PostgreSQL script updates (UTF-8, SERIAL PKs and case-insensitive identifiers) #3
Merged
lerocha merged 5 commits intolerocha:developfrom Feb 10, 2024
Merged
PostgreSQL script updates (UTF-8, SERIAL PKs and case-insensitive identifiers) #3lerocha merged 5 commits intolerocha:developfrom
lerocha merged 5 commits intolerocha:developfrom
Conversation
Double-quoted identifiers are case-sensitive in PostgreSQL. This poses a problem when writing queries in programming languages like Java as one *must* use double-quotes around identifiers, this (could) make queries hard to write, read, maintain, etc.
…ences Not sure if it works or not, unfortunately I couldn't test it.
Contributor
Author
|
@lerocha do you mind if I ask do you intend to merge this or any similar PRs in the future? |
|
@kohanyirobert Thank you for the work! Helped a lot! |
lerocha
approved these changes
Feb 10, 2024
Owner
lerocha
left a comment
There was a problem hiding this comment.
@kohanyirobert Thank you for your contribution and sorry for such a delay since this project has been inactive for many years and I'm just back to it.
I like the idea of the SERIAL identifier. One note that these files are auto-generated and not manually edited, so I will merge them and will work on updating the text templates (ChinookDatabase.tt) and strategies to auto-generate the SERIAL PK version. The other issues have already been addressed.
Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've updated the original PostgreSQL script in three-steps.
The case-insensitive version of the script is useful if the DB is used with a language like Java where strings are by default use double-quotes. If identifiers are double-quoted in PostgreSQL it's burdensome to write queries, because one would need to wrap identifiers in double-quotes leading to stuff like
String sql = "SELECT * FROM \"Customer\"";which soon becomes error-prone.