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

📄 psql-ref.sgml

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 SGML
📖 第 1 页 / 共 5 页
字号:
        omitted the current user name is assumed. </para>        <para>        As a special rule, <command>\connect</command> without any        arguments will connect to the default database as the default        user (as you would have gotten by starting        <application>psql</application> without any arguments).        </para>        <para>        If the connection attempt failed (wrong user name, access        denied, etc.), the previous connection will be kept if and only        if <application>psql</application> is in interactive mode. When        executing a non-interactive script, processing will immediately        stop with an error. This distinction was chosen as a user        convenience against typos on the one hand, and a safety        mechanism that scripts are not accidentally acting on the wrong        database on the other hand.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\copy <replaceable class="parameter">table</replaceable>        [ ( <replaceable class="parameter">column_list</replaceable> ) ]        { <literal>from</literal> | <literal>to</literal> }        { <replaceable class="parameter">filename</replaceable> | stdin | stdout | pstdin | pstdout }        [ with ]            [ oids ]            [ delimiter [ as ] '<replaceable class="parameter">character</replaceable>' ]            [ null [ as ] '<replaceable class="parameter">string</replaceable>' ]            [ csv [ quote [ as ] '<replaceable class="parameter">character</replaceable>' ]            [ escape [ as ] '<replaceable class="parameter">character</replaceable>' ]            [ force quote <replaceable class="parameter">column_list</replaceable> ]            [ force not null <replaceable class="parameter">column_list</replaceable> ] ]</literal>        </term>        <listitem>        <para>        Performs a frontend (client) copy. This is an operation that        runs an <acronym>SQL</acronym> <xref linkend="SQL-COPY"        endterm="SQL-COPY-title"> command, but instead of the server        reading or writing the specified file,        <application>psql</application> reads or writes the file and        routes the data between the server and the local file system.        This means that file accessibility and privileges are those of        the local user, not the server, and no SQL superuser        privileges are required.        </para>        <para>        The syntax of the command is similar to that of the        <acronym>SQL</acronym> <xref linkend="sql-copy"        endterm="sql-copy-title"> command.  Note that, because of this,        special parsing rules apply to the <command>\copy</command>        command. In particular, the variable substitution rules and        backslash escapes do not apply.        </para>        <para>        <literal>\copy <replaceable        class="parameter">table</replaceable> from <replaceable        class="parameter">stdin | stdout</replaceable></literal>        reads/writes based on the command input and output respectively.        All rows are read from the same source that issued the command,        continuing until <literal>\.</literal> is read or the stream        reaches <acronym>EOF</>. Output is sent to the same place as        command output. To read/write from        <application>psql</application>'s standard input or output, use        <literal>pstdin</> or <literal>pstdout</>. This option is useful        for populating tables in-line within a SQL script file.        </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 connection. For large        amounts of data the <acronym>SQL</acronym> command may be preferable.        </para>        </tip>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\copyright</literal></term>        <listitem>        <para>        Shows the copyright and distribution terms of        <productname>PostgreSQL</productname>.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\d [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <term><literal>\d+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        For each relation (table, view, index, or sequence) matching the        <replaceable class="parameter">pattern</replaceable>, show all        columns, their types, the tablespace (if not the default) and any special        attributes such as <literal>NOT NULL</literal> or defaults, if        any. Associated indexes, constraints, rules, and triggers are        also shown, as is the view definition if the relation is a view.        (<quote>Matching the pattern</> is defined below.)        </para>        <para>        The command form <literal>\d+</literal> is identical, except that        more information is displayed: any comments associated with the        columns of the table are shown, as is the presence of OIDs in the        table.        </para>        <note>        <para>        If <command>\d</command> is used without a        <replaceable class="parameter">pattern</replaceable> argument, it is        equivalent to <command>\dtvs</command> which will show a list of        all tables, views, and sequences. This is purely a convenience        measure.        </para>        </note>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\da [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all available aggregate functions, together with the data        type they operate on. If <replaceable        class="parameter">pattern</replaceable>        is specified, only aggregates whose names match the pattern are shown.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\db [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <term><literal>\db+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all available tablespaces. If <replaceable        class="parameter">pattern</replaceable>        is specified, only tablespaces whose names match the pattern are shown.        If <literal>+</literal> is appended to the command name, each object         is listed with its associated permissions.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dc [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all available conversions between character-set encodings.        If <replaceable class="parameter">pattern</replaceable>        is specified, only conversions whose names match the pattern are        listed.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dC</literal></term>        <listitem>        <para>        Lists all available type casts.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dd [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Shows the descriptions of objects matching the <replaceable        class="parameter">pattern</replaceable>, or of all visible objects if        no argument is given.  But in either case, only objects that have        a description are listed.        (<quote>Object</quote> covers aggregates, functions, operators,        types, relations (tables, views, indexes, sequences, large        objects), rules, and triggers.) For example:<programlisting>=&gt; <userinput>\dd version</userinput>                     Object descriptions   Schema   |  Name   |  Object  |        Description------------+---------+----------+--------------------------- pg_catalog | version | function | PostgreSQL version string(1 row)</programlisting>        </para>        <para>        Descriptions for objects can be created with the <xref        linkend="sql-comment" endterm="sql-comment-title">        <acronym>SQL</acronym> command.       </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dD [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all available domains. If <replaceable        class="parameter">pattern</replaceable>        is specified, only matching domains are shown.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\df [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <term><literal>\df+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists available functions, together with their argument and        return types. If <replaceable        class="parameter">pattern</replaceable>        is specified, only functions whose names match the pattern are shown.        If the form <literal>\df+</literal> is used, additional information about        each function, including language and description, is shown.        </para>        <note>        <para>        To look up functions taking argument or returning values of a specific        type, use your pager's search capability to scroll through the <literal>\df</>        output.        </para>        <para>        To reduce clutter, <literal>\df</> does not show data type I/O        functions.  This is implemented by ignoring functions that accept        or return type <type>cstring</>.        </para>        </note>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dg [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all database roles. If <replaceable        class="parameter">pattern</replaceable> is specified, only        those roles whose names match the pattern are listed.        (This command is now effectively the same as <literal>\du</>.)        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\distvS [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        This is not the actual command name: the letters        <literal>i</literal>, <literal>s</literal>, <literal>t</literal>,        <literal>v</literal>, <literal>S</literal> stand for index,        sequence, table, view, and system table, respectively. You can        specify any or all of these letters, in any order, to obtain a        listing of all the matching objects.  The letter S restricts the        listing to system objects; without <literal>S</literal>, only        non-system objects are shown.  If <literal>+</literal> is appended        to the command name, each object is listed with its associated        description, if any.        </para>        <para>        If <replaceable class="parameter">pattern</replaceable> is        specified, only objects whose names match the pattern are listed.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dl</literal></term>        <listitem>        <para>        This is an alias for <command>\lo_list</command>, which shows a        list of large objects.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dn [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <term><literal>\dn+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists all available schemas (namespaces). If <replaceable        class="parameter">pattern</replaceable> (a regular expression)        is specified, only schemas whose names match the pattern are listed.        Non-local temporary schemas are suppressed.  If <literal>+</literal>        is appended to the command name, each object is listed with its associated        permissions and description, if any.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\do [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Lists available operators with their operand and return types.        If <replaceable class="parameter">pattern</replaceable> is        specified, only operators whose names match the pattern are listed.        </para>        </listitem>      </varlistentry>      <varlistentry>        <term><literal>\dp [ <replaceable class="parameter">pattern</replaceable> ]</literal></term>        <listitem>        <para>        Produces a list of all available tables, views and sequences with their        associated access privileges.        If <replaceable class="parameter">pattern</replaceable> is        specified, only tables, views and sequences whose names match the pattern are listed.        </para>        <para>        The commands <command>GRANT</command> and        <command>REVOKE</command> are used to set access privileges.        See <xref linkend="sql-grant" endterm="sql-grant-title">        for more information.        </para>        </listitem>      </varlistentry>

⌨️ 快捷键说明

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