📄 psql-ref.sgml
字号:
<term><literal>\dFp+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Lists available text search parsers. If <replaceable class="parameter">pattern</replaceable> is specified, only parsers whose names match the pattern are shown. If the form <literal>\dFp+</literal> is used, a full description of each parser is shown, including the underlying functions and the list of recognized token types. </para> </listitem> </varlistentry> <varlistentry> <term><literal>\dFt [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <term><literal>\dFt+ [ <replaceable class="parameter">pattern</replaceable> ]</literal></term> <listitem> <para> Lists available text search templates. If <replaceable class="parameter">pattern</replaceable> is specified, only templates whose names match the pattern are shown. If the form <literal>\dFt+</literal> is used, additional information is shown about each template, including the underlying function names. </para> </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 <literal>S</literal> 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 <xref linkend="sql-grant" endterm="sql-grant-title"> and <xref linkend="sql-revoke" endterm="sql-revoke-title"> commands are used to set access privileges. </para> </listitem> </varlistentry> <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>=> <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 might 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -