Commit ffac5998 authored by Tom Lane's avatar Tom Lane

Doc: clarify behavior of OT_WHOLE_LINE and OT_FILEPIPE psql slash commands.

This is another bit of ancient behavior that was documented poorly (in
a couple of cases) or not at all (in several others).

Discussion: https://postgr.es/m/9b4ea968-753f-4b5f-b46c-d7d3bf7c8f90@manitou-mail.org
parent 68dba97a
...@@ -989,8 +989,10 @@ testdb=> ...@@ -989,8 +989,10 @@ testdb=>
command. All options other than the data source/destination are command. All options other than the data source/destination are
as specified for <xref linkend="sql-copy">. as specified for <xref linkend="sql-copy">.
Because of this, special parsing rules apply to the <command>\copy</> Because of this, special parsing rules apply to the <command>\copy</>
command. In particular, <application>psql</>'s variable substitution meta-command. Unlike most other meta-commands, the entire remainder
rules and backslash escapes do not apply. of the line is always taken to be the arguments of <command>\copy</>,
and neither variable interpolation nor backquote expansion are
performed in the arguments.
</para> </para>
<tip> <tip>
...@@ -1820,6 +1822,13 @@ Tue Oct 26 21:40:57 CEST 1999 ...@@ -1820,6 +1822,13 @@ Tue Oct 26 21:40:57 CEST 1999
line of the file.) line of the file.)
</para> </para>
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\ef</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments.
</para>
<tip> <tip>
<para> <para>
See under <xref linkend="app-psql-environment" See under <xref linkend="app-psql-environment"
...@@ -1879,6 +1888,13 @@ Tue Oct 26 21:40:57 CEST 1999 ...@@ -1879,6 +1888,13 @@ Tue Oct 26 21:40:57 CEST 1999
If a line number is specified, <application>psql</application> will If a line number is specified, <application>psql</application> will
position the cursor on the specified line of the view definition. position the cursor on the specified line of the view definition.
</para> </para>
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\ev</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1916,6 +1932,14 @@ Tue Oct 26 21:40:57 CEST 1999 ...@@ -1916,6 +1932,14 @@ Tue Oct 26 21:40:57 CEST 1999
A <literal>\g</literal> with argument is a <quote>one-shot</quote> A <literal>\g</literal> with argument is a <quote>one-shot</quote>
alternative to the <command>\o</command> command. alternative to the <command>\o</command> command.
</para> </para>
<para>
If the argument begins with <literal>|</>, then the entire remainder
of the line is taken to be
the <replaceable class="parameter">command</replaceable> to execute,
and neither variable interpolation nor backquote expansion are
performed in it. The rest of the line is simply passed literally to
the shell.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2035,6 +2059,13 @@ hello 10 ...@@ -2035,6 +2059,13 @@ hello 10
<acronym>SQL</acronym> commands is shown. <acronym>SQL</acronym> commands is shown.
</para> </para>
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\help</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments.
</para>
<note> <note>
<para> <para>
To simplify typing, commands that consists of several words do To simplify typing, commands that consists of several words do
...@@ -2303,10 +2334,20 @@ lo_import 152801 ...@@ -2303,10 +2334,20 @@ lo_import 152801
specified, the query output is reset to the standard output. specified, the query output is reset to the standard output.
</para> </para>
<para><quote>Query results</quote> includes all tables, command <para>
If the argument begins with <literal>|</>, then the entire remainder
of the line is taken to be
the <replaceable class="parameter">command</replaceable> to execute,
and neither variable interpolation nor backquote expansion are
performed in it. The rest of the line is simply passed literally to
the shell.
</para>
<para>
<quote>Query results</quote> includes all tables, command
responses, and notices obtained from the database server, as responses, and notices obtained from the database server, as
well as output of various backslash commands that query the well as output of various backslash commands that query the
database (such as <command>\d</command>), but not error database (such as <command>\d</command>); but not error
messages. messages.
</para> </para>
...@@ -2907,6 +2948,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput> ...@@ -2907,6 +2948,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
output lines are numbered, with the first line of the function body output lines are numbered, with the first line of the function body
being line 1. being line 1.
</para> </para>
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\sf</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -2926,6 +2974,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput> ...@@ -2926,6 +2974,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
If <literal>+</literal> is appended to the command name, then the If <literal>+</literal> is appended to the command name, then the
output lines are numbered from 1. output lines are numbered from 1.
</para> </para>
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\sv</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -3001,6 +3056,15 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput> ...@@ -3001,6 +3056,15 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
If the current query buffer is empty, the most recently executed query If the current query buffer is empty, the most recently executed query
is written instead. is written instead.
</para> </para>
<para>
If the argument begins with <literal>|</>, then the entire remainder
of the line is taken to be
the <replaceable class="parameter">command</replaceable> to execute,
and neither variable interpolation nor backquote expansion are
performed in it. The rest of the line is simply passed literally to
the shell.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -3057,11 +3121,17 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput> ...@@ -3057,11 +3121,17 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
<term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term> <term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term>
<listitem> <listitem>
<para> <para>
Escapes to a separate shell or executes the shell command With no argument, escapes to a sub-shell; <application>psql</>
<replaceable class="parameter">command</replaceable>. The resumes when the sub-shell exits. With an argument, executes the
arguments are not further interpreted; the shell will see them shell command <replaceable class="parameter">command</replaceable>.
as-is. In particular, the variable substitution rules and </para>
backslash escapes do not apply.
<para>
Unlike most other meta-commands, the entire remainder of the line is
always taken to be the argument(s) of <command>\!</>, and neither
variable interpolation nor backquote expansion are performed in the
arguments. The rest of the line is simply passed literally to the
shell.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment