-
Notifications
You must be signed in to change notification settings - Fork 611
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
(MODULES-1834) Be less strict when changing template1 encoding #579
Conversation
We currently use: UTF8 != UTF-8 We should instead use: pg_char_to_encoding(UTF8) == pg_char_to_encoding(UTF-8)
👍 from me! |
cool! |
@@ -94,7 +94,7 @@ | |||
SET encoding = pg_char_to_encoding('${encoding}'), datistemplate = TRUE | |||
WHERE datname = 'template1'", | |||
unless => "SELECT datname FROM pg_database WHERE | |||
datname = 'template1' AND pg_encoding_to_char(encoding) = '${encoding}'", | |||
datname = 'template1' AND encoding = pg_char_to_encoding('${encoding}')", |
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 guessing that postgresql already normalises encoding, which is why you're not passing both of those to the function, as per your comment/commit message, i.e.:
datname = 'template1' AND pg_encoding_to_char(encoding) = pg_char_to_encoding('${encoding}')
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.
encoding is an integer here. No need to normalize it.
Example:
postgres=# SELECT encoding from pg_database;
encoding
----------
6
6
6
6
6
6
6
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.
ah. duh ._.
(MODULES-1834) Be less strict when changing template1 encoding
Thanks @sathieu ! |
(MODULES-1834) Be less strict when changing template1 encoding
We currently use: UTF8 != UTF-8
We should instead use: pg_char_to_encoding(UTF8) == pg_char_to_encoding(UTF-8)