-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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-23.1: sql: fix formatting of export and changefeed #108314
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:
|
Informs: cockroachdb#99185 This commit cherry-picked changes from cockroachdb#107892. Release note: None Fixes: cockroachdb#108254 and cockroachdb#108233 (partially) Release justification: fixes bug with random syntax generation
476a8d1
to
7ed0bda
Compare
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.
LGTM! The change itself looks good to me, but can you explain how it fixes the randomized test? Just for my own understanding.
I'm also curious... We always supported |
@jayshrivastava from my understanding, TestRandomSyntaxGeneration has failed before with the same pattern - this is a very specific case due to the fact that a cockroach/pkg/sql/parser/lexer.go Lines 245 to 249 in da6a7c4
CREATE CHANGEFEED ... WITH_LA bucket_count; is actually the statement that is being parsed - causing the syntax error that we see:
@miretskiy that's a good question - |
Yes, otherwise #108254 will continue failing. In general, it's a good idea to make sure any statement can roundtrip format->parse->format. In some cases, that is actually critical. |
#108254 fails because this SQL
Formats to
The latter cannot be parsed because it uses a reserved keyword
I think the real problem is that both statements (with and without brackets) should be equivalent, but they are not. One can be parsed and the other cannot. |
Actually on second thought, maybe they aren't equivalent. Using brackets allows you to pass in reserved keywords and missing brackets does not let you pass them in. Nevertheless, I think it's better to format the statement using brackets because we would want formatting to produce the most a parseable output. |
Informs: #99185
This commit cherry-picked changes from #107892.
Release note: None
Fixes: #108254 and #108233 (partially)
Release justification: fixes bug with random syntax generation