Skip to content

Commit 6538173

Browse files
committed
Enable CreateHekatonTriggerStatementTest with asterisk wildcard and string value fixes
- Add support for TokenStar (asterisk) as a wildcard ColumnReferenceExpression in parsePrimaryExpression, fixing count(*) parsing in function calls - Fix LiteralAtomicBlockOption value parsing to strip N prefix and quotes from national strings in BEGIN ATOMIC block options
1 parent ec1883d commit 6538173

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

parser/parse_select.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,10 @@ func (p *Parser) parsePrimaryExpression() (ast.ScalarExpression, error) {
689689
return p.parsePostExpressionAccess(&ast.ParenthesisExpression{Expression: expr})
690690
case TokenCase:
691691
return p.parseCaseExpression()
692+
case TokenStar:
693+
// Wildcard column reference (e.g., * in count(*))
694+
p.nextToken()
695+
return &ast.ColumnReferenceExpression{ColumnType: "Wildcard"}, nil
692696
default:
693697
return nil, fmt.Errorf("unexpected token in expression: %s", p.curTok.Literal)
694698
}

parser/parse_statements.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,19 @@ func (p *Parser) parseBeginAtomicBlockStatement() (*ast.BeginEndAtomicBlockState
993993
case "LANGUAGE":
994994
// Parse the language value
995995
if p.curTok.Type == TokenString || p.curTok.Type == TokenNationalString {
996+
value := p.curTok.Literal
997+
isNational := p.curTok.Type == TokenNationalString
998+
// Strip the N prefix and quotes from national strings
999+
if isNational && len(value) >= 3 && (value[0] == 'N' || value[0] == 'n') && value[1] == '\'' {
1000+
value = value[2 : len(value)-1]
1001+
} else if len(value) >= 2 && value[0] == '\'' {
1002+
// Strip quotes from regular strings
1003+
value = value[1 : len(value)-1]
1004+
}
9961005
strLit := &ast.StringLiteral{
9971006
LiteralType: "String",
998-
Value: p.curTok.Literal,
999-
IsNational: p.curTok.Type == TokenNationalString,
1007+
Value: value,
1008+
IsNational: isNational,
10001009
IsLargeObject: false,
10011010
}
10021011
p.nextToken()
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)