Skip to content

Commit f3693fc

Browse files
committed
Add $ROWGUID pseudo-column support and enable MiscTests100 tests
- Extend lexer to recognize $ as identifier start when followed by a letter (for pseudo-columns like $ROWGUID) - Add PseudoColumnRowGuid handling in parseAssignmentSetClause for UPDATE SET $ROWGUID = ... syntax - Enable Baselines100_MiscTests100 and MiscTests100 tests
1 parent f6a4e57 commit f3693fc

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

parser/lexer.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,10 @@ func (l *Lexer) NextToken() Token {
466466
case '\'':
467467
tok = l.readString()
468468
default:
469-
if isLetter(l.ch) || l.ch == '_' || l.ch == '@' || l.ch == '#' {
469+
// Handle $ only if followed by a letter (for pseudo-columns like $ROWGUID)
470+
if l.ch == '$' && isLetter(l.peekChar()) {
471+
tok = l.readIdentifier()
472+
} else if isLetter(l.ch) || l.ch == '_' || l.ch == '@' || l.ch == '#' {
470473
tok = l.readIdentifier()
471474
} else if isDigit(l.ch) {
472475
tok = l.readNumber()
@@ -516,7 +519,7 @@ func (l *Lexer) skipWhitespaceAndComments() {
516519

517520
func (l *Lexer) readIdentifier() Token {
518521
startPos := l.pos
519-
for isLetter(l.ch) || isDigit(l.ch) || l.ch == '_' || l.ch == '@' || l.ch == '#' {
522+
for isLetter(l.ch) || isDigit(l.ch) || l.ch == '_' || l.ch == '@' || l.ch == '#' || l.ch == '$' {
520523
l.readChar()
521524
}
522525
literal := l.input[startPos:l.pos]

parser/parse_dml.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,12 +832,20 @@ func (p *Parser) parseAssignmentSetClause() (*ast.AssignmentSetClause, error) {
832832
}
833833
}
834834

835-
// col = value or col ||= value
836-
col, err := p.parseMultiPartIdentifierAsColumn()
837-
if err != nil {
838-
return nil, err
835+
// Check for $ROWGUID pseudo-column
836+
if p.curTok.Type == TokenIdent && strings.EqualFold(p.curTok.Literal, "$ROWGUID") {
837+
clause.Column = &ast.ColumnReferenceExpression{
838+
ColumnType: "PseudoColumnRowGuid",
839+
}
840+
p.nextToken()
841+
} else {
842+
// col = value or col ||= value
843+
col, err := p.parseMultiPartIdentifierAsColumn()
844+
if err != nil {
845+
return nil, err
846+
}
847+
clause.Column = col
839848
}
840-
clause.Column = col
841849

842850
if p.isCompoundAssignment() {
843851
clause.AssignmentKind = p.getAssignmentKind()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"todo": true}
1+
{}

0 commit comments

Comments
 (0)