Home Explore Blog CI



postgresql

45th chunk of `doc/src/sgml/ref/psql-ref.sgml`
3b14b0e33a34acf0d5ec0a011d5cdd8aaeee3175298a630f0000000100000fa0
 query buffer to the standard output.
        If the current query buffer is empty, the most recently executed query
        is printed instead.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-parse">
        <term><literal>\parse <replaceable class="parameter">statement_name</replaceable></literal></term>
        <listitem>
        <para>
         Creates a prepared statement from the current query buffer, based on
         the name of a destination prepared-statement object. An empty string
         denotes the unnamed prepared statement.
        </para>

        <para>
         Example:
<programlisting>
SELECT $1 \parse stmt1
</programlisting>
        </para>

        <para>
         This command causes the extended query protocol to be used, unlike
         normal <application>psql</application> operation, which uses the
         simple query protocol. A
         <xref linkend="protocol-message-formats-Parse"/>
         message will be issued by this command so it can be useful to
         test the extended query protocol from
         <application>psql</application>. This command affects only the next
         query executed; all subsequent queries will use the simple query
         protocol by default.
        </para>

        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-password">
        <term><literal>\password [ <replaceable class="parameter">username</replaceable> ]</literal></term>
        <listitem>
        <para>
        Changes the password of the specified user (by default, the current
        user).  This command prompts for the new password, encrypts it, and
        sends it to the server as an <command>ALTER ROLE</command> command.  This
        makes sure that the new password does not appear in cleartext in the
        command history, the server log, or elsewhere.
        </para>
        </listitem>
      </varlistentry>

      <varlistentry id="app-psql-meta-command-prompt">
        <term><literal>\prompt [ <replaceable class="parameter">text</replaceable> ] <replaceable class="parameter">name</replaceable></literal></term>
        <listitem>
        <para>
         Prompts the user to supply text, which is assigned to the variable
         <replaceable class="parameter">name</replaceable>.
         An optional prompt string, <replaceable
         class="parameter">text</replaceable>, can be specified.  (For multiword
         prompts, surround the text with single quotes.)
        </para>

        <para>
         By default, <literal>\prompt</literal> uses the terminal for input and
         output.  However, if the <option>-f</option> command line switch was
         used, <literal>\prompt</literal> uses standard input and standard output.
        </para>
        </listitem>
      </varlistentry>

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

        <listitem>
        <para>
        This command sets options affecting the output of query result tables.
        <replaceable class="parameter">option</replaceable>
        indicates which option is to be set. The semantics of
        <replaceable class="parameter">value</replaceable> vary depending
        on the selected option.  For some options, omitting <replaceable
        class="parameter">value</replaceable> causes the option to be toggled
        or unset, as described under the particular option.  If no such
        behavior is mentioned, then omitting
        <replaceable class="parameter">value</replaceable> just results in
        the current setting being displayed.
        </para>

        <para>
        <command>\pset</command> without any arguments displays the current status
        of all printing options.
        </para>

        <para>
        Adjustable printing options are:
      

Title: psql Meta-Commands: \parse, \password, \prompt, \pset
Summary
This section continues describing psql meta-commands. `\parse` creates a prepared statement from the current query buffer and can be used to test the extended query protocol. `\password` changes the password of a specified user, prompting for the new password securely. `\prompt` prompts the user for text input and assigns it to a variable. `\pset` sets options affecting the output of query result tables.