Skip to content

Commit 90ff84d

Browse files
kyleconroyclaude
andcommitted
Add REMOVE TTL support for ALTER TABLE
Parse ALTER TABLE ... REMOVE TTL command and output the correct REMOVE_TTL command type in EXPLAIN output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 98e6e8e commit 90ff84d

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

ast/ast.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ const (
678678
AlterDropConstraint AlterCommandType = "DROP_CONSTRAINT"
679679
AlterModifyTTL AlterCommandType = "MODIFY_TTL"
680680
AlterMaterializeTTL AlterCommandType = "MATERIALIZE_TTL"
681+
AlterRemoveTTL AlterCommandType = "REMOVE_TTL"
681682
AlterModifySetting AlterCommandType = "MODIFY_SETTING"
682683
AlterResetSetting AlterCommandType = "RESET_SETTING"
683684
AlterDropPartition AlterCommandType = "DROP_PARTITION"

parser/parser.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5729,6 +5729,10 @@ func (p *Parser) parseAlterCommand() *ast.AlterCommand {
57295729
p.nextToken() // skip BY
57305730
}
57315731
cmd.Type = ast.AlterRemoveSampleBy
5732+
} else if p.currentIs(token.TTL) {
5733+
// REMOVE TTL (table-level TTL)
5734+
p.nextToken() // skip TTL
5735+
cmd.Type = ast.AlterRemoveTTL
57325736
}
57335737
} else if upper == "RESET" {
57345738
p.nextToken() // skip RESET
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt24": true
4-
}
5-
}
1+
{}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt34": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)