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

Michael Paquier <michael@paquier.xyz>

Commit: 943affb3d1db38ba0960ee9a0666ea2598b78f1f
Author: Michael Paquier <michael@paquier.xyz>
Date: 2020-02-27T02:21:00Z
Releases: 12.3
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

Files

PathChange+/−
src/bin/scripts/createdb.c modified +19 −10
src/bin/scripts/t/020_createdb.pl modified +25 −1

Discussion