-
Notifications
You must be signed in to change notification settings - Fork 17
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
Diff uppercases fields if they match a reserved word in CREATE INDEX statement #35
Comments
The problem seems to be that now the code always uses ASTTreeUtils.tokensToString which does not distinguish between column names and keywords. |
It is impossible to fix this fully, as this tool does not include a full SQL parser/validator... #60 will include a partial fix which preserves case of column names in most of the places where they are used in DDL. However there will always be cases where reserved words will be still capitalized -- such as in the SQL expressions in CHECK constraints and generated columns. The workaround is to quote the column name in backticks: |
#67 fixes the second part of this -- SQL expressions no longer uppercase reserved words. This does mean that if there is a difference in case between old and new SQL expressions (check constraints, generated columns) -- eg |
Thanks! I am not sure about the workaround.. I have tried this but seems then it will also add the backticks to the column names. |
The output incorrectly capitalizes fields in output statements if they match a reserved word.
Example:
Given the schmea test.ddl:
And a black original.ddl.
Then, running
java -jar target/spanner-ddl-diff-1.0-jar-with-dependencies.jar --allowRecreateIndexes --originalDdlFile original.ddl --newDdlFile test.ddl --outputDdlFile alter.ddl
results in
Note the capital "KEY" fields instead of "key".
Expected output (as in the old version):
I did a bisection and this change was introduced in commit 5a72ed3
The text was updated successfully, but these errors were encountered: