From a3eb19ba4a34dcfed7a79167717d9fed1ef9d26e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 19 Jun 2016 13:11:40 -0400 Subject: [PATCH] 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> --- doc/src/sgml/ref/psql-ref.sgml | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index bb93cb8fdb..308e3900c0 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -3294,11 +3294,12 @@ testdb=> INSERT INTO my_table VALUES (:'content'); and special escape sequences that describe the appearance of the prompt. Prompt 1 is the normal prompt that is issued when psql requests a new command. Prompt 2 is - issued when more input is expected during command input because the - command was not terminated with a semicolon or a quote was not closed. - Prompt 3 is issued when you run an SQL - COPY command and you are expected to type in the - row values on the terminal. + issued when more input is expected during command entry, for example + because the command was not terminated with a semicolon or a quote + was not closed. + Prompt 3 is issued when you are running an SQL + COPY FROM STDIN command and you need to type in + a row value on the terminal. @@ -3378,17 +3379,20 @@ testdb=> INSERT INTO my_table VALUES (:'content'); %R - In prompt 1 normally =, but ^ if - in single-line mode, and ! if the session is - disconnected from the database (which can happen if - \connect fails). In prompt 2 the sequence is - replaced by -, *, a single quote, - a double quote, or a dollar sign, depending on whether - psql expects more input because the - command wasn't terminated yet, because you are inside a - /* ... */ comment, or because you are inside - a quoted or dollar-escaped string. In prompt 3 the sequence doesn't - produce anything. + In prompt 1 normally =, + but ^ if in single-line mode, + or ! if the session is disconnected from the + database (which can happen if \connect fails). + In prompt 2 %R is replaced by a character that + depends on why psql expects more input: + - if the command simply wasn't terminated yet, + but * if there is an unfinished + /* ... */ comment, + a single quote if there is an unfinished quoted string, + a double quote if there is an unfinished quoted identifier, + a dollar sign if there is an unfinished dollar-quoted string, + or ( if there is an unmatched left parenthesis. + In prompt 3 %R doesn't produce anything.