Thread: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate

pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate

From
Michael Paquier
Date:
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.GB1998@paquier.xyz
Backpatch-through: 9.5

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/240c7c75f3a9946509c9c6f9f5062b56cec627ae

Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)