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

(MODULES-1834) Be less strict when changing template1 encoding #579

Merged
merged 1 commit into from
Mar 12, 2015

Conversation

sathieu
Copy link
Contributor

@sathieu sathieu commented Mar 10, 2015

We currently use: UTF8 != UTF-8
We should instead use: pg_char_to_encoding(UTF8) == pg_char_to_encoding(UTF-8)

We currently use: UTF8 != UTF-8
We should instead use: pg_char_to_encoding(UTF8) == pg_char_to_encoding(UTF-8)
@antaflos
Copy link
Contributor

👍 from me!

@igalic
Copy link
Contributor

igalic commented Mar 11, 2015

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}')",
Copy link
Contributor

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}')

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

ah. duh ._.

underscorgan pushed a commit that referenced this pull request Mar 12, 2015
(MODULES-1834) Be less strict when changing template1 encoding
@underscorgan underscorgan merged commit d348cdb into puppetlabs:master Mar 12, 2015
@underscorgan
Copy link
Contributor

Thanks @sathieu !

@sathieu sathieu deleted the template_encoding branch January 11, 2017 12:10
cegeka-jenkins pushed a commit to cegeka/puppet-postgresql that referenced this pull request Oct 23, 2017
(MODULES-1834) Be less strict when changing template1 encoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants