Skip to content

Commit 2b75bea

Browse files
Ajit Pratap SinghAjit Pratap Singh
authored andcommitted
fix: add boolean literal support to INSERT VALUES parsing
The parser's INSERT statement handler only supported STRING, INT, and FLOAT literals in VALUES clause. Added support for TRUE/FALSE tokens to match the functionality already present in UPDATE statement parsing. This fixes validation errors on INSERT statements with boolean values like: INSERT INTO users (name, email, active) VALUES ('John', 'john@example.com', true);
1 parent 8d739ee commit 2b75bea

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/sql/parser/parser.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,9 @@ func (p *Parser) parseInsertStatement() (ast.Statement, error) {
12021202
case "FLOAT":
12031203
expr = &ast.LiteralValue{Value: p.currentToken.Literal, Type: "float"}
12041204
p.advance()
1205+
case token.TRUE, token.FALSE:
1206+
expr = &ast.LiteralValue{Value: p.currentToken.Literal, Type: "bool"}
1207+
p.advance()
12051208
default:
12061209
return nil, fmt.Errorf("unexpected token for value: %s", p.currentToken.Type)
12071210
}

0 commit comments

Comments
 (0)