Skip to content

Commit 9e75fd9

Browse files
kyleconroyclaude
andcommitted
Add nested paren table ref handling and VariableTableReference alias marshaling
- Handle nested parentheses in FROM clause that contain derived tables with aliases and JOINs (e.g., ((SELECT ...) AS t10 INNER JOIN ...)) - Add Alias field marshaling for VariableTableReference in tableReferenceToJSON - Add support for bracketed identifiers as aliases for VariableTableReference - Enables BaselinesCommon_FromClauseTests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0081e36 commit 9e75fd9

4 files changed

Lines changed: 560 additions & 10 deletions

File tree

ast/table_reference.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ type TableReference interface {
55
Node
66
tableReference()
77
}
8+
9+
// OdbcQualifiedJoinTableReference represents an ODBC qualified join syntax: { OJ ... }
10+
type OdbcQualifiedJoinTableReference struct {
11+
TableReference TableReference
12+
}
13+
14+
func (o *OdbcQualifiedJoinTableReference) node() {}
15+
func (o *OdbcQualifiedJoinTableReference) tableReference() {}

parser/marshal.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2785,13 +2785,24 @@ func tableReferenceToJSON(ref ast.TableReference) jsonNode {
27852785
node["Join"] = tableReferenceToJSON(r.Join)
27862786
}
27872787
return node
2788+
case *ast.OdbcQualifiedJoinTableReference:
2789+
node := jsonNode{
2790+
"$type": "OdbcQualifiedJoinTableReference",
2791+
}
2792+
if r.TableReference != nil {
2793+
node["TableReference"] = tableReferenceToJSON(r.TableReference)
2794+
}
2795+
return node
27882796
case *ast.VariableTableReference:
27892797
node := jsonNode{
27902798
"$type": "VariableTableReference",
27912799
}
27922800
if r.Variable != nil {
27932801
node["Variable"] = scalarExpressionToJSON(r.Variable)
27942802
}
2803+
if r.Alias != nil {
2804+
node["Alias"] = identifierToJSON(r.Alias)
2805+
}
27952806
node["ForPath"] = r.ForPath
27962807
return node
27972808
case *ast.VariableMethodCallTableReference:

0 commit comments

Comments
 (0)