Skip to content

Commit 20d3016

Browse files
kyleconroyclaude
andcommitted
Allow keywords as column names in ALTER TABLE DROP COLUMN
- Handle cases where column name is a keyword (e.g., alias) - Apply same fix to dotted column names Fixes 01269_alias_type_differs/stmt6 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a9e48cb commit 20d3016

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

parser/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5459,13 +5459,13 @@ func (p *Parser) parseAlterCommand() *ast.AlterCommand {
54595459
p.expect(token.EXISTS)
54605460
cmd.IfExists = true
54615461
}
5462-
if p.currentIs(token.IDENT) {
5462+
if p.currentIs(token.IDENT) || p.current.Token.IsKeyword() {
54635463
// Handle dotted column names like NestedColumn.A
54645464
colName := p.current.Value
54655465
p.nextToken()
54665466
for p.currentIs(token.DOT) {
54675467
p.nextToken() // skip DOT
5468-
if p.currentIs(token.IDENT) {
5468+
if p.currentIs(token.IDENT) || p.current.Token.IsKeyword() {
54695469
colName += "." + p.current.Value
54705470
p.nextToken()
54715471
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt6": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)