-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
release-22.2: sql: fix formatting of import, backup and alter tenant #107185
release-22.2: sql: fix formatting of import, backup and alter tenant #107185
Conversation
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
191ecb4
to
d7824b8
Compare
Seems like we may need this on |
d7824b8
to
37223d2
Compare
Fixes: cockroachdb#95618 This commit is trying to fix 2 things found in the TestRandomSyntaxGeneration failures: 1. TenenatID expr in `ALTER TENANT` and `SHOW ... FOR TENANT` should be formatted as being wrapped with parenthesises. This was fixed in 23.1. The idea is copied from there. 2. IMPORT/BACKUP options are formatted without being wrapped with `OPTIONS ()`. This sometimes got confused with other `WITH SOME_KEYWORD = xxx` syntax, for example `WITH BUCkET_COUNT = 123`. Release note: None Release justification: test fixes
37223d2
to
9e4bdc6
Compare
@rafiss yes, I'll apply some of the changes in this PR 23.1 and master as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @chengxiong-ruan)
pkg/sql/sem/tree/tenant_settings.go
line 90 at r1 (raw file):
// all the d_expr expression *types*. We can only do so for a few // types for which we know that *all possible objects* of that type // are well-delimited, such as Subquery, NumVal or Placeholder.
very nice explanation!
maybe the multi-tenant team should be aware? it seems that ALTER TENANT
and SHOW CLUSTER SETTINGS FOR TENANT
are the only statements affected by this problem?
pkg/sql/sem/tree/tenant_settings.go
line 109 at r1 (raw file):
ctx.WriteString(" FOR TENANT ") _, canOmitParentheses := node.TenantID.(alreadyDelimitedAsSyntacticDExpr) if !canOmitParentheses {
just want to understand better: what is the problem if we always add the parenthesis here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @knz and @rafiss)
pkg/sql/sem/tree/tenant_settings.go
line 90 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
very nice explanation!
maybe the multi-tenant team should be aware? it seems that
ALTER TENANT
andSHOW CLUSTER SETTINGS FOR TENANT
are the only statements affected by this problem?
hehe, I stole this from master. Huge credits to @knz who added that. But yes.
pkg/sql/sem/tree/tenant_settings.go
line 109 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
just want to understand better: what is the problem if we always add the parenthesis here?
good question, I think it's fine, but just looking weird in some cases, for example (NULL)
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @chengxiong-ruan and @knz)
pkg/sql/sem/tree/tenant_settings.go
line 109 at r1 (raw file):
Previously, chengxiong-ruan (Chengxiong Ruan) wrote…
good question, I think it's fine, but just looking weird in some cases, for example
(NULL)
...
ah OK, if the team already decided on fixing it this way on master
then i suppose we should do that here too instead of always adding parentheses.
Informs: cockroachdb#99183 Similar to cockroachdb#107185, this commit wraps option formatting of import, backup and restore statement with `()`. Also wrap replcation expression with `()` in `create tenant from replication` statements. Release note: None
Fixes: #95618
This commit is trying to fix 2 things found in the TestRandomSyntaxGeneration failures:
ALTER TENANT
andSHOW ... FOR TENANT
should be formatted as being wrapped with parenthesises. This was fixed in 23.1. The idea is copiedfrom there.
OPTIONS ()
. This sometimes got confused with otherWITH SOME_KEYWORD = xxx
syntax, for exampleWITH BUCkET_COUNT = 123
.Release note: None
Release justification: test fixes