-
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
sql: automatic way to ensure new sql keyword is added to bare_label_keywords
list
#84309
Comments
I don't know which project I should add to this issue...so I just attached my team. |
Thanks for the issue. What's the impact of forgetting to add the keyword to |
@rafiss adding new keyword without adding to |
Maybe some kind of test that automatically tries to parse |
As revealed by cockroachdb#84309, some keywords not added to `bare_label_keywords` in `sql.y` will make the `SELECT ... <keyword>` statement error out, which is not compatible with postgres. This commit is to add the `QUERY` keyword per a support ticket. We're not adding the whole `unreserved_keyword` list here as having some of them in `bare_label_keyword`, such as `DAY`, bring `reduce` errors. Postgres: ``` postgres=# select substring('stringstringstring',1,10) query; query ------------ stringstri (1 row) ``` CRDB: ``` root@localhost:26257/defaultdb> select substring('stringstringstring',1,10) query; invalid syntax: statement ignored: at or near "query": syntax error SQLSTATE: 42601 DETAIL: source SQL: select substring('stringstringstring',1,10) query ^ ``` informs cockroachdb#84309 Release Note(bug fix): fixed the syntax error for `SELECT ... QUERY` (without AS) statement.
As revealed by cockroachdb#84309, some keywords not added to `bare_label_keywords` in `sql.y` will make the `SELECT ... <keyword>` statement error out, which is not compatible with postgres. This commit is to add the `QUERY` keyword per a support ticket. We're not adding the whole `unreserved_keyword` list here as having some of them in `bare_label_keyword`, such as `DAY`, bring `reduce` errors. Postgres: ``` postgres=# select substring('stringstringstring',1,10) query; query ------------ stringstri (1 row) ``` CRDB: ``` root@localhost:26257/defaultdb> select substring('stringstringstring',1,10) query; invalid syntax: statement ignored: at or near "query": syntax error SQLSTATE: 42601 DETAIL: source SQL: select substring('stringstringstring',1,10) query ^ ``` informs cockroachdb#84309 Release Note(bug fix): fixed the syntax error for `SELECT ... QUERY` (without AS) statement.
96295: changefeedccl: Rename and remove CDC functions r=miretskiy a=miretskiy This PR renames and removes CDC specific functions, while maintaining backward compatability. * `cdc_is_delete()` function removed. It is replaced with `event_op()` function which returns a string describing the type of event. If the changefeed is running with `diff` option, then this function returns `insert`, `update`, or `delete`. If changefeed is running without the `diff` option, we can't tell an update from insert, so this function returns `upsert` or `delete`. * `cdc_mvcc_timestamp()` function removed. This information can be accessed via cockroach standard system column `crdb_internal_mvcc_timestamp`. The same timestamp column is avaiable in the previous row state `(cdc_prev).crdb_internal_mvcc_timestamp` * `cdc_updated_timestamp()` function renamed as `event_schema_timestamp()` Fixes #92482 Epic: CRDB-17161 Release note (enterprise change): Deprecate and replace some of the changefeed specific functions made available in preview mode in 22.2 release. While these functions are deprecated, old changefeed transformations should continue to function properly. Customers are encouraged to closely monitor their changefeeds created during upgrade. While effort was made to maintain backward compatibility, the updated changefeed transformation may produce slightly different output (different column names, etc). 97041: parser: add `QUERY` to `bare_label_keyword` r=ZhouXing19 a=ZhouXing19 As revealed by #84309, some keywords not added to `bare_label_keywords` in `sql.y` make the `SELECT ... <keyword>` statement error out, which is not compatible with postgres. This commit is to add the `QUERY` keyword per a support ticket. We're not adding the whole `unreserved_keyword` list here as having some of them in `bare_label_keyword`, such as `DAY`, brings `reduce` errors. Postgres: ``` postgres=# select substring('stringstringstring',1,10) query; query ------------ stringstri (1 row) ``` CRDB: ``` root@localhost:26257/defaultdb> select substring('stringstringstring',1,10) query; invalid syntax: statement ignored: at or near "query": syntax error SQLSTATE: 42601 DETAIL: source SQL: select substring('stringstringstring',1,10) query ^ ``` informs #84309 Release Note(bug fix): fixed the syntax error for `SELECT ... QUERY` (without AS) statement. 97134: storage: include version in benchmark fixture directory r=RaduBerinde a=RaduBerinde This benchmark is sometimes failing in CI and I cannot reproduce locally. The error is consistent with a leftover fixture from an older version (which shouldn't happen because CI should be cleaning up the repo). This change adds the version to the fixture name so that this kind of cross-version problem cannot occur. This is a good idea regardless of the CI issue. Informs #97061 Release note: None Epic: none 97149: sql: add missing STORING clause in system.privileges user ID migration r=rafiss a=andyyang890 This patch fixes a discrepancy between the bootstrap schema and user ID migration for the system.privileges table. Part of #87079 Release note: None Co-authored-by: Yevgeniy Miretskiy <[email protected]> Co-authored-by: Jane Xing <[email protected]> Co-authored-by: Radu Berinde <[email protected]> Co-authored-by: Andy Yang <[email protected]>
As revealed by #84309, some keywords not added to `bare_label_keywords` in `sql.y` will make the `SELECT ... <keyword>` statement error out, which is not compatible with postgres. This commit is to add the `QUERY` keyword per a support ticket. We're not adding the whole `unreserved_keyword` list here as having some of them in `bare_label_keyword`, such as `DAY`, bring `reduce` errors. Postgres: ``` postgres=# select substring('stringstringstring',1,10) query; query ------------ stringstri (1 row) ``` CRDB: ``` root@localhost:26257/defaultdb> select substring('stringstringstring',1,10) query; invalid syntax: statement ignored: at or near "query": syntax error SQLSTATE: 42601 DETAIL: source SQL: select substring('stringstringstring',1,10) query ^ ``` informs #84309 Release Note(bug fix): fixed the syntax error for `SELECT ... QUERY` (without AS) statement.
Describe the solution you'd like
Adding new keyword could break user queries which use column labels without
AS
. We added thebare_label_keywords
list to allow those keywords to be used as column labels. However, it's easy to forget to add the keyword. We need to an automatic way to validate all newly added keywords are added to this list.We could auto generate code to validate that, for example we're already doing similar thing when generating this list. The hard part could be how do we know a keyword is newly added? One alternative is to add all keywords (including existing ones) to this list, and the automatic check just need to make sure all keywords are added.
Jira issue: CRDB-17582
The text was updated successfully, but these errors were encountered: