Skip to content

Commit 9561bbd

Browse files
committed
Add COLLATE clause parsing for column definitions
- Add COLLATE handling in parseColumnDefinition - Add Collation field output in columnDefinitionToJSON
1 parent 5081feb commit 9561bbd

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

parser/marshal.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,6 +3306,9 @@ func (p *Parser) parseColumnDefinition() (*ast.ColumnDefinition, error) {
33063306
}
33073307
// Continue to parse actual constraint in next iteration
33083308
continue
3309+
} else if upperLit == "COLLATE" {
3310+
p.nextToken() // consume COLLATE
3311+
col.Collation = p.parseIdentifier()
33093312
} else {
33103313
break
33113314
}
@@ -4416,6 +4419,9 @@ func columnDefinitionToJSON(c *ast.ColumnDefinition) jsonNode {
44164419
if c.DataType != nil {
44174420
node["DataType"] = dataTypeReferenceToJSON(c.DataType)
44184421
}
4422+
if c.Collation != nil {
4423+
node["Collation"] = identifierToJSON(c.Collation)
4424+
}
44194425
return node
44204426
}
44214427

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)