⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 psql-ref.sgml

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 SGML
📖 第 1 页 / 共 5 页
字号:
      <varlistentry>        <term><literal>\dT [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <term><literal>\dT+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all data types or only those that match <replaceable        class="parameter">pattern</replaceable>. The command form        <literal>\dT+</literal> shows extra information.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\du [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all database roles, or only those that match <replaceable        class="parameter">pattern</replaceable>.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\edit</literal> (or <literal>\e</literal>) <literal>[ <replaceable class="parameter">filename</replaceable> ]</literal></term>        <listitem>        <para>        If <replaceable class="parameter">filename</replaceable> is        specified, the file is edited; after the editor exits, its        content is copied back to the query buffer. If no argument is        given, the current query buffer is copied to a temporary file        which is then edited in the same fashion.        </para>        <para>        The new query buffer is then re-parsed according to the normal        rules of <application>psql</application>, where the whole buffer        is treated as a single line. (Thus you cannot make scripts this        way. Use <command>\i</command> for that.) This means also that        if the query ends with (or rather contains) a semicolon, it is        immediately executed. In other cases it will merely wait in the        query buffer.        </para>        <tip>        <para>        <application>psql</application> searches the environment        variables <envar>PSQL_EDITOR</envar>, <envar>EDITOR</envar>, and        <envar>VISUAL</envar> (in that order) for an editor to use. If        all of them are unset, <filename>vi</filename> is used on Unix        systems, <filename>notepad.exe</filename> on Windows systems.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term>        <listitem>        <para>        Prints the arguments to the standard output, separated by one        space 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.        </para>        <tip>        <para>        If you use the <command>\o</command> command to redirect your        query output you may wish to use <command>\qecho</command>        instead of this command.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\encoding [ <replaceable class="parameter">encoding</replaceable> ]</literal></term>        <listitem>        <para>        Sets the client character set encoding.  Without an argument, this command        shows the current encoding.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\f [ <replaceable class="parameter">string</replaceable> ]</literal></term>        <listitem>        <para>        Sets the field separator for unaligned query output. The default        is the vertical bar (<literal>|</literal>). See also        <command>\pset</command> for a generic way of setting output        options.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]</term>        <listitem>        <para>        Sends the current query input buffer to the server and        optionally stores the query's output in <replaceable        class="parameter">filename</replaceable> or pipes the output        into a separate Unix shell executing <replaceable        class="parameter">command</replaceable>. A bare        <literal>\g</literal> is virtually equivalent to a semicolon. A        <literal>\g</literal> with argument is a <quote>one-shot</quote>        alternative to the <command>\o</command> command.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\help</literal> (or <literal>\h</literal>) <literal>[ <replaceable class="parameter">command</replaceable> ]</literal></term>        <listitem>        <para>        Gives syntax help on the specified <acronym>SQL</acronym>        command. If <replaceable class="parameter">command</replaceable>        is not specified, then <application>psql</application> will list        all the commands for which syntax help is available. If        <replaceable class="parameter">command</replaceable> is an        asterisk (<literal>*</literal>), then syntax help on all        <acronym>SQL</acronym> commands is shown.        </para>        <note>        <para>        To simplify typing, commands that consists of several words do        not have to be quoted. Thus it is fine to type <userinput>\help        alter table</userinput>.        </para>        </note>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\H</literal></term>        <listitem>        <para>        Turns on <acronym>HTML</acronym> query output format. If the        <acronym>HTML</acronym> format is already on, it is switched        back to the default aligned text format. This command is for        compatibility and convenience, but see <command>\pset</command>        about setting other output options.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\i <replaceable class="parameter">filename</replaceable></literal></term>        <listitem>        <para>        Reads input from the file <replaceable        class="parameter">filename</replaceable> and executes it as        though it had been typed on the keyboard.        </para>        <note>        <para>        If you want to see the lines on the screen as they are read you        must set the variable <varname>ECHO</varname> to        <literal>all</literal>.        </para>        </note>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\l</literal> (or <literal>\list</literal>)</term>        <term><literal>\l+</literal> (or <literal>\list+</literal>)</term>        <listitem>        <para>        List the names, owners, and character set encodings of all the databases in        the server. If <literal>+</literal> is appended to the command        name, database descriptions are also displayed.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\lo_export <replaceable class="parameter">loid</replaceable> <replaceable class="parameter">filename</replaceable></literal></term>        <listitem>        <para>        Reads the large object with <acronym>OID</acronym> <replaceable        class="parameter">loid</replaceable> from the database and        writes it to <replaceable        class="parameter">filename</replaceable>. Note that this is        subtly different from the server function        <function>lo_export</function>, which acts with the permissions        of the user that the database server runs as and on the server's        file system.        </para>        <tip>        <para>        Use <command>\lo_list</command> to find out the large object's        <acronym>OID</acronym>.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\lo_import <replaceable class="parameter">filename</replaceable> [ <replaceable class="parameter">comment</replaceable> ]</literal></term>        <listitem>        <para>        Stores the file into a <productname>PostgreSQL</productname>        large object. Optionally, it associates the given        comment with the object. Example:<programlisting>foo=&gt; <userinput>\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</userinput>lo_import 152801</programlisting>        The response indicates that the large object received object ID        152801 which one ought to remember if one wants to access the        object ever again. For that reason it is recommended to always        associate a human-readable comment with every object. Those can        then be seen with the <command>\lo_list</command> command.        </para>        <para>        Note that this command is subtly different from the server-side        <function>lo_import</function> because it acts as the local user        on the local file system, rather than the server's user and file        system.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\lo_list</literal></term>        <listitem>        <para>        Shows a list of all <productname>PostgreSQL</productname>        large objects currently stored in the database,        along with any comments provided for them.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\lo_unlink <replaceable class="parameter">loid</replaceable></literal></term>        <listitem>        <para>        Deletes the large object with <acronym>OID</acronym>        <replaceable class="parameter">loid</replaceable> from the        database.        </para>        <tip>        <para>        Use <command>\lo_list</command> to find out the large object's        <acronym>OID</acronym>.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\o</literal> [ {<replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable>} ]</term>        <listitem>        <para>        Saves future query results to the file <replaceable        class="parameter">filename</replaceable> or pipes future results        into a separate Unix shell to execute <replaceable        class="parameter">command</replaceable>. If no arguments are        specified, the query output will be reset to the standard output.        </para>        <para>        <quote>Query results</quote> includes all tables, command        responses, and notices obtained from the database server, as        well as output of various backslash commands that query the        database (such as <command>\d</command>), but not error        messages.        </para>        <tip>        <para>        To intersperse text output in between query results, use        <command>\qecho</command>.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\p</literal></term>        <listitem>        <para>        Print the current query buffer to the standard output.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\pset <replaceable class="parameter">parameter</replaceable> [ <replaceable class="parameter">value</replaceable> ]</literal></term>        <listitem>        <para>        This command sets options affecting the output of query result        tables. <replaceable class="parameter">parameter</replaceable>        describes which option is to be set. The semantics of        <replaceable class="parameter">value</replaceable> depend        thereon.        </para>        <para>        Adjustable printing options are:        <variablelist>          <varlistentry>          <term><literal>format</literal></term>          <listitem>          <para>          Sets the output format to one of <literal>unaligned</literal>,          <literal>aligned</literal>, <literal>html</literal>,          <literal>latex</literal>, or <literal>troff-ms</literal>.          Unique abbreviations are allowed.  (That would mean one letter          is enough.)          </para>          <para>          <quote>Unaligned</quote> writes all columns of a row on a          line, separated by the currently active field separator. This          is intended to create output that might be intended to be read          in by other programs (tab-separated, comma-separated).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -