-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support long database names in PostgreSQL 17.x #6059
base: release24.11-SNAPSHOT
Are you sure you want to change the base?
Conversation
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.
I'm OK with this change, though it seems wiser to stop generating ones that are so long.
Co-authored-by: Josh Eckels <[email protected]>
|
Agreed; it seems bad to just silently truncate to something other than what the configuration specifies. I presume the Postgres folks made the same conclusion. |
I filed an issue with the PostgreSQL team given the long-standing truncation behavior, the now inconsistent behavior (CREATE and ALTER DATABASE work fine, but connecting fails), and the lack of any mention in the release notes... while fully acknowledging that we were relying on undocumented behavior and we can easily work around this. Once TeamCity is using shorter database names I can remove the code that truncates and futzes with the URL in the DataSource. The rest of this PR (having the dialect report the actual max length instead of guessing what callers might do) seems worthwhile, so I'll merge it eventually. @labkey-tchad The current truncation code should allow us to start testing on PostgreSQL 17.x without adjusting those names. Can you enable PG 17 on this branch? |
Rationale
PostgreSQL used to accept database names longer than 63 characters, truncating them for all operations. As of 17.x, it now fails to connect when the database name is too long. TeamCity uses very long database names, so we now truncate and replace the URL in the
DataSource
to maintain previous behavior. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=51676Also, change
getIdentifierMaxLength()
to report the database's actual limit. Previously, the dialect reported two or three characters less than the actual limit (we were inconsistent) in an attempt to help callers that might be adding suffixes. Seems like the dialect should just report the facts; callers are now responsible for respecting the database-imposed limit.