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

Commit 8eb6407

Browse files
committed
Add psql \ev and \sv commands for editing and showing view definitions.
These are basically just like the \ef and \sf commands for functions. Petr Korobeinikov, reviewed by Jeevan Chalke, some changes by me
1 parent 1bc90f7 commit 8eb6407

File tree

4 files changed

+424
-100
lines changed

4 files changed

+424
-100
lines changed

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

+51-4
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,32 @@ Tue Oct 26 21:40:57 CEST 1999
16501650
</varlistentry>
16511651

16521652

1653+
<varlistentry>
1654+
<term><literal>\ev <optional> <replaceable class="parameter">view_name</> <optional> <replaceable class="parameter">line_number</> </optional> </optional> </literal></term>
1655+
1656+
<listitem>
1657+
<para>
1658+
This command fetches and edits the definition of the named view,
1659+
in the form of a <command>CREATE OR REPLACE VIEW</> command.
1660+
Editing is done in the same way as for <literal>\edit</>.
1661+
After the editor exits, the updated command waits in the query buffer;
1662+
type semicolon or <literal>\g</> to send it, or <literal>\r</>
1663+
to cancel.
1664+
</para>
1665+
1666+
<para>
1667+
If no view is specified, a blank <command>CREATE VIEW</>
1668+
template is presented for editing.
1669+
</para>
1670+
1671+
<para>
1672+
If a line number is specified, <application>psql</application> will
1673+
position the cursor on the specified line of the view definition.
1674+
</para>
1675+
</listitem>
1676+
</varlistentry>
1677+
1678+
16531679
<varlistentry>
16541680
<term><literal>\encoding [ <replaceable class="parameter">encoding</replaceable> ]</literal></term>
16551681

@@ -2521,6 +2547,25 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
25212547
</varlistentry>
25222548

25232549

2550+
<varlistentry>
2551+
<term><literal>\sv[+] <replaceable class="parameter">view_name</> </literal></term>
2552+
2553+
<listitem>
2554+
<para>
2555+
This command fetches and shows the definition of the named view,
2556+
in the form of a <command>CREATE OR REPLACE VIEW</> command.
2557+
The definition is printed to the current query output channel,
2558+
as set by <command>\o</command>.
2559+
</para>
2560+
2561+
<para>
2562+
If <literal>+</literal> is appended to the command name, then the
2563+
output lines are numbered from 1.
2564+
</para>
2565+
</listitem>
2566+
</varlistentry>
2567+
2568+
25242569
<varlistentry>
25252570
<term><literal>\t</literal></term>
25262571
<listitem>
@@ -3554,9 +3599,10 @@ $endif
35543599

35553600
<listitem>
35563601
<para>
3557-
Editor used by the <command>\e</command> and
3558-
<command>\ef</command> commands. The variables are examined in
3559-
the order listed; the first that is set is used.
3602+
Editor used by the <command>\e</command>, <command>\ef</command>,
3603+
and <command>\ev</command> commands.
3604+
These variables are examined in the order listed;
3605+
the first that is set is used.
35603606
</para>
35613607

35623608
<para>
@@ -3571,7 +3617,8 @@ $endif
35713617

35723618
<listitem>
35733619
<para>
3574-
When <command>\e</command> or <command>\ef</command> is used
3620+
When <command>\e</command>, <command>\ef</command>, or
3621+
<command>\ev</command> is used
35753622
with a line number argument, this variable specifies the
35763623
command-line argument used to pass the starting line number to
35773624
the user's editor. For editors such as <productname>Emacs</> or

0 commit comments

Comments
 (0)