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

📄 psql-ref.sgml

📁 关系型数据库 Postgresql 6.5.2
💻 SGML
📖 第 1 页 / 共 2 页
字号:
    <varlistentry>     <term>-t</term>     <listitem>      <para>       Turn off printing of column names.       This is useful with the       <option>-c</option>       option in shell scripts.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term>-T <replaceable class="parameter">table_options</replaceable></term>     <listitem>      <para>       Allows you to specify options to be placed within the       <sgmltag>table ...</sgmltag> tag for <acronym>HTML 3.0</acronym>       tabular output.For example, <literal>border</literal>       will give you tables with borders.       This must be used in conjunction with the <option>-H</option> option.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term>-u</term>     <listitem>      <para>       Asks the user for the user name and password before connecting to the database.       If the database does not require password authentication then these are       ignored.  If the option is not used (and the PGPASSWORD environment variable       is not set) and the database requires password authentication, then the       connection will fail.  The user name is ignored anyway.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term>-x</term>     <listitem>      <para>       Turns on extended row format mode. When enabled each row will have its column       names printed on the left with the column values printed on the right.       This is useful for rows which are otherwise too long to fit into       one screen line. HTML row output supports this mode also.      </para>     </listitem>    </varlistentry>   </variablelist>  </para>  <para>   You may set environment variables to avoid typing some of the above   options.  See the section on environment variables below.  </para> </refsect1> <refsect1 id="R1-APP-PSQL-3">  <refsect1info>   <date>1998-09-26</date>  </refsect1info>  <title>   <application>psql</application> Meta-Commands  </title>  <para>   Anything you enter in <application>psql</application>    that begins with an unquoted backslash is a <application>psql</application>   meta-command.  Anything else is <acronym>SQL</acronym>   and simply goes into the current query buffer   (and once you have at least one complete query, it gets automatically    submitted to the backend).     <application>psql</application> meta-commands are also called slash commands.  </para>  <para>   The format of a <application>psql</application> command is the backslash,    followed immediately by   a command verb, then any arguments.  The arguments are separated from the   command verb and each other by any number of white space characters.  </para>  <para>   With single character command verbs, you don't actually need to separate the   command verb from the argument with white space, for historical reasons.   You should anyway.  </para>  <para>   The following meta-commands are defined:   <variablelist>    <varlistentry>     <term><literal>\a</literal></term>     <listitem>      <para>       Toggle field alignment when printing out table elements.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\C</literal> <replaceable class="parameter">caption</replaceable></term>     <listitem>      <para>       Set the HTML3.0 table caption to        <quote><replaceable class="parameter">caption</replaceable></quote>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\connect</literal> <replaceable class="parameter">meter"</replaceable>ceable> [ <replaceable class="parameter">username</replaceable> ]</term>     <listitem>      <para>       Establish a connection to a new database, using the default        <replaceable class="parameter">username</replaceable> if none is specified.       The previous connection is closed.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\copy</literal> <replaceable class="parameter">meter"</replaceable>ceable> { FROM | TO } <replaceable class="parameter">filename</replaceable>     </term>     <listitem>      <para>       Perform a frontend (client) copy.  This is an operation that runs a SQL COPY command,       but instead of the backend reading or writing the specified file, and        consequently requiring backend access and special user privilege,        <application>psql</application> reads or writes the        file and routes the data to or from the backend.  The default       <literal>tab</literal>       delimiter is used.      </para>      <tip>       <para>	This operation is not as efficient as the <acronym>SQL</acronym> 	<command>COPY</command> command because all data must pass through the	client/server IP or socket connection. For large amounts of data this other	technique may be preferable.       </para>      </tip>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\d</literal> [ <replaceable class="parameter">table</replaceable> ]</term>     <listitem>      <para>       List tables in the database, or if <replaceable	class="parameter">table</replaceable>       is specified, list the columns in that table.       If table name is specified as an asterisk (<quote>*</quote>),       list all tables and column information for each tables.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\da</literal></term>     <listitem>      <para>       List all available aggregates.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\dd</literal> <replaceable class="parameter">object</replaceable></term>     <listitem>      <para>       List the description from <literal>pg_description</literal>       of the specified object, which can be a       table, table.column, type, operator, or aggregate.      </para>      <tip>       <para>	Not all objects have a description in <literal>pg_description</literal>.	This meta-command can be useful to get a quick description of a native	<productname>Postgres</productname> feature.       </para>      </tip>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\df</literal></term>     <listitem>      <para>       List functions.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\di</literal></term>     <listitem>      <para>       List only indexes.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\do</literal></term>     <listitem>      <para>       List only operators.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\ds</literal></term>     <listitem>      <para>       List only sequences.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\dS</literal></term>     <listitem>      <para>       List system tables and indexes.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\dt</literal></term>     <listitem>      <para>       List only non-system tables.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\dT</literal></term>     <listitem>      <para>       List types.      </para>     </listitem>    </varlistentry>    <varlistentry><term>      <literal>\e</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>     <listitem>      <para>       Edit the current query buffer or the contents of the file       <replaceable class="parameter">filename</replaceable>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\E</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>     <listitem>      <para>       Edit the current query buffer or the contents of the file       <replaceable class="parameter">filename</replaceable>       and execute it upon editor exit.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\f</literal> [ <replaceable class="parameter">separator</replaceable> ]</term>     <listitem>      <para>       Set the field separator.  Default is a single blank space.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\g</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]</term>     <listitem>      <para>       Send the current query input buffer to the backend and optionally       save the output in <replaceable class="parameter">filename</replaceable>       or pipe the output into a separate Unix shell to execute       <replaceable class="parameter">command</replaceable>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\h</literal> [ <replaceable class="parameter">command</replaceable> ]</term>     <listitem>      <para>       Give syntax help on the specified SQL command.         If <replaceable class="parameter">command</replaceable> is not a defined SQL command       (or is not documented in <application>psql</application>), or 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 (<quote>*</quote>), then       give syntax help on all SQL commands.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\H</literal></term>     <listitem>      <para>       Toggle <acronym>HTML3</acronym> output. This is equivalent to       the <option>-H</option>       command-line option.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\i</literal> <replaceable class="parameter">filename</replaceable></term>     <listitem>      <para>       Read queries from the file <replaceable class="parameter">filename</replaceable>       into the query input buffer.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\l</literal></term>     <listitem>      <para>       List all the databases in the server.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\m</literal></term>     <listitem>      <para>       Toggle the old monitor-like table display, which includes border characters       surrounding the table.       This is standard SQL output.       By default, <application>psql</application> includes only field separators       between columns.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\o</literal> [ { <replaceable class="parameter">filename</replaceable> | <literal>|</literal><replaceable class="parameter">command</replaceable> } ]</term>     <listitem>      <para>       Save future query results to the file       <replaceable class="parameter">filename</replaceable> or pipe future       results into a separate Unix shell to execute       <replaceable class="parameter">command</replaceable>.       If no arguments are specified, send query results to       <filename>stdout</filename>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\p</literal></term>     <listitem>      <para>       Print the current query buffer.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\q</literal></term>     <listitem>      <para>       Quit the <application>psql</application> program.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\r</literal></term>     <listitem>      <para>       Reset(clear) the query buffer.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\s</literal> [ <replaceable class="parameter">filename</replaceable> ]</term>     <listitem>      <para>       Print or save the command line history to        <replaceable class="parameter">filename</replaceable>.       If <replaceable class="parameter">filename</replaceable> is omitted,       do not save subsequent commands to a history file.       This option is only available if <application>psql</application> is       configured to use readline.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\t</literal></term>     <listitem>      <para>       Toggle display of output column name headings and row count footer (defaults to on).      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\T</literal> <replaceable class="parameter">table_options</replaceable></term>     <listitem>      <para>       Allows you to specify options to be placed within the       <sgmltag>table ...</sgmltag> tag       for <acronym>HTML 3.0</acronym>       tabular output.For example, <literal>border</literal>       will give you tables with borders.       This must be used in conjunction with the <command>\H</command> meta-command.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\x</literal></term>     <listitem>      <para>       Toggles extended row format mode. When enabled each row will have its column       names printed on the left with the column values printed on the right.       This is useful for rows which are otherwise too long to fit into       one screen line. <acronym>HTML</acronym> row output mode supports this flag too.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\w</literal> <replaceable class="parameter">filename</replaceable></term>     <listitem>      <para>       Outputs the current query buffer to the file       <replaceable class="parameter">filename</replaceable>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\z</literal></term>     <listitem>      <para>       Produces a list of all tables in the database with their appropriate ACLs       (grant/revoke permissions) listed.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\!</literal> [ <replaceable class="parameter">command</replaceable> ]</term>     <listitem>      <para>       Escape to a separate Unix shell or execute the Unix command       <replaceable class="parameter">command</replaceable>.      </para>     </listitem>    </varlistentry>    <varlistentry>     <term><literal>\?</literal></term>     <listitem>      <para>       Get help information about the slash (<quote>\</quote>) commands.      </para>     </listitem>    </varlistentry>   </variablelist>  </para> </refsect1></refentry><!-- Keep this comment at the end of the fileLocal variables:mode: sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"../reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:"/usr/lib/sgml/catalog"sgml-local-ecat-files:nilEnd:-->

⌨️ 快捷键说明

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