Skip to content
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

PostgreSQL script updates (UTF-8, SERIAL PKs and case-insensitive identifiers) #3

Merged
merged 5 commits into from
Feb 10, 2024

Conversation

kohanyirobert
Copy link
Contributor

I've updated the original PostgreSQL script in three-steps.

  1. Changed it's encoding to UTF-8.
  2. Created an alternative script that uses SERIAL primary keys instead of hard-coded ones.
  3. Created an alternative script which uses case-insensitive identifiers - I've did this for both the non-SERIAL and the SERIAL PK version of the script.
  4. Updated the batch files and references here and there to include these new scripts (the best that I could, I wasn't able to run the tests and such).

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.

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.
@kohanyirobert
Copy link
Contributor Author

kohanyirobert commented Apr 12, 2022

@lerocha do you mind if I ask do you intend to merge this or any similar PRs in the future?

@russo-matrosso
Copy link

russo-matrosso commented Apr 9, 2023

@kohanyirobert Thank you for the work! Helped a lot!

@lerocha lerocha changed the base branch from master to develop February 10, 2024 19:17
@lerocha lerocha self-assigned this Feb 10, 2024
Copy link
Owner

@lerocha lerocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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!

@lerocha lerocha merged commit adfd7ea into lerocha:develop Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants