Skip to content

Commit f3ddb56

Browse files
committed
Handle SYSTEM RESTORE REPLICA command parsing
Add RESTORE to system command keywords so it's not parsed as a table name. Also add RESTORE REPLICA to the list of commands that output the table name twice in EXPLAIN AST. Fixes stmt11 and stmt12 in 03168_attach_as_replicated_materialized_view.
1 parent 4f40523 commit f3ddb56

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

parser/parser.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6771,6 +6771,7 @@ func (p *Parser) parseSystem() *ast.SystemQuery {
67716771
upperCmd := strings.ToUpper(sys.Command)
67726772
if strings.Contains(upperCmd, "RELOAD DICTIONARY") ||
67736773
strings.Contains(upperCmd, "DROP REPLICA") ||
6774+
strings.Contains(upperCmd, "RESTORE REPLICA") ||
67746775
strings.Contains(upperCmd, "STOP DISTRIBUTED SENDS") ||
67756776
strings.Contains(upperCmd, "START DISTRIBUTED SENDS") ||
67766777
strings.Contains(upperCmd, "FLUSH DISTRIBUTED") {
@@ -6803,7 +6804,7 @@ func (p *Parser) parseSystem() *ast.SystemQuery {
68036804
func (p *Parser) isSystemCommandKeyword() bool {
68046805
switch p.current.Token {
68056806
case token.TTL, token.SYNC, token.DROP, token.FORMAT, token.FOR, token.INDEX, token.INSERT,
6806-
token.PRIMARY, token.KEY, token.DISTRIBUTED:
6807+
token.PRIMARY, token.KEY, token.DISTRIBUTED, token.RESTORE:
68076808
return true
68086809
}
68096810
// Handle identifiers that are part of SYSTEM commands (not table names)
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt11": true,
4-
"stmt12": true
5-
}
6-
}
1+
{}

0 commit comments

Comments
 (0)