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

Commit ffac599

Browse files
committed
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
1 parent 68dba97 commit ffac599

File tree

1 file changed

+79
-9
lines changed

1 file changed

+79
-9
lines changed

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

+79-9
Original file line numberDiff line numberDiff line change
@@ -989,8 +989,10 @@ testdb=>
989989
command. All options other than the data source/destination are
990990
as specified for <xref linkend="sql-copy">.
991991
Because of this, special parsing rules apply to the <command>\copy</>
992-
command. In particular, <application>psql</>'s variable substitution
993-
rules and backslash escapes do not apply.
992+
meta-command. Unlike most other meta-commands, the entire remainder
993+
of the line is always taken to be the arguments of <command>\copy</>,
994+
and neither variable interpolation nor backquote expansion are
995+
performed in the arguments.
994996
</para>
995997

996998
<tip>
@@ -1820,6 +1822,13 @@ Tue Oct 26 21:40:57 CEST 1999
18201822
line of the file.)
18211823
</para>
18221824

1825+
<para>
1826+
Unlike most other meta-commands, the entire remainder of the line is
1827+
always taken to be the argument(s) of <command>\ef</>, and neither
1828+
variable interpolation nor backquote expansion are performed in the
1829+
arguments.
1830+
</para>
1831+
18231832
<tip>
18241833
<para>
18251834
See under <xref linkend="app-psql-environment"
@@ -1879,6 +1888,13 @@ Tue Oct 26 21:40:57 CEST 1999
18791888
If a line number is specified, <application>psql</application> will
18801889
position the cursor on the specified line of the view definition.
18811890
</para>
1891+
1892+
<para>
1893+
Unlike most other meta-commands, the entire remainder of the line is
1894+
always taken to be the argument(s) of <command>\ev</>, and neither
1895+
variable interpolation nor backquote expansion are performed in the
1896+
arguments.
1897+
</para>
18821898
</listitem>
18831899
</varlistentry>
18841900

@@ -1916,6 +1932,14 @@ Tue Oct 26 21:40:57 CEST 1999
19161932
A <literal>\g</literal> with argument is a <quote>one-shot</quote>
19171933
alternative to the <command>\o</command> command.
19181934
</para>
1935+
<para>
1936+
If the argument begins with <literal>|</>, then the entire remainder
1937+
of the line is taken to be
1938+
the <replaceable class="parameter">command</replaceable> to execute,
1939+
and neither variable interpolation nor backquote expansion are
1940+
performed in it. The rest of the line is simply passed literally to
1941+
the shell.
1942+
</para>
19191943
</listitem>
19201944
</varlistentry>
19211945

@@ -2035,6 +2059,13 @@ hello 10
20352059
<acronym>SQL</acronym> commands is shown.
20362060
</para>
20372061

2062+
<para>
2063+
Unlike most other meta-commands, the entire remainder of the line is
2064+
always taken to be the argument(s) of <command>\help</>, and neither
2065+
variable interpolation nor backquote expansion are performed in the
2066+
arguments.
2067+
</para>
2068+
20382069
<note>
20392070
<para>
20402071
To simplify typing, commands that consists of several words do
@@ -2303,10 +2334,20 @@ lo_import 152801
23032334
specified, the query output is reset to the standard output.
23042335
</para>
23052336

2306-
<para><quote>Query results</quote> includes all tables, command
2337+
<para>
2338+
If the argument begins with <literal>|</>, then the entire remainder
2339+
of the line is taken to be
2340+
the <replaceable class="parameter">command</replaceable> to execute,
2341+
and neither variable interpolation nor backquote expansion are
2342+
performed in it. The rest of the line is simply passed literally to
2343+
the shell.
2344+
</para>
2345+
2346+
<para>
2347+
<quote>Query results</quote> includes all tables, command
23072348
responses, and notices obtained from the database server, as
23082349
well as output of various backslash commands that query the
2309-
database (such as <command>\d</command>), but not error
2350+
database (such as <command>\d</command>); but not error
23102351
messages.
23112352
</para>
23122353

@@ -2907,6 +2948,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
29072948
output lines are numbered, with the first line of the function body
29082949
being line 1.
29092950
</para>
2951+
2952+
<para>
2953+
Unlike most other meta-commands, the entire remainder of the line is
2954+
always taken to be the argument(s) of <command>\sf</>, and neither
2955+
variable interpolation nor backquote expansion are performed in the
2956+
arguments.
2957+
</para>
29102958
</listitem>
29112959
</varlistentry>
29122960

@@ -2926,6 +2974,13 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
29262974
If <literal>+</literal> is appended to the command name, then the
29272975
output lines are numbered from 1.
29282976
</para>
2977+
2978+
<para>
2979+
Unlike most other meta-commands, the entire remainder of the line is
2980+
always taken to be the argument(s) of <command>\sv</>, and neither
2981+
variable interpolation nor backquote expansion are performed in the
2982+
arguments.
2983+
</para>
29292984
</listitem>
29302985
</varlistentry>
29312986

@@ -3001,6 +3056,15 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
30013056
If the current query buffer is empty, the most recently executed query
30023057
is written instead.
30033058
</para>
3059+
3060+
<para>
3061+
If the argument begins with <literal>|</>, then the entire remainder
3062+
of the line is taken to be
3063+
the <replaceable class="parameter">command</replaceable> to execute,
3064+
and neither variable interpolation nor backquote expansion are
3065+
performed in it. The rest of the line is simply passed literally to
3066+
the shell.
3067+
</para>
30043068
</listitem>
30053069
</varlistentry>
30063070

@@ -3057,11 +3121,17 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
30573121
<term><literal>\! [ <replaceable class="parameter">command</replaceable> ]</literal></term>
30583122
<listitem>
30593123
<para>
3060-
Escapes to a separate shell or executes the shell command
3061-
<replaceable class="parameter">command</replaceable>. The
3062-
arguments are not further interpreted; the shell will see them
3063-
as-is. In particular, the variable substitution rules and
3064-
backslash escapes do not apply.
3124+
With no argument, escapes to a sub-shell; <application>psql</>
3125+
resumes when the sub-shell exits. With an argument, executes the
3126+
shell command <replaceable class="parameter">command</replaceable>.
3127+
</para>
3128+
3129+
<para>
3130+
Unlike most other meta-commands, the entire remainder of the line is
3131+
always taken to be the argument(s) of <command>\!</>, and neither
3132+
variable interpolation nor backquote expansion are performed in the
3133+
arguments. The rest of the line is simply passed literally to the
3134+
shell.
30653135
</para>
30663136
</listitem>
30673137
</varlistentry>

0 commit comments

Comments
 (0)