Skip to content

Commit c7aea92

Browse files
committed
Docs: improve description of psql's %R prompt escape sequence.
Dilian Palauzov pointed out in bug #14201 that the docs failed to mention the possibility of %R producing '(' due to an unmatched parenthesis. He proposed just adding that in the same style as the other options were listed; but it seemed to me that the sentence was already nearly unintelligible, so I rewrote it a bit more extensively. Report: <20160619121113.5789.68274@wrigleys.postgresql.org>
1 parent d300b8c commit c7aea92

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,11 +3204,12 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
32043204
and special escape sequences that describe the appearance of the
32053205
prompt. Prompt 1 is the normal prompt that is issued when
32063206
<application>psql</application> requests a new command. Prompt 2 is
3207-
issued when more input is expected during command input because the
3208-
command was not terminated with a semicolon or a quote was not closed.
3209-
Prompt 3 is issued when you run an <acronym>SQL</acronym>
3210-
<command>COPY</command> command and you are expected to type in the
3211-
row values on the terminal.
3207+
issued when more input is expected during command entry, for example
3208+
because the command was not terminated with a semicolon or a quote
3209+
was not closed.
3210+
Prompt 3 is issued when you are running an <acronym>SQL</acronym>
3211+
<command>COPY FROM STDIN</command> command and you need to type in
3212+
a row value on the terminal.
32123213
</para>
32133214

32143215
<para>
@@ -3288,17 +3289,20 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
32883289
<term><literal>%R</literal></term>
32893290
<listitem>
32903291
<para>
3291-
In prompt 1 normally <literal>=</literal>, but <literal>^</literal> if
3292-
in single-line mode, and <literal>!</literal> if the session is
3293-
disconnected from the database (which can happen if
3294-
<command>\connect</command> fails). In prompt 2 the sequence is
3295-
replaced by <literal>-</literal>, <literal>*</literal>, a single quote,
3296-
a double quote, or a dollar sign, depending on whether
3297-
<application>psql</application> expects more input because the
3298-
command wasn't terminated yet, because you are inside a
3299-
<literal>/* ... */</literal> comment, or because you are inside
3300-
a quoted or dollar-escaped string. In prompt 3 the sequence doesn't
3301-
produce anything.
3292+
In prompt 1 normally <literal>=</literal>,
3293+
but <literal>^</literal> if in single-line mode,
3294+
or <literal>!</literal> if the session is disconnected from the
3295+
database (which can happen if <command>\connect</command> fails).
3296+
In prompt 2 <literal>%R</literal> is replaced by a character that
3297+
depends on why <application>psql</application> expects more input:
3298+
<literal>-</literal> if the command simply wasn't terminated yet,
3299+
but <literal>*</literal> if there is an unfinished
3300+
<literal>/* ... */</literal> comment,
3301+
a single quote if there is an unfinished quoted string,
3302+
a double quote if there is an unfinished quoted identifier,
3303+
a dollar sign if there is an unfinished dollar-quoted string,
3304+
or <literal>(</literal> if there is an unmatched left parenthesis.
3305+
In prompt 3 <literal>%R</literal> doesn't produce anything.
33023306
</para>
33033307
</listitem>
33043308
</varlistentry>

0 commit comments

Comments
 (0)