Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: another syntax hint for ALTER PARTITION #40812

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/sql/parser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,14 @@ DETAIL: source SQL:
CREATE STATISTICS a ON col1 FROM t WITH OPTIONS AS OF SYSTEM TIME '-1s' THROTTLING 0.1 AS OF SYSTEM TIME '-2s'
^`,
},
{
`ALTER PARTITION p OF TABLE tbl@idx CONFIGURE ZONE USING num_replicas = 1`,
`at or near "idx": syntax error: index name should not be specified in ALTER PARTITION ... OF TABLE
DETAIL: source SQL:
ALTER PARTITION p OF TABLE tbl@idx CONFIGURE ZONE USING num_replicas = 1
^
HINT: try ALTER PARTITION ... OF INDEX`,
},
{
`ALTER PARTITION p OF TABLE tbl@* CONFIGURE ZONE USING num_replicas = 1`,
`at or near "configure": syntax error: index wildcard unsupported in ALTER PARTITION ... OF TABLE
Expand Down
6 changes: 6 additions & 0 deletions pkg/sql/parser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,12 @@ alter_zone_partition_stmt:
s.AllIndexes = true
$$.val = s
}
| ALTER PARTITION partition_name OF TABLE table_name '@' error
{
err := errors.New("index name should not be specified in ALTER PARTITION ... OF TABLE")
err = errors.WithHint(err, "try ALTER PARTITION ... OF INDEX")
return setErr(sqllex, err)
}
| ALTER PARTITION partition_name OF TABLE table_name '@' '*' error
{
err := errors.New("index wildcard unsupported in ALTER PARTITION ... OF TABLE")
Expand Down