diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-04-17 19:53:50 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-04-17 19:53:50 -0400 |
commit | 55d26ff638f063fbccf57843f2c27f9795895a5c (patch) | |
tree | bb094186f374620288b702217f8c26280dc9f719 /doc/src | |
parent | 9ffcccdb958d38db5051bf64143330ff445a26cc (diff) |
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/bki.sgml | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml index f7a323ef345..5a4cd393421 100644 --- a/doc/src/sgml/bki.sgml +++ b/doc/src/sgml/bki.sgml @@ -184,13 +184,11 @@ <programlisting> [ -# LC_COLLATE and LC_CTYPE will be replaced at initdb time with user choices -# that might contain non-word characters, so we must double-quote them. - +# A comment could appear here. { oid => '1', oid_symbol => 'TemplateDbOid', descr => 'database\'s default template', datname => 'template1', datdba => 'PGUID', encoding => 'ENCODING', - datcollate => '"LC_COLLATE"', datctype => '"LC_CTYPE"', datistemplate => 't', + datcollate => 'LC_COLLATE', datctype => 'LC_CTYPE', datistemplate => 't', datallowconn => 't', datconnlimit => '-1', datlastsysoid => '0', datfrozenxid => '0', datminmxid => '1', dattablespace => '1663', datacl => '_null_' }, @@ -234,10 +232,16 @@ <listitem> <para> - All values must be single-quoted. Escape single quotes used within - a value with a backslash. (Backslashes meant as data need not be - doubled, however; this follows Perl's rules for simple quoted - literals.) + All values must be single-quoted. Escape single quotes used within a + value with a backslash. Backslashes meant as data can, but need not, + be doubled; this follows Perl's rules for simple quoted literals. + Note that backslashes appearing as data will be treated as escapes by + the bootstrap scanner, according to the same rules as for escape string + constants (see <xref linkend="sql-syntax-strings-escape"/>); for + example <literal>\t</literal> converts to a tab character. If you + actually want a backslash in the final value, you will need to write + four of them: Perl strips two, leaving <literal>\\</literal> for the + bootstrap scanner to see. </para> </listitem> @@ -249,15 +253,6 @@ <listitem> <para> - If a value is a macro to be expanded - by <application>initdb</application>, it should also contain double - quotes as shown above, unless we know that no special characters can - appear within the string that will be substituted. - </para> - </listitem> - - <listitem> - <para> Comments are preceded by <literal>#</literal>, and must be on their own lines. </para> |