Rationalize handling of single and double quotes in bootstrap data.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Apr 2018 23:53:50 +0000 (19:53 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Apr 2018 23:53:50 +0000 (19:53 -0400)
commit55d26ff638f063fbccf57843f2c27f9795895a5c
treebb094186f374620288b702217f8c26280dc9f719
parent9ffcccdb958d38db5051bf64143330ff445a26cc
Rationalize handling of single and double quotes in bootstrap data.

Change things around so that proper quoting of values interpolated into
the BKI data by initdb is the responsibility of initdb, not something
we half-heartedly handle by putting double quotes into the raw BKI data.
(Note: experimentation shows that it still doesn't work to put a double
quote into the initial superuser username, but that's the fault of
inadequate quoting while interpolating the name into SQL scripts;
the BKI aspect of it works fine now.)

Having done that, we can remove the special-case handling of values
that look like "something" from genbki.pl, and instead teach it to
escape double --- and single --- quotes properly.  This removes the
nowhere-documented need to treat those specially in the BKI source
data; whatever you write will be passed through unchanged into the
inserted data value, modulo Perl's rules about single-quoted strings.

Add documentation explaining the (pre-existing) handling of backslashes
in the BKI data.

Per an earlier discussion with John Naylor.

Discussion: https://postgr.es/m/CAJVSVGUNao=-Q2-vAN3PYcdF5tnL5JAHwGwzZGuYHtq+Mk_9ng@mail.gmail.com
doc/src/sgml/bki.sgml
src/backend/catalog/genbki.pl
src/bin/initdb/initdb.c
src/include/catalog/pg_authid.dat
src/include/catalog/pg_database.dat
src/include/catalog/pg_proc.dat