Home Explore Blog CI



postgresql

35th chunk of `doc/src/sgml/ref/psql-ref.sgml`
09431c26e29be7d12126f111148743fc2b1ffe93c5fc91880000000100000fa2
 meta-command, even if it spans multiple lines.
        (Thus you cannot make meta-command-using scripts this way.
        Use <command>\i</command> for that.)
        </para>

        <para>
        If a line number is specified, <application>psql</application> will
        position the cursor on the specified line of the file or query buffer.
        Note that if a single all-digits argument is given,
        <application>psql</application> assumes it is a line number,
        not a file name.
        </para>

        <tip>
        <para>
        See <xref linkend="app-psql-environment"/>, below, for how to
        configure and customize your editor.
        </para>
        </tip>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-echo">
        <term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>
        <listitem>
        <para>
        Prints the evaluated arguments to standard output, separated by
        spaces and followed by a newline. This can be useful to
        intersperse information in the output of scripts. For example:
<programlisting>
=&gt; <userinput>\echo `date`</userinput>
Tue Oct 26 21:40:57 CEST 1999
</programlisting>
        If the first argument is an unquoted <literal>-n</literal> the trailing
        newline is not written (nor is the first argument).
        </para>

        <tip>
        <para>
        If you use the <command>\o</command> command to redirect your
        query output you might wish to use <command>\qecho</command>
        instead of this command.  See also <command>\warn</command>.
        </para>
        </tip>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-ef">
        <term><literal>\ef <optional> <replaceable class="parameter">function_description</replaceable> <optional>  <replaceable class="parameter">line_number</replaceable> </optional> </optional> </literal></term>

        <listitem>
        <para>
         This command fetches and edits the definition of the named function or procedure,
         in the form of a <command>CREATE OR REPLACE FUNCTION</command> or
         <command>CREATE OR REPLACE PROCEDURE</command> command.
         Editing is done in the same way as for <literal>\edit</literal>.
         If you quit the editor without saving, the statement is discarded.
         If you save and exit the editor, the updated command is executed immediately
         if you added a semicolon to it.  Otherwise it is redisplayed;
         type semicolon or <literal>\g</literal> to send it, or <literal>\r</literal>
         to cancel.
        </para>

        <para>
         The target function can be specified by name alone, or by name
         and arguments, for example <literal>foo(integer, text)</literal>.
         The argument types must be given if there is more
         than one function of the same name.
        </para>

        <para>
         If no function is specified, a blank <command>CREATE FUNCTION</command>
         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 function body.
        (Note that the function body typically does not begin on the first
        line of the file.)
        </para>

        <para>
        Unlike most other meta-commands, the entire remainder of the line is
        always taken to be the argument(s) of <command>\ef</command>, and neither
        variable interpolation nor backquote expansion are performed in the
        arguments.
        </para>

        <tip>
        <para>
        See <xref linkend="app-psql-environment"/>, below, for how to
        configure and customize your editor.
        </para>
        </tip>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-encoding">
        <term><literal>\encoding [ <replaceable

Title: psql Meta-Commands: \echo, \ef, \encoding
Summary
This section describes the `psql` meta-commands `\echo`, `\ef`, and `\encoding`: * `\echo`: Prints arguments to standard output, useful in scripts. `-n` suppresses the trailing newline. * `\ef`: Fetches and edits the definition of a named function or procedure as a `CREATE OR REPLACE` command. Editing is similar to `\edit`. The target function is specified by name and arguments. If no function is specified, a blank `CREATE FUNCTION` template is presented for editing. A line number can be specified to position the cursor in the function body. Unlike most meta-commands, the entire remainder of the line is always taken to be the argument(s) of `\ef`. * `\encoding`: Sets the client encoding.