createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
authorMichael Paquier <[email protected]>
Thu, 27 Feb 2020 02:21:28 +0000 (11:21 +0900)
committerMichael Paquier <[email protected]>
Thu, 27 Feb 2020 02:21:28 +0000 (11:21 +0900)
commit49300e4cf2da9988eb5caa94f18779cfa72ec698
tree6e35842cc63b5e6876cae6c7a2ca585d2f915a4f
parentbbefb11541890d9add4b3b1ab2c53b26f4fc386b
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate

The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used.  As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.

Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004[email protected]
Backpatch-through: 9.5
src/bin/scripts/createdb.c