Home Explore Blog CI



postgresql

54th chunk of `doc/src/sgml/ref/psql-ref.sgml`
a962e714011bf35a31cede15c21a9588416a0b133ef537370000000100000fba
 <application>psql</application> was built
        without <application>Readline</application> support.
        </para>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-set">
        <term><literal>\set [ <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> [ ... ] ] ]</literal></term>

        <listitem>
        <para>
        Sets the <application>psql</application> variable <replaceable
        class="parameter">name</replaceable> to <replaceable
        class="parameter">value</replaceable>, or if more than one value
        is given, to the concatenation of all of them. If only one
        argument is given, the variable is set to an empty-string value. To
        unset a variable, use the <command>\unset</command> command.
        </para>

        <para><command>\set</command> without any arguments displays the names and values
        of all currently-set <application>psql</application> variables.
        </para>

        <para>
        Valid variable names can contain letters, digits, and
        underscores. See <xref linkend="app-psql-variables"/> below for details.
        Variable names are case-sensitive.
        </para>

        <para>
        Certain variables are special, in that they
        control <application>psql</application>'s behavior or are
        automatically set to reflect connection state.  These variables are
        documented in <xref linkend="app-psql-variables"/>, below.
        </para>

        <note>
        <para>
        This command is unrelated to the <acronym>SQL</acronym>
        command <link linkend="sql-set"><command>SET</command></link>.
        </para>
        </note>
        </listitem>
      </varlistentry>


      <varlistentry id="app-psql-meta-command-setenv">
        <term><literal>\setenv <replaceable class="parameter">name</replaceable> [ <replaceable class="parameter">value</replaceable> ]</literal></term>

        <listitem>
        <para>
        Sets the environment variable <replaceable
        class="parameter">name</replaceable> to <replaceable
        class="parameter">value</replaceable>, or if the
        <replaceable class="parameter">value</replaceable> is
        not supplied, unsets the environment variable. Example:
<programlisting>
testdb=&gt; <userinput>\setenv PAGER less</userinput>
testdb=&gt; <userinput>\setenv LESS -imx4F</userinput>
</programlisting></para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-sf">
        <term><literal>\sf[+] <replaceable class="parameter">function_description</replaceable> </literal></term>

        <listitem>
        <para>
         This command fetches and shows 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.
         The definition is printed to the current query output channel,
         as set by <command>\o</command>.
        </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 <literal>+</literal> is appended to the command name, then the
         output lines are numbered, with the first line of the function body
         being line 1.
        </para>

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


      <varlistentry id="app-psql-meta-command-sv">
        <term><literal>\sv[+] <replaceable class="parameter">view_name</replaceable>

Title: psql Meta-Commands: \set, \setenv, \sf, \sv
Summary
This section describes the \set, \setenv, \sf, and \sv meta-commands in psql. \set is used to set psql variables, \setenv sets environment variables, \sf displays the definition of a function or procedure, and \sv displays the definition of a view.