Fix template1 encoding on debian
This commit is contained in:
parent
0daf411a3e
commit
e1034d9bee
1 changed files with 16 additions and 0 deletions
|
@ -80,5 +80,21 @@ class postgresql::server::initdb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elsif $encoding != undef {
|
||||||
|
# [workaround]
|
||||||
|
# by default pg_createcluster encoding derived from locale
|
||||||
|
# but it do does not work by installing postgresql via puppet because puppet
|
||||||
|
# always override LANG to 'C'
|
||||||
|
postgresql_psql { "Set template1 encoding to ${encoding}":
|
||||||
|
command => "UPDATE pg_database
|
||||||
|
SET datistemplate = FALSE
|
||||||
|
WHERE datname = 'template1'
|
||||||
|
;
|
||||||
|
UPDATE pg_database
|
||||||
|
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}'",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue