1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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
This commit is contained in:
Tom Lane
2015-07-03 15:48:18 -04:00
parent 1bc90f7a7b
commit 8eb6407aae
4 changed files with 424 additions and 100 deletions

View File

@ -1650,6 +1650,32 @@ Tue Oct 26 21:40:57 CEST 1999
</varlistentry>
<varlistentry>
<term><literal>\ev <optional> <replaceable class="parameter">view_name</> <optional> <replaceable class="parameter">line_number</> </optional> </optional> </literal></term>
<listitem>
<para>
This command fetches and edits the definition of the named view,
in the form of a <command>CREATE OR REPLACE VIEW</> command.
Editing is done in the same way as for <literal>\edit</>.
After the editor exits, the updated command waits in the query buffer;
type semicolon or <literal>\g</> to send it, or <literal>\r</>
to cancel.
</para>
<para>
If no view is specified, a blank <command>CREATE VIEW</>
template is presented for editing.
</para>
<para>
If a line number is specified, <application>psql</application> will
position the cursor on the specified line of the view definition.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\encoding [ <replaceable class="parameter">encoding</replaceable> ]</literal></term>
@ -2521,6 +2547,25 @@ testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
</varlistentry>
<varlistentry>
<term><literal>\sv[+] <replaceable class="parameter">view_name</> </literal></term>
<listitem>
<para>
This command fetches and shows the definition of the named view,
in the form of a <command>CREATE OR REPLACE VIEW</> command.
The definition is printed to the current query output channel,
as set by <command>\o</command>.
</para>
<para>
If <literal>+</literal> is appended to the command name, then the
output lines are numbered from 1.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\t</literal></term>
<listitem>
@ -3554,9 +3599,10 @@ $endif
<listitem>
<para>
Editor used by the <command>\e</command> and
<command>\ef</command> commands. The variables are examined in
the order listed; the first that is set is used.
Editor used by the <command>\e</command>, <command>\ef</command>,
and <command>\ev</command> commands.
These variables are examined in the order listed;
the first that is set is used.
</para>
<para>
@ -3571,7 +3617,8 @@ $endif
<listitem>
<para>
When <command>\e</command> or <command>\ef</command> is used
When <command>\e</command>, <command>\ef</command>, or
<command>\ev</command> is used
with a line number argument, this variable specifies the
command-line argument used to pass the starting line number to
the user's editor. For editors such as <productname>Emacs</> or