Skip to content

Commit df16bfc

Browse files
committed
Add pseudo column parsing for $ACTION, $CUID, $ROWGUID
Handle pseudo columns in INSERT column list with proper ColumnType: - $ACTION -> PseudoColumnAction - $CUID -> PseudoColumnCuid - $ROWGUID -> PseudoColumnRowGuid Enable Baselines100_InsertStatementTests100 and InsertStatementTests100 tests.
1 parent d06e080 commit df16bfc

3 files changed

Lines changed: 20 additions & 6 deletions

File tree

parser/parse_dml.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,25 @@ func (p *Parser) parseColumnList() ([]*ast.ColumnReferenceExpression, error) {
656656

657657
var cols []*ast.ColumnReferenceExpression
658658
for p.curTok.Type != TokenRParen && p.curTok.Type != TokenEOF {
659-
col, err := p.parseMultiPartIdentifierAsColumn()
660-
if err != nil {
661-
return nil, err
659+
// Check for pseudo columns
660+
lit := p.curTok.Literal
661+
upperLit := strings.ToUpper(lit)
662+
if upperLit == "$ACTION" {
663+
cols = append(cols, &ast.ColumnReferenceExpression{ColumnType: "PseudoColumnAction"})
664+
p.nextToken()
665+
} else if upperLit == "$CUID" {
666+
cols = append(cols, &ast.ColumnReferenceExpression{ColumnType: "PseudoColumnCuid"})
667+
p.nextToken()
668+
} else if upperLit == "$ROWGUID" {
669+
cols = append(cols, &ast.ColumnReferenceExpression{ColumnType: "PseudoColumnRowGuid"})
670+
p.nextToken()
671+
} else {
672+
col, err := p.parseMultiPartIdentifierAsColumn()
673+
if err != nil {
674+
return nil, err
675+
}
676+
cols = append(cols, col)
662677
}
663-
cols = append(cols, col)
664678

665679
if p.curTok.Type != TokenComma {
666680
break
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)