Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 705ad7f

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 9bc3332 commit 705ad7f

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

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

+20-16
Original file line numberDiff line numberDiff line change
@@ -3535,11 +3535,12 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
35353535
and special escape sequences that describe the appearance of the
35363536
prompt. Prompt 1 is the normal prompt that is issued when
35373537
<application>psql</application> requests a new command. Prompt 2 is
3538-
issued when more input is expected during command input because the
3539-
command was not terminated with a semicolon or a quote was not closed.
3540-
Prompt 3 is issued when you run an <acronym>SQL</acronym>
3541-
<command>COPY</command> command and you are expected to type in the
3542-
row values on the terminal.
3538+
issued when more input is expected during command entry, for example
3539+
because the command was not terminated with a semicolon or a quote
3540+
was not closed.
3541+
Prompt 3 is issued when you are running an <acronym>SQL</acronym>
3542+
<command>COPY FROM STDIN</command> command and you need to type in
3543+
a row value on the terminal.
35433544
</para>
35443545

35453546
<para>
@@ -3626,17 +3627,20 @@ testdb=&gt; <userinput>INSERT INTO my_table VALUES (:'content');</userinput>
36263627
<term><literal>%R</literal></term>
36273628
<listitem>
36283629
<para>
3629-
In prompt 1 normally <literal>=</literal>, but <literal>^</literal> if
3630-
in single-line mode, and <literal>!</literal> if the session is
3631-
disconnected from the database (which can happen if
3632-
<command>\connect</command> fails). In prompt 2 the sequence is
3633-
replaced by <literal>-</literal>, <literal>*</literal>, a single quote,
3634-
a double quote, or a dollar sign, depending on whether
3635-
<application>psql</application> expects more input because the
3636-
command wasn't terminated yet, because you are inside a
3637-
<literal>/* ... */</literal> comment, or because you are inside
3638-
a quoted or dollar-escaped string. In prompt 3 the sequence doesn't
3639-
produce anything.
3630+
In prompt 1 normally <literal>=</literal>,
3631+
but <literal>^</literal> if in single-line mode,
3632+
or <literal>!</literal> if the session is disconnected from the
3633+
database (which can happen if <command>\connect</command> fails).
3634+
In prompt 2 <literal>%R</literal> is replaced by a character that
3635+
depends on why <application>psql</application> expects more input:
3636+
<literal>-</literal> if the command simply wasn't terminated yet,
3637+
but <literal>*</literal> if there is an unfinished
3638+
<literal>/* ... */</literal> comment,
3639+
a single quote if there is an unfinished quoted string,
3640+
a double quote if there is an unfinished quoted identifier,
3641+
a dollar sign if there is an unfinished dollar-quoted string,
3642+
or <literal>(</literal> if there is an unmatched left parenthesis.
3643+
In prompt 3 <literal>%R</literal> doesn't produce anything.
36403644
</para>
36413645
</listitem>
36423646
</varlistentry>

0 commit comments

Comments
 (0)