{"Entry":{"collection":"tool","key":"psql","name":"psql","aliases":["psql"],"metadata":{"aliases":["psql"],"category":"Client applications","content_hash":"55335a4ca513a42a35d079ab722124f676238d1bce30f048dfdc109a2c986747","derived_content_hash":"6e2ec47a48b5bbf321845baad1ce3f81dabd2388c47cfefa37652537b7ef8683","documentation_refresh":{"batch":"20261113","original_source_rev":"","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"imported_at":"2026-09-30T00:40:34.632601+08:00","name":"psql","name_zh":"","slug":"psql","summary":"psql — PostgreSQL interactive terminal"}},"Definition":{"Collection":"tool","Key":"psql","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"psql","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","Facts":{"comparison_data":{"environment":[{"description":"If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.","name":"COLUMNS"},{"description":"Default connection parameters (see Section 32.15 ).","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.","name":"PSQL_EDITOR EDITOR VISUAL"},{"description":"When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.","name":"PSQL_EDITOR_LINENUMBER_ARG"},{"description":"Alternative location for the command history file. Tilde ( ~ ) expansion is performed.","name":"PSQL_HISTORY"},{"description":"If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.","name":"PSQL_PAGER PAGER"},{"description":"When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .","name":"PSQL_WATCH_PAGER"},{"description":"Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.","name":"PSQLRC"},{"description":"Command executed by the \\! command.","name":"SHELL"},{"description":"Directory for storing temporary files. The default is /tmp .","name":"TMPDIR"}],"options":[{"description":"Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .","names":["-a","--echo-all"],"signature":"-a --echo-all"},{"description":"Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .","names":["-A","--no-align"],"signature":"-A --no-align"},{"description":"Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .","names":["-b","--echo-errors"],"signature":"-b --echo-errors"},{"description":"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql \u003c\u003cEOF \\x SELECT * FROM foo; EOF","names":["-c command","--command= command"],"signature":"-c command --command= command"},{"description":"Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .","names":["--csv"],"signature":"--csv"},{"description":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname"},{"description":"Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .","names":["-e","--echo-queries"],"signature":"-e --echo-queries"},{"description":"Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .","names":["-E","--echo-hidden"],"signature":"-E --echo-hidden"},{"description":"Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql \u003c filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand.","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename"},{"description":"Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .","names":["-F separator","--field-separator= separator"],"signature":"-F separator --field-separator= separator"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.","names":["-h hostname","--host= hostname"],"signature":"-h hostname --host= hostname"},{"description":"Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.","names":["-H","--html"],"signature":"-H --html"},{"description":"List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable).","names":["-l","--list"],"signature":"-l --list"},{"description":"Write all query output into file filename , in addition to the normal output destination.","names":["-L filename","--log-file= filename"],"signature":"-L filename --log-file= filename"},{"description":"Do not use Readline for line editing and do not use the command history (see the section called “Command-Line Editing” below).","names":["-n","--no-readline"],"signature":"-n --no-readline"},{"description":"Put all query output into file filename . This is equivalent to the command \\o .","names":["-o filename","--output= filename"],"signature":"-o filename --output= filename"},{"description":"Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .","names":["-P assignment","--pset= assignment"],"signature":"-P assignment --pset= assignment"},{"description":"Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .","names":["-q","--quiet"],"signature":"-q --quiet"},{"description":"Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .","names":["-R separator","--record-separator= separator"],"signature":"-R separator --record-separator= separator"},{"description":"Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.","names":["-s","--single-step"],"signature":"-s --single-step"},{"description":"Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user.","names":["-S","--single-line"],"signature":"-S --single-line"},{"description":"Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .","names":["-t","--tuples-only"],"signature":"-t --tuples-only"},{"description":"Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.","names":["-T table_options","--table-attr= table_options"],"signature":"-T table_options --table-attr= table_options"},{"description":"Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.","names":["-v assignment","--set= assignment","--variable= assignment"],"signature":"-v assignment --set= assignment --variable= assignment"},{"description":"Print the psql version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .","names":["-x","--expanded"],"signature":"-x --expanded"},{"description":"Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).","names":["-X","--no-psqlrc"],"signature":"-X --no-psqlrc"},{"description":"Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .","names":["-z","--field-separator-zero"],"signature":"-z --field-separator-zero"},{"description":"Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .","names":["-0","--record-separator-zero"],"signature":"-0 --record-separator-zero"},{"description":"This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail.","names":["-1","--single-transaction"],"signature":"-1 --single-transaction"},{"description":"Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.","names":["-?","--help[= topic ]"],"signature":"-? --help[= topic ]"}],"synopsis":["psql [ option ...] [ dbname [ username ]]"]},"comparison_hash":"7e52d8ca2dae4caec99412af17f0657a086f7413f9904aa5e55efb826f752e8b","description":["psql — PostgreSQL interactive terminal"],"description_zh":"psql — PostgreSQL 的交互式终端","description_zh_html":"\u003cdiv class=\"refentry\" id=\"APP-PSQL\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e — \n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的交互式终端\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003e大纲\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.21.4.1\"\u003e\u003ccode class=\"command\"\u003epsql\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n    [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.5\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的一个基于终端的前端。它使你能够交互式地输入查询，将其发送给 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e，并查看查询结果。也可以从文件或命令行参数提供输入。此外，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 还提供了若干元命令和多种类似 shell 的特性，以便于编写脚本和自动化执行各种任务。\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"R1-APP-PSQL-3\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ALL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-all\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      在读入时将所有非空输入行打印到标准输出（不适用于交互式行读取）。这等效于把变量 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 设置为\n      \u003ccode class=\"literal\"\u003eall\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-ALIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-A\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-align\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      切换到非对齐输出模式（默认输出模式是 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e）。这等效于\u003ccode class=\"command\"\u003e\\pset format unaligned\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-b\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-errors\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      把失败的 SQL 命令打印到标准错误输出。这等效于把变量 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 设置为 \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--command=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 执行一个给定的命令字符串 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e。这个选项可以重复多次并且以任何顺序与 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 选项组合在一起。当 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 或者 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 被指定时，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 不会从标准输入读取命令，而是在按顺序处理完所有 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 选项后终止。\n      \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 必须是一个服务器完全可解析的命令字符串（即不包含 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 专有的特性）或者单个反斜线命令。因此不能在一个 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项中混合 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 和 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 元命令。要那样做，可以使用多个 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项或者把字符串用管道输送到 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中，例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npsql -c '\\x' -c 'SELECT * FROM foo;'\n\u003c/pre\u003e\u003cp\u003e\n       或者\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\necho '\\x \\\\ SELECT * FROM foo;' | psql\n\u003c/pre\u003e\u003cp\u003e\n       （\u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e 是分隔符元命令）。\n      \u003c/p\u003e\u003cp\u003e\n       每个 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令字符串传递给 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 都作为一个单独的请求发送到服务器。因此，即使字符串包含多个 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令，服务器也会将其作为单个事务执行，除非字符串中包含明确的 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e 命令将其分成多个事务。（有关服务器如何处理多查询字符串的更多详细信息，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. 一个简单查询中的多条语句\"\u003e第 54.2.2.1 节\u003c/a\u003e。）\n      \u003c/p\u003e\u003cp\u003e\n       如果不希望在一个事务中执行多个命令，可以使用重复的 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 命令，或将多个命令输入到 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的标准输入，可以像上面示例中使用 \u003cspan class=\"application\"\u003eecho\u003c/span\u003e，也可以通过 shell 的 here-document，例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npsql \u0026lt;\u0026lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-CSV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--csv\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      切换到 \u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e（逗号分隔值）输出模式。这相当于\u003ccode class=\"command\"\u003e\\pset format csv\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定要连接的数据库的名称。这等效于指定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 为命令行上的第一个非选项参数。\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 可以是\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. 连接字符串\"\u003e连接字符串\u003c/a\u003e。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-queries\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      也把发送到服务器的所有 SQL 命令复制到标准输出。这等效于把变量 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 设置为 \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-hidden\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      回显\u003ccode class=\"command\"\u003e\\d\u003c/code\u003e 以及其他反斜线命令生成的实际查询。可以用它来学习 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的内部操作。这等效于把变量 \u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e 设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       从文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 而不是标准输入中读取命令。这个选项可以重复指定，也可以按任意顺序与 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项组合使用。当指定了 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 或 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 时，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 不会从标准输入读取命令，而是在按顺序处理完所有 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 选项后终止。除此之外，这个选项在很大程度上等价于元命令\u003ccode class=\"command\"\u003e\\i\u003c/code\u003e。\n      \u003c/p\u003e\u003cp\u003e\n       如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 是\u003ccode class=\"literal\"\u003e-\u003c/code\u003e（连字符），则会读取标准输入，直到遇到 \u003cacronym class=\"acronym\"\u003eEOF\u003c/acronym\u003e 指示或\u003ccode class=\"command\"\u003e\\q\u003c/code\u003e 元命令。这可用于将交互式输入与文件输入交错使用。不过请注意，这种情况下不会使用 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e（很像指定了 \u003ccode class=\"option\"\u003e-n\u003c/code\u003e 时的情况）。\n      \u003c/p\u003e\u003cp\u003e\n      使用这个选项与写成 \u003ccode class=\"literal\"\u003epsql \u0026lt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e 有细微差别。通常两种形式都会得到你期望的结果，但使用 \u003ccode class=\"literal\"\u003e-f\u003c/code\u003e 可以启用一些有用的特性，例如带行号的错误消息。使用这个选项也还有一点机会降低启动开销。另一方面，使用 shell 输入重定向的形式在理论上能保证得到与你手工逐行输入时完全相同的输出。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      使用 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e 作为非对齐输出的字段分隔符。这等效于\u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e 或者\u003ccode class=\"command\"\u003e\\f\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-H\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      切换到 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 输出模式。这等效于\u003ccode class=\"command\"\u003e\\pset format html\u003c/code\u003e 或者\u003ccode class=\"command\"\u003e\\H\u003c/code\u003e 命令。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--list\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      列出所有可用的数据库，然后退出。其他非连接选项会被忽略。这与元命令\u003ccode class=\"command\"\u003e\\list\u003c/code\u003e 类似。\n      \u003c/p\u003e\u003cp\u003e\n      使用该选项时，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将连接到数据库 \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e，除非命令行上指定了其他数据库（通过 \u003ccode class=\"option\"\u003e-d\u003c/code\u003e 选项或非选项参数，也可能通过服务项，但不能通过环境变量）。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LOG-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--log-file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       除了把所有查询输出写到普通输出目标之外，还写到文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 中。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-READLINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       不要使用 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e 进行行编辑，也不要使用命令历史记录（请参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"命令行编辑\"\u003e“命令行编辑”一节\u003c/a\u003e）。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-OUTPUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--output=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      把所有查询输出放到文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 中。这等效于命令\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       指定服务器正在监听连接的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量；如果未设置，则取编译时指定的端口，通常为 5432。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pset=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      以\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e 的形式指定打印选项。注意，这里你必须用一个等号而不是空格来分隔名称和值。例如，要设置输出格式为 \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e，应该写成 \u003ccode class=\"literal\"\u003e-P format=latex\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      指定 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 应该安静地工作。默认情况下，它会打印出欢迎消息和各种提示信息。如果使用了这个选项，以上那些就都不会输出。在使用 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项时，配合这个选项很有用。这等效于设置变量 \u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e 为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      把 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e 用作非对齐输出的记录分隔符。这等效于\u003ccode class=\"command\"\u003e\\pset recordsep\u003c/code\u003e 命令。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-STEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-step\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      运行在单步模式中。这意味着在每个命令被发送给服务器之前都会提示用户，并允许取消执行。使用这个选项可以调试脚本。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-LINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-line\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      运行在单行模式中，其中换行符会终止一个 SQL 命令，就像分号的作用一样。\n      \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n      这种模式是为坚持使用它的用户提供的，但并不一定值得推荐。特别是，如果在一行中混合了 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 和元命令，对于没有经验的用户来说，它们的执行顺序未必总是清楚的。\n      \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tuples-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      关闭打印列名和结果行计数页脚等。这等效于\u003ccode class=\"command\"\u003e\\t\u003c/code\u003e 或者\u003ccode class=\"command\"\u003e\\pset tuples_only\u003c/code\u003e 命令。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TABLE-ATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table-attr=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      指定要放在 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e 标签内的选项。详见\u003ccode class=\"command\"\u003e\\pset tableattr\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-USERNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      作为用户 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e 而不是默认用户连接到数据库（当然，你必须具有这样做的权限）。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VARIABLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--set=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--variable=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      执行一次变量赋值，和\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 元命令相似。注意你必须在命令行上用等号分隔名字和值（如果有）。要取消变量的设置，去掉等号就行。要把一个变量设为空字符串，使用等号但是去掉值。这些赋值在命令行处理期间被完成，因此反映连接状态的变量将在稍后被覆盖。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      打印 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 版本并且退出。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       永不发出密码提示。如果服务器要求密码认证，而密码又无法从其他来源获得，例如\u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件，则连接尝试将失败。这个选项对于批处理任务和脚本很有用，因为那时通常没有用户在场输入密码。\n      \u003c/p\u003e\u003cp\u003e\n       请注意，这个选项在整个会话期间都会保持生效，因此它不仅影响初始连接尝试，也会影响元命令\u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       强制 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 在连接数据库之前提示输入密码，即使该密码实际上不会被使用。\n      \u003c/p\u003e\u003cp\u003e\n       如果服务器要求密码认证，而密码又无法从其他来源获得，例如\u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件，则 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 无论如何都会提示输入密码。不过，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 需要先浪费一次连接尝试，才能知道服务器要求密码。在某些情况下，显式指定 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e 值得用来避免这次额外的连接尝试。\n      \u003c/p\u003e\u003cp\u003e\n       请注意，这个选项在整个会话期间都会保持生效，因此它不仅影响初始连接尝试，也会影响元命令\u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--expanded\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      打开扩展表格式模式。这等效于\u003ccode class=\"command\"\u003e\\x\u003c/code\u003e 或者\u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e 命令。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      不读取启动文件（既不读取系统范围的 \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e 文件，也不读取用户的 \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e 文件）。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      设置非对齐输出的字段分隔符为零字节。这等效于\u003ccode class=\"command\"\u003e\\pset fieldsep_zero\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-0\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      设置非对齐输出的记录分隔符为零字节。例如，这有助于与 \u003ccode class=\"literal\"\u003exargs -0\u003c/code\u003e 配合使用。这等效于\u003ccode class=\"command\"\u003e\\pset recordsep_zero\u003c/code\u003e。\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-1\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-transaction\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这个选项只能与一个或多个 \u003ccode class=\"option\"\u003e-c\u003c/code\u003e 和/或 \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 选项结合使用。它会导致 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 在第一个这样的选项之前发出一个 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e 命令，并在最后一个选项之后发出一个 \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e 命令，从而将所有命令包装成一个单独的事务。如果任何命令失败且变量 \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e 被设置，则会改为发送一个 \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e 命令。这确保要么所有命令都成功完成，要么不应用任何更改。\n\u003c/p\u003e\u003cp\u003e\n        如果命令本身包含 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e、\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e 或 \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e，这个选项就不会产生期望的效果。另外，如果某个单独命令不能在事务块中执行，指定这个选项将导致整个事务失败。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      显示有关 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的帮助并且退出。可选的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e 参数（默认为 \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e）选择要解释 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的哪一部分：\u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e 描述 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的反斜线命令；\u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e 描述可以被传递给 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的命令行选项；而 \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e 则显示有关 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 配置变量的帮助。\n      \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.7\"\u003e\u003ch2\u003e退出状态\u003c/h2\u003e\u003cp\u003e\n   如果 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 正常结束，它会向 shell 返回 0；如果它自身发生致命错误（例如内存耗尽、找不到文件），则返回 1；如果到服务器的连接发生故障且该会话不是交互式的，则返回 2；如果脚本中发生错误且变量 \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e 已设置，则返回 3。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.8\"\u003e\u003ch2\u003e用法\u003c/h2\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\"\u003e\u003ch3\u003e连接到数据库\u003c/h3\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 是常规的\n    \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 客户端应用程序。要连接到数据库，你需要知道目标数据库名称、服务器的主机名和端口号，以及要以哪个数据库用户名连接。\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 可以通过命令行选项\n    \u003ccode class=\"option\"\u003e-d\u003c/code\u003e、\u003ccode class=\"option\"\u003e-h\u003c/code\u003e、\u003ccode class=\"option\"\u003e-p\u003c/code\u003e 和\n    \u003ccode class=\"option\"\u003e-U\u003c/code\u003e 分别指定这些参数。如果遇到一个不属于任何选项的参数，它将被解释为数据库名（如果数据库名已经给出，则解释为数据库用户名）。并非所有这些选项都是必需的；它们都有有用的默认值。如果省略主机名，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 在 Unix 上将通过 Unix 域套接字连接到本地主机上的服务器，在 Windows 上则通过 TCP/IP 连接到 \u003ccode class=\"literal\"\u003elocalhost\u003c/code\u003e。默认端口号在编译时确定。由于数据库服务器使用相同的默认值，因此在大多数情况下不必指定端口。默认数据库用户名是你的操作系统用户名。数据库用户名确定后，它也会被用作默认数据库名。请注意，你不能随意以任意数据库用户名连接到任意数据库。数据库管理员应当已经告知你拥有的访问权限。\n    \u003c/p\u003e\u003cp\u003e\n    当默认值不完全合适时，可以通过把环境变量 \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e、\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e、\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 和 \u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e 设置为适当的值来少敲一些键盘（额外的环境变量见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。另外，准备一个 \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e 文件也很方便，这样就不必经常手工输入密码。详见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-pgpass.html\" title=\"32.16. 密码文件\"\u003e第 32.16 节\u003c/a\u003e。\n    \u003c/p\u003e\u003cp\u003e\n     指定连接参数的另一种方法是使用一个 \u003cem class=\"parameter\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e 字符串或一个 \u003cacronym class=\"acronym\"\u003eURI\u003c/acronym\u003e，它可用来替代数据库名。这种机制可以让你对连接进行非常细致的控制。例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql \"service=myservice sslmode=require\"\u003c/code\u003e\u003c/strong\u003e\n$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql postgresql://dbmaster:5433/mydb?sslmode=require\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n     用这种方式，你也可以把 \u003cacronym class=\"acronym\"\u003eLDAP\u003c/acronym\u003e 用于\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-ldap.html\" title=\"32.18. 连接参数的 LDAP 查找\"\u003e第 32.18 节\u003c/a\u003e中描述的连接参数查找。可用连接选项的更多信息请见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2. 参数关键词\"\u003e第 32.1.2 节\u003c/a\u003e。\n    \u003c/p\u003e\u003cp\u003e\n    如果由于任何原因（例如权限不足、服务器没有在目标主机上运行等）导致连接无法建立，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将返回一个错误并且终止。\n    \u003c/p\u003e\u003cp\u003e\n     如果标准输入和标准输出都是终端，那么 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会把客户端编码设置为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eauto\u003c/span\u003e”\u003c/span\u003e，从区域设置中检测合适的客户端编码（在 Unix 系统上是 \u003ccode class=\"envar\"\u003eLC_CTYPE\u003c/code\u003e 环境变量）。如果结果不符合预期，可以使用环境变量 \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e 覆盖客户端编码。\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-4\"\u003e\u003ch3\u003e输入 SQL 命令\u003c/h3\u003e\u003cp\u003e\n    在正常操作时，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会提供一个提示符，该提示符是 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 当前连接到的数据库名称后面跟上字符串\u003ccode class=\"literal\"\u003e=\u0026gt;\u003c/code\u003e。例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql testdb\u003c/code\u003e\u003c/strong\u003e\npsql (18.7)\nType \"help\" for help.\n\ntestdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    在提示符下，用户可以输入 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令。通常，当遇到表示命令结束的分号时，输入的内容就会被发送给服务器。行结束并不会终止一条命令，因此为了提高清晰度，命令可以分布在多行上。如果命令被发送并成功执行，其结果就会显示在屏幕上。\n    \u003c/p\u003e\u003cp\u003e\n    如果不受信任的用户能够访问尚未采用\u003ca class=\"link\" href=\"/zh/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6. 使用方式\"\u003e模式的安全使用方式\u003c/a\u003e的数据库，请在会话开始时从 \u003ccode class=\"varname\"\u003esearch_path\u003c/code\u003e 中移除所有公众可写的模式。可以在连接字符串中加入 \u003ccode class=\"literal\"\u003eoptions=-csearch_path=\u003c/code\u003e，或者在执行其他 SQL 命令之前发出 \u003ccode class=\"literal\"\u003eSELECT pg_catalog.set_config('search_path', '', false)\u003c/code\u003e。这种考虑并非 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 特有；它适用于任何执行任意 SQL 命令的接口。\n    \u003c/p\u003e\u003cp\u003e\n    每当执行命令时，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 也会轮询由 \u003ca class=\"link\" href=\"/zh/docs/18/sql-listen.html\" title=\"LISTEN\"\u003e\u003ccode class=\"command\"\u003eLISTEN\u003c/code\u003e\u003c/a\u003e 和 \u003ca class=\"link\" href=\"/zh/docs/18/sql-notify.html\" title=\"NOTIFY\"\u003e\u003ccode class=\"command\"\u003eNOTIFY\u003c/code\u003e\u003c/a\u003e 生成的异步通知事件。\n    \u003c/p\u003e\u003cp\u003e\n    虽然 C 风格的块注释会被传给服务器处理并移除，但 SQL 标准注释会由 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 自行移除。\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\"\u003e\u003ch3\u003e元命令\u003c/h3\u003e\u003cp\u003e\n    你输入到 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中的任何以未加引号的反斜线开始的东西都是一个 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 元命令，它们由 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 自行处理。这些命令让 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 对管理和编写脚本更有用。元命令常常被称作斜线或者反斜线命令。\n    \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 命令的格式是用反斜线后面直接跟上一个命令动词，然后是一些参数。参数与命令动词和其他参数之间用任意多个空白字符分隔开。\n    \u003c/p\u003e\u003cp\u003e\n    要在参数中包含空白，可以用单引号将它括起来。要在参数中包含一个单引号，可以在单引号文本内写两个单引号。单引号中的内容还会接受类似 C 语言的替换：\u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e（换行）、\u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e（制表符）、\u003ccode class=\"literal\"\u003e\\b\u003c/code\u003e（退格）、\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e（回车）、\u003ccode class=\"literal\"\u003e\\f\u003c/code\u003e（换页）、\u003ccode class=\"literal\"\u003e\\\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e（八进制）以及\u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e（十六进制）。在单引号文本内，反斜线出现在任何其他字符前面时，只是对该单个字符进行转义，不论它是什么字符。\n    \u003c/p\u003e\u003cp\u003e\n    如果在参数中出现一个未加引号的冒号（\u003ccode class=\"literal\"\u003e:\u003c/code\u003e），后面紧跟一个 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量名，它就会被该变量的值替换，如下面 \u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL 插值\"\u003eSQL 插值\u003c/a\u003e所述。其中介绍的\u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e 和\u003ccode class=\"literal\"\u003e:\"\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\"\u003c/code\u003e 形式也同样适用。\u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e语法允许测试变量是否已定义；它会被 TRUE 或 FALSE 替换。用反斜线转义该冒号可以防止替换发生。\n    \u003c/p\u003e\u003cp\u003e\n    在参数中，用反引号（\u003ccode class=\"literal\"\u003e`\u003c/code\u003e）包围的文本会被视为传给 shell 的命令行。该命令的输出（去掉末尾的换行符）会替换反引号中的文本。在反引号包围的文本内部，不会进行特殊的引号处理或其他处理，但出现\u003ccode class=\"literal\"\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e 时，如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e 是 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量名，就会被替换为该变量的值。此外，\u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e 也会被替换为该变量的值，并会适当地加上引号，使其成为单个 shell 命令参数。（后一种形式几乎总是更可取，除非你非常确定变量中包含什么。）由于无法保证在所有平台上都能对回车和换行字符安全地加引号，当变量值中出现这类字符时，\u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e 形式会打印错误消息，并且不会替换变量值。\n    \u003c/p\u003e\u003cp\u003e\n    有些命令把 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 标识符（例如表名）作为参数。这些参数遵循 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 的语法规则：未加引号的字母会被强制转换为小写，而双引号（\u003ccode class=\"literal\"\u003e\"\u003c/code\u003e）可以保护字母不发生大小写转换，并允许在标识符中包含空白。在双引号内，成对的双引号会在结果名称中折叠成一个双引号。例如，\u003ccode class=\"literal\"\u003eFOO\"BAR\"BAZ\u003c/code\u003e 会被解释为 \u003ccode class=\"literal\"\u003efooBARbaz\u003c/code\u003e，而\u003ccode class=\"literal\"\u003e\"A weird\"\" name\"\u003c/code\u003e 会变成 \u003ccode class=\"literal\"\u003eA weird\" name\u003c/code\u003e。\n    \u003c/p\u003e\u003cp\u003e\n    参数解析会在行尾或遇到另一个未加引号的反斜线时停止。未加引号的反斜线会被视为新元命令的开始。特殊序列\u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e（两个反斜线）表示参数结束，并继续解析 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令（如果还有）。通过这种方式，\u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令和 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 命令可以自由地混合在同一行中。但无论如何，元命令的参数都不能延续到下一行。\n    \u003c/p\u003e\u003cp\u003e\n    许多元命令作用于\u003cem class=\"firstterm\"\u003e当前查询缓冲区\u003c/em\u003e。这只是一个保存已输入但尚未发送到服务器执行的 SQL 命令文本的缓冲区。其中既包括先前输入的行，也包括同一行上位于元命令之前的文本。\n   \u003c/p\u003e\u003cp\u003e\n    许多元命令还允许在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e 作为选项。这会使结果以扩展模式显示，就像使用了 \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e 或 \u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e 一样。\n    \u003c/p\u003e\u003cp\u003e\n    定义了以下元命令：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-A\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\a\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果当前表格输出格式是非对齐，则切换为对齐；否则切换为非对齐。保留此命令是为了向后兼容。更通用的解决方案请参见\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         为下一次查询执行设置查询参数，并将指定参数传给任意参数占位符（\u003ccode class=\"literal\"\u003e$1\u003c/code\u003e 等）。\n        \u003c/p\u003e\u003cp\u003e\n         示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nINSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         这对除 \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 之外的查询执行命令也有效，例如 \u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e 和\n         \u003ccode class=\"literal\"\u003e\\gset\u003c/code\u003e。\n        \u003c/p\u003e\u003cp\u003e\n         此命令会使用扩展查询协议（参见\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. 扩展查询概述\"\u003e第 54.1.2 节\u003c/a\u003e），不同于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 通常使用的简单查询协议。因此，可以用它在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中测试扩展查询协议。（即使查询没有参数，而且此命令指定了零个参数，也会使用扩展查询协议。）此命令只影响下一条被执行的查询；之后的所有查询默认仍会使用简单查询协议。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e 等同于 \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e，不同之处在于它把现有预备语句的名称作为第一个参数。空字符串表示未命名的预备语句。\n        \u003c/p\u003e\u003cp\u003e\n         示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nINSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         此命令会使用扩展查询协议（参见\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. 扩展查询概述\"\u003e第 54.1.2 节\u003c/a\u003e），不同于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 通常使用的简单查询协议。因此，可以用它在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中测试扩展查询协议。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\c\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\connect [ -reuse-previous=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eon|off\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e ] | \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        建立到 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器的新连接。可以使用位置语法（数据库名称、用户、主机和端口中的一个或多个）指定要使用的连接参数，也可以使用 \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e 连接字符串，详见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. 连接字符串\"\u003e第 32.1.1 节\u003c/a\u003e。如果没有给出参数，则使用与之前相同的参数建立新连接。\n        \u003c/p\u003e\u003cp\u003e\n        将 \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e、\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e、\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e 或\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e 中的任意一个指定为\n        \u003ccode class=\"literal\"\u003e-\u003c/code\u003e，等同于省略该参数。\n        \u003c/p\u003e\u003cp\u003e\n        新连接可以重用前一个连接的连接参数；不仅包括数据库名称、用户、主机和端口，还包括其他设置，如 \u003cem class=\"replaceable\"\u003e\u003ccode\u003esslmode\u003c/code\u003e\u003c/em\u003e。默认情况下，参数在位置语法中被重用，但在给定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e 字符串时不会被重用。传递 \u003ccode class=\"literal\"\u003e-reuse-previous=on\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e-reuse-previous=off\u003c/code\u003e 作为第一个参数将覆盖该默认设置。如果参数被重用，则任何未明确指定为位置参数或在 \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e 字符串中的参数将从现有连接的参数中获取。一个例外是，如果使用位置语法更改 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e 设置，使其不同于先前的值，则现有连接参数中存在的任何 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostaddr\u003c/code\u003e\u003c/em\u003e 设置将被删除。此外，仅当用户、主机和端口设置未更改时，才会重用现有连接使用的任何密码。当命令既不指定也不重用特定参数时，将使用 \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 的默认值。\n        \u003c/p\u003e\u003cp\u003e\n        如果新连接成功建立，则关闭先前的连接。如果连接尝试失败（用户名错误，访问被拒绝等），且 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 处于交互模式，则保留先前的连接。但在执行非交互脚本时，旧连接将被关闭并报告错误。这可能会或可能不会终止脚本；如果没有终止，直到成功执行另一个\u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e 命令之前，所有访问数据库的命令都将失败。采用这种区别，一方面是为了方便用户应对输入笔误，另一方面是为了防止脚本意外操作错误的数据库。请注意，每当\u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e 命令尝试重新使用参数时，重新使用的值是最后一个成功连接的值，而不是随后的任何失败尝试的值。但是，在非交互\u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e 失败的情况下，不允许稍后重新使用参数，因为脚本可能期望从失败的\u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e 中重新使用值。\n        \u003c/p\u003e\u003cp\u003e\n        示例：\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \\c mydb myuser host.dom 6432\n=\u0026gt; \\c service=foo\n=\u0026gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=\u0026gt; \\c -reuse-previous=on sslmode=require    -- 仅更改 sslmode\n=\u0026gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\C [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置作为查询结果打印的表的标题，或取消此类标题。该命令等价于\u003ccode class=\"literal\"\u003e\\pset title \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e。（此命令的名称源自\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecaption\u003c/span\u003e”\u003c/span\u003e，因为它过去只用于设置 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 表的标题。）\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\cd [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         将当前工作目录更改为\n         \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e。如果没有参数，则切换到当前用户的主目录。关于如何确定主目录，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-pgpass.html\" title=\"32.16. 密码文件\"\u003e第 32.16 节\u003c/a\u003e。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n          要打印当前工作目录，请使用\u003ccode class=\"literal\"\u003e\\! pwd\u003c/code\u003e。\n         \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprepared_statement_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         关闭指定的预备语句。空字符串表示未命名的预备语句。如果不存在该名称的预备语句，则不执行任何操作。\n        \u003c/p\u003e\u003cp\u003e\n         示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nSELECT $1 \\parse stmt1\n\\close_prepared stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         此命令会使用扩展查询协议，不同于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 通常使用的简单查询协议。因此，可以用它在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中测试扩展查询协议。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CONNINFO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\conninfo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          输出当前数据库连接的信息；如果正在使用 SSL，也包括与 SSL 相关的信息。\n         \u003c/p\u003e\u003cp\u003e\n          请注意，\u003ccode class=\"structfield\"\u003eClient User\u003c/code\u003e 字段显示的是连接建立时的用户，而\n          \u003ccode class=\"structfield\"\u003eSuperuser\u003c/code\u003e 字段表示当前用户（在当前执行上下文中）是否具有超级用户权限。这两个用户通常相同，但也可能不同，例如当前用户曾通过\n          \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e 命令被更改。\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-COPY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] }\n        \u003ccode class=\"literal\"\u003efrom\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdin | pstdin }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\n        [ where \u003cem class=\"replaceable\"\u003e\u003ccode\u003econdition\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] | ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003equery\u003c/code\u003e\u003c/em\u003e ) }\n        \u003ccode class=\"literal\"\u003eto\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdout | pstdout }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        执行前端（客户端）复制。该操作会运行一个 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e\n\u003ca class=\"link\" href=\"/zh/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e 命令，但并不是由服务器读取或写入指定文件，而是由 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 读取或写入文件，并在服务器与本地文件系统之间转送数据。这意味着文件可访问性和权限取决于本地用户，而不是服务器，也不需要 SQL 超级用户权限。\n\u003c/p\u003e\u003cp\u003e\n        当指定 \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e 时，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 由 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 执行，传给 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 的数据或从其中读出的数据都会在服务器与客户端之间转送。再次强调，执行权限属于本地用户，而不是服务器，也不需要 SQL 超级用户权限。\n        \u003c/p\u003e\u003cp\u003e\n        对于 \u003ccode class=\"literal\"\u003e\\copy ... from stdin\u003c/code\u003e，数据行会从发出该命令的同一输入源读取，直到读到仅包含 \u003ccode class=\"literal\"\u003e\\.\u003c/code\u003e 的一行或流到达 \u003cacronym class=\"acronym\"\u003eEOF\u003c/acronym\u003e 为止。这个选项适合在 SQL 脚本文件中以内联方式填充表。对于 \u003ccode class=\"literal\"\u003e\\copy ... to stdout\u003c/code\u003e，输出会发送到与 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 命令输出相同的位置，并且不会打印 \u003ccode class=\"literal\"\u003eCOPY \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e 命令状态（因为这可能与数据行混淆）。若要读写 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的标准输入或输出，而不受当前命令来源或 \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e 选项影响，请写成 \u003ccode class=\"literal\"\u003efrom pstdin\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eto pstdout\u003c/code\u003e。\n        \u003c/p\u003e\u003cp\u003e\n        该命令的语法与 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e \u003ca class=\"link\" href=\"/zh/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e 命令类似。除数据源或目标之外，其他所有选项都与 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 命令中的指定相同。因此，特殊的解析规则适用于\u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e 元命令。与大多数其他元命令不同，整个剩余行始终被视为\u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e 的参数，参数中不执行变量插值或反引号扩展。\n\u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        另一种获得与\u003ccode class=\"literal\"\u003e\\copy ... to\u003c/code\u003e 相同结果的方法是使用 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e\n\u003ccode class=\"literal\"\u003eCOPY ... TO STDOUT\u003c/code\u003e 命令，并以\u003ccode class=\"literal\"\u003e\\g \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\n        或\u003ccode class=\"literal\"\u003e\\g |\u003cem class=\"replaceable\"\u003e\u003ccode\u003eprogram\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e 结束。与\u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e 不同，这种方法允许命令跨越多行；此外，可以使用变量插值和反引号扩展。\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        这些操作不如以文件或程序作为数据源或目标的 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 命令高效，因为所有数据都必须通过客户端/服务器连接传输。对于大量数据，使用 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e\n        命令可能更合适。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copyright\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的版权和分发条款。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\crosstabview [\n            \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        执行当前查询缓冲区（与\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 类似），并以交叉表网格显示结果。查询必须返回至少三列。由 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 标识的输出列成为纵向表头，由 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 标识的输出列成为横向表头。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e 标识要在网格中显示的输出列。\u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 标识横向表头的可选排序列。\n       \u003c/p\u003e\u003cp\u003e\n        每个列指定都可以是列号（从 1 开始）或列名。通常的 SQL 大小写折叠和加引号规则适用于列名。如果省略，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 取第 1 列，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 取第 2 列。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 必须不同于 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e。如果未指定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e，查询结果必须恰好有三列，既不是 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 也不是 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 的那一列被用作 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        纵向表头显示为最左列，包含 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 列中的值，其顺序与查询结果中相同，但会移除重复值。\n       \u003c/p\u003e\u003cp\u003e\n        横向表头显示为第一行，包含 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 列中的值，并移除重复值。默认情况下，它们按查询结果中的相同顺序显示。但如果给出了可选的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 参数，它所标识的列的值必须是整数，而 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 中的值会按照对应的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 值排序后显示在横向表头中。\n       \u003c/p\u003e\u003cp\u003e\n        在交叉表网格中，对于 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 中的每个不同值 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 中的每个不同值 \u003ccode class=\"literal\"\u003ey\u003c/code\u003e，交点\u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e 处的单元格包含查询结果中 \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e 列的值，该结果行的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 值为 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 值为 \u003ccode class=\"literal\"\u003ey\u003c/code\u003e。如果没有这样的行，单元格为空。如果存在多条这样的行，则报错。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-D\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\d[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        对于每个与 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的关系（表、视图、物化视图、索引、序列或外部表）或复合类型，显示所有列、它们的类型、表空间（如果不是默认的）以及任何特殊属性，如 \u003ccode class=\"literal\"\u003eNOT NULL\u003c/code\u003e 或默认值。还显示相关的索引、约束、规则和触发器。对于外部表，还显示关联的外部服务器。（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e匹配模式\u003c/span\u003e”\u003c/span\u003e的定义在下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e模式\u003c/a\u003e中。）\n        \u003c/p\u003e\u003cp\u003e\n        对于某些类型的关系，\u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 显示每列的附加信息：序列的列值，索引的索引表达式，外部表的外部数据包装器选项。\n        \u003c/p\u003e\u003cp\u003e\n        命令形式\u003ccode class=\"literal\"\u003e\\d+\u003c/code\u003e与前者相同，但会显示更多信息：表列关联的注释、表是否包含 OID、当关系为视图时的视图定义、非默认的\u003ca class=\"link\" href=\"/zh/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\"\u003e复制标识\u003c/a\u003e设置，以及当关系具有访问方法时的\u003ca class=\"link\" href=\"/zh/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\"\u003e访问方法\u003c/a\u003e名称。\n        \u003c/p\u003e\u003cp\u003e\n        默认情况下，只显示用户创建的对象；提供一个模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符以包括系统对象。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        如果使用\u003ccode class=\"command\"\u003e\\d\u003c/code\u003e 而没有 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数，它等同于\u003ccode class=\"command\"\u003e\\dtvmsE\u003c/code\u003e，它将显示所有可见的表、视图、物化视图、序列和外部表的列表。这纯粹是一种便利措施。\n\u003c/p\u003e\u003cp\u003e\n        与许多其他命令一样，如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，仅此命令的结果会以扩展模式显示。但请注意，这只适用于不带 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数或用于描述序列的 \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e。同样的扩展输出限制也适用于 \u003ccode class=\"command\"\u003e\\x on\u003c/code\u003e 和 \u003ccode class=\"command\"\u003e\\x auto\u003c/code\u003e。\u003ccode class=\"literal\"\u003ex\u003c/code\u003e 修饰符不能直接紧跟在 \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e 后面（因为 \u003ccode class=\"command\"\u003e\\dx\u003c/code\u003e 是另一个命令）。\u003ccode class=\"literal\"\u003ex\u003c/code\u003e 只能出现在 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e 修饰符之后。例如，\u003ccode class=\"command\"\u003e\\d+x\u003c/code\u003e 等同于 \u003ccode class=\"command\"\u003e\\dtvmsE+x\u003c/code\u003e，并以扩展模式显示所有关系的列表。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\da[Sx] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出聚合函数，以及它们的返回类型和所作用的数据类型。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的聚合。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dA[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出访问方法。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的访问方法。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个访问方法都会连同其关联的处理器函数和描述一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAC\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAc[x+]\n            [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出操作符类（参见\u003ca class=\"xref\" href=\"/zh/docs/18/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1. 索引方法和操作符类\"\u003e第 36.16.1 节\u003c/a\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的访问方法关联的操作符类。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的输入类型关联的操作符类。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个操作符类都会连同其关联的操作符族和所有者一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAF\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAf[x+]\n            [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出操作符族（参见\u003ca class=\"xref\" href=\"/zh/docs/18/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5. 操作符类和操作符族\"\u003e第 36.16.5 节\u003c/a\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的访问方法关联的操作符族。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的输入类型关联的操作符族。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个操作符族都会连同其所有者一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAO\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAo[x+]\n            [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出与操作符族关联的操作符（参见\u003ca class=\"xref\" href=\"/zh/docs/18/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2. 索引方法策略\"\u003e第 36.16.2 节\u003c/a\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的访问方法所关联的操作符族成员。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与该模式匹配的操作符族成员。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个操作符都会连同其排序操作符族（如果它是排序操作符）以及其底层函数是否防漏一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAP\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAp[x+]\n            [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出与操作符族关联的支持函数（参见\u003ca class=\"xref\" href=\"/zh/docs/18/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3. 索引方法支持例程\"\u003e第 36.16.3 节\u003c/a\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e，则只列出与名称匹配该模式的访问方法所关联的操作符族函数。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与该模式匹配的操作符族函数。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，函数会以详细形式显示，并带有其实际参数列表。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DB\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\db[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出表空间。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的表空间。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个表空间都会连同其关联选项、磁盘大小、权限和描述一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dc[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出字符集编码之间的转换。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的转换。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个对象都会连同其相关描述一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DCONFIG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dconfig[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出服务器配置参数及其值。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的参数。不带 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 时，只列出被设置为非默认值的参数。（使用 \u003ccode class=\"literal\"\u003e\\dconfig *\u003c/code\u003e 可查看所有参数。）如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个参数都会连同其数据类型、该参数可设置的上下文以及访问权限（如果已授予非默认访问权限）一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dC[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出类型转换。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出其源类型或目标类型与模式匹配的类型转换。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个类型转换的附加信息，包括其底层函数是否防漏，以及该类型转换的描述。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dd[Sx] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示 \u003ccode class=\"literal\"\u003econstraint\u003c/code\u003e、\u003ccode class=\"literal\"\u003eoperator class\u003c/code\u003e、\u003ccode class=\"literal\"\u003eoperator family\u003c/code\u003e、\u003ccode class=\"literal\"\u003erule\u003c/code\u003e 和\n        \u003ccode class=\"literal\"\u003etrigger\u003c/code\u003e 类型对象的描述。其他注释可通过对应对象类型的反斜线命令查看。\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003e\\dd\u003c/code\u003e 显示与\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的对象描述；如果没有给出参数，则显示相应类型的可见对象的描述。但无论哪种情况，只列出那些已有描述的对象。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n        可以使用 \u003ca class=\"link\" href=\"/zh/docs/18/sql-comment.html\" title=\"COMMENT\"\u003e\u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e\u003c/a\u003e \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令创建对象的描述。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dD[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出域。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的域。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个对象都会连同其相关权限和描述一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DDP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ddp[x] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出默认访问权限设置。对于每个默认权限设置已偏离内置默认值的角色（以及适用时的模式），都会显示一条记录。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出角色名或模式名与模式匹配的记录。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"link\" href=\"/zh/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"\u003e\u003ccode class=\"command\"\u003eALTER DEFAULT\n        PRIVILEGES\u003c/code\u003e\u003c/a\u003e 命令用于设置默认访问权限。权限显示的含义在\u003ca class=\"xref\" href=\"/zh/docs/18/ddl-priv.html\" title=\"5.8. 权限\"\u003e第 5.8 节\u003c/a\u003e中有解释。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dE[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\di[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dm[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ds[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dt[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dv[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在这组命令中，字母 \u003ccode class=\"literal\"\u003eE\u003c/code\u003e、\u003ccode class=\"literal\"\u003ei\u003c/code\u003e、\u003ccode class=\"literal\"\u003em\u003c/code\u003e、\u003ccode class=\"literal\"\u003es\u003c/code\u003e、\u003ccode class=\"literal\"\u003et\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003ev\u003c/code\u003e\n        分别表示外部表、索引、物化视图、序列、表和视图。你可以按任意顺序指定其中任意一个或多个字母，以获取这些类型对象的列表。例如，\u003ccode class=\"literal\"\u003e\\dti\u003c/code\u003e 会列出表和索引。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个对象都会连同其持久性状态（永久、临时或不记录 WAL）、磁盘上的物理大小以及相关描述（如果有）一起列出。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的对象。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\des[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出外部服务器（助记符：\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        servers\u003c/span\u003e”\u003c/span\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的服务器。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个服务器的完整描述，包括服务器的访问权限、类型、版本、选项和描述。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\det[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出外部表（助记符：\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal tables\u003c/span\u003e”\u003c/span\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出表名或模式名与模式匹配的条目。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则还会显示通用选项以及外部表描述。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\deu[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出用户映射（助记符：\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        users\u003c/span\u003e”\u003c/span\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出用户名与模式匹配的映射。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个映射的附加信息。\n        \u003c/p\u003e\u003cdiv class=\"caution\"\u003e\u003ch3 class=\"title\"\u003e小心\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\deu+\u003c/code\u003e可能还会显示远程用户的用户名和密码，因此应注意不要泄露它们。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dew[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出外部数据包装器（助记符：\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        wrappers\u003c/span\u003e”\u003c/span\u003e）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的外部数据包装器。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则还会显示外部数据包装器的访问权限、选项和描述。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\df[anptwSx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ... ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出函数，以及它们的结果数据类型、参数数据类型和函数类型，函数类型分为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eagg\u003c/span\u003e”\u003c/span\u003e（聚合）、\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enormal\u003c/span\u003e”\u003c/span\u003e、\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eprocedure\u003c/span\u003e”\u003c/span\u003e、\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003etrigger\u003c/span\u003e”\u003c/span\u003e或\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ewindow\u003c/span\u003e”\u003c/span\u003e。要只显示特定类型的函数，请在命令后添加相应的字母 \u003ccode class=\"literal\"\u003ea\u003c/code\u003e、\u003ccode class=\"literal\"\u003en\u003c/code\u003e、\u003ccode class=\"literal\"\u003ep\u003c/code\u003e、\u003ccode class=\"literal\"\u003et\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003ew\u003c/code\u003e。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的函数。任何附加参数都是类型名模式，分别与函数第一、第二等参数的类型名匹配。（匹配到的函数可以比你指定的参数更多；若要防止这种情况，可将连字符 \u003ccode class=\"literal\"\u003e-\u003c/code\u003e 写成最后一个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e。）默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e\n        修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个函数的附加信息，包括易变性、并行安全性、所有者、安全分类、是否防漏、访问权限、语言、内部名称（仅适用于 C 和 internal 函数）以及描述。特定函数的源代码可通过 \u003ccode class=\"literal\"\u003e\\sf\u003c/code\u003e 查看。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dF[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         列出全文检索配置。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的配置。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个配置的完整描述，包括底层全文检索解析器以及每种解析器词元类型对应的词典列表。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFd[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         列出全文检索词典。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的词典。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个所选词典的附加信息，包括底层全文检索模板和选项值。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFp[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         列出全文检索解析器。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的解析器。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个解析器的完整描述，包括底层函数和可识别的词元类型列表。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFt[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         列出全文检索模板。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只显示名称与模式匹配的模板。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个模板的附加信息，包括底层函数名。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dg[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出数据库角色。（由于\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e用户\u003c/span\u003e”\u003c/span\u003e和\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e组\u003c/span\u003e”\u003c/span\u003e的概念已经统一为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e角色\u003c/span\u003e”\u003c/span\u003e，此命令现在等同于\n        \u003ccode class=\"literal\"\u003e\\du\u003c/code\u003e。）默认情况下，只显示用户创建的角色；提供\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统角色。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的角色。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个角色的附加信息；目前这会增加每个角色的注释。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dl[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这是 \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e 的别名，后者会显示大对象列表。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会列出每个大对象的相关权限（如果有）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dL[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出过程语言。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的语言。默认情况下，只显示用户创建的语言；提供 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每种语言都会连同其调用处理器、验证器、访问权限以及它是否为系统对象一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dn[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出模式（命名空间）。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的模式。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个对象都会连同其相关权限和描述（如果有）一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\do[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出操作符及其操作数类型和结果类型。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的操作符。如果指定了一个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e，则只列出其右参数类型名称与该模式匹配的前缀操作符。如果指定了两个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e，则只列出参数类型名称与这些模式匹配的二元操作符。（对于一元操作符未使用的参数，也可以写成 \u003ccode class=\"literal\"\u003e-\u003c/code\u003e。）默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个操作符的附加信息，包括底层函数名以及它是否防漏。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dO[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出排序规则。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的排序规则。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个排序规则都会连同其相关描述（如果有）一起列出。请注意，只会显示与当前数据库编码兼容的排序规则，因此在同一安装中的不同数据库里结果可能不同。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dp[Sx] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出表、视图和序列及其相关访问权限。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的表、视图和序列。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"link\" href=\"/zh/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e 和\n        \u003ca class=\"link\" href=\"/zh/docs/18/sql-revoke.html\" title=\"REVOKE\"\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e\u003c/a\u003e\n        命令用于设置访问权限。权限显示的含义在\u003ca class=\"xref\" href=\"/zh/docs/18/ddl-priv.html\" title=\"5.8. 权限\"\u003e第 5.8 节\u003c/a\u003e中有解释。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dP[itnx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出分区关系。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 被指定，则只列出名称与模式匹配的条目。修饰符 \u003ccode class=\"literal\"\u003et\u003c/code\u003e（表）和 \u003ccode class=\"literal\"\u003ei\u003c/code\u003e（索引）可以附加到命令，过滤要列出的关系类型。默认情况下，列出分区表和索引。\n        \u003c/p\u003e\u003cp\u003e\n        如果使用修饰符 \u003ccode class=\"literal\"\u003en\u003c/code\u003e（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enested\u003c/span\u003e”\u003c/span\u003e），或指定了模式，则将包括非根分区关系，并显示一列，给出每个分区关系的父级。\n        \u003c/p\u003e\u003cp\u003e\n        如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则还会显示每个关系分区大小的总和以及关系描述。如果 \u003ccode class=\"literal\"\u003en\u003c/code\u003e 与 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e 组合使用，则会显示两个大小：一个包括直接附加的叶分区的总大小，另一个显示包括间接附加子分区在内的所有分区总大小。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRDS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drds[x] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出已定义的配置设置。这些设置可以特定于角色、特定于数据库，或同时特定于两者。\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e 分别用于选择要列出的角色和数据库。省略某个模式参数或将其指定为\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 时，不会按该参数筛选，还会分别包含不特定于角色或不特定于数据库的设置。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"link\" href=\"/zh/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"\u003e\u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e\u003c/a\u003e 和\n        \u003ca class=\"link\" href=\"/zh/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003ccode class=\"command\"\u003eALTER DATABASE\u003c/code\u003e\u003c/a\u003e\n        命令用于定义每个角色和每个数据库的配置设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drg[Sx] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出每个被授予角色成员身份的信息，包括被授予的选项（\u003ccode class=\"literal\"\u003eADMIN\u003c/code\u003e、\u003ccode class=\"literal\"\u003eINHERIT\u003c/code\u003e 和/或 \u003ccode class=\"literal\"\u003eSET\u003c/code\u003e）以及授予者。关于角色成员身份，参见 \u003ca class=\"link\" href=\"/zh/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e\n        命令。\n        \u003c/p\u003e\u003cp\u003e\n        默认情况下，只显示授予用户创建角色的成员身份；提供\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统角色。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出授予名称与模式匹配的角色的成员身份。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRp[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出逻辑复制发布。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的发布。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则还会显示与每个发布关联的表和模式。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRs[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出逻辑复制订阅。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的订阅。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示订阅的其他属性。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dT[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出数据类型。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的类型。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个类型都会连同其内部名称、大小和相关权限一起列出；对于 \u003ccode class=\"type\"\u003eenum\u003c/code\u003e 类型，还会显示其允许值。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\du[Sx+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出数据库角色。（由于\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e用户\u003c/span\u003e”\u003c/span\u003e和\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e组\u003c/span\u003e”\u003c/span\u003e的概念已经统一为\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e角色\u003c/span\u003e”\u003c/span\u003e，此命令现在等同于\n        \u003ccode class=\"literal\"\u003e\\dg\u003c/code\u003e。）默认情况下，只显示用户创建的角色；提供\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统角色。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的角色。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会显示每个角色的附加信息；目前这会增加每个角色的注释。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dx[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出已安装的扩展。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的扩展。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会列出属于每个匹配扩展的全部对象。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dX[x] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出扩展统计信息。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的扩展统计信息。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n        每种扩展统计信息的状态显示在以其统计类型命名的列中（例如 Ndistinct）。\u003ccode class=\"literal\"\u003edefined\u003c/code\u003e 表示在创建统计信息时请求了该信息，NULL 表示未请求。如果想知道是否已经运行了 \u003ca class=\"link\" href=\"/zh/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e，以及这些统计信息是否已经对规划器可用，可以查看 \u003ccode class=\"structname\"\u003epg_stats_ext\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dy[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出事件触发器。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的事件触发器。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则每个对象都会连同其相关描述一起列出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\e\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e \u003ccode class=\"literal\"\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，则编辑该文件；编辑器退出后，文件内容将被复制到当前查询缓冲区。如果没有给出 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，则将当前查询缓冲区复制到临时文件中，然后以相同方式进行编辑。或者，如果当前查询缓冲区为空，则将最近执行的查询复制到临时文件中，并以相同方式进行编辑。\n        \u003c/p\u003e\u003cp\u003e\n        如果编辑文件或上一个查询后在未修改文件的情况下退出编辑器，则查询缓冲区将被清除。否则，查询缓冲区的新内容将根据 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的正常规则重新解析，将整个缓冲区视为单行。任何完整的查询将立即执行；也就是说，如果查询缓冲区包含分号或以分号结尾，则执行并从查询缓冲区中删除到该点的所有内容。查询缓冲区中剩余的内容将重新显示。输入分号或\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 发送它，或输入\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e 通过清除查询缓冲区来取消。\n        \u003c/p\u003e\u003cp\u003e\n        将缓冲区视为单行主要影响元命令：在元命令后的缓冲区将被视为元命令的参数，即使它跨越多行。（因此，不能用这种方式创建使用元命令的脚本。请使用\u003ccode class=\"command\"\u003e\\i\u003c/code\u003e。）\n        \u003c/p\u003e\u003cp\u003e\n        如果指定了行号，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将光标定位在文件或查询缓冲区的指定行上。请注意，如果只给出一个全是数字的参数，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会假定它是一个行号，而不是文件名。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        关于如何配置和自定义编辑器，请参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"环境\"\u003e环境\u003c/a\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\echo \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将求值后的参数打印到标准输出，用空格分隔，并在末尾加上换行符。这对于在脚本输出中穿插信息很有用。例如：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo `date`\u003c/code\u003e\u003c/strong\u003e\nTue Oct 26 21:40:57 CEST 1999\n\u003c/pre\u003e\u003cp\u003e如果第一个参数是未加引号的 \u003ccode class=\"literal\"\u003e-n\u003c/code\u003e，则不会写入尾随的换行符（也不会写入第一个参数）。\u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        如果使用\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e 命令重定向查询输出，可能会想用\u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e 代替这个命令。另请参阅\u003ccode class=\"command\"\u003e\\warn\u003c/code\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ef [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         这个命令获取并编辑指定函数或过程的定义，形式为 \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e 或\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e 命令。编辑方式与\u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e 相同。如果在不保存的情况下退出编辑器，则该语句会被丢弃。如果保存并退出编辑器，并在其中添加了分号，则更新后的命令会立即执行。否则它会重新显示；键入分号或\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 发送它，或用\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e 取消。\n        \u003c/p\u003e\u003cp\u003e\n         目标函数可以仅通过名称指定，也可以通过名称和参数指定，例如 \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e。如果有多个同名函数，则必须给出参数类型。\n        \u003c/p\u003e\u003cp\u003e\n         如果未指定函数，则会呈现一个空的 \u003ccode class=\"command\"\u003eCREATE FUNCTION\u003c/code\u003e 模板供编辑。\n        \u003c/p\u003e\u003cp\u003e\n        如果指定了行号，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将光标定位在函数体的指定行上。（请注意，函数体通常不会从文件的第一行开始。）\n        \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个行的剩余部分始终被视为\u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e 的参数，参数中不进行变量插值或反引号扩展。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        关于如何配置和自定义编辑器，请参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"环境\"\u003e环境\u003c/a\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\encoding [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置客户端字符集编码。没有参数时，此命令显示当前编码。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\errverbose\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        以最大的详细程度重复最近的服务器错误消息，就好像 \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e 被设置为 \u003ccode class=\"literal\"\u003everbose\u003c/code\u003e，\u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e 被设置为 \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e 一样。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ev [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         这个命令获取并编辑指定视图的定义，形式为 \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e 命令。编辑方式与\u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e 相同。如果在不保存的情况下退出编辑器，则该语句会被丢弃。如果保存并退出编辑器，并在其中添加了分号，则更新后的命令会立即执行；否则将重新显示；输入分号或\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 发送它，或用\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e 取消。\n        \u003c/p\u003e\u003cp\u003e\n         如果未指定视图，则会呈现一个空的 \u003ccode class=\"command\"\u003eCREATE VIEW\u003c/code\u003e 模板供编辑。\n        \u003c/p\u003e\u003cp\u003e\n         如果指定了行号，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将光标定位在视图定义的指定行上。\n        \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个行的剩余部分始终被视为\u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e 的参数，参数中不进行变量插值或反引号扩展。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-F\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\f [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置非对齐查询输出的字段分隔符。默认值是竖线（\u003ccode class=\"literal\"\u003e|\u003c/code\u003e）。它等同于\u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-G\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将当前查询缓冲区发送给服务器执行。\u003c/p\u003e\u003cp\u003e如果在\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 后面出现括号，则括号中是用空格分隔的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 格式选项子句列表。这些子句的解释方式与\u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 命令相同，但仅在此查询执行期间生效。在此列表中，\u003ccode class=\"literal\"\u003e=\u003c/code\u003e符号周围不允许有空格，但选项子句之间必须有空格。如果\u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 被省略，则指定的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e 会按以下命令的方式更改：\u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e，其中不显式指定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e。\n        \u003c/p\u003e\u003cp\u003e如果给出了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 或\u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 参数，查询输出就会写入指定文件，或通过管道传给指定的 shell 命令，而不是照常显示。只有当查询成功返回零个或多个元组时，才会向文件或命令写入；如果查询失败，或执行的是不返回数据的 SQL 命令，则不会写入。\u003c/p\u003e\u003cp\u003e\n        如果当前查询缓冲区为空，则最近发送的查询将被重新执行。除此之外，没有任何参数的\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 基本上等同于一个分号。带有参数的\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 提供了一个\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e一次性\u003c/span\u003e”\u003c/span\u003e替代\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e 命令的选择，并且还允许一次性调整通常由\u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e 设置的输出格式选项。\n        \u003c/p\u003e\u003cp\u003e当最后一个参数以\u003ccode class=\"literal\"\u003e|\u003c/code\u003e开头时，该行剩余的全部内容都会被视为要执行的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e，其中既不进行变量插值，也不进行反引号扩展。该行剩余部分会直接按字面传给 shell。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GDESC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e显示当前查询缓冲区中查询结果的描述（即列名和数据类型）。查询并不会实际执行；不过，如果其中存在语法错误，会按通常的方式报告。\u003c/p\u003e\u003cp\u003e如果当前查询缓冲区为空，则改为描述最近发送的查询。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         获取环境变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e 的值，并将其赋给 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e 在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 进程的环境中未定义，\u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e 不会被改变。示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\getenv home HOME\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :home\u003c/code\u003e\u003c/strong\u003e\n/home/postgres\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GEXEC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gexec\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         将当前查询缓冲区发送到服务器，然后将查询输出的每行每列视为要执行的 SQL 语句。例如，要在 \u003ccode class=\"structname\"\u003emy_table\u003c/code\u003e 的每一列上创建索引：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT format('create index on my_table(%I)', attname)\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM pg_attribute\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eWHERE attrelid = 'my_table'::regclass AND attnum \u0026gt; 0\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eORDER BY attnum\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gexec\u003c/code\u003e\u003c/strong\u003e\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         生成的查询按照返回行的顺序执行；如果有多列，则在每行内从左到右执行。NULL 字段会被忽略。生成的查询按原样发送到服务器进行处理，因此不能是 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 元命令，也不能包含 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量引用。如果某个查询失败，仍会继续执行其余查询，除非设置了 \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e。每个查询的执行都受 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 处理的影响。（通常，在使用\u003ccode class=\"command\"\u003e\\gexec\u003c/code\u003e 时，适宜将 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 设为 \u003ccode class=\"literal\"\u003eall\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e。）查询日志、单步模式、计时及其他查询执行功能也适用于每个生成的查询。\n        \u003c/p\u003e\u003cp\u003e\n         如果当前查询缓冲区为空，则重新执行最近发送的查询。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将当前查询缓冲区发送给服务器，并将查询输出存入 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量（参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"变量\"\u003e变量\u003c/a\u003e）。要执行的查询必须恰好返回一行。该行的每一列分别存入一个变量，变量名与列名相同。例如：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :var1 :var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e，则会将该字符串加到查询的列名前面，以构成要使用的变量名：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset result_\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :result_var1 :result_var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e如果某一列的结果为 NULL，则取消设置对应的变量，而不是设置它。\u003c/p\u003e\u003cp\u003e如果查询失败或没有恰好返回一行，则不会更改任何变量。\u003c/p\u003e\u003cp\u003e如果当前查询缓冲区为空，则改为重新执行最近发送的查询。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GX\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e 等同于 \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e，不同之处在于它强制为此查询启用扩展输出模式，就好像在\u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e 选项列表中包含了 \u003ccode class=\"literal\"\u003eexpanded=on\u003c/code\u003e 一样。另请参见\u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\h\u003c/code\u003e 或\u003ccode class=\"literal\"\u003e\\help\u003c/code\u003e \u003ccode class=\"literal\"\u003e[ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        给出指定 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令的语法帮助。如果未指定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e，则 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 将列出所有可用语法帮助的命令。如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 是星号（\u003ccode class=\"literal\"\u003e*\u003c/code\u003e），则显示所有 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令的语法帮助。\n        \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个行的剩余部分始终被视为\u003ccode class=\"command\"\u003e\\help\u003c/code\u003e 的参数，参数中不进行变量插值或反引号扩展。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        为了简化输入，由多个单词组成的命令不需要加引号。因此，可以直接输入\u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\help alter table\u003c/code\u003e\u003c/strong\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\H\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打开 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 查询输出格式。如果 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 格式已经打开，则切换回默认的对齐文本格式。此命令是为兼容性和便利性而保留的；设置其他输出选项的方法见\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\include\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        从文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 中读取输入，并像在键盘上输入一样执行它。\n        \u003c/p\u003e\u003cp\u003e\n        如果 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e 是\u003ccode class=\"literal\"\u003e-\u003c/code\u003e（连字符），则从标准输入读取，直到遇到 EOF 指示或\u003ccode class=\"command\"\u003e\\q\u003c/code\u003e 元命令。这可用于将交互式输入与文件输入交错使用。请注意，只有在最外层启用了 Readline，此处才会使用 Readline 功能。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        如果想在屏幕上看到被读入的各行，请将变量 \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e 设置为 \u003ccode class=\"literal\"\u003eall\u003c/code\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"PSQL-METACOMMAND-IF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\if\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\elif\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\else\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endif\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这组命令实现了可嵌套的条件块。条件块必须以\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 开始，并以\u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e 结束。在两者之间可以有任意数量的\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 子句，后面可以选择性地跟着一个\u003ccode class=\"command\"\u003e\\else\u003c/code\u003e 子句。在形成条件块的命令之间通常会出现普通查询和其他类型的反斜线命令。\n        \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 和\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 命令读取其参数，并将其作为布尔表达式求值。如果表达式的值为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e，则正常继续处理；否则，跳过后续行，直到遇到匹配的\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\else\u003c/code\u003e 或\u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e。一旦\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 或\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 测试成功，同一块中后续\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 命令的参数就不再求值，而是被视为假。只有前面所有匹配的\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 和\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 测试都未成功时，才会处理\u003ccode class=\"command\"\u003e\\else\u003c/code\u003e 后面的行。\n\u003c/p\u003e\u003cp\u003e\n        与其他反斜线命令的参数一样，\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 或\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e 命令的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e 参数会经过变量插值和反引号扩展。随后，按开/关选项变量值的规则对结果求值。因此，有效值是以下值的不区分大小写且无歧义的匹配：\u003ccode class=\"literal\"\u003etrue\u003c/code\u003e、\u003ccode class=\"literal\"\u003efalse\u003c/code\u003e、\u003ccode class=\"literal\"\u003e1\u003c/code\u003e、\u003ccode class=\"literal\"\u003e0\u003c/code\u003e、\u003ccode class=\"literal\"\u003eon\u003c/code\u003e、\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e、\u003ccode class=\"literal\"\u003eyes\u003c/code\u003e、\u003ccode class=\"literal\"\u003eno\u003c/code\u003e。例如，\u003ccode class=\"literal\"\u003et\u003c/code\u003e、\u003ccode class=\"literal\"\u003eT\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003etR\u003c/code\u003e 都会被视为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e。\n        \u003c/p\u003e\u003cp\u003e\n        不能正确求值为真或假的表达式会产生警告，并被视为假。\n        \u003c/p\u003e\u003cp\u003e\n        被跳过的行会被正常解析以识别查询和反斜线命令，但查询不会发送到服务器，而且除了条件命令（\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\else\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e）之外的反斜线命令会被忽略。仅检查跳过行中条件命令的有效嵌套。跳过行中的变量引用不会被展开，也不会执行反引号扩展。\n        \u003c/p\u003e\u003cp\u003e\n        同一个条件块的所有反斜线命令必须出现在同一个源文件中。如果主输入文件或通过\u003ccode class=\"command\"\u003e\\include\u003c/code\u003e 引入的文件到达 EOF 时，仍有本地\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e 块未关闭，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 就会报错。\n        \u003c/p\u003e\u003cp\u003e\n         下面是一个示例：\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n-- 检查数据库中是否存在两条不同的记录，并将\n-- 结果分别存入不同的 psql 变量\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\include_relative\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e 命令与\u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e 相似，但解析相对文件名的方式不同。在交互模式下执行时，这两个命令的行为相同。不过，在脚本中调用时，\u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e 会相对于脚本所在的目录来解释文件名，而不是相对于当前工作目录。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\l[x+]\u003c/code\u003e 或\u003ccode class=\"literal\"\u003e\\list[x+] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出服务器中的数据库，并显示其名称、所有者、字符集编码和访问权限。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的数据库。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则还会显示数据库大小、默认表空间和描述。当前用户对其拥有 \u003ccode class=\"literal\"\u003eCONNECT\u003c/code\u003e 权限的数据库可以显示大小信息；如果当前用户是超级用户或具有 \u003ccode class=\"literal\"\u003epg_read_all_stats\u003c/code\u003e 角色的权限，也可以显示大小信息。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_export \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        从数据库中读取具有 \u003cacronym class=\"acronym\"\u003eOID\u003c/acronym\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e 的大对象，并将其写入 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e。请注意，这与服务器函数\n        \u003ccode class=\"function\"\u003elo_export\u003c/code\u003e 略有不同，后者使用运行数据库服务器的用户的权限，并在服务器的文件系统上操作。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        使用\u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e 命令来查找大对象的 \u003cacronym class=\"acronym\"\u003eOID\u003c/acronym\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_import \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecomment\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将文件存储到一个 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 大对象中。可选地，它将给定的注释与对象关联起来。例如：\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nfoo=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'\u003c/code\u003e\u003c/strong\u003e\nlo_import 152801\n\u003c/pre\u003e\u003cp\u003e响应表明大对象获得了对象 ID 152801，这个 ID 可以用来在将来访问新创建的大对象。为便于阅读，建议始终为每个对象关联一条便于人阅读的注释。查看 OID 和注释时，可以使用\u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e 命令。\u003c/p\u003e\u003cp\u003e\n        请注意，此命令与服务器端的 \u003ccode class=\"function\"\u003elo_import\u003c/code\u003e 略有不同，因为它作为本地用户在本地文件系统上操作，而不是服务器的用户和文件系统。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_list[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示当前存储在数据库中的全部 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        大对象列表，以及为它们提供的任何注释。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。如果在命令名后追加 \u003ccode class=\"literal\"\u003e+\u003c/code\u003e，则会列出每个大对象的相关权限（如果有）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_unlink \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        从数据库中删除 \u003cacronym class=\"acronym\"\u003eOID\u003c/acronym\u003e 为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e 的大对象。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        使用\u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e 命令来查找大对象的 \u003cacronym class=\"acronym\"\u003eOID\u003c/acronym\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-OUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\out [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\out [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将后续查询结果保存到文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，或通过管道传给 shell 命令 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e。如果没有指定参数，查询输出将恢复为标准输出。\u003c/p\u003e\u003cp\u003e如果参数以\u003ccode class=\"literal\"\u003e|\u003c/code\u003e开头，则该行剩余的全部内容会被视为要执行的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e，其中不会进行变量插值或反引号扩展。该行剩余的内容只会原样传递给 shell。\u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e查询结果\u003c/span\u003e”\u003c/span\u003e包括从数据库服务器获取的所有表格、命令响应和通知，以及查询数据库的各种反斜杠命令的输出（例如\u003ccode class=\"command\"\u003e\\d\u003c/code\u003e）；但不包括错误消息。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        要在查询结果之间插入文本输出，使用\u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PRINT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\p\u003c/code\u003e 或\u003ccode class=\"literal\"\u003e\\print\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        将当前查询缓冲区打印到标准输出。如果当前查询缓冲区为空，则打印最近执行的查询。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PARSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\parse \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         基于目标预备语句对象的名称，从当前查询缓冲区创建一个预备语句。空字符串表示未命名的预备语句。\n        \u003c/p\u003e\u003cp\u003e\n         示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nSELECT $1 \\parse stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         此命令会使用扩展查询协议，不同于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 通常使用的简单查询协议。该命令会发出一条 \u003ca class=\"xref\" href=\"/zh/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\"\u003eParse (F)\u003c/a\u003e 消息，因此可用于在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中测试扩展查询协议。此命令只影响下一条被执行的查询；之后的所有查询默认仍会使用简单查询协议。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\password [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        更改指定用户（默认为当前用户）的密码。此命令提示输入新密码，对其进行加密，并将其作为 \u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e 命令发送到服务器。这样可以确保新密码不会以明文形式出现在命令历史记录、服务器日志或其他地方。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\prompt [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         提示用户提供文本，将其赋值给变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e。可以指定一个可选的提示字符串 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e。（对于多个单词的提示，用单引号括起文本。）\n        \u003c/p\u003e\u003cp\u003e\n         默认情况下，\u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e 使用终端进行输入和输出。然而，如果使用了\n         \u003ccode class=\"option\"\u003e-f\u003c/code\u003e 命令行开关，\u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e 将使用标准输入和标准输出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\pset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e这个命令设置影响查询结果表输出的选项。\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e 指定要设置哪个选项。\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 的含义取决于所选的选项。对于某些选项，省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 会切换或取消设置该选项，具体见各选项的说明。如果没有提及这类行为，那么省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 只会显示当前设置。\u003c/p\u003e\u003cp\u003e不带任何参数的\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e 会显示所有打印选项的当前状态。\u003c/p\u003e\u003cp\u003e\n        可调整打印选项有：\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eborder\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 必须是数字。一般来说，数字越大，表格的边框和分隔线就越多，但细节取决于具体格式。在 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 格式中，它会直接转换为 \u003ccode class=\"literal\"\u003eborder=...\u003c/code\u003e属性。在大多数其他格式中，只有值 0（无边框）、1（内部分隔线）和 2（表格外框）有意义，大于 2 的值会与 \u003ccode class=\"literal\"\u003eborder = 2\u003c/code\u003e 作相同处理。\u003ccode class=\"literal\"\u003elatex\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e 格式还允许使用值 3，以在数据行之间添加分隔线。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          设置 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式的目标宽度，同时也是确定输出是否足够宽以需要分页器或在扩展自动模式下切换到垂直显示的宽度限制。零（默认值）会导致目标宽度由环境变量 \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e 控制，或者如果未设置\n          \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e 则由检测到的屏幕宽度控制。另外，如果 \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e 为零，则 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式仅影响屏幕输出。如果 \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e 为非零，则文件和管道输出也会按该宽度折行。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecsv_fieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          指定在 \u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e 输出格式中使用的字段分隔符。如果分隔符字符出现在字段的值中，则该字段将根据标准 \u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e 规则在双引号内输出。默认值是逗号。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eexpanded\u003c/code\u003e（或 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，它必须是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e（分别启用或禁用扩展模式），或者是 \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e。如果省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，该命令会在开启和关闭设置之间切换。启用扩展模式时，查询结果以两列显示，左侧为列名，右侧为数据。如果数据在通常的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e横向\u003c/span\u003e”\u003c/span\u003e模式下无法适应屏幕，这种模式就很有用。在自动设置下，当查询输出包含多列且宽度超过屏幕时，会使用扩展模式；否则使用常规模式。自动设置只在对齐和折行格式中有效。在其他格式中，它的行为始终与关闭扩展模式相同。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e指定非对齐输出格式使用的字段分隔符。这样可以创建例如制表符分隔的输出，这可能更符合其他程序的需要。要将制表符设置为字段分隔符，请输入\u003ccode class=\"literal\"\u003e\\pset fieldsep '\\t'\u003c/code\u003e。默认字段分隔符是\u003ccode class=\"literal\"\u003e'|'\u003c/code\u003e（竖线）。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将非对齐输出格式使用的字段分隔符设置为零字节。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efooter\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，它必须是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e，分别启用或禁用表格页脚（\u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e rows)\u003c/code\u003e 计数）的显示。如果省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，该命令会切换页脚显示的开关状态。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eformat\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e设置输出格式为 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e、\u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e、\u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e、\u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e、\u003ccode class=\"literal\"\u003elatex\u003c/code\u003e、\u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e、\u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e、\u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e。允许使用唯一缩写。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e 格式是标准的、适合人阅读且排版整齐的文本输出；这是默认格式。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e 格式将一行中的所有列写在一行上，由当前活动的字段分隔符分隔。这对于创建可能被其他程序读取的输出很有用，例如，制表符分隔或逗号分隔格式。然而，如果字段分隔符字符出现在列的值中，则不会被特殊处理；因此，\u003cacronym class=\"acronym\"\u003eCSV\u003c/acronym\u003e 格式可能更适合这些目的。\u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e 格式按逗号分隔的列值输出，并应用\n          \u003ca class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\"\u003eRFC 4180\u003c/a\u003e\n          中描述的加引号规则。此输出与服务器的 CSV 格式的\n          \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 命令兼容。生成包含列名的表头行，除非\n          \u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e 参数设置为\n          \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。不打印表格标题和页脚。每行以系统相关的行结束字符结束，对于类 Unix 系统通常是单个换行符（\u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e），对于 Microsoft Windows 则是回车和换行序列（\u003ccode class=\"literal\"\u003e\\r\\n\u003c/code\u003e）。可以用\u003ccode class=\"command\"\u003e\\pset csv_fieldsep\u003c/code\u003e 选择逗号以外的字段分隔字符。\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式与 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e 相似，但会将较宽的数据值折成多行，使输出适应目标列宽。目标宽度的确定方式见 \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e 选项的说明。请注意，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 不会尝试对列标题折行；因此，如果列标题所需的总宽度超过目标宽度，\u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式的行为就与 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e 相同。\u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e、\u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e、\u003ccode class=\"literal\"\u003elatex\u003c/code\u003e、\u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e 和\n          \u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e 格式生成的表格旨在包含在使用相应标记语言的文档中。它们不是完整的文档！这在 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 中可能不是必需的，但在\n          \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e 中，则必须有一个完整文档的外层结构。\u003ccode class=\"literal\"\u003elatex\u003c/code\u003e 格式使用 \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e 的 \u003ccode class=\"literal\"\u003etabular\u003c/code\u003e\n          环境。\u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e 格式需要 \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e\n          的 \u003ccode class=\"literal\"\u003elongtable\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003ebooktabs\u003c/code\u003e 包。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          设置边框线绘制样式为 \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e、\u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e 之一。允许使用唯一缩写。（这意味着一个字母就足够了。）默认设置为 \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e。此选项仅影响 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 输出格式。\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eascii\u003c/code\u003e 样式使用普通的 \u003cacronym class=\"acronym\"\u003eASCII\u003c/acronym\u003e 字符。数据中的换行符以右边缘的\u003ccode class=\"literal\"\u003e+\u003c/code\u003e符号表示。当 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式在没有换行符的位置把数据折到下一行时，会在第一行的右边缘显示一个点（\u003ccode class=\"literal\"\u003e.\u003c/code\u003e），并在下一行的左边缘再次显示。\n\u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e 样式使用普通的 \u003cacronym class=\"acronym\"\u003eASCII\u003c/acronym\u003e 字符，采用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4 及更早版本的格式样式。数据中的换行符以替代左侧列分隔符的\u003ccode class=\"literal\"\u003e:\u003c/code\u003e符号表示。当数据在没有换行符的位置折到下一行时，则用\u003ccode class=\"literal\"\u003e;\u003c/code\u003e符号替代左侧列分隔符。\n\u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e 样式使用 Unicode 框线绘制字符。数据中的换行符以右边缘的回车符号表示。当数据在没有换行符的位置折到下一行时，会在第一行的右边缘显示省略号符号，并在下一行的左边缘再次显示。\n\u003c/p\u003e\u003cp\u003e\n          当 \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e 设置大于零时，\u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e 选项还决定用哪些字符绘制边框线。普通的 \u003cacronym class=\"acronym\"\u003eASCII\u003c/acronym\u003e 字符在任何环境中都可用，但在支持 Unicode 的显示设备上，Unicode 字符更美观。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enull\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e设置用于代替空值打印的字符串。默认不打印任何内容，这很容易被误认为空字符串。例如，你可能更喜欢使用\u003ccode class=\"literal\"\u003e\\pset null '(null)'\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enumericlocale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，它必须是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e，分别启用或禁用使用区域设置特定的字符来分隔小数点左侧的数字组。如果省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，该命令会在常规数字输出和区域设置特定的数字输出之间切换。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          控制查询和 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 帮助输出是否使用分页器程序。当 \u003ccode class=\"literal\"\u003epager\u003c/code\u003e 选项为 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e 时，不使用分页器程序。当 \u003ccode class=\"literal\"\u003epager\u003c/code\u003e 选项为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 时，会在适当时使用分页器，即输出目标为终端且内容无法在屏幕上完整显示时。\u003ccode class=\"literal\"\u003epager\u003c/code\u003e 选项也可以设为 \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e，这样所有终端输出都会使用分页器，无论内容是否能在屏幕上完整显示。不带 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e 的\u003ccode class=\"literal\"\u003e\\pset pager\u003c/code\u003e 会切换分页器的使用状态。\n          \u003c/p\u003e\u003cp\u003e\n          如果设置了环境变量 \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e 或 \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e，需要分页的输出会通过管道传给指定程序。否则，使用与平台有关的默认程序（如 \u003ccode class=\"filename\"\u003emore\u003c/code\u003e）。\n          \u003c/p\u003e\u003cp\u003e\n          当使用 \u003ccode class=\"literal\"\u003e\\watch\u003c/code\u003e 命令重复执行查询时，在 Unix 系统上会改用环境变量 \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\n          来查找分页器程序。之所以单独配置它，是因为这种用法可能会让传统分页器无法正常工作；但它可用于把输出发送给能够理解\n          \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 输出格式的工具（例如\n          \u003ccode class=\"filename\"\u003epspg --stream\u003c/code\u003e）。\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果将 \u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e 设置为大于页面高度的数字，那么只有待显示的输出至少达到这么多行时，才会调用分页器程序。默认设置为 0。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e指定非对齐输出格式使用的记录（行）分隔符。默认为换行符。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将非对齐输出格式使用的记录分隔符设置为零字节。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etableattr\u003c/code\u003e（或 \u003ccode class=\"literal\"\u003eT\u003c/code\u003e）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e在 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 格式中，这指定要放在 \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e 标签内的属性，例如 \u003ccode class=\"literal\"\u003ecellpadding\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003ebgcolor\u003c/code\u003e。请注意，你可能不需要在这里指定 \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e，因为\u003ccode class=\"literal\"\u003e\\pset border\u003c/code\u003e 已经负责处理它。如果没有给出 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，则取消设置表格属性。\u003c/p\u003e\u003cp\u003e在 \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e 格式中，这控制每个包含左对齐数据类型的列的宽度比例。它以空白分隔的值列表指定，例如\u003ccode class=\"literal\"\u003e'0.2 0.2 0.6'\u003c/code\u003e。未指定的输出列使用最后指定的值。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etitle\u003c/code\u003e（或 \u003ccode class=\"literal\"\u003eC\u003c/code\u003e）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e设置随后打印的所有表格的标题。这可以为输出提供描述性标签。如果没有给出 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，则取消设置标题。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e（或 \u003ccode class=\"literal\"\u003et\u003c/code\u003e）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，它必须是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e，分别启用或禁用仅元组模式。如果省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，该命令会在常规输出和仅元组输出之间切换。常规输出包含列标题、表格标题和各种页脚等附加信息。在仅元组模式下，只显示实际的表格数据。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_border_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将 \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e 线条样式的边框绘制样式设置为 \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_column_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将 \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e 线条样式的列分隔线绘制样式设置为 \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_header_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将 \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e 线条样式的表头分隔线绘制样式设置为 \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003exheader_width\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n           将扩展输出的表头最大宽度设置为以下之一：\u003ccode class=\"literal\"\u003efull\u003c/code\u003e（默认值）、\u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e、\u003ccode class=\"literal\"\u003epage\u003c/code\u003e 或\u003cem class=\"replaceable\"\u003e\u003ccode\u003e整数值\u003c/code\u003e\u003c/em\u003e。\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003efull\u003c/code\u003e：扩展表头不截断，其宽度与最宽的输出行相同。\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e：将表头行截断为第一列的宽度。\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003epage\u003c/code\u003e：将表头行截断为终端宽度。\n          \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003e整数值\u003c/code\u003e\u003c/em\u003e：指定表头行的确切最大宽度。\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e这些不同格式的外观示例可参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"示例\"\u003e示例\u003c/a\u003e。\u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        有各种快捷命令用于\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e。请参见\u003ccode class=\"command\"\u003e\\a\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\C\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\f\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\H\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\t\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\T\u003c/code\u003e 和\u003ccode class=\"command\"\u003e\\x\u003c/code\u003e。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\q\u003c/code\u003e 或\u003ccode class=\"literal\"\u003e\\quit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e退出 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 程序。在脚本文件中，只会终止该脚本的执行。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\qecho \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这个命令与\u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e 相同，只是输出会写入由\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e 设置的查询输出通道。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e 或\u003ccode class=\"literal\"\u003e\\reset\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e重置（清空）查询缓冲区。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\restrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        使用给定的密钥进入\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e受限\u003c/span\u003e”\u003c/span\u003e模式。在该模式下，唯一允许的元命令是用于退出受限模式的\u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e。密钥只能包含字母数字字符。\n        \u003c/p\u003e\u003cp\u003e\n        此命令主要用于 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e、\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\n        和 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 生成的纯文本转储文件中，但在其他场景下也可能有用。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\s [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        打印 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的命令行历史记录到 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e。如果省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，历史记录将被写入标准输出（如果适用，将使用分页器）。如果 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 在构建时没有使用 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e 支持，则此命令不可用。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\set [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [ ... ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e 为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，如果给出多个值，则设置为所有值的连接。如果只给出一个参数，则将变量设置为空字符串值。要取消变量设置，请使用\u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e 命令。\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 没有任何参数时，显示当前设置的所有 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量的名称和值。\u003c/p\u003e\u003cp\u003e\n        有效的变量名可以包含字母、数字和下划线。有关详细信息，请参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"变量\"\u003e变量\u003c/a\u003e。变量名区分大小写。\n        \u003c/p\u003e\u003cp\u003e\n        某些变量是特殊的，它们控制 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的行为或者自动设置以反映连接状态。这些变量在下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"变量\"\u003e变量\u003c/a\u003e中有文档记录。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        这个命令与 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令 \u003ca class=\"link\" href=\"/zh/docs/18/sql-set.html\" title=\"SET\"\u003e\u003ccode class=\"command\"\u003eSET\u003c/code\u003e\u003c/a\u003e 无关。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\setenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置环境变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e 为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，或者如果未提供 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，则取消设置环境变量。示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sf[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         这个命令获取并显示指定函数或过程的定义，以 \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e 或\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e 命令的形式呈现。定义将打印到当前查询输出通道，由\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e 设置。\n        \u003c/p\u003e\u003cp\u003e目标函数可以只用名称指定，也可以同时给出名称和参数，例如 \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e。如果存在多个同名函数，就必须给出参数类型。\u003c/p\u003e\u003cp\u003e如果在命令名后附加\u003ccode class=\"literal\"\u003e+\u003c/code\u003e，输出行会带上行号，函数体的第一行编号为 1。\u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个行的剩余部分始终被视为\u003ccode class=\"command\"\u003e\\sf\u003c/code\u003e 的参数，参数中不进行变量插值或反引号扩展。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sv[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          这个命令获取指定视图的定义，并以 \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e 命令的形式显示。定义会打印到由\u003ccode class=\"command\"\u003e\\o\u003c/code\u003e 设置的当前查询输出通道。\n         \u003c/p\u003e\u003cp\u003e\n          如果在命令名称后添加\u003ccode class=\"literal\"\u003e+\u003c/code\u003e，那么输出行将从 1 开始编号。\n         \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个行的剩余部分始终被视为\u003ccode class=\"command\"\u003e\\sv\u003c/code\u003e 的参数，参数中不进行变量插值或反引号扩展。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PIPELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\startpipeline\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\syncpipeline\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endpipeline\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flushrequest\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flush\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getresults [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这组命令实现 SQL 语句的管道化。一个管道必须以 \u003ccode class=\"command\"\u003e\\startpipeline\u003c/code\u003e 开始，并以 \u003ccode class=\"command\"\u003e\\endpipeline\u003c/code\u003e 结束。其间可以出现任意数量的 \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e 命令，它会发送一条\u003ca class=\"link\" href=\"/zh/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3. 扩展查询\"\u003e同步消息\u003c/a\u003e，而不会结束当前管道，也不会刷新发送缓冲区。在管道模式下，语句会被发送到服务器，而不等待前面语句的结果。更多细节见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-pipeline-mode.html\" title=\"32.5. 管道模式\"\u003e第 32.5 节\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        管道进行期间执行的所有查询都使用扩展查询协议。以分号结束的查询会被追加到管道中。元命令 \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e 和\n        \u003ccode class=\"literal\"\u003e\\parse\u003c/code\u003e 可以在进行中的管道里使用。管道进行期间，\u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e 会将当前查询缓冲区追加到管道中。其他元命令，如\n        \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e 或\n        \u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e，则不允许在管道模式中使用。\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e 会向管道追加一条 flush 命令，使得可以在不发送 sync 或结束管道的情况下通过\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e 读取结果。\u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e 会自动将尚未发送的数据推送到服务器。\u003ccode class=\"command\"\u003e\\flush\u003c/code\u003e 可用于手动推送未发送的数据。\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e 接受一个可选的\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e 参数。如果提供，则只读取前\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e 个待处理结果。若省略该参数或其值为 \u003ccode class=\"literal\"\u003e0\u003c/code\u003e，则读取所有待处理结果。\n       \u003c/p\u003e\u003cp\u003e\n        当管道模式处于活动状态时，可使用一个专用的提示符变量来报告管道状态。详见 \u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 在管道模式中不支持。\n       \u003c/p\u003e\u003cp\u003e\n        示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e切换输出中的列名标题和行数页脚的显示状态。这个命令等价于\u003ccode class=\"literal\"\u003e\\pset tuples_only\u003c/code\u003e，提供它是为了使用方便。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e指定在 \u003cacronym class=\"acronym\"\u003eHTML\u003c/acronym\u003e 输出格式中放在 \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e 标签内的属性。这个命令等价于\u003ccode class=\"literal\"\u003e\\pset tableattr \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-TIMING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\timing [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e带参数时，开启或关闭每条 SQL 语句执行耗时的显示。不带参数时，切换显示的开关状态。耗时以毫秒显示；超过 1 秒的时间间隔还会以分钟:秒的格式显示，必要时添加小时和天字段。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unrestrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        退出\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e受限\u003c/span\u003e”\u003c/span\u003e模式（即所有其他元命令都被阻止的模式），前提是指定的密钥与进入受限模式时传给\u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e 的密钥匹配。\n        \u003c/p\u003e\u003cp\u003e\n        此命令主要用于 \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e、\u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e\n        和 \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e 生成的纯文本转储文件中，但在其他场景下也可能有用。\n        \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，整个剩余行始终被视为\u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e 的参数，并且不会执行变量插值或反引号扩展。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unset \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e取消设置（删除）\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e。\u003c/p\u003e\u003cp\u003e大多数控制 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 行为的变量不能取消设置；对于这些变量，\u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e 命令会被解释为将其设置为默认值。参见下面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"变量\"\u003e变量\u003c/a\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WRITE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e将当前查询缓冲区写入文件 \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e，或通过管道传递给 shell 命令 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e。如果当前查询缓冲区为空，则改为写入最近执行的查询。\u003c/p\u003e\u003cp\u003e如果参数以\u003ccode class=\"literal\"\u003e|\u003c/code\u003e开头，则该行剩余的全部内容会被视为要执行的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e，其中不会进行变量插值或反引号扩展。该行剩余的内容只会原样传递给 shell。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WARN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\warn \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这个命令与\u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e 命令相同，只是输出将被写入 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的标准错误通道，而不是标准输出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WATCH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\watch [ i[nterval]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ] [ c[ount]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimes\u003c/code\u003e\u003c/em\u003e ] [ m[in_rows]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erows\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        重复执行当前查询缓冲区（如同 \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 一样），直到被中断、查询失败、达到执行次数上限（如果给定）或查询返回的行数低于最小要求。两次执行之间等待指定的秒数（默认 2 秒）。默认等待时间可通过变量 \u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/a\u003e 修改。为保持向后兼容，\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e 可以带或不带 \u003ccode class=\"literal\"\u003einterval=\u003c/code\u003e 前缀。每次查询结果都会带有一个头部，其中包含 \u003ccode class=\"literal\"\u003e\\pset title\u003c/code\u003e\n        字符串（如果有）、查询开始时的时间以及延迟间隔。\n        \u003c/p\u003e\u003cp\u003e\n        如果当前查询缓冲区为空，则重新执行最近发送的查询。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\x [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eauto\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e设置或切换扩展表格格式模式。它等价于\u003ccode class=\"literal\"\u003e\\pset expanded\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-Z\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\z[Sx] [ \u003ca class=\"link\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"模式\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        列出表、视图和序列及其相关访问权限。如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e，则只列出名称与模式匹配的表、视图和序列。默认情况下，只显示用户创建的对象；提供模式或 \u003ccode class=\"literal\"\u003eS\u003c/code\u003e 修饰符可包括系统对象。如果在命令名后追加 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，结果会以扩展模式显示。\n        \u003c/p\u003e\u003cp\u003e\n        这是\u003ccode class=\"command\"\u003e\\dp\u003c/code\u003e 的别名（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e显示权限\u003c/span\u003e”\u003c/span\u003e）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\! [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        不带参数时，进入一个子 shell；子 shell 退出后，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 恢复运行。带参数时，执行 shell 命令 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e。\n        \u003c/p\u003e\u003cp\u003e\n        与大多数其他元命令不同，该行剩余的全部内容始终被视为\u003ccode class=\"command\"\u003e\\!\u003c/code\u003e的参数，其中不会进行变量插值或反引号扩展。该行剩余内容会原样传给 shell。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\? [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        显示帮助信息。可选的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e 参数（默认为 \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e）选择要解释的 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的哪个部分：\u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e 描述 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的反斜线命令；\u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e 描述可以传递给 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的命令行选项；而 \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e 显示关于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 配置变量的帮助。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        反斜线分号不像前面的命令那样是一个元命令；相反，它只是在不进行进一步处理的情况下将一个分号添加到查询缓冲区中。\n        \u003c/p\u003e\u003cp\u003e\n        通常，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会在到达命令结束的分号时立即将 SQL 命令发送到服务器，即使当前行还有更多输入。因此，例如输入\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nselect 1; select 2; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        将导致三个 SQL 命令分别发送到服务器，每个命令的结果在继续下一个命令之前显示。然而，输入为\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e的分号不会触发命令处理，因此它之前和之后的命令实际上被合并并作为一个请求发送到服务器。因此，例如\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nselect 1\\; select 2\\; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        会在遇到前面没有反斜线的分号时，将这三个 SQL 命令作为单个请求发送到服务器。服务器会将此类请求作为单个事务执行，除非字符串中包含显式的 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e 命令将其分成多个事务。（有关服务器如何处理多查询字符串的更多详细信息，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. 一个简单查询中的多条语句\"\u003e第 54.2.2.1 节\u003c/a\u003e。）\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PATTERNS\"\u003e\u003ch4\u003e模式\u003c/h4\u003e\u003cp\u003e\n   很多\u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令都可以用一个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数来指定要被显示的对象名称。在最简单的情况下，模式正好就是该对象的准确名称。在模式中的字符通常会被变成小写形式（就像在 SQL 名称中那样），例如\u003ccode class=\"literal\"\u003e\\dt FOO\u003c/code\u003e 将会显示名为 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 的表。就像在 SQL 名称中那样，把模式放在双引号中可以阻止它被转换成小写形式。如果需要在一个模式中包括一个真正的双引号字符，则需要在双引号包围的文本内把它写成两个相邻的双引号，这同样是符合 SQL 加引号标识符的规则。例如，\u003ccode class=\"literal\"\u003e\\dt \"FOO\"\"BAR\"\u003c/code\u003e 将显示名为 \u003ccode class=\"literal\"\u003eFOO\"BAR\u003c/code\u003e（不是 \u003ccode class=\"literal\"\u003efoo\"bar\u003c/code\u003e）的表。和普通的 SQL 名称规则不同，你可以只在模式的一部分周围放上双引号，例如\u003ccode class=\"literal\"\u003e\\dt FOO\"FOO\"BAR\u003c/code\u003e 将会显示名为 \u003ccode class=\"literal\"\u003efooFOObar\u003c/code\u003e 的表。\n  \u003c/p\u003e\u003cp\u003e\n   只要完全省略 \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 参数，\u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 命令就会显示当前模式搜索路径中可见的全部对象 — 这等价于用\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 作为模式（如果一个对象所在的模式位于搜索路径中，并且在搜索路径中该模式之前没有同类且同名的对象，则该对象就是\u003cem class=\"firstterm\"\u003e可见\u003c/em\u003e的。这表示可以直接用名称引用该对象，而不需要用模式来限定）。要查看数据库中所有对象而不考虑其可见性，可以把\u003ccode class=\"literal\"\u003e*.*\u003c/code\u003e 用作模式。\n  \u003c/p\u003e\u003cp\u003e\n   如果放在一个模式中，\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 将匹配任意字符序列（包括空序列），而\u003ccode class=\"literal\"\u003e?\u003c/code\u003e会匹配任意的单个字符（这种记号方法就像 Unix shell 的文件名模式一样）。例如，\u003ccode class=\"literal\"\u003e\\dt int*\u003c/code\u003e 会显示名称以 \u003ccode class=\"literal\"\u003eint\u003c/code\u003e 开始的表。但是如果被放在双引号内，\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 和\u003ccode class=\"literal\"\u003e?\u003c/code\u003e就会失去这些特殊含义而变成普通的字符。\n  \u003c/p\u003e\u003cp\u003e\n   如果用于匹配关系名的模式包含一个点（\u003ccode class=\"literal\"\u003e.\u003c/code\u003e），则会被解释为模式名的匹配模式，后接对象名的匹配模式。例如，\u003ccode class=\"literal\"\u003e\\dt foo*.*bar*\u003c/code\u003e 会显示所有位于模式名以 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 开头的模式中、且表名包含 \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e 的表。如果没有点，则只匹配当前模式搜索路径中可见的对象。同样，双引号内的点会失去特殊含义，按字面匹配。如果用于匹配关系名的模式包含两个点（\u003ccode class=\"literal\"\u003e.\u003c/code\u003e），则会被解释为数据库名、模式名的匹配模式和对象名的匹配模式。数据库名部分不会被当作匹配模式，必须与当前连接的数据库名相同，否则会报错。\n\u003c/p\u003e\u003cp\u003e\n   如果用于匹配模式名的模式包含一个点（\u003ccode class=\"literal\"\u003e.\u003c/code\u003e），则会被解释为数据库名，后接模式名的匹配模式。例如，\u003ccode class=\"literal\"\u003e\\dn mydb.*foo*\u003c/code\u003e 会显示名称中包含 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 的所有模式。数据库名部分不会被当作匹配模式，必须与当前连接的数据库名相同，否则会报错。\n\u003c/p\u003e\u003cp\u003e\n   高级用户可以使用字符类等正则表达式记法，如\u003ccode class=\"literal\"\u003e[0-9]\u003c/code\u003e 可以匹配任意数字。所有的正则表达式特殊字符都按照\u003ca class=\"xref\" href=\"/zh/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e所说的工作，以下字符除外：\u003ccode class=\"literal\"\u003e.\u003c/code\u003e会按照上面所说的作为一种分隔符，\u003ccode class=\"literal\"\u003e*\u003c/code\u003e 会被翻译成正则表达式记号\u003ccode class=\"literal\"\u003e.*\u003c/code\u003e，\u003ccode class=\"literal\"\u003e?\u003c/code\u003e会被翻译成\u003ccode class=\"literal\"\u003e.\u003c/code\u003e，而\u003ccode class=\"literal\"\u003e$\u003c/code\u003e则按字面意思匹配。根据需要，可以用\u003ccode class=\"literal\"\u003e?\u003c/code\u003e模拟\u003ccode class=\"literal\"\u003e.\u003c/code\u003e，用\u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e+|)\u003c/code\u003e 模拟 \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e*\u003c/code\u003e，或用\u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e|)\u003c/code\u003e 模拟 \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e?\u003c/code\u003e。\u003ccode class=\"literal\"\u003e$\u003c/code\u003e不需要作为一个正则表达式字符，因为模式必须匹配整个名称，而不是像正则表达式的常规用法那样解释（换句话说，\u003ccode class=\"literal\"\u003e$\u003c/code\u003e会被自动地追加到模式上）。如果不希望该模式的匹配位置被固定，可以在开头或者结尾写上\u003ccode class=\"literal\"\u003e*\u003c/code\u003e。注意在双引号内，所有的正则表达式特殊字符会失去其特殊含义并且按照其字面意思进行匹配。还有，在操作符名称模式中（即作为\u003ccode class=\"literal\"\u003e\\do\u003c/code\u003e 的参数），正则表达式特殊字符也按照字面意思进行匹配。\n  \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"id-1.9.4.21.8.5\"\u003e\u003ch3\u003e高级特性\u003c/h3\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-VARIABLES\"\u003e\u003ch4\u003e变量\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 提供了和普通 Unix 命令 shell 相似的变量替换特性。变量简单来说就是一对名称/值，其中值可以是任意长度的任意字符串。名称必须由字母（包括非拉丁字母）、数字和下划线构成。\n    \u003c/p\u003e\u003cp\u003e\n    要设置一个变量，可以使用 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的元命令\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e。例如，\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo bar\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    会将 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 设置为值 \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e。要检索该变量的内容，可以在名称前放一个冒号，例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :foo\u003c/code\u003e\u003c/strong\u003e\nbar\n\u003c/pre\u003e\u003cp\u003e\n    这在常规 SQL 命令和元命令中均有效，下文的 \u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL 插值\"\u003eSQL 插值\u003c/a\u003e中有更多细节。\n    \u003c/p\u003e\u003cp\u003e\n    如果调用\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 时没有第二个参数，该变量会被设置为一个空字符串值。要取消设置（即删除）一个变量，可以使用命令\u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e。要显示所有变量的值，在调用\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 时不带任何参数即可。\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 的参数服从与其他命令相同的替换规则。因此可以构造有趣的引用，例如\u003ccode class=\"literal\"\u003e\\set :foo 'something'\u003c/code\u003e 以及分别得到 \u003cspan class=\"productname\"\u003ePerl\u003c/span\u003e 或者 \u003cspan class=\"productname\"\u003e\u003cacronym class=\"acronym\"\u003ePHP\u003c/acronym\u003e\u003c/span\u003e 的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e软链接\u003c/span\u003e”\u003c/span\u003e或者\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e可变变量\u003c/span\u003e”\u003c/span\u003e。不幸的是（或者幸运的是？），这些构造出来的东西并没有什么用处。在另一方面，\u003ccode class=\"literal\"\u003e\\set bar :foo\u003c/code\u003e 是一种很好的拷贝变量的方法。\n    \u003c/p\u003e\u003c/div\u003e\u003cp\u003e\n    有一些变量会被 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 特殊对待。它们表示特定的选项设置，运行时这类选项设置可以通过修改该变量的值来改变，或者在某些情况下它们表示 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的可更改的状态。按照惯例，所有被特殊对待的变量的名称由全部大写形式的 ASCII 字母（还有可能是数字和下划线）组成。为了确保未来最大的兼容性，最好避免把这类变量名用于自己的目的。\n   \u003c/p\u003e\u003cp\u003e\n    控制 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 行为的变量通常不能被取消设置或者设置为无效值。允许\u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e 命令，但它会被解释为将变量设置为它的默认值。没有第二参数的\u003ccode class=\"literal\"\u003e\\set\u003c/code\u003e 命令会被解释为将变量设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e（对于接受该值的控制变量），对不接受该值的变量则会拒绝这个命令。此外，接受值 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e 的控制变量也能接受其他常见的布尔值拼写方式，例如 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e。\n   \u003c/p\u003e\u003cp\u003e\n    被特殊对待的变量是：\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eAUTOCOMMIT\u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在被设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e（默认）时，每一个 SQL 命令在成功完成时会被自动提交。在这种模式中要推迟提交，必须输入一个 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e 或者 \u003ccode class=\"command\"\u003eSTART TRANSACTION\u003c/code\u003e SQL 命令。当被设置为 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e 或者被取消设置时，在显式发出 \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e 或者 \u003ccode class=\"command\"\u003eEND\u003c/code\u003e 之前，SQL 命令不会被提交。自动提交关闭模式会为你发出一个隐式的 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e，这会发生在命令执行之前，前提是该命令不在事务块中，且其本身既不是 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e 或其他事务控制命令，也不是无法在事务块中执行的命令（例如 \u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e）。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         在自动提交关闭模式中，必须通过 \u003ccode class=\"command\"\u003eABORT\u003c/code\u003e 或者 \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e 显式地放弃任何失败的事务。还要记住，如果退出会话时没有提交，则所有的工作都会丢失。\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n         自动提交打开模式是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的传统行为，但是自动提交关闭模式更接近于 SQL 的规范。如果更喜欢自动提交关闭模式，可以在系统级的 \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e 文件或者个人的 \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e 文件中设置它。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eCOMP_KEYWORD_CASE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        确定在补全一个 SQL 关键词时要使用的大小写形式。如果被设置为 \u003ccode class=\"literal\"\u003elower\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003eupper\u003c/code\u003e，补全后的词将分别是小写或者大写形式。如果被设置为 \u003ccode class=\"literal\"\u003epreserve-lower\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003epreserve-upper\u003c/code\u003e（默认），补全后的词将会保持该词已输入部分的大小写形式，但是如果被补全的词还没有被输入，则它会被分别补全成小写或者大写形式。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eDBNAME\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当前已连接的数据库名称。每次连接到一个数据库时都会设置该变量（包括程序启动时），但是可以被更改或者取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果被设置为 \u003ccode class=\"literal\"\u003eall\u003c/code\u003e，所有非空输入行会在读入时打印到标准输出（不适用于交互式读取的行）。要在程序开始时选择这种行为，可以使用开关 \u003ccode class=\"option\"\u003e-a\u003c/code\u003e。如果被设置为 \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会在发送每个查询给服务器时将它们打印到标准输出。选择这种行为的开关是 \u003ccode class=\"option\"\u003e-e\u003c/code\u003e。如果被设置为 \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e，那么只有失败的查询会被显示在标准错误输出上。这种行为的开关是 \u003ccode class=\"option\"\u003e-b\u003c/code\u003e。如果被设置为 \u003ccode class=\"literal\"\u003enone\u003c/code\u003e（默认值）则不会显示任何查询。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当这个变量被设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 且一个反斜线命令查询数据库时，相应的查询会被先显示。这种特性可以帮助我们学习 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的内部并且在自己的程序中提供类似的功能（要在程序开始时选择这种行为，可以使用开关 \u003ccode class=\"option\"\u003e-E\u003c/code\u003e）。如果把这个变量设置为值 \u003ccode class=\"literal\"\u003enoexec\u003c/code\u003e，则对应的查询只会被显示而并不真正被发送给服务器执行。默认值是 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eENCODING\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当前的客户端字符集编码。每一次你连接到一个数据库（包括程序启动）时以及当你用\u003ccode class=\"literal\"\u003e\\encoding\u003c/code\u003e 更改编码时，这个变量都会被设置，但它可以被更改或者取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果上一个 SQL 查询失败则为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e，如果成功则是 \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e。另见 \u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果这个变量被设置为一个大于零的整数值，\u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e 查询的结果会以一组一组的方式取出并且显示（而不是像默认的那样把整个结果集拿到以后再显示），每组包含的行数等于该整数值。因此，这种方式只会使用有限的内存量，而不管整个结果集的大小。在启用这个特性时，通常会使用 100 到 1000 的设置。记住在使用这种特性时，一个查询可能会在已经显示了一些行之后失败。\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003e提示\u003c/h3\u003e\u003cp\u003e\n        尽管可以把这种特性用于任何的输出格式，但是默认的 \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e 格式看起来会比较糟糕，因为每一组的 \u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e 行将被单独格式化，这就会导致不同的行组的列宽不同。其他的输出格式会更好。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TABLEAM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果此变量设置为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e，则不显示表的访问方法的详细信息。这主要用于回归测试。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TOAST_COMPRESSION\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果这个变量被设置为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e，不显示列压缩方法的细节。这主要用于回归测试。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTCONTROL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果这个变量被设置为 \u003ccode class=\"literal\"\u003eignorespace\u003c/code\u003e，则以一个空格开始的行不会被放入到历史列表中。如果被设置为值 \u003ccode class=\"literal\"\u003eignoredups\u003c/code\u003e，则与上一条历史记录相同的行不会被放入。值 \u003ccode class=\"literal\"\u003eignoreboth\u003c/code\u003e 组合了上述两种值。如果被设置为 \u003ccode class=\"literal\"\u003enone\u003c/code\u003e（默认值），所有在交互模式中被读入的行都会保存在历史列表中。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        这个特性是可耻地从 \u003cspan class=\"application\"\u003eBash\u003c/span\u003e 抄袭过来的。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTFILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        该文件名将被用于存储历史列表。如果未设置该变量，文件名将从 \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e 环境变量中取得。如果该环境变量也没有被设置，则默认值是 \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e，在 Windows 上是 \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e。例如，\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n\\set HISTFILE ~/.psql_history-:DBNAME\n\u003c/pre\u003e\u003cp\u003e\n        放在 \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e 中将会导致 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 为每一个数据库维护一个单独的历史。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        这个特性是可耻地从 \u003cspan class=\"application\"\u003eBash\u003c/span\u003e 抄袭过来的。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTSIZE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTSIZE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        存储在命令历史中的最大命令数（默认值是 500）。如果被设置为一个负值，则不会应用限制。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        这个特性是可耻地从 \u003cspan class=\"application\"\u003eBash\u003c/span\u003e 抄袭过来的。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHOST\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当前连接到的数据库服务器主机。每次连接到数据库时都会设置该变量（包括程序启动时），但也可以被更改或取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eIGNOREEOF\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果被设置为 1 或者更小，向一个 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的交互式会话发送一个 \u003cacronym class=\"acronym\"\u003eEOF\u003c/acronym\u003e 字符（通常是 \u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e）将会终止应用。如果设置为一个较大的数字值，则必须连续键入与该数值相等数量的 \u003cacronym class=\"acronym\"\u003eEOF\u003c/acronym\u003e 字符才能让交互式会话终止。如果该变量被设置为一个非数字值，则它会被解释为 10。默认值为 0。\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n        这个特性是可耻地从 \u003cspan class=\"application\"\u003eBash\u003c/span\u003e 抄袭过来的。\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LASTOID\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLASTOID\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        最后被影响的 OID 的值，即由 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 或者\u003ccode class=\"command\"\u003e\\lo_import\u003c/code\u003e 命令返回的值。这个变量仅保证在下一个 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 命令的结果显示完之前有效。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器从 12 版开始不再支持 OID 系统列，因此，在面向此类服务器时，执行 \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e 后的 LASTOID 将始终为 0。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_MESSAGE\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_SQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         当前 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会话中最近一个失败查询的主错误消息和相关的 SQLSTATE 代码，如果在当前会话中没有发生错误，则是一个空字符串和 \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eON_ERROR_ROLLBACK\u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当被设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 时，如果事务块中的一个语句产生一个错误，该错误会被忽略并且该事务会继续。当被设置为 \u003ccode class=\"literal\"\u003einteractive\u003c/code\u003e 时，只在交互式会话中忽略这类错误，而读取脚本文件时则不会忽略错误。当被设置为 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e（默认值）时，事务块中产生错误的一个语句会中止整个事务。错误回滚模式的工作原理是在事务块的每个命令之前都为你发出一个隐式的 \u003ccode class=\"command\"\u003eSAVEPOINT\u003c/code\u003e，然后在该命令失败时回滚到该保存点。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        默认情况下，发生错误后命令处理会继续。当这个变量被设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 时，处理将立即停止。在交互模式下，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会返回到命令提示符；否则，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会退出，并返回错误代码 3，以便与错误代码 1 所表示的致命错误区分开来。在两种情况下，任何当前正在运行的脚本（顶层脚本以及它可能调用的其他脚本）都会立即中止。如果顶层命令字符串包含多个 SQL 命令，则会在当前命令处停止处理。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_COMMAND_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        正在运行的管道中排队的命令数。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_RESULT_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        正在进行的管道中，有多少条命令后面跟着 \u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e 或\n        \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e，从而强制服务器发送结果。这些结果可以通过\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e 取回。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_SYNC_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        正在运行的管道中排队的同步消息数量。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePORT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当前连接到的数据库服务器端口。每次连接到数据库时都会设置该变量（包括程序启动时），但也可以被更改或取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这些变量指定 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 发出的提示符的模样。见下文的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"提示符\"\u003e提示符\u003c/a\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        把这个变量设置为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 等效于命令行选项 \u003ccode class=\"option\"\u003e-q\u003c/code\u003e。在交互模式下可能用处不大。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eROW_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         上一个 SQL 查询返回的行数或者受影响的行数，如果该查询失败或者没有报告行计数则为 0。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NAME\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        字符串形式的服务器版本号，例如 \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e、\u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e，以及数字形式的服务器版本号，例如 \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e。每次你连接到一个数据库（包括程序启动）时，这些都会被设置，但可以被改变或者取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVICE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVICE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        服务名称（如果适用）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         如果最后一个 shell 命令失败，则为 \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e；如果成功，则为 \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e。这适用于通过 \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e\n         和 \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e 元命令调用的 shell 命令，也适用于反引号（\u003ccode class=\"literal\"\u003e`\u003c/code\u003e）扩展。请注意，对于 \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e，该变量会在下一个 \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e 命令关闭输出管道时更新。另见 \u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         最后一个 shell 命令返回的退出状态。0–127 表示程序退出码，128–255 表示因信号而终止，-1 表示未能启动程序或未能取得其退出状态。这适用于通过 \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e、\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e\n         和 \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e 元命令调用的 shell 命令，也适用于反引号（\u003ccode class=\"literal\"\u003e`\u003c/code\u003e）扩展。请注意，对于 \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e，该变量会在下一个 \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e 命令关闭输出管道时更新。另见 \u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_ALL_RESULTS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当此变量被设为 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e 时，组合查询（\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e）只显示最后一个结果，而不是显示全部结果。默认值为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。设为 off 的行为是为了兼容旧版本的\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这个变量可以被设置为值 \u003ccode class=\"literal\"\u003enever\u003c/code\u003e、\u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e 来控制是否在来自服务器的消息中显示 \u003ccode class=\"literal\"\u003eCONTEXT\u003c/code\u003e 字段。默认是 \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e（表示在错误消息中显示上下文，但在通知和警告消息中不显示）。当 \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e 被设置为 \u003ccode class=\"literal\"\u003eterse\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e 时，这个设置无效（另见\u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e，它可以用来得到刚遇到的错误的详细信息）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLELINE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置这个变量为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 等效于命令行选项 \u003ccode class=\"option\"\u003e-S\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLESTEP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置这个变量为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e 等效于命令行选项 \u003ccode class=\"option\"\u003e-s\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SQLSTATE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         与上一个 SQL 查询的失败相关的错误代码（见\u003ca class=\"xref\" href=\"/zh/docs/18/errcodes-appendix.html\" title=\"附录 A. PostgreSQL错误代码\"\u003e附录 A\u003c/a\u003e），如果上一个查询成功则为 \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-USER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当前连接的数据库用户。每次连接到一个数据库时都会设置该变量（包括程序启动时），但是可以被更改或者取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERBOSITY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这个变量可以被设置为值 \u003ccode class=\"literal\"\u003edefault\u003c/code\u003e、\u003ccode class=\"literal\"\u003everbose\u003c/code\u003e、\u003ccode class=\"literal\"\u003eterse\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e 来控制错误报告的详细程度（另见\u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e，在想得到刚遇到的错误的详细信息时使用）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NAME\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        这些变量在程序启动时被设置以反映 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 的版本，分别是一个详细的字符串、一个短字符串（例如 \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e、\u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e）以及一个数字（例如 \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e 或者 \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e）。它们可以被更改或取消设置。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此变量设置\u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e 在两次执行查询之间等待的默认间隔，单位为秒。默认值为 2 秒。若在命令中指定了间隔，则会覆盖此变量。\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\"\u003e\u003ch4\u003e\u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 插值\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量的一个关键特性是可以把它们替换（\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e插值\u003c/span\u003e”\u003c/span\u003e）到常规 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 语句中，也可以把它们替换到元命令的参数中。此外，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 还提供了功能来确保被用作 SQL 字面量和标识符的变量值会被正确地加引号。不加引号地插值一个值的语法是在变量名前面加上一个冒号（\u003ccode class=\"literal\"\u003e:\u003c/code\u003e）。例如，\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :foo;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    将查询表 \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e。注意这可能会不安全：该变量的值会被按字面拷贝，因此它可能包含不平衡的引号甚至反斜线命令。必须确保把它放在那里是有意义的。\n    \u003c/p\u003e\u003cp\u003e\n    当一个值要用作 SQL 字面量或标识符时，最安全的做法是为它加上引号。要将变量值作为 SQL 字面量加引号，应写一个冒号，后面跟用单引号括起来的变量名。要将变量值作为 SQL 标识符加引号，则在冒号后面用双引号括起变量名。这些写法能正确处理变量值中嵌入的引号和其他特殊字符。前面的示例可用以下更安全的写法：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :\"foo\";\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    在加引号的 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e 字面量和标识符内部，不会执行变量插值。因此，\u003ccode class=\"literal\"\u003e':foo'\u003c/code\u003e 这样的写法不能根据变量值生成加引号的字面量（即使能够生效，也不安全，因为它无法正确处理变量值中嵌入的引号）。\n    \u003c/p\u003e\u003cp\u003e\n    使用这种机制的一个示例是把一个文件的内容拷贝到一个表列中。首先把该文件载入到一个变量，然后把该变量的值作为一个加引号的字符串进行插值：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set content `cat my_file.txt`\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eINSERT INTO my_table VALUES (:'content');\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    （注意如果 \u003ccode class=\"filename\"\u003emy_file.txt\u003c/code\u003e 包含 NUL 字节，这样也不行。\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 不支持在变量值中嵌入 NUL 字节）。\n    \u003c/p\u003e\u003cp\u003e\n    因为冒号可以合法地出现在 SQL 命令中，看似插值的写法（即\u003ccode class=\"literal\"\u003e:name\u003c/code\u003e、\u003ccode class=\"literal\"\u003e:'name'\u003c/code\u003e 或者\u003ccode class=\"literal\"\u003e:\"name\"\u003c/code\u003e）不会被替换，除非所指的变量当前已设置。在任何情况下，可以用一个反斜线对冒号进行转义以避免它被替换。\n    \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e特殊语法会根据该变量是否存在返回 TRUE 或 FALSE，因此总是会被替换，除非冒号被反斜线转义。\n    \u003c/p\u003e\u003cp\u003e\n    变量的冒号语法对嵌入式查询语言（例如 \u003cspan class=\"application\"\u003eECPG\u003c/span\u003e）来说是标准的 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e。用于数组切片和类型转换的冒号语法是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展，它有时可能会与标准用法冲突。把一个变量值转义成 SQL 字面量或者标识符的冒号加引号语法是一种 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 扩展。\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PROMPTING\"\u003e\u003ch4\u003e提示符\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 发出的提示符可以按你的喜好进行定制。\u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e、\u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e 和 \u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e 这三个变量包含描述提示符外观的字符串和特殊转义序列。提示符 1 是 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 请求新命令时发出的常规提示符。提示符 2 会在录入命令期间还需要更多输入时发出，例如命令尚未以分号结束，或者引号尚未闭合时。在执行 \u003cacronym class=\"acronym\"\u003eSQL\u003c/acronym\u003e \u003ccode class=\"command\"\u003eCOPY FROM STDIN\u003c/code\u003e 命令并需要在终端中输入一行值时，会发出提示符 3。\n    \u003c/p\u003e\u003cp\u003e\n    选中的提示符变量值会按字面输出，除非遇到百分号（\u003ccode class=\"literal\"\u003e%\u003c/code\u003e）。根据下一个字符的不同，会替换成某些其他文本。已定义的替换如下：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%M\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e数据库服务器的完整主机名（含域名）；如果通过 Unix 域套接字连接，则为\u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e；如果 Unix 域套接字不在编译时指定的默认位置，则为\u003ccode class=\"literal\"\u003e[local:\u003cem class=\"replaceable\"\u003e\u003ccode\u003e/dir/name\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%m\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e数据库服务器的主机名，在第一个点号处截断；如果通过 Unix 域套接字连接，则为\u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-GT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u0026gt;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e数据库服务器监听的端口号。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-N\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%n\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e数据库会话用户名。（在数据库会话期间，\u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 命令可能改变该值的扩展结果。）\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%s\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e服务名称。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SLASH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%/\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e当前数据库的名称。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-TILDE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%~\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e类似 \u003ccode class=\"literal\"\u003e%/\u003c/code\u003e，但如果该数据库是你的默认数据库，则输出 \u003ccode class=\"literal\"\u003e~\u003c/code\u003e（波浪号）。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%#\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果会话用户是数据库超级用户，则为\u003ccode class=\"literal\"\u003e#\u003c/code\u003e，否则为\u003ccode class=\"literal\"\u003e\u0026gt;\u003c/code\u003e。（在数据库会话期间，\u003ccode class=\"command\"\u003eSET SESSION AUTHORIZATION\u003c/code\u003e 命令可能改变该值的扩展结果。）\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%p\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e当前所连接后端的进程 ID。\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        管道状态：不在管道中时为 \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e，在进行中的管道中时为 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e，在已中止的管道中时为 \u003ccode class=\"literal\"\u003eabort\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-R\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%R\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在提示符 1 中，通常为 \u003ccode class=\"literal\"\u003e=\u003c/code\u003e；但如果会话处于条件块的非活动分支中，则为 \u003ccode class=\"literal\"\u003e@\u003c/code\u003e；如果处于单行模式，则为 \u003ccode class=\"literal\"\u003e^\u003c/code\u003e；如果会话已与数据库断开连接（这可能发生在 \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e 失败时），则为 \u003ccode class=\"literal\"\u003e!\u003c/code\u003e。在提示符 2 中，\u003ccode class=\"literal\"\u003e%R\u003c/code\u003e 会被替换为一个字符，该字符取决于 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 为什么还期待更多输入：如果命令只是尚未终止，则为 \u003ccode class=\"literal\"\u003e-\u003c/code\u003e；如果存在未结束的 \u003ccode class=\"literal\"\u003e/* ... */\u003c/code\u003e 注释，则为 \u003ccode class=\"literal\"\u003e*\u003c/code\u003e；如果存在未结束的带引号字符串，则为单引号；如果存在未结束的带引号标识符，则为双引号；如果存在未结束的美元引用字符串，则为美元符号；如果存在未匹配的左括号，则为 \u003ccode class=\"literal\"\u003e(\u003c/code\u003e。在提示符 3 中，\u003ccode class=\"literal\"\u003e%R\u003c/code\u003e 不会产生任何输出。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%x\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        事务状态：如果当前不在事务块中，则为空字符串；如果处于事务块中，则为 \u003ccode class=\"literal\"\u003e*\u003c/code\u003e；如果处于失败的事务块中，则为 \u003ccode class=\"literal\"\u003e!\u003c/code\u003e；如果事务状态不确定（例如因为当前没有连接），则为 \u003ccode class=\"literal\"\u003e?\u003c/code\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-L\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%l\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          当前语句中的行号，从 \u003ccode class=\"literal\"\u003e1\u003c/code\u003e 开始。\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-DIGITS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        替换为指定八进制代码对应的字符。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%:\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e:\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e 的值。详见上面的\u003ca class=\"xref\" href=\"/zh/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"变量\"\u003e变量\u003c/a\u003e。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%`\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e`\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e 的输出，类似普通的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e反引号\u003c/span\u003e”\u003c/span\u003e替换。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%[\u003c/code\u003e ... \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         提示符中可以包含终端控制字符，例如改变提示文本的颜色、背景或样式，或者改变终端窗口标题。为了让 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e 的行编辑功能正常工作，这些不可打印的控制字符必须用 \u003ccode class=\"literal\"\u003e%[\u003c/code\u003e 和\n         \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e 包围起来，以标记为不可见字符。提示符中可以出现多组这样的标记。例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n\u003c/pre\u003e\u003cp\u003e\n         其效果是在兼容 VT100 且支持颜色的终端上，生成一个粗体（\u003ccode class=\"literal\"\u003e1;\u003c/code\u003e）的黑底黄字提示符（\u003ccode class=\"literal\"\u003e33;40\u003c/code\u003e）。\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-W\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%w\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        与最近一次输出的\n        \u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e 具有相同宽度的空白。这可用作\n        \u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e 的设置，使多行语句与第一行对齐，但不显示可见的二级提示符。\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\n    要在提示符中插入百分号，请写成\n    \u003ccode class=\"literal\"\u003e%%\u003c/code\u003e。默认提示符是：提示符 1 和 2 使用 \u003ccode class=\"literal\"\u003e'%/%R%x%# '\u003c/code\u003e，提示符 3 使用 \u003ccode class=\"literal\"\u003e'\u0026gt;\u0026gt; '\u003c/code\u003e。\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003e注意\u003c/h3\u003e\u003cp\u003e\n    这个特性是可耻地从 \u003cspan class=\"application\"\u003etcsh\u003c/span\u003e 抄袭过来的。\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-READLINE\"\u003e\u003ch4\u003e命令行编辑\u003c/h4\u003e\u003cp\u003e\n    如果可用，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会使用 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e 或 \u003cspan class=\"application\"\u003elibedit\u003c/span\u003e 库，以便进行便捷的行编辑和历史检索。当 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 退出时，命令历史会自动保存；当 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 启动时，又会重新载入。输入上箭头或 control-P 可以取回之前的行。\n\u003c/p\u003e\u003cp\u003e\n    在许多（绝非全部）上下文中，还可以使用 TAB 补全部分输入的关键字和 SQL 对象名。例如，在命令开头输入 \u003ccode class=\"literal\"\u003eins\u003c/code\u003e 并按下 TAB 键，会补全为 \u003ccode class=\"literal\"\u003einsert into \u003c/code\u003e。然后输入表名或模式名的几个字符，再按下 \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e 键，就会补全尚未输完的名称；如果有多个候选项，则会给出可能的补全菜单。（具体取决于所使用的库，可能需要按多次 \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e 键才能看到菜单。）\n    \u003c/p\u003e\u003cp\u003e\n    对 SQL 对象名进行 TAB 补全时，需要向服务器发送查询来查找可能的匹配项。在某些上下文中，这可能会干扰其他操作。例如，在 \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e 之后，如果中间发出了一次 TAB 补全查询，那么再发出 \u003ccode class=\"command\"\u003eSET TRANSACTION ISOLATION LEVEL\u003c/code\u003e 就为时已晚了。如果根本不想使用 TAB 补全，可以把下面的内容放到主目录中名为\u003ccode class=\"filename\"\u003e.inputrc\u003c/code\u003e 的文件里，从而永久关闭它：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\n$if psql\nset disable-completion on\n$endif\n\u003c/pre\u003e\u003cp\u003e\n    （这不是 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 而是一个 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e 功能。阅读其文档以获取更多详细信息。）\n    \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"option\"\u003e-n\u003c/code\u003e（\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e）命令行选项也可用于在单次运行 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 时禁用 \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e。这会阻止 TAB 补全、命令行历史的使用或记录，以及多行命令的编辑。当你需要复制粘贴包含 \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e 字符的文本时，它尤其有用。\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\"\u003e\u003ch2\u003e环境\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果\u003ccode class=\"literal\"\u003e\\pset columns\u003c/code\u003e 为零，这个环境变量控制用于 \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e 格式的宽度以及用来确定较宽的输出是否需要分页器，或者是否应切换到扩展自动模式中的垂直格式的宽度。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      默认连接参数（见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      指定诊断消息是否使用颜色。可选值为\n      \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e、\u003ccode class=\"literal\"\u003eauto\u003c/code\u003e 和\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eEDITOR\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eVISUAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\e\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e 以及\u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e 命令所使用的编辑器。会按照列出的顺序检查这些变量，第一个被设置的将被使用。如果都没有被设置，默认是使用 Unix 系统上的 \u003ccode class=\"filename\"\u003evi\u003c/code\u003e 或者 Windows 系统上的 \u003ccode class=\"filename\"\u003enotepad.exe\u003c/code\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR_LINENUMBER_ARG\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      当 \u003ccode class=\"command\"\u003e\\e\u003c/code\u003e、\u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e 或\n      \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e 带有行号参数使用时，此变量指定将起始行号传给用户编辑器时所用的命令行参数。对于 \u003cspan class=\"productname\"\u003eEmacs\u003c/span\u003e 或\n      \u003cspan class=\"productname\"\u003evi\u003c/span\u003e 之类的编辑器，这个参数是一个加号。如果选项名和行号之间需要空格，请在变量值中包含末尾空格。例如：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nPSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n      在 Unix 系统上默认是\u003ccode class=\"literal\"\u003e+\u003c/code\u003e（对应于默认编辑器 \u003ccode class=\"filename\"\u003evi\u003c/code\u003e，且对很多其他常见编辑器可用）。在 Windows 系统上没有默认值。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      命令历史文件的替代位置。波浪线（\u003ccode class=\"literal\"\u003e~\u003c/code\u003e）扩展会被执行。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果查询结果无法在屏幕上显示完整，它们会通过管道传给此命令。典型的值是 \u003ccode class=\"literal\"\u003emore\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eless\u003c/code\u003e。可以通过将 \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e 或 \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e 设置为空字符串，或通过调整\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e 命令的与分页相关的选项来禁用分页器。这些变量按照列出的顺序进行检查；使用按该顺序找到的第一个已设置的变量。如果它们都没有设置，默认情况下在大多数平台上使用 \u003ccode class=\"literal\"\u003emore\u003c/code\u003e，但在 Cygwin 上使用 \u003ccode class=\"literal\"\u003eless\u003c/code\u003e。\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      当使用 \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e\n      命令重复执行查询时，默认不会使用分页器。在 Unix 系统上，可以通过将 \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e 设置为分页器命令来改变这一行为。\u003ccode class=\"literal\"\u003epspg\u003c/code\u003e 分页器（不是\n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的一部分，但在许多开源软件发行版中可用）如果以\n      \u003ccode class=\"literal\"\u003e--stream\u003c/code\u003e 选项启动，就可以显示\n      \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e 的输出。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      用户的\u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e 文件的替代位置。波浪线（\u003ccode class=\"literal\"\u003e~\u003c/code\u003e）扩展会被执行。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-SHELL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eSHELL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      被\u003ccode class=\"command\"\u003e\\!\u003c/code\u003e命令执行的命令。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eTMPDIR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      存储临时文件的目录。默认是 \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   与大多数其他 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 工具一样，此工具也使用\n   \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 支持的环境变量（见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.10\"\u003e\u003ch2\u003e文件\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-FILES-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e 和 \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     如果没有 \u003ccode class=\"option\"\u003e-X\u003c/code\u003e 选项，在连接到数据库后但在接收正常的命令之前，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 会尝试依次从系统级的启动文件（\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e）和用户的个人启动文件（\u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e）中读取并且执行命令。这些文件可以被用来设置客户端或者服务器，通常是一些\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e 和 \u003ccode class=\"command\"\u003eSET\u003c/code\u003e 命令。\n    \u003c/p\u003e\u003cp\u003e\n     系统范围的启动文件名为 \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e。默认情况下，会在安装的\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e系统配置\u003c/span\u003e”\u003c/span\u003e目录中查找它，最可靠的识别方式是运行 \u003ccode class=\"literal\"\u003epg_config\n     --sysconfdir\u003c/code\u003e。通常这个目录是相对于包含 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 可执行文件的目录的 \u003ccode class=\"filename\"\u003e../etc/\u003c/code\u003e。也可以通过 \u003ccode class=\"envar\"\u003ePGSYSCONFDIR\u003c/code\u003e 环境变量显式指定查找目录。\n    \u003c/p\u003e\u003cp\u003e\n     用户的个人启动文件名为\u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e，并且在调用用户的主目录中寻找。在 Windows 上，个人启动文件的名称改为 \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psqlrc.conf\u003c/code\u003e。在任何情况下，可以通过设置 \u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e 环境变量来覆盖此默认文件路径。\n\u003c/p\u003e\u003cp\u003e\n     系统范围的启动文件和用户个人的启动文件都可以通过在文件名后附加连字符和 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 的大版本或小版本标识符来使其与 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 版本相关，例如 \u003ccode class=\"filename\"\u003e~/.psqlrc-18\u003c/code\u003e 或 \u003ccode class=\"filename\"\u003e~/.psqlrc-18.7\u003c/code\u003e。最具体版本匹配的文件将优先读取，而不是非特定版本的文件。这些版本后缀是在确定文件路径后添加的，如上所述。\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-FILES-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003e.psql_history\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     命令行历史被存储在文件 \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e 中，在 Windows 上则存储在文件 \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e 中。\n    \u003c/p\u003e\u003cp\u003e\n     历史文件的位置可以通过 \u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 变量或者 \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e 环境变量显式设置。\n    \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.11\"\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\" style=\"list-style-type: disc; \"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 最适合与相同或较旧大版本的服务器配合使用。如果服务器的版本比 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 本身更新，反斜线命令特别容易失败。然而，\u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e 系列的反斜线命令应该可以在最低至 9.2 版本的服务器上运行，但不一定适用于比 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 本身更新的服务器。运行 SQL 命令和显示查询结果的一般功能也应该可以在更新大版本的服务器上运行，但不能保证在所有情况下都能实现。\n      \u003c/p\u003e\u003cp\u003e\n       如果你想用 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 连接到多个具有不同大版本的服务器，推荐使用最新版本的 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e。或者，你可以为每一个大版本保留一份 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 拷贝，并且针对相应的服务器使用匹配的版本。但实际上，这种额外的麻烦是不必要的。\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       在 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.6 之前，\u003ccode class=\"option\"\u003e-c\u003c/code\u003e 选项意味着 \u003ccode class=\"option\"\u003e-X\u003c/code\u003e（\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e）；现在已经不是这样了。\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       在 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4 之前，\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 允许一个单字母反斜线命令的第一个参数直接写在该命令后面，中间不需要空白。现在则要求用空白分隔。\n      \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.12\"\u003e\u003ch2\u003e给 Windows 用户的注解\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e 是一个\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e控制台应用\u003c/span\u003e”\u003c/span\u003e。由于 Windows 的控制台窗口使用的是一种和系统中其他应用不同的编码，在 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 中使用 8 位字符时要特别注意。如果 \u003cspan class=\"application\"\u003epsql\u003c/span\u003e 检测到一个有问题的控制台代码页，它将会在启动时警告你。要更改控制台代码页，有两件事是必要的：\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\" style=\"list-style-type: disc; \"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      输入 \u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecmd.exe /c chcp 1252\u003c/code\u003e\u003c/strong\u003e 可以设置代码页（1252 是适用于德语的一个代码页，请在这里替换成你的值）。如果正在使用 Cygwin，可以把这个命令放在 \u003ccode class=\"filename\"\u003e/etc/profile\u003c/code\u003e 中。\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      把控制台字体设置为 \u003ccode class=\"literal\"\u003eLucida Console\u003c/code\u003e，因为栅格字体无法与 ANSI 代码页一起使用。\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\"\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n  第一个示例展示了如何把一条命令分散到多行输入中。注意提示符的变化：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eCREATE TABLE my_table (\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e first integer not null default 0,\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e second text)\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e;\u003c/code\u003e\u003c/strong\u003e\nCREATE TABLE\n\u003c/pre\u003e\u003cp\u003e\n  现在再来看一下这个表的定义：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\d my_table\u003c/code\u003e\u003c/strong\u003e\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n\u003c/pre\u003e\u003cp\u003e\n  现在我们把提示符改成更有趣的形式：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set PROMPT1 '%n@%m %~%R%# '\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n  假设你已经向表中填入数据，并想看一看：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npeter@localhost testdb=\u0026gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n  你可以使用\n  \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e 命令以不同方式显示表格：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 2\u003c/code\u003e\u003c/strong\u003e\nBorder style is 2.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 0\u003c/code\u003e\u003c/strong\u003e\nBorder style is 0.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 1\u003c/code\u003e\u003c/strong\u003e\nBorder style is 1.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format csv\u003c/code\u003e\u003c/strong\u003e\nOutput format is csv.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset tuples_only\u003c/code\u003e\u003c/strong\u003e\nTuples only is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format unaligned\u003c/code\u003e\u003c/strong\u003e\nOutput format is unaligned.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset fieldsep '\\t'\u003c/code\u003e\u003c/strong\u003e\nField separator is \"    \".\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none     1\ntwo     2\nthree   3\nfour    4\n\u003c/pre\u003e\u003cp\u003e\n  或者使用短命令：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\a \\t \\x\u003c/code\u003e\u003c/strong\u003e\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  此外，可以使用\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 为一个查询设置这些输出格式选项：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\g (format=aligned tuples_only=off expanded=on)\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   下面是一个使用 \u003ccode class=\"command\"\u003e\\df\u003c/code\u003e 命令只查找名称匹配 \u003ccode class=\"literal\"\u003eint*pl\u003c/code\u003e\n   且第二个参数类型为 \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e 的函数的示例：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df int*pl * bigint\u003c/code\u003e\u003c/strong\u003e\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   这里，\u003ccode class=\"literal\"\u003e+\u003c/code\u003e 选项用于显示其中一个函数的附加信息，而 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e 用于以扩展模式显示结果：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df+x int*pl integer bigint\u003c/code\u003e\u003c/strong\u003e\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  在适合的情况下，可以使用 \u003ccode class=\"command\"\u003e\\crosstabview\u003c/code\u003e 命令将查询结果显示为交叉表：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT first, second, first \u0026gt; 2 AS gt2 FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview first second\u003c/code\u003e\u003c/strong\u003e\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n\n第二个示例展示了一个乘法表，其中行按数字倒序排列，而列按独立的升序数字排列。\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003erow_number() over(order by t2.first) AS ord\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview \"A\" \"B\" \"AxB\" ord\u003c/code\u003e\u003c/strong\u003e\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e","documentation_revision":{"inputs":[{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","version":"18.7"},{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"cb475c53a16d9e06358f5e6c9c5649645db92568cfd319f230c62c9f57ae090b","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"819e1b59b1a011bdaaff0c7cb9162348de1d0b34988a56179dc7ef1fee696a5a","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"environment":[{"description":"If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.","name":"COLUMNS"},{"description":"Default connection parameters (see Section 32.15 ).","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.","name":"PSQL_EDITOR EDITOR VISUAL"},{"description":"When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.","name":"PSQL_EDITOR_LINENUMBER_ARG"},{"description":"Alternative location for the command history file. Tilde ( ~ ) expansion is performed.","name":"PSQL_HISTORY"},{"description":"If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.","name":"PSQL_PAGER PAGER"},{"description":"When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .","name":"PSQL_WATCH_PAGER"},{"description":"Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.","name":"PSQLRC"},{"description":"Command executed by the \\! command.","name":"SHELL"},{"description":"Directory for storing temporary files. The default is /tmp .","name":"TMPDIR"}],"facts":[{"label":"Documented executable","value":"psql"},{"label":"Executable version","value":"18.7"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"35"}],"facts_zh":[{"label":"手册中的可执行程序","value":"psql"},{"label":"程序版本","value":"18.7"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"35"}],"localization":{"documentation_release":"18.7","language":"en","source_language":"en","source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552","status":"same-version-reviewed-manual"},"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PSQL\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e — \n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interactive terminal\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.21.4.1\"\u003e\u003ccode class=\"command\"\u003epsql\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n    [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is a terminal-based front-end to\n     \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e. It enables you to type in\n     queries interactively, issue them to\n     \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, and see the query results.\n     Alternatively, input can be from a file or from command line\n     arguments. In addition, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides a\n     number of meta-commands and various shell-like features to\n     facilitate writing scripts and automating a wide variety of tasks.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"R1-APP-PSQL-3\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ALL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-all\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print all nonempty input lines to standard output as they are read.\n      (This does not apply to lines read interactively.) This is\n      equivalent to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003eall\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-ALIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-A\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-align\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to unaligned output mode. (The default output mode is\n      \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e.)  This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset format unaligned\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-errors\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print failed SQL commands to standard error output. This is\n      equivalent to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--command=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is to execute the given\n       command string, \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n       This option can be repeated and combined in any order with\n       the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e option.  When either \u003ccode class=\"option\"\u003e-c\u003c/code\u003e\n       or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and \u003ccode class=\"option\"\u003e-f\u003c/code\u003e\n       options in sequence.\n      \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e must be either\n       a command string that is completely parsable by the server (i.e.,\n       it contains no \u003cspan class=\"application\"\u003epsql\u003c/span\u003e-specific features),\n       or a single backslash command. Thus you cannot mix\n       SQL and \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       meta-commands within a \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option. To achieve that,\n       you could use repeated \u003ccode class=\"option\"\u003e-c\u003c/code\u003e options or pipe the string\n       into \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epsql -c '\\x' -c 'SELECT * FROM foo;'\n\u003c/pre\u003e\u003cp\u003e\n       or\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eecho '\\x \\\\ SELECT * FROM foo;' | psql\n\u003c/pre\u003e\u003cp\u003e\n       (\u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e is the separator meta-command.)\n      \u003c/p\u003e\u003cp\u003e\n       Each SQL command string passed\n       to \u003ccode class=\"option\"\u003e-c\u003c/code\u003e is sent to the server as a single request.\n       Because of this, the server executes it as a single transaction even\n       if the string contains multiple SQL commands,\n       unless there are explicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e\n       commands included in the string to divide it into multiple\n       transactions.  (See \u003ca class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. Multiple Statements in a Simple Query\"\u003eSection 54.2.2.1\u003c/a\u003e\n       for more details about how the server handles multi-query strings.)\n      \u003c/p\u003e\u003cp\u003e\n       If having several commands executed in one transaction is not desired,\n       use repeated \u003ccode class=\"option\"\u003e-c\u003c/code\u003e commands or feed multiple commands to\n       \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's standard input,\n       either using \u003cspan class=\"application\"\u003eecho\u003c/span\u003e as illustrated above, or\n       via a shell here-document, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epsql \u0026lt;\u0026lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-CSV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--csv\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to CSV (Comma-Separated Values) output\n      mode.  This is equivalent to \u003ccode class=\"command\"\u003e\\pset format csv\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-queries\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Copy all SQL commands sent to the server to standard output as well.\n      This is equivalent\n      to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-hidden\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Echo the actual queries generated by \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e and other backslash\n      commands. You can use this to study \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n      internal operations. This is equivalent to\n      setting the variable \u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Read commands from the\n       file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e,\n       rather than standard input.\n       This option can be repeated and combined in any order with\n       the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option.  When either \u003ccode class=\"option\"\u003e-c\u003c/code\u003e\n       or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and \u003ccode class=\"option\"\u003e-f\u003c/code\u003e\n       options in sequence.\n       Except for that, this option is largely equivalent to the\n       meta-command \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n       If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n       (hyphen), then standard input is read until an EOF indication\n       or \u003ccode class=\"command\"\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n       interactive input with input from files.  Note however that Readline\n       is not used in this case (much as if \u003ccode class=\"option\"\u003e-n\u003c/code\u003e had been\n       specified).\n      \u003c/p\u003e\u003cp\u003e\n      Using this option is subtly different from writing \u003ccode class=\"literal\"\u003epsql\n      \u0026lt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. In general,\n      both will do what you expect, but using \u003ccode class=\"literal\"\u003e-f\u003c/code\u003e\n      enables some nice features such as error messages with line\n      numbers. There is also a slight chance that using this option will\n      reduce the start-up overhead. On the other hand, the variant using\n      the shell's input redirection is (in theory) guaranteed to yield\n      exactly the same output you would have received had you entered\n      everything by hand.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      field separator for unaligned output. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\f\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the host name of the machine on which the\n      server is running. If the value begins\n      with a slash, it is used as the directory for the Unix-domain\n      socket.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-H\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to HTML output mode.  This is\n      equivalent to \u003ccode class=\"command\"\u003e\\pset format html\u003c/code\u003e or the\n      \u003ccode class=\"command\"\u003e\\H\u003c/code\u003e command.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--list\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      List all available databases, then exit. Other non-connection\n      options are ignored. This is similar to the meta-command\n      \u003ccode class=\"command\"\u003e\\list\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n      When this option is used, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will connect\n      to the database \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, unless a different database\n      is named on the command line (option \u003ccode class=\"option\"\u003e-d\u003c/code\u003e or non-option\n      argument, possibly via a service entry, but not via an environment\n      variable).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LOG-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--log-file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Write all query output into file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e, in addition to the\n       normal output destination.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-READLINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Do not use \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e for line editing and\n       do not use the command history (see\n       \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"Command-Line Editing\"\u003ethe section called “Command-Line Editing”\u003c/a\u003e below).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-OUTPUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--output=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Put all query output into file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This is equivalent to\n      the command \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the TCP port or the local Unix-domain\n      socket file extension on which the server is listening for\n      connections. Defaults to the value of the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\n      environment variable or, if not set, to the port specified at\n      compile time, usually 5432.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pset=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies printing options, in the style of\n      \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e. Note that here you\n      have to separate name and value with an equal sign instead of a\n      space. For example, to set the output format to \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e, you could write\n      \u003ccode class=\"literal\"\u003e-P format=latex\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e should do its work\n      quietly. By default, it prints welcome messages and various\n      informational output. If this option is used, none of this\n      happens. This is useful with the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option.\n      This is equivalent to setting the variable \u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e\n      to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      record separator for unaligned output. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset recordsep\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-STEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-step\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Run in single-step mode. That means the user is prompted before\n      each command is sent to the server, with the option to cancel\n      execution as well. Use this to debug scripts.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-LINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-line\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Runs in single-line mode where a newline terminates an SQL command, as a\n      semicolon does.\n      \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n      This mode is provided for those who insist on it, but you are not\n      necessarily encouraged to use it. In particular, if you mix\n      SQL and meta-commands on a line the order of\n      execution might not always be clear to the inexperienced user.\n      \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tuples-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn off printing of column names and result row count footers,\n      etc. This is equivalent to \u003ccode class=\"command\"\u003e\\t\u003c/code\u003e or\n      \u003ccode class=\"command\"\u003e\\pset tuples_only\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TABLE-ATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table-attr=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies options to be placed within the\n      HTML \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag. See\n      \u003ccode class=\"command\"\u003e\\pset tableattr\u003c/code\u003e for details.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-USERNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Connect to the database as the user \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\n      (You must have permission to do so, of course.)\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VARIABLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--set=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--variable=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Perform a variable assignment, like the \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e\n      meta-command. Note that you must separate name and value, if\n      any, by an equal sign on the command line. To unset a variable,\n      leave off the equal sign. To set a variable with an empty value,\n      use the equal sign but leave off the value. These assignments are\n      done during command line processing, so variables that reflect\n      connection state will get overwritten later.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e version and exit.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Never issue a password prompt.  If the server requires password\n       authentication and a password is not available from other sources\n       such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection\n       attempt will fail.  This option can be useful in batch jobs and\n       scripts where no user is present to enter a password.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Force \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to prompt for a\n       password before connecting to a database, even if the password will\n       not be used.\n      \u003c/p\u003e\u003cp\u003e\n       If the server requires password authentication and a password is not\n       available from other sources such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e\n       file, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will prompt for a\n       password in any case.  However, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       will waste a connection attempt finding out that the server wants a\n       password.  In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid\n       the extra connection attempt.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--expanded\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn on the expanded table formatting mode. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Do not read the start-up file (neither the system-wide\n      \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e file nor the user's\n      \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e file).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the field separator for unaligned output to a zero byte.  This is\n      equivalent to \u003ccode class=\"command\"\u003e\\pset fieldsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-0\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the record separator for unaligned output to a zero byte.  This is\n      useful for interfacing, for example, with \u003ccode class=\"literal\"\u003exargs -0\u003c/code\u003e.\n      This is equivalent to \u003ccode class=\"command\"\u003e\\pset recordsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-transaction\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used in combination with one or more\n        \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and/or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e options.  It causes\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e command\n        before the first such option and a \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e command after\n        the last one, thereby wrapping all the commands into a single\n        transaction. If any of the commands fails and the variable\n        \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e was set, a\n        \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e command is sent instead. This ensures that\n        either all the commands complete successfully, or no changes are\n        applied.\n       \u003c/p\u003e\u003cp\u003e\n        If the commands themselves\n        contain \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e, \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e,\n        or \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e, this option will not have the desired\n        effects.  Also, if an individual command cannot be executed inside a\n        transaction block, specifying this option will cause the whole\n        transaction to fail.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Show help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e and exit. The optional\n      \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter (defaulting\n      to \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e) selects which part of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is\n      explained: \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e describes \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n      backslash commands; \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e describes the command-line\n      options that can be passed to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e;\n      and \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e shows help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configuration\n      variables.\n      \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.7\"\u003e\u003ch2\u003eExit Status\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e returns 0 to the shell if it\n   finished normally, 1 if a fatal error of its own occurs (e.g., out of memory,\n   file not found), 2 if the connection to the server went bad\n   and the session was not interactive, and 3 if an error occurred in a\n   script and the variable \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e was set.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.8\"\u003e\u003ch2\u003eUsage\u003c/h2\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\"\u003e\u003ch3\u003eConnecting to a Database\u003c/h3\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is a regular\n    \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e client application. In order\n    to connect to a database you need to know the name of your target\n    database, the host name and port number of the server, and what\n    database user name you want to connect as. \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    can be told about those parameters via command line options, namely\n    \u003ccode class=\"option\"\u003e-d\u003c/code\u003e, \u003ccode class=\"option\"\u003e-h\u003c/code\u003e, \u003ccode class=\"option\"\u003e-p\u003c/code\u003e, and\n    \u003ccode class=\"option\"\u003e-U\u003c/code\u003e respectively. If an argument is found that does\n    not belong to any option it will be interpreted as the database name\n    (or the database user name, if the database name is already given). Not all\n    of these options are required; there are useful defaults. If you omit the host\n    name, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will connect via a Unix-domain socket\n    to a server on the local host, or via TCP/IP to \u003ccode class=\"literal\"\u003elocalhost\u003c/code\u003e on\n    Windows. The default port number is\n    determined at compile time.\n    Since the database server uses the same default, you will not have\n    to specify the port in most cases. The default database user name is your\n    operating-system user name. Once the database user name is determined, it\n    is used as the default database name.\n    Note that you cannot\n    just connect to any database under any database user name. Your database\n    administrator should have informed you about your access rights.\n    \u003c/p\u003e\u003cp\u003e\n    When the defaults aren't quite right, you can save yourself\n    some typing by setting the environment variables\n    \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e, \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e,\n    \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e and/or \u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e to appropriate\n    values. (For additional environment variables, see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e.) It is also convenient to have a\n    \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file to avoid regularly having to type in\n    passwords. See \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e for more information.\n    \u003c/p\u003e\u003cp\u003e\n     An alternative way to specify connection parameters is in a\n     \u003cem class=\"parameter\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string or\n     a URI, which is used instead of a database\n     name. This mechanism give you very wide control over the\n     connection. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql \"service=myservice sslmode=require\"\u003c/code\u003e\u003c/strong\u003e\n$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql postgresql://dbmaster:5433/mydb?sslmode=require\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n     This way you can also use LDAP for connection\n     parameter lookup as described in \u003ca class=\"xref\" href=\"/docs/18/libpq-ldap.html\" title=\"32.18. LDAP Lookup of Connection Parameters\"\u003eSection 32.18\u003c/a\u003e.\n     See \u003ca class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2. Parameter Key Words\"\u003eSection 32.1.2\u003c/a\u003e for more information on all the\n     available connection options.\n    \u003c/p\u003e\u003cp\u003e\n    If the connection could not be made for any reason (e.g., insufficient\n    privileges, server is not running on the targeted host, etc.),\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will return an error and terminate.\n    \u003c/p\u003e\u003cp\u003e\n     If both standard input and standard output are a\n     terminal, then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e sets the client\n     encoding to \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eauto\u003c/span\u003e”\u003c/span\u003e, which will detect the\n     appropriate client encoding from the locale settings\n     (\u003ccode class=\"envar\"\u003eLC_CTYPE\u003c/code\u003e environment variable on Unix systems).\n     If this doesn't work out as expected, the client encoding can be\n     overridden using the environment\n     variable \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-4\"\u003e\u003ch3\u003eEntering SQL Commands\u003c/h3\u003e\u003cp\u003e\n    In normal operation, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides a\n    prompt with the name of the database to which\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is currently connected, followed by\n    the string \u003ccode class=\"literal\"\u003e=\u0026gt;\u003c/code\u003e. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql testdb\u003c/code\u003e\u003c/strong\u003e\npsql (18.7)\nType \"help\" for help.\n\ntestdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    At the prompt, the user can type in SQL commands.\n    Ordinarily, input lines are sent to the server when a\n    command-terminating semicolon is reached. An end of line does not\n    terminate a command.  Thus commands can be spread over several lines for\n    clarity. If the command was sent and executed without error, the results\n    of the command are displayed on the screen.\n    \u003c/p\u003e\u003cp\u003e\n    If untrusted users have access to a database that has not adopted a\n    \u003ca class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6. Usage Patterns\"\u003esecure schema usage pattern\u003c/a\u003e,\n    begin your session by removing publicly-writable schemas\n    from \u003ccode class=\"varname\"\u003esearch_path\u003c/code\u003e.  One can\n    add \u003ccode class=\"literal\"\u003eoptions=-csearch_path=\u003c/code\u003e to the connection string or\n    issue \u003ccode class=\"literal\"\u003eSELECT pg_catalog.set_config('search_path', '',\n    false)\u003c/code\u003e before other SQL commands.  This consideration is not\n    specific to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e; it applies to every interface\n    for executing arbitrary SQL commands.\n    \u003c/p\u003e\u003cp\u003e\n    Whenever a command is executed, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e also polls\n    for asynchronous notification events generated by\n    \u003ca class=\"link\" href=\"/docs/18/sql-listen.html\" title=\"LISTEN\"\u003e\u003ccode class=\"command\"\u003eLISTEN\u003c/code\u003e\u003c/a\u003e and\n    \u003ca class=\"link\" href=\"/docs/18/sql-notify.html\" title=\"NOTIFY\"\u003e\u003ccode class=\"command\"\u003eNOTIFY\u003c/code\u003e\u003c/a\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    While C-style block comments are passed to the server for\n    processing and removal, SQL-standard comments are removed by\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\"\u003e\u003ch3\u003eMeta-Commands\u003c/h3\u003e\u003cp\u003e\n    Anything you enter in \u003cspan class=\"application\"\u003epsql\u003c/span\u003e that begins\n    with an unquoted backslash is a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    meta-command that is processed by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    itself. These commands make\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e more useful for administration or\n    scripting. Meta-commands are often called slash or backslash commands.\n    \u003c/p\u003e\u003cp\u003e\n    The format of a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e command is the backslash,\n    followed immediately by a command verb, then any arguments. The arguments\n    are separated from the command verb and each other by any number of\n    whitespace characters.\n    \u003c/p\u003e\u003cp\u003e\n    To include whitespace in an argument you can quote it with\n    single quotes. To include a single quote in an argument,\n    write two single quotes within single-quoted text.\n    Anything contained in single quotes is\n    furthermore subject to C-like substitutions for\n    \u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e (new line), \u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e (tab),\n    \u003ccode class=\"literal\"\u003e\\b\u003c/code\u003e (backspace), \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e (carriage return),\n    \u003ccode class=\"literal\"\u003e\\f\u003c/code\u003e (form feed),\n    \u003ccode class=\"literal\"\u003e\\\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (octal), and\n    \u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (hexadecimal).\n    A backslash preceding any other character within single-quoted text\n    quotes that single character, whatever it is.\n    \u003c/p\u003e\u003cp\u003e\n    If an unquoted colon (\u003ccode class=\"literal\"\u003e:\u003c/code\u003e) followed by a\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable name appears within an argument, it is\n    replaced by the variable's value, as described in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\"\u003eSQL Interpolation\u003c/a\u003e below.\n    The forms \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e and\n    \u003ccode class=\"literal\"\u003e:\"\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\"\u003c/code\u003e described there\n    work as well.\n    The \u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e syntax allows\n    testing whether a variable is defined. It is substituted by\n    TRUE or FALSE.\n    Escaping the colon with a backslash protects it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    Within an argument, text that is enclosed in backquotes\n    (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) is taken as a command line that is passed to the\n    shell.  The output of the command (with any trailing newline removed)\n    replaces the backquoted text.  Within the text enclosed in backquotes,\n    no special quoting or other processing occurs, except that appearances\n    of \u003ccode class=\"literal\"\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e where\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e is a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable name\n    are replaced by the variable's value.  Also, appearances of\n    \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e are replaced by the\n    variable's value suitably quoted to become a single shell command\n    argument.  (The latter form is almost always preferable, unless you are\n    very sure of what is in the variable.)  Because carriage return and line\n    feed characters cannot be safely quoted on all platforms, the\n    \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e form prints an\n    error message and does not substitute the variable value when such\n    characters appear in the value.\n    \u003c/p\u003e\u003cp\u003e\n    Some commands take an SQL identifier (such as a\n    table name) as argument. These arguments follow the syntax rules\n    of SQL: Unquoted letters are forced to\n    lowercase, while double quotes (\u003ccode class=\"literal\"\u003e\"\u003c/code\u003e) protect letters\n    from case conversion and allow incorporation of whitespace into\n    the identifier.  Within double quotes, paired double quotes reduce\n    to a single double quote in the resulting name.  For example,\n    \u003ccode class=\"literal\"\u003eFOO\"BAR\"BAZ\u003c/code\u003e is interpreted as \u003ccode class=\"literal\"\u003efooBARbaz\u003c/code\u003e,\n    and \u003ccode class=\"literal\"\u003e\"A weird\"\" name\"\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003eA weird\"\n    name\u003c/code\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    Parsing for arguments stops at the end of the line, or when another\n    unquoted backslash is found.  An unquoted backslash\n    is taken as the beginning of a new meta-command. The special\n    sequence \u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e (two backslashes) marks the end of\n    arguments and continues parsing SQL commands, if\n    any. That way SQL and\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e commands can be freely mixed on a\n    line. But in any case, the arguments of a meta-command cannot\n    continue beyond the end of the line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands act on the \u003cem class=\"firstterm\"\u003ecurrent query buffer\u003c/em\u003e.\n    This is simply a buffer holding whatever SQL command text has been typed\n    but not yet sent to the server for execution.  This will include previous\n    input lines as well as any text appearing before the meta-command on the\n    same line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands also allow \u003ccode class=\"literal\"\u003ex\u003c/code\u003e to be appended\n    as an option. This will cause the results to be displayed in expanded\n    mode, as if \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e\n    had been used.\n    \u003c/p\u003e\u003cp\u003e\n    The following meta-commands are defined:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-A\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\a\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If the current table output format is unaligned, it is switched to aligned.\n        If it is not unaligned, it is set to unaligned. This command is\n        kept for backwards compatibility. See \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e for a\n        more general solution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sets query parameters for the next query execution, with the\n         specified parameters passed for any parameter placeholders\n         (\u003ccode class=\"literal\"\u003e$1\u003c/code\u003e etc.).\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eINSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This also works for query-execution commands besides\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, such as \u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e and\n         \u003ccode class=\"literal\"\u003e\\gset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see \u003ca class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. Extended Query Overview\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol.  So this command can be useful to test the extended\n         query protocol from \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  (The extended\n         query protocol is used even if the query has no parameters and this\n         command specifies zero parameters.)  This command affects only the\n         next query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e is equivalent to \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e,\n         except that it takes the name of an existing prepared statement as\n         first parameter. An empty string denotes the unnamed prepared\n         statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eINSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see\n         \u003ca class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. Extended Query Overview\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol. So this command can be useful to test the extended\n         query protocol from \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\c\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\connect [ -reuse-previous=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eon|off\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e ] | \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Establishes a new connection to a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        server.  The connection parameters to use can be specified either\n        using a positional syntax (one or more of database name, user,\n        host, and port), or using a \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        connection string as detailed in\n        \u003ca class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003eSection 32.1.1\u003c/a\u003e.  If no arguments are given, a\n        new connection is made using the same parameters as before.\n        \u003c/p\u003e\u003cp\u003e\n        Specifying any\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e or\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\n        as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e is equivalent to omitting that parameter.\n        \u003c/p\u003e\u003cp\u003e\n        The new connection can re-use connection parameters from the previous\n        connection; not only database name, user, host, and port, but other\n        settings such as \u003cem class=\"replaceable\"\u003e\u003ccode\u003esslmode\u003c/code\u003e\u003c/em\u003e.  By default,\n        parameters are re-used in the positional syntax, but not when\n        a \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string is given.  Passing a\n        first argument of \u003ccode class=\"literal\"\u003e-reuse-previous=on\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e-reuse-previous=off\u003c/code\u003e overrides that default.  If\n        parameters are re-used, then any parameter not explicitly specified as\n        a positional parameter or in the \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        string is taken from the existing connection's parameters.  An\n        exception is that if the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e setting\n        is changed from its previous value using the positional syntax,\n        any \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostaddr\u003c/code\u003e\u003c/em\u003e setting present in the\n        existing connection's parameters is dropped.\n        Also, any password used for the existing connection will be re-used\n        only if the user, host, and port settings are not changed.\n        When the command neither specifies nor reuses a particular parameter,\n        the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e default is used.\n        \u003c/p\u003e\u003cp\u003e\n        If the new connection is successfully made, the previous\n        connection is closed.\n        If the connection attempt fails (wrong user name, access\n        denied, etc.), the previous connection will be kept if\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is in interactive mode.  But when\n        executing a non-interactive script, the old connection is closed\n        and an error is reported.  That may or may not terminate the\n        script; if it does not, all database-accessing commands will fail\n        until another \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e command is successfully\n        executed.  This distinction was chosen as\n        a user convenience against typos on the one hand, and a safety\n        mechanism that scripts are not accidentally acting on the\n        wrong database on the other hand.\n        Note that whenever a \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e command attempts\n        to re-use parameters, the values re-used are those of the last\n        successful connection, not of any failed attempts made subsequently.\n        However, in the case of a\n        non-interactive \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e failure, no parameters\n        are allowed to be re-used later, since the script would likely be\n        expecting the values from the failed \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e\n        to be re-used.\n        \u003c/p\u003e\u003cp\u003e\n        Examples:\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \\c mydb myuser host.dom 6432\n=\u0026gt; \\c service=foo\n=\u0026gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=\u0026gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=\u0026gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\C [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the title of any tables being printed as the result of a\n        query or unset any such title. This command is equivalent to\n        \u003ccode class=\"literal\"\u003e\\pset title \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. (The name of\n        this command derives from \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecaption\u003c/span\u003e”\u003c/span\u003e, as it was\n        previously only used to set the caption in an\n        HTML table.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\cd [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Changes the current working directory to\n         \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e. Without argument, changes\n         to the current user's home directory.  For details on how home\n         directories are found, see \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n          To print your current working directory, use \u003ccode class=\"literal\"\u003e\\! pwd\u003c/code\u003e.\n         \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprepared_statement_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Closes the specified prepared statement. An empty string denotes the\n         unnamed prepared statement. If no prepared statement exists with this\n         name, the operation is a no-op.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eSELECT $1 \\parse stmt1\n\\close_prepared stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used,\n         unlike normal \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which\n         uses the simple query protocol. So this command can be useful\n         to test the extended query protocol from\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CONNINFO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\conninfo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Outputs information about the current database connection,\n          including SSL-related information if SSL is in use.\n         \u003c/p\u003e\u003cp\u003e\n          Note that the \u003ccode class=\"structfield\"\u003eClient User\u003c/code\u003e field shows\n          the user at the time of connection, while the\n          \u003ccode class=\"structfield\"\u003eSuperuser\u003c/code\u003e field indicates whether\n          the current user (in the current execution context) has\n          superuser privileges. These users are usually the same, but they can\n          differ, for example, if the current user was changed with the\n          \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e command.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-COPY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] }\n        \u003ccode class=\"literal\"\u003efrom\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdin | pstdin }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\n        [ where \u003cem class=\"replaceable\"\u003e\u003ccode\u003econdition\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] | ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003equery\u003c/code\u003e\u003c/em\u003e ) }\n        \u003ccode class=\"literal\"\u003eto\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdout | pstdout }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs a frontend (client) copy. This is an operation that\n        runs an SQL \u003ca class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command, but instead of the server\n        reading or writing the specified file,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e reads or writes the file and\n        routes the data between the server and the local file system.\n        This means that file accessibility and privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        When \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e is specified,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        executed by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e and the data passed from\n        or to \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        routed between the server and the client.\n        Again, the execution privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        For \u003ccode class=\"literal\"\u003e\\copy ... from stdin\u003c/code\u003e, data rows are read from the same\n        source that issued the command, continuing until a line containing\n        only \u003ccode class=\"literal\"\u003e\\.\u003c/code\u003e\n        is read or the stream reaches EOF. This option is useful\n        for populating tables in-line within an SQL script file.\n        For \u003ccode class=\"literal\"\u003e\\copy ... to stdout\u003c/code\u003e, output is sent to the same place\n        as \u003cspan class=\"application\"\u003epsql\u003c/span\u003e command output, and\n        the \u003ccode class=\"literal\"\u003eCOPY \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e command status is\n        not printed (since it might be confused with a data row).\n        To read/write \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's standard input or\n        output regardless of the current command source or \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e\n        option, write \u003ccode class=\"literal\"\u003efrom pstdin\u003c/code\u003e or \u003ccode class=\"literal\"\u003eto pstdout\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The syntax of this command is similar to that of the\n        SQL \u003ca class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command.  All options other than the data source/destination are\n        as specified for \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e.\n        Because of this, special parsing rules apply to the \u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e\n        meta-command.  Unlike most other meta-commands, the entire remainder\n        of the line is always taken to be the arguments of \u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e,\n        and neither variable interpolation nor backquote expansion are\n        performed in the arguments.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Another way to obtain the same result as \u003ccode class=\"literal\"\u003e\\copy\n        ... to\u003c/code\u003e is to use the SQL \u003ccode class=\"literal\"\u003eCOPY\n        ... TO STDOUT\u003c/code\u003e command and terminate it\n        with \u003ccode class=\"literal\"\u003e\\g \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e\\g |\u003cem class=\"replaceable\"\u003e\u003ccode\u003eprogram\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        Unlike \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e, this method allows the command to\n        span multiple lines; also, variable interpolation and backquote\n        expansion can be used.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        These operations are not as efficient as the SQL\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e command with a file or program data source or\n        destination, because all data must pass through the client/server\n        connection.  For large amounts of data the SQL\n        command might be preferable.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copyright\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the copyright and distribution terms of\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\crosstabview [\n            \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode class=\"literal\"\u003ex\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode class=\"literal\"\u003ey\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ex\u003c/code\u003e and the value\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-D\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\d[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        For each relation (table, view, materialized view, index, sequence,\n        or foreign table)\n        or composite type matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, show all\n        columns, their types, the tablespace (if not the default) and any\n        special attributes such as \u003ccode class=\"literal\"\u003eNOT NULL\u003c/code\u003e or defaults.\n        Associated indexes, constraints, rules, and triggers are\n        also shown.  For foreign tables, the associated foreign\n        server is shown as well.\n        (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eMatching the pattern\u003c/span\u003e”\u003c/span\u003e is defined in\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e below.)\n        \u003c/p\u003e\u003cp\u003e\n        For some types of relation, \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e shows additional information\n        for each column: column values for sequences, indexed expressions for\n        indexes, and foreign data wrapper options for foreign tables.\n        \u003c/p\u003e\u003cp\u003e\n        The command form \u003ccode class=\"literal\"\u003e\\d+\u003c/code\u003e is identical, except that\n        more information is displayed: any comments associated with the\n        columns of the table are shown, as is the presence of OIDs in the\n        table, the view definition if the relation is a view, a non-default\n        \u003ca class=\"link\" href=\"/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\"\u003ereplica\n         identity\u003c/a\u003e setting and the\n        \u003ca class=\"link\" href=\"/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\"\u003eaccess method\u003c/a\u003e name\n        if the relation has an access method.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e is used without a\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e argument, it is\n        equivalent to \u003ccode class=\"command\"\u003e\\dtvmsE\u003c/code\u003e which will show a list of\n        all visible tables, views, materialized views, sequences and\n        foreign tables.\n        This is purely a convenience measure.\n        \u003c/p\u003e\u003cp\u003e\n        As with many other commands, if \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to\n        the command name, the results are displayed in expanded mode for this\n        command only, but note that this only applies when \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e\n        is used without a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        argument or to describe a sequence.\n        The same limitation on expanded output applies to\n        \u003ccode class=\"command\"\u003e\\x on\u003c/code\u003e and \u003ccode class=\"command\"\u003e\\x auto\u003c/code\u003e.\n        The \u003ccode class=\"literal\"\u003ex\u003c/code\u003e modifier cannot appear immediately after the\n        \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e (because \u003ccode class=\"command\"\u003e\\dx\u003c/code\u003e is a different\n        command); the \u003ccode class=\"literal\"\u003ex\u003c/code\u003e modifier may only appear after an\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e or \u003ccode class=\"literal\"\u003e+\u003c/code\u003e modifier. For example,\n        \u003ccode class=\"command\"\u003e\\d+x\u003c/code\u003e is equivalent to \u003ccode class=\"command\"\u003e\\dtvmsE+x\u003c/code\u003e\n        and will show a list of all relations in expanded mode.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\da[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists aggregate functions, together with their\n        return type and the data types they operate on. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only aggregates whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dA[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists access methods. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only access\n        methods whose names match the pattern are shown.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each access\n        method is listed with its associated handler function and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAC\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAc[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator classes\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1. Index Methods and Operator Classes\"\u003eSection 36.16.1\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        class is listed with its associated operator family and owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAF\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAf[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5. Operator Classes and Operator Families\"\u003eSection 36.16.5\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        family is listed with its owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAO\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAo[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators associated with operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2. Index Method Strategies\"\u003eSection 36.16.2\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families associated with access\n        methods whose names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families whose names match that\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        is listed with its sort operator family (if it is an ordering operator),\n        and whether its underlying function is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAP\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAp[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists support functions associated with operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3. Index Method Support Routines\"\u003eSection 36.16.3\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families associated with\n        access methods whose names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families whose names match\n        that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, functions are\n        displayed verbosely, with their actual parameter lists.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DB\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\db[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tablespaces. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only tablespaces whose names match the pattern are shown.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each tablespace\n        is listed with its associated options, on-disk size, permissions and\n        description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dc[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists conversions between character-set encodings.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only conversions whose names match the pattern are\n        listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DCONFIG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dconfig[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists server configuration parameters and their values.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only parameters whose names match the pattern are listed.  Without\n        a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, only\n        parameters that are set to non-default values are listed.\n        (Use \u003ccode class=\"literal\"\u003e\\dconfig *\u003c/code\u003e to see all parameters.)\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each\n        parameter is listed with its data type, context in which the\n        parameter can be set, and access privileges (if non-default access\n        privileges have been granted).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dC[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists type casts.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only casts whose source or target types match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional\n        information about each cast is shown, including whether its underlying\n        function is leakproof, and the cast's description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dd[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the descriptions of objects of type \u003ccode class=\"literal\"\u003econstraint\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eoperator class\u003c/code\u003e, \u003ccode class=\"literal\"\u003eoperator family\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003erule\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etrigger\u003c/code\u003e. All\n        other comments may be viewed by the respective backslash commands for\n        those object types.\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003e\\dd\u003c/code\u003e displays descriptions for objects matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or of visible\n        objects of the appropriate type if no argument is given.  But in either\n        case, only objects that have a description are listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        Descriptions for objects can be created with the \u003ca class=\"link\" href=\"/docs/18/sql-comment.html\" title=\"COMMENT\"\u003e\u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e\u003c/a\u003e\nSQL command.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dD[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists domains. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only domains whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DDP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ddp[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists default access privilege settings.  An entry is shown for\n        each role (and schema, if applicable) for which the default\n        privilege settings have been changed from the built-in defaults.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose role name or schema name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"\u003e\u003ccode class=\"command\"\u003eALTER DEFAULT\n        PRIVILEGES\u003c/code\u003e\u003c/a\u003e command is used to set default access\n        privileges.  The meaning of the privilege display is explained in\n        \u003ca class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8. Privileges\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dE[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\di[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dm[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ds[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dt[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dv[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In this group of commands, the letters \u003ccode class=\"literal\"\u003eE\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003ei\u003c/code\u003e, \u003ccode class=\"literal\"\u003em\u003c/code\u003e, \u003ccode class=\"literal\"\u003es\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003et\u003c/code\u003e, and \u003ccode class=\"literal\"\u003ev\u003c/code\u003e\n        stand for foreign table, index, materialized view,\n        sequence, table, and view,\n        respectively.\n        You can specify any or all of\n        these letters, in any order, to obtain a listing of objects\n        of these types.  For example, \u003ccode class=\"literal\"\u003e\\dti\u003c/code\u003e lists\n        tables and indexes.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is\n        appended to the command name, each object is listed with its\n        persistence status (permanent, temporary, or unlogged),\n        physical size on disk, and associated description if any.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only objects whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\des[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign servers (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        servers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those servers whose name matches the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a\n        full description of each server is shown, including the\n        server's access privileges, type, version, options, and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\det[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign tables (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal tables\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose table name or schema name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        generic options and the foreign table description\n        are also displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\deu[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists user mappings (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        users\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those mappings whose user names match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each mapping is shown.\n        \u003c/p\u003e\u003cdiv class=\"caution\"\u003e\u003ch3 class=\"title\"\u003eCaution\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\deu+\u003c/code\u003e might also display the user name and\n        password of the remote user, so care should be taken not to\n        disclose them.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dew[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign-data wrappers (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        wrappers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those foreign-data wrappers whose name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        the access privileges, options, and description of the\n        foreign-data wrapper are also shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\df[anptwSx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ... ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists functions, together with their result data types, argument data\n        types, and function types, which are classified as \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eagg\u003c/span\u003e”\u003c/span\u003e\n        (aggregate), \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enormal\u003c/span\u003e”\u003c/span\u003e, \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eprocedure\u003c/span\u003e”\u003c/span\u003e, \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003etrigger\u003c/span\u003e”\u003c/span\u003e, or \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ewindow\u003c/span\u003e”\u003c/span\u003e.\n        To display only functions\n        of specific type(s), add the corresponding letters \u003ccode class=\"literal\"\u003ea\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003en\u003c/code\u003e, \u003ccode class=\"literal\"\u003ep\u003c/code\u003e, \u003ccode class=\"literal\"\u003et\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ew\u003c/code\u003e to the command.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only\n        functions whose names match the pattern are shown.\n        Any additional arguments are type-name patterns, which are matched\n        to the type names of the first, second, and so on arguments of the\n        function.  (Matching functions can have more arguments than what\n        you specify.  To prevent that, write a dash \u003ccode class=\"literal\"\u003e-\u003c/code\u003e as\n        the last \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e.)\n        By default, only user-created\n        objects are shown; supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e\n        modifier to include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        about each function is shown, including volatility,\n        parallel safety, owner, security classification, whether it is\n        leakproof, access privileges, language, internal name (for C and\n        internal functions only), and description.\n        Source code for a specific function can be seen\n        using \u003ccode class=\"literal\"\u003e\\sf\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dF[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search configurations.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only configurations whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each configuration is shown, including the underlying text search\n         parser and the dictionary list for each parser token type.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFd[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search dictionaries.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only dictionaries whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each selected dictionary, including the underlying\n         text search template and the option values.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFp[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search parsers.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only parsers whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each parser is shown, including the underlying functions and the\n         list of recognized token types.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFt[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search templates.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only templates whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each template, including the underlying function names.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dg[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode class=\"literal\"\u003e\\du\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dl[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This is an alias for \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e, which shows a\n        list of large objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dL[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists procedural languages. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only languages whose names match the pattern are listed.\n        By default, only user-created languages\n        are shown; supply the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each\n        language is listed with its call handler, validator, access privileges,\n        and whether it is a system object.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dn[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists schemas (namespaces). If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only schemas whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description, if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\do[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators with their operand and result types.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only operators whose names match the pattern are listed.\n        If one \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only prefix operators whose right argument's type name\n        matches that pattern are listed.\n        If two \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003es\n        are specified, only binary operators whose argument type names match\n        those patterns are listed.  (Alternatively, write \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n        for the unused argument of a unary operator.)\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each operator is shown, including\n        the name of the underlying function, and whether it is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dO[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists collations.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only collations whose names match the pattern are\n        listed.  By default, only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to\n        include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended\n        to the command name, each collation is listed with its associated\n        description, if any.\n        Note that only collations usable with the current database's encoding\n        are shown, so the results may vary in different databases of the\n        same installation.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dp[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e and\n        \u003ca class=\"link\" href=\"/docs/18/sql-revoke.html\" title=\"REVOKE\"\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e\u003c/a\u003e\n        commands are used to set access privileges.  The meaning of the\n        privilege display is explained in\n        \u003ca class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8. Privileges\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dP[itnx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists partitioned relations.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only entries whose name matches the pattern are listed.\n        The modifiers \u003ccode class=\"literal\"\u003et\u003c/code\u003e (tables) and \u003ccode class=\"literal\"\u003ei\u003c/code\u003e\n        (indexes) can be appended to the command, filtering the kind of\n        relations to list.  By default, partitioned tables and indexes are\n        listed.\n        \u003c/p\u003e\u003cp\u003e\n        If the modifier \u003ccode class=\"literal\"\u003en\u003c/code\u003e (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enested\u003c/span\u003e”\u003c/span\u003e) is used,\n        or a pattern is specified, then non-root partitioned relations are\n        included, and a column is shown displaying the parent of each\n        partitioned relation.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, the sum of the\n        sizes of each relation's partitions is also displayed, along with the\n        relation's description.\n        If \u003ccode class=\"literal\"\u003en\u003c/code\u003e is combined with \u003ccode class=\"literal\"\u003e+\u003c/code\u003e, two\n        sizes are shown: one including the total size of directly-attached\n        leaf partitions, and another showing the total size of all partitions,\n        including indirectly attached sub-partitions.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRDS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drds[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists defined configuration settings.  These settings can be\n        role-specific, database-specific, or both.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e and\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e are used to select\n        specific roles and databases to list, respectively.  If omitted, or if\n        \u003ccode class=\"literal\"\u003e*\u003c/code\u003e is specified, all settings are listed, including those\n        not role-specific or database-specific, respectively.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"\u003e\u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e\u003c/a\u003e and\n        \u003ca class=\"link\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003ccode class=\"command\"\u003eALTER DATABASE\u003c/code\u003e\u003c/a\u003e\n        commands are used to define per-role and per-database configuration\n        settings.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drg[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists information about each granted role membership, including\n        assigned options (\u003ccode class=\"literal\"\u003eADMIN\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eINHERIT\u003c/code\u003e and/or \u003ccode class=\"literal\"\u003eSET\u003c/code\u003e) and grantor.\n        See the \u003ca class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e\n        command for information about role memberships.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only grants to user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only grants to those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRp[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication publications.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those publications whose names match the pattern are\n        listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, the tables and\n        schemas associated with each publication are shown as well.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRs[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication subscriptions.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those subscriptions whose names match the pattern are\n        listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional\n        properties of the subscriptions are shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dT[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists data types.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only types whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each type is\n        listed with its internal name and size, its allowed values\n        if it is an \u003ccode class=\"type\"\u003eenum\u003c/code\u003e type, and its associated permissions.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\du[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode class=\"literal\"\u003e\\dg\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dx[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists installed extensions.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extensions whose names match the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, all the objects belonging\n        to each matching extension are listed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dX[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists extended statistics.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extended statistics whose names match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The status of each kind of extended statistics is shown in a column\n        named after its statistic kind (e.g. Ndistinct).\n        \u003ccode class=\"literal\"\u003edefined\u003c/code\u003e means that it was requested when creating\n        the statistics, and NULL means it wasn't requested.\n        You can use \u003ccode class=\"structname\"\u003epg_stats_ext\u003c/code\u003e if you'd like to\n        know whether \u003ca class=\"link\" href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e\n        was run and statistics are available to the planner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dy[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists event triggers.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those event triggers whose names match the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\e\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e \u003ccode class=\"literal\"\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file's\n        content is copied into the current query buffer. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\echo \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prints the evaluated arguments to standard output, separated by\n        spaces and followed by a newline. This can be useful to\n        intersperse information in the output of scripts. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo `date`\u003c/code\u003e\u003c/strong\u003e\nTue Oct 26 21:40:57 CEST 1999\n\u003c/pre\u003e\u003cp\u003e\n        If the first argument is an unquoted \u003ccode class=\"literal\"\u003e-n\u003c/code\u003e the trailing\n        newline is not written (nor is the first argument).\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        If you use the \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e command to redirect your\n        query output you might wish to use \u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e\n        instead of this command.  See also \u003ccode class=\"command\"\u003e\\warn\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ef [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named function or procedure,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it, or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If no function is specified, a blank \u003ccode class=\"command\"\u003eCREATE FUNCTION\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the function body.\n        (Note that the function body typically does not begin on the first\n        line of the file.)\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\encoding [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the client character set encoding.  Without an argument, this command\n        shows the current encoding.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\errverbose\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeats the most recent server error message at maximum\n        verbosity, as though \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e were set\n        to \u003ccode class=\"literal\"\u003everbose\u003c/code\u003e and \u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e were\n        set to \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ev [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named view,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it, or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         If no view is specified, a blank \u003ccode class=\"command\"\u003eCREATE VIEW\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n         If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n         position the cursor on the specified line of the view definition.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-F\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\f [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the field separator for unaligned query output. The default\n        is the vertical bar (\u003ccode class=\"literal\"\u003e|\u003c/code\u003e). It is equivalent to\n        \u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-G\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sends the current query buffer to the server for execution.\n        \u003c/p\u003e\u003cp\u003e\n        If parentheses appear after \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, they surround a\n        space-separated list\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        formatting-option clauses, which are interpreted in the same way\n        as \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e commands, but take\n        effect only for the duration of this query.  In this list, spaces are\n        not allowed around \u003ccode class=\"literal\"\u003e=\u003c/code\u003e signs, but are required\n        between option clauses.\n        If \u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        is omitted, the\n        named \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e is changed\n        in the same way as for\n        \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        with no explicit \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        If a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\n        or \u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        argument is given, the query's output is written to the named\n        file or piped to the given shell command, instead of displaying it as\n        usual.  The file or command is written to only if the query\n        successfully returns zero or more tuples, not if the query fails or\n        is a non-data-returning SQL command.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query is\n        re-executed instead.  Except for that behavior, \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e\n        without any arguments is essentially equivalent to a semicolon.\n        With arguments, \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e provides\n        a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eone-shot\u003c/span\u003e”\u003c/span\u003e alternative to the \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e\n        command, and additionally allows one-shot adjustments of the\n        output formatting options normally set by \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        When the last argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, the entire\n        remainder of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GDESC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Shows the description (that is, the column names and data types)\n         of the result of the current query buffer.  The query is not\n         actually executed; however, if it contains some type of syntax\n         error, that error will be reported in the normal way.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is described instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Gets the value of the environment\n         variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\n         and assigns it to the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e is\n         not defined in the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e process's\n         environment, \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e\n         is not changed.  Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\getenv home HOME\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :home\u003c/code\u003e\u003c/strong\u003e\n/home/postgres\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GEXEC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gexec\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server, then treats\n         each column of each row of the query's output (if any) as an SQL\n         statement to be executed.  For example, to create an index on each\n         column of \u003ccode class=\"structname\"\u003emy_table\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT format('create index on my_table(%I)', attname)\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM pg_attribute\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eWHERE attrelid = 'my_table'::regclass AND attnum \u0026gt; 0\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eORDER BY attnum\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gexec\u003c/code\u003e\u003c/strong\u003e\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         The generated queries are executed in the order in which the rows\n         are returned, and left-to-right within each row if there is more\n         than one column.  NULL fields are ignored.  The generated queries\n         are sent literally to the server for processing, so they cannot be\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-commands nor contain \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         variable references.  If any individual query fails, execution of\n         the remaining queries continues\n         unless \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e is set.  Execution of each\n         query is subject to \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e processing.\n         (Setting \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to \u003ccode class=\"literal\"\u003eall\u003c/code\u003e\n         or \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e is often advisable when\n         using \u003ccode class=\"command\"\u003e\\gexec\u003c/code\u003e.)  Query logging, single-step mode,\n         timing, and other query execution features apply to each generated\n         query as well.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server and stores the\n         query's output into \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variables\n         (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below).\n         The query to be executed must return exactly one row.  Each column of\n         the row is stored into a separate variable, named the same as the\n         column.  For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :var1 :var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If you specify a \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e,\n         that string is prepended to the query's column names to create the\n         variable names to use:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset result_\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :result_var1 :result_var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If a column result is NULL, the corresponding variable is unset\n         rather than being set.\n        \u003c/p\u003e\u003cp\u003e\n         If the query fails or does not return one row,\n         no variables are changed.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GX\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e is equivalent to \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, except\n        that it forces expanded output mode for this query, as\n        if \u003ccode class=\"literal\"\u003eexpanded=on\u003c/code\u003e were included in the list of\n        \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e options.  See also \u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\h\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\help\u003c/code\u003e \u003ccode class=\"literal\"\u003e[ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Gives syntax help on the specified SQL\n        command. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        is not specified, then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will list\n        all the commands for which syntax help is available. If\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is an\n        asterisk (\u003ccode class=\"literal\"\u003e*\u003c/code\u003e), then syntax help on all\n        SQL commands is shown.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\help\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        To simplify typing, commands that consists of several words do\n        not have to be quoted. Thus it is fine to type \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\help\n        alter table\u003c/code\u003e\u003c/strong\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\H\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Turns on HTML query output format. If the\n        HTML format is already on, it is switched\n        back to the default aligned text format. This command is for\n        compatibility and convenience, but see \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e\n        about setting other output options.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\include\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads input from the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e and executes it as\n        though it had been typed on the keyboard.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n        (hyphen), then standard input is read until an EOF indication\n        or \u003ccode class=\"command\"\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n        interactive input with input from files.  Note that Readline behavior\n        will be used only if it is active at the outermost level.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If you want to see the lines on the screen as they are read you\n        must set the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n        \u003ccode class=\"literal\"\u003eall\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"PSQL-METACOMMAND-IF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\if\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\elif\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\else\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endif\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements nestable conditional blocks.\n        A conditional block must begin with an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e and end\n        with an \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e.  In between there may be any number\n        of \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e clauses, which may optionally be followed\n        by a single \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e clause.  Ordinary queries and\n        other types of backslash commands may (and usually do) appear between\n        the commands forming a conditional block.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e and \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e commands read\n        their argument(s) and evaluate them as a Boolean expression.  If the\n        expression yields \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e then processing continues\n        normally; otherwise, lines are skipped until a\n        matching \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e,\n        or \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e is reached.  Once\n        an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e test has\n        succeeded, the arguments of later \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e commands in\n        the same block are not evaluated but are treated as false.  Lines\n        following an \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e are processed only if no earlier\n        matching \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e succeeded.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e argument\n        of an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e command\n        is subject to variable interpolation and backquote expansion, just\n        like any other backslash command argument.  After that it is evaluated\n        like the value of an on/off option variable.  So a valid value\n        is any unambiguous case-insensitive match for one of:\n        \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e, \u003ccode class=\"literal\"\u003e1\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eyes\u003c/code\u003e, \u003ccode class=\"literal\"\u003eno\u003c/code\u003e.  For example,\n        \u003ccode class=\"literal\"\u003et\u003c/code\u003e, \u003ccode class=\"literal\"\u003eT\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etR\u003c/code\u003e\n        will all be considered to be \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Expressions that do not properly evaluate to true or false will\n        generate a warning and be treated as false.\n        \u003c/p\u003e\u003cp\u003e\n        Lines being skipped are parsed normally to identify queries and\n        backslash commands, but queries are not sent to the server, and\n        backslash commands other than conditionals\n        (\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e,\n        \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e) are\n        ignored.  Conditional commands are checked only for valid nesting.\n        Variable references in skipped lines are not expanded, and backquote\n        expansion is not performed either.\n        \u003c/p\u003e\u003cp\u003e\n        All the backslash commands of a given conditional block must appear in\n        the same source file. If EOF is reached on the main input file or an\n        \u003ccode class=\"command\"\u003e\\include\u003c/code\u003e-ed file before all local\n        \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e-blocks have been closed,\n        then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will raise an error.\n        \u003c/p\u003e\u003cp\u003e\n         Here is an example:\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\include_relative\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The \u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e command is similar to \u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e, but resolves\n        relative file names differently.  When executing in interactive mode,\n        the two commands behave identically.  However, when invoked from a\n        script, \u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e interprets file names relative to the\n        directory in which the script is located, rather than the current\n        working directory.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\l[x+]\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\list[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        List the databases in the server and show their names, owners,\n        character set encodings, and access privileges.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only databases whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, database\n        sizes, default tablespaces, and descriptions are also displayed.\n        Size information is available for databases on which the current user has\n        \u003ccode class=\"literal\"\u003eCONNECT\u003c/code\u003e privilege, or if the current user is a superuser\n        or has privileges of the \u003ccode class=\"literal\"\u003epg_read_all_stats\u003c/code\u003e role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_export \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads the large object with OID \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the database and\n        writes it to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Note that this is\n        subtly different from the server function\n        \u003ccode class=\"function\"\u003elo_export\u003c/code\u003e, which acts with the permissions\n        of the user that the database server runs as and on the server's\n        file system.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e to find out the large object's\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_import \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecomment\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Stores the file into a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        large object. Optionally, it associates the given\n        comment with the object. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003efoo=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'\u003c/code\u003e\u003c/strong\u003e\nlo_import 152801\n\u003c/pre\u003e\u003cp\u003e\n        The response indicates that the large object received object\n        ID 152801, which can be used to access the newly-created large\n        object in the future. For the sake of readability, it is\n        recommended to always associate a human-readable comment with\n        every object. Both OIDs and comments can be viewed with the\n        \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\n        Note that this command is subtly different from the server-side\n        \u003ccode class=\"function\"\u003elo_import\u003c/code\u003e because it acts as the local user\n        on the local file system, rather than the server's user and file\n        system.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_list[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows a list of all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        large objects currently stored in the database,\n        along with any comments provided for them.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_unlink \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Deletes the large object with OID\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the\n        database.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e to find out the large object's\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-OUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\out [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\out [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Arranges to save future query results to the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipe future results\n        to the shell command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e. If no argument is\n        specified, the query output is reset to the standard output.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eQuery results\u003c/span\u003e”\u003c/span\u003e includes all tables, command\n        responses, and notices obtained from the database server, as\n        well as output of various backslash commands that query the\n        database (such as \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e); but not error\n        messages.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        To intersperse text output in between query results, use\n        \u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PRINT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\p\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\print\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print the current query buffer to the standard output.\n        If the current query buffer is empty, the most recently executed query\n        is printed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PARSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\parse \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Creates a prepared statement from the current query buffer, based on\n         the name of a destination prepared-statement object. An empty string\n         denotes the unnamed prepared statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eSELECT $1 \\parse stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used, unlike\n         normal \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the\n         simple query protocol. A\n         \u003ca class=\"xref\" href=\"/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\"\u003eParse (F)\u003c/a\u003e\n         message will be issued by this command so it can be useful to\n         test the extended query protocol from\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. This command affects only the next\n         query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\password [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Changes the password of the specified user (by default, the current\n        user).  This command prompts for the new password, encrypts it, and\n        sends it to the server as an \u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e command.  This\n        makes sure that the new password does not appear in cleartext in the\n        command history, the server log, or elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\prompt [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts the user to supply text, which is assigned to the variable\n         \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n         An optional prompt string, \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e, can be specified.  (For multiword\n         prompts, surround the text with single quotes.)\n        \u003c/p\u003e\u003cp\u003e\n         By default, \u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e uses the terminal for input and\n         output.  However, if the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e command line switch was\n         used, \u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e uses standard input and standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\pset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command sets options affecting the output of query result tables.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        indicates which option is to be set. The semantics of\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e vary depending\n        on the selected option.  For some options, omitting \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e causes the option to be toggled\n        or unset, as described under the particular option.  If no such\n        behavior is mentioned, then omitting\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e just results in\n        the current setting being displayed.\n        \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e without any arguments displays the current status\n        of all printing options.\n        \u003c/p\u003e\u003cp\u003e\n        Adjustable printing options are:\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eborder\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e must be a\n          number. In general, the higher\n          the number the more borders and lines the tables will have,\n          but details depend on the particular format.\n          In HTML format, this will translate directly\n          into the \u003ccode class=\"literal\"\u003eborder=...\u003c/code\u003e attribute.\n          In most other formats only values 0 (no border), 1 (internal\n          dividing lines), and 2 (table frame) make sense, and values above 2\n          will be treated the same as \u003ccode class=\"literal\"\u003eborder = 2\u003c/code\u003e.\n          The \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e and \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e\n          formats additionally allow a value of 3 to add dividing lines\n          between data rows.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the target width for the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format, and also\n          the width limit for determining whether output is wide enough to\n          require the pager or switch to the vertical display in expanded auto\n          mode.\n          Zero (the default) causes the target width to be controlled by the\n          environment variable \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e, or the detected screen width\n          if \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e is not set.\n          In addition, if \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e is zero then the\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format only affects screen output.\n          If \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e is nonzero then file and pipe output is\n          wrapped to that width as well.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecsv_fieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in\n          CSV output format.  If the separator character\n          appears in a field's value, that field is output within double\n          quotes, following standard CSV rules.\n          The default is a comma.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eexpanded\u003c/code\u003e (or \u003ccode class=\"literal\"\u003ex\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified it\n          must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, which\n          will enable or disable expanded mode, or \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between the on and off settings.  When expanded mode\n          is enabled, query results are displayed in two columns, with the\n          column name on the left and the data on the right. This mode is\n          useful if the data wouldn't fit on the screen in the\n          normal \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ehorizontal\u003c/span\u003e”\u003c/span\u003e mode.  In the auto setting, the\n          expanded mode is used whenever the query output has more than one\n          column and is wider than the screen; otherwise, the regular mode is\n          used.  The auto setting is only\n          effective in the aligned and wrapped formats.  In other formats, it\n          always behaves as if the expanded mode is off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in unaligned output\n          format. That way one can create, for example, tab-separated\n          output, which other programs might prefer. To\n          set a tab as field separator, type \u003ccode class=\"literal\"\u003e\\pset fieldsep\n          '\\t'\u003c/code\u003e. The default field separator is\n          \u003ccode class=\"literal\"\u003e'|'\u003c/code\u003e (a vertical bar).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the field separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efooter\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable display of the table footer\n          (the \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e rows)\u003c/code\u003e count).\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles footer display on or off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eformat\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the output format to one of \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e, \u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e.\n          Unique abbreviations are allowed.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e format is the standard,\n          human-readable, nicely formatted text output; this is the default.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e format writes all columns of a row on one\n          line, separated by the currently active field separator. This\n          is useful for creating output that might be intended to be read\n          in by other programs, for example, tab-separated or comma-separated\n          format.  However, the field separator character is not treated\n          specially if it appears in a column's value;\n          so CSV format may be better suited for such\n          purposes.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e format\n          \n          writes column values separated by commas, applying the quoting\n          rules described in\n          \u003ca class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\"\u003eRFC 4180\u003c/a\u003e.\n          This output is compatible with the CSV format of the server's\n          \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e command.\n          A header line with column names is generated unless\n          the \u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e parameter is\n          \u003ccode class=\"literal\"\u003eon\u003c/code\u003e. Titles and footers are not printed.\n          Each row is terminated by the system-dependent end-of-line character,\n          which is typically a single newline (\u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e) for\n          Unix-like systems or a carriage return and newline sequence\n          (\u003ccode class=\"literal\"\u003e\\r\\n\u003c/code\u003e) for Microsoft Windows.\n          Field separator characters other than comma can be selected with\n          \u003ccode class=\"command\"\u003e\\pset csv_fieldsep\u003c/code\u003e.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format is like \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e but wraps\n          wide data values across lines to make the output fit in the target\n          column width.  The target width is determined as described under\n          the \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e option.  Note that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n          not attempt to wrap column header titles; therefore,\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format behaves the same as \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e\n          if the total width needed for column headers exceeds the target.\n          \u003c/p\u003e\u003cp\u003e\n          The \u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e, \u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e, \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e, and\n          \u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e formats put out tables that are intended\n          to be included in documents using the respective mark-up\n          language. They are not complete documents! This might not be\n          necessary in HTML, but in\n          \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e you must have a complete\n          document wrapper.\n          The \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e format\n          uses \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e's \u003ccode class=\"literal\"\u003etabular\u003c/code\u003e\n          environment.\n          The \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e format\n          requires the \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e\n\u003ccode class=\"literal\"\u003elongtable\u003c/code\u003e and \u003ccode class=\"literal\"\u003ebooktabs\u003c/code\u003e packages.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border line drawing style to one\n          of \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e, \u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e,\n          or \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e.\n          Unique abbreviations are allowed.  (That would mean one\n          letter is enough.)\n          The default setting is \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e.\n          This option only affects the \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e and\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e output formats.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eascii\u003c/code\u003e style uses plain ASCII\n          characters.  Newlines in data are shown using\n          a \u003ccode class=\"literal\"\u003e+\u003c/code\u003e symbol in the right-hand margin.\n          When the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format wraps data from\n          one line to the next without a newline character, a dot\n          (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is shown in the right-hand margin of the first line,\n          and again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e style uses plain ASCII\n          characters, using the formatting style used\n          in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4 and earlier.\n          Newlines in data are shown using a \u003ccode class=\"literal\"\u003e:\u003c/code\u003e\n          symbol in place of the left-hand column separator.\n          When the data is wrapped from one line\n          to the next without a newline character, a \u003ccode class=\"literal\"\u003e;\u003c/code\u003e\n          symbol is used in place of the left-hand column separator.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e style uses Unicode box-drawing characters.\n          Newlines in data are shown using a carriage return symbol\n          in the right-hand margin.  When the data is wrapped from one line\n          to the next without a newline character, an ellipsis symbol\n          is shown in the right-hand margin of the first line, and\n          again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\n          When the \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e setting is greater than zero,\n          the \u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e option also determines the\n          characters with which the border lines are drawn.\n          Plain ASCII characters work everywhere, but\n          Unicode characters look nicer on displays that recognize them.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enull\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the string to be printed in place of a null value.\n          The default is to print nothing, which can easily be mistaken for\n          an empty string. For example, one might prefer \u003ccode class=\"literal\"\u003e\\pset null\n          '(null)'\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enumericlocale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable display of a locale-specific character\n          to separate groups of digits to the left of the decimal marker.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and locale-specific numeric output.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Controls use of a pager program for query and \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n          help output.\n          When the \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option is \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, the pager\n          program is not used. When the \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option is\n          \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, the pager is used when appropriate, i.e., when the\n          output is to a terminal and will not fit on the screen.\n          The \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option can also be set to \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e,\n          which causes the pager to be used for all terminal output regardless\n          of whether it fits on the screen.  \u003ccode class=\"literal\"\u003e\\pset pager\u003c/code\u003e\n          without a \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n          toggles pager use on and off.\n          \u003c/p\u003e\u003cp\u003e\n          If the environment variable \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\n          or \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e is set, output to be paged is piped to the\n          specified program.  Otherwise a platform-dependent default program\n          (such as \u003ccode class=\"filename\"\u003emore\u003c/code\u003e) is used.\n          \u003c/p\u003e\u003cp\u003e\n          When using the \u003ccode class=\"literal\"\u003e\\watch\u003c/code\u003e command to execute a query\n          repeatedly, the environment variable \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\n          is used to find the pager program instead, on Unix systems.  This is\n          configured separately because it may confuse traditional pagers, but\n          can be used to send output to tools that understand\n          \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's output format (such as\n          \u003ccode class=\"filename\"\u003epspg --stream\u003c/code\u003e).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e is set to a number greater than the\n          page height, the pager program will not be called unless there are\n          at least this many lines of output to show. The default setting\n          is 0.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the record (line) separator to use in unaligned\n          output format. The default is a newline character.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the record separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etableattr\u003c/code\u003e (or \u003ccode class=\"literal\"\u003eT\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          In HTML format, this specifies attributes\n          to be placed inside the \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag.  This\n          could for example be \u003ccode class=\"literal\"\u003ecellpadding\u003c/code\u003e or\n          \u003ccode class=\"literal\"\u003ebgcolor\u003c/code\u003e. Note that you probably don't want\n          to specify \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e here, as that is already\n          taken care of by \u003ccode class=\"literal\"\u003e\\pset border\u003c/code\u003e.\n          If no\n          \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the table attributes are unset.\n          \u003c/p\u003e\u003cp\u003e\n          In \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e format, this controls\n          the proportional width of each column containing a left-aligned\n          data type.  It is specified as a whitespace-separated list of values,\n          e.g., \u003ccode class=\"literal\"\u003e'0.2 0.2 0.6'\u003c/code\u003e.  Unspecified output columns\n          use the last specified value.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etitle\u003c/code\u003e (or \u003ccode class=\"literal\"\u003eC\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the table title for any subsequently printed tables. This\n          can be used to give your output descriptive tags. If no\n          \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the title is unset.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e (or \u003ccode class=\"literal\"\u003et\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable tuples-only mode.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and tuples-only output.\n          Regular output includes extra information such\n          as column headers, titles, and various footers. In tuples-only\n          mode, only actual table data is shown.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_border_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_column_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the column drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_header_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the header drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003exheader_width\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n           Sets the maximum width of the header for expanded output to one of\n           \u003ccode class=\"literal\"\u003efull\u003c/code\u003e (the default value),\n           \u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e, \u003ccode class=\"literal\"\u003epage\u003c/code\u003e, or an\n           \u003cem class=\"replaceable\"\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003efull\u003c/code\u003e: the expanded header is not truncated,\n           and will be as wide as the widest output line.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e: truncate the header line to the\n           width of the first column.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003epage\u003c/code\u003e: truncate the header line to the terminal\n           width.\n          \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e: specify\n           the exact maximum width of the header line.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Illustrations of how these different formats look can be seen in\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        There are various shortcut commands for \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e. See\n        \u003ccode class=\"command\"\u003e\\a\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\C\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\f\u003c/code\u003e,\n        \u003ccode class=\"command\"\u003e\\H\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\t\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\T\u003c/code\u003e,\n        and \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\q\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\quit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Quits the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e program.\n        In a script file, only execution of that script is terminated.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\qecho \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e except\n        that the output will be written to the query output channel, as\n        set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\reset\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Resets (clears) the query buffer.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\restrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enter \"restricted\" mode with the provided key.  In this mode, the only\n        allowed meta-command is \u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e, to exit\n        restricted mode.  The key may contain only alphanumeric characters.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\s [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's command line history\n        to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is omitted,\n        the history is written to the standard output (using the pager if\n        appropriate).  This command is not available\n        if \u003cspan class=\"application\"\u003epsql\u003c/span\u003e was built\n        without \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e support.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\set [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [ ... ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if more than one value\n        is given, to the concatenation of all of them. If only one\n        argument is given, the variable is set to an empty-string value. To\n        unset a variable, use the \u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without any arguments displays the names and values\n        of all currently-set \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variables.\n        \u003c/p\u003e\u003cp\u003e\n        Valid variable names can contain letters, digits, and\n        underscores. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below for details.\n        Variable names are case-sensitive.\n        \u003c/p\u003e\u003cp\u003e\n        Certain variables are special, in that they\n        control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior or are\n        automatically set to reflect connection state.  These variables are\n        documented in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This command is unrelated to the SQL\n        command \u003ca class=\"link\" href=\"/docs/18/sql-set.html\" title=\"SET\"\u003e\u003ccode class=\"command\"\u003eSET\u003c/code\u003e\u003c/a\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\setenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sf[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and shows the definition of the named function or procedure,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         The definition is printed to the current query output channel,\n         as set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, then the\n         output lines are numbered, with the first line of the function body\n         being line 1.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\sf\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sv[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          This command fetches and shows the definition of the named view,\n          in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n          The definition is printed to the current query output channel,\n          as set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n         \u003c/p\u003e\u003cp\u003e\n          If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, then the\n          output lines are numbered from 1.\n         \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\sv\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PIPELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\startpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\syncpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flushrequest\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flush\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getresults [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements pipelining of SQL statements.\n        A pipeline must begin with a \u003ccode class=\"command\"\u003e\\startpipeline\u003c/code\u003e\n        and end with an \u003ccode class=\"command\"\u003e\\endpipeline\u003c/code\u003e. In between there\n        may be any number of \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e commands,\n        which sends a \u003ca class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3. Extended Query\"\u003esync message\u003c/a\u003e\n        without ending the ongoing pipeline and flushing the send buffer.\n        In pipeline mode, statements are sent to the server without waiting\n        for the results of previous statements.\n        See \u003ca class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5. Pipeline Mode\"\u003eSection 32.5\u003c/a\u003e for more details.\n       \u003c/p\u003e\u003cp\u003e\n        All queries executed while a pipeline is ongoing use the extended\n        query protocol. Queries are appended to the pipeline when ending with\n        a semicolon. The meta-commands \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003e\\parse\u003c/code\u003e can be used in an ongoing pipeline. While\n        a pipeline is ongoing, \u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e will append\n        the current query buffer to the pipeline. Other meta-commands like\n        \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e are not allowed in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e appends a flush command to the\n        pipeline, allowing to read results with\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e without issuing a sync or ending the\n        pipeline. \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e will automatically push\n        unsent data to the server. \u003ccode class=\"command\"\u003e\\flush\u003c/code\u003e can be used to\n        manually push unsent data.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e accepts an optional\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e parameter.\n        If provided, only the first\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e pending\n        results will be read. If not provided or \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, all\n        pending results are read.\n       \u003c/p\u003e\u003cp\u003e\n        When pipeline mode is active, a dedicated prompt variable is available\n        to report the pipeline status.\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/a\u003e for more details\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e is not supported while in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n        Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Toggles the display of output column name headings and row count\n        footer. This command is equivalent to \u003ccode class=\"literal\"\u003e\\pset\n        tuples_only\u003c/code\u003e and is provided for convenience.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies attributes to be placed within the\n        \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag in HTML\n        output format. This command is equivalent to \u003ccode class=\"literal\"\u003e\\pset\n        tableattr \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-TIMING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\timing [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         With a parameter, turns displaying of how long each SQL statement\n         takes on or off.  Without a parameter, toggles the display between\n         on and off.  The display is in milliseconds; intervals longer than\n         1 second are also shown in minutes:seconds format, with hours and\n         days fields added if needed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unrestrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Exit \"restricted\" mode (i.e., where all other meta-commands are\n        blocked), provided the specified key matches the one given to\n        \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e when restricted mode was entered.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument of \u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e, and\n        neither variable interpolation nor backquote expansion are performed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unset \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Unsets (deletes) the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Most variables that control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior\n        cannot be unset; instead, an \u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e command is interpreted\n        as setting them to their default values.\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WRITE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Writes the current query buffer to the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipes it to the shell\n        command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        If the current query buffer is empty, the most recently executed query\n        is written instead.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WARN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\warn \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e except\n        that the output will be written to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n        standard error channel, rather than standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WATCH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\watch [ i[nterval]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ] [ c[ount]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimes\u003c/code\u003e\u003c/em\u003e ] [ m[in_rows]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erows\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeatedly execute the current query buffer (as \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e does)\n        until interrupted, or the query fails, or the execution count limit\n        (if given) is reached, or the query no longer returns the minimum number\n        of rows. Wait the specified number of seconds (default 2) between executions.\n        The default wait can be changed with the variable\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/a\u003e.\n        For backwards compatibility,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e can be specified\n        with or without an \u003ccode class=\"literal\"\u003einterval=\u003c/code\u003e prefix.\n        Each query result is\n        displayed with a header that includes the \u003ccode class=\"literal\"\u003e\\pset title\u003c/code\u003e\n        string (if any), the time as of query start, and the delay interval.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query\n        is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\x [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eauto\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets or toggles expanded table formatting mode. As such it is equivalent to\n        \u003ccode class=\"literal\"\u003e\\pset expanded\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-Z\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\z[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        This is an alias for \u003ccode class=\"command\"\u003e\\dp\u003c/code\u003e (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edisplay\n        privileges\u003c/span\u003e”\u003c/span\u003e).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\! [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        With no argument, escapes to a sub-shell; \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n        resumes when the sub-shell exits.  With an argument, executes the\n        shell command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\!\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.  The rest of the line is simply passed literally to the\n        shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\? [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows help information. The optional\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter\n        (defaulting to \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e) selects which part of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is\n        explained: \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e describes \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n        backslash commands; \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e describes the command-line\n        options that can be passed to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e;\n        and \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e shows help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configuration\n        variables.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Backslash-semicolon is not a meta-command in the same way as the\n        preceding commands; rather, it simply causes a semicolon to be\n        added to the query buffer without any further processing.\n        \u003c/p\u003e\u003cp\u003e\n        Normally, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will dispatch an SQL command to the\n        server as soon as it reaches the command-ending semicolon, even if\n        more input remains on the current line.  Thus for example entering\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eselect 1; select 2; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        will result in the three SQL commands being individually sent to\n        the server, with each one's results being displayed before\n        continuing to the next command.  However, a semicolon entered\n        as \u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e will not trigger command processing, so that the\n        command before it and the one after are effectively combined and\n        sent to the server in one request.  So for example\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eselect 1\\; select 2\\; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        results in sending the three SQL commands to the server in a single\n        request, when the non-backslashed semicolon is reached.\n        The server executes such a request as a single transaction,\n        unless there are explicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e\n        commands included in the string to divide it into multiple\n        transactions.  (See \u003ca class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. Multiple Statements in a Simple Query\"\u003eSection 54.2.2.1\u003c/a\u003e\n        for more details about how the server handles multi-query strings.)\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PATTERNS\"\u003e\u003ch4\u003ePatterns\u003c/h4\u003e\u003cp\u003e\n   The various \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands accept a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter to specify the\n   object name(s) to be displayed.  In the simplest case, a pattern\n   is just the exact name of the object.  The characters within a\n   pattern are normally folded to lower case, just as in SQL names;\n   for example, \u003ccode class=\"literal\"\u003e\\dt FOO\u003c/code\u003e will display the table named\n   \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  As in SQL names, placing double quotes around\n   a pattern stops folding to lower case.  Should you need to include\n   an actual double quote character in a pattern, write it as a pair\n   of double quotes within a double-quote sequence; again this is in\n   accord with the rules for SQL quoted identifiers.  For example,\n   \u003ccode class=\"literal\"\u003e\\dt \"FOO\"\"BAR\"\u003c/code\u003e will display the table named\n   \u003ccode class=\"literal\"\u003eFOO\"BAR\u003c/code\u003e (not \u003ccode class=\"literal\"\u003efoo\"bar\u003c/code\u003e).  Unlike the normal\n   rules for SQL names, you can put double quotes around just part\n   of a pattern, for instance \u003ccode class=\"literal\"\u003e\\dt FOO\"FOO\"BAR\u003c/code\u003e will display\n   the table named \u003ccode class=\"literal\"\u003efooFOObar\u003c/code\u003e.\n  \u003c/p\u003e\u003cp\u003e\n   Whenever the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter\n   is omitted completely, the \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands display all objects\n   that are visible in the current schema search path — this is\n   equivalent to using \u003ccode class=\"literal\"\u003e*\u003c/code\u003e as the pattern.\n   (An object is said to be \u003cem class=\"firstterm\"\u003evisible\u003c/em\u003e if its\n   containing schema is in the search path and no object of the same\n   kind and name appears earlier in the search path. This is equivalent to the\n   statement that the object can be referenced by name without explicit\n   schema qualification.)\n   To see all objects in the database regardless of visibility,\n   use \u003ccode class=\"literal\"\u003e*.*\u003c/code\u003e as the pattern.\n  \u003c/p\u003e\u003cp\u003e\n   Within a pattern, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e matches any sequence of characters\n   (including no characters) and \u003ccode class=\"literal\"\u003e?\u003c/code\u003e matches any single character.\n   (This notation is comparable to Unix shell file name patterns.)\n   For example, \u003ccode class=\"literal\"\u003e\\dt int*\u003c/code\u003e displays tables whose names\n   begin with \u003ccode class=\"literal\"\u003eint\u003c/code\u003e.  But within double quotes, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e\n   and \u003ccode class=\"literal\"\u003e?\u003c/code\u003e lose these special meanings and are just matched\n   literally.\n  \u003c/p\u003e\u003cp\u003e\n   A relation pattern that contains a dot (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is interpreted as a schema\n   name pattern followed by an object name pattern.  For example,\n   \u003ccode class=\"literal\"\u003e\\dt foo*.*bar*\u003c/code\u003e displays all tables whose table name\n   includes \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e that are in schemas whose schema name\n   starts with \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  When no dot appears, then the pattern\n   matches only objects that are visible in the current schema search path.\n   Again, a dot within double quotes loses its special meaning and is matched\n   literally.  A relation pattern that contains two dots (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e)\n   is interpreted as a database name followed by a schema name pattern followed\n   by an object name pattern.  The database name portion will not be treated as\n   a pattern and must match the name of the currently connected database, else\n   an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   A schema pattern that contains a dot (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is interpreted\n   as a database name followed by a schema name pattern.  For example,\n   \u003ccode class=\"literal\"\u003e\\dn mydb.*foo*\u003c/code\u003e displays all schemas whose schema name\n   includes \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  The database name portion will not be\n   treated as a pattern and must match the name of the currently connected\n   database, else an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   Advanced users can use regular-expression notations such as character\n   classes, for example \u003ccode class=\"literal\"\u003e[0-9]\u003c/code\u003e to match any digit.  All regular\n   expression special characters work as specified in\n   \u003ca class=\"xref\" href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e, except for \u003ccode class=\"literal\"\u003e.\u003c/code\u003e which\n   is taken as a separator as mentioned above, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e which is\n   translated to the regular-expression notation \u003ccode class=\"literal\"\u003e.*\u003c/code\u003e,\n   \u003ccode class=\"literal\"\u003e?\u003c/code\u003e which is translated to \u003ccode class=\"literal\"\u003e.\u003c/code\u003e, and\n   \u003ccode class=\"literal\"\u003e$\u003c/code\u003e which is matched literally.  You can emulate\n   these pattern characters at need by writing\n   \u003ccode class=\"literal\"\u003e?\u003c/code\u003e for \u003ccode class=\"literal\"\u003e.\u003c/code\u003e,\n   \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e+|)\u003c/code\u003e for\n   \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e*\u003c/code\u003e, or\n   \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e|)\u003c/code\u003e for\n   \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e?\u003c/code\u003e.\n   \u003ccode class=\"literal\"\u003e$\u003c/code\u003e is not needed as a regular-expression character since\n   the pattern must match the whole name, unlike the usual\n   interpretation of regular expressions (in other words, \u003ccode class=\"literal\"\u003e$\u003c/code\u003e\n   is automatically appended to your pattern).  Write \u003ccode class=\"literal\"\u003e*\u003c/code\u003e at the\n   beginning and/or end if you don't wish the pattern to be anchored.\n   Note that within double quotes, all regular expression special characters\n   lose their special meanings and are matched literally.  Also, the regular\n   expression special characters are matched literally in operator name\n   patterns (i.e., the argument of \u003ccode class=\"literal\"\u003e\\do\u003c/code\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"id-1.9.4.21.8.5\"\u003e\u003ch3\u003eAdvanced Features\u003c/h3\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-VARIABLES\"\u003e\u003ch4\u003eVariables\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides variable substitution\n    features similar to common Unix command shells.\n    Variables are simply name/value pairs, where the value\n    can be any string of any length.  The name must consist of letters\n    (including non-Latin letters), digits, and underscores.\n    \u003c/p\u003e\u003cp\u003e\n    To set a variable, use the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-command\n    \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e.  For example,\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo bar\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    sets the variable \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e to the value\n    \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e. To retrieve the content of the variable, precede\n    the name with a colon, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :foo\u003c/code\u003e\u003c/strong\u003e\nbar\n\u003c/pre\u003e\u003cp\u003e\n    This works in both regular SQL commands and meta-commands; there is\n    more detail in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\"\u003eSQL Interpolation\u003c/a\u003e, below.\n    \u003c/p\u003e\u003cp\u003e\n    If you call \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without a second argument, the\n    variable is set to an empty-string value. To unset (i.e., delete)\n    a variable, use the command \u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e.  To show the\n    values of all variables, call \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without any argument.\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n    The arguments of \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e are subject to the same\n    substitution rules as with other commands. Thus you can construct\n    interesting references such as \u003ccode class=\"literal\"\u003e\\set :foo\n    'something'\u003c/code\u003e and get \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003esoft links\u003c/span\u003e”\u003c/span\u003e or\n    \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003evariable variables\u003c/span\u003e”\u003c/span\u003e of \u003cspan class=\"productname\"\u003ePerl\u003c/span\u003e\n    or \u003cspan class=\"productname\"\u003ePHP\u003c/span\u003e fame,\n    respectively. Unfortunately (or fortunately?), there is no way to do\n    anything useful with these constructs. On the other hand,\n    \u003ccode class=\"literal\"\u003e\\set bar :foo\u003c/code\u003e is a perfectly valid way to copy a\n    variable.\n    \u003c/p\u003e\u003c/div\u003e\u003cp\u003e\n    A number of these variables are treated specially\n    by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. They represent certain option\n    settings that can be changed at run time by altering the value of\n    the variable, or in some cases represent changeable state of\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n    By convention, all specially treated variables' names\n    consist of all upper-case ASCII letters (and possibly digits and\n    underscores). To ensure maximum compatibility in the future, avoid\n    using such variable names for your own purposes.\n   \u003c/p\u003e\u003cp\u003e\n    Variables that control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior\n    generally cannot be unset or set to invalid values.  An \u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e\n    command is allowed but is interpreted as setting the variable to its\n    default value.  A \u003ccode class=\"literal\"\u003e\\set\u003c/code\u003e command without a second argument is\n    interpreted as setting the variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, for control\n    variables that accept that value, and is rejected for others.  Also,\n    control variables that accept the values \u003ccode class=\"literal\"\u003eon\u003c/code\u003e\n    and \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e will also accept other common spellings of Boolean\n    values, such as \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e and \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e.\n   \u003c/p\u003e\u003cp\u003e\n    The specially treated variables are:\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eAUTOCOMMIT\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When \u003ccode class=\"literal\"\u003eon\u003c/code\u003e (the default), each SQL command is automatically\n        committed upon successful completion.  To postpone commit in this\n        mode, you must enter a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e or \u003ccode class=\"command\"\u003eSTART\n        TRANSACTION\u003c/code\u003e SQL command.  When \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e or unset, SQL\n        commands are not committed until you explicitly issue\n        \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e or \u003ccode class=\"command\"\u003eEND\u003c/code\u003e.  The autocommit-off\n        mode works by issuing an implicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e for you, just\n        before any command that is not already in a transaction block and\n        is not itself a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e or other transaction-control\n        command, nor a command that cannot be executed inside a transaction\n        block (such as \u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e).\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         In autocommit-off mode, you must explicitly abandon any failed\n         transaction by entering \u003ccode class=\"command\"\u003eABORT\u003c/code\u003e or \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e.\n         Also keep in mind that if you exit the session\n         without committing, your work will be lost.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         The autocommit-on mode is \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e's traditional\n         behavior, but autocommit-off is closer to the SQL spec.  If you\n         prefer autocommit-off, you might wish to set it in the system-wide\n         \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e file or your\n         \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e file.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eCOMP_KEYWORD_CASE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Determines which letter case to use when completing an SQL key word.\n        If set to \u003ccode class=\"literal\"\u003elower\u003c/code\u003e or \u003ccode class=\"literal\"\u003eupper\u003c/code\u003e, the\n        completed word will be in lower or upper case, respectively.  If set\n        to \u003ccode class=\"literal\"\u003epreserve-lower\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003epreserve-upper\u003c/code\u003e (the default), the completed word\n        will be in the case of the word already entered, but words being\n        completed without anything entered will be in lower or upper case,\n        respectively.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eDBNAME\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The name of the database you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If set to \u003ccode class=\"literal\"\u003eall\u003c/code\u003e, all nonempty input lines are printed\n        to standard output as they are read.  (This does not apply to lines\n        read interactively.)  To select this behavior on program\n        start-up, use the switch \u003ccode class=\"option\"\u003e-a\u003c/code\u003e. If set to\n        \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e prints each query to standard output\n        as it is sent to the server. The switch to select this behavior is\n        \u003ccode class=\"option\"\u003e-e\u003c/code\u003e. If set to \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e, then only\n        failed queries are displayed on standard error output. The switch\n        for this behavior is \u003ccode class=\"option\"\u003e-b\u003c/code\u003e. If set to\n        \u003ccode class=\"literal\"\u003enone\u003c/code\u003e (the default), then no queries are displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e and a backslash command\n        queries the database, the query is first shown.\n        This feature helps you to study\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e internals and provide\n        similar functionality in your own programs. (To select this behavior\n        on program start-up, use the switch \u003ccode class=\"option\"\u003e-E\u003c/code\u003e.)  If you set\n        this variable to the value \u003ccode class=\"literal\"\u003enoexec\u003c/code\u003e, the queries are\n        just shown but are not actually sent to the server and executed.\n        The default value is \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eENCODING\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The current client character set encoding.\n        This is set every time you connect to a database (including\n        program start-up), and when you change the encoding\n        with \u003ccode class=\"literal\"\u003e\\encoding\u003c/code\u003e, but it can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etrue\u003c/code\u003e if the last SQL query failed, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e if\n         it succeeded.  See also \u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If this variable is set to an integer value greater than zero,\n        the results of \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e queries are fetched\n        and displayed in groups of that many rows, rather than the\n        default behavior of collecting the entire result set before\n        display.  Therefore only a\n        limited amount of memory is used, regardless of the size of\n        the result set.  Settings of 100 to 1000 are commonly used\n        when enabling this feature.\n        Keep in mind that when using this feature, a query might\n        fail after having already displayed some rows.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Although you can use any output format with this feature,\n        the default \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e format tends to look bad\n        because each group of \u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e rows\n        will be formatted separately, leading to varying column\n        widths across the row groups.  The other output formats work better.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TABLEAM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, a table's access\n         method details are not displayed. This is mainly useful for\n         regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TOAST_COMPRESSION\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, column\n         compression method details are not displayed. This is mainly\n         useful for regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTCONTROL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003eignorespace\u003c/code\u003e,\n         lines which begin with a space are not entered into the history\n         list. If set to a value of \u003ccode class=\"literal\"\u003eignoredups\u003c/code\u003e, lines\n         matching the previous history line are not entered. A value of\n         \u003ccode class=\"literal\"\u003eignoreboth\u003c/code\u003e combines the two options. If\n         set to \u003ccode class=\"literal\"\u003enone\u003c/code\u003e (the default), all lines\n         read in interactive mode are saved on the history list.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTFILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The file name that will be used to store the history list.  If unset,\n        the file name is taken from the \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e\n        environment variable.  If that is not set either, the default\n        is \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e,\n        or \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n        For example, putting:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\\set HISTFILE ~/.psql_history-:DBNAME\n\u003c/pre\u003e\u003cp\u003e\n        in \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e will cause\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to maintain a separate history for\n        each database.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTSIZE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTSIZE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The maximum number of commands to store in the command history\n        (default 500).  If set to a negative value, no limit is applied.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHOST\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server host you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eIGNOREEOF\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If set to 1 or less, sending an EOF character (usually\n         \u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e)\n         to an interactive session of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         will terminate the application.  If set to a larger numeric value,\n         that many consecutive EOF characters must be typed to\n         make an interactive session terminate.  If the variable is set to a\n         non-numeric value, it is interpreted as 10.  The default is 0.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LASTOID\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLASTOID\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the last affected OID, as returned from an\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\lo_import\u003c/code\u003e\n        command. This variable is only guaranteed to be valid until\n        after the result of the next SQL command has\n        been displayed.\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers since version 12 do not\n        support OID system columns anymore, thus LASTOID will always be 0\n        following \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e when targeting such servers.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_MESSAGE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_SQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The primary error message and associated SQLSTATE code for the most\n         recent failed query in the current \u003cspan class=\"application\"\u003epsql\u003c/span\u003e session, or\n         an empty string and \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e if no error has occurred in\n         the current session.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eON_ERROR_ROLLBACK\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, if a statement in a transaction block\n        generates an error, the error is ignored and the transaction\n        continues. When set to \u003ccode class=\"literal\"\u003einteractive\u003c/code\u003e, such errors are only\n        ignored in interactive sessions, and not when reading script\n        files. When set to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e (the default), a statement in a\n        transaction block that generates an error aborts the entire\n        transaction. The error rollback mode works by issuing an\n        implicit \u003ccode class=\"command\"\u003eSAVEPOINT\u003c/code\u003e for you, just before each command\n        that is in a transaction block, and then rolling back to the\n        savepoint if the command fails.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, command processing continues after an error.  When this\n        variable is set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, processing will instead stop\n        immediately.  In interactive mode,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will return to the command prompt;\n        otherwise, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will exit, returning\n        error code 3 to distinguish this case from fatal error\n        conditions, which are reported using error code 1.  In either case,\n        any currently running scripts (the top-level script, if any, and any\n        other scripts which it may have in invoked) will be terminated\n        immediately.  If the top-level command string contained multiple SQL\n        commands, processing will stop with the current command.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_COMMAND_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_RESULT_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands of an ongoing pipeline that were followed\n        by either a \u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e or a\n        \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e, forcing the server to send the\n        results. These results can be retrieved with\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_SYNC_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of sync messages queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePORT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server port to which you are currently connected.\n        This is set every time you connect to a database (including\n        program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These specify what the prompts \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n        issues should look like. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"Prompting\"\u003ePrompting\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-q\u003c/code\u003e. It is probably not too useful in\n        interactive mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eROW_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The number of rows returned or affected by the last SQL query, or 0\n         if the query failed or did not report a row count.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The server's version number as a string, for\n        example \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e, \u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e or \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e,\n        and in numeric form, for\n        example \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e or \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e.\n        These are set every time you connect to a database\n        (including program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVICE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVICE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The service name, if applicable.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etrue\u003c/code\u003e if the last shell command\n         failed, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e if it succeeded.\n         This applies to shell commands invoked via the \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e,\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e,\n         and \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The exit status returned by the last shell command.\n         0–127 represent program exit codes, 128–255\n         indicate termination by a signal, and -1 indicates failure\n         to launch a program or to collect its exit status.\n         This applies to shell commands invoked via the \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e,\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e,\n         and \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_ALL_RESULTS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, only the last\n        result of a combined query (\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e) is shown instead of\n        all of them.  The default is \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.  The off behavior\n        is for compatibility with older versions of\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the\n        values \u003ccode class=\"literal\"\u003enever\u003c/code\u003e, \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e\n        to control whether \u003ccode class=\"literal\"\u003eCONTEXT\u003c/code\u003e fields are displayed in\n        messages from the server. The default is \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e (meaning\n        that context will be shown in error messages, but not in notice or\n        warning messages).  This setting has no effect\n        when \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003eterse\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e.\n        (See also \u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLELINE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-S\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLESTEP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-s\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SQLSTATE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The error code (see \u003ca class=\"xref\" href=\"/docs/18/errcodes-appendix.html\" title=\"Appendix A. PostgreSQL Error Codes\"\u003eAppendix A\u003c/a\u003e) associated\n         with the last SQL query's failure, or \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e if it\n         succeeded.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-USER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database user you are currently connected as. This is set\n        every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERBOSITY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the values \u003ccode class=\"literal\"\u003edefault\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003everbose\u003c/code\u003e, \u003ccode class=\"literal\"\u003eterse\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e to control the verbosity of error\n        reports.\n        (See also \u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These variables are set at program start-up to reflect\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's version, respectively as a verbose string,\n        a short string (e.g., \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e, \u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e), and a number (e.g., \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e).  They can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable sets the default interval, in seconds, which\n        \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e waits between executing the query. The\n        default is 2 seconds.  Specifying an interval in the command overrides\n        this variable.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\"\u003e\u003ch4\u003eSQL Interpolation\u003c/h4\u003e\u003cp\u003e\n    A key feature of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    variables is that you can substitute (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003einterpolate\u003c/span\u003e”\u003c/span\u003e)\n    them into regular SQL statements, as well as the\n    arguments of meta-commands.  Furthermore,\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides facilities for\n    ensuring that variable values used as SQL literals and identifiers are\n    properly quoted.  The syntax for interpolating a value without\n    any quoting is to prepend the variable name with a colon\n    (\u003ccode class=\"literal\"\u003e:\u003c/code\u003e).  For example,\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :foo;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    would query the table \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e. Note that this\n    may be unsafe: the value of the variable is copied literally, so it can\n    contain unbalanced quotes, or even backslash commands. You must make sure\n    that it makes sense where you put it.\n    \u003c/p\u003e\u003cp\u003e\n    When a value is to be used as an SQL literal or identifier, it is\n    safest to arrange for it to be quoted.  To quote the value of\n    a variable as an SQL literal, write a colon followed by the variable\n    name in single quotes.  To quote the value as an SQL identifier, write\n    a colon followed by the variable name in double quotes.\n    These constructs deal correctly with quotes and other special\n    characters embedded within the variable value.\n    The previous example would be more safely written this way:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :\"foo\";\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Variable interpolation will not be performed within quoted\n    SQL literals and identifiers.  Therefore, a\n    construction such as \u003ccode class=\"literal\"\u003e':foo'\u003c/code\u003e doesn't work to produce a quoted\n    literal from a variable's value (and it would be unsafe if it did work,\n    since it wouldn't correctly handle quotes embedded in the value).\n    \u003c/p\u003e\u003cp\u003e\n    One example use of this mechanism is to\n    copy the contents of a file into a table column.\n    First load the file into a variable and then interpolate the variable's\n    value as a quoted string:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set content `cat my_file.txt`\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eINSERT INTO my_table VALUES (:'content');\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    (Note that this still won't work if \u003ccode class=\"filename\"\u003emy_file.txt\u003c/code\u003e contains NUL bytes.\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e does not support embedded NUL bytes in variable values.)\n    \u003c/p\u003e\u003cp\u003e\n    Since colons can legally appear in SQL commands, an apparent attempt\n    at interpolation (that is, \u003ccode class=\"literal\"\u003e:name\u003c/code\u003e,\n    \u003ccode class=\"literal\"\u003e:'name'\u003c/code\u003e, or \u003ccode class=\"literal\"\u003e:\"name\"\u003c/code\u003e) is not\n    replaced unless the named variable is currently set. In any case, you\n    can escape a colon with a backslash to protect it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    The \u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e special syntax returns TRUE\n    or FALSE depending on whether the variable exists or not, and is thus\n    always substituted, unless the colon is backslash-escaped.\n    \u003c/p\u003e\u003cp\u003e\n    The colon syntax for variables is standard SQL for\n    embedded query languages, such as \u003cspan class=\"application\"\u003eECPG\u003c/span\u003e.\n    The colon syntaxes for array slices and type casts are\n    \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extensions, which can sometimes\n    conflict with the standard usage.  The colon-quote syntax for escaping a\n    variable's value as an SQL literal or identifier is a\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e extension.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PROMPTING\"\u003e\u003ch4\u003ePrompting\u003c/h4\u003e\u003cp\u003e\n    The prompts \u003cspan class=\"application\"\u003epsql\u003c/span\u003e issues can be customized\n    to your preference. The three variables \u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e,\n    \u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e, and \u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e contain strings\n    and special escape sequences that describe the appearance of the\n    prompt. Prompt 1 is the normal prompt that is issued when\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e requests a new command. Prompt 2 is\n    issued when more input is expected during command entry, for example\n    because the command was not terminated with a semicolon or a quote\n    was not closed.\n    Prompt 3 is issued when you are running an SQL\n\u003ccode class=\"command\"\u003eCOPY FROM STDIN\u003c/code\u003e command and you need to type in\n    a row value on the terminal.\n    \u003c/p\u003e\u003cp\u003e\n    The value of the selected prompt variable is printed literally,\n    except where a percent sign (\u003ccode class=\"literal\"\u003e%\u003c/code\u003e) is encountered.\n    Depending on the next character, certain other text is substituted\n    instead. Defined substitutions are:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%M\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The full host name (with domain name) of the database server,\n          or \u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e if the connection is over a Unix\n          domain socket, or\n          \u003ccode class=\"literal\"\u003e[local:\u003cem class=\"replaceable\"\u003e\u003ccode\u003e/dir/name\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e,\n          if the Unix domain socket is not at the compiled in default\n          location.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%m\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The host name of the database server, truncated at the\n          first dot, or \u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e if the connection is\n          over a Unix domain socket.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-GT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u0026gt;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe port number at which the database server is listening.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-N\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%n\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The database session user name.  (The expansion of this\n          value might change during a database session as the result\n          of the command \u003ccode class=\"command\"\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%s\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the service.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SLASH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%/\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the current database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-TILDE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%~\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eLike \u003ccode class=\"literal\"\u003e%/\u003c/code\u003e, but the output is \u003ccode class=\"literal\"\u003e~\u003c/code\u003e\n         (tilde) if the database is your default database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%#\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If the session user is a database superuser, then a\n          \u003ccode class=\"literal\"\u003e#\u003c/code\u003e, otherwise a \u003ccode class=\"literal\"\u003e\u0026gt;\u003c/code\u003e.\n          (The expansion of this value might change during a database\n          session as the result of the command \u003ccode class=\"command\"\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%p\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe process ID of the backend currently connected to.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Pipeline status: \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e when not in a pipeline,\n        \u003ccode class=\"literal\"\u003eon\u003c/code\u003e when in an ongoing pipeline or\n        \u003ccode class=\"literal\"\u003eabort\u003c/code\u003e when in an aborted pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-R\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%R\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In prompt 1 normally \u003ccode class=\"literal\"\u003e=\u003c/code\u003e,\n        but \u003ccode class=\"literal\"\u003e@\u003c/code\u003e if the session is in an inactive branch of a\n        conditional block, or \u003ccode class=\"literal\"\u003e^\u003c/code\u003e if in single-line mode,\n        or \u003ccode class=\"literal\"\u003e!\u003c/code\u003e if the session is disconnected from the\n        database (which can happen if \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e fails).\n        In prompt 2 \u003ccode class=\"literal\"\u003e%R\u003c/code\u003e is replaced by a character that\n        depends on why \u003cspan class=\"application\"\u003epsql\u003c/span\u003e expects more input:\n        \u003ccode class=\"literal\"\u003e-\u003c/code\u003e if the command simply wasn't terminated yet,\n        but \u003ccode class=\"literal\"\u003e*\u003c/code\u003e if there is an unfinished\n        \u003ccode class=\"literal\"\u003e/* ... */\u003c/code\u003e comment,\n        a single quote if there is an unfinished quoted string,\n        a double quote if there is an unfinished quoted identifier,\n        a dollar sign if there is an unfinished dollar-quoted string,\n        or \u003ccode class=\"literal\"\u003e(\u003c/code\u003e if there is an unmatched left parenthesis.\n        In prompt 3 \u003ccode class=\"literal\"\u003e%R\u003c/code\u003e doesn't produce anything.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%x\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Transaction status: an empty string when not in a transaction\n        block, or \u003ccode class=\"literal\"\u003e*\u003c/code\u003e when in a transaction block, or\n        \u003ccode class=\"literal\"\u003e!\u003c/code\u003e when in a failed transaction block, or \u003ccode class=\"literal\"\u003e?\u003c/code\u003e\n        when the transaction state is indeterminate (for example, because\n        there is no connection).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-L\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%l\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The line number inside the current statement, starting from \u003ccode class=\"literal\"\u003e1\u003c/code\u003e.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-DIGITS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The character with the indicated octal code is substituted.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%:\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e:\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e. See\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e, above, for details.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%`\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e`\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The output of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e, similar to ordinary\n        \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eback-tick\u003c/span\u003e”\u003c/span\u003e substitution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%[\u003c/code\u003e ... \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts can contain terminal control characters which, for\n         example, change the color, background, or style of the prompt\n         text, or change the title of the terminal window. In order for\n         the line editing features of \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e to work properly, these\n         non-printing control characters must be designated as invisible\n         by surrounding them with \u003ccode class=\"literal\"\u003e%[\u003c/code\u003e and\n         \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e. Multiple pairs of these can occur within\n         the prompt.  For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n\u003c/pre\u003e\u003cp\u003e\n         results in a boldfaced (\u003ccode class=\"literal\"\u003e1;\u003c/code\u003e) yellow-on-black\n         (\u003ccode class=\"literal\"\u003e33;40\u003c/code\u003e) prompt on VT100-compatible, color-capable\n         terminals.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-W\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%w\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Whitespace of the same width as the most recent output of\n        \u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e.  This can be used as a\n        \u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e setting, so that multi-line statements are\n        aligned with the first line, but there is no visible secondary prompt.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\n    To insert a percent sign into your prompt, write\n    \u003ccode class=\"literal\"\u003e%%\u003c/code\u003e. The default prompts are\n    \u003ccode class=\"literal\"\u003e'%/%R%x%# '\u003c/code\u003e for prompts 1 and 2, and\n    \u003ccode class=\"literal\"\u003e'\u0026gt;\u0026gt; '\u003c/code\u003e for prompt 3.\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n    This feature was shamelessly plagiarized from\n    \u003cspan class=\"application\"\u003etcsh\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-READLINE\"\u003e\u003ch4\u003eCommand-Line Editing\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e uses\n    the \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e\n    or \u003cspan class=\"application\"\u003elibedit\u003c/span\u003e library, if available, for\n    convenient line editing and retrieval.  The command history is\n    automatically saved when \u003cspan class=\"application\"\u003epsql\u003c/span\u003e exits and is\n    reloaded when \u003cspan class=\"application\"\u003epsql\u003c/span\u003e starts up.  Type\n    up-arrow or control-P to retrieve previous lines.\n    \u003c/p\u003e\u003cp\u003e\n    You can also use tab completion to fill in partially-typed keywords\n    and SQL object names in many (by no means all) contexts.  For example,\n    at the start of a command, typing \u003ccode class=\"literal\"\u003eins\u003c/code\u003e and pressing\n    TAB will fill in \u003ccode class=\"literal\"\u003einsert into \u003c/code\u003e.  Then, typing a few\n    characters of a table or schema name and pressing \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e\n    will fill in the unfinished name, or offer a menu of possible completions\n    when there's more than one.  (Depending on the library in use, you may need to\n    press \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e more than once to get a menu.)\n    \u003c/p\u003e\u003cp\u003e\n    Tab completion for SQL object names requires sending queries to the\n    server to find possible matches.  In some contexts this can interfere\n    with other operations.  For example, after \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e\n    it will be too late to issue \u003ccode class=\"command\"\u003eSET TRANSACTION ISOLATION\n    LEVEL\u003c/code\u003e if a tab-completion query is issued in between.\n    If you do not want tab completion at all, you\n    can turn it off permanently by putting this in a file named\n    \u003ccode class=\"filename\"\u003e.inputrc\u003c/code\u003e in your home directory:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$if psql\nset disable-completion on\n$endif\n\u003c/pre\u003e\u003cp\u003e\n    (This is not a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e but a\n    \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e feature. Read its documentation\n    for further details.)\n    \u003c/p\u003e\u003cp\u003e\n     The \u003ccode class=\"option\"\u003e-n\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e) command line\n     option can also be useful to disable use\n     of \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e for a single run\n     of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  This prevents tab completion,\n     use or recording of command line history, and editing of multi-line\n     commands.  It is particularly useful when you need to copy-and-paste\n     text that contains \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e characters.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If \u003ccode class=\"literal\"\u003e\\pset columns\u003c/code\u003e is zero, controls the\n      width for the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format and width for determining\n      if wide output requires the pager or should be switched to the\n      vertical format in expanded auto mode.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Default connection parameters (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eEDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eVISUAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Editor used by the \u003ccode class=\"command\"\u003e\\e\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e,\n      and \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e commands.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If none of them is set, the default is to use \u003ccode class=\"filename\"\u003evi\u003c/code\u003e\n      on Unix systems or \u003ccode class=\"filename\"\u003enotepad.exe\u003c/code\u003e on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR_LINENUMBER_ARG\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When \u003ccode class=\"command\"\u003e\\e\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e, or\n      \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e is used\n      with a line number argument, this variable specifies the\n      command-line argument used to pass the starting line number to\n      the user's editor.  For editors such as \u003cspan class=\"productname\"\u003eEmacs\u003c/span\u003e or\n      \u003cspan class=\"productname\"\u003evi\u003c/span\u003e, this is a plus sign.  Include a trailing\n      space in the value of the variable if there needs to be space\n      between the option name and the line number.  Examples:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003ePSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n      The default is \u003ccode class=\"literal\"\u003e+\u003c/code\u003e on Unix systems\n      (corresponding to the default editor \u003ccode class=\"filename\"\u003evi\u003c/code\u003e,\n      and useful for many other common editors); but there is no\n      default on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location for the command history file. Tilde (\u003ccode class=\"literal\"\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If a query's results do not fit on the screen, they are piped\n      through this command. Typical values are \u003ccode class=\"literal\"\u003emore\u003c/code\u003e\n      or \u003ccode class=\"literal\"\u003eless\u003c/code\u003e.\n      Use of the pager can be disabled by setting \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\n      or \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e to an empty string, or by adjusting the\n      pager-related options of the \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e command.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If neither of them is set, the default is to use \u003ccode class=\"literal\"\u003emore\u003c/code\u003e on most\n      platforms, but \u003ccode class=\"literal\"\u003eless\u003c/code\u003e on Cygwin.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When a query is executed repeatedly with the \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e\n      command, a pager is not used by default.  This behavior can be changed\n      by setting \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e to a pager command, on Unix\n      systems.  The \u003ccode class=\"literal\"\u003epspg\u003c/code\u003e pager (not part of\n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e but available in many open source\n      software distributions) can display the output of\n      \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e if started with the option\n      \u003ccode class=\"literal\"\u003e--stream\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location of the user's \u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e file. Tilde (\u003ccode class=\"literal\"\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-SHELL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eSHELL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Command executed by the \u003ccode class=\"command\"\u003e\\!\u003c/code\u003e command.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eTMPDIR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Directory for storing temporary files.  The default is\n      \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.10\"\u003e\u003ch2\u003eFiles\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-FILES-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e and \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     Unless it is passed an \u003ccode class=\"option\"\u003e-X\u003c/code\u003e option,\n     \u003cspan class=\"application\"\u003epsql\u003c/span\u003e attempts to read and execute commands\n     from the system-wide startup file (\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e) and then\n     the user's personal startup file (\u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e), after\n     connecting to the database but before accepting normal commands.\n     These files can be used to set up the client and/or the server to taste,\n     typically with \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e and \u003ccode class=\"command\"\u003eSET\u003c/code\u003e\n     commands.\n    \u003c/p\u003e\u003cp\u003e\n     The system-wide startup file is named \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e.\n     By default it is\n     sought in the installation's \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003esystem configuration\u003c/span\u003e”\u003c/span\u003e directory,\n     which is most reliably identified by running \u003ccode class=\"literal\"\u003epg_config\n     --sysconfdir\u003c/code\u003e.\n     Typically this directory will be \u003ccode class=\"filename\"\u003e../etc/\u003c/code\u003e\n     relative to the directory containing\n     the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e executables.\n     The directory to look in can be set explicitly via\n     the \u003ccode class=\"envar\"\u003ePGSYSCONFDIR\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     The user's personal startup file is named \u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e\n     and is sought in the invoking user's home directory.\n     On Windows the personal startup file is instead named\n     \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psqlrc.conf\u003c/code\u003e.\n     In either case, this default file path can be overridden by setting\n     the \u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     Both the system-wide startup file and the user's personal startup file\n     can be made \u003cspan class=\"application\"\u003epsql\u003c/span\u003e-version-specific\n     by appending a dash and the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n     major or minor release identifier to the file name,\n     for example \u003ccode class=\"filename\"\u003e~/.psqlrc-18\u003c/code\u003e or\n     \u003ccode class=\"filename\"\u003e~/.psqlrc-18.7\u003c/code\u003e.\n     The most specific version-matching file will be read in preference\n     to a non-version-specific file.\n     These version suffixes are added after determining the file path\n     as explained above.\n    \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-FILES-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003e.psql_history\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     The command-line history is stored in the file\n     \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e, or\n     \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n    \u003c/p\u003e\u003cp\u003e\n     The location of the history file can be set explicitly via\n     the \u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable or\n     the \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.11\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e works best with servers of the same\n       or an older major version.  Backslash commands are particularly likely\n       to fail if the server is of a newer version than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       itself.  However, backslash commands of the \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e family should\n       work with servers of versions back to 9.2, though not necessarily with\n       servers newer than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e itself.  The general\n       functionality of running SQL commands and displaying query results\n       should also work with servers of a newer major version, but this cannot\n       be guaranteed in all cases.\n      \u003c/p\u003e\u003cp\u003e\n       If you want to use \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to connect to several\n       servers of different major versions, it is recommended that you use the\n       newest version of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  Alternatively, you\n       can keep around a copy of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e from each\n       major version and be sure to use the version that matches the\n       respective server.  But in practice, this additional complication should\n       not be necessary.\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       Before \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.6,\n       the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option implied \u003ccode class=\"option\"\u003e-X\u003c/code\u003e\n       (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e); this is no longer the case.\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       Before \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4,\n       \u003cspan class=\"application\"\u003epsql\u003c/span\u003e allowed the\n       first argument of a single-letter backslash command to start\n       directly after the command, without intervening whitespace.\n       Now, some whitespace is required.\n      \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.12\"\u003e\u003ch2\u003eNotes for Windows Users\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is built as a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003econsole\n  application\u003c/span\u003e”\u003c/span\u003e.  Since the Windows console windows use a different\n  encoding than the rest of the system, you must take special care\n  when using 8-bit characters within \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n  If \u003cspan class=\"application\"\u003epsql\u003c/span\u003e detects a problematic\n  console code page, it will warn you at startup. To change the\n  console code page, two things are necessary:\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      Set the code page by entering \u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecmd.exe /c chcp\n      1252\u003c/code\u003e\u003c/strong\u003e. (1252 is a code page that is appropriate for\n      German; replace it with your value.) If you are using Cygwin,\n      you can put this command in \u003ccode class=\"filename\"\u003e/etc/profile\u003c/code\u003e.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      Set the console font to \u003ccode class=\"literal\"\u003eLucida Console\u003c/code\u003e, because the\n      raster font does not work with the ANSI code page.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n  The first example shows how to spread a command over several lines of\n  input. Notice the changing prompt:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eCREATE TABLE my_table (\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e first integer not null default 0,\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e second text)\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e;\u003c/code\u003e\u003c/strong\u003e\nCREATE TABLE\n\u003c/pre\u003e\u003cp\u003e\n  Now look at the table definition again:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\d my_table\u003c/code\u003e\u003c/strong\u003e\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n\u003c/pre\u003e\u003cp\u003e\n  Now we change the prompt to something more interesting:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set PROMPT1 '%n@%m %~%R%# '\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n  Let's assume you have filled the table with data and want to take a\n  look at it:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n  You can display tables in different ways by using the\n  \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 2\u003c/code\u003e\u003c/strong\u003e\nBorder style is 2.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 0\u003c/code\u003e\u003c/strong\u003e\nBorder style is 0.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 1\u003c/code\u003e\u003c/strong\u003e\nBorder style is 1.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format csv\u003c/code\u003e\u003c/strong\u003e\nOutput format is csv.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset tuples_only\u003c/code\u003e\u003c/strong\u003e\nTuples only is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format unaligned\u003c/code\u003e\u003c/strong\u003e\nOutput format is unaligned.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset fieldsep '\\t'\u003c/code\u003e\u003c/strong\u003e\nField separator is \"    \".\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none     1\ntwo     2\nthree   3\nfour    4\n\u003c/pre\u003e\u003cp\u003e\n  Alternatively, use the short commands:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\a \\t \\x\u003c/code\u003e\u003c/strong\u003e\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  Also, these output format options can be set for just one query by using\n  \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\g (format=aligned tuples_only=off expanded=on)\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here is an example of using the \u003ccode class=\"command\"\u003e\\df\u003c/code\u003e command to\n   find only functions with names matching \u003ccode class=\"literal\"\u003eint*pl\u003c/code\u003e\n   and whose second argument is of type \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df int*pl * bigint\u003c/code\u003e\u003c/strong\u003e\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here, the \u003ccode class=\"literal\"\u003e+\u003c/code\u003e option is used to display additional\n   information about one of these functions, and \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is used\n   to display the results in expanded mode:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df+x int*pl integer bigint\u003c/code\u003e\u003c/strong\u003e\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  When suitable, query results can be shown in a crosstab representation\n  with the \u003ccode class=\"command\"\u003e\\crosstabview\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT first, second, first \u0026gt; 2 AS gt2 FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview first second\u003c/code\u003e\u003c/strong\u003e\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n\nThis second example shows a multiplication table with rows sorted in reverse\nnumerical order and columns with an independent, ascending numerical order.\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003erow_number() over(order by t2.first) AS ord\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview \"A\" \"B\" \"AxB\" ord\u003c/code\u003e\u003c/strong\u003e\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","manual_path":"app-psql.html","options":[{"description":"Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .","names":["-a","--echo-all"],"signature":"-a --echo-all","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL","summary":"Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."},{"description":"Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .","names":["-A","--no-align"],"signature":"-A --no-align","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN","summary":"Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."},{"description":"Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .","names":["-b","--echo-errors"],"signature":"-b --echo-errors","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS","summary":"Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."},{"description":"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql \u003c\u003cEOF \\x SELECT * FROM foo; EOF","names":["-c command","--command= command"],"signature":"-c command --command= command","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND","summary":"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence."},{"description":"Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .","names":["--csv"],"signature":"--csv","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-CSV","summary":"Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."},{"description":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME","summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"description":"Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .","names":["-e","--echo-queries"],"signature":"-e --echo-queries","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES","summary":"Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."},{"description":"Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .","names":["-E","--echo-hidden"],"signature":"-E --echo-hidden","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN","summary":"Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."},{"description":"Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql \u003c filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand.","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FILE","summary":"Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i ."},{"description":"Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .","names":["-F separator","--field-separator= separator"],"signature":"-F separator --field-separator= separator","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR","summary":"Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.","names":["-h hostname","--host= hostname"],"signature":"-h hostname --host= hostname","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."},{"description":"Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.","names":["-H","--html"],"signature":"-H --html","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HTML","summary":"Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."},{"description":"List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable).","names":["-l","--list"],"signature":"-l --list","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LIST","summary":"List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list ."},{"description":"Write all query output into file filename , in addition to the normal output destination.","names":["-L filename","--log-file= filename"],"signature":"-L filename --log-file= filename","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE","summary":"Write all query output into file filename , in addition to the normal output destination."},{"description":"Do not use Readline for line editing and do not use the command history (see the section called “Command-Line Editing” below).","names":["-n","--no-readline"],"signature":"-n --no-readline","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE","summary":"Do not use Readline for line editing and do not use the command history (see the section called “Command-Line Editing” below)."},{"description":"Put all query output into file filename . This is equivalent to the command \\o .","names":["-o filename","--output= filename"],"signature":"-o filename --output= filename","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT","summary":"Put all query output into file filename . This is equivalent to the command \\o ."},{"description":"Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PORT","summary":"Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"description":"Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .","names":["-P assignment","--pset= assignment"],"signature":"-P assignment --pset= assignment","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PSET","summary":"Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."},{"description":"Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .","names":["-q","--quiet"],"signature":"-q --quiet","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET","summary":"Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."},{"description":"Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .","names":["-R separator","--record-separator= separator"],"signature":"-R separator --record-separator= separator","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR","summary":"Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."},{"description":"Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.","names":["-s","--single-step"],"signature":"-s --single-step","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP","summary":"Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."},{"description":"Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user.","names":["-S","--single-line"],"signature":"-S --single-line","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE","summary":"Runs in single-line mode where a newline terminates an SQL command, as a semicolon does."},{"description":"Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .","names":["-t","--tuples-only"],"signature":"-t --tuples-only","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY","summary":"Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."},{"description":"Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.","names":["-T table_options","--table-attr= table_options"],"signature":"-T table_options --table-attr= table_options","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR","summary":"Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."},{"description":"Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME","summary":"Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"},{"description":"Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.","names":["-v assignment","--set= assignment","--variable= assignment"],"signature":"-v assignment --set= assignment --variable= assignment","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE","summary":"Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."},{"description":"Print the psql version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION","summary":"Print the psql version and exit."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD","summary":"Force psql to prompt for a password before connecting to a database, even if the password will not be used."},{"description":"Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .","names":["-x","--expanded"],"signature":"-x --expanded","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED","summary":"Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."},{"description":"Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).","names":["-X","--no-psqlrc"],"signature":"-X --no-psqlrc","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC","summary":"Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."},{"description":"Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .","names":["-z","--field-separator-zero"],"signature":"-z --field-separator-zero","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO","summary":"Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."},{"description":"Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .","names":["-0","--record-separator-zero"],"signature":"-0 --record-separator-zero","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO","summary":"Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."},{"description":"This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail.","names":["-1","--single-transaction"],"signature":"-1 --single-transaction","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION","summary":"This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied."},{"description":"Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.","names":["-?","--help[= topic ]"],"signature":"-? --help[= topic ]","source_url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HELP","summary":"Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}],"related":[{"label":"psql meta-commands","url":"/wiki/psql/?v=18"},{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"related_zh":[{"label":"psql 元命令","url":"/wiki/psql/?v=18"},{"label":"libpq 连接参数","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sections":[],"sections_zh":[],"signature":"psql [ option ...] [ dbname [ username ]]","sources":[{"anchor":"","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","url":"/docs/18/reference-client.html"}],"synopsis":["psql [ option ...] [ dbname [ username ]]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --echo-all","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL"},"summary":"Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."},{"signature":{"text":"-A --no-align","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN"},"summary":"Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."},{"signature":{"text":"-b --echo-errors","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS"},"summary":"Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."},{"signature":{"text":"-c command --command= command","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND"},"summary":"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence."},{"signature":{"text":"--csv","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-CSV"},"summary":"Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME"},"summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-e --echo-queries","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES"},"summary":"Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."},{"signature":{"text":"-E --echo-hidden","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN"},"summary":"Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FILE"},"summary":"Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i ."},{"signature":{"text":"-F separator --field-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR"},"summary":"Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."},{"signature":{"text":"-H --html","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HTML"},"summary":"Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."},{"signature":{"text":"-l --list","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LIST"},"summary":"List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list ."},{"signature":{"text":"-L filename --log-file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE"},"summary":"Write all query output into file filename , in addition to the normal output destination."},{"signature":{"text":"-n --no-readline","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE"},"summary":"Do not use Readline for line editing and do not use the command history (see the section called “Command-Line Editing” below)."},{"signature":{"text":"-o filename --output= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT"},"summary":"Put all query output into file filename . This is equivalent to the command \\o ."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PORT"},"summary":"Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"signature":{"text":"-P assignment --pset= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PSET"},"summary":"Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET"},"summary":"Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."},{"signature":{"text":"-R separator --record-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR"},"summary":"Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."},{"signature":{"text":"-s --single-step","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP"},"summary":"Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."},{"signature":{"text":"-S --single-line","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE"},"summary":"Runs in single-line mode where a newline terminates an SQL command, as a semicolon does."},{"signature":{"text":"-t --tuples-only","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY"},"summary":"Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."},{"signature":{"text":"-T table_options --table-attr= table_options","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR"},"summary":"Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME"},"summary":"Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"},{"signature":{"text":"-v assignment --set= assignment --variable= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE"},"summary":"Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."},{"signature":{"text":"-V --version","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION"},"summary":"Print the psql version and exit."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD"},"summary":"Force psql to prompt for a password before connecting to a database, even if the password will not be used."},{"signature":{"text":"-x --expanded","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED"},"summary":"Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."},{"signature":{"text":"-X --no-psqlrc","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC"},"summary":"Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."},{"signature":{"text":"-z --field-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO"},"summary":"Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."},{"signature":{"text":"-0 --record-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO"},"summary":"Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."},{"signature":{"text":"-1 --single-transaction","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION"},"summary":"This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied."},{"signature":{"text":"-? --help[= topic ]","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HELP"},"summary":"Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.","name":"COLUMNS"},{"description":"Default connection parameters (see Section 32.15 ).","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.","name":"PSQL_EDITOR EDITOR VISUAL"},{"description":"When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.","name":"PSQL_EDITOR_LINENUMBER_ARG"},{"description":"Alternative location for the command history file. Tilde ( ~ ) expansion is performed.","name":"PSQL_HISTORY"},{"description":"If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.","name":"PSQL_PAGER PAGER"},{"description":"When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .","name":"PSQL_WATCH_PAGER"},{"description":"Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.","name":"PSQLRC"},{"description":"Command executed by the \\! command.","name":"SHELL"},{"description":"Directory for storing temporary files. The default is /tmp .","name":"TMPDIR"}],"title":"Environment variables"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-a --echo-all","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL"},"summary":"在读入时将所有非空输入行打印到标准输出（不适用于交互式行读取）。这等效于把变量 ECHO 设置为 all 。"},{"signature":{"text":"-A --no-align","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN"},"summary":"切换到非对齐输出模式（默认输出模式是 aligned ）。这等效于 \\pset format unaligned 。"},{"signature":{"text":"-b --echo-errors","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS"},"summary":"把失败的 SQL 命令打印到标准错误输出。这等效于把变量 ECHO 设置为 errors 。"},{"signature":{"text":"-c command --command= command","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND"},"summary":"指定 psql 执行一个给定的命令字符串 command 。这个选项可以重复多次并且以任何顺序与 -f 选项组合在一起。当 -c 或者 -f 被指定时， psql 不会从标准输入读取命令，而是在按顺序处理完所有 -c 和 -f 选项后终止。"},{"signature":{"text":"--csv","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-CSV"},"summary":"切换到 CSV （逗号分隔值）输出模式。这相当于 \\pset format csv 。"},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME"},"summary":"指定要连接的数据库的名称。这等效于指定 dbname 为命令行上的第一个非选项参数。 dbname 可以是 连接字符串 。如果是这样，连接字符串参数将覆盖任何冲突的命令行选项。"},{"signature":{"text":"-e --echo-queries","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES"},"summary":"也把发送到服务器的所有 SQL 命令复制到标准输出。这等效于把变量 ECHO 设置为 queries 。"},{"signature":{"text":"-E --echo-hidden","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN"},"summary":"回显 \\d 以及其他反斜线命令生成的实际查询。可以用它来学习 psql 的内部操作。这等效于把变量 ECHO_HIDDEN 设置为 on 。"},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FILE"},"summary":"从文件 filename 而不是标准输入中读取命令。这个选项可以重复指定，也可以按任意顺序与 -c 选项组合使用。当指定了 -c 或 -f 时， psql 不会从标准输入读取命令，而是在按顺序处理完所有 -c 和 -f 选项后终止。除此之外，这个选项在很大程度上等价于元命令 \\i 。"},{"signature":{"text":"-F separator --field-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR"},"summary":"使用 separator 作为非对齐输出的字段分隔符。这等效于 \\pset fieldsep 或者 \\f 。"},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST"},"summary":"指定服务器所在机器的主机名。如果值以斜杠开头，则被用作 Unix 域套接字的目录。"},{"signature":{"text":"-H --html","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HTML"},"summary":"切换到 HTML 输出模式。这等效于 \\pset format html 或者 \\H 命令。"},{"signature":{"text":"-l --list","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LIST"},"summary":"列出所有可用的数据库，然后退出。其他非连接选项会被忽略。这与元命令 \\list 类似。"},{"signature":{"text":"-L filename --log-file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE"},"summary":"除了把所有查询输出写到普通输出目标之外，还写到文件 filename 中。"},{"signature":{"text":"-n --no-readline","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE"},"summary":"不要使用 Readline 进行行编辑，也不要使用命令历史记录（请参见下面的 “命令行编辑”一节 ）。"},{"signature":{"text":"-o filename --output= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT"},"summary":"把所有查询输出放到文件 filename 中。这等效于命令 \\o 。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PORT"},"summary":"指定服务器监听连接的 TCP 端口，或本地 Unix 域套接字的文件名后缀。默认使用 PGPORT 环境变量的值；未设置时，使用编译时指定的端口，通常为 5432。"},{"signature":{"text":"-P assignment --pset= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PSET"},"summary":"以 \\pset 的形式指定打印选项。注意，这里你必须用一个等号而不是空格来分隔名称和值。例如，要设置输出格式为 LaTeX ，应该写成 -P format=latex 。"},{"signature":{"text":"-q --quiet","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET"},"summary":"指定 psql 应该安静地工作。默认情况下，它会打印出欢迎消息和各种提示信息。如果使用了这个选项，以上那些就都不会输出。在使用 -c 选项时，配合这个选项很有用。这等效于设置变量 QUIET 为 on 。"},{"signature":{"text":"-R separator --record-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR"},"summary":"把 separator 用作非对齐输出的记录分隔符。这等效于 \\pset recordsep 命令。"},{"signature":{"text":"-s --single-step","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP"},"summary":"运行在单步模式中。这意味着在每个命令被发送给服务器之前都会提示用户，并允许取消执行。使用这个选项可以调试脚本。"},{"signature":{"text":"-S --single-line","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE"},"summary":"运行在单行模式中，其中换行符会终止一个 SQL 命令，就像分号的作用一样。"},{"signature":{"text":"-t --tuples-only","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY"},"summary":"关闭打印列名和结果行计数页脚等。这等效于 \\t 或者 \\pset tuples_only 命令。"},{"signature":{"text":"-T table_options --table-attr= table_options","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR"},"summary":"指定要放在 HTML table 标签内的选项。详见 \\pset tableattr 。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME"},"summary":"作为用户 username 而不是默认用户连接到数据库（当然，你必须具有这样做的权限）。"},{"signature":{"text":"-v assignment --set= assignment --variable= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE"},"summary":"执行一次变量赋值，和 \\set 元命令相似。注意你必须在命令行上用等号分隔名字和值（如果有）。要取消变量的设置，去掉等号就行。要把一个变量设为空字符串，使用等号但是去掉值。这些赋值在命令行处理期间被完成，因此反映连接状态的变量将在稍后被覆盖。"},{"signature":{"text":"-V --version","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION"},"summary":"打印 psql 版本并且退出。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD"},"summary":"永不发出密码提示。如果服务器要求密码认证，而密码又无法从其他来源获得，例如 .pgpass 文件，则连接尝试将失败。这个选项对于批处理任务和脚本很有用，因为那时通常没有用户在场输入密码。"},{"signature":{"text":"-W --password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD"},"summary":"强制 psql 在连接数据库之前提示输入密码，即使该密码实际上不会被使用。"},{"signature":{"text":"-x --expanded","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED"},"summary":"打开扩展表格式模式。这等效于 \\x 或者 \\pset expanded 命令。"},{"signature":{"text":"-X --no-psqlrc","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC"},"summary":"不读取启动文件（既不读取系统范围的 psqlrc 文件，也不读取用户的 ~/.psqlrc 文件）。"},{"signature":{"text":"-z --field-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO"},"summary":"设置非对齐输出的字段分隔符为零字节。这等效于 \\pset fieldsep_zero 。"},{"signature":{"text":"-0 --record-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO"},"summary":"设置非对齐输出的记录分隔符为零字节。例如，这有助于与 xargs -0 配合使用。这等效于 \\pset recordsep_zero 。"},{"signature":{"text":"-1 --single-transaction","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION"},"summary":"这个选项只能与一个或多个 -c 和/或 -f 选项结合使用。它会导致 psql 在第一个这样的选项之前发出一个 BEGIN 命令，并在最后一个选项之后发出一个 COMMIT 命令，从而将所有命令包装成一个单独的事务。如果任何命令失败且变量 ON_ERROR_STOP 被设置，则会改为发送一个 ROLLBACK 命令。这确保要么所有命令都成功完成，要么不应用任何更改。"},{"signature":{"text":"-? --help[= topic ]","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HELP"},"summary":"显示有关 psql 的帮助并且退出。可选的 topic 参数（默认为 options ）选择要解释 psql 的哪一部分： commands 描述 psql 的反斜线命令； options 描述可以被传递给 psql 的命令行选项；而 variables 则显示有关 psql 配置变量的帮助。"}],"title":"手册中的选项"},{"columns":[{"key":"name","label":"变量"},{"key":"description","label":"含义"}],"key":"environment","rows":[{"description":"如果 \\pset columns 为零，这个环境变量控制用于 wrapped 格式的宽度以及用来确定较宽的输出是否需要分页器，或者是否应切换到扩展自动模式中的垂直格式的宽度。","name":"COLUMNS"},{"description":"默认连接参数（见 第 32.15 节 ）。","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"指定诊断消息是否使用颜色。可选值为 always 、 auto 和 never 。","name":"PG_COLOR"},{"description":"\\e 、 \\ef 以及 \\ev 命令所使用的编辑器。会按照列出的顺序检查这些变量，第一个被设置的将被使用。如果都没有被设置，默认是使用 Unix 系统上的 vi 或者 Windows 系统上的 notepad.exe 。","name":"PSQL_EDITOR EDITOR VISUAL"},{"description":"当 \\e 、 \\ef 或 \\ev 带有行号参数使用时，此变量指定将起始行号传给用户编辑器时所用的命令行参数。对于 Emacs 或 vi 之类的编辑器，这个参数是一个加号。如果选项名和行号之间需要空格，请在变量值中包含末尾空格。例如： PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' 在 Unix 系统上默认是 + （对应于默认编辑器 vi ，且对很多其他常见编辑器可用）。在 Windows 系统上没有默认值。","name":"PSQL_EDITOR_LINENUMBER_ARG"},{"description":"命令历史文件的替代位置。波浪线（ ~ ）扩展会被执行。","name":"PSQL_HISTORY"},{"description":"如果查询结果无法在屏幕上显示完整，它们会通过管道传给此命令。典型的值是 more 或 less 。可以通过将 PSQL_PAGER 或 PAGER 设置为空字符串，或通过调整 \\pset 命令的与分页相关的选项来禁用分页器。这些变量按照列出的顺序进行检查；使用按该顺序找到的第一个已设置的变量。如果它们都没有设置，默认情况下在大多数平台上使用 more ，但在 Cygwin 上使用 less 。","name":"PSQL_PAGER PAGER"},{"description":"使用 \\watch 命令反复执行查询时，默认不使用分页程序。在 Unix 系统上，可以将 PSQL_WATCH_PAGER 设为分页程序命令来改变此行为。pspg 分页程序（不属于 PostgreSQL，但许多开源软件发行版都提供它）以 --stream 选项启动时，可以显示 \\watch 的输出。","name":"PSQL_WATCH_PAGER"},{"description":"用户的 .psqlrc 文件的替代位置。波浪线（ ~ ）扩展会被执行。","name":"PSQLRC"},{"description":"被 \\! 命令执行的命令。","name":"SHELL"},{"description":"存储临时文件的目录。默认是 /tmp 。","name":"TMPDIR"}],"title":"环境变量"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-psql.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sources":[{"anchor":"","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"psql","SourceDatabase":"center","Version":"18","Locale":"en","Title":"psql","Summary":"psql — PostgreSQL interactive terminal","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PSQL\"\u003e\u003cdiv\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003e\u003cspan\u003epsql\u003c/span\u003e — \n      \u003cspan\u003ePostgreSQL\u003c/span\u003e interactive terminal\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv\u003e\u003cp id=\"id-1.9.4.21.4.1\"\u003e\u003ccode\u003epsql\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n    [\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e is a terminal-based front-end to\n     \u003cspan\u003ePostgreSQL\u003c/span\u003e. It enables you to type in\n     queries interactively, issue them to\n     \u003cspan\u003ePostgreSQL\u003c/span\u003e, and see the query results.\n     Alternatively, input can be from a file or from command line\n     arguments. In addition, \u003cspan\u003epsql\u003c/span\u003e provides a\n     number of meta-commands and various shell-like features to\n     facilitate writing scripts and automating a wide variety of tasks.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"R1-APP-PSQL-3\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ALL\"\u003e\u003cspan\u003e\u003ccode\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo-all\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print all nonempty input lines to standard output as they are read.\n      (This does not apply to lines read interactively.) This is\n      equivalent to setting the variable \u003ccode\u003eECHO\u003c/code\u003e to\n      \u003ccode\u003eall\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-ALIGN\"\u003e\u003cspan\u003e\u003ccode\u003e-A\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-align\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to unaligned output mode. (The default output mode is\n      \u003ccode\u003ealigned\u003c/code\u003e.)  This is equivalent to\n      \u003ccode\u003e\\pset format unaligned\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"\u003e\u003cspan\u003e\u003ccode\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo-errors\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print failed SQL commands to standard error output. This is\n      equivalent to setting the variable \u003ccode\u003eECHO\u003c/code\u003e to\n      \u003ccode\u003eerrors\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-COMMAND\"\u003e\u003cspan\u003e\u003ccode\u003e-c \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--command=\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies that \u003cspan\u003epsql\u003c/span\u003e is to execute the given\n       command string, \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n       This option can be repeated and combined in any order with\n       the \u003ccode\u003e-f\u003c/code\u003e option.  When either \u003ccode\u003e-c\u003c/code\u003e\n       or \u003ccode\u003e-f\u003c/code\u003e is specified, \u003cspan\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode\u003e-c\u003c/code\u003e and \u003ccode\u003e-f\u003c/code\u003e\n       options in sequence.\n      \u003c/p\u003e\u003cp\u003e\n\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e must be either\n       a command string that is completely parsable by the server (i.e.,\n       it contains no \u003cspan\u003epsql\u003c/span\u003e-specific features),\n       or a single backslash command. Thus you cannot mix\n       SQL and \u003cspan\u003epsql\u003c/span\u003e\n       meta-commands within a \u003ccode\u003e-c\u003c/code\u003e option. To achieve that,\n       you could use repeated \u003ccode\u003e-c\u003c/code\u003e options or pipe the string\n       into \u003cspan\u003epsql\u003c/span\u003e, for example:\n\u003c/p\u003e\u003cpre\u003epsql -c \u0026#39;\\x\u0026#39; -c \u0026#39;SELECT * FROM foo;\u0026#39;\n\u003c/pre\u003e\u003cp\u003e\n       or\n\u003c/p\u003e\u003cpre\u003eecho \u0026#39;\\x \\\\ SELECT * FROM foo;\u0026#39; | psql\n\u003c/pre\u003e\u003cp\u003e\n       (\u003ccode\u003e\\\\\u003c/code\u003e is the separator meta-command.)\n      \u003c/p\u003e\u003cp\u003e\n       Each SQL command string passed\n       to \u003ccode\u003e-c\u003c/code\u003e is sent to the server as a single request.\n       Because of this, the server executes it as a single transaction even\n       if the string contains multiple SQL commands,\n       unless there are explicit \u003ccode\u003eBEGIN\u003c/code\u003e/\u003ccode\u003eCOMMIT\u003c/code\u003e\n       commands included in the string to divide it into multiple\n       transactions.  (See \u003ca href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" rel=\"nofollow\"\u003eSection 54.2.2.1\u003c/a\u003e\n       for more details about how the server handles multi-query strings.)\n      \u003c/p\u003e\u003cp\u003e\n       If having several commands executed in one transaction is not desired,\n       use repeated \u003ccode\u003e-c\u003c/code\u003e commands or feed multiple commands to\n       \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s standard input,\n       either using \u003cspan\u003eecho\u003c/span\u003e as illustrated above, or\n       via a shell here-document, for example:\n\u003c/p\u003e\u003cpre\u003epsql \u0026lt;\u0026lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-CSV\"\u003e\u003cspan\u003e\u003ccode\u003e--csv\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to CSV (Comma-Separated Values) output\n      mode.  This is equivalent to \u003ccode\u003e\\pset format csv\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-DBNAME\"\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"\u003e\u003cspan\u003e\u003ccode\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo-queries\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Copy all SQL commands sent to the server to standard output as well.\n      This is equivalent\n      to setting the variable \u003ccode\u003eECHO\u003c/code\u003e to\n      \u003ccode\u003equeries\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"\u003e\u003cspan\u003e\u003ccode\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--echo-hidden\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Echo the actual queries generated by \u003ccode\u003e\\d\u003c/code\u003e and other backslash\n      commands. You can use this to study \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s\n      internal operations. This is equivalent to\n      setting the variable \u003ccode\u003eECHO_HIDDEN\u003c/code\u003e to \u003ccode\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FILE\"\u003e\u003cspan\u003e\u003ccode\u003e-f \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--file=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Read commands from the\n       file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e,\n       rather than standard input.\n       This option can be repeated and combined in any order with\n       the \u003ccode\u003e-c\u003c/code\u003e option.  When either \u003ccode\u003e-c\u003c/code\u003e\n       or \u003ccode\u003e-f\u003c/code\u003e is specified, \u003cspan\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode\u003e-c\u003c/code\u003e and \u003ccode\u003e-f\u003c/code\u003e\n       options in sequence.\n       Except for that, this option is largely equivalent to the\n       meta-command \u003ccode\u003e\\i\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n       If \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode\u003e-\u003c/code\u003e\n       (hyphen), then standard input is read until an EOF indication\n       or \u003ccode\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n       interactive input with input from files.  Note however that Readline\n       is not used in this case (much as if \u003ccode\u003e-n\u003c/code\u003e had been\n       specified).\n      \u003c/p\u003e\u003cp\u003e\n      Using this option is subtly different from writing \u003ccode\u003epsql\n      \u0026lt; \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. In general,\n      both will do what you expect, but using \u003ccode\u003e-f\u003c/code\u003e\n      enables some nice features such as error messages with line\n      numbers. There is also a slight chance that using this option will\n      reduce the start-up overhead. On the other hand, the variant using\n      the shell\u0026#39;s input redirection is (in theory) guaranteed to yield\n      exactly the same output you would have received had you entered\n      everything by hand.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"\u003e\u003cspan\u003e\u003ccode\u003e-F \u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--field-separator=\u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      field separator for unaligned output. This is equivalent to\n      \u003ccode\u003e\\pset fieldsep\u003c/code\u003e or \u003ccode\u003e\\f\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-HOST\"\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the host name of the machine on which the\n      server is running. If the value begins\n      with a slash, it is used as the directory for the Unix-domain\n      socket.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HTML\"\u003e\u003cspan\u003e\u003ccode\u003e-H\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to HTML output mode.  This is\n      equivalent to \u003ccode\u003e\\pset format html\u003c/code\u003e or the\n      \u003ccode\u003e\\H\u003c/code\u003e command.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LIST\"\u003e\u003cspan\u003e\u003ccode\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--list\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      List all available databases, then exit. Other non-connection\n      options are ignored. This is similar to the meta-command\n      \u003ccode\u003e\\list\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n      When this option is used, \u003cspan\u003epsql\u003c/span\u003e will connect\n      to the database \u003ccode\u003epostgres\u003c/code\u003e, unless a different database\n      is named on the command line (option \u003ccode\u003e-d\u003c/code\u003e or non-option\n      argument, possibly via a service entry, but not via an environment\n      variable).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LOG-FILE\"\u003e\u003cspan\u003e\u003ccode\u003e-L \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--log-file=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Write all query output into file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e, in addition to the\n       normal output destination.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-READLINE\"\u003e\u003cspan\u003e\u003ccode\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-readline\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Do not use \u003cspan\u003eReadline\u003c/span\u003e for line editing and\n       do not use the command history (see\n       \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"Command-Line Editing\" rel=\"nofollow\"\u003ethe section called “Command-Line Editing”\u003c/a\u003e below).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-OUTPUT\"\u003e\u003cspan\u003e\u003ccode\u003e-o \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--output=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Put all query output into file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This is equivalent to\n      the command \u003ccode\u003e\\o\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PORT\"\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the TCP port or the local Unix-domain\n      socket file extension on which the server is listening for\n      connections. Defaults to the value of the \u003ccode\u003ePGPORT\u003c/code\u003e\n      environment variable or, if not set, to the port specified at\n      compile time, usually 5432.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PSET\"\u003e\u003cspan\u003e\u003ccode\u003e-P \u003cem\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--pset=\u003cem\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies printing options, in the style of\n      \u003ccode\u003e\\pset\u003c/code\u003e. Note that here you\n      have to separate name and value with an equal sign instead of a\n      space. For example, to set the output format to \u003cspan\u003eLaTeX\u003c/span\u003e, you could write\n      \u003ccode\u003e-P format=latex\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-QUIET\"\u003e\u003cspan\u003e\u003ccode\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--quiet\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies that \u003cspan\u003epsql\u003c/span\u003e should do its work\n      quietly. By default, it prints welcome messages and various\n      informational output. If this option is used, none of this\n      happens. This is useful with the \u003ccode\u003e-c\u003c/code\u003e option.\n      This is equivalent to setting the variable \u003ccode\u003eQUIET\u003c/code\u003e\n      to \u003ccode\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"\u003e\u003cspan\u003e\u003ccode\u003e-R \u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--record-separator=\u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      record separator for unaligned output. This is equivalent to\n      \u003ccode\u003e\\pset recordsep\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-STEP\"\u003e\u003cspan\u003e\u003ccode\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--single-step\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Run in single-step mode. That means the user is prompted before\n      each command is sent to the server, with the option to cancel\n      execution as well. Use this to debug scripts.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-LINE\"\u003e\u003cspan\u003e\u003ccode\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--single-line\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Runs in single-line mode where a newline terminates an SQL command, as a\n      semicolon does.\n      \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n      This mode is provided for those who insist on it, but you are not\n      necessarily encouraged to use it. In particular, if you mix\n      SQL and meta-commands on a line the order of\n      execution might not always be clear to the inexperienced user.\n      \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"\u003e\u003cspan\u003e\u003ccode\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--tuples-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn off printing of column names and result row count footers,\n      etc. This is equivalent to \u003ccode\u003e\\t\u003c/code\u003e or\n      \u003ccode\u003e\\pset tuples_only\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TABLE-ATTR\"\u003e\u003cspan\u003e\u003ccode\u003e-T \u003cem\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--table-attr=\u003cem\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies options to be placed within the\n      HTML \u003ccode\u003etable\u003c/code\u003e tag. See\n      \u003ccode\u003e\\pset tableattr\u003c/code\u003e for details.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-USERNAME\"\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Connect to the database as the user \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\n      (You must have permission to do so, of course.)\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VARIABLE\"\u003e\u003cspan\u003e\u003ccode\u003e-v \u003cem\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--set=\u003cem\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--variable=\u003cem\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Perform a variable assignment, like the \u003ccode\u003e\\set\u003c/code\u003e\n      meta-command. Note that you must separate name and value, if\n      any, by an equal sign on the command line. To unset a variable,\n      leave off the equal sign. To set a variable with an empty value,\n      use the equal sign but leave off the value. These assignments are\n      done during command line processing, so variables that reflect\n      connection state will get overwritten later.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VERSION\"\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print the \u003cspan\u003epsql\u003c/span\u003e version and exit.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PASSWORD\"\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Never issue a password prompt.  If the server requires password\n       authentication and a password is not available from other sources\n       such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection\n       attempt will fail.  This option can be useful in batch jobs and\n       scripts where no user is present to enter a password.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PASSWORD\"\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Force \u003cspan\u003epsql\u003c/span\u003e to prompt for a\n       password before connecting to a database, even if the password will\n       not be used.\n      \u003c/p\u003e\u003cp\u003e\n       If the server requires password authentication and a password is not\n       available from other sources such as a \u003ccode\u003e.pgpass\u003c/code\u003e\n       file, \u003cspan\u003epsql\u003c/span\u003e will prompt for a\n       password in any case.  However, \u003cspan\u003epsql\u003c/span\u003e\n       will waste a connection attempt finding out that the server wants a\n       password.  In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid\n       the extra connection attempt.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-EXPANDED\"\u003e\u003cspan\u003e\u003ccode\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--expanded\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn on the expanded table formatting mode. This is equivalent to\n      \u003ccode\u003e\\x\u003c/code\u003e or \u003ccode\u003e\\pset expanded\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PSQLRC\"\u003e\u003cspan\u003e\u003ccode\u003e-X\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Do not read the start-up file (neither the system-wide\n      \u003ccode\u003epsqlrc\u003c/code\u003e file nor the user\u0026#39;s\n      \u003ccode\u003e~/.psqlrc\u003c/code\u003e file).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"\u003e\u003cspan\u003e\u003ccode\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--field-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the field separator for unaligned output to a zero byte.  This is\n      equivalent to \u003ccode\u003e\\pset fieldsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"\u003e\u003cspan\u003e\u003ccode\u003e-0\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--record-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the record separator for unaligned output to a zero byte.  This is\n      useful for interfacing, for example, with \u003ccode\u003exargs -0\u003c/code\u003e.\n      This is equivalent to \u003ccode\u003e\\pset recordsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"\u003e\u003cspan\u003e\u003ccode\u003e-1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--single-transaction\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used in combination with one or more\n        \u003ccode\u003e-c\u003c/code\u003e and/or \u003ccode\u003e-f\u003c/code\u003e options.  It causes\n        \u003cspan\u003epsql\u003c/span\u003e to issue a \u003ccode\u003eBEGIN\u003c/code\u003e command\n        before the first such option and a \u003ccode\u003eCOMMIT\u003c/code\u003e command after\n        the last one, thereby wrapping all the commands into a single\n        transaction. If any of the commands fails and the variable\n        \u003ccode\u003eON_ERROR_STOP\u003c/code\u003e was set, a\n        \u003ccode\u003eROLLBACK\u003c/code\u003e command is sent instead. This ensures that\n        either all the commands complete successfully, or no changes are\n        applied.\n       \u003c/p\u003e\u003cp\u003e\n        If the commands themselves\n        contain \u003ccode\u003eBEGIN\u003c/code\u003e, \u003ccode\u003eCOMMIT\u003c/code\u003e,\n        or \u003ccode\u003eROLLBACK\u003c/code\u003e, this option will not have the desired\n        effects.  Also, if an individual command cannot be executed inside a\n        transaction block, specifying this option will cause the whole\n        transaction to fail.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HELP\"\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help[=\u003cem\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Show help about \u003cspan\u003epsql\u003c/span\u003e and exit. The optional\n      \u003cem\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter (defaulting\n      to \u003ccode\u003eoptions\u003c/code\u003e) selects which part of \u003cspan\u003epsql\u003c/span\u003e is\n      explained: \u003ccode\u003ecommands\u003c/code\u003e describes \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s\n      backslash commands; \u003ccode\u003eoptions\u003c/code\u003e describes the command-line\n      options that can be passed to \u003cspan\u003epsql\u003c/span\u003e;\n      and \u003ccode\u003evariables\u003c/code\u003e shows help about \u003cspan\u003epsql\u003c/span\u003e configuration\n      variables.\n      \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.7\"\u003e\u003ch2\u003eExit Status\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e returns 0 to the shell if it\n   finished normally, 1 if a fatal error of its own occurs (e.g., out of memory,\n   file not found), 2 if the connection to the server went bad\n   and the session was not interactive, and 3 if an error occurred in a\n   script and the variable \u003ccode\u003eON_ERROR_STOP\u003c/code\u003e was set.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.8\"\u003e\u003ch2\u003eUsage\u003c/h2\u003e\u003cdiv id=\"R2-APP-PSQL-CONNECTING\"\u003e\u003ch3\u003eConnecting to a Database\u003c/h3\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e is a regular\n    \u003cspan\u003ePostgreSQL\u003c/span\u003e client application. In order\n    to connect to a database you need to know the name of your target\n    database, the host name and port number of the server, and what\n    database user name you want to connect as. \u003cspan\u003epsql\u003c/span\u003e\n    can be told about those parameters via command line options, namely\n    \u003ccode\u003e-d\u003c/code\u003e, \u003ccode\u003e-h\u003c/code\u003e, \u003ccode\u003e-p\u003c/code\u003e, and\n    \u003ccode\u003e-U\u003c/code\u003e respectively. If an argument is found that does\n    not belong to any option it will be interpreted as the database name\n    (or the database user name, if the database name is already given). Not all\n    of these options are required; there are useful defaults. If you omit the host\n    name, \u003cspan\u003epsql\u003c/span\u003e will connect via a Unix-domain socket\n    to a server on the local host, or via TCP/IP to \u003ccode\u003elocalhost\u003c/code\u003e on\n    Windows. The default port number is\n    determined at compile time.\n    Since the database server uses the same default, you will not have\n    to specify the port in most cases. The default database user name is your\n    operating-system user name. Once the database user name is determined, it\n    is used as the default database name.\n    Note that you cannot\n    just connect to any database under any database user name. Your database\n    administrator should have informed you about your access rights.\n    \u003c/p\u003e\u003cp\u003e\n    When the defaults aren\u0026#39;t quite right, you can save yourself\n    some typing by setting the environment variables\n    \u003ccode\u003ePGDATABASE\u003c/code\u003e, \u003ccode\u003ePGHOST\u003c/code\u003e,\n    \u003ccode\u003ePGPORT\u003c/code\u003e and/or \u003ccode\u003ePGUSER\u003c/code\u003e to appropriate\n    values. (For additional environment variables, see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e.) It is also convenient to have a\n    \u003ccode\u003e~/.pgpass\u003c/code\u003e file to avoid regularly having to type in\n    passwords. See \u003ca href=\"/docs/18/libpq-pgpass.html\" rel=\"nofollow\"\u003eSection 32.16\u003c/a\u003e for more information.\n    \u003c/p\u003e\u003cp\u003e\n     An alternative way to specify connection parameters is in a\n     \u003cem\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string or\n     a URI, which is used instead of a database\n     name. This mechanism give you very wide control over the\n     connection. For example:\n\u003c/p\u003e\u003cpre\u003e$ \u003cstrong\u003e\u003ccode\u003epsql \u0026#34;service=myservice sslmode=require\u0026#34;\u003c/code\u003e\u003c/strong\u003e\n$ \u003cstrong\u003e\u003ccode\u003epsql postgresql://dbmaster:5433/mydb?sslmode=require\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n     This way you can also use LDAP for connection\n     parameter lookup as described in \u003ca href=\"/docs/18/libpq-ldap.html\" rel=\"nofollow\"\u003eSection 32.18\u003c/a\u003e.\n     See \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" rel=\"nofollow\"\u003eSection 32.1.2\u003c/a\u003e for more information on all the\n     available connection options.\n    \u003c/p\u003e\u003cp\u003e\n    If the connection could not be made for any reason (e.g., insufficient\n    privileges, server is not running on the targeted host, etc.),\n    \u003cspan\u003epsql\u003c/span\u003e will return an error and terminate.\n    \u003c/p\u003e\u003cp\u003e\n     If both standard input and standard output are a\n     terminal, then \u003cspan\u003epsql\u003c/span\u003e sets the client\n     encoding to \u003cspan\u003e“\u003cspan\u003eauto\u003c/span\u003e”\u003c/span\u003e, which will detect the\n     appropriate client encoding from the locale settings\n     (\u003ccode\u003eLC_CTYPE\u003c/code\u003e environment variable on Unix systems).\n     If this doesn\u0026#39;t work out as expected, the client encoding can be\n     overridden using the environment\n     variable \u003ccode\u003ePGCLIENTENCODING\u003c/code\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"R2-APP-PSQL-4\"\u003e\u003ch3\u003eEntering SQL Commands\u003c/h3\u003e\u003cp\u003e\n    In normal operation, \u003cspan\u003epsql\u003c/span\u003e provides a\n    prompt with the name of the database to which\n    \u003cspan\u003epsql\u003c/span\u003e is currently connected, followed by\n    the string \u003ccode\u003e=\u0026gt;\u003c/code\u003e. For example:\n\u003c/p\u003e\u003cpre\u003e$ \u003cstrong\u003e\u003ccode\u003epsql testdb\u003c/code\u003e\u003c/strong\u003e\npsql (18.7)\nType \u0026#34;help\u0026#34; for help.\n\ntestdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    At the prompt, the user can type in SQL commands.\n    Ordinarily, input lines are sent to the server when a\n    command-terminating semicolon is reached. An end of line does not\n    terminate a command.  Thus commands can be spread over several lines for\n    clarity. If the command was sent and executed without error, the results\n    of the command are displayed on the screen.\n    \u003c/p\u003e\u003cp\u003e\n    If untrusted users have access to a database that has not adopted a\n    \u003ca href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" rel=\"nofollow\"\u003esecure schema usage pattern\u003c/a\u003e,\n    begin your session by removing publicly-writable schemas\n    from \u003ccode\u003esearch_path\u003c/code\u003e.  One can\n    add \u003ccode\u003eoptions=-csearch_path=\u003c/code\u003e to the connection string or\n    issue \u003ccode\u003eSELECT pg_catalog.set_config(\u0026#39;search_path\u0026#39;, \u0026#39;\u0026#39;,\n    false)\u003c/code\u003e before other SQL commands.  This consideration is not\n    specific to \u003cspan\u003epsql\u003c/span\u003e; it applies to every interface\n    for executing arbitrary SQL commands.\n    \u003c/p\u003e\u003cp\u003e\n    Whenever a command is executed, \u003cspan\u003epsql\u003c/span\u003e also polls\n    for asynchronous notification events generated by\n    \u003ca href=\"/docs/18/sql-listen.html\" title=\"LISTEN\" rel=\"nofollow\"\u003e\u003ccode\u003eLISTEN\u003c/code\u003e\u003c/a\u003e and\n    \u003ca href=\"/docs/18/sql-notify.html\" title=\"NOTIFY\" rel=\"nofollow\"\u003e\u003ccode\u003eNOTIFY\u003c/code\u003e\u003c/a\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    While C-style block comments are passed to the server for\n    processing and removal, SQL-standard comments are removed by\n    \u003cspan\u003epsql\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-META-COMMANDS\"\u003e\u003ch3\u003eMeta-Commands\u003c/h3\u003e\u003cp\u003e\n    Anything you enter in \u003cspan\u003epsql\u003c/span\u003e that begins\n    with an unquoted backslash is a \u003cspan\u003epsql\u003c/span\u003e\n    meta-command that is processed by \u003cspan\u003epsql\u003c/span\u003e\n    itself. These commands make\n    \u003cspan\u003epsql\u003c/span\u003e more useful for administration or\n    scripting. Meta-commands are often called slash or backslash commands.\n    \u003c/p\u003e\u003cp\u003e\n    The format of a \u003cspan\u003epsql\u003c/span\u003e command is the backslash,\n    followed immediately by a command verb, then any arguments. The arguments\n    are separated from the command verb and each other by any number of\n    whitespace characters.\n    \u003c/p\u003e\u003cp\u003e\n    To include whitespace in an argument you can quote it with\n    single quotes. To include a single quote in an argument,\n    write two single quotes within single-quoted text.\n    Anything contained in single quotes is\n    furthermore subject to C-like substitutions for\n    \u003ccode\u003e\\n\u003c/code\u003e (new line), \u003ccode\u003e\\t\u003c/code\u003e (tab),\n    \u003ccode\u003e\\b\u003c/code\u003e (backspace), \u003ccode\u003e\\r\u003c/code\u003e (carriage return),\n    \u003ccode\u003e\\f\u003c/code\u003e (form feed),\n    \u003ccode\u003e\\\u003c/code\u003e\u003cem\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (octal), and\n    \u003ccode\u003e\\x\u003c/code\u003e\u003cem\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (hexadecimal).\n    A backslash preceding any other character within single-quoted text\n    quotes that single character, whatever it is.\n    \u003c/p\u003e\u003cp\u003e\n    If an unquoted colon (\u003ccode\u003e:\u003c/code\u003e) followed by a\n    \u003cspan\u003epsql\u003c/span\u003e variable name appears within an argument, it is\n    replaced by the variable\u0026#39;s value, as described in \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\" rel=\"nofollow\"\u003eSQL Interpolation\u003c/a\u003e below.\n    The forms \u003ccode\u003e:\u0026#39;\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u0026#39;\u003c/code\u003e and\n    \u003ccode\u003e:\u0026#34;\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u0026#34;\u003c/code\u003e described there\n    work as well.\n    The \u003ccode\u003e:{?\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e syntax allows\n    testing whether a variable is defined. It is substituted by\n    TRUE or FALSE.\n    Escaping the colon with a backslash protects it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    Within an argument, text that is enclosed in backquotes\n    (\u003ccode\u003e`\u003c/code\u003e) is taken as a command line that is passed to the\n    shell.  The output of the command (with any trailing newline removed)\n    replaces the backquoted text.  Within the text enclosed in backquotes,\n    no special quoting or other processing occurs, except that appearances\n    of \u003ccode\u003e:\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e where\n    \u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e is a \u003cspan\u003epsql\u003c/span\u003e variable name\n    are replaced by the variable\u0026#39;s value.  Also, appearances of\n    \u003ccode\u003e:\u0026#39;\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u0026#39;\u003c/code\u003e are replaced by the\n    variable\u0026#39;s value suitably quoted to become a single shell command\n    argument.  (The latter form is almost always preferable, unless you are\n    very sure of what is in the variable.)  Because carriage return and line\n    feed characters cannot be safely quoted on all platforms, the\n    \u003ccode\u003e:\u0026#39;\u003cem\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u0026#39;\u003c/code\u003e form prints an\n    error message and does not substitute the variable value when such\n    characters appear in the value.\n    \u003c/p\u003e\u003cp\u003e\n    Some commands take an SQL identifier (such as a\n    table name) as argument. These arguments follow the syntax rules\n    of SQL: Unquoted letters are forced to\n    lowercase, while double quotes (\u003ccode\u003e\u0026#34;\u003c/code\u003e) protect letters\n    from case conversion and allow incorporation of whitespace into\n    the identifier.  Within double quotes, paired double quotes reduce\n    to a single double quote in the resulting name.  For example,\n    \u003ccode\u003eFOO\u0026#34;BAR\u0026#34;BAZ\u003c/code\u003e is interpreted as \u003ccode\u003efooBARbaz\u003c/code\u003e,\n    and \u003ccode\u003e\u0026#34;A weird\u0026#34;\u0026#34; name\u0026#34;\u003c/code\u003e becomes \u003ccode\u003eA weird\u0026#34;\n    name\u003c/code\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    Parsing for arguments stops at the end of the line, or when another\n    unquoted backslash is found.  An unquoted backslash\n    is taken as the beginning of a new meta-command. The special\n    sequence \u003ccode\u003e\\\\\u003c/code\u003e (two backslashes) marks the end of\n    arguments and continues parsing SQL commands, if\n    any. That way SQL and\n    \u003cspan\u003epsql\u003c/span\u003e commands can be freely mixed on a\n    line. But in any case, the arguments of a meta-command cannot\n    continue beyond the end of the line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands act on the \u003cem\u003ecurrent query buffer\u003c/em\u003e.\n    This is simply a buffer holding whatever SQL command text has been typed\n    but not yet sent to the server for execution.  This will include previous\n    input lines as well as any text appearing before the meta-command on the\n    same line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands also allow \u003ccode\u003ex\u003c/code\u003e to be appended\n    as an option. This will cause the results to be displayed in expanded\n    mode, as if \u003ccode\u003e\\x\u003c/code\u003e or \u003ccode\u003e\\pset expanded\u003c/code\u003e\n    had been used.\n    \u003c/p\u003e\u003cp\u003e\n    The following meta-commands are defined:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-A\"\u003e\u003cspan\u003e\u003ccode\u003e\\a\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If the current table output format is unaligned, it is switched to aligned.\n        If it is not unaligned, it is set to unaligned. This command is\n        kept for backwards compatibility. See \u003ccode\u003e\\pset\u003c/code\u003e for a\n        more general solution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND\"\u003e\u003cspan\u003e\u003ccode\u003e\\bind\u003c/code\u003e [ \u003cem\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sets query parameters for the next query execution, with the\n         specified parameters passed for any parameter placeholders\n         (\u003ccode\u003e$1\u003c/code\u003e etc.).\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre\u003eINSERT INTO tbl1 VALUES ($1, $2) \\bind \u0026#39;first value\u0026#39; \u0026#39;second value\u0026#39; \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This also works for query-execution commands besides\n         \u003ccode\u003e\\g\u003c/code\u003e, such as \u003ccode\u003e\\gx\u003c/code\u003e and\n         \u003ccode\u003e\\gset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see \u003ca href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" rel=\"nofollow\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol.  So this command can be useful to test the extended\n         query protocol from \u003cspan\u003epsql\u003c/span\u003e.  (The extended\n         query protocol is used even if the query has no parameters and this\n         command specifies zero parameters.)  This command affects only the\n         next query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"\u003e\u003cspan\u003e\u003ccode\u003e\\bind_named\u003c/code\u003e \u003cem\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode\u003e\\bind_named\u003c/code\u003e is equivalent to \u003ccode\u003e\\bind\u003c/code\u003e,\n         except that it takes the name of an existing prepared statement as\n         first parameter. An empty string denotes the unnamed prepared\n         statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre\u003eINSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 \u0026#39;first value\u0026#39; \u0026#39;second value\u0026#39; \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see\n         \u003ca href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" rel=\"nofollow\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol. So this command can be useful to test the extended\n         query protocol from \u003cspan\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\c\u003c/code\u003e or \u003ccode\u003e\\connect [ -reuse-previous=\u003cem\u003e\u003ccode\u003eon|off\u003c/code\u003e\u003c/em\u003e ] [ \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ] [ \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e ] [ \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e ] | \u003cem\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Establishes a new connection to a \u003cspan\u003ePostgreSQL\u003c/span\u003e\n        server.  The connection parameters to use can be specified either\n        using a positional syntax (one or more of database name, user,\n        host, and port), or using a \u003cem\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        connection string as detailed in\n        \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003eSection 32.1.1\u003c/a\u003e.  If no arguments are given, a\n        new connection is made using the same parameters as before.\n        \u003c/p\u003e\u003cp\u003e\n        Specifying any\n        of \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e,\n        \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e,\n        \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e or\n        \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\n        as \u003ccode\u003e-\u003c/code\u003e is equivalent to omitting that parameter.\n        \u003c/p\u003e\u003cp\u003e\n        The new connection can re-use connection parameters from the previous\n        connection; not only database name, user, host, and port, but other\n        settings such as \u003cem\u003e\u003ccode\u003esslmode\u003c/code\u003e\u003c/em\u003e.  By default,\n        parameters are re-used in the positional syntax, but not when\n        a \u003cem\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string is given.  Passing a\n        first argument of \u003ccode\u003e-reuse-previous=on\u003c/code\u003e\n        or \u003ccode\u003e-reuse-previous=off\u003c/code\u003e overrides that default.  If\n        parameters are re-used, then any parameter not explicitly specified as\n        a positional parameter or in the \u003cem\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        string is taken from the existing connection\u0026#39;s parameters.  An\n        exception is that if the \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e setting\n        is changed from its previous value using the positional syntax,\n        any \u003cem\u003e\u003ccode\u003ehostaddr\u003c/code\u003e\u003c/em\u003e setting present in the\n        existing connection\u0026#39;s parameters is dropped.\n        Also, any password used for the existing connection will be re-used\n        only if the user, host, and port settings are not changed.\n        When the command neither specifies nor reuses a particular parameter,\n        the \u003cspan\u003elibpq\u003c/span\u003e default is used.\n        \u003c/p\u003e\u003cp\u003e\n        If the new connection is successfully made, the previous\n        connection is closed.\n        If the connection attempt fails (wrong user name, access\n        denied, etc.), the previous connection will be kept if\n        \u003cspan\u003epsql\u003c/span\u003e is in interactive mode.  But when\n        executing a non-interactive script, the old connection is closed\n        and an error is reported.  That may or may not terminate the\n        script; if it does not, all database-accessing commands will fail\n        until another \u003ccode\u003e\\connect\u003c/code\u003e command is successfully\n        executed.  This distinction was chosen as\n        a user convenience against typos on the one hand, and a safety\n        mechanism that scripts are not accidentally acting on the\n        wrong database on the other hand.\n        Note that whenever a \u003ccode\u003e\\connect\u003c/code\u003e command attempts\n        to re-use parameters, the values re-used are those of the last\n        successful connection, not of any failed attempts made subsequently.\n        However, in the case of a\n        non-interactive \u003ccode\u003e\\connect\u003c/code\u003e failure, no parameters\n        are allowed to be re-used later, since the script would likely be\n        expecting the values from the failed \u003ccode\u003e\\connect\u003c/code\u003e\n        to be re-used.\n        \u003c/p\u003e\u003cp\u003e\n        Examples:\n        \u003c/p\u003e\u003cpre\u003e=\u0026gt; \\c mydb myuser host.dom 6432\n=\u0026gt; \\c service=foo\n=\u0026gt; \\c \u0026#34;host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\u0026#34;\n=\u0026gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=\u0026gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\C [ \u003cem\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the title of any tables being printed as the result of a\n        query or unset any such title. This command is equivalent to\n        \u003ccode\u003e\\pset title \u003cem\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. (The name of\n        this command derives from \u003cspan\u003e“\u003cspan\u003ecaption\u003c/span\u003e”\u003c/span\u003e, as it was\n        previously only used to set the caption in an\n        HTML table.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CD\"\u003e\u003cspan\u003e\u003ccode\u003e\\cd [ \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Changes the current working directory to\n         \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e. Without argument, changes\n         to the current user\u0026#39;s home directory.  For details on how home\n         directories are found, see \u003ca href=\"/docs/18/libpq-pgpass.html\" rel=\"nofollow\"\u003eSection 32.16\u003c/a\u003e.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n          To print your current working directory, use \u003ccode\u003e\\! pwd\u003c/code\u003e.\n         \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"\u003e\u003cspan\u003e\u003ccode\u003e\\close_prepared\u003c/code\u003e \u003cem\u003e\u003ccode\u003eprepared_statement_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Closes the specified prepared statement. An empty string denotes the\n         unnamed prepared statement. If no prepared statement exists with this\n         name, the operation is a no-op.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre\u003eSELECT $1 \\parse stmt1\n\\close_prepared stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used,\n         unlike normal \u003cspan\u003epsql\u003c/span\u003e operation, which\n         uses the simple query protocol. So this command can be useful\n         to test the extended query protocol from\n         \u003cspan\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CONNINFO\"\u003e\u003cspan\u003e\u003ccode\u003e\\conninfo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Outputs information about the current database connection,\n          including SSL-related information if SSL is in use.\n         \u003c/p\u003e\u003cp\u003e\n          Note that the \u003ccode\u003eClient User\u003c/code\u003e field shows\n          the user at the time of connection, while the\n          \u003ccode\u003eSuperuser\u003c/code\u003e field indicates whether\n          the current user (in the current execution context) has\n          superuser privileges. These users are usually the same, but they can\n          differ, for example, if the current user was changed with the\n          \u003ccode\u003eSET ROLE\u003c/code\u003e command.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-COPY\"\u003e\u003cspan\u003e\u003ccode\u003e\\copy { \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] }\n        \u003ccode\u003efrom\u003c/code\u003e\n        { \u003cem\u003e\u003ccode\u003e\u0026#39;filename\u0026#39;\u003c/code\u003e\u003c/em\u003e | program \u003cem\u003e\u003ccode\u003e\u0026#39;command\u0026#39;\u003c/code\u003e\u003c/em\u003e | stdin | pstdin }\n        [ [ with ] ( \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\n        [ where \u003cem\u003e\u003ccode\u003econdition\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\copy { \u003cem\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] | ( \u003cem\u003e\u003ccode\u003equery\u003c/code\u003e\u003c/em\u003e ) }\n        \u003ccode\u003eto\u003c/code\u003e\n        { \u003cem\u003e\u003ccode\u003e\u0026#39;filename\u0026#39;\u003c/code\u003e\u003c/em\u003e | program \u003cem\u003e\u003ccode\u003e\u0026#39;command\u0026#39;\u003c/code\u003e\u003c/em\u003e | stdout | pstdout }\n        [ [ with ] ( \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs a frontend (client) copy. This is an operation that\n        runs an SQL \u003ca href=\"/docs/18/sql-copy.html\" title=\"COPY\" rel=\"nofollow\"\u003e\u003ccode\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command, but instead of the server\n        reading or writing the specified file,\n        \u003cspan\u003epsql\u003c/span\u003e reads or writes the file and\n        routes the data between the server and the local file system.\n        This means that file accessibility and privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        When \u003ccode\u003eprogram\u003c/code\u003e is specified,\n        \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        executed by \u003cspan\u003epsql\u003c/span\u003e and the data passed from\n        or to \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        routed between the server and the client.\n        Again, the execution privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        For \u003ccode\u003e\\copy ... from stdin\u003c/code\u003e, data rows are read from the same\n        source that issued the command, continuing until a line containing\n        only \u003ccode\u003e\\.\u003c/code\u003e\n        is read or the stream reaches EOF. This option is useful\n        for populating tables in-line within an SQL script file.\n        For \u003ccode\u003e\\copy ... to stdout\u003c/code\u003e, output is sent to the same place\n        as \u003cspan\u003epsql\u003c/span\u003e command output, and\n        the \u003ccode\u003eCOPY \u003cem\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e command status is\n        not printed (since it might be confused with a data row).\n        To read/write \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s standard input or\n        output regardless of the current command source or \u003ccode\u003e\\o\u003c/code\u003e\n        option, write \u003ccode\u003efrom pstdin\u003c/code\u003e or \u003ccode\u003eto pstdout\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The syntax of this command is similar to that of the\n        SQL \u003ca href=\"/docs/18/sql-copy.html\" title=\"COPY\" rel=\"nofollow\"\u003e\u003ccode\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command.  All options other than the data source/destination are\n        as specified for \u003ccode\u003eCOPY\u003c/code\u003e.\n        Because of this, special parsing rules apply to the \u003ccode\u003e\\copy\u003c/code\u003e\n        meta-command.  Unlike most other meta-commands, the entire remainder\n        of the line is always taken to be the arguments of \u003ccode\u003e\\copy\u003c/code\u003e,\n        and neither variable interpolation nor backquote expansion are\n        performed in the arguments.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Another way to obtain the same result as \u003ccode\u003e\\copy\n        ... to\u003c/code\u003e is to use the SQL \u003ccode\u003eCOPY\n        ... TO STDOUT\u003c/code\u003e command and terminate it\n        with \u003ccode\u003e\\g \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\n        or \u003ccode\u003e\\g |\u003cem\u003e\u003ccode\u003eprogram\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        Unlike \u003ccode\u003e\\copy\u003c/code\u003e, this method allows the command to\n        span multiple lines; also, variable interpolation and backquote\n        expansion can be used.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        These operations are not as efficient as the SQL\n\u003ccode\u003eCOPY\u003c/code\u003e command with a file or program data source or\n        destination, because all data must pass through the client/server\n        connection.  For large amounts of data the SQL\n        command might be preferable.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"\u003e\u003cspan\u003e\u003ccode\u003e\\copyright\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the copyright and distribution terms of\n        \u003cspan\u003ePostgreSQL\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan\u003e\u003ccode\u003e\\crosstabview [\n            \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode\u003ex\u003c/code\u003e\n        of \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode\u003ey\u003c/code\u003e\n        of \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode\u003ex\u003c/code\u003e and the value\n        of \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-D\"\u003e\u003cspan\u003e\u003ccode\u003e\\d[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        For each relation (table, view, materialized view, index, sequence,\n        or foreign table)\n        or composite type matching the\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, show all\n        columns, their types, the tablespace (if not the default) and any\n        special attributes such as \u003ccode\u003eNOT NULL\u003c/code\u003e or defaults.\n        Associated indexes, constraints, rules, and triggers are\n        also shown.  For foreign tables, the associated foreign\n        server is shown as well.\n        (\u003cspan\u003e“\u003cspan\u003eMatching the pattern\u003c/span\u003e”\u003c/span\u003e is defined in\n        \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003ePatterns\u003c/a\u003e below.)\n        \u003c/p\u003e\u003cp\u003e\n        For some types of relation, \u003ccode\u003e\\d\u003c/code\u003e shows additional information\n        for each column: column values for sequences, indexed expressions for\n        indexes, and foreign data wrapper options for foreign tables.\n        \u003c/p\u003e\u003cp\u003e\n        The command form \u003ccode\u003e\\d+\u003c/code\u003e is identical, except that\n        more information is displayed: any comments associated with the\n        columns of the table are shown, as is the presence of OIDs in the\n        table, the view definition if the relation is a view, a non-default\n        \u003ca href=\"/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\" rel=\"nofollow\"\u003ereplica\n         identity\u003c/a\u003e setting and the\n        \u003ca href=\"/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\" rel=\"nofollow\"\u003eaccess method\u003c/a\u003e name\n        if the relation has an access method.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If \u003ccode\u003e\\d\u003c/code\u003e is used without a\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e argument, it is\n        equivalent to \u003ccode\u003e\\dtvmsE\u003c/code\u003e which will show a list of\n        all visible tables, views, materialized views, sequences and\n        foreign tables.\n        This is purely a convenience measure.\n        \u003c/p\u003e\u003cp\u003e\n        As with many other commands, if \u003ccode\u003ex\u003c/code\u003e is appended to\n        the command name, the results are displayed in expanded mode for this\n        command only, but note that this only applies when \u003ccode\u003e\\d\u003c/code\u003e\n        is used without a \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        argument or to describe a sequence.\n        The same limitation on expanded output applies to\n        \u003ccode\u003e\\x on\u003c/code\u003e and \u003ccode\u003e\\x auto\u003c/code\u003e.\n        The \u003ccode\u003ex\u003c/code\u003e modifier cannot appear immediately after the\n        \u003ccode\u003e\\d\u003c/code\u003e (because \u003ccode\u003e\\dx\u003c/code\u003e is a different\n        command); the \u003ccode\u003ex\u003c/code\u003e modifier may only appear after an\n        \u003ccode\u003eS\u003c/code\u003e or \u003ccode\u003e+\u003c/code\u003e modifier. For example,\n        \u003ccode\u003e\\d+x\u003c/code\u003e is equivalent to \u003ccode\u003e\\dtvmsE+x\u003c/code\u003e\n        and will show a list of all relations in expanded mode.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\da[Sx] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists aggregate functions, together with their\n        return type and the data types they operate on. If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only aggregates whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dA[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists access methods. If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only access\n        methods whose names match the pattern are shown.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each access\n        method is listed with its associated handler function and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAC\"\u003e\u003cspan\u003e\n\u003ccode\u003e\\dAc[x+]\n            [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator classes\n        (see \u003ca href=\"/docs/18/xindex.html#XINDEX-OPCLASS\" rel=\"nofollow\"\u003eSection 36.16.1\u003c/a\u003e).\n        If \u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each operator\n        class is listed with its associated operator family and owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAF\"\u003e\u003cspan\u003e\n\u003ccode\u003e\\dAf[x+]\n            [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator families\n        (see \u003ca href=\"/docs/18/xindex.html#XINDEX-OPFAMILY\" rel=\"nofollow\"\u003eSection 36.16.5\u003c/a\u003e).\n        If \u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each operator\n        family is listed with its owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAO\"\u003e\u003cspan\u003e\n\u003ccode\u003e\\dAo[x+]\n            [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators associated with operator families\n        (see \u003ca href=\"/docs/18/xindex.html#XINDEX-STRATEGIES\" rel=\"nofollow\"\u003eSection 36.16.2\u003c/a\u003e).\n        If \u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families associated with access\n        methods whose names match that pattern are listed.\n        If \u003cem\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families whose names match that\n        pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each operator\n        is listed with its sort operator family (if it is an ordering operator),\n        and whether its underlying function is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAP\"\u003e\u003cspan\u003e\n\u003ccode\u003e\\dAp[x+]\n            [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists support functions associated with operator families\n        (see \u003ca href=\"/docs/18/xindex.html#XINDEX-SUPPORT\" rel=\"nofollow\"\u003eSection 36.16.3\u003c/a\u003e).\n        If \u003cem\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families associated with\n        access methods whose names match that pattern are listed.\n        If \u003cem\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families whose names match\n        that pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, functions are\n        displayed verbosely, with their actual parameter lists.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DB\"\u003e\u003cspan\u003e\u003ccode\u003e\\db[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tablespaces. If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only tablespaces whose names match the pattern are shown.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each tablespace\n        is listed with its associated options, on-disk size, permissions and\n        description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dc[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists conversions between character-set encodings.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only conversions whose names match the pattern are\n        listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DCONFIG\"\u003e\u003cspan\u003e\u003ccode\u003e\\dconfig[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists server configuration parameters and their values.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only parameters whose names match the pattern are listed.  Without\n        a \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, only\n        parameters that are set to non-default values are listed.\n        (Use \u003ccode\u003e\\dconfig *\u003c/code\u003e to see all parameters.)\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each\n        parameter is listed with its data type, context in which the\n        parameter can be set, and access privileges (if non-default access\n        privileges have been granted).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dC[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists type casts.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only casts whose source or target types match the\n        pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional\n        information about each cast is shown, including whether its underlying\n        function is leakproof, and the cast\u0026#39;s description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dd[Sx] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the descriptions of objects of type \u003ccode\u003econstraint\u003c/code\u003e,\n        \u003ccode\u003eoperator class\u003c/code\u003e, \u003ccode\u003eoperator family\u003c/code\u003e,\n        \u003ccode\u003erule\u003c/code\u003e, and \u003ccode\u003etrigger\u003c/code\u003e. All\n        other comments may be viewed by the respective backslash commands for\n        those object types.\n        \u003c/p\u003e\u003cp\u003e\u003ccode\u003e\\dd\u003c/code\u003e displays descriptions for objects matching the\n        \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or of visible\n        objects of the appropriate type if no argument is given.  But in either\n        case, only objects that have a description are listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        Descriptions for objects can be created with the \u003ca href=\"/docs/18/sql-comment.html\" title=\"COMMENT\" rel=\"nofollow\"\u003e\u003ccode\u003eCOMMENT\u003c/code\u003e\u003c/a\u003e\nSQL command.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dD[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists domains. If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only domains whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DDP\"\u003e\u003cspan\u003e\u003ccode\u003e\\ddp[x] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists default access privilege settings.  An entry is shown for\n        each role (and schema, if applicable) for which the default\n        privilege settings have been changed from the built-in defaults.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose role name or schema name matches\n        the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca href=\"/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\" rel=\"nofollow\"\u003e\u003ccode\u003eALTER DEFAULT\n        PRIVILEGES\u003c/code\u003e\u003c/a\u003e command is used to set default access\n        privileges.  The meaning of the privilege display is explained in\n        \u003ca href=\"/docs/18/ddl-priv.html\" rel=\"nofollow\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DE\"\u003e\u003cspan\u003e\u003ccode\u003e\\dE[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\di[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\dm[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\ds[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\dt[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\dv[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In this group of commands, the letters \u003ccode\u003eE\u003c/code\u003e,\n        \u003ccode\u003ei\u003c/code\u003e, \u003ccode\u003em\u003c/code\u003e, \u003ccode\u003es\u003c/code\u003e,\n        \u003ccode\u003et\u003c/code\u003e, and \u003ccode\u003ev\u003c/code\u003e\n        stand for foreign table, index, materialized view,\n        sequence, table, and view,\n        respectively.\n        You can specify any or all of\n        these letters, in any order, to obtain a listing of objects\n        of these types.  For example, \u003ccode\u003e\\dti\u003c/code\u003e lists\n        tables and indexes.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is\n        appended to the command name, each object is listed with its\n        persistence status (permanent, temporary, or unlogged),\n        physical size on disk, and associated description if any.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only objects whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DES\"\u003e\u003cspan\u003e\u003ccode\u003e\\des[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign servers (mnemonic: \u003cspan\u003e“\u003cspan\u003eexternal\n        servers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those servers whose name matches the pattern\n        are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, a\n        full description of each server is shown, including the\n        server\u0026#39;s access privileges, type, version, options, and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DET\"\u003e\u003cspan\u003e\u003ccode\u003e\\det[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign tables (mnemonic: \u003cspan\u003e“\u003cspan\u003eexternal tables\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose table name or schema name matches\n        the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        generic options and the foreign table description\n        are also displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEU\"\u003e\u003cspan\u003e\u003ccode\u003e\\deu[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists user mappings (mnemonic: \u003cspan\u003e“\u003cspan\u003eexternal\n        users\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those mappings whose user names match the\n        pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each mapping is shown.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eCaution\u003c/h3\u003e\u003cp\u003e\n\u003ccode\u003e\\deu+\u003c/code\u003e might also display the user name and\n        password of the remote user, so care should be taken not to\n        disclose them.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEW\"\u003e\u003cspan\u003e\u003ccode\u003e\\dew[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign-data wrappers (mnemonic: \u003cspan\u003e“\u003cspan\u003eexternal\n        wrappers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those foreign-data wrappers whose name matches\n        the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        the access privileges, options, and description of the\n        foreign-data wrapper are also shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\df[anptwSx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ... ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists functions, together with their result data types, argument data\n        types, and function types, which are classified as \u003cspan\u003e“\u003cspan\u003eagg\u003c/span\u003e”\u003c/span\u003e\n        (aggregate), \u003cspan\u003e“\u003cspan\u003enormal\u003c/span\u003e”\u003c/span\u003e, \u003cspan\u003e“\u003cspan\u003eprocedure\u003c/span\u003e”\u003c/span\u003e, \u003cspan\u003e“\u003cspan\u003etrigger\u003c/span\u003e”\u003c/span\u003e, or \u003cspan\u003e“\u003cspan\u003ewindow\u003c/span\u003e”\u003c/span\u003e.\n        To display only functions\n        of specific type(s), add the corresponding letters \u003ccode\u003ea\u003c/code\u003e,\n        \u003ccode\u003en\u003c/code\u003e, \u003ccode\u003ep\u003c/code\u003e, \u003ccode\u003et\u003c/code\u003e, or \u003ccode\u003ew\u003c/code\u003e to the command.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only\n        functions whose names match the pattern are shown.\n        Any additional arguments are type-name patterns, which are matched\n        to the type names of the first, second, and so on arguments of the\n        function.  (Matching functions can have more arguments than what\n        you specify.  To prevent that, write a dash \u003ccode\u003e-\u003c/code\u003e as\n        the last \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e.)\n        By default, only user-created\n        objects are shown; supply a pattern or the \u003ccode\u003eS\u003c/code\u003e\n        modifier to include system objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional information\n        about each function is shown, including volatility,\n        parallel safety, owner, security classification, whether it is\n        leakproof, access privileges, language, internal name (for C and\n        internal functions only), and description.\n        Source code for a specific function can be seen\n        using \u003ccode\u003e\\sf\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dF[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search configurations.\n         If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only configurations whose names match the pattern are shown.\n         If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each configuration is shown, including the underlying text search\n         parser and the dictionary list for each parser token type.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFD\"\u003e\u003cspan\u003e\u003ccode\u003e\\dFd[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search dictionaries.\n         If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only dictionaries whose names match the pattern are shown.\n         If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each selected dictionary, including the underlying\n         text search template and the option values.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFP\"\u003e\u003cspan\u003e\u003ccode\u003e\\dFp[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search parsers.\n         If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only parsers whose names match the pattern are shown.\n         If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each parser is shown, including the underlying functions and the\n         list of recognized token types.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFT\"\u003e\u003cspan\u003e\u003ccode\u003e\\dFt[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search templates.\n         If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only templates whose names match the pattern are shown.\n         If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each template, including the underlying function names.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DG\"\u003e\u003cspan\u003e\u003ccode\u003e\\dg[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan\u003e“\u003cspan\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan\u003e“\u003cspan\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan\u003e“\u003cspan\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode\u003e\\du\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dl[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This is an alias for \u003ccode\u003e\\lo_list\u003c/code\u003e, which shows a\n        list of large objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dL[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists procedural languages. If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only languages whose names match the pattern are listed.\n        By default, only user-created languages\n        are shown; supply the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each\n        language is listed with its call handler, validator, access privileges,\n        and whether it is a system object.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DN\"\u003e\u003cspan\u003e\u003ccode\u003e\\dn[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists schemas (namespaces). If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only schemas whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description, if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\do[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators with their operand and result types.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only operators whose names match the pattern are listed.\n        If one \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only prefix operators whose right argument\u0026#39;s type name\n        matches that pattern are listed.\n        If two \u003cem\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003es\n        are specified, only binary operators whose argument type names match\n        those patterns are listed.  (Alternatively, write \u003ccode\u003e-\u003c/code\u003e\n        for the unused argument of a unary operator.)\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each operator is shown, including\n        the name of the underlying function, and whether it is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dO[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists collations.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only collations whose names match the pattern are\n        listed.  By default, only user-created objects are shown;\n        supply a pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to\n        include system objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended\n        to the command name, each collation is listed with its associated\n        description, if any.\n        Note that only collations usable with the current database\u0026#39;s encoding\n        are shown, so the results may vary in different databases of the\n        same installation.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dp[Sx] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\" rel=\"nofollow\"\u003e\u003ccode\u003eGRANT\u003c/code\u003e\u003c/a\u003e and\n        \u003ca href=\"/docs/18/sql-revoke.html\" title=\"REVOKE\" rel=\"nofollow\"\u003e\u003ccode\u003eREVOKE\u003c/code\u003e\u003c/a\u003e\n        commands are used to set access privileges.  The meaning of the\n        privilege display is explained in\n        \u003ca href=\"/docs/18/ddl-priv.html\" rel=\"nofollow\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dP[itnx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists partitioned relations.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only entries whose name matches the pattern are listed.\n        The modifiers \u003ccode\u003et\u003c/code\u003e (tables) and \u003ccode\u003ei\u003c/code\u003e\n        (indexes) can be appended to the command, filtering the kind of\n        relations to list.  By default, partitioned tables and indexes are\n        listed.\n        \u003c/p\u003e\u003cp\u003e\n        If the modifier \u003ccode\u003en\u003c/code\u003e (\u003cspan\u003e“\u003cspan\u003enested\u003c/span\u003e”\u003c/span\u003e) is used,\n        or a pattern is specified, then non-root partitioned relations are\n        included, and a column is shown displaying the parent of each\n        partitioned relation.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, the sum of the\n        sizes of each relation\u0026#39;s partitions is also displayed, along with the\n        relation\u0026#39;s description.\n        If \u003ccode\u003en\u003c/code\u003e is combined with \u003ccode\u003e+\u003c/code\u003e, two\n        sizes are shown: one including the total size of directly-attached\n        leaf partitions, and another showing the total size of all partitions,\n        including indirectly attached sub-partitions.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRDS\"\u003e\u003cspan\u003e\u003ccode\u003e\\drds[x] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists defined configuration settings.  These settings can be\n        role-specific, database-specific, or both.\n        \u003cem\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e and\n        \u003cem\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e are used to select\n        specific roles and databases to list, respectively.  If omitted, or if\n        \u003ccode\u003e*\u003c/code\u003e is specified, all settings are listed, including those\n        not role-specific or database-specific, respectively.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\" rel=\"nofollow\"\u003e\u003ccode\u003eALTER ROLE\u003c/code\u003e\u003c/a\u003e and\n        \u003ca href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\" rel=\"nofollow\"\u003e\u003ccode\u003eALTER DATABASE\u003c/code\u003e\u003c/a\u003e\n        commands are used to define per-role and per-database configuration\n        settings.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRG\"\u003e\u003cspan\u003e\u003ccode\u003e\\drg[Sx] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists information about each granted role membership, including\n        assigned options (\u003ccode\u003eADMIN\u003c/code\u003e,\n        \u003ccode\u003eINHERIT\u003c/code\u003e and/or \u003ccode\u003eSET\u003c/code\u003e) and grantor.\n        See the \u003ca href=\"/docs/18/sql-grant.html\" title=\"GRANT\" rel=\"nofollow\"\u003e\u003ccode\u003eGRANT\u003c/code\u003e\u003c/a\u003e\n        command for information about role memberships.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only grants to user-created roles are shown; supply the\n        \u003ccode\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only grants to those roles whose names match the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRP\"\u003e\u003cspan\u003e\u003ccode\u003e\\dRp[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication publications.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those publications whose names match the pattern are\n        listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, the tables and\n        schemas associated with each publication are shown as well.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRS\"\u003e\u003cspan\u003e\u003ccode\u003e\\dRs[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication subscriptions.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those subscriptions whose names match the pattern are\n        listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional\n        properties of the subscriptions are shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DT\"\u003e\u003cspan\u003e\u003ccode\u003e\\dT[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists data types.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only types whose names match the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each type is\n        listed with its internal name and size, its allowed values\n        if it is an \u003ccode\u003eenum\u003c/code\u003e type, and its associated permissions.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DU\"\u003e\u003cspan\u003e\u003ccode\u003e\\du[Sx+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan\u003e“\u003cspan\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan\u003e“\u003cspan\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan\u003e“\u003cspan\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode\u003e\\dg\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dx[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists installed extensions.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extensions whose names match the pattern\n        are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, all the objects belonging\n        to each matching extension are listed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\dX[x] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists extended statistics.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extended statistics whose names match the\n        pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The status of each kind of extended statistics is shown in a column\n        named after its statistic kind (e.g. Ndistinct).\n        \u003ccode\u003edefined\u003c/code\u003e means that it was requested when creating\n        the statistics, and NULL means it wasn\u0026#39;t requested.\n        You can use \u003ccode\u003epg_stats_ext\u003c/code\u003e if you\u0026#39;d like to\n        know whether \u003ca href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\" rel=\"nofollow\"\u003e\u003ccode\u003eANALYZE\u003c/code\u003e\u003c/a\u003e\n        was run and statistics are available to the planner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DY\"\u003e\u003cspan\u003e\u003ccode\u003e\\dy[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists event triggers.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those event triggers whose names match the pattern\n        are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan\u003e\u003ccode\u003e\\e\u003c/code\u003e or \u003ccode\u003e\\edit\u003c/code\u003e \u003ccode\u003e [\u003cspan\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file\u0026#39;s\n        content is copied into the current query buffer. If no \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\" rel=\"nofollow\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ECHO\"\u003e\u003cspan\u003e\u003ccode\u003e\\echo \u003cem\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prints the evaluated arguments to standard output, separated by\n        spaces and followed by a newline. This can be useful to\n        intersperse information in the output of scripts. For example:\n\u003c/p\u003e\u003cpre\u003e=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\echo `date`\u003c/code\u003e\u003c/strong\u003e\nTue Oct 26 21:40:57 CEST 1999\n\u003c/pre\u003e\u003cp\u003e\n        If the first argument is an unquoted \u003ccode\u003e-n\u003c/code\u003e the trailing\n        newline is not written (nor is the first argument).\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        If you use the \u003ccode\u003e\\o\u003c/code\u003e command to redirect your\n        query output you might wish to use \u003ccode\u003e\\qecho\u003c/code\u003e\n        instead of this command.  See also \u003ccode\u003e\\warn\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EF\"\u003e\u003cspan\u003e\u003ccode\u003e\\ef [\u003cspan\u003e \u003cem\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named function or procedure,\n         in the form of a \u003ccode\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode\u003e\\g\u003c/code\u003e to send it, or \u003ccode\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If no function is specified, a blank \u003ccode\u003eCREATE FUNCTION\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the function body.\n        (Note that the function body typically does not begin on the first\n        line of the file.)\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\ef\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\" rel=\"nofollow\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ENCODING\"\u003e\u003cspan\u003e\u003ccode\u003e\\encoding [ \u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the client character set encoding.  Without an argument, this command\n        shows the current encoding.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"\u003e\u003cspan\u003e\u003ccode\u003e\\errverbose\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeats the most recent server error message at maximum\n        verbosity, as though \u003ccode\u003eVERBOSITY\u003c/code\u003e were set\n        to \u003ccode\u003everbose\u003c/code\u003e and \u003ccode\u003eSHOW_CONTEXT\u003c/code\u003e were\n        set to \u003ccode\u003ealways\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EV\"\u003e\u003cspan\u003e\u003ccode\u003e\\ev [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e [\u003cspan\u003e \u003cem\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named view,\n         in the form of a \u003ccode\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode\u003e\\g\u003c/code\u003e to send it, or \u003ccode\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         If no view is specified, a blank \u003ccode\u003eCREATE VIEW\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n         If a line number is specified, \u003cspan\u003epsql\u003c/span\u003e will\n         position the cursor on the specified line of the view definition.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\ev\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-F\"\u003e\u003cspan\u003e\u003ccode\u003e\\f [ \u003cem\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the field separator for unaligned query output. The default\n        is the vertical bar (\u003ccode\u003e|\u003c/code\u003e). It is equivalent to\n        \u003ccode\u003e\\pset fieldsep\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-G\"\u003e\u003cspan\u003e\u003ccode\u003e\\g [ (\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\g [ (\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sends the current query buffer to the server for execution.\n        \u003c/p\u003e\u003cp\u003e\n        If parentheses appear after \u003ccode\u003e\\g\u003c/code\u003e, they surround a\n        space-separated list\n        of \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003ccode\u003e=\u003c/code\u003e\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        formatting-option clauses, which are interpreted in the same way\n        as \u003ccode\u003e\\pset\u003c/code\u003e\n\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e commands, but take\n        effect only for the duration of this query.  In this list, spaces are\n        not allowed around \u003ccode\u003e=\u003c/code\u003e signs, but are required\n        between option clauses.\n        If \u003ccode\u003e=\u003c/code\u003e\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        is omitted, the\n        named \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e is changed\n        in the same way as for\n        \u003ccode\u003e\\pset\u003c/code\u003e \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        with no explicit \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        If a \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\n        or \u003ccode\u003e|\u003c/code\u003e\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        argument is given, the query\u0026#39;s output is written to the named\n        file or piped to the given shell command, instead of displaying it as\n        usual.  The file or command is written to only if the query\n        successfully returns zero or more tuples, not if the query fails or\n        is a non-data-returning SQL command.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query is\n        re-executed instead.  Except for that behavior, \u003ccode\u003e\\g\u003c/code\u003e\n        without any arguments is essentially equivalent to a semicolon.\n        With arguments, \u003ccode\u003e\\g\u003c/code\u003e provides\n        a \u003cspan\u003e“\u003cspan\u003eone-shot\u003c/span\u003e”\u003c/span\u003e alternative to the \u003ccode\u003e\\o\u003c/code\u003e\n        command, and additionally allows one-shot adjustments of the\n        output formatting options normally set by \u003ccode\u003e\\pset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        When the last argument begins with \u003ccode\u003e|\u003c/code\u003e, the entire\n        remainder of the line is taken to be\n        the \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GDESC\"\u003e\u003cspan\u003e\u003ccode\u003e\\gdesc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Shows the description (that is, the column names and data types)\n         of the result of the current query buffer.  The query is not\n         actually executed; however, if it contains some type of syntax\n         error, that error will be reported in the normal way.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is described instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GETENV\"\u003e\u003cspan\u003e\u003ccode\u003e\\getenv \u003cem\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Gets the value of the environment\n         variable \u003cem\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\n         and assigns it to the \u003cspan\u003epsql\u003c/span\u003e\n         variable \u003cem\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e.\n         If \u003cem\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e is\n         not defined in the \u003cspan\u003epsql\u003c/span\u003e process\u0026#39;s\n         environment, \u003cem\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e\n         is not changed.  Example:\n\u003c/p\u003e\u003cpre\u003e=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\getenv home HOME\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\echo :home\u003c/code\u003e\u003c/strong\u003e\n/home/postgres\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GEXEC\"\u003e\u003cspan\u003e\u003ccode\u003e\\gexec\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server, then treats\n         each column of each row of the query\u0026#39;s output (if any) as an SQL\n         statement to be executed.  For example, to create an index on each\n         column of \u003ccode\u003emy_table\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003e=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT format(\u0026#39;create index on my_table(%I)\u0026#39;, attname)\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003eFROM pg_attribute\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003eWHERE attrelid = \u0026#39;my_table\u0026#39;::regclass AND attnum \u0026gt; 0\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003eORDER BY attnum\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\gexec\u003c/code\u003e\u003c/strong\u003e\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         The generated queries are executed in the order in which the rows\n         are returned, and left-to-right within each row if there is more\n         than one column.  NULL fields are ignored.  The generated queries\n         are sent literally to the server for processing, so they cannot be\n         \u003cspan\u003epsql\u003c/span\u003e meta-commands nor contain \u003cspan\u003epsql\u003c/span\u003e\n         variable references.  If any individual query fails, execution of\n         the remaining queries continues\n         unless \u003ccode\u003eON_ERROR_STOP\u003c/code\u003e is set.  Execution of each\n         query is subject to \u003ccode\u003eECHO\u003c/code\u003e processing.\n         (Setting \u003ccode\u003eECHO\u003c/code\u003e to \u003ccode\u003eall\u003c/code\u003e\n         or \u003ccode\u003equeries\u003c/code\u003e is often advisable when\n         using \u003ccode\u003e\\gexec\u003c/code\u003e.)  Query logging, single-step mode,\n         timing, and other query execution features apply to each generated\n         query as well.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GSET\"\u003e\u003cspan\u003e\u003ccode\u003e\\gset [ \u003cem\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server and stores the\n         query\u0026#39;s output into \u003cspan\u003epsql\u003c/span\u003e variables\n         (see \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\" rel=\"nofollow\"\u003eVariables\u003c/a\u003e below).\n         The query to be executed must return exactly one row.  Each column of\n         the row is stored into a separate variable, named the same as the\n         column.  For example:\n\u003c/p\u003e\u003cpre\u003e=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT \u0026#39;hello\u0026#39; AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\gset\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\echo :var1 :var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If you specify a \u003cem\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e,\n         that string is prepended to the query\u0026#39;s column names to create the\n         variable names to use:\n\u003c/p\u003e\u003cpre\u003e=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT \u0026#39;hello\u0026#39; AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\gset result_\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\echo :result_var1 :result_var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If a column result is NULL, the corresponding variable is unset\n         rather than being set.\n        \u003c/p\u003e\u003cp\u003e\n         If the query fails or does not return one row,\n         no variables are changed.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GX\"\u003e\u003cspan\u003e\u003ccode\u003e\\gx [ (\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\gx [ (\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode\u003e\\gx\u003c/code\u003e is equivalent to \u003ccode\u003e\\g\u003c/code\u003e, except\n        that it forces expanded output mode for this query, as\n        if \u003ccode\u003eexpanded=on\u003c/code\u003e were included in the list of\n        \u003ccode\u003e\\pset\u003c/code\u003e options.  See also \u003ccode\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HELP\"\u003e\u003cspan\u003e\u003ccode\u003e\\h\u003c/code\u003e or \u003ccode\u003e\\help\u003c/code\u003e \u003ccode\u003e[ \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Gives syntax help on the specified SQL\n        command. If \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        is not specified, then \u003cspan\u003epsql\u003c/span\u003e will list\n        all the commands for which syntax help is available. If\n        \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is an\n        asterisk (\u003ccode\u003e*\u003c/code\u003e), then syntax help on all\n        SQL commands is shown.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\help\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        To simplify typing, commands that consists of several words do\n        not have to be quoted. Thus it is fine to type \u003cstrong\u003e\u003ccode\u003e\\help\n        alter table\u003c/code\u003e\u003c/strong\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HTML\"\u003e\u003cspan\u003e\u003ccode\u003e\\H\u003c/code\u003e or \u003ccode\u003e\\html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Turns on HTML query output format. If the\n        HTML format is already on, it is switched\n        back to the default aligned text format. This command is for\n        compatibility and convenience, but see \u003ccode\u003e\\pset\u003c/code\u003e\n        about setting other output options.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE\"\u003e\u003cspan\u003e\u003ccode\u003e\\i\u003c/code\u003e or \u003ccode\u003e\\include\u003c/code\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads input from the file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e and executes it as\n        though it had been typed on the keyboard.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode\u003e-\u003c/code\u003e\n        (hyphen), then standard input is read until an EOF indication\n        or \u003ccode\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n        interactive input with input from files.  Note that Readline behavior\n        will be used only if it is active at the outermost level.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If you want to see the lines on the screen as they are read you\n        must set the variable \u003ccode\u003eECHO\u003c/code\u003e to\n        \u003ccode\u003eall\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"PSQL-METACOMMAND-IF\"\u003e\u003cspan\u003e\u003ccode\u003e\\if\u003c/code\u003e \u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\elif\u003c/code\u003e \u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\else\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\endif\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements nestable conditional blocks.\n        A conditional block must begin with an \u003ccode\u003e\\if\u003c/code\u003e and end\n        with an \u003ccode\u003e\\endif\u003c/code\u003e.  In between there may be any number\n        of \u003ccode\u003e\\elif\u003c/code\u003e clauses, which may optionally be followed\n        by a single \u003ccode\u003e\\else\u003c/code\u003e clause.  Ordinary queries and\n        other types of backslash commands may (and usually do) appear between\n        the commands forming a conditional block.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ccode\u003e\\if\u003c/code\u003e and \u003ccode\u003e\\elif\u003c/code\u003e commands read\n        their argument(s) and evaluate them as a Boolean expression.  If the\n        expression yields \u003ccode\u003etrue\u003c/code\u003e then processing continues\n        normally; otherwise, lines are skipped until a\n        matching \u003ccode\u003e\\elif\u003c/code\u003e, \u003ccode\u003e\\else\u003c/code\u003e,\n        or \u003ccode\u003e\\endif\u003c/code\u003e is reached.  Once\n        an \u003ccode\u003e\\if\u003c/code\u003e or \u003ccode\u003e\\elif\u003c/code\u003e test has\n        succeeded, the arguments of later \u003ccode\u003e\\elif\u003c/code\u003e commands in\n        the same block are not evaluated but are treated as false.  Lines\n        following an \u003ccode\u003e\\else\u003c/code\u003e are processed only if no earlier\n        matching \u003ccode\u003e\\if\u003c/code\u003e or \u003ccode\u003e\\elif\u003c/code\u003e succeeded.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003cem\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e argument\n        of an \u003ccode\u003e\\if\u003c/code\u003e or \u003ccode\u003e\\elif\u003c/code\u003e command\n        is subject to variable interpolation and backquote expansion, just\n        like any other backslash command argument.  After that it is evaluated\n        like the value of an on/off option variable.  So a valid value\n        is any unambiguous case-insensitive match for one of:\n        \u003ccode\u003etrue\u003c/code\u003e, \u003ccode\u003efalse\u003c/code\u003e, \u003ccode\u003e1\u003c/code\u003e,\n        \u003ccode\u003e0\u003c/code\u003e, \u003ccode\u003eon\u003c/code\u003e, \u003ccode\u003eoff\u003c/code\u003e,\n        \u003ccode\u003eyes\u003c/code\u003e, \u003ccode\u003eno\u003c/code\u003e.  For example,\n        \u003ccode\u003et\u003c/code\u003e, \u003ccode\u003eT\u003c/code\u003e, and \u003ccode\u003etR\u003c/code\u003e\n        will all be considered to be \u003ccode\u003etrue\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Expressions that do not properly evaluate to true or false will\n        generate a warning and be treated as false.\n        \u003c/p\u003e\u003cp\u003e\n        Lines being skipped are parsed normally to identify queries and\n        backslash commands, but queries are not sent to the server, and\n        backslash commands other than conditionals\n        (\u003ccode\u003e\\if\u003c/code\u003e, \u003ccode\u003e\\elif\u003c/code\u003e,\n        \u003ccode\u003e\\else\u003c/code\u003e, \u003ccode\u003e\\endif\u003c/code\u003e) are\n        ignored.  Conditional commands are checked only for valid nesting.\n        Variable references in skipped lines are not expanded, and backquote\n        expansion is not performed either.\n        \u003c/p\u003e\u003cp\u003e\n        All the backslash commands of a given conditional block must appear in\n        the same source file. If EOF is reached on the main input file or an\n        \u003ccode\u003e\\include\u003c/code\u003e-ed file before all local\n        \u003ccode\u003e\\if\u003c/code\u003e-blocks have been closed,\n        then \u003cspan\u003epsql\u003c/span\u003e will raise an error.\n        \u003c/p\u003e\u003cp\u003e\n         Here is an example:\n        \u003c/p\u003e\u003cpre\u003e-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo \u0026#39;is not a customer but is an employee\u0026#39;\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo \u0026#39;not a customer or employee\u0026#39;\n    \\else\n        \\echo \u0026#39;this will never print\u0026#39;\n    \\endif\n\\endif\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\"\u003e\u003cspan\u003e\u003ccode\u003e\\ir\u003c/code\u003e or \u003ccode\u003e\\include_relative\u003c/code\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The \u003ccode\u003e\\ir\u003c/code\u003e command is similar to \u003ccode\u003e\\i\u003c/code\u003e, but resolves\n        relative file names differently.  When executing in interactive mode,\n        the two commands behave identically.  However, when invoked from a\n        script, \u003ccode\u003e\\ir\u003c/code\u003e interprets file names relative to the\n        directory in which the script is located, rather than the current\n        working directory.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LIST\"\u003e\u003cspan\u003e\u003ccode\u003e\\l[x+]\u003c/code\u003e or \u003ccode\u003e\\list[x+] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        List the databases in the server and show their names, owners,\n        character set encodings, and access privileges.\n        If \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only databases whose names match the pattern are listed.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, database\n        sizes, default tablespaces, and descriptions are also displayed.\n        Size information is available for databases on which the current user has\n        \u003ccode\u003eCONNECT\u003c/code\u003e privilege, or if the current user is a superuser\n        or has privileges of the \u003ccode\u003epg_read_all_stats\u003c/code\u003e role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"\u003e\u003cspan\u003e\u003ccode\u003e\\lo_export \u003cem\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads the large object with OID \u003cem\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the database and\n        writes it to \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Note that this is\n        subtly different from the server function\n        \u003ccode\u003elo_export\u003c/code\u003e, which acts with the permissions\n        of the user that the database server runs as and on the server\u0026#39;s\n        file system.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode\u003e\\lo_list\u003c/code\u003e to find out the large object\u0026#39;s\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"\u003e\u003cspan\u003e\u003ccode\u003e\\lo_import \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003ecomment\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Stores the file into a \u003cspan\u003ePostgreSQL\u003c/span\u003e\n        large object. Optionally, it associates the given\n        comment with the object. Example:\n\u003c/p\u003e\u003cpre\u003efoo=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\lo_import \u0026#39;/home/peter/pictures/photo.xcf\u0026#39; \u0026#39;a picture of me\u0026#39;\u003c/code\u003e\u003c/strong\u003e\nlo_import 152801\n\u003c/pre\u003e\u003cp\u003e\n        The response indicates that the large object received object\n        ID 152801, which can be used to access the newly-created large\n        object in the future. For the sake of readability, it is\n        recommended to always associate a human-readable comment with\n        every object. Both OIDs and comments can be viewed with the\n        \u003ccode\u003e\\lo_list\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\n        Note that this command is subtly different from the server-side\n        \u003ccode\u003elo_import\u003c/code\u003e because it acts as the local user\n        on the local file system, rather than the server\u0026#39;s user and file\n        system.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-LIST\"\u003e\u003cspan\u003e\u003ccode\u003e\\lo_list[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows a list of all \u003cspan\u003ePostgreSQL\u003c/span\u003e\n        large objects currently stored in the database,\n        along with any comments provided for them.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"\u003e\u003cspan\u003e\u003ccode\u003e\\lo_unlink \u003cem\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Deletes the large object with OID\n\u003cem\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the\n        database.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode\u003e\\lo_list\u003c/code\u003e to find out the large object\u0026#39;s\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-OUT\"\u003e\u003cspan\u003e\u003ccode\u003e\\o\u003c/code\u003e or \u003ccode\u003e\\out [ \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\o\u003c/code\u003e or \u003ccode\u003e\\out [ |\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Arranges to save future query results to the file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipe future results\n        to the shell command \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e. If no argument is\n        specified, the query output is reset to the standard output.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003e“\u003cspan\u003eQuery results\u003c/span\u003e”\u003c/span\u003e includes all tables, command\n        responses, and notices obtained from the database server, as\n        well as output of various backslash commands that query the\n        database (such as \u003ccode\u003e\\d\u003c/code\u003e); but not error\n        messages.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        To intersperse text output in between query results, use\n        \u003ccode\u003e\\qecho\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PRINT\"\u003e\u003cspan\u003e\u003ccode\u003e\\p\u003c/code\u003e or \u003ccode\u003e\\print\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print the current query buffer to the standard output.\n        If the current query buffer is empty, the most recently executed query\n        is printed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PARSE\"\u003e\u003cspan\u003e\u003ccode\u003e\\parse \u003cem\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Creates a prepared statement from the current query buffer, based on\n         the name of a destination prepared-statement object. An empty string\n         denotes the unnamed prepared statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre\u003eSELECT $1 \\parse stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used, unlike\n         normal \u003cspan\u003epsql\u003c/span\u003e operation, which uses the\n         simple query protocol. A\n         \u003ca href=\"/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\" rel=\"nofollow\"\u003eParse (F)\u003c/a\u003e\n         message will be issued by this command so it can be useful to\n         test the extended query protocol from\n         \u003cspan\u003epsql\u003c/span\u003e. This command affects only the next\n         query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PASSWORD\"\u003e\u003cspan\u003e\u003ccode\u003e\\password [ \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Changes the password of the specified user (by default, the current\n        user).  This command prompts for the new password, encrypts it, and\n        sends it to the server as an \u003ccode\u003eALTER ROLE\u003c/code\u003e command.  This\n        makes sure that the new password does not appear in cleartext in the\n        command history, the server log, or elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PROMPT\"\u003e\u003cspan\u003e\u003ccode\u003e\\prompt [ \u003cem\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e ] \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts the user to supply text, which is assigned to the variable\n         \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n         An optional prompt string, \u003cem\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e, can be specified.  (For multiword\n         prompts, surround the text with single quotes.)\n        \u003c/p\u003e\u003cp\u003e\n         By default, \u003ccode\u003e\\prompt\u003c/code\u003e uses the terminal for input and\n         output.  However, if the \u003ccode\u003e-f\u003c/code\u003e command line switch was\n         used, \u003ccode\u003e\\prompt\u003c/code\u003e uses standard input and standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET\"\u003e\u003cspan\u003e\u003ccode\u003e\\pset [ \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command sets options affecting the output of query result tables.\n        \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        indicates which option is to be set. The semantics of\n        \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e vary depending\n        on the selected option.  For some options, omitting \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e causes the option to be toggled\n        or unset, as described under the particular option.  If no such\n        behavior is mentioned, then omitting\n        \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e just results in\n        the current setting being displayed.\n        \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003e\\pset\u003c/code\u003e without any arguments displays the current status\n        of all printing options.\n        \u003c/p\u003e\u003cp\u003e\n        Adjustable printing options are:\n        \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"\u003e\u003cspan\u003e\u003ccode\u003eborder\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e must be a\n          number. In general, the higher\n          the number the more borders and lines the tables will have,\n          but details depend on the particular format.\n          In HTML format, this will translate directly\n          into the \u003ccode\u003eborder=...\u003c/code\u003e attribute.\n          In most other formats only values 0 (no border), 1 (internal\n          dividing lines), and 2 (table frame) make sense, and values above 2\n          will be treated the same as \u003ccode\u003eborder = 2\u003c/code\u003e.\n          The \u003ccode\u003elatex\u003c/code\u003e and \u003ccode\u003elatex-longtable\u003c/code\u003e\n          formats additionally allow a value of 3 to add dividing lines\n          between data rows.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\"\u003e\u003cspan\u003e\u003ccode\u003ecolumns\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the target width for the \u003ccode\u003ewrapped\u003c/code\u003e format, and also\n          the width limit for determining whether output is wide enough to\n          require the pager or switch to the vertical display in expanded auto\n          mode.\n          Zero (the default) causes the target width to be controlled by the\n          environment variable \u003ccode\u003eCOLUMNS\u003c/code\u003e, or the detected screen width\n          if \u003ccode\u003eCOLUMNS\u003c/code\u003e is not set.\n          In addition, if \u003ccode\u003ecolumns\u003c/code\u003e is zero then the\n          \u003ccode\u003ewrapped\u003c/code\u003e format only affects screen output.\n          If \u003ccode\u003ecolumns\u003c/code\u003e is nonzero then file and pipe output is\n          wrapped to that width as well.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"\u003e\u003cspan\u003e\u003ccode\u003ecsv_fieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in\n          CSV output format.  If the separator character\n          appears in a field\u0026#39;s value, that field is output within double\n          quotes, following standard CSV rules.\n          The default is a comma.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\"\u003e\u003cspan\u003e\u003ccode\u003eexpanded\u003c/code\u003e (or \u003ccode\u003ex\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified it\n          must be either \u003ccode\u003eon\u003c/code\u003e or \u003ccode\u003eoff\u003c/code\u003e, which\n          will enable or disable expanded mode, or \u003ccode\u003eauto\u003c/code\u003e.\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between the on and off settings.  When expanded mode\n          is enabled, query results are displayed in two columns, with the\n          column name on the left and the data on the right. This mode is\n          useful if the data wouldn\u0026#39;t fit on the screen in the\n          normal \u003cspan\u003e“\u003cspan\u003ehorizontal\u003c/span\u003e”\u003c/span\u003e mode.  In the auto setting, the\n          expanded mode is used whenever the query output has more than one\n          column and is wider than the screen; otherwise, the regular mode is\n          used.  The auto setting is only\n          effective in the aligned and wrapped formats.  In other formats, it\n          always behaves as if the expanded mode is off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"\u003e\u003cspan\u003e\u003ccode\u003efieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in unaligned output\n          format. That way one can create, for example, tab-separated\n          output, which other programs might prefer. To\n          set a tab as field separator, type \u003ccode\u003e\\pset fieldsep\n          \u0026#39;\\t\u0026#39;\u003c/code\u003e. The default field separator is\n          \u003ccode\u003e\u0026#39;|\u0026#39;\u003c/code\u003e (a vertical bar).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"\u003e\u003cspan\u003e\u003ccode\u003efieldsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the field separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"\u003e\u003cspan\u003e\u003ccode\u003efooter\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode\u003eon\u003c/code\u003e or \u003ccode\u003eoff\u003c/code\u003e\n          which will enable or disable display of the table footer\n          (the \u003ccode\u003e(\u003cem\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e rows)\u003c/code\u003e count).\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles footer display on or off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"\u003e\u003cspan\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the output format to one of \u003ccode\u003ealigned\u003c/code\u003e,\n          \u003ccode\u003easciidoc\u003c/code\u003e,\n          \u003ccode\u003ecsv\u003c/code\u003e,\n          \u003ccode\u003ehtml\u003c/code\u003e,\n          \u003ccode\u003elatex\u003c/code\u003e,\n          \u003ccode\u003elatex-longtable\u003c/code\u003e, \u003ccode\u003etroff-ms\u003c/code\u003e,\n          \u003ccode\u003eunaligned\u003c/code\u003e, or \u003ccode\u003ewrapped\u003c/code\u003e.\n          Unique abbreviations are allowed.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003ealigned\u003c/code\u003e format is the standard,\n          human-readable, nicely formatted text output; this is the default.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003eunaligned\u003c/code\u003e format writes all columns of a row on one\n          line, separated by the currently active field separator. This\n          is useful for creating output that might be intended to be read\n          in by other programs, for example, tab-separated or comma-separated\n          format.  However, the field separator character is not treated\n          specially if it appears in a column\u0026#39;s value;\n          so CSV format may be better suited for such\n          purposes.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003ecsv\u003c/code\u003e format\n          \n          writes column values separated by commas, applying the quoting\n          rules described in\n          \u003ca href=\"https://datatracker.ietf.org/doc/html/rfc4180\" rel=\"nofollow\"\u003eRFC 4180\u003c/a\u003e.\n          This output is compatible with the CSV format of the server\u0026#39;s\n          \u003ccode\u003eCOPY\u003c/code\u003e command.\n          A header line with column names is generated unless\n          the \u003ccode\u003etuples_only\u003c/code\u003e parameter is\n          \u003ccode\u003eon\u003c/code\u003e. Titles and footers are not printed.\n          Each row is terminated by the system-dependent end-of-line character,\n          which is typically a single newline (\u003ccode\u003e\\n\u003c/code\u003e) for\n          Unix-like systems or a carriage return and newline sequence\n          (\u003ccode\u003e\\r\\n\u003c/code\u003e) for Microsoft Windows.\n          Field separator characters other than comma can be selected with\n          \u003ccode\u003e\\pset csv_fieldsep\u003c/code\u003e.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003ewrapped\u003c/code\u003e format is like \u003ccode\u003ealigned\u003c/code\u003e but wraps\n          wide data values across lines to make the output fit in the target\n          column width.  The target width is determined as described under\n          the \u003ccode\u003ecolumns\u003c/code\u003e option.  Note that \u003cspan\u003epsql\u003c/span\u003e will\n          not attempt to wrap column header titles; therefore,\n          \u003ccode\u003ewrapped\u003c/code\u003e format behaves the same as \u003ccode\u003ealigned\u003c/code\u003e\n          if the total width needed for column headers exceeds the target.\n          \u003c/p\u003e\u003cp\u003e\n          The \u003ccode\u003easciidoc\u003c/code\u003e, \u003ccode\u003ehtml\u003c/code\u003e,\n          \u003ccode\u003elatex\u003c/code\u003e, \u003ccode\u003elatex-longtable\u003c/code\u003e, and\n          \u003ccode\u003etroff-ms\u003c/code\u003e formats put out tables that are intended\n          to be included in documents using the respective mark-up\n          language. They are not complete documents! This might not be\n          necessary in HTML, but in\n          \u003cspan\u003eLaTeX\u003c/span\u003e you must have a complete\n          document wrapper.\n          The \u003ccode\u003elatex\u003c/code\u003e format\n          uses \u003cspan\u003eLaTeX\u003c/span\u003e\u0026#39;s \u003ccode\u003etabular\u003c/code\u003e\n          environment.\n          The \u003ccode\u003elatex-longtable\u003c/code\u003e format\n          requires the \u003cspan\u003eLaTeX\u003c/span\u003e\n\u003ccode\u003elongtable\u003c/code\u003e and \u003ccode\u003ebooktabs\u003c/code\u003e packages.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"\u003e\u003cspan\u003e\u003ccode\u003elinestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border line drawing style to one\n          of \u003ccode\u003eascii\u003c/code\u003e, \u003ccode\u003eold-ascii\u003c/code\u003e,\n          or \u003ccode\u003eunicode\u003c/code\u003e.\n          Unique abbreviations are allowed.  (That would mean one\n          letter is enough.)\n          The default setting is \u003ccode\u003eascii\u003c/code\u003e.\n          This option only affects the \u003ccode\u003ealigned\u003c/code\u003e and\n          \u003ccode\u003ewrapped\u003c/code\u003e output formats.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003eascii\u003c/code\u003e style uses plain ASCII\n          characters.  Newlines in data are shown using\n          a \u003ccode\u003e+\u003c/code\u003e symbol in the right-hand margin.\n          When the \u003ccode\u003ewrapped\u003c/code\u003e format wraps data from\n          one line to the next without a newline character, a dot\n          (\u003ccode\u003e.\u003c/code\u003e) is shown in the right-hand margin of the first line,\n          and again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003eold-ascii\u003c/code\u003e style uses plain ASCII\n          characters, using the formatting style used\n          in \u003cspan\u003ePostgreSQL\u003c/span\u003e 8.4 and earlier.\n          Newlines in data are shown using a \u003ccode\u003e:\u003c/code\u003e\n          symbol in place of the left-hand column separator.\n          When the data is wrapped from one line\n          to the next without a newline character, a \u003ccode\u003e;\u003c/code\u003e\n          symbol is used in place of the left-hand column separator.\n          \u003c/p\u003e\u003cp\u003e\u003ccode\u003eunicode\u003c/code\u003e style uses Unicode box-drawing characters.\n          Newlines in data are shown using a carriage return symbol\n          in the right-hand margin.  When the data is wrapped from one line\n          to the next without a newline character, an ellipsis symbol\n          is shown in the right-hand margin of the first line, and\n          again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\n          When the \u003ccode\u003eborder\u003c/code\u003e setting is greater than zero,\n          the \u003ccode\u003elinestyle\u003c/code\u003e option also determines the\n          characters with which the border lines are drawn.\n          Plain ASCII characters work everywhere, but\n          Unicode characters look nicer on displays that recognize them.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"\u003e\u003cspan\u003e\u003ccode\u003enull\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the string to be printed in place of a null value.\n          The default is to print nothing, which can easily be mistaken for\n          an empty string. For example, one might prefer \u003ccode\u003e\\pset null\n          \u0026#39;(null)\u0026#39;\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"\u003e\u003cspan\u003e\u003ccode\u003enumericlocale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode\u003eon\u003c/code\u003e or \u003ccode\u003eoff\u003c/code\u003e\n          which will enable or disable display of a locale-specific character\n          to separate groups of digits to the left of the decimal marker.\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and locale-specific numeric output.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"\u003e\u003cspan\u003e\u003ccode\u003epager\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Controls use of a pager program for query and \u003cspan\u003epsql\u003c/span\u003e\n          help output.\n          When the \u003ccode\u003epager\u003c/code\u003e option is \u003ccode\u003eoff\u003c/code\u003e, the pager\n          program is not used. When the \u003ccode\u003epager\u003c/code\u003e option is\n          \u003ccode\u003eon\u003c/code\u003e, the pager is used when appropriate, i.e., when the\n          output is to a terminal and will not fit on the screen.\n          The \u003ccode\u003epager\u003c/code\u003e option can also be set to \u003ccode\u003ealways\u003c/code\u003e,\n          which causes the pager to be used for all terminal output regardless\n          of whether it fits on the screen.  \u003ccode\u003e\\pset pager\u003c/code\u003e\n          without a \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n          toggles pager use on and off.\n          \u003c/p\u003e\u003cp\u003e\n          If the environment variable \u003ccode\u003ePSQL_PAGER\u003c/code\u003e\n          or \u003ccode\u003ePAGER\u003c/code\u003e is set, output to be paged is piped to the\n          specified program.  Otherwise a platform-dependent default program\n          (such as \u003ccode\u003emore\u003c/code\u003e) is used.\n          \u003c/p\u003e\u003cp\u003e\n          When using the \u003ccode\u003e\\watch\u003c/code\u003e command to execute a query\n          repeatedly, the environment variable \u003ccode\u003ePSQL_WATCH_PAGER\u003c/code\u003e\n          is used to find the pager program instead, on Unix systems.  This is\n          configured separately because it may confuse traditional pagers, but\n          can be used to send output to tools that understand\n          \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s output format (such as\n          \u003ccode\u003epspg --stream\u003c/code\u003e).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"\u003e\u003cspan\u003e\u003ccode\u003epager_min_lines\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003ccode\u003epager_min_lines\u003c/code\u003e is set to a number greater than the\n          page height, the pager program will not be called unless there are\n          at least this many lines of output to show. The default setting\n          is 0.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"\u003e\u003cspan\u003e\u003ccode\u003erecordsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the record (line) separator to use in unaligned\n          output format. The default is a newline character.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"\u003e\u003cspan\u003e\u003ccode\u003erecordsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the record separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\"\u003e\u003cspan\u003e\u003ccode\u003etableattr\u003c/code\u003e (or \u003ccode\u003eT\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          In HTML format, this specifies attributes\n          to be placed inside the \u003ccode\u003etable\u003c/code\u003e tag.  This\n          could for example be \u003ccode\u003ecellpadding\u003c/code\u003e or\n          \u003ccode\u003ebgcolor\u003c/code\u003e. Note that you probably don\u0026#39;t want\n          to specify \u003ccode\u003eborder\u003c/code\u003e here, as that is already\n          taken care of by \u003ccode\u003e\\pset border\u003c/code\u003e.\n          If no\n          \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the table attributes are unset.\n          \u003c/p\u003e\u003cp\u003e\n          In \u003ccode\u003elatex-longtable\u003c/code\u003e format, this controls\n          the proportional width of each column containing a left-aligned\n          data type.  It is specified as a whitespace-separated list of values,\n          e.g., \u003ccode\u003e\u0026#39;0.2 0.2 0.6\u0026#39;\u003c/code\u003e.  Unspecified output columns\n          use the last specified value.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\"\u003e\u003cspan\u003e\u003ccode\u003etitle\u003c/code\u003e (or \u003ccode\u003eC\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the table title for any subsequently printed tables. This\n          can be used to give your output descriptive tags. If no\n          \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the title is unset.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\"\u003e\u003cspan\u003e\u003ccode\u003etuples_only\u003c/code\u003e (or \u003ccode\u003et\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode\u003eon\u003c/code\u003e or \u003ccode\u003eoff\u003c/code\u003e\n          which will enable or disable tuples-only mode.\n          If \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and tuples-only output.\n          Regular output includes extra information such\n          as column headers, titles, and various footers. In tuples-only\n          mode, only actual table data is shown.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"\u003e\u003cspan\u003e\u003ccode\u003eunicode_border_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border drawing style for the \u003ccode\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode\u003esingle\u003c/code\u003e\n          or \u003ccode\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"\u003e\u003cspan\u003e\u003ccode\u003eunicode_column_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the column drawing style for the \u003ccode\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode\u003esingle\u003c/code\u003e\n          or \u003ccode\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"\u003e\u003cspan\u003e\u003ccode\u003eunicode_header_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the header drawing style for the \u003ccode\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode\u003esingle\u003c/code\u003e\n          or \u003ccode\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"\u003e\u003cspan\u003e\u003ccode\u003exheader_width\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n           Sets the maximum width of the header for expanded output to one of\n           \u003ccode\u003efull\u003c/code\u003e (the default value),\n           \u003ccode\u003ecolumn\u003c/code\u003e, \u003ccode\u003epage\u003c/code\u003e, or an\n           \u003cem\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003efull\u003c/code\u003e: the expanded header is not truncated,\n           and will be as wide as the widest output line.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003ecolumn\u003c/code\u003e: truncate the header line to the\n           width of the first column.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003epage\u003c/code\u003e: truncate the header line to the terminal\n           width.\n          \u003c/p\u003e\u003cp\u003e\n\u003cem\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e: specify\n           the exact maximum width of the header line.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Illustrations of how these different formats look can be seen in\n        \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"Examples\" rel=\"nofollow\"\u003eExamples\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        There are various shortcut commands for \u003ccode\u003e\\pset\u003c/code\u003e. See\n        \u003ccode\u003e\\a\u003c/code\u003e, \u003ccode\u003e\\C\u003c/code\u003e, \u003ccode\u003e\\f\u003c/code\u003e,\n        \u003ccode\u003e\\H\u003c/code\u003e, \u003ccode\u003e\\t\u003c/code\u003e, \u003ccode\u003e\\T\u003c/code\u003e,\n        and \u003ccode\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUIT\"\u003e\u003cspan\u003e\u003ccode\u003e\\q\u003c/code\u003e or \u003ccode\u003e\\quit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Quits the \u003cspan\u003epsql\u003c/span\u003e program.\n        In a script file, only execution of that script is terminated.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QECHO\"\u003e\u003cspan\u003e\u003ccode\u003e\\qecho \u003cem\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode\u003e\\echo\u003c/code\u003e except\n        that the output will be written to the query output channel, as\n        set by \u003ccode\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESET\"\u003e\u003cspan\u003e\u003ccode\u003e\\r\u003c/code\u003e or \u003ccode\u003e\\reset\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Resets (clears) the query buffer.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESTRICT\"\u003e\u003cspan\u003e\u003ccode\u003e\\restrict \u003cem\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enter \u0026#34;restricted\u0026#34; mode with the provided key.  In this mode, the only\n        allowed meta-command is \u003ccode\u003e\\unrestrict\u003c/code\u003e, to exit\n        restricted mode.  The key may contain only alphanumeric characters.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan\u003epg_dump\u003c/span\u003e,\n        \u003cspan\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-S\"\u003e\u003cspan\u003e\u003ccode\u003e\\s [ \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s command line history\n        to \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is omitted,\n        the history is written to the standard output (using the pager if\n        appropriate).  This command is not available\n        if \u003cspan\u003epsql\u003c/span\u003e was built\n        without \u003cspan\u003eReadline\u003c/span\u003e support.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SET\"\u003e\u003cspan\u003e\u003ccode\u003e\\set [ \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [ ... ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the \u003cspan\u003epsql\u003c/span\u003e variable \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if more than one value\n        is given, to the concatenation of all of them. If only one\n        argument is given, the variable is set to an empty-string value. To\n        unset a variable, use the \u003ccode\u003e\\unset\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\u003ccode\u003e\\set\u003c/code\u003e without any arguments displays the names and values\n        of all currently-set \u003cspan\u003epsql\u003c/span\u003e variables.\n        \u003c/p\u003e\u003cp\u003e\n        Valid variable names can contain letters, digits, and\n        underscores. See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\" rel=\"nofollow\"\u003eVariables\u003c/a\u003e below for details.\n        Variable names are case-sensitive.\n        \u003c/p\u003e\u003cp\u003e\n        Certain variables are special, in that they\n        control \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s behavior or are\n        automatically set to reflect connection state.  These variables are\n        documented in \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\" rel=\"nofollow\"\u003eVariables\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This command is unrelated to the SQL\n        command \u003ca href=\"/docs/18/sql-set.html\" title=\"SET\" rel=\"nofollow\"\u003e\u003ccode\u003eSET\u003c/code\u003e\u003c/a\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan\u003e\u003ccode\u003e\\setenv \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SF\"\u003e\u003cspan\u003e\u003ccode\u003e\\sf[+] \u003cem\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and shows the definition of the named function or procedure,\n         in the form of a \u003ccode\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         The definition is printed to the current query output channel,\n         as set by \u003ccode\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, then the\n         output lines are numbered, with the first line of the function body\n         being line 1.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\sf\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SV\"\u003e\u003cspan\u003e\u003ccode\u003e\\sv[+] \u003cem\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          This command fetches and shows the definition of the named view,\n          in the form of a \u003ccode\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n          The definition is printed to the current query output channel,\n          as set by \u003ccode\u003e\\o\u003c/code\u003e.\n         \u003c/p\u003e\u003cp\u003e\n          If \u003ccode\u003e+\u003c/code\u003e is appended to the command name, then the\n          output lines are numbered from 1.\n         \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\sv\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PIPELINE\"\u003e\u003cspan\u003e\u003ccode\u003e\\startpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\sendpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\syncpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\endpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\flushrequest\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\flush\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\getresults [ \u003cem\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements pipelining of SQL statements.\n        A pipeline must begin with a \u003ccode\u003e\\startpipeline\u003c/code\u003e\n        and end with an \u003ccode\u003e\\endpipeline\u003c/code\u003e. In between there\n        may be any number of \u003ccode\u003e\\syncpipeline\u003c/code\u003e commands,\n        which sends a \u003ca href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" rel=\"nofollow\"\u003esync message\u003c/a\u003e\n        without ending the ongoing pipeline and flushing the send buffer.\n        In pipeline mode, statements are sent to the server without waiting\n        for the results of previous statements.\n        See \u003ca href=\"/docs/18/libpq-pipeline-mode.html\" rel=\"nofollow\"\u003eSection 32.5\u003c/a\u003e for more details.\n       \u003c/p\u003e\u003cp\u003e\n        All queries executed while a pipeline is ongoing use the extended\n        query protocol. Queries are appended to the pipeline when ending with\n        a semicolon. The meta-commands \u003ccode\u003e\\bind\u003c/code\u003e,\n        \u003ccode\u003e\\bind_named\u003c/code\u003e, \u003ccode\u003e\\close_prepared\u003c/code\u003e or\n        \u003ccode\u003e\\parse\u003c/code\u003e can be used in an ongoing pipeline. While\n        a pipeline is ongoing, \u003ccode\u003e\\sendpipeline\u003c/code\u003e will append\n        the current query buffer to the pipeline. Other meta-commands like\n        \u003ccode\u003e\\g\u003c/code\u003e, \u003ccode\u003e\\gx\u003c/code\u003e or\n        \u003ccode\u003e\\gdesc\u003c/code\u003e are not allowed in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003e\\flushrequest\u003c/code\u003e appends a flush command to the\n        pipeline, allowing to read results with\n        \u003ccode\u003e\\getresults\u003c/code\u003e without issuing a sync or ending the\n        pipeline. \u003ccode\u003e\\getresults\u003c/code\u003e will automatically push\n        unsent data to the server. \u003ccode\u003e\\flush\u003c/code\u003e can be used to\n        manually push unsent data.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003e\\getresults\u003c/code\u003e accepts an optional\n        \u003cem\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e parameter.\n        If provided, only the first\n        \u003cem\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e pending\n        results will be read. If not provided or \u003ccode\u003e0\u003c/code\u003e, all\n        pending results are read.\n       \u003c/p\u003e\u003cp\u003e\n        When pipeline mode is active, a dedicated prompt variable is available\n        to report the pipeline status.\n        See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\" rel=\"nofollow\"\u003e\u003ccode\u003e%P\u003c/code\u003e\u003c/a\u003e for more details\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode\u003eCOPY\u003c/code\u003e is not supported while in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n        Example:\n\u003c/p\u003e\u003cpre\u003e\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-LC\"\u003e\u003cspan\u003e\u003ccode\u003e\\t\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Toggles the display of output column name headings and row count\n        footer. This command is equivalent to \u003ccode\u003e\\pset\n        tuples_only\u003c/code\u003e and is provided for convenience.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-UC\"\u003e\u003cspan\u003e\u003ccode\u003e\\T \u003cem\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies attributes to be placed within the\n        \u003ccode\u003etable\u003c/code\u003e tag in HTML\n        output format. This command is equivalent to \u003ccode\u003e\\pset\n        tableattr \u003cem\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-TIMING\"\u003e\u003cspan\u003e\u003ccode\u003e\\timing [ \u003cem\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         With a parameter, turns displaying of how long each SQL statement\n         takes on or off.  Without a parameter, toggles the display between\n         on and off.  The display is in milliseconds; intervals longer than\n         1 second are also shown in minutes:seconds format, with hours and\n         days fields added if needed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"\u003e\u003cspan\u003e\u003ccode\u003e\\unrestrict \u003cem\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Exit \u0026#34;restricted\u0026#34; mode (i.e., where all other meta-commands are\n        blocked), provided the specified key matches the one given to\n        \u003ccode\u003e\\restrict\u003c/code\u003e when restricted mode was entered.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan\u003epg_dump\u003c/span\u003e,\n        \u003cspan\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument of \u003ccode\u003e\\unrestrict\u003c/code\u003e, and\n        neither variable interpolation nor backquote expansion are performed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNSET\"\u003e\u003cspan\u003e\u003ccode\u003e\\unset \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Unsets (deletes) the \u003cspan\u003epsql\u003c/span\u003e variable \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Most variables that control \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s behavior\n        cannot be unset; instead, an \u003ccode\u003e\\unset\u003c/code\u003e command is interpreted\n        as setting them to their default values.\n        See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\" rel=\"nofollow\"\u003eVariables\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WRITE\"\u003e\u003cspan\u003e\u003ccode\u003e\\w\u003c/code\u003e or \u003ccode\u003e\\write\u003c/code\u003e \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e\\w\u003c/code\u003e or \u003ccode\u003e\\write\u003c/code\u003e \u003ccode\u003e|\u003c/code\u003e\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Writes the current query buffer to the file \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipes it to the shell\n        command \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        If the current query buffer is empty, the most recently executed query\n        is written instead.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WARN\"\u003e\u003cspan\u003e\u003ccode\u003e\\warn \u003cem\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode\u003e\\echo\u003c/code\u003e except\n        that the output will be written to \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s\n        standard error channel, rather than standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WATCH\"\u003e\u003cspan\u003e\u003ccode\u003e\\watch [ i[nterval]=\u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ] [ c[ount]=\u003cem\u003e\u003ccode\u003etimes\u003c/code\u003e\u003c/em\u003e ] [ m[in_rows]=\u003cem\u003e\u003ccode\u003erows\u003c/code\u003e\u003c/em\u003e ] [ \u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeatedly execute the current query buffer (as \u003ccode\u003e\\g\u003c/code\u003e does)\n        until interrupted, or the query fails, or the execution count limit\n        (if given) is reached, or the query no longer returns the minimum number\n        of rows. Wait the specified number of seconds (default 2) between executions.\n        The default wait can be changed with the variable\n        \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\" rel=\"nofollow\"\u003e\u003ccode\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/a\u003e.\n        For backwards compatibility,\n        \u003cem\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e can be specified\n        with or without an \u003ccode\u003einterval=\u003c/code\u003e prefix.\n        Each query result is\n        displayed with a header that includes the \u003ccode\u003e\\pset title\u003c/code\u003e\n        string (if any), the time as of query start, and the delay interval.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query\n        is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-X\"\u003e\u003cspan\u003e\u003ccode\u003e\\x [ \u003cem\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e | \u003cem\u003e\u003ccode\u003eauto\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets or toggles expanded table formatting mode. As such it is equivalent to\n        \u003ccode\u003e\\pset expanded\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-Z\"\u003e\u003cspan\u003e\u003ccode\u003e\\z[Sx] [ \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\" rel=\"nofollow\"\u003e\u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If a \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        This is an alias for \u003ccode\u003e\\dp\u003c/code\u003e (\u003cspan\u003e“\u003cspan\u003edisplay\n        privileges\u003c/span\u003e”\u003c/span\u003e).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"\u003e\u003cspan\u003e\u003ccode\u003e\\! [ \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        With no argument, escapes to a sub-shell; \u003cspan\u003epsql\u003c/span\u003e\n        resumes when the sub-shell exits.  With an argument, executes the\n        shell command \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode\u003e\\!\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.  The rest of the line is simply passed literally to the\n        shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"\u003e\u003cspan\u003e\u003ccode\u003e\\? [ \u003cem\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows help information. The optional\n        \u003cem\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter\n        (defaulting to \u003ccode\u003ecommands\u003c/code\u003e) selects which part of \u003cspan\u003epsql\u003c/span\u003e is\n        explained: \u003ccode\u003ecommands\u003c/code\u003e describes \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s\n        backslash commands; \u003ccode\u003eoptions\u003c/code\u003e describes the command-line\n        options that can be passed to \u003cspan\u003epsql\u003c/span\u003e;\n        and \u003ccode\u003evariables\u003c/code\u003e shows help about \u003cspan\u003epsql\u003c/span\u003e configuration\n        variables.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"\u003e\u003cspan\u003e\u003ccode\u003e\\;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Backslash-semicolon is not a meta-command in the same way as the\n        preceding commands; rather, it simply causes a semicolon to be\n        added to the query buffer without any further processing.\n        \u003c/p\u003e\u003cp\u003e\n        Normally, \u003cspan\u003epsql\u003c/span\u003e will dispatch an SQL command to the\n        server as soon as it reaches the command-ending semicolon, even if\n        more input remains on the current line.  Thus for example entering\n\u003c/p\u003e\u003cpre\u003eselect 1; select 2; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        will result in the three SQL commands being individually sent to\n        the server, with each one\u0026#39;s results being displayed before\n        continuing to the next command.  However, a semicolon entered\n        as \u003ccode\u003e\\;\u003c/code\u003e will not trigger command processing, so that the\n        command before it and the one after are effectively combined and\n        sent to the server in one request.  So for example\n\u003c/p\u003e\u003cpre\u003eselect 1\\; select 2\\; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        results in sending the three SQL commands to the server in a single\n        request, when the non-backslashed semicolon is reached.\n        The server executes such a request as a single transaction,\n        unless there are explicit \u003ccode\u003eBEGIN\u003c/code\u003e/\u003ccode\u003eCOMMIT\u003c/code\u003e\n        commands included in the string to divide it into multiple\n        transactions.  (See \u003ca href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" rel=\"nofollow\"\u003eSection 54.2.2.1\u003c/a\u003e\n        for more details about how the server handles multi-query strings.)\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cdiv id=\"APP-PSQL-PATTERNS\"\u003e\u003ch4\u003ePatterns\u003c/h4\u003e\u003cp\u003e\n   The various \u003ccode\u003e\\d\u003c/code\u003e commands accept a \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter to specify the\n   object name(s) to be displayed.  In the simplest case, a pattern\n   is just the exact name of the object.  The characters within a\n   pattern are normally folded to lower case, just as in SQL names;\n   for example, \u003ccode\u003e\\dt FOO\u003c/code\u003e will display the table named\n   \u003ccode\u003efoo\u003c/code\u003e.  As in SQL names, placing double quotes around\n   a pattern stops folding to lower case.  Should you need to include\n   an actual double quote character in a pattern, write it as a pair\n   of double quotes within a double-quote sequence; again this is in\n   accord with the rules for SQL quoted identifiers.  For example,\n   \u003ccode\u003e\\dt \u0026#34;FOO\u0026#34;\u0026#34;BAR\u0026#34;\u003c/code\u003e will display the table named\n   \u003ccode\u003eFOO\u0026#34;BAR\u003c/code\u003e (not \u003ccode\u003efoo\u0026#34;bar\u003c/code\u003e).  Unlike the normal\n   rules for SQL names, you can put double quotes around just part\n   of a pattern, for instance \u003ccode\u003e\\dt FOO\u0026#34;FOO\u0026#34;BAR\u003c/code\u003e will display\n   the table named \u003ccode\u003efooFOObar\u003c/code\u003e.\n  \u003c/p\u003e\u003cp\u003e\n   Whenever the \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter\n   is omitted completely, the \u003ccode\u003e\\d\u003c/code\u003e commands display all objects\n   that are visible in the current schema search path — this is\n   equivalent to using \u003ccode\u003e*\u003c/code\u003e as the pattern.\n   (An object is said to be \u003cem\u003evisible\u003c/em\u003e if its\n   containing schema is in the search path and no object of the same\n   kind and name appears earlier in the search path. This is equivalent to the\n   statement that the object can be referenced by name without explicit\n   schema qualification.)\n   To see all objects in the database regardless of visibility,\n   use \u003ccode\u003e*.*\u003c/code\u003e as the pattern.\n  \u003c/p\u003e\u003cp\u003e\n   Within a pattern, \u003ccode\u003e*\u003c/code\u003e matches any sequence of characters\n   (including no characters) and \u003ccode\u003e?\u003c/code\u003e matches any single character.\n   (This notation is comparable to Unix shell file name patterns.)\n   For example, \u003ccode\u003e\\dt int*\u003c/code\u003e displays tables whose names\n   begin with \u003ccode\u003eint\u003c/code\u003e.  But within double quotes, \u003ccode\u003e*\u003c/code\u003e\n   and \u003ccode\u003e?\u003c/code\u003e lose these special meanings and are just matched\n   literally.\n  \u003c/p\u003e\u003cp\u003e\n   A relation pattern that contains a dot (\u003ccode\u003e.\u003c/code\u003e) is interpreted as a schema\n   name pattern followed by an object name pattern.  For example,\n   \u003ccode\u003e\\dt foo*.*bar*\u003c/code\u003e displays all tables whose table name\n   includes \u003ccode\u003ebar\u003c/code\u003e that are in schemas whose schema name\n   starts with \u003ccode\u003efoo\u003c/code\u003e.  When no dot appears, then the pattern\n   matches only objects that are visible in the current schema search path.\n   Again, a dot within double quotes loses its special meaning and is matched\n   literally.  A relation pattern that contains two dots (\u003ccode\u003e.\u003c/code\u003e)\n   is interpreted as a database name followed by a schema name pattern followed\n   by an object name pattern.  The database name portion will not be treated as\n   a pattern and must match the name of the currently connected database, else\n   an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   A schema pattern that contains a dot (\u003ccode\u003e.\u003c/code\u003e) is interpreted\n   as a database name followed by a schema name pattern.  For example,\n   \u003ccode\u003e\\dn mydb.*foo*\u003c/code\u003e displays all schemas whose schema name\n   includes \u003ccode\u003efoo\u003c/code\u003e.  The database name portion will not be\n   treated as a pattern and must match the name of the currently connected\n   database, else an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   Advanced users can use regular-expression notations such as character\n   classes, for example \u003ccode\u003e[0-9]\u003c/code\u003e to match any digit.  All regular\n   expression special characters work as specified in\n   \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" rel=\"nofollow\"\u003eSection 9.7.3\u003c/a\u003e, except for \u003ccode\u003e.\u003c/code\u003e which\n   is taken as a separator as mentioned above, \u003ccode\u003e*\u003c/code\u003e which is\n   translated to the regular-expression notation \u003ccode\u003e.*\u003c/code\u003e,\n   \u003ccode\u003e?\u003c/code\u003e which is translated to \u003ccode\u003e.\u003c/code\u003e, and\n   \u003ccode\u003e$\u003c/code\u003e which is matched literally.  You can emulate\n   these pattern characters at need by writing\n   \u003ccode\u003e?\u003c/code\u003e for \u003ccode\u003e.\u003c/code\u003e,\n   \u003ccode\u003e(\u003cem\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e+|)\u003c/code\u003e for\n   \u003ccode\u003e\u003cem\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e*\u003c/code\u003e, or\n   \u003ccode\u003e(\u003cem\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e|)\u003c/code\u003e for\n   \u003ccode\u003e\u003cem\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e?\u003c/code\u003e.\n   \u003ccode\u003e$\u003c/code\u003e is not needed as a regular-expression character since\n   the pattern must match the whole name, unlike the usual\n   interpretation of regular expressions (in other words, \u003ccode\u003e$\u003c/code\u003e\n   is automatically appended to your pattern).  Write \u003ccode\u003e*\u003c/code\u003e at the\n   beginning and/or end if you don\u0026#39;t wish the pattern to be anchored.\n   Note that within double quotes, all regular expression special characters\n   lose their special meanings and are matched literally.  Also, the regular\n   expression special characters are matched literally in operator name\n   patterns (i.e., the argument of \u003ccode\u003e\\do\u003c/code\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.8.5\"\u003e\u003ch3\u003eAdvanced Features\u003c/h3\u003e\u003cdiv id=\"APP-PSQL-VARIABLES\"\u003e\u003ch4\u003eVariables\u003c/h4\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e provides variable substitution\n    features similar to common Unix command shells.\n    Variables are simply name/value pairs, where the value\n    can be any string of any length.  The name must consist of letters\n    (including non-Latin letters), digits, and underscores.\n    \u003c/p\u003e\u003cp\u003e\n    To set a variable, use the \u003cspan\u003epsql\u003c/span\u003e meta-command\n    \u003ccode\u003e\\set\u003c/code\u003e.  For example,\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\set foo bar\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    sets the variable \u003ccode\u003efoo\u003c/code\u003e to the value\n    \u003ccode\u003ebar\u003c/code\u003e. To retrieve the content of the variable, precede\n    the name with a colon, for example:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\echo :foo\u003c/code\u003e\u003c/strong\u003e\nbar\n\u003c/pre\u003e\u003cp\u003e\n    This works in both regular SQL commands and meta-commands; there is\n    more detail in \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\" rel=\"nofollow\"\u003eSQL Interpolation\u003c/a\u003e, below.\n    \u003c/p\u003e\u003cp\u003e\n    If you call \u003ccode\u003e\\set\u003c/code\u003e without a second argument, the\n    variable is set to an empty-string value. To unset (i.e., delete)\n    a variable, use the command \u003ccode\u003e\\unset\u003c/code\u003e.  To show the\n    values of all variables, call \u003ccode\u003e\\set\u003c/code\u003e without any argument.\n    \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n    The arguments of \u003ccode\u003e\\set\u003c/code\u003e are subject to the same\n    substitution rules as with other commands. Thus you can construct\n    interesting references such as \u003ccode\u003e\\set :foo\n    \u0026#39;something\u0026#39;\u003c/code\u003e and get \u003cspan\u003e“\u003cspan\u003esoft links\u003c/span\u003e”\u003c/span\u003e or\n    \u003cspan\u003e“\u003cspan\u003evariable variables\u003c/span\u003e”\u003c/span\u003e of \u003cspan\u003ePerl\u003c/span\u003e\n    or \u003cspan\u003ePHP\u003c/span\u003e fame,\n    respectively. Unfortunately (or fortunately?), there is no way to do\n    anything useful with these constructs. On the other hand,\n    \u003ccode\u003e\\set bar :foo\u003c/code\u003e is a perfectly valid way to copy a\n    variable.\n    \u003c/p\u003e\u003c/div\u003e\u003cp\u003e\n    A number of these variables are treated specially\n    by \u003cspan\u003epsql\u003c/span\u003e. They represent certain option\n    settings that can be changed at run time by altering the value of\n    the variable, or in some cases represent changeable state of\n    \u003cspan\u003epsql\u003c/span\u003e.\n    By convention, all specially treated variables\u0026#39; names\n    consist of all upper-case ASCII letters (and possibly digits and\n    underscores). To ensure maximum compatibility in the future, avoid\n    using such variable names for your own purposes.\n   \u003c/p\u003e\u003cp\u003e\n    Variables that control \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s behavior\n    generally cannot be unset or set to invalid values.  An \u003ccode\u003e\\unset\u003c/code\u003e\n    command is allowed but is interpreted as setting the variable to its\n    default value.  A \u003ccode\u003e\\set\u003c/code\u003e command without a second argument is\n    interpreted as setting the variable to \u003ccode\u003eon\u003c/code\u003e, for control\n    variables that accept that value, and is rejected for others.  Also,\n    control variables that accept the values \u003ccode\u003eon\u003c/code\u003e\n    and \u003ccode\u003eoff\u003c/code\u003e will also accept other common spellings of Boolean\n    values, such as \u003ccode\u003etrue\u003c/code\u003e and \u003ccode\u003efalse\u003c/code\u003e.\n   \u003c/p\u003e\u003cp\u003e\n    The specially treated variables are:\n   \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"\u003e\u003cspan\u003e\n\u003ccode\u003eAUTOCOMMIT\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When \u003ccode\u003eon\u003c/code\u003e (the default), each SQL command is automatically\n        committed upon successful completion.  To postpone commit in this\n        mode, you must enter a \u003ccode\u003eBEGIN\u003c/code\u003e or \u003ccode\u003eSTART\n        TRANSACTION\u003c/code\u003e SQL command.  When \u003ccode\u003eoff\u003c/code\u003e or unset, SQL\n        commands are not committed until you explicitly issue\n        \u003ccode\u003eCOMMIT\u003c/code\u003e or \u003ccode\u003eEND\u003c/code\u003e.  The autocommit-off\n        mode works by issuing an implicit \u003ccode\u003eBEGIN\u003c/code\u003e for you, just\n        before any command that is not already in a transaction block and\n        is not itself a \u003ccode\u003eBEGIN\u003c/code\u003e or other transaction-control\n        command, nor a command that cannot be executed inside a transaction\n        block (such as \u003ccode\u003eVACUUM\u003c/code\u003e).\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         In autocommit-off mode, you must explicitly abandon any failed\n         transaction by entering \u003ccode\u003eABORT\u003c/code\u003e or \u003ccode\u003eROLLBACK\u003c/code\u003e.\n         Also keep in mind that if you exit the session\n         without committing, your work will be lost.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n         The autocommit-on mode is \u003cspan\u003ePostgreSQL\u003c/span\u003e\u0026#39;s traditional\n         behavior, but autocommit-off is closer to the SQL spec.  If you\n         prefer autocommit-off, you might wish to set it in the system-wide\n         \u003ccode\u003epsqlrc\u003c/code\u003e file or your\n         \u003ccode\u003e~/.psqlrc\u003c/code\u003e file.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"\u003e\u003cspan\u003e\u003ccode\u003eCOMP_KEYWORD_CASE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Determines which letter case to use when completing an SQL key word.\n        If set to \u003ccode\u003elower\u003c/code\u003e or \u003ccode\u003eupper\u003c/code\u003e, the\n        completed word will be in lower or upper case, respectively.  If set\n        to \u003ccode\u003epreserve-lower\u003c/code\u003e\n        or \u003ccode\u003epreserve-upper\u003c/code\u003e (the default), the completed word\n        will be in the case of the word already entered, but words being\n        completed without anything entered will be in lower or upper case,\n        respectively.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-DBNAME\"\u003e\u003cspan\u003e\u003ccode\u003eDBNAME\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The name of the database you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO\"\u003e\u003cspan\u003e\u003ccode\u003eECHO\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If set to \u003ccode\u003eall\u003c/code\u003e, all nonempty input lines are printed\n        to standard output as they are read.  (This does not apply to lines\n        read interactively.)  To select this behavior on program\n        start-up, use the switch \u003ccode\u003e-a\u003c/code\u003e. If set to\n        \u003ccode\u003equeries\u003c/code\u003e,\n        \u003cspan\u003epsql\u003c/span\u003e prints each query to standard output\n        as it is sent to the server. The switch to select this behavior is\n        \u003ccode\u003e-e\u003c/code\u003e. If set to \u003ccode\u003eerrors\u003c/code\u003e, then only\n        failed queries are displayed on standard error output. The switch\n        for this behavior is \u003ccode\u003e-b\u003c/code\u003e. If set to\n        \u003ccode\u003enone\u003c/code\u003e (the default), then no queries are displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"\u003e\u003cspan\u003e\u003ccode\u003eECHO_HIDDEN\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode\u003eon\u003c/code\u003e and a backslash command\n        queries the database, the query is first shown.\n        This feature helps you to study\n        \u003cspan\u003ePostgreSQL\u003c/span\u003e internals and provide\n        similar functionality in your own programs. (To select this behavior\n        on program start-up, use the switch \u003ccode\u003e-E\u003c/code\u003e.)  If you set\n        this variable to the value \u003ccode\u003enoexec\u003c/code\u003e, the queries are\n        just shown but are not actually sent to the server and executed.\n        The default value is \u003ccode\u003eoff\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ENCODING\"\u003e\u003cspan\u003e\u003ccode\u003eENCODING\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The current client character set encoding.\n        This is set every time you connect to a database (including\n        program start-up), and when you change the encoding\n        with \u003ccode\u003e\\encoding\u003c/code\u003e, but it can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ERROR\"\u003e\u003cspan\u003e\u003ccode\u003eERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode\u003etrue\u003c/code\u003e if the last SQL query failed, \u003ccode\u003efalse\u003c/code\u003e if\n         it succeeded.  See also \u003ccode\u003eSQLSTATE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"\u003e\u003cspan\u003e\u003ccode\u003eFETCH_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If this variable is set to an integer value greater than zero,\n        the results of \u003ccode\u003eSELECT\u003c/code\u003e queries are fetched\n        and displayed in groups of that many rows, rather than the\n        default behavior of collecting the entire result set before\n        display.  Therefore only a\n        limited amount of memory is used, regardless of the size of\n        the result set.  Settings of 100 to 1000 are commonly used\n        when enabling this feature.\n        Keep in mind that when using this feature, a query might\n        fail after having already displayed some rows.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Although you can use any output format with this feature,\n        the default \u003ccode\u003ealigned\u003c/code\u003e format tends to look bad\n        because each group of \u003ccode\u003eFETCH_COUNT\u003c/code\u003e rows\n        will be formatted separately, leading to varying column\n        widths across the row groups.  The other output formats work better.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"\u003e\u003cspan\u003e\u003ccode\u003eHIDE_TABLEAM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode\u003etrue\u003c/code\u003e, a table\u0026#39;s access\n         method details are not displayed. This is mainly useful for\n         regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"\u003e\u003cspan\u003e\u003ccode\u003eHIDE_TOAST_COMPRESSION\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode\u003etrue\u003c/code\u003e, column\n         compression method details are not displayed. This is mainly\n         useful for regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"\u003e\u003cspan\u003e\u003ccode\u003eHISTCONTROL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode\u003eignorespace\u003c/code\u003e,\n         lines which begin with a space are not entered into the history\n         list. If set to a value of \u003ccode\u003eignoredups\u003c/code\u003e, lines\n         matching the previous history line are not entered. A value of\n         \u003ccode\u003eignoreboth\u003c/code\u003e combines the two options. If\n         set to \u003ccode\u003enone\u003c/code\u003e (the default), all lines\n         read in interactive mode are saved on the history list.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTFILE\"\u003e\u003cspan\u003e\u003ccode\u003eHISTFILE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The file name that will be used to store the history list.  If unset,\n        the file name is taken from the \u003ccode\u003ePSQL_HISTORY\u003c/code\u003e\n        environment variable.  If that is not set either, the default\n        is \u003ccode\u003e~/.psql_history\u003c/code\u003e,\n        or \u003ccode\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n        For example, putting:\n\u003c/p\u003e\u003cpre\u003e\\set HISTFILE ~/.psql_history-:DBNAME\n\u003c/pre\u003e\u003cp\u003e\n        in \u003ccode\u003e~/.psqlrc\u003c/code\u003e will cause\n        \u003cspan\u003epsql\u003c/span\u003e to maintain a separate history for\n        each database.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTSIZE\"\u003e\u003cspan\u003e\u003ccode\u003eHISTSIZE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The maximum number of commands to store in the command history\n        (default 500).  If set to a negative value, no limit is applied.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HOST\"\u003e\u003cspan\u003e\u003ccode\u003eHOST\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server host you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"\u003e\u003cspan\u003e\u003ccode\u003eIGNOREEOF\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If set to 1 or less, sending an EOF character (usually\n         \u003cspan\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e)\n         to an interactive session of \u003cspan\u003epsql\u003c/span\u003e\n         will terminate the application.  If set to a larger numeric value,\n         that many consecutive EOF characters must be typed to\n         make an interactive session terminate.  If the variable is set to a\n         non-numeric value, it is interpreted as 10.  The default is 0.\n        \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LASTOID\"\u003e\u003cspan\u003e\u003ccode\u003eLASTOID\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the last affected OID, as returned from an\n        \u003ccode\u003eINSERT\u003c/code\u003e or \u003ccode\u003e\\lo_import\u003c/code\u003e\n        command. This variable is only guaranteed to be valid until\n        after the result of the next SQL command has\n        been displayed.\n        \u003cspan\u003ePostgreSQL\u003c/span\u003e servers since version 12 do not\n        support OID system columns anymore, thus LASTOID will always be 0\n        following \u003ccode\u003eINSERT\u003c/code\u003e when targeting such servers.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"\u003e\u003cspan\u003e\u003ccode\u003eLAST_ERROR_MESSAGE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eLAST_ERROR_SQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The primary error message and associated SQLSTATE code for the most\n         recent failed query in the current \u003cspan\u003epsql\u003c/span\u003e session, or\n         an empty string and \u003ccode\u003e00000\u003c/code\u003e if no error has occurred in\n         the current session.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"\u003e\u003cspan\u003e\n\u003ccode\u003eON_ERROR_ROLLBACK\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode\u003eon\u003c/code\u003e, if a statement in a transaction block\n        generates an error, the error is ignored and the transaction\n        continues. When set to \u003ccode\u003einteractive\u003c/code\u003e, such errors are only\n        ignored in interactive sessions, and not when reading script\n        files. When set to \u003ccode\u003eoff\u003c/code\u003e (the default), a statement in a\n        transaction block that generates an error aborts the entire\n        transaction. The error rollback mode works by issuing an\n        implicit \u003ccode\u003eSAVEPOINT\u003c/code\u003e for you, just before each command\n        that is in a transaction block, and then rolling back to the\n        savepoint if the command fails.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"\u003e\u003cspan\u003e\u003ccode\u003eON_ERROR_STOP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, command processing continues after an error.  When this\n        variable is set to \u003ccode\u003eon\u003c/code\u003e, processing will instead stop\n        immediately.  In interactive mode,\n        \u003cspan\u003epsql\u003c/span\u003e will return to the command prompt;\n        otherwise, \u003cspan\u003epsql\u003c/span\u003e will exit, returning\n        error code 3 to distinguish this case from fatal error\n        conditions, which are reported using error code 1.  In either case,\n        any currently running scripts (the top-level script, if any, and any\n        other scripts which it may have in invoked) will be terminated\n        immediately.  If the top-level command string contained multiple SQL\n        commands, processing will stop with the current command.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"\u003e\u003cspan\u003e\u003ccode\u003ePIPELINE_COMMAND_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"\u003e\u003cspan\u003e\u003ccode\u003ePIPELINE_RESULT_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands of an ongoing pipeline that were followed\n        by either a \u003ccode\u003e\\flushrequest\u003c/code\u003e or a\n        \u003ccode\u003e\\syncpipeline\u003c/code\u003e, forcing the server to send the\n        results. These results can be retrieved with\n        \u003ccode\u003e\\getresults\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"\u003e\u003cspan\u003e\u003ccode\u003ePIPELINE_SYNC_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of sync messages queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PORT\"\u003e\u003cspan\u003e\u003ccode\u003ePORT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server port to which you are currently connected.\n        This is set every time you connect to a database (including\n        program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PROMPT\"\u003e\u003cspan\u003e\u003ccode\u003ePROMPT1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePROMPT2\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePROMPT3\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These specify what the prompts \u003cspan\u003epsql\u003c/span\u003e\n        issues should look like. See \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"Prompting\" rel=\"nofollow\"\u003ePrompting\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-QUIET\"\u003e\u003cspan\u003e\u003ccode\u003eQUIET\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode\u003e-q\u003c/code\u003e. It is probably not too useful in\n        interactive mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"\u003e\u003cspan\u003e\u003ccode\u003eROW_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The number of rows returned or affected by the last SQL query, or 0\n         if the query failed or did not report a row count.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"\u003e\u003cspan\u003e\u003ccode\u003eSERVER_VERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eSERVER_VERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The server\u0026#39;s version number as a string, for\n        example \u003ccode\u003e9.6.2\u003c/code\u003e, \u003ccode\u003e10.1\u003c/code\u003e or \u003ccode\u003e11beta1\u003c/code\u003e,\n        and in numeric form, for\n        example \u003ccode\u003e90602\u003c/code\u003e or \u003ccode\u003e100001\u003c/code\u003e.\n        These are set every time you connect to a database\n        (including program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVICE\"\u003e\u003cspan\u003e\u003ccode\u003eSERVICE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The service name, if applicable.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"\u003e\u003cspan\u003e\u003ccode\u003eSHELL_ERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode\u003etrue\u003c/code\u003e if the last shell command\n         failed, \u003ccode\u003efalse\u003c/code\u003e if it succeeded.\n         This applies to shell commands invoked via the \u003ccode\u003e\\!\u003c/code\u003e,\n         \u003ccode\u003e\\g\u003c/code\u003e, \u003ccode\u003e\\o\u003c/code\u003e, \u003ccode\u003e\\w\u003c/code\u003e,\n         and \u003ccode\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode\u003eSHELL_EXIT_CODE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"\u003e\u003cspan\u003e\u003ccode\u003eSHELL_EXIT_CODE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The exit status returned by the last shell command.\n         0–127 represent program exit codes, 128–255\n         indicate termination by a signal, and -1 indicates failure\n         to launch a program or to collect its exit status.\n         This applies to shell commands invoked via the \u003ccode\u003e\\!\u003c/code\u003e,\n         \u003ccode\u003e\\g\u003c/code\u003e, \u003ccode\u003e\\o\u003c/code\u003e, \u003ccode\u003e\\w\u003c/code\u003e,\n         and \u003ccode\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode\u003eSHELL_ERROR\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"\u003e\u003cspan\u003e\u003ccode\u003eSHOW_ALL_RESULTS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode\u003eoff\u003c/code\u003e, only the last\n        result of a combined query (\u003ccode\u003e\\;\u003c/code\u003e) is shown instead of\n        all of them.  The default is \u003ccode\u003eon\u003c/code\u003e.  The off behavior\n        is for compatibility with older versions of\n        \u003cspan\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"\u003e\u003cspan\u003e\u003ccode\u003eSHOW_CONTEXT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the\n        values \u003ccode\u003enever\u003c/code\u003e, \u003ccode\u003eerrors\u003c/code\u003e, or \u003ccode\u003ealways\u003c/code\u003e\n        to control whether \u003ccode\u003eCONTEXT\u003c/code\u003e fields are displayed in\n        messages from the server. The default is \u003ccode\u003eerrors\u003c/code\u003e (meaning\n        that context will be shown in error messages, but not in notice or\n        warning messages).  This setting has no effect\n        when \u003ccode\u003eVERBOSITY\u003c/code\u003e is set to \u003ccode\u003eterse\u003c/code\u003e\n        or \u003ccode\u003esqlstate\u003c/code\u003e.\n        (See also \u003ccode\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLELINE\"\u003e\u003cspan\u003e\u003ccode\u003eSINGLELINE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode\u003e-S\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"\u003e\u003cspan\u003e\u003ccode\u003eSINGLESTEP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode\u003e-s\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SQLSTATE\"\u003e\u003cspan\u003e\u003ccode\u003eSQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The error code (see \u003ca href=\"/docs/18/errcodes-appendix.html\" rel=\"nofollow\"\u003eAppendix A\u003c/a\u003e) associated\n         with the last SQL query\u0026#39;s failure, or \u003ccode\u003e00000\u003c/code\u003e if it\n         succeeded.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-USER\"\u003e\u003cspan\u003e\u003ccode\u003eUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database user you are currently connected as. This is set\n        every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERBOSITY\"\u003e\u003cspan\u003e\u003ccode\u003eVERBOSITY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the values \u003ccode\u003edefault\u003c/code\u003e,\n        \u003ccode\u003everbose\u003c/code\u003e, \u003ccode\u003eterse\u003c/code\u003e,\n        or \u003ccode\u003esqlstate\u003c/code\u003e to control the verbosity of error\n        reports.\n        (See also \u003ccode\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERSION\"\u003e\u003cspan\u003e\u003ccode\u003eVERSION\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eVERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eVERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These variables are set at program start-up to reflect\n        \u003cspan\u003epsql\u003c/span\u003e\u0026#39;s version, respectively as a verbose string,\n        a short string (e.g., \u003ccode\u003e9.6.2\u003c/code\u003e, \u003ccode\u003e10.1\u003c/code\u003e,\n        or \u003ccode\u003e11beta1\u003c/code\u003e), and a number (e.g., \u003ccode\u003e90602\u003c/code\u003e\n        or \u003ccode\u003e100001\u003c/code\u003e).  They can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003cspan\u003e\u003ccode\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable sets the default interval, in seconds, which\n        \u003ccode\u003e\\watch\u003c/code\u003e waits between executing the query. The\n        default is 2 seconds.  Specifying an interval in the command overrides\n        this variable.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-INTERPOLATION\"\u003e\u003ch4\u003eSQL Interpolation\u003c/h4\u003e\u003cp\u003e\n    A key feature of \u003cspan\u003epsql\u003c/span\u003e\n    variables is that you can substitute (\u003cspan\u003e“\u003cspan\u003einterpolate\u003c/span\u003e”\u003c/span\u003e)\n    them into regular SQL statements, as well as the\n    arguments of meta-commands.  Furthermore,\n    \u003cspan\u003epsql\u003c/span\u003e provides facilities for\n    ensuring that variable values used as SQL literals and identifiers are\n    properly quoted.  The syntax for interpolating a value without\n    any quoting is to prepend the variable name with a colon\n    (\u003ccode\u003e:\u003c/code\u003e).  For example,\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\set foo \u0026#39;my_table\u0026#39;\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM :foo;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    would query the table \u003ccode\u003emy_table\u003c/code\u003e. Note that this\n    may be unsafe: the value of the variable is copied literally, so it can\n    contain unbalanced quotes, or even backslash commands. You must make sure\n    that it makes sense where you put it.\n    \u003c/p\u003e\u003cp\u003e\n    When a value is to be used as an SQL literal or identifier, it is\n    safest to arrange for it to be quoted.  To quote the value of\n    a variable as an SQL literal, write a colon followed by the variable\n    name in single quotes.  To quote the value as an SQL identifier, write\n    a colon followed by the variable name in double quotes.\n    These constructs deal correctly with quotes and other special\n    characters embedded within the variable value.\n    The previous example would be more safely written this way:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\set foo \u0026#39;my_table\u0026#39;\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM :\u0026#34;foo\u0026#34;;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Variable interpolation will not be performed within quoted\n    SQL literals and identifiers.  Therefore, a\n    construction such as \u003ccode\u003e\u0026#39;:foo\u0026#39;\u003c/code\u003e doesn\u0026#39;t work to produce a quoted\n    literal from a variable\u0026#39;s value (and it would be unsafe if it did work,\n    since it wouldn\u0026#39;t correctly handle quotes embedded in the value).\n    \u003c/p\u003e\u003cp\u003e\n    One example use of this mechanism is to\n    copy the contents of a file into a table column.\n    First load the file into a variable and then interpolate the variable\u0026#39;s\n    value as a quoted string:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\set content `cat my_file.txt`\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eINSERT INTO my_table VALUES (:\u0026#39;content\u0026#39;);\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    (Note that this still won\u0026#39;t work if \u003ccode\u003emy_file.txt\u003c/code\u003e contains NUL bytes.\n    \u003cspan\u003epsql\u003c/span\u003e does not support embedded NUL bytes in variable values.)\n    \u003c/p\u003e\u003cp\u003e\n    Since colons can legally appear in SQL commands, an apparent attempt\n    at interpolation (that is, \u003ccode\u003e:name\u003c/code\u003e,\n    \u003ccode\u003e:\u0026#39;name\u0026#39;\u003c/code\u003e, or \u003ccode\u003e:\u0026#34;name\u0026#34;\u003c/code\u003e) is not\n    replaced unless the named variable is currently set. In any case, you\n    can escape a colon with a backslash to protect it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    The \u003ccode\u003e:{?\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e special syntax returns TRUE\n    or FALSE depending on whether the variable exists or not, and is thus\n    always substituted, unless the colon is backslash-escaped.\n    \u003c/p\u003e\u003cp\u003e\n    The colon syntax for variables is standard SQL for\n    embedded query languages, such as \u003cspan\u003eECPG\u003c/span\u003e.\n    The colon syntaxes for array slices and type casts are\n    \u003cspan\u003ePostgreSQL\u003c/span\u003e extensions, which can sometimes\n    conflict with the standard usage.  The colon-quote syntax for escaping a\n    variable\u0026#39;s value as an SQL literal or identifier is a\n    \u003cspan\u003epsql\u003c/span\u003e extension.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-PROMPTING\"\u003e\u003ch4\u003ePrompting\u003c/h4\u003e\u003cp\u003e\n    The prompts \u003cspan\u003epsql\u003c/span\u003e issues can be customized\n    to your preference. The three variables \u003ccode\u003ePROMPT1\u003c/code\u003e,\n    \u003ccode\u003ePROMPT2\u003c/code\u003e, and \u003ccode\u003ePROMPT3\u003c/code\u003e contain strings\n    and special escape sequences that describe the appearance of the\n    prompt. Prompt 1 is the normal prompt that is issued when\n    \u003cspan\u003epsql\u003c/span\u003e requests a new command. Prompt 2 is\n    issued when more input is expected during command entry, for example\n    because the command was not terminated with a semicolon or a quote\n    was not closed.\n    Prompt 3 is issued when you are running an SQL\n\u003ccode\u003eCOPY FROM STDIN\u003c/code\u003e command and you need to type in\n    a row value on the terminal.\n    \u003c/p\u003e\u003cp\u003e\n    The value of the selected prompt variable is printed literally,\n    except where a percent sign (\u003ccode\u003e%\u003c/code\u003e) is encountered.\n    Depending on the next character, certain other text is substituted\n    instead. Defined substitutions are:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-UC\"\u003e\u003cspan\u003e\u003ccode\u003e%M\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The full host name (with domain name) of the database server,\n          or \u003ccode\u003e[local]\u003c/code\u003e if the connection is over a Unix\n          domain socket, or\n          \u003ccode\u003e[local:\u003cem\u003e\u003ccode\u003e/dir/name\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e,\n          if the Unix domain socket is not at the compiled in default\n          location.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-LC\"\u003e\u003cspan\u003e\u003ccode\u003e%m\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The host name of the database server, truncated at the\n          first dot, or \u003ccode\u003e[local]\u003c/code\u003e if the connection is\n          over a Unix domain socket.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-GT\"\u003e\u003cspan\u003e\u003ccode\u003e%\u0026gt;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe port number at which the database server is listening.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-N\"\u003e\u003cspan\u003e\u003ccode\u003e%n\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The database session user name.  (The expansion of this\n          value might change during a database session as the result\n          of the command \u003ccode\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-S\"\u003e\u003cspan\u003e\u003ccode\u003e%s\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the service.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SLASH\"\u003e\u003cspan\u003e\u003ccode\u003e%/\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the current database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-TILDE\"\u003e\u003cspan\u003e\u003ccode\u003e%~\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eLike \u003ccode\u003e%/\u003c/code\u003e, but the output is \u003ccode\u003e~\u003c/code\u003e\n         (tilde) if the database is your default database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"\u003e\u003cspan\u003e\u003ccode\u003e%#\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If the session user is a database superuser, then a\n          \u003ccode\u003e#\u003c/code\u003e, otherwise a \u003ccode\u003e\u0026gt;\u003c/code\u003e.\n          (The expansion of this value might change during a database\n          session as the result of the command \u003ccode\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P\"\u003e\u003cspan\u003e\u003ccode\u003e%p\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe process ID of the backend currently connected to.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P-UC\"\u003e\u003cspan\u003e\u003ccode\u003e%P\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Pipeline status: \u003ccode\u003eoff\u003c/code\u003e when not in a pipeline,\n        \u003ccode\u003eon\u003c/code\u003e when in an ongoing pipeline or\n        \u003ccode\u003eabort\u003c/code\u003e when in an aborted pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-R\"\u003e\u003cspan\u003e\u003ccode\u003e%R\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In prompt 1 normally \u003ccode\u003e=\u003c/code\u003e,\n        but \u003ccode\u003e@\u003c/code\u003e if the session is in an inactive branch of a\n        conditional block, or \u003ccode\u003e^\u003c/code\u003e if in single-line mode,\n        or \u003ccode\u003e!\u003c/code\u003e if the session is disconnected from the\n        database (which can happen if \u003ccode\u003e\\connect\u003c/code\u003e fails).\n        In prompt 2 \u003ccode\u003e%R\u003c/code\u003e is replaced by a character that\n        depends on why \u003cspan\u003epsql\u003c/span\u003e expects more input:\n        \u003ccode\u003e-\u003c/code\u003e if the command simply wasn\u0026#39;t terminated yet,\n        but \u003ccode\u003e*\u003c/code\u003e if there is an unfinished\n        \u003ccode\u003e/* ... */\u003c/code\u003e comment,\n        a single quote if there is an unfinished quoted string,\n        a double quote if there is an unfinished quoted identifier,\n        a dollar sign if there is an unfinished dollar-quoted string,\n        or \u003ccode\u003e(\u003c/code\u003e if there is an unmatched left parenthesis.\n        In prompt 3 \u003ccode\u003e%R\u003c/code\u003e doesn\u0026#39;t produce anything.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-X\"\u003e\u003cspan\u003e\u003ccode\u003e%x\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Transaction status: an empty string when not in a transaction\n        block, or \u003ccode\u003e*\u003c/code\u003e when in a transaction block, or\n        \u003ccode\u003e!\u003c/code\u003e when in a failed transaction block, or \u003ccode\u003e?\u003c/code\u003e\n        when the transaction state is indeterminate (for example, because\n        there is no connection).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-L\"\u003e\u003cspan\u003e\u003ccode\u003e%l\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The line number inside the current statement, starting from \u003ccode\u003e1\u003c/code\u003e.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-DIGITS\"\u003e\u003cspan\u003e\u003ccode\u003e%\u003c/code\u003e\u003cem\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The character with the indicated octal code is substituted.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NAME\"\u003e\u003cspan\u003e\u003ccode\u003e%:\u003c/code\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003ccode\u003e:\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the \u003cspan\u003epsql\u003c/span\u003e variable\n        \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e. See\n        \u003ca href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\" rel=\"nofollow\"\u003eVariables\u003c/a\u003e, above, for details.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-COMMAND\"\u003e\u003cspan\u003e\u003ccode\u003e%`\u003c/code\u003e\u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003ccode\u003e`\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The output of \u003cem\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e, similar to ordinary\n        \u003cspan\u003e“\u003cspan\u003eback-tick\u003c/span\u003e”\u003c/span\u003e substitution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"\u003e\u003cspan\u003e\u003ccode\u003e%[\u003c/code\u003e ... \u003ccode\u003e%]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts can contain terminal control characters which, for\n         example, change the color, background, or style of the prompt\n         text, or change the title of the terminal window. In order for\n         the line editing features of \u003cspan\u003eReadline\u003c/span\u003e to work properly, these\n         non-printing control characters must be designated as invisible\n         by surrounding them with \u003ccode\u003e%[\u003c/code\u003e and\n         \u003ccode\u003e%]\u003c/code\u003e. Multiple pairs of these can occur within\n         the prompt.  For example:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \\set PROMPT1 \u0026#39;%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# \u0026#39;\n\u003c/pre\u003e\u003cp\u003e\n         results in a boldfaced (\u003ccode\u003e1;\u003c/code\u003e) yellow-on-black\n         (\u003ccode\u003e33;40\u003c/code\u003e) prompt on VT100-compatible, color-capable\n         terminals.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-W\"\u003e\u003cspan\u003e\u003ccode\u003e%w\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Whitespace of the same width as the most recent output of\n        \u003ccode\u003ePROMPT1\u003c/code\u003e.  This can be used as a\n        \u003ccode\u003ePROMPT2\u003c/code\u003e setting, so that multi-line statements are\n        aligned with the first line, but there is no visible secondary prompt.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\n    To insert a percent sign into your prompt, write\n    \u003ccode\u003e%%\u003c/code\u003e. The default prompts are\n    \u003ccode\u003e\u0026#39;%/%R%x%# \u0026#39;\u003c/code\u003e for prompts 1 and 2, and\n    \u003ccode\u003e\u0026#39;\u0026gt;\u0026gt; \u0026#39;\u003c/code\u003e for prompt 3.\n    \u003c/p\u003e\u003cdiv\u003e\u003ch3\u003eNote\u003c/h3\u003e\u003cp\u003e\n    This feature was shamelessly plagiarized from\n    \u003cspan\u003etcsh\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-READLINE\"\u003e\u003ch4\u003eCommand-Line Editing\u003c/h4\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e uses\n    the \u003cspan\u003eReadline\u003c/span\u003e\n    or \u003cspan\u003elibedit\u003c/span\u003e library, if available, for\n    convenient line editing and retrieval.  The command history is\n    automatically saved when \u003cspan\u003epsql\u003c/span\u003e exits and is\n    reloaded when \u003cspan\u003epsql\u003c/span\u003e starts up.  Type\n    up-arrow or control-P to retrieve previous lines.\n    \u003c/p\u003e\u003cp\u003e\n    You can also use tab completion to fill in partially-typed keywords\n    and SQL object names in many (by no means all) contexts.  For example,\n    at the start of a command, typing \u003ccode\u003eins\u003c/code\u003e and pressing\n    TAB will fill in \u003ccode\u003einsert into \u003c/code\u003e.  Then, typing a few\n    characters of a table or schema name and pressing \u003ccode\u003eTAB\u003c/code\u003e\n    will fill in the unfinished name, or offer a menu of possible completions\n    when there\u0026#39;s more than one.  (Depending on the library in use, you may need to\n    press \u003ccode\u003eTAB\u003c/code\u003e more than once to get a menu.)\n    \u003c/p\u003e\u003cp\u003e\n    Tab completion for SQL object names requires sending queries to the\n    server to find possible matches.  In some contexts this can interfere\n    with other operations.  For example, after \u003ccode\u003eBEGIN\u003c/code\u003e\n    it will be too late to issue \u003ccode\u003eSET TRANSACTION ISOLATION\n    LEVEL\u003c/code\u003e if a tab-completion query is issued in between.\n    If you do not want tab completion at all, you\n    can turn it off permanently by putting this in a file named\n    \u003ccode\u003e.inputrc\u003c/code\u003e in your home directory:\n\u003c/p\u003e\u003cpre\u003e$if psql\nset disable-completion on\n$endif\n\u003c/pre\u003e\u003cp\u003e\n    (This is not a \u003cspan\u003epsql\u003c/span\u003e but a\n    \u003cspan\u003eReadline\u003c/span\u003e feature. Read its documentation\n    for further details.)\n    \u003c/p\u003e\u003cp\u003e\n     The \u003ccode\u003e-n\u003c/code\u003e (\u003ccode\u003e--no-readline\u003c/code\u003e) command line\n     option can also be useful to disable use\n     of \u003cspan\u003eReadline\u003c/span\u003e for a single run\n     of \u003cspan\u003epsql\u003c/span\u003e.  This prevents tab completion,\n     use or recording of command line history, and editing of multi-line\n     commands.  It is particularly useful when you need to copy-and-paste\n     text that contains \u003ccode\u003eTAB\u003c/code\u003e characters.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-ENVIRONMENT\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"\u003e\u003cspan\u003e\u003ccode\u003eCOLUMNS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If \u003ccode\u003e\\pset columns\u003c/code\u003e is zero, controls the\n      width for the \u003ccode\u003ewrapped\u003c/code\u003e format and width for determining\n      if wide output requires the pager or should be switched to the\n      vertical format in expanded auto mode.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"\u003e\u003cspan\u003e\u003ccode\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePGUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Default connection parameters (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"\u003e\u003cspan\u003e\u003ccode\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and\n      \u003ccode\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"\u003e\u003cspan\u003e\u003ccode\u003ePSQL_EDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eEDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eVISUAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Editor used by the \u003ccode\u003e\\e\u003c/code\u003e, \u003ccode\u003e\\ef\u003c/code\u003e,\n      and \u003ccode\u003e\\ev\u003c/code\u003e commands.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If none of them is set, the default is to use \u003ccode\u003evi\u003c/code\u003e\n      on Unix systems or \u003ccode\u003enotepad.exe\u003c/code\u003e on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"\u003e\u003cspan\u003e\u003ccode\u003ePSQL_EDITOR_LINENUMBER_ARG\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When \u003ccode\u003e\\e\u003c/code\u003e, \u003ccode\u003e\\ef\u003c/code\u003e, or\n      \u003ccode\u003e\\ev\u003c/code\u003e is used\n      with a line number argument, this variable specifies the\n      command-line argument used to pass the starting line number to\n      the user\u0026#39;s editor.  For editors such as \u003cspan\u003eEmacs\u003c/span\u003e or\n      \u003cspan\u003evi\u003c/span\u003e, this is a plus sign.  Include a trailing\n      space in the value of the variable if there needs to be space\n      between the option name and the line number.  Examples:\n\u003c/p\u003e\u003cpre\u003ePSQL_EDITOR_LINENUMBER_ARG=\u0026#39;+\u0026#39;\nPSQL_EDITOR_LINENUMBER_ARG=\u0026#39;--line \u0026#39;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n      The default is \u003ccode\u003e+\u003c/code\u003e on Unix systems\n      (corresponding to the default editor \u003ccode\u003evi\u003c/code\u003e,\n      and useful for many other common editors); but there is no\n      default on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"\u003e\u003cspan\u003e\u003ccode\u003ePSQL_HISTORY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location for the command history file. Tilde (\u003ccode\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PAGER\"\u003e\u003cspan\u003e\u003ccode\u003ePSQL_PAGER\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003ePAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If a query\u0026#39;s results do not fit on the screen, they are piped\n      through this command. Typical values are \u003ccode\u003emore\u003c/code\u003e\n      or \u003ccode\u003eless\u003c/code\u003e.\n      Use of the pager can be disabled by setting \u003ccode\u003ePSQL_PAGER\u003c/code\u003e\n      or \u003ccode\u003ePAGER\u003c/code\u003e to an empty string, or by adjusting the\n      pager-related options of the \u003ccode\u003e\\pset\u003c/code\u003e command.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If neither of them is set, the default is to use \u003ccode\u003emore\u003c/code\u003e on most\n      platforms, but \u003ccode\u003eless\u003c/code\u003e on Cygwin.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"\u003e\u003cspan\u003e\u003ccode\u003ePSQL_WATCH_PAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When a query is executed repeatedly with the \u003ccode\u003e\\watch\u003c/code\u003e\n      command, a pager is not used by default.  This behavior can be changed\n      by setting \u003ccode\u003ePSQL_WATCH_PAGER\u003c/code\u003e to a pager command, on Unix\n      systems.  The \u003ccode\u003epspg\u003c/code\u003e pager (not part of\n      \u003cspan\u003ePostgreSQL\u003c/span\u003e but available in many open source\n      software distributions) can display the output of\n      \u003ccode\u003e\\watch\u003c/code\u003e if started with the option\n      \u003ccode\u003e--stream\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"\u003e\u003cspan\u003e\u003ccode\u003ePSQLRC\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location of the user\u0026#39;s \u003ccode\u003e.psqlrc\u003c/code\u003e file. Tilde (\u003ccode\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-SHELL\"\u003e\u003cspan\u003e\u003ccode\u003eSHELL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Command executed by the \u003ccode\u003e\\!\u003c/code\u003e command.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"\u003e\u003cspan\u003e\u003ccode\u003eTMPDIR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Directory for storing temporary files.  The default is\n      \u003ccode\u003e/tmp\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e\n   (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.10\"\u003e\u003ch2\u003eFiles\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-FILES-PSQLRC\"\u003e\u003cspan\u003e\u003ccode\u003epsqlrc\u003c/code\u003e and \u003ccode\u003e~/.psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     Unless it is passed an \u003ccode\u003e-X\u003c/code\u003e option,\n     \u003cspan\u003epsql\u003c/span\u003e attempts to read and execute commands\n     from the system-wide startup file (\u003ccode\u003epsqlrc\u003c/code\u003e) and then\n     the user\u0026#39;s personal startup file (\u003ccode\u003e~/.psqlrc\u003c/code\u003e), after\n     connecting to the database but before accepting normal commands.\n     These files can be used to set up the client and/or the server to taste,\n     typically with \u003ccode\u003e\\set\u003c/code\u003e and \u003ccode\u003eSET\u003c/code\u003e\n     commands.\n    \u003c/p\u003e\u003cp\u003e\n     The system-wide startup file is named \u003ccode\u003epsqlrc\u003c/code\u003e.\n     By default it is\n     sought in the installation\u0026#39;s \u003cspan\u003e“\u003cspan\u003esystem configuration\u003c/span\u003e”\u003c/span\u003e directory,\n     which is most reliably identified by running \u003ccode\u003epg_config\n     --sysconfdir\u003c/code\u003e.\n     Typically this directory will be \u003ccode\u003e../etc/\u003c/code\u003e\n     relative to the directory containing\n     the \u003cspan\u003ePostgreSQL\u003c/span\u003e executables.\n     The directory to look in can be set explicitly via\n     the \u003ccode\u003ePGSYSCONFDIR\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     The user\u0026#39;s personal startup file is named \u003ccode\u003e.psqlrc\u003c/code\u003e\n     and is sought in the invoking user\u0026#39;s home directory.\n     On Windows the personal startup file is instead named\n     \u003ccode\u003e%APPDATA%\\postgresql\\psqlrc.conf\u003c/code\u003e.\n     In either case, this default file path can be overridden by setting\n     the \u003ccode\u003ePSQLRC\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     Both the system-wide startup file and the user\u0026#39;s personal startup file\n     can be made \u003cspan\u003epsql\u003c/span\u003e-version-specific\n     by appending a dash and the \u003cspan\u003ePostgreSQL\u003c/span\u003e\n     major or minor release identifier to the file name,\n     for example \u003ccode\u003e~/.psqlrc-18\u003c/code\u003e or\n     \u003ccode\u003e~/.psqlrc-18.7\u003c/code\u003e.\n     The most specific version-matching file will be read in preference\n     to a non-version-specific file.\n     These version suffixes are added after determining the file path\n     as explained above.\n    \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-FILES-PSQL-HISTORY\"\u003e\u003cspan\u003e\u003ccode\u003e.psql_history\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     The command-line history is stored in the file\n     \u003ccode\u003e~/.psql_history\u003c/code\u003e, or\n     \u003ccode\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n    \u003c/p\u003e\u003cp\u003e\n     The location of the history file can be set explicitly via\n     the \u003ccode\u003eHISTFILE\u003c/code\u003e \u003cspan\u003epsql\u003c/span\u003e variable or\n     the \u003ccode\u003ePSQL_HISTORY\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.11\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\u003cspan\u003epsql\u003c/span\u003e works best with servers of the same\n       or an older major version.  Backslash commands are particularly likely\n       to fail if the server is of a newer version than \u003cspan\u003epsql\u003c/span\u003e\n       itself.  However, backslash commands of the \u003ccode\u003e\\d\u003c/code\u003e family should\n       work with servers of versions back to 9.2, though not necessarily with\n       servers newer than \u003cspan\u003epsql\u003c/span\u003e itself.  The general\n       functionality of running SQL commands and displaying query results\n       should also work with servers of a newer major version, but this cannot\n       be guaranteed in all cases.\n      \u003c/p\u003e\u003cp\u003e\n       If you want to use \u003cspan\u003epsql\u003c/span\u003e to connect to several\n       servers of different major versions, it is recommended that you use the\n       newest version of \u003cspan\u003epsql\u003c/span\u003e.  Alternatively, you\n       can keep around a copy of \u003cspan\u003epsql\u003c/span\u003e from each\n       major version and be sure to use the version that matches the\n       respective server.  But in practice, this additional complication should\n       not be necessary.\n      \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n       Before \u003cspan\u003ePostgreSQL\u003c/span\u003e 9.6,\n       the \u003ccode\u003e-c\u003c/code\u003e option implied \u003ccode\u003e-X\u003c/code\u003e\n       (\u003ccode\u003e--no-psqlrc\u003c/code\u003e); this is no longer the case.\n      \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n       Before \u003cspan\u003ePostgreSQL\u003c/span\u003e 8.4,\n       \u003cspan\u003epsql\u003c/span\u003e allowed the\n       first argument of a single-letter backslash command to start\n       directly after the command, without intervening whitespace.\n       Now, some whitespace is required.\n      \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.21.12\"\u003e\u003ch2\u003eNotes for Windows Users\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epsql\u003c/span\u003e is built as a \u003cspan\u003e“\u003cspan\u003econsole\n  application\u003c/span\u003e”\u003c/span\u003e.  Since the Windows console windows use a different\n  encoding than the rest of the system, you must take special care\n  when using 8-bit characters within \u003cspan\u003epsql\u003c/span\u003e.\n  If \u003cspan\u003epsql\u003c/span\u003e detects a problematic\n  console code page, it will warn you at startup. To change the\n  console code page, two things are necessary:\n\n   \u003c/p\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\n      Set the code page by entering \u003cstrong\u003e\u003ccode\u003ecmd.exe /c chcp\n      1252\u003c/code\u003e\u003c/strong\u003e. (1252 is a code page that is appropriate for\n      German; replace it with your value.) If you are using Cygwin,\n      you can put this command in \u003ccode\u003e/etc/profile\u003c/code\u003e.\n     \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n      Set the console font to \u003ccode\u003eLucida Console\u003c/code\u003e, because the\n      raster font does not work with the ANSI code page.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"APP-PSQL-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n  The first example shows how to spread a command over several lines of\n  input. Notice the changing prompt:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eCREATE TABLE my_table (\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong\u003e\u003ccode\u003e first integer not null default 0,\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong\u003e\u003ccode\u003e second text)\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong\u003e\u003ccode\u003e;\u003c/code\u003e\u003c/strong\u003e\nCREATE TABLE\n\u003c/pre\u003e\u003cp\u003e\n  Now look at the table definition again:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\d my_table\u003c/code\u003e\u003c/strong\u003e\n              Table \u0026#34;public.my_table\u0026#34;\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n\u003c/pre\u003e\u003cp\u003e\n  Now we change the prompt to something more interesting:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\set PROMPT1 \u0026#39;%n@%m %~%R%# \u0026#39;\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n  Let\u0026#39;s assume you have filled the table with data and want to take a\n  look at it:\n\u003c/p\u003e\u003cpre\u003epeter@localhost testdb=\u0026gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n  You can display tables in different ways by using the\n  \u003ccode\u003e\\pset\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre\u003epeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset border 2\u003c/code\u003e\u003c/strong\u003e\nBorder style is 2.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset border 0\u003c/code\u003e\u003c/strong\u003e\nBorder style is 0.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset border 1\u003c/code\u003e\u003c/strong\u003e\nBorder style is 1.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset format csv\u003c/code\u003e\u003c/strong\u003e\nOutput format is csv.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset tuples_only\u003c/code\u003e\u003c/strong\u003e\nTuples only is on.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset format unaligned\u003c/code\u003e\u003c/strong\u003e\nOutput format is unaligned.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\pset fieldsep \u0026#39;\\t\u0026#39;\u003c/code\u003e\u003c/strong\u003e\nField separator is \u0026#34;    \u0026#34;.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none     1\ntwo     2\nthree   3\nfour    4\n\u003c/pre\u003e\u003cp\u003e\n  Alternatively, use the short commands:\n\u003c/p\u003e\u003cpre\u003epeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\a \\t \\x\u003c/code\u003e\u003c/strong\u003e\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  Also, these output format options can be set for just one query by using\n  \u003ccode\u003e\\g\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003epeter@localhost testdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT * FROM my_table\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb-\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\g (format=aligned tuples_only=off expanded=on)\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here is an example of using the \u003ccode\u003e\\df\u003c/code\u003e command to\n   find only functions with names matching \u003ccode\u003eint*pl\u003c/code\u003e\n   and whose second argument is of type \u003ccode\u003ebigint\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\df int*pl * bigint\u003c/code\u003e\u003c/strong\u003e\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here, the \u003ccode\u003e+\u003c/code\u003e option is used to display additional\n   information about one of these functions, and \u003ccode\u003ex\u003c/code\u003e is used\n   to display the results in expanded mode:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\df+x int*pl integer bigint\u003c/code\u003e\u003c/strong\u003e\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  When suitable, query results can be shown in a crosstab representation\n  with the \u003ccode\u003e\\crosstabview\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT first, second, first \u0026gt; 2 AS gt2 FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\crosstabview first second\u003c/code\u003e\u003c/strong\u003e\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n\nThis second example shows a multiplication table with rows sorted in reverse\nnumerical order and columns with an independent, ascending numerical order.\n\u003c/p\u003e\u003cpre\u003etestdb=\u0026gt; \u003cstrong\u003e\u003ccode\u003eSELECT t1.first as \u0026#34;A\u0026#34;, t2.first+100 AS \u0026#34;B\u0026#34;, t1.first*(t2.first+100) as \u0026#34;AxB\u0026#34;,\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong\u003e\u003ccode\u003erow_number() over(order by t2.first) AS ord\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong\u003e\u003ccode\u003eFROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong\u003e\u003ccode\u003e\\crosstabview \u0026#34;A\u0026#34; \u0026#34;B\u0026#34; \u0026#34;AxB\u0026#34; ord\u003c/code\u003e\u003c/strong\u003e\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"8535e5be13048c61784d2c59e97f487d85a1c5d92809a02855b9fb4ee8b7f16e","Payload":{"description":["psql — PostgreSQL interactive terminal"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PSQL\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e — \n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e interactive terminal\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.21.4.1\"\u003e\u003ccode class=\"command\"\u003epsql\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...] [\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n    [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e]]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is a terminal-based front-end to\n     \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e. It enables you to type in\n     queries interactively, issue them to\n     \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e, and see the query results.\n     Alternatively, input can be from a file or from command line\n     arguments. In addition, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides a\n     number of meta-commands and various shell-like features to\n     facilitate writing scripts and automating a wide variety of tasks.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"R1-APP-PSQL-3\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ALL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-a\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-all\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print all nonempty input lines to standard output as they are read.\n      (This does not apply to lines read interactively.) This is\n      equivalent to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003eall\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-ALIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-A\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-align\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to unaligned output mode. (The default output mode is\n      \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e.)  This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset format unaligned\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-b\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-errors\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print failed SQL commands to standard error output. This is\n      equivalent to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--command=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is to execute the given\n       command string, \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n       This option can be repeated and combined in any order with\n       the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e option.  When either \u003ccode class=\"option\"\u003e-c\u003c/code\u003e\n       or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and \u003ccode class=\"option\"\u003e-f\u003c/code\u003e\n       options in sequence.\n      \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e must be either\n       a command string that is completely parsable by the server (i.e.,\n       it contains no \u003cspan class=\"application\"\u003epsql\u003c/span\u003e-specific features),\n       or a single backslash command. Thus you cannot mix\n       SQL and \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       meta-commands within a \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option. To achieve that,\n       you could use repeated \u003ccode class=\"option\"\u003e-c\u003c/code\u003e options or pipe the string\n       into \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epsql -c '\\x' -c 'SELECT * FROM foo;'\n\u003c/pre\u003e\u003cp\u003e\n       or\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eecho '\\x \\\\ SELECT * FROM foo;' | psql\n\u003c/pre\u003e\u003cp\u003e\n       (\u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e is the separator meta-command.)\n      \u003c/p\u003e\u003cp\u003e\n       Each SQL command string passed\n       to \u003ccode class=\"option\"\u003e-c\u003c/code\u003e is sent to the server as a single request.\n       Because of this, the server executes it as a single transaction even\n       if the string contains multiple SQL commands,\n       unless there are explicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e\n       commands included in the string to divide it into multiple\n       transactions.  (See \u003ca class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. Multiple Statements in a Simple Query\"\u003eSection 54.2.2.1\u003c/a\u003e\n       for more details about how the server handles multi-query strings.)\n      \u003c/p\u003e\u003cp\u003e\n       If having several commands executed in one transaction is not desired,\n       use repeated \u003ccode class=\"option\"\u003e-c\u003c/code\u003e commands or feed multiple commands to\n       \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's standard input,\n       either using \u003cspan class=\"application\"\u003eecho\u003c/span\u003e as illustrated above, or\n       via a shell here-document, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epsql \u0026lt;\u0026lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-CSV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--csv\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to CSV (Comma-Separated Values) output\n      mode.  This is equivalent to \u003ccode class=\"command\"\u003e\\pset format csv\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Specifies the name of the database to connect to. This is\n       equivalent to specifying \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e as the first non-option\n       argument on the command line.  The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\n       can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e.\n       If so, connection string parameters will override any conflicting\n       command line options.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-queries\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Copy all SQL commands sent to the server to standard output as well.\n      This is equivalent\n      to setting the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n      \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--echo-hidden\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Echo the actual queries generated by \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e and other backslash\n      commands. You can use this to study \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n      internal operations. This is equivalent to\n      setting the variable \u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Read commands from the\n       file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e,\n       rather than standard input.\n       This option can be repeated and combined in any order with\n       the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option.  When either \u003ccode class=\"option\"\u003e-c\u003c/code\u003e\n       or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       does not read commands from standard input; instead it terminates\n       after processing all the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and \u003ccode class=\"option\"\u003e-f\u003c/code\u003e\n       options in sequence.\n       Except for that, this option is largely equivalent to the\n       meta-command \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n       If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n       (hyphen), then standard input is read until an EOF indication\n       or \u003ccode class=\"command\"\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n       interactive input with input from files.  Note however that Readline\n       is not used in this case (much as if \u003ccode class=\"option\"\u003e-n\u003c/code\u003e had been\n       specified).\n      \u003c/p\u003e\u003cp\u003e\n      Using this option is subtly different from writing \u003ccode class=\"literal\"\u003epsql\n      \u0026lt; \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. In general,\n      both will do what you expect, but using \u003ccode class=\"literal\"\u003e-f\u003c/code\u003e\n      enables some nice features such as error messages with line\n      numbers. There is also a slight chance that using this option will\n      reduce the start-up overhead. On the other hand, the variant using\n      the shell's input redirection is (in theory) guaranteed to yield\n      exactly the same output you would have received had you entered\n      everything by hand.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      field separator for unaligned output. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\f\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the host name of the machine on which the\n      server is running. If the value begins\n      with a slash, it is used as the directory for the Unix-domain\n      socket.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-H\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Switches to HTML output mode.  This is\n      equivalent to \u003ccode class=\"command\"\u003e\\pset format html\u003c/code\u003e or the\n      \u003ccode class=\"command\"\u003e\\H\u003c/code\u003e command.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--list\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      List all available databases, then exit. Other non-connection\n      options are ignored. This is similar to the meta-command\n      \u003ccode class=\"command\"\u003e\\list\u003c/code\u003e.\n      \u003c/p\u003e\u003cp\u003e\n      When this option is used, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will connect\n      to the database \u003ccode class=\"literal\"\u003epostgres\u003c/code\u003e, unless a different database\n      is named on the command line (option \u003ccode class=\"option\"\u003e-d\u003c/code\u003e or non-option\n      argument, possibly via a service entry, but not via an environment\n      variable).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-LOG-FILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-L \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--log-file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Write all query output into file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e, in addition to the\n       normal output destination.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-READLINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Do not use \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e for line editing and\n       do not use the command history (see\n       \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"Command-Line Editing\"\u003ethe section called “Command-Line Editing”\u003c/a\u003e below).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-OUTPUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--output=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Put all query output into file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. This is equivalent to\n      the command \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies the TCP port or the local Unix-domain\n      socket file extension on which the server is listening for\n      connections. Defaults to the value of the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\n      environment variable or, if not set, to the port specified at\n      compile time, usually 5432.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pset=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies printing options, in the style of\n      \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e. Note that here you\n      have to separate name and value with an equal sign instead of a\n      space. For example, to set the output format to \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e, you could write\n      \u003ccode class=\"literal\"\u003e-P format=latex\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-q\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--quiet\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e should do its work\n      quietly. By default, it prints welcome messages and various\n      informational output. If this option is used, none of this\n      happens. This is useful with the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option.\n      This is equivalent to setting the variable \u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e\n      to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Use \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseparator\u003c/code\u003e\u003c/em\u003e as the\n      record separator for unaligned output. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\pset recordsep\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-STEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-step\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Run in single-step mode. That means the user is prompted before\n      each command is sent to the server, with the option to cancel\n      execution as well. Use this to debug scripts.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-LINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-line\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Runs in single-line mode where a newline terminates an SQL command, as a\n      semicolon does.\n      \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n      This mode is provided for those who insist on it, but you are not\n      necessarily encouraged to use it. In particular, if you mix\n      SQL and meta-commands on a line the order of\n      execution might not always be clear to the inexperienced user.\n      \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tuples-only\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn off printing of column names and result row count footers,\n      etc. This is equivalent to \u003ccode class=\"command\"\u003e\\t\u003c/code\u003e or\n      \u003ccode class=\"command\"\u003e\\pset tuples_only\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-TABLE-ATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--table-attr=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies options to be placed within the\n      HTML \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag. See\n      \u003ccode class=\"command\"\u003e\\pset tableattr\u003c/code\u003e for details.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-USERNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Connect to the database as the user \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e instead of the default.\n      (You must have permission to do so, of course.)\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VARIABLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v \u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--set=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--variable=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eassignment\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Perform a variable assignment, like the \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e\n      meta-command. Note that you must separate name and value, if\n      any, by an equal sign on the command line. To unset a variable,\n      leave off the equal sign. To set a variable with an empty value,\n      use the equal sign but leave off the value. These assignments are\n      done during command line processing, so variables that reflect\n      connection state will get overwritten later.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Print the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e version and exit.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Never issue a password prompt.  If the server requires password\n       authentication and a password is not available from other sources\n       such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection\n       attempt will fail.  This option can be useful in batch jobs and\n       scripts where no user is present to enter a password.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Force \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to prompt for a\n       password before connecting to a database, even if the password will\n       not be used.\n      \u003c/p\u003e\u003cp\u003e\n       If the server requires password authentication and a password is not\n       available from other sources such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e\n       file, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will prompt for a\n       password in any case.  However, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       will waste a connection attempt finding out that the server wants a\n       password.  In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid\n       the extra connection attempt.\n      \u003c/p\u003e\u003cp\u003e\n       Note that this option will remain set for the entire session,\n       and so it affects uses of the meta-command\n       \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e as well as the initial connection attempt.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-x\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--expanded\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Turn on the expanded table formatting mode. This is equivalent to\n      \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-NO-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Do not read the start-up file (neither the system-wide\n      \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e file nor the user's\n      \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e file).\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--field-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the field separator for unaligned output to a zero byte.  This is\n      equivalent to \u003ccode class=\"command\"\u003e\\pset fieldsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-0\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--record-separator-zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Set the record separator for unaligned output to a zero byte.  This is\n      useful for interfacing, for example, with \u003ccode class=\"literal\"\u003exargs -0\u003c/code\u003e.\n      This is equivalent to \u003ccode class=\"command\"\u003e\\pset recordsep_zero\u003c/code\u003e.\n      \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--single-transaction\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used in combination with one or more\n        \u003ccode class=\"option\"\u003e-c\u003c/code\u003e and/or \u003ccode class=\"option\"\u003e-f\u003c/code\u003e options.  It causes\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to issue a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e command\n        before the first such option and a \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e command after\n        the last one, thereby wrapping all the commands into a single\n        transaction. If any of the commands fails and the variable\n        \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e was set, a\n        \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e command is sent instead. This ensures that\n        either all the commands complete successfully, or no changes are\n        applied.\n       \u003c/p\u003e\u003cp\u003e\n        If the commands themselves\n        contain \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e, \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e,\n        or \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e, this option will not have the desired\n        effects.  Also, if an individual command cannot be executed inside a\n        transaction block, specifying this option will cause the whole\n        transaction to fail.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-OPTION-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Show help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e and exit. The optional\n      \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter (defaulting\n      to \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e) selects which part of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is\n      explained: \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e describes \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n      backslash commands; \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e describes the command-line\n      options that can be passed to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e;\n      and \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e shows help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configuration\n      variables.\n      \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.7\"\u003e\u003ch2\u003eExit Status\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e returns 0 to the shell if it\n   finished normally, 1 if a fatal error of its own occurs (e.g., out of memory,\n   file not found), 2 if the connection to the server went bad\n   and the session was not interactive, and 3 if an error occurred in a\n   script and the variable \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e was set.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.8\"\u003e\u003ch2\u003eUsage\u003c/h2\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\"\u003e\u003ch3\u003eConnecting to a Database\u003c/h3\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is a regular\n    \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e client application. In order\n    to connect to a database you need to know the name of your target\n    database, the host name and port number of the server, and what\n    database user name you want to connect as. \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    can be told about those parameters via command line options, namely\n    \u003ccode class=\"option\"\u003e-d\u003c/code\u003e, \u003ccode class=\"option\"\u003e-h\u003c/code\u003e, \u003ccode class=\"option\"\u003e-p\u003c/code\u003e, and\n    \u003ccode class=\"option\"\u003e-U\u003c/code\u003e respectively. If an argument is found that does\n    not belong to any option it will be interpreted as the database name\n    (or the database user name, if the database name is already given). Not all\n    of these options are required; there are useful defaults. If you omit the host\n    name, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will connect via a Unix-domain socket\n    to a server on the local host, or via TCP/IP to \u003ccode class=\"literal\"\u003elocalhost\u003c/code\u003e on\n    Windows. The default port number is\n    determined at compile time.\n    Since the database server uses the same default, you will not have\n    to specify the port in most cases. The default database user name is your\n    operating-system user name. Once the database user name is determined, it\n    is used as the default database name.\n    Note that you cannot\n    just connect to any database under any database user name. Your database\n    administrator should have informed you about your access rights.\n    \u003c/p\u003e\u003cp\u003e\n    When the defaults aren't quite right, you can save yourself\n    some typing by setting the environment variables\n    \u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e, \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e,\n    \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e and/or \u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e to appropriate\n    values. (For additional environment variables, see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e.) It is also convenient to have a\n    \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e file to avoid regularly having to type in\n    passwords. See \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e for more information.\n    \u003c/p\u003e\u003cp\u003e\n     An alternative way to specify connection parameters is in a\n     \u003cem class=\"parameter\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string or\n     a URI, which is used instead of a database\n     name. This mechanism give you very wide control over the\n     connection. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql \"service=myservice sslmode=require\"\u003c/code\u003e\u003c/strong\u003e\n$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql postgresql://dbmaster:5433/mydb?sslmode=require\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n     This way you can also use LDAP for connection\n     parameter lookup as described in \u003ca class=\"xref\" href=\"/docs/18/libpq-ldap.html\" title=\"32.18. LDAP Lookup of Connection Parameters\"\u003eSection 32.18\u003c/a\u003e.\n     See \u003ca class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2. Parameter Key Words\"\u003eSection 32.1.2\u003c/a\u003e for more information on all the\n     available connection options.\n    \u003c/p\u003e\u003cp\u003e\n    If the connection could not be made for any reason (e.g., insufficient\n    privileges, server is not running on the targeted host, etc.),\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will return an error and terminate.\n    \u003c/p\u003e\u003cp\u003e\n     If both standard input and standard output are a\n     terminal, then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e sets the client\n     encoding to \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eauto\u003c/span\u003e”\u003c/span\u003e, which will detect the\n     appropriate client encoding from the locale settings\n     (\u003ccode class=\"envar\"\u003eLC_CTYPE\u003c/code\u003e environment variable on Unix systems).\n     If this doesn't work out as expected, the client encoding can be\n     overridden using the environment\n     variable \u003ccode class=\"envar\"\u003ePGCLIENTENCODING\u003c/code\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"R2-APP-PSQL-4\"\u003e\u003ch3\u003eEntering SQL Commands\u003c/h3\u003e\u003cp\u003e\n    In normal operation, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides a\n    prompt with the name of the database to which\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is currently connected, followed by\n    the string \u003ccode class=\"literal\"\u003e=\u0026gt;\u003c/code\u003e. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$ \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epsql testdb\u003c/code\u003e\u003c/strong\u003e\npsql (18.7)\nType \"help\" for help.\n\ntestdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    At the prompt, the user can type in SQL commands.\n    Ordinarily, input lines are sent to the server when a\n    command-terminating semicolon is reached. An end of line does not\n    terminate a command.  Thus commands can be spread over several lines for\n    clarity. If the command was sent and executed without error, the results\n    of the command are displayed on the screen.\n    \u003c/p\u003e\u003cp\u003e\n    If untrusted users have access to a database that has not adopted a\n    \u003ca class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6. Usage Patterns\"\u003esecure schema usage pattern\u003c/a\u003e,\n    begin your session by removing publicly-writable schemas\n    from \u003ccode class=\"varname\"\u003esearch_path\u003c/code\u003e.  One can\n    add \u003ccode class=\"literal\"\u003eoptions=-csearch_path=\u003c/code\u003e to the connection string or\n    issue \u003ccode class=\"literal\"\u003eSELECT pg_catalog.set_config('search_path', '',\n    false)\u003c/code\u003e before other SQL commands.  This consideration is not\n    specific to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e; it applies to every interface\n    for executing arbitrary SQL commands.\n    \u003c/p\u003e\u003cp\u003e\n    Whenever a command is executed, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e also polls\n    for asynchronous notification events generated by\n    \u003ca class=\"link\" href=\"/docs/18/sql-listen.html\" title=\"LISTEN\"\u003e\u003ccode class=\"command\"\u003eLISTEN\u003c/code\u003e\u003c/a\u003e and\n    \u003ca class=\"link\" href=\"/docs/18/sql-notify.html\" title=\"NOTIFY\"\u003e\u003ccode class=\"command\"\u003eNOTIFY\u003c/code\u003e\u003c/a\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    While C-style block comments are passed to the server for\n    processing and removal, SQL-standard comments are removed by\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\"\u003e\u003ch3\u003eMeta-Commands\u003c/h3\u003e\u003cp\u003e\n    Anything you enter in \u003cspan class=\"application\"\u003epsql\u003c/span\u003e that begins\n    with an unquoted backslash is a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    meta-command that is processed by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    itself. These commands make\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e more useful for administration or\n    scripting. Meta-commands are often called slash or backslash commands.\n    \u003c/p\u003e\u003cp\u003e\n    The format of a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e command is the backslash,\n    followed immediately by a command verb, then any arguments. The arguments\n    are separated from the command verb and each other by any number of\n    whitespace characters.\n    \u003c/p\u003e\u003cp\u003e\n    To include whitespace in an argument you can quote it with\n    single quotes. To include a single quote in an argument,\n    write two single quotes within single-quoted text.\n    Anything contained in single quotes is\n    furthermore subject to C-like substitutions for\n    \u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e (new line), \u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e (tab),\n    \u003ccode class=\"literal\"\u003e\\b\u003c/code\u003e (backspace), \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e (carriage return),\n    \u003ccode class=\"literal\"\u003e\\f\u003c/code\u003e (form feed),\n    \u003ccode class=\"literal\"\u003e\\\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (octal), and\n    \u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e (hexadecimal).\n    A backslash preceding any other character within single-quoted text\n    quotes that single character, whatever it is.\n    \u003c/p\u003e\u003cp\u003e\n    If an unquoted colon (\u003ccode class=\"literal\"\u003e:\u003c/code\u003e) followed by a\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable name appears within an argument, it is\n    replaced by the variable's value, as described in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\"\u003eSQL Interpolation\u003c/a\u003e below.\n    The forms \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e and\n    \u003ccode class=\"literal\"\u003e:\"\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\"\u003c/code\u003e described there\n    work as well.\n    The \u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e syntax allows\n    testing whether a variable is defined. It is substituted by\n    TRUE or FALSE.\n    Escaping the colon with a backslash protects it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    Within an argument, text that is enclosed in backquotes\n    (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) is taken as a command line that is passed to the\n    shell.  The output of the command (with any trailing newline removed)\n    replaces the backquoted text.  Within the text enclosed in backquotes,\n    no special quoting or other processing occurs, except that appearances\n    of \u003ccode class=\"literal\"\u003e:\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e where\n    \u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e is a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable name\n    are replaced by the variable's value.  Also, appearances of\n    \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e are replaced by the\n    variable's value suitably quoted to become a single shell command\n    argument.  (The latter form is almost always preferable, unless you are\n    very sure of what is in the variable.)  Because carriage return and line\n    feed characters cannot be safely quoted on all platforms, the\n    \u003ccode class=\"literal\"\u003e:'\u003cem class=\"replaceable\"\u003e\u003ccode\u003evariable_name\u003c/code\u003e\u003c/em\u003e'\u003c/code\u003e form prints an\n    error message and does not substitute the variable value when such\n    characters appear in the value.\n    \u003c/p\u003e\u003cp\u003e\n    Some commands take an SQL identifier (such as a\n    table name) as argument. These arguments follow the syntax rules\n    of SQL: Unquoted letters are forced to\n    lowercase, while double quotes (\u003ccode class=\"literal\"\u003e\"\u003c/code\u003e) protect letters\n    from case conversion and allow incorporation of whitespace into\n    the identifier.  Within double quotes, paired double quotes reduce\n    to a single double quote in the resulting name.  For example,\n    \u003ccode class=\"literal\"\u003eFOO\"BAR\"BAZ\u003c/code\u003e is interpreted as \u003ccode class=\"literal\"\u003efooBARbaz\u003c/code\u003e,\n    and \u003ccode class=\"literal\"\u003e\"A weird\"\" name\"\u003c/code\u003e becomes \u003ccode class=\"literal\"\u003eA weird\"\n    name\u003c/code\u003e.\n    \u003c/p\u003e\u003cp\u003e\n    Parsing for arguments stops at the end of the line, or when another\n    unquoted backslash is found.  An unquoted backslash\n    is taken as the beginning of a new meta-command. The special\n    sequence \u003ccode class=\"literal\"\u003e\\\\\u003c/code\u003e (two backslashes) marks the end of\n    arguments and continues parsing SQL commands, if\n    any. That way SQL and\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e commands can be freely mixed on a\n    line. But in any case, the arguments of a meta-command cannot\n    continue beyond the end of the line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands act on the \u003cem class=\"firstterm\"\u003ecurrent query buffer\u003c/em\u003e.\n    This is simply a buffer holding whatever SQL command text has been typed\n    but not yet sent to the server for execution.  This will include previous\n    input lines as well as any text appearing before the meta-command on the\n    same line.\n    \u003c/p\u003e\u003cp\u003e\n    Many of the meta-commands also allow \u003ccode class=\"literal\"\u003ex\u003c/code\u003e to be appended\n    as an option. This will cause the results to be displayed in expanded\n    mode, as if \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\pset expanded\u003c/code\u003e\n    had been used.\n    \u003c/p\u003e\u003cp\u003e\n    The following meta-commands are defined:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-A\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\a\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If the current table output format is unaligned, it is switched to aligned.\n        If it is not unaligned, it is set to unaligned. This command is\n        kept for backwards compatibility. See \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e for a\n        more general solution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sets query parameters for the next query execution, with the\n         specified parameters passed for any parameter placeholders\n         (\u003ccode class=\"literal\"\u003e$1\u003c/code\u003e etc.).\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eINSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This also works for query-execution commands besides\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, such as \u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e and\n         \u003ccode class=\"literal\"\u003e\\gset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see \u003ca class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. Extended Query Overview\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol.  So this command can be useful to test the extended\n         query protocol from \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  (The extended\n         query protocol is used even if the query has no parameters and this\n         command specifies zero parameters.)  This command affects only the\n         next query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eparameter\u003c/code\u003e\u003c/em\u003e ] ... \u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e is equivalent to \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e,\n         except that it takes the name of an existing prepared statement as\n         first parameter. An empty string denotes the unnamed prepared\n         statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eINSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol (see\n         \u003ca class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2. Extended Query Overview\"\u003eSection 54.1.2\u003c/a\u003e) to be used, unlike normal\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the simple\n         query protocol. So this command can be useful to test the extended\n         query protocol from \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\c\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\connect [ -reuse-previous=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eon|off\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e ] | \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Establishes a new connection to a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        server.  The connection parameters to use can be specified either\n        using a positional syntax (one or more of database name, user,\n        host, and port), or using a \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        connection string as detailed in\n        \u003ca class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003eSection 32.1.1\u003c/a\u003e.  If no arguments are given, a\n        new connection is made using the same parameters as before.\n        \u003c/p\u003e\u003cp\u003e\n        Specifying any\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e or\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\n        as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e is equivalent to omitting that parameter.\n        \u003c/p\u003e\u003cp\u003e\n        The new connection can re-use connection parameters from the previous\n        connection; not only database name, user, host, and port, but other\n        settings such as \u003cem class=\"replaceable\"\u003e\u003ccode\u003esslmode\u003c/code\u003e\u003c/em\u003e.  By default,\n        parameters are re-used in the positional syntax, but not when\n        a \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e string is given.  Passing a\n        first argument of \u003ccode class=\"literal\"\u003e-reuse-previous=on\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e-reuse-previous=off\u003c/code\u003e overrides that default.  If\n        parameters are re-used, then any parameter not explicitly specified as\n        a positional parameter or in the \u003cem class=\"replaceable\"\u003e\u003ccode\u003econninfo\u003c/code\u003e\u003c/em\u003e\n        string is taken from the existing connection's parameters.  An\n        exception is that if the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e setting\n        is changed from its previous value using the positional syntax,\n        any \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostaddr\u003c/code\u003e\u003c/em\u003e setting present in the\n        existing connection's parameters is dropped.\n        Also, any password used for the existing connection will be re-used\n        only if the user, host, and port settings are not changed.\n        When the command neither specifies nor reuses a particular parameter,\n        the \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e default is used.\n        \u003c/p\u003e\u003cp\u003e\n        If the new connection is successfully made, the previous\n        connection is closed.\n        If the connection attempt fails (wrong user name, access\n        denied, etc.), the previous connection will be kept if\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is in interactive mode.  But when\n        executing a non-interactive script, the old connection is closed\n        and an error is reported.  That may or may not terminate the\n        script; if it does not, all database-accessing commands will fail\n        until another \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e command is successfully\n        executed.  This distinction was chosen as\n        a user convenience against typos on the one hand, and a safety\n        mechanism that scripts are not accidentally acting on the\n        wrong database on the other hand.\n        Note that whenever a \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e command attempts\n        to re-use parameters, the values re-used are those of the last\n        successful connection, not of any failed attempts made subsequently.\n        However, in the case of a\n        non-interactive \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e failure, no parameters\n        are allowed to be re-used later, since the script would likely be\n        expecting the values from the failed \u003ccode class=\"literal\"\u003e\\connect\u003c/code\u003e\n        to be re-used.\n        \u003c/p\u003e\u003cp\u003e\n        Examples:\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \\c mydb myuser host.dom 6432\n=\u0026gt; \\c service=foo\n=\u0026gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=\u0026gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=\u0026gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-C-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\C [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the title of any tables being printed as the result of a\n        query or unset any such title. This command is equivalent to\n        \u003ccode class=\"literal\"\u003e\\pset title \u003cem class=\"replaceable\"\u003e\u003ccode\u003etitle\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e. (The name of\n        this command derives from \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ecaption\u003c/span\u003e”\u003c/span\u003e, as it was\n        previously only used to set the caption in an\n        HTML table.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\cd [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Changes the current working directory to\n         \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e. Without argument, changes\n         to the current user's home directory.  For details on how home\n         directories are found, see \u003ca class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16. The Password File\"\u003eSection 32.16\u003c/a\u003e.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n          To print your current working directory, use \u003ccode class=\"literal\"\u003e\\! pwd\u003c/code\u003e.\n         \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprepared_statement_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Closes the specified prepared statement. An empty string denotes the\n         unnamed prepared statement. If no prepared statement exists with this\n         name, the operation is a no-op.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eSELECT $1 \\parse stmt1\n\\close_prepared stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used,\n         unlike normal \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which\n         uses the simple query protocol. So this command can be useful\n         to test the extended query protocol from\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-CONNINFO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\conninfo\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Outputs information about the current database connection,\n          including SSL-related information if SSL is in use.\n         \u003c/p\u003e\u003cp\u003e\n          Note that the \u003ccode class=\"structfield\"\u003eClient User\u003c/code\u003e field shows\n          the user at the time of connection, while the\n          \u003ccode class=\"structfield\"\u003eSuperuser\u003c/code\u003e field indicates whether\n          the current user (in the current execution context) has\n          superuser privileges. These users are usually the same, but they can\n          differ, for example, if the current user was changed with the\n          \u003ccode class=\"command\"\u003eSET ROLE\u003c/code\u003e command.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-COPY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] }\n        \u003ccode class=\"literal\"\u003efrom\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdin | pstdin }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\n        [ where \u003cem class=\"replaceable\"\u003e\u003ccode\u003econdition\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copy { \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable\u003c/code\u003e\u003c/em\u003e [ ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolumn_list\u003c/code\u003e\u003c/em\u003e ) ] | ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003equery\u003c/code\u003e\u003c/em\u003e ) }\n        \u003ccode class=\"literal\"\u003eto\u003c/code\u003e\n        { \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'filename'\u003c/code\u003e\u003c/em\u003e | program \u003cem class=\"replaceable\"\u003e\u003ccode\u003e'command'\u003c/code\u003e\u003c/em\u003e | stdout | pstdout }\n        [ [ with ] ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [, ...] ) ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs a frontend (client) copy. This is an operation that\n        runs an SQL \u003ca class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command, but instead of the server\n        reading or writing the specified file,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e reads or writes the file and\n        routes the data between the server and the local file system.\n        This means that file accessibility and privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        When \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e is specified,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        executed by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e and the data passed from\n        or to \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is\n        routed between the server and the client.\n        Again, the execution privileges are those of\n        the local user, not the server, and no SQL superuser\n        privileges are required.\n        \u003c/p\u003e\u003cp\u003e\n        For \u003ccode class=\"literal\"\u003e\\copy ... from stdin\u003c/code\u003e, data rows are read from the same\n        source that issued the command, continuing until a line containing\n        only \u003ccode class=\"literal\"\u003e\\.\u003c/code\u003e\n        is read or the stream reaches EOF. This option is useful\n        for populating tables in-line within an SQL script file.\n        For \u003ccode class=\"literal\"\u003e\\copy ... to stdout\u003c/code\u003e, output is sent to the same place\n        as \u003cspan class=\"application\"\u003epsql\u003c/span\u003e command output, and\n        the \u003ccode class=\"literal\"\u003eCOPY \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecount\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e command status is\n        not printed (since it might be confused with a data row).\n        To read/write \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's standard input or\n        output regardless of the current command source or \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e\n        option, write \u003ccode class=\"literal\"\u003efrom pstdin\u003c/code\u003e or \u003ccode class=\"literal\"\u003eto pstdout\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The syntax of this command is similar to that of the\n        SQL \u003ca class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e\u003c/a\u003e\n        command.  All options other than the data source/destination are\n        as specified for \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e.\n        Because of this, special parsing rules apply to the \u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e\n        meta-command.  Unlike most other meta-commands, the entire remainder\n        of the line is always taken to be the arguments of \u003ccode class=\"command\"\u003e\\copy\u003c/code\u003e,\n        and neither variable interpolation nor backquote expansion are\n        performed in the arguments.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Another way to obtain the same result as \u003ccode class=\"literal\"\u003e\\copy\n        ... to\u003c/code\u003e is to use the SQL \u003ccode class=\"literal\"\u003eCOPY\n        ... TO STDOUT\u003c/code\u003e command and terminate it\n        with \u003ccode class=\"literal\"\u003e\\g \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e\\g |\u003cem class=\"replaceable\"\u003e\u003ccode\u003eprogram\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        Unlike \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e, this method allows the command to\n        span multiple lines; also, variable interpolation and backquote\n        expansion can be used.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        These operations are not as efficient as the SQL\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e command with a file or program data source or\n        destination, because all data must pass through the client/server\n        connection.  For large amounts of data the SQL\n        command might be preferable.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\copyright\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the copyright and distribution terms of\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\crosstabview [\n            \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode class=\"literal\"\u003ex\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode class=\"literal\"\u003ey\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ex\u003c/code\u003e and the value\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-D\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\d[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        For each relation (table, view, materialized view, index, sequence,\n        or foreign table)\n        or composite type matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, show all\n        columns, their types, the tablespace (if not the default) and any\n        special attributes such as \u003ccode class=\"literal\"\u003eNOT NULL\u003c/code\u003e or defaults.\n        Associated indexes, constraints, rules, and triggers are\n        also shown.  For foreign tables, the associated foreign\n        server is shown as well.\n        (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eMatching the pattern\u003c/span\u003e”\u003c/span\u003e is defined in\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003ePatterns\u003c/a\u003e below.)\n        \u003c/p\u003e\u003cp\u003e\n        For some types of relation, \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e shows additional information\n        for each column: column values for sequences, indexed expressions for\n        indexes, and foreign data wrapper options for foreign tables.\n        \u003c/p\u003e\u003cp\u003e\n        The command form \u003ccode class=\"literal\"\u003e\\d+\u003c/code\u003e is identical, except that\n        more information is displayed: any comments associated with the\n        columns of the table are shown, as is the presence of OIDs in the\n        table, the view definition if the relation is a view, a non-default\n        \u003ca class=\"link\" href=\"/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\"\u003ereplica\n         identity\u003c/a\u003e setting and the\n        \u003ca class=\"link\" href=\"/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\"\u003eaccess method\u003c/a\u003e name\n        if the relation has an access method.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e is used without a\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e argument, it is\n        equivalent to \u003ccode class=\"command\"\u003e\\dtvmsE\u003c/code\u003e which will show a list of\n        all visible tables, views, materialized views, sequences and\n        foreign tables.\n        This is purely a convenience measure.\n        \u003c/p\u003e\u003cp\u003e\n        As with many other commands, if \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to\n        the command name, the results are displayed in expanded mode for this\n        command only, but note that this only applies when \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e\n        is used without a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        argument or to describe a sequence.\n        The same limitation on expanded output applies to\n        \u003ccode class=\"command\"\u003e\\x on\u003c/code\u003e and \u003ccode class=\"command\"\u003e\\x auto\u003c/code\u003e.\n        The \u003ccode class=\"literal\"\u003ex\u003c/code\u003e modifier cannot appear immediately after the\n        \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e (because \u003ccode class=\"command\"\u003e\\dx\u003c/code\u003e is a different\n        command); the \u003ccode class=\"literal\"\u003ex\u003c/code\u003e modifier may only appear after an\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e or \u003ccode class=\"literal\"\u003e+\u003c/code\u003e modifier. For example,\n        \u003ccode class=\"command\"\u003e\\d+x\u003c/code\u003e is equivalent to \u003ccode class=\"command\"\u003e\\dtvmsE+x\u003c/code\u003e\n        and will show a list of all relations in expanded mode.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\da[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists aggregate functions, together with their\n        return type and the data types they operate on. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only aggregates whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DA-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dA[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists access methods. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only access\n        methods whose names match the pattern are shown.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each access\n        method is listed with its associated handler function and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAC\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAc[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator classes\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1. Index Methods and Operator Classes\"\u003eSection 36.16.1\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator classes associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        class is listed with its associated operator family and owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAF\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAf[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5. Operator Classes and Operator Families\"\u003eSection 36.16.5\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with access methods whose\n        names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003einput-type-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only operator families associated with input types whose\n        names match that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        family is listed with its owner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAO\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAo[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators associated with operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2. Index Method Strategies\"\u003eSection 36.16.2\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families associated with access\n        methods whose names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only members of operator families whose names match that\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each operator\n        is listed with its sort operator family (if it is an ordering operator),\n        and whether its underlying function is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DAP\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"literal\"\u003e\\dAp[x+]\n            [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e\n              [\u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e]]\n          \u003c/code\u003e\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists support functions associated with operator families\n        (see \u003ca class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3. Index Method Support Routines\"\u003eSection 36.16.3\u003c/a\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eaccess-method-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families associated with\n        access methods whose names match that pattern are listed.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoperator-family-pattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only functions of operator families whose names match\n        that pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, functions are\n        displayed verbosely, with their actual parameter lists.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DB\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\db[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tablespaces. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only tablespaces whose names match the pattern are shown.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each tablespace\n        is listed with its associated options, on-disk size, permissions and\n        description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dc[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists conversions between character-set encodings.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only conversions whose names match the pattern are\n        listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DCONFIG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dconfig[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists server configuration parameters and their values.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only parameters whose names match the pattern are listed.  Without\n        a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, only\n        parameters that are set to non-default values are listed.\n        (Use \u003ccode class=\"literal\"\u003e\\dconfig *\u003c/code\u003e to see all parameters.)\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each\n        parameter is listed with its data type, context in which the\n        parameter can be set, and access privileges (if non-default access\n        privileges have been granted).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DC-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dC[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists type casts.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only casts whose source or target types match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional\n        information about each cast is shown, including whether its underlying\n        function is leakproof, and the cast's description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dd[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows the descriptions of objects of type \u003ccode class=\"literal\"\u003econstraint\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eoperator class\u003c/code\u003e, \u003ccode class=\"literal\"\u003eoperator family\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003erule\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etrigger\u003c/code\u003e. All\n        other comments may be viewed by the respective backslash commands for\n        those object types.\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003e\\dd\u003c/code\u003e displays descriptions for objects matching the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or of visible\n        objects of the appropriate type if no argument is given.  But in either\n        case, only objects that have a description are listed.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        Descriptions for objects can be created with the \u003ca class=\"link\" href=\"/docs/18/sql-comment.html\" title=\"COMMENT\"\u003e\u003ccode class=\"command\"\u003eCOMMENT\u003c/code\u003e\u003c/a\u003e\nSQL command.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DD-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dD[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists domains. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only domains whose names match the pattern are shown.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DDP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ddp[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists default access privilege settings.  An entry is shown for\n        each role (and schema, if applicable) for which the default\n        privilege settings have been changed from the built-in defaults.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose role name or schema name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"\u003e\u003ccode class=\"command\"\u003eALTER DEFAULT\n        PRIVILEGES\u003c/code\u003e\u003c/a\u003e command is used to set default access\n        privileges.  The meaning of the privilege display is explained in\n        \u003ca class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8. Privileges\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dE[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\di[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dm[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ds[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dt[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dv[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In this group of commands, the letters \u003ccode class=\"literal\"\u003eE\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003ei\u003c/code\u003e, \u003ccode class=\"literal\"\u003em\u003c/code\u003e, \u003ccode class=\"literal\"\u003es\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003et\u003c/code\u003e, and \u003ccode class=\"literal\"\u003ev\u003c/code\u003e\n        stand for foreign table, index, materialized view,\n        sequence, table, and view,\n        respectively.\n        You can specify any or all of\n        these letters, in any order, to obtain a listing of objects\n        of these types.  For example, \u003ccode class=\"literal\"\u003e\\dti\u003c/code\u003e lists\n        tables and indexes.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is\n        appended to the command name, each object is listed with its\n        persistence status (permanent, temporary, or unlogged),\n        physical size on disk, and associated description if any.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only objects whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\des[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign servers (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        servers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those servers whose name matches the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a\n        full description of each server is shown, including the\n        server's access privileges, type, version, options, and description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\det[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign tables (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal tables\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only entries whose table name or schema name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        generic options and the foreign table description\n        are also displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\deu[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists user mappings (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        users\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those mappings whose user names match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each mapping is shown.\n        \u003c/p\u003e\u003cdiv class=\"caution\"\u003e\u003ch3 class=\"title\"\u003eCaution\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\deu+\u003c/code\u003e might also display the user name and\n        password of the remote user, so care should be taken not to\n        disclose them.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dew[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists foreign-data wrappers (mnemonic: \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eexternal\n        wrappers\u003c/span\u003e”\u003c/span\u003e).\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those foreign-data wrappers whose name matches\n        the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        the access privileges, options, and description of the\n        foreign-data wrapper are also shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\df[anptwSx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ... ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists functions, together with their result data types, argument data\n        types, and function types, which are classified as \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eagg\u003c/span\u003e”\u003c/span\u003e\n        (aggregate), \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enormal\u003c/span\u003e”\u003c/span\u003e, \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eprocedure\u003c/span\u003e”\u003c/span\u003e, \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003etrigger\u003c/span\u003e”\u003c/span\u003e, or \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ewindow\u003c/span\u003e”\u003c/span\u003e.\n        To display only functions\n        of specific type(s), add the corresponding letters \u003ccode class=\"literal\"\u003ea\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003en\u003c/code\u003e, \u003ccode class=\"literal\"\u003ep\u003c/code\u003e, \u003ccode class=\"literal\"\u003et\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ew\u003c/code\u003e to the command.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified, only\n        functions whose names match the pattern are shown.\n        Any additional arguments are type-name patterns, which are matched\n        to the type names of the first, second, and so on arguments of the\n        function.  (Matching functions can have more arguments than what\n        you specify.  To prevent that, write a dash \u003ccode class=\"literal\"\u003e-\u003c/code\u003e as\n        the last \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e.)\n        By default, only user-created\n        objects are shown; supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e\n        modifier to include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        about each function is shown, including volatility,\n        parallel safety, owner, security classification, whether it is\n        leakproof, access privileges, language, internal name (for C and\n        internal functions only), and description.\n        Source code for a specific function can be seen\n        using \u003ccode class=\"literal\"\u003e\\sf\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DF-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dF[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search configurations.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only configurations whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each configuration is shown, including the underlying text search\n         parser and the dictionary list for each parser token type.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFd[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search dictionaries.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only dictionaries whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each selected dictionary, including the underlying\n         text search template and the option values.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFp[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search parsers.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only parsers whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, a full description of\n         each parser is shown, including the underlying functions and the\n         list of recognized token types.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DFT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dFt[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Lists text search templates.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n         only templates whose names match the pattern are shown.\n         If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n         are displayed in expanded mode.\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n         is shown about each template, including the underlying function names.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dg[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode class=\"literal\"\u003e\\du\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dl[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This is an alias for \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e, which shows a\n        list of large objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DL-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dL[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists procedural languages. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only languages whose names match the pattern are listed.\n        By default, only user-created languages\n        are shown; supply the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each\n        language is listed with its call handler, validator, access privileges,\n        and whether it is a system object.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dn[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists schemas (namespaces). If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only schemas whose names match the pattern are listed.\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated permissions and description, if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\do[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists operators with their operand and result types.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only operators whose names match the pattern are listed.\n        If one \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only prefix operators whose right argument's type name\n        matches that pattern are listed.\n        If two \u003cem class=\"replaceable\"\u003e\u003ccode\u003earg_pattern\u003c/code\u003e\u003c/em\u003es\n        are specified, only binary operators whose argument type names match\n        those patterns are listed.  (Alternatively, write \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n        for the unused argument of a unary operator.)\n        By default, only user-created objects are shown; supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        additional information about each operator is shown, including\n        the name of the underlying function, and whether it is leakproof.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DO-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dO[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists collations.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only collations whose names match the pattern are\n        listed.  By default, only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to\n        include system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended\n        to the command name, each collation is listed with its associated\n        description, if any.\n        Note that only collations usable with the current database's encoding\n        are shown, so the results may vary in different databases of the\n        same installation.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dp[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e and\n        \u003ca class=\"link\" href=\"/docs/18/sql-revoke.html\" title=\"REVOKE\"\u003e\u003ccode class=\"command\"\u003eREVOKE\u003c/code\u003e\u003c/a\u003e\n        commands are used to set access privileges.  The meaning of the\n        privilege display is explained in\n        \u003ca class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8. Privileges\"\u003eSection 5.8\u003c/a\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DP-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dP[itnx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists partitioned relations.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only entries whose name matches the pattern are listed.\n        The modifiers \u003ccode class=\"literal\"\u003et\u003c/code\u003e (tables) and \u003ccode class=\"literal\"\u003ei\u003c/code\u003e\n        (indexes) can be appended to the command, filtering the kind of\n        relations to list.  By default, partitioned tables and indexes are\n        listed.\n        \u003c/p\u003e\u003cp\u003e\n        If the modifier \u003ccode class=\"literal\"\u003en\u003c/code\u003e (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003enested\u003c/span\u003e”\u003c/span\u003e) is used,\n        or a pattern is specified, then non-root partitioned relations are\n        included, and a column is shown displaying the parent of each\n        partitioned relation.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, the sum of the\n        sizes of each relation's partitions is also displayed, along with the\n        relation's description.\n        If \u003ccode class=\"literal\"\u003en\u003c/code\u003e is combined with \u003ccode class=\"literal\"\u003e+\u003c/code\u003e, two\n        sizes are shown: one including the total size of directly-attached\n        leaf partitions, and another showing the total size of all partitions,\n        including indirectly attached sub-partitions.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRDS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drds[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists defined configuration settings.  These settings can be\n        role-specific, database-specific, or both.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003erole-pattern\u003c/code\u003e\u003c/em\u003e and\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003edatabase-pattern\u003c/code\u003e\u003c/em\u003e are used to select\n        specific roles and databases to list, respectively.  If omitted, or if\n        \u003ccode class=\"literal\"\u003e*\u003c/code\u003e is specified, all settings are listed, including those\n        not role-specific or database-specific, respectively.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ca class=\"link\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"\u003e\u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e\u003c/a\u003e and\n        \u003ca class=\"link\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003ccode class=\"command\"\u003eALTER DATABASE\u003c/code\u003e\u003c/a\u003e\n        commands are used to define per-role and per-database configuration\n        settings.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\drg[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists information about each granted role membership, including\n        assigned options (\u003ccode class=\"literal\"\u003eADMIN\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eINHERIT\u003c/code\u003e and/or \u003ccode class=\"literal\"\u003eSET\u003c/code\u003e) and grantor.\n        See the \u003ca class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"\u003e\u003ccode class=\"command\"\u003eGRANT\u003c/code\u003e\u003c/a\u003e\n        command for information about role memberships.\n        \u003c/p\u003e\u003cp\u003e\n        By default, only grants to user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only grants to those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRp[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication publications.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those publications whose names match the pattern are\n        listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, the tables and\n        schemas associated with each publication are shown as well.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DRS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dRs[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists replication subscriptions.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only those subscriptions whose names match the pattern are\n        listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional\n        properties of the subscriptions are shown.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dT[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists data types.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only types whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each type is\n        listed with its internal name and size, its allowed values\n        if it is an \u003ccode class=\"type\"\u003eenum\u003c/code\u003e type, and its associated permissions.\n        By default, only user-created objects are shown;  supply a\n        pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system\n        objects.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DU\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\du[Sx+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists database roles.\n        (Since the concepts of \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eusers\u003c/span\u003e”\u003c/span\u003e and \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003egroups\u003c/span\u003e”\u003c/span\u003e have been\n        unified into \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eroles\u003c/span\u003e”\u003c/span\u003e, this command is now equivalent to\n        \u003ccode class=\"literal\"\u003e\\dg\u003c/code\u003e.)\n        By default, only user-created roles are shown; supply the\n        \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include system roles.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only those roles whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, additional information\n        is shown about each role; currently this adds the comment for each\n        role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dx[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists installed extensions.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extensions whose names match the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, all the objects belonging\n        to each matching extension are listed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DX-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dX[x] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists extended statistics.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those extended statistics whose names match the\n        pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        The status of each kind of extended statistics is shown in a column\n        named after its statistic kind (e.g. Ndistinct).\n        \u003ccode class=\"literal\"\u003edefined\u003c/code\u003e means that it was requested when creating\n        the statistics, and NULL means it wasn't requested.\n        You can use \u003ccode class=\"structname\"\u003epg_stats_ext\u003c/code\u003e if you'd like to\n        know whether \u003ca class=\"link\" href=\"/docs/18/sql-analyze.html\" title=\"ANALYZE\"\u003e\u003ccode class=\"command\"\u003eANALYZE\u003c/code\u003e\u003c/a\u003e\n        was run and statistics are available to the planner.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-DY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\dy[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists event triggers.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\n        is specified, only those event triggers whose names match the pattern\n        are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, each object\n        is listed with its associated description.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EDIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\e\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e \u003ccode class=\"literal\"\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is\n        specified, the file is edited; after the editor exits, the file's\n        content is copied into the current query buffer. If no \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is given, the current query\n        buffer is copied to a temporary file which is then edited in the same\n        fashion.  Or, if the current query buffer is empty, the most recently\n        executed query is copied to a temporary file and edited in the same\n        fashion.\n        \u003c/p\u003e\u003cp\u003e\n        If you edit a file or the previous query, and you quit the editor without\n        modifying the file, the query buffer is cleared.\n        Otherwise, the new contents of the query buffer are re-parsed according to\n        the normal rules of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e, treating the\n        whole buffer as a single line.  Any complete queries are immediately\n        executed; that is, if the query buffer contains or ends with a\n        semicolon, everything up to that point is executed and removed from\n        the query buffer.  Whatever remains in the query buffer is\n        redisplayed.  Type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it,\n        or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e to cancel it by clearing the query buffer.\n        \u003c/p\u003e\u003cp\u003e\n        Treating the buffer as a single line primarily affects meta-commands:\n        whatever is in the buffer after a meta-command will be taken as\n        argument(s) to the meta-command, even if it spans multiple lines.\n        (Thus you cannot make meta-command-using scripts this way.\n        Use \u003ccode class=\"command\"\u003e\\i\u003c/code\u003e for that.)\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the file or query buffer.\n        Note that if a single all-digits argument is given,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e assumes it is a line number,\n        not a file name.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\echo \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prints the evaluated arguments to standard output, separated by\n        spaces and followed by a newline. This can be useful to\n        intersperse information in the output of scripts. For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo `date`\u003c/code\u003e\u003c/strong\u003e\nTue Oct 26 21:40:57 CEST 1999\n\u003c/pre\u003e\u003cp\u003e\n        If the first argument is an unquoted \u003ccode class=\"literal\"\u003e-n\u003c/code\u003e the trailing\n        newline is not written (nor is the first argument).\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        If you use the \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e command to redirect your\n        query output you might wish to use \u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e\n        instead of this command.  See also \u003ccode class=\"command\"\u003e\\warn\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ef [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named function or procedure,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it, or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If no function is specified, a blank \u003ccode class=\"command\"\u003eCREATE FUNCTION\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n        If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n        position the cursor on the specified line of the function body.\n        (Note that the function body typically does not begin on the first\n        line of the file.)\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"Environment\"\u003eEnvironment\u003c/a\u003e, below, for how to\n        configure and customize your editor.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\encoding [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the client character set encoding.  Without an argument, this command\n        shows the current encoding.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\errverbose\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeats the most recent server error message at maximum\n        verbosity, as though \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e were set\n        to \u003ccode class=\"literal\"\u003everbose\u003c/code\u003e and \u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e were\n        set to \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ev [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e [\u003cspan class=\"optional\"\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eline_number\u003c/code\u003e\u003c/em\u003e \u003c/span\u003e] \u003c/span\u003e] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and edits the definition of the named view,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n         Editing is done in the same way as for \u003ccode class=\"literal\"\u003e\\edit\u003c/code\u003e.\n         If you quit the editor without saving, the statement is discarded.\n         If you save and exit the editor, the updated command is executed immediately\n         if you added a semicolon to it.  Otherwise it is redisplayed;\n         type semicolon or \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e to send it, or \u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e\n         to cancel.\n        \u003c/p\u003e\u003cp\u003e\n         If no view is specified, a blank \u003ccode class=\"command\"\u003eCREATE VIEW\u003c/code\u003e\n         template is presented for editing.\n        \u003c/p\u003e\u003cp\u003e\n         If a line number is specified, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n         position the cursor on the specified line of the view definition.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-F\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\f [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the field separator for unaligned query output. The default\n        is the vertical bar (\u003ccode class=\"literal\"\u003e|\u003c/code\u003e). It is equivalent to\n        \u003ccode class=\"command\"\u003e\\pset fieldsep\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-G\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\g [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sends the current query buffer to the server for execution.\n        \u003c/p\u003e\u003cp\u003e\n        If parentheses appear after \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, they surround a\n        space-separated list\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        formatting-option clauses, which are interpreted in the same way\n        as \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e commands, but take\n        effect only for the duration of this query.  In this list, spaces are\n        not allowed around \u003ccode class=\"literal\"\u003e=\u003c/code\u003e signs, but are required\n        between option clauses.\n        If \u003ccode class=\"literal\"\u003e=\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n        is omitted, the\n        named \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e is changed\n        in the same way as for\n        \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        with no explicit \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        If a \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\n        or \u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        argument is given, the query's output is written to the named\n        file or piped to the given shell command, instead of displaying it as\n        usual.  The file or command is written to only if the query\n        successfully returns zero or more tuples, not if the query fails or\n        is a non-data-returning SQL command.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query is\n        re-executed instead.  Except for that behavior, \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e\n        without any arguments is essentially equivalent to a semicolon.\n        With arguments, \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e provides\n        a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eone-shot\u003c/span\u003e”\u003c/span\u003e alternative to the \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e\n        command, and additionally allows one-shot adjustments of the\n        output formatting options normally set by \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        When the last argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, the entire\n        remainder of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GDESC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Shows the description (that is, the column names and data types)\n         of the result of the current query buffer.  The query is not\n         actually executed; however, if it contains some type of syntax\n         error, that error will be reported in the normal way.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is described instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Gets the value of the environment\n         variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e\n         and assigns it to the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e.\n         If \u003cem class=\"replaceable\"\u003e\u003ccode\u003eenv_var\u003c/code\u003e\u003c/em\u003e is\n         not defined in the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e process's\n         environment, \u003cem class=\"replaceable\"\u003e\u003ccode\u003epsql_var\u003c/code\u003e\u003c/em\u003e\n         is not changed.  Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\getenv home HOME\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :home\u003c/code\u003e\u003c/strong\u003e\n/home/postgres\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GEXEC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gexec\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server, then treats\n         each column of each row of the query's output (if any) as an SQL\n         statement to be executed.  For example, to create an index on each\n         column of \u003ccode class=\"structname\"\u003emy_table\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT format('create index on my_table(%I)', attname)\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM pg_attribute\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eWHERE attrelid = 'my_table'::regclass AND attnum \u0026gt; 0\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eORDER BY attnum\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gexec\u003c/code\u003e\u003c/strong\u003e\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         The generated queries are executed in the order in which the rows\n         are returned, and left-to-right within each row if there is more\n         than one column.  NULL fields are ignored.  The generated queries\n         are sent literally to the server for processing, so they cannot be\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-commands nor contain \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         variable references.  If any individual query fails, execution of\n         the remaining queries continues\n         unless \u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e is set.  Execution of each\n         query is subject to \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e processing.\n         (Setting \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to \u003ccode class=\"literal\"\u003eall\u003c/code\u003e\n         or \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e is often advisable when\n         using \u003ccode class=\"command\"\u003e\\gexec\u003c/code\u003e.)  Query logging, single-step mode,\n         timing, and other query execution features apply to each generated\n         query as well.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Sends the current query buffer to the server and stores the\n         query's output into \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variables\n         (see \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below).\n         The query to be executed must return exactly one row.  Each column of\n         the row is stored into a separate variable, named the same as the\n         column.  For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :var1 :var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If you specify a \u003cem class=\"replaceable\"\u003e\u003ccode\u003eprefix\u003c/code\u003e\u003c/em\u003e,\n         that string is prepended to the query's column names to create the\n         variable names to use:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT 'hello' AS var1, 10 AS var2\u003c/code\u003e\u003c/strong\u003e\n-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\gset result_\u003c/code\u003e\u003c/strong\u003e\n=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :result_var1 :result_var2\u003c/code\u003e\u003c/strong\u003e\nhello 10\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         If a column result is NULL, the corresponding variable is unset\n         rather than being set.\n        \u003c/p\u003e\u003cp\u003e\n         If the query fails or does not return one row,\n         no variables are changed.\n        \u003c/p\u003e\u003cp\u003e\n         If the current query buffer is empty, the most recently sent query\n         is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-GX\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\gx [ (\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [...]) ] [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e is equivalent to \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, except\n        that it forces expanded output mode for this query, as\n        if \u003ccode class=\"literal\"\u003eexpanded=on\u003c/code\u003e were included in the list of\n        \u003ccode class=\"literal\"\u003e\\pset\u003c/code\u003e options.  See also \u003ccode class=\"literal\"\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HELP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\h\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\help\u003c/code\u003e \u003ccode class=\"literal\"\u003e[ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Gives syntax help on the specified SQL\n        command. If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\n        is not specified, then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will list\n        all the commands for which syntax help is available. If\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e is an\n        asterisk (\u003ccode class=\"literal\"\u003e*\u003c/code\u003e), then syntax help on all\n        SQL commands is shown.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\help\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        To simplify typing, commands that consists of several words do\n        not have to be quoted. Thus it is fine to type \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\help\n        alter table\u003c/code\u003e\u003c/strong\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-HTML\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\H\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\html\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Turns on HTML query output format. If the\n        HTML format is already on, it is switched\n        back to the default aligned text format. This command is for\n        compatibility and convenience, but see \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e\n        about setting other output options.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\include\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads input from the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e and executes it as\n        though it had been typed on the keyboard.\n        \u003c/p\u003e\u003cp\u003e\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n        (hyphen), then standard input is read until an EOF indication\n        or \u003ccode class=\"command\"\u003e\\q\u003c/code\u003e meta-command.  This can be used to intersperse\n        interactive input with input from files.  Note that Readline behavior\n        will be used only if it is active at the outermost level.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        If you want to see the lines on the screen as they are read you\n        must set the variable \u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e to\n        \u003ccode class=\"literal\"\u003eall\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"PSQL-METACOMMAND-IF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\if\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\elif\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\else\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endif\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements nestable conditional blocks.\n        A conditional block must begin with an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e and end\n        with an \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e.  In between there may be any number\n        of \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e clauses, which may optionally be followed\n        by a single \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e clause.  Ordinary queries and\n        other types of backslash commands may (and usually do) appear between\n        the commands forming a conditional block.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e and \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e commands read\n        their argument(s) and evaluate them as a Boolean expression.  If the\n        expression yields \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e then processing continues\n        normally; otherwise, lines are skipped until a\n        matching \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e,\n        or \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e is reached.  Once\n        an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e test has\n        succeeded, the arguments of later \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e commands in\n        the same block are not evaluated but are treated as false.  Lines\n        following an \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e are processed only if no earlier\n        matching \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e succeeded.\n        \u003c/p\u003e\u003cp\u003e\n        The \u003cem class=\"replaceable\"\u003e\u003ccode\u003eexpression\u003c/code\u003e\u003c/em\u003e argument\n        of an \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e command\n        is subject to variable interpolation and backquote expansion, just\n        like any other backslash command argument.  After that it is evaluated\n        like the value of an on/off option variable.  So a valid value\n        is any unambiguous case-insensitive match for one of:\n        \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e, \u003ccode class=\"literal\"\u003e1\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eyes\u003c/code\u003e, \u003ccode class=\"literal\"\u003eno\u003c/code\u003e.  For example,\n        \u003ccode class=\"literal\"\u003et\u003c/code\u003e, \u003ccode class=\"literal\"\u003eT\u003c/code\u003e, and \u003ccode class=\"literal\"\u003etR\u003c/code\u003e\n        will all be considered to be \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Expressions that do not properly evaluate to true or false will\n        generate a warning and be treated as false.\n        \u003c/p\u003e\u003cp\u003e\n        Lines being skipped are parsed normally to identify queries and\n        backslash commands, but queries are not sent to the server, and\n        backslash commands other than conditionals\n        (\u003ccode class=\"command\"\u003e\\if\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\elif\u003c/code\u003e,\n        \u003ccode class=\"command\"\u003e\\else\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\endif\u003c/code\u003e) are\n        ignored.  Conditional commands are checked only for valid nesting.\n        Variable references in skipped lines are not expanded, and backquote\n        expansion is not performed either.\n        \u003c/p\u003e\u003cp\u003e\n        All the backslash commands of a given conditional block must appear in\n        the same source file. If EOF is reached on the main input file or an\n        \u003ccode class=\"command\"\u003e\\include\u003c/code\u003e-ed file before all local\n        \u003ccode class=\"command\"\u003e\\if\u003c/code\u003e-blocks have been closed,\n        then \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will raise an error.\n        \u003c/p\u003e\u003cp\u003e\n         Here is an example:\n        \u003c/p\u003e\u003cpre class=\"programlisting\"\u003e-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\include_relative\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The \u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e command is similar to \u003ccode class=\"literal\"\u003e\\i\u003c/code\u003e, but resolves\n        relative file names differently.  When executing in interactive mode,\n        the two commands behave identically.  However, when invoked from a\n        script, \u003ccode class=\"literal\"\u003e\\ir\u003c/code\u003e interprets file names relative to the\n        directory in which the script is located, rather than the current\n        working directory.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\l[x+]\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\list[x+] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        List the databases in the server and show their names, owners,\n        character set encodings, and access privileges.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is specified,\n        only databases whose names match the pattern are listed.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, database\n        sizes, default tablespaces, and descriptions are also displayed.\n        Size information is available for databases on which the current user has\n        \u003ccode class=\"literal\"\u003eCONNECT\u003c/code\u003e privilege, or if the current user is a superuser\n        or has privileges of the \u003ccode class=\"literal\"\u003epg_read_all_stats\u003c/code\u003e role.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_export \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Reads the large object with OID \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the database and\n        writes it to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e. Note that this is\n        subtly different from the server function\n        \u003ccode class=\"function\"\u003elo_export\u003c/code\u003e, which acts with the permissions\n        of the user that the database server runs as and on the server's\n        file system.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e to find out the large object's\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_import \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecomment\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Stores the file into a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        large object. Optionally, it associates the given\n        comment with the object. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003efoo=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'\u003c/code\u003e\u003c/strong\u003e\nlo_import 152801\n\u003c/pre\u003e\u003cp\u003e\n        The response indicates that the large object received object\n        ID 152801, which can be used to access the newly-created large\n        object in the future. For the sake of readability, it is\n        recommended to always associate a human-readable comment with\n        every object. Both OIDs and comments can be viewed with the\n        \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\n        Note that this command is subtly different from the server-side\n        \u003ccode class=\"function\"\u003elo_import\u003c/code\u003e because it acts as the local user\n        on the local file system, rather than the server's user and file\n        system.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-LIST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_list[x+]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows a list of all \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n        large objects currently stored in the database,\n        along with any comments provided for them.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name,\n        each large object is listed with its associated permissions,\n        if any.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\lo_unlink \u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Deletes the large object with OID\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003eloid\u003c/code\u003e\u003c/em\u003e from the\n        database.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Use \u003ccode class=\"command\"\u003e\\lo_list\u003c/code\u003e to find out the large object's\n        OID.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-OUT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\out [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\out [ |\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Arranges to save future query results to the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipe future results\n        to the shell command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e. If no argument is\n        specified, the query output is reset to the standard output.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eQuery results\u003c/span\u003e”\u003c/span\u003e includes all tables, command\n        responses, and notices obtained from the database server, as\n        well as output of various backslash commands that query the\n        database (such as \u003ccode class=\"command\"\u003e\\d\u003c/code\u003e); but not error\n        messages.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        To intersperse text output in between query results, use\n        \u003ccode class=\"command\"\u003e\\qecho\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PRINT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\p\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\print\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print the current query buffer to the standard output.\n        If the current query buffer is empty, the most recently executed query\n        is printed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PARSE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\parse \u003cem class=\"replaceable\"\u003e\u003ccode\u003estatement_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Creates a prepared statement from the current query buffer, based on\n         the name of a destination prepared-statement object. An empty string\n         denotes the unnamed prepared statement.\n        \u003c/p\u003e\u003cp\u003e\n         Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eSELECT $1 \\parse stmt1\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n         This command causes the extended query protocol to be used, unlike\n         normal \u003cspan class=\"application\"\u003epsql\u003c/span\u003e operation, which uses the\n         simple query protocol. A\n         \u003ca class=\"xref\" href=\"/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\"\u003eParse (F)\u003c/a\u003e\n         message will be issued by this command so it can be useful to\n         test the extended query protocol from\n         \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. This command affects only the next\n         query executed; all subsequent queries will use the simple query\n         protocol by default.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PASSWORD\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\password [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Changes the password of the specified user (by default, the current\n        user).  This command prompts for the new password, encrypts it, and\n        sends it to the server as an \u003ccode class=\"command\"\u003eALTER ROLE\u003c/code\u003e command.  This\n        makes sure that the new password does not appear in cleartext in the\n        command history, the server log, or elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\prompt [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts the user to supply text, which is assigned to the variable\n         \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n         An optional prompt string, \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e, can be specified.  (For multiword\n         prompts, surround the text with single quotes.)\n        \u003c/p\u003e\u003cp\u003e\n         By default, \u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e uses the terminal for input and\n         output.  However, if the \u003ccode class=\"option\"\u003e-f\u003c/code\u003e command line switch was\n         used, \u003ccode class=\"literal\"\u003e\\prompt\u003c/code\u003e uses standard input and standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\pset [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command sets options affecting the output of query result tables.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e\n        indicates which option is to be set. The semantics of\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e vary depending\n        on the selected option.  For some options, omitting \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e causes the option to be toggled\n        or unset, as described under the particular option.  If no such\n        behavior is mentioned, then omitting\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e just results in\n        the current setting being displayed.\n        \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e without any arguments displays the current status\n        of all printing options.\n        \u003c/p\u003e\u003cp\u003e\n        Adjustable printing options are:\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eborder\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e must be a\n          number. In general, the higher\n          the number the more borders and lines the tables will have,\n          but details depend on the particular format.\n          In HTML format, this will translate directly\n          into the \u003ccode class=\"literal\"\u003eborder=...\u003c/code\u003e attribute.\n          In most other formats only values 0 (no border), 1 (internal\n          dividing lines), and 2 (table frame) make sense, and values above 2\n          will be treated the same as \u003ccode class=\"literal\"\u003eborder = 2\u003c/code\u003e.\n          The \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e and \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e\n          formats additionally allow a value of 3 to add dividing lines\n          between data rows.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the target width for the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format, and also\n          the width limit for determining whether output is wide enough to\n          require the pager or switch to the vertical display in expanded auto\n          mode.\n          Zero (the default) causes the target width to be controlled by the\n          environment variable \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e, or the detected screen width\n          if \u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e is not set.\n          In addition, if \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e is zero then the\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format only affects screen output.\n          If \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e is nonzero then file and pipe output is\n          wrapped to that width as well.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ecsv_fieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in\n          CSV output format.  If the separator character\n          appears in a field's value, that field is output within double\n          quotes, following standard CSV rules.\n          The default is a comma.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eexpanded\u003c/code\u003e (or \u003ccode class=\"literal\"\u003ex\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified it\n          must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, which\n          will enable or disable expanded mode, or \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between the on and off settings.  When expanded mode\n          is enabled, query results are displayed in two columns, with the\n          column name on the left and the data on the right. This mode is\n          useful if the data wouldn't fit on the screen in the\n          normal \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003ehorizontal\u003c/span\u003e”\u003c/span\u003e mode.  In the auto setting, the\n          expanded mode is used whenever the query output has more than one\n          column and is wider than the screen; otherwise, the regular mode is\n          used.  The auto setting is only\n          effective in the aligned and wrapped formats.  In other formats, it\n          always behaves as if the expanded mode is off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the field separator to be used in unaligned output\n          format. That way one can create, for example, tab-separated\n          output, which other programs might prefer. To\n          set a tab as field separator, type \u003ccode class=\"literal\"\u003e\\pset fieldsep\n          '\\t'\u003c/code\u003e. The default field separator is\n          \u003ccode class=\"literal\"\u003e'|'\u003c/code\u003e (a vertical bar).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efieldsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the field separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efooter\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable display of the table footer\n          (the \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003en\u003c/code\u003e\u003c/em\u003e rows)\u003c/code\u003e count).\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles footer display on or off.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eformat\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the output format to one of \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e, \u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e.\n          Unique abbreviations are allowed.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e format is the standard,\n          human-readable, nicely formatted text output; this is the default.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eunaligned\u003c/code\u003e format writes all columns of a row on one\n          line, separated by the currently active field separator. This\n          is useful for creating output that might be intended to be read\n          in by other programs, for example, tab-separated or comma-separated\n          format.  However, the field separator character is not treated\n          specially if it appears in a column's value;\n          so CSV format may be better suited for such\n          purposes.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ecsv\u003c/code\u003e format\n          \n          writes column values separated by commas, applying the quoting\n          rules described in\n          \u003ca class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\"\u003eRFC 4180\u003c/a\u003e.\n          This output is compatible with the CSV format of the server's\n          \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e command.\n          A header line with column names is generated unless\n          the \u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e parameter is\n          \u003ccode class=\"literal\"\u003eon\u003c/code\u003e. Titles and footers are not printed.\n          Each row is terminated by the system-dependent end-of-line character,\n          which is typically a single newline (\u003ccode class=\"literal\"\u003e\\n\u003c/code\u003e) for\n          Unix-like systems or a carriage return and newline sequence\n          (\u003ccode class=\"literal\"\u003e\\r\\n\u003c/code\u003e) for Microsoft Windows.\n          Field separator characters other than comma can be selected with\n          \u003ccode class=\"command\"\u003e\\pset csv_fieldsep\u003c/code\u003e.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format is like \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e but wraps\n          wide data values across lines to make the output fit in the target\n          column width.  The target width is determined as described under\n          the \u003ccode class=\"literal\"\u003ecolumns\u003c/code\u003e option.  Note that \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will\n          not attempt to wrap column header titles; therefore,\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format behaves the same as \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e\n          if the total width needed for column headers exceeds the target.\n          \u003c/p\u003e\u003cp\u003e\n          The \u003ccode class=\"literal\"\u003easciidoc\u003c/code\u003e, \u003ccode class=\"literal\"\u003ehtml\u003c/code\u003e,\n          \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e, \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e, and\n          \u003ccode class=\"literal\"\u003etroff-ms\u003c/code\u003e formats put out tables that are intended\n          to be included in documents using the respective mark-up\n          language. They are not complete documents! This might not be\n          necessary in HTML, but in\n          \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e you must have a complete\n          document wrapper.\n          The \u003ccode class=\"literal\"\u003elatex\u003c/code\u003e format\n          uses \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e's \u003ccode class=\"literal\"\u003etabular\u003c/code\u003e\n          environment.\n          The \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e format\n          requires the \u003cspan class=\"application\"\u003eLaTeX\u003c/span\u003e\n\u003ccode class=\"literal\"\u003elongtable\u003c/code\u003e and \u003ccode class=\"literal\"\u003ebooktabs\u003c/code\u003e packages.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border line drawing style to one\n          of \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e, \u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e,\n          or \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e.\n          Unique abbreviations are allowed.  (That would mean one\n          letter is enough.)\n          The default setting is \u003ccode class=\"literal\"\u003eascii\u003c/code\u003e.\n          This option only affects the \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e and\n          \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e output formats.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eascii\u003c/code\u003e style uses plain ASCII\n          characters.  Newlines in data are shown using\n          a \u003ccode class=\"literal\"\u003e+\u003c/code\u003e symbol in the right-hand margin.\n          When the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format wraps data from\n          one line to the next without a newline character, a dot\n          (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is shown in the right-hand margin of the first line,\n          and again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eold-ascii\u003c/code\u003e style uses plain ASCII\n          characters, using the formatting style used\n          in \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4 and earlier.\n          Newlines in data are shown using a \u003ccode class=\"literal\"\u003e:\u003c/code\u003e\n          symbol in place of the left-hand column separator.\n          When the data is wrapped from one line\n          to the next without a newline character, a \u003ccode class=\"literal\"\u003e;\u003c/code\u003e\n          symbol is used in place of the left-hand column separator.\n          \u003c/p\u003e\u003cp\u003e\u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e style uses Unicode box-drawing characters.\n          Newlines in data are shown using a carriage return symbol\n          in the right-hand margin.  When the data is wrapped from one line\n          to the next without a newline character, an ellipsis symbol\n          is shown in the right-hand margin of the first line, and\n          again in the left-hand margin of the following line.\n          \u003c/p\u003e\u003cp\u003e\n          When the \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e setting is greater than zero,\n          the \u003ccode class=\"literal\"\u003elinestyle\u003c/code\u003e option also determines the\n          characters with which the border lines are drawn.\n          Plain ASCII characters work everywhere, but\n          Unicode characters look nicer on displays that recognize them.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enull\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the string to be printed in place of a null value.\n          The default is to print nothing, which can easily be mistaken for\n          an empty string. For example, one might prefer \u003ccode class=\"literal\"\u003e\\pset null\n          '(null)'\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enumericlocale\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable display of a locale-specific character\n          to separate groups of digits to the left of the decimal marker.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and locale-specific numeric output.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Controls use of a pager program for query and \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n          help output.\n          When the \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option is \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, the pager\n          program is not used. When the \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option is\n          \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, the pager is used when appropriate, i.e., when the\n          output is to a terminal and will not fit on the screen.\n          The \u003ccode class=\"literal\"\u003epager\u003c/code\u003e option can also be set to \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e,\n          which causes the pager to be used for all terminal output regardless\n          of whether it fits on the screen.  \u003ccode class=\"literal\"\u003e\\pset pager\u003c/code\u003e\n          without a \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\n          toggles pager use on and off.\n          \u003c/p\u003e\u003cp\u003e\n          If the environment variable \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\n          or \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e is set, output to be paged is piped to the\n          specified program.  Otherwise a platform-dependent default program\n          (such as \u003ccode class=\"filename\"\u003emore\u003c/code\u003e) is used.\n          \u003c/p\u003e\u003cp\u003e\n          When using the \u003ccode class=\"literal\"\u003e\\watch\u003c/code\u003e command to execute a query\n          repeatedly, the environment variable \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\n          is used to find the pager program instead, on Unix systems.  This is\n          configured separately because it may confuse traditional pagers, but\n          can be used to send output to tools that understand\n          \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's output format (such as\n          \u003ccode class=\"filename\"\u003epspg --stream\u003c/code\u003e).\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003ccode class=\"literal\"\u003epager_min_lines\u003c/code\u003e is set to a number greater than the\n          page height, the pager program will not be called unless there are\n          at least this many lines of output to show. The default setting\n          is 0.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Specifies the record (line) separator to use in unaligned\n          output format. The default is a newline character.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003erecordsep_zero\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the record separator to use in unaligned output format to a zero\n          byte.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etableattr\u003c/code\u003e (or \u003ccode class=\"literal\"\u003eT\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          In HTML format, this specifies attributes\n          to be placed inside the \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag.  This\n          could for example be \u003ccode class=\"literal\"\u003ecellpadding\u003c/code\u003e or\n          \u003ccode class=\"literal\"\u003ebgcolor\u003c/code\u003e. Note that you probably don't want\n          to specify \u003ccode class=\"literal\"\u003eborder\u003c/code\u003e here, as that is already\n          taken care of by \u003ccode class=\"literal\"\u003e\\pset border\u003c/code\u003e.\n          If no\n          \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the table attributes are unset.\n          \u003c/p\u003e\u003cp\u003e\n          In \u003ccode class=\"literal\"\u003elatex-longtable\u003c/code\u003e format, this controls\n          the proportional width of each column containing a left-aligned\n          data type.  It is specified as a whitespace-separated list of values,\n          e.g., \u003ccode class=\"literal\"\u003e'0.2 0.2 0.6'\u003c/code\u003e.  Unspecified output columns\n          use the last specified value.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etitle\u003c/code\u003e (or \u003ccode class=\"literal\"\u003eC\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the table title for any subsequently printed tables. This\n          can be used to give your output descriptive tags. If no\n          \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is given,\n          the title is unset.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etuples_only\u003c/code\u003e (or \u003ccode class=\"literal\"\u003et\u003c/code\u003e)\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is specified\n          it must be either \u003ccode class=\"literal\"\u003eon\u003c/code\u003e or \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e\n          which will enable or disable tuples-only mode.\n          If \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is omitted the\n          command toggles between regular and tuples-only output.\n          Regular output includes extra information such\n          as column headers, titles, and various footers. In tuples-only\n          mode, only actual table data is shown.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_border_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the border drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_column_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the column drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eunicode_header_linestyle\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          Sets the header drawing style for the \u003ccode class=\"literal\"\u003eunicode\u003c/code\u003e\n          line style to one of \u003ccode class=\"literal\"\u003esingle\u003c/code\u003e\n          or \u003ccode class=\"literal\"\u003edouble\u003c/code\u003e.\n          \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003exheader_width\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n           Sets the maximum width of the header for expanded output to one of\n           \u003ccode class=\"literal\"\u003efull\u003c/code\u003e (the default value),\n           \u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e, \u003ccode class=\"literal\"\u003epage\u003c/code\u003e, or an\n           \u003cem class=\"replaceable\"\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003efull\u003c/code\u003e: the expanded header is not truncated,\n           and will be as wide as the widest output line.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003ecolumn\u003c/code\u003e: truncate the header line to the\n           width of the first column.\n          \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003epage\u003c/code\u003e: truncate the header line to the terminal\n           width.\n          \u003c/p\u003e\u003cp\u003e\n\u003cem class=\"replaceable\"\u003e\u003ccode\u003einteger value\u003c/code\u003e\u003c/em\u003e: specify\n           the exact maximum width of the header line.\n          \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n        Illustrations of how these different formats look can be seen in\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"Examples\"\u003eExamples\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        There are various shortcut commands for \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e. See\n        \u003ccode class=\"command\"\u003e\\a\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\C\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\f\u003c/code\u003e,\n        \u003ccode class=\"command\"\u003e\\H\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\t\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\T\u003c/code\u003e,\n        and \u003ccode class=\"command\"\u003e\\x\u003c/code\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUIT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\q\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\quit\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Quits the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e program.\n        In a script file, only execution of that script is terminated.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\qecho \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e except\n        that the output will be written to the query output channel, as\n        set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\r\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\reset\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Resets (clears) the query buffer.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-RESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\restrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enter \"restricted\" mode with the provided key.  In this mode, the only\n        allowed meta-command is \u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e, to exit\n        restricted mode.  The key may contain only alphanumeric characters.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\s [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Print \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's command line history\n        to \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e is omitted,\n        the history is written to the standard output (using the pager if\n        appropriate).  This command is not available\n        if \u003cspan class=\"application\"\u003epsql\u003c/span\u003e was built\n        without \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e support.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\set [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e [ ... ] ] ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if more than one value\n        is given, to the concatenation of all of them. If only one\n        argument is given, the variable is set to an empty-string value. To\n        unset a variable, use the \u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e command.\n        \u003c/p\u003e\u003cp\u003e\u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without any arguments displays the names and values\n        of all currently-set \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variables.\n        \u003c/p\u003e\u003cp\u003e\n        Valid variable names can contain letters, digits, and\n        underscores. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below for details.\n        Variable names are case-sensitive.\n        \u003c/p\u003e\u003cp\u003e\n        Certain variables are special, in that they\n        control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior or are\n        automatically set to reflect connection state.  These variables are\n        documented in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e, below.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This command is unrelated to the SQL\n        command \u003ca class=\"link\" href=\"/docs/18/sql-set.html\" title=\"SET\"\u003e\u003ccode class=\"command\"\u003eSET\u003c/code\u003e\u003c/a\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SETENV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\setenv \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the environment variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e, or if the\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e is\n        not supplied, unsets the environment variable. Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv PAGER less\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\setenv LESS -imx4F\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sf[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003efunction_description\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         This command fetches and shows the definition of the named function or procedure,\n         in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE FUNCTION\u003c/code\u003e or\n         \u003ccode class=\"command\"\u003eCREATE OR REPLACE PROCEDURE\u003c/code\u003e command.\n         The definition is printed to the current query output channel,\n         as set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n        \u003c/p\u003e\u003cp\u003e\n         The target function can be specified by name alone, or by name\n         and arguments, for example \u003ccode class=\"literal\"\u003efoo(integer, text)\u003c/code\u003e.\n         The argument types must be given if there is more\n         than one function of the same name.\n        \u003c/p\u003e\u003cp\u003e\n         If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, then the\n         output lines are numbered, with the first line of the function body\n         being line 1.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\sf\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SV\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sv[+] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eview_name\u003c/code\u003e\u003c/em\u003e \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          This command fetches and shows the definition of the named view,\n          in the form of a \u003ccode class=\"command\"\u003eCREATE OR REPLACE VIEW\u003c/code\u003e command.\n          The definition is printed to the current query output channel,\n          as set by \u003ccode class=\"command\"\u003e\\o\u003c/code\u003e.\n         \u003c/p\u003e\u003cp\u003e\n          If \u003ccode class=\"literal\"\u003e+\u003c/code\u003e is appended to the command name, then the\n          output lines are numbered from 1.\n         \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\sv\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-PIPELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\startpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\syncpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\endpipeline\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flushrequest\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\flush\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\getresults [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This group of commands implements pipelining of SQL statements.\n        A pipeline must begin with a \u003ccode class=\"command\"\u003e\\startpipeline\u003c/code\u003e\n        and end with an \u003ccode class=\"command\"\u003e\\endpipeline\u003c/code\u003e. In between there\n        may be any number of \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e commands,\n        which sends a \u003ca class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3. Extended Query\"\u003esync message\u003c/a\u003e\n        without ending the ongoing pipeline and flushing the send buffer.\n        In pipeline mode, statements are sent to the server without waiting\n        for the results of previous statements.\n        See \u003ca class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5. Pipeline Mode\"\u003eSection 32.5\u003c/a\u003e for more details.\n       \u003c/p\u003e\u003cp\u003e\n        All queries executed while a pipeline is ongoing use the extended\n        query protocol. Queries are appended to the pipeline when ending with\n        a semicolon. The meta-commands \u003ccode class=\"literal\"\u003e\\bind\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003e\\bind_named\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\close_prepared\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003e\\parse\u003c/code\u003e can be used in an ongoing pipeline. While\n        a pipeline is ongoing, \u003ccode class=\"literal\"\u003e\\sendpipeline\u003c/code\u003e will append\n        the current query buffer to the pipeline. Other meta-commands like\n        \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\gx\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003e\\gdesc\u003c/code\u003e are not allowed in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e appends a flush command to the\n        pipeline, allowing to read results with\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e without issuing a sync or ending the\n        pipeline. \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e will automatically push\n        unsent data to the server. \u003ccode class=\"command\"\u003e\\flush\u003c/code\u003e can be used to\n        manually push unsent data.\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e accepts an optional\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e parameter.\n        If provided, only the first\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enumber_results\u003c/code\u003e\u003c/em\u003e pending\n        results will be read. If not provided or \u003ccode class=\"literal\"\u003e0\u003c/code\u003e, all\n        pending results are read.\n       \u003c/p\u003e\u003cp\u003e\n        When pipeline mode is active, a dedicated prompt variable is available\n        to report the pipeline status.\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/a\u003e for more details\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e is not supported while in pipeline mode.\n       \u003c/p\u003e\u003cp\u003e\n        Example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\t\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Toggles the display of output column name headings and row count\n        footer. This command is equivalent to \u003ccode class=\"literal\"\u003e\\pset\n        tuples_only\u003c/code\u003e and is provided for convenience.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-T-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\T \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies attributes to be placed within the\n        \u003ccode class=\"sgmltag-element\"\u003etable\u003c/code\u003e tag in HTML\n        output format. This command is equivalent to \u003ccode class=\"literal\"\u003e\\pset\n        tableattr \u003cem class=\"replaceable\"\u003e\u003ccode\u003etable_options\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-TIMING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\timing [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         With a parameter, turns displaying of how long each SQL statement\n         takes on or off.  Without a parameter, toggles the display between\n         on and off.  The display is in milliseconds; intervals longer than\n         1 second are also shown in minutes:seconds format, with hours and\n         days fields added if needed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unrestrict \u003cem class=\"replaceable\"\u003e\u003ccode\u003erestrict_key\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Exit \"restricted\" mode (i.e., where all other meta-commands are\n        blocked), provided the specified key matches the one given to\n        \u003ccode class=\"command\"\u003e\\restrict\u003c/code\u003e when restricted mode was entered.\n        \u003c/p\u003e\u003cp\u003e\n        This command is primarily intended for use in plain-text dumps\n        generated by \u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e,\n        \u003cspan class=\"application\"\u003epg_dumpall\u003c/span\u003e, and\n        \u003cspan class=\"application\"\u003epg_restore\u003c/span\u003e, but it may be useful elsewhere.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument of \u003ccode class=\"command\"\u003e\\unrestrict\u003c/code\u003e, and\n        neither variable interpolation nor backquote expansion are performed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-UNSET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\unset \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Unsets (deletes) the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Most variables that control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior\n        cannot be unset; instead, an \u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e command is interpreted\n        as setting them to their default values.\n        See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WRITE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e or \u003ccode class=\"literal\"\u003e\\write\u003c/code\u003e \u003ccode class=\"literal\"\u003e|\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Writes the current query buffer to the file \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e or pipes it to the shell\n        command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        If the current query buffer is empty, the most recently executed query\n        is written instead.\n        \u003c/p\u003e\u003cp\u003e\n        If the argument begins with \u003ccode class=\"literal\"\u003e|\u003c/code\u003e, then the entire remainder\n        of the line is taken to be\n        the \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e to execute,\n        and neither variable interpolation nor backquote expansion are\n        performed in it.  The rest of the line is simply passed literally to\n        the shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WARN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\warn \u003cem class=\"replaceable\"\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/em\u003e [ ... ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This command is identical to \u003ccode class=\"command\"\u003e\\echo\u003c/code\u003e except\n        that the output will be written to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n        standard error channel, rather than standard output.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-WATCH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\watch [ i[nterval]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ] [ c[ount]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etimes\u003c/code\u003e\u003c/em\u003e ] [ m[in_rows]=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erows\u003c/code\u003e\u003c/em\u003e ] [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Repeatedly execute the current query buffer (as \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e does)\n        until interrupted, or the query fails, or the execution count limit\n        (if given) is reached, or the query no longer returns the minimum number\n        of rows. Wait the specified number of seconds (default 2) between executions.\n        The default wait can be changed with the variable\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/a\u003e.\n        For backwards compatibility,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003eseconds\u003c/code\u003e\u003c/em\u003e can be specified\n        with or without an \u003ccode class=\"literal\"\u003einterval=\u003c/code\u003e prefix.\n        Each query result is\n        displayed with a header that includes the \u003ccode class=\"literal\"\u003e\\pset title\u003c/code\u003e\n        string (if any), the time as of query start, and the delay interval.\n        \u003c/p\u003e\u003cp\u003e\n        If the current query buffer is empty, the most recently sent query\n        is re-executed instead.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\x [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003eon\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoff\u003c/code\u003e\u003c/em\u003e | \u003cem class=\"replaceable\"\u003e\u003ccode\u003eauto\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets or toggles expanded table formatting mode. As such it is equivalent to\n        \u003ccode class=\"literal\"\u003e\\pset expanded\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-Z\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\z[Sx] [ \u003ca class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e\u003c/a\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Lists tables, views and sequences with their\n        associated access privileges.\n        If a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e is\n        specified, only tables, views and sequences whose names match the\n        pattern are listed.  By default only user-created objects are shown;\n        supply a pattern or the \u003ccode class=\"literal\"\u003eS\u003c/code\u003e modifier to include\n        system objects.\n        If \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is appended to the command name, the results\n        are displayed in expanded mode.\n        \u003c/p\u003e\u003cp\u003e\n        This is an alias for \u003ccode class=\"command\"\u003e\\dp\u003c/code\u003e (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003edisplay\n        privileges\u003c/span\u003e”\u003c/span\u003e).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\! [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        With no argument, escapes to a sub-shell; \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n        resumes when the sub-shell exits.  With an argument, executes the\n        shell command \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        Unlike most other meta-commands, the entire remainder of the line is\n        always taken to be the argument(s) of \u003ccode class=\"command\"\u003e\\!\u003c/code\u003e, and neither\n        variable interpolation nor backquote expansion are performed in the\n        arguments.  The rest of the line is simply passed literally to the\n        shell.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\? [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e ]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Shows help information. The optional\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003etopic\u003c/code\u003e\u003c/em\u003e parameter\n        (defaulting to \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e) selects which part of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e is\n        explained: \u003ccode class=\"literal\"\u003ecommands\u003c/code\u003e describes \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's\n        backslash commands; \u003ccode class=\"literal\"\u003eoptions\u003c/code\u003e describes the command-line\n        options that can be passed to \u003cspan class=\"application\"\u003epsql\u003c/span\u003e;\n        and \u003ccode class=\"literal\"\u003evariables\u003c/code\u003e shows help about \u003cspan class=\"application\"\u003epsql\u003c/span\u003e configuration\n        variables.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Backslash-semicolon is not a meta-command in the same way as the\n        preceding commands; rather, it simply causes a semicolon to be\n        added to the query buffer without any further processing.\n        \u003c/p\u003e\u003cp\u003e\n        Normally, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will dispatch an SQL command to the\n        server as soon as it reaches the command-ending semicolon, even if\n        more input remains on the current line.  Thus for example entering\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eselect 1; select 2; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        will result in the three SQL commands being individually sent to\n        the server, with each one's results being displayed before\n        continuing to the next command.  However, a semicolon entered\n        as \u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e will not trigger command processing, so that the\n        command before it and the one after are effectively combined and\n        sent to the server in one request.  So for example\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eselect 1\\; select 2\\; select 3;\n\u003c/pre\u003e\u003cp\u003e\n        results in sending the three SQL commands to the server in a single\n        request, when the non-backslashed semicolon is reached.\n        The server executes such a request as a single transaction,\n        unless there are explicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e/\u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e\n        commands included in the string to divide it into multiple\n        transactions.  (See \u003ca class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1. Multiple Statements in a Simple Query\"\u003eSection 54.2.2.1\u003c/a\u003e\n        for more details about how the server handles multi-query strings.)\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PATTERNS\"\u003e\u003ch4\u003ePatterns\u003c/h4\u003e\u003cp\u003e\n   The various \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands accept a \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter to specify the\n   object name(s) to be displayed.  In the simplest case, a pattern\n   is just the exact name of the object.  The characters within a\n   pattern are normally folded to lower case, just as in SQL names;\n   for example, \u003ccode class=\"literal\"\u003e\\dt FOO\u003c/code\u003e will display the table named\n   \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  As in SQL names, placing double quotes around\n   a pattern stops folding to lower case.  Should you need to include\n   an actual double quote character in a pattern, write it as a pair\n   of double quotes within a double-quote sequence; again this is in\n   accord with the rules for SQL quoted identifiers.  For example,\n   \u003ccode class=\"literal\"\u003e\\dt \"FOO\"\"BAR\"\u003c/code\u003e will display the table named\n   \u003ccode class=\"literal\"\u003eFOO\"BAR\u003c/code\u003e (not \u003ccode class=\"literal\"\u003efoo\"bar\u003c/code\u003e).  Unlike the normal\n   rules for SQL names, you can put double quotes around just part\n   of a pattern, for instance \u003ccode class=\"literal\"\u003e\\dt FOO\"FOO\"BAR\u003c/code\u003e will display\n   the table named \u003ccode class=\"literal\"\u003efooFOObar\u003c/code\u003e.\n  \u003c/p\u003e\u003cp\u003e\n   Whenever the \u003cem class=\"replaceable\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e parameter\n   is omitted completely, the \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e commands display all objects\n   that are visible in the current schema search path — this is\n   equivalent to using \u003ccode class=\"literal\"\u003e*\u003c/code\u003e as the pattern.\n   (An object is said to be \u003cem class=\"firstterm\"\u003evisible\u003c/em\u003e if its\n   containing schema is in the search path and no object of the same\n   kind and name appears earlier in the search path. This is equivalent to the\n   statement that the object can be referenced by name without explicit\n   schema qualification.)\n   To see all objects in the database regardless of visibility,\n   use \u003ccode class=\"literal\"\u003e*.*\u003c/code\u003e as the pattern.\n  \u003c/p\u003e\u003cp\u003e\n   Within a pattern, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e matches any sequence of characters\n   (including no characters) and \u003ccode class=\"literal\"\u003e?\u003c/code\u003e matches any single character.\n   (This notation is comparable to Unix shell file name patterns.)\n   For example, \u003ccode class=\"literal\"\u003e\\dt int*\u003c/code\u003e displays tables whose names\n   begin with \u003ccode class=\"literal\"\u003eint\u003c/code\u003e.  But within double quotes, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e\n   and \u003ccode class=\"literal\"\u003e?\u003c/code\u003e lose these special meanings and are just matched\n   literally.\n  \u003c/p\u003e\u003cp\u003e\n   A relation pattern that contains a dot (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is interpreted as a schema\n   name pattern followed by an object name pattern.  For example,\n   \u003ccode class=\"literal\"\u003e\\dt foo*.*bar*\u003c/code\u003e displays all tables whose table name\n   includes \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e that are in schemas whose schema name\n   starts with \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  When no dot appears, then the pattern\n   matches only objects that are visible in the current schema search path.\n   Again, a dot within double quotes loses its special meaning and is matched\n   literally.  A relation pattern that contains two dots (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e)\n   is interpreted as a database name followed by a schema name pattern followed\n   by an object name pattern.  The database name portion will not be treated as\n   a pattern and must match the name of the currently connected database, else\n   an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   A schema pattern that contains a dot (\u003ccode class=\"literal\"\u003e.\u003c/code\u003e) is interpreted\n   as a database name followed by a schema name pattern.  For example,\n   \u003ccode class=\"literal\"\u003e\\dn mydb.*foo*\u003c/code\u003e displays all schemas whose schema name\n   includes \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e.  The database name portion will not be\n   treated as a pattern and must match the name of the currently connected\n   database, else an error will be raised.\n  \u003c/p\u003e\u003cp\u003e\n   Advanced users can use regular-expression notations such as character\n   classes, for example \u003ccode class=\"literal\"\u003e[0-9]\u003c/code\u003e to match any digit.  All regular\n   expression special characters work as specified in\n   \u003ca class=\"xref\" href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e, except for \u003ccode class=\"literal\"\u003e.\u003c/code\u003e which\n   is taken as a separator as mentioned above, \u003ccode class=\"literal\"\u003e*\u003c/code\u003e which is\n   translated to the regular-expression notation \u003ccode class=\"literal\"\u003e.*\u003c/code\u003e,\n   \u003ccode class=\"literal\"\u003e?\u003c/code\u003e which is translated to \u003ccode class=\"literal\"\u003e.\u003c/code\u003e, and\n   \u003ccode class=\"literal\"\u003e$\u003c/code\u003e which is matched literally.  You can emulate\n   these pattern characters at need by writing\n   \u003ccode class=\"literal\"\u003e?\u003c/code\u003e for \u003ccode class=\"literal\"\u003e.\u003c/code\u003e,\n   \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e+|)\u003c/code\u003e for\n   \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e*\u003c/code\u003e, or\n   \u003ccode class=\"literal\"\u003e(\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e|)\u003c/code\u003e for\n   \u003ccode class=\"literal\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eR\u003c/code\u003e\u003c/em\u003e?\u003c/code\u003e.\n   \u003ccode class=\"literal\"\u003e$\u003c/code\u003e is not needed as a regular-expression character since\n   the pattern must match the whole name, unlike the usual\n   interpretation of regular expressions (in other words, \u003ccode class=\"literal\"\u003e$\u003c/code\u003e\n   is automatically appended to your pattern).  Write \u003ccode class=\"literal\"\u003e*\u003c/code\u003e at the\n   beginning and/or end if you don't wish the pattern to be anchored.\n   Note that within double quotes, all regular expression special characters\n   lose their special meanings and are matched literally.  Also, the regular\n   expression special characters are matched literally in operator name\n   patterns (i.e., the argument of \u003ccode class=\"literal\"\u003e\\do\u003c/code\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect2\" id=\"id-1.9.4.21.8.5\"\u003e\u003ch3\u003eAdvanced Features\u003c/h3\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-VARIABLES\"\u003e\u003ch4\u003eVariables\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides variable substitution\n    features similar to common Unix command shells.\n    Variables are simply name/value pairs, where the value\n    can be any string of any length.  The name must consist of letters\n    (including non-Latin letters), digits, and underscores.\n    \u003c/p\u003e\u003cp\u003e\n    To set a variable, use the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e meta-command\n    \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e.  For example,\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo bar\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    sets the variable \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e to the value\n    \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e. To retrieve the content of the variable, precede\n    the name with a colon, for example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\echo :foo\u003c/code\u003e\u003c/strong\u003e\nbar\n\u003c/pre\u003e\u003cp\u003e\n    This works in both regular SQL commands and meta-commands; there is\n    more detail in \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL Interpolation\"\u003eSQL Interpolation\u003c/a\u003e, below.\n    \u003c/p\u003e\u003cp\u003e\n    If you call \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without a second argument, the\n    variable is set to an empty-string value. To unset (i.e., delete)\n    a variable, use the command \u003ccode class=\"command\"\u003e\\unset\u003c/code\u003e.  To show the\n    values of all variables, call \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e without any argument.\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n    The arguments of \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e are subject to the same\n    substitution rules as with other commands. Thus you can construct\n    interesting references such as \u003ccode class=\"literal\"\u003e\\set :foo\n    'something'\u003c/code\u003e and get \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003esoft links\u003c/span\u003e”\u003c/span\u003e or\n    \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003evariable variables\u003c/span\u003e”\u003c/span\u003e of \u003cspan class=\"productname\"\u003ePerl\u003c/span\u003e\n    or \u003cspan class=\"productname\"\u003ePHP\u003c/span\u003e fame,\n    respectively. Unfortunately (or fortunately?), there is no way to do\n    anything useful with these constructs. On the other hand,\n    \u003ccode class=\"literal\"\u003e\\set bar :foo\u003c/code\u003e is a perfectly valid way to copy a\n    variable.\n    \u003c/p\u003e\u003c/div\u003e\u003cp\u003e\n    A number of these variables are treated specially\n    by \u003cspan class=\"application\"\u003epsql\u003c/span\u003e. They represent certain option\n    settings that can be changed at run time by altering the value of\n    the variable, or in some cases represent changeable state of\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n    By convention, all specially treated variables' names\n    consist of all upper-case ASCII letters (and possibly digits and\n    underscores). To ensure maximum compatibility in the future, avoid\n    using such variable names for your own purposes.\n   \u003c/p\u003e\u003cp\u003e\n    Variables that control \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's behavior\n    generally cannot be unset or set to invalid values.  An \u003ccode class=\"literal\"\u003e\\unset\u003c/code\u003e\n    command is allowed but is interpreted as setting the variable to its\n    default value.  A \u003ccode class=\"literal\"\u003e\\set\u003c/code\u003e command without a second argument is\n    interpreted as setting the variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, for control\n    variables that accept that value, and is rejected for others.  Also,\n    control variables that accept the values \u003ccode class=\"literal\"\u003eon\u003c/code\u003e\n    and \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e will also accept other common spellings of Boolean\n    values, such as \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e and \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e.\n   \u003c/p\u003e\u003cp\u003e\n    The specially treated variables are:\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eAUTOCOMMIT\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When \u003ccode class=\"literal\"\u003eon\u003c/code\u003e (the default), each SQL command is automatically\n        committed upon successful completion.  To postpone commit in this\n        mode, you must enter a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e or \u003ccode class=\"command\"\u003eSTART\n        TRANSACTION\u003c/code\u003e SQL command.  When \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e or unset, SQL\n        commands are not committed until you explicitly issue\n        \u003ccode class=\"command\"\u003eCOMMIT\u003c/code\u003e or \u003ccode class=\"command\"\u003eEND\u003c/code\u003e.  The autocommit-off\n        mode works by issuing an implicit \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e for you, just\n        before any command that is not already in a transaction block and\n        is not itself a \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e or other transaction-control\n        command, nor a command that cannot be executed inside a transaction\n        block (such as \u003ccode class=\"command\"\u003eVACUUM\u003c/code\u003e).\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         In autocommit-off mode, you must explicitly abandon any failed\n         transaction by entering \u003ccode class=\"command\"\u003eABORT\u003c/code\u003e or \u003ccode class=\"command\"\u003eROLLBACK\u003c/code\u003e.\n         Also keep in mind that if you exit the session\n         without committing, your work will be lost.\n        \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n         The autocommit-on mode is \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e's traditional\n         behavior, but autocommit-off is closer to the SQL spec.  If you\n         prefer autocommit-off, you might wish to set it in the system-wide\n         \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e file or your\n         \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e file.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eCOMP_KEYWORD_CASE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Determines which letter case to use when completing an SQL key word.\n        If set to \u003ccode class=\"literal\"\u003elower\u003c/code\u003e or \u003ccode class=\"literal\"\u003eupper\u003c/code\u003e, the\n        completed word will be in lower or upper case, respectively.  If set\n        to \u003ccode class=\"literal\"\u003epreserve-lower\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003epreserve-upper\u003c/code\u003e (the default), the completed word\n        will be in the case of the word already entered, but words being\n        completed without anything entered will be in lower or upper case,\n        respectively.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-DBNAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eDBNAME\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The name of the database you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If set to \u003ccode class=\"literal\"\u003eall\u003c/code\u003e, all nonempty input lines are printed\n        to standard output as they are read.  (This does not apply to lines\n        read interactively.)  To select this behavior on program\n        start-up, use the switch \u003ccode class=\"option\"\u003e-a\u003c/code\u003e. If set to\n        \u003ccode class=\"literal\"\u003equeries\u003c/code\u003e,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e prints each query to standard output\n        as it is sent to the server. The switch to select this behavior is\n        \u003ccode class=\"option\"\u003e-e\u003c/code\u003e. If set to \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e, then only\n        failed queries are displayed on standard error output. The switch\n        for this behavior is \u003ccode class=\"option\"\u003e-b\u003c/code\u003e. If set to\n        \u003ccode class=\"literal\"\u003enone\u003c/code\u003e (the default), then no queries are displayed.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eECHO_HIDDEN\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e and a backslash command\n        queries the database, the query is first shown.\n        This feature helps you to study\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e internals and provide\n        similar functionality in your own programs. (To select this behavior\n        on program start-up, use the switch \u003ccode class=\"option\"\u003e-E\u003c/code\u003e.)  If you set\n        this variable to the value \u003ccode class=\"literal\"\u003enoexec\u003c/code\u003e, the queries are\n        just shown but are not actually sent to the server and executed.\n        The default value is \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ENCODING\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eENCODING\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The current client character set encoding.\n        This is set every time you connect to a database (including\n        program start-up), and when you change the encoding\n        with \u003ccode class=\"literal\"\u003e\\encoding\u003c/code\u003e, but it can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etrue\u003c/code\u003e if the last SQL query failed, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e if\n         it succeeded.  See also \u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        If this variable is set to an integer value greater than zero,\n        the results of \u003ccode class=\"command\"\u003eSELECT\u003c/code\u003e queries are fetched\n        and displayed in groups of that many rows, rather than the\n        default behavior of collecting the entire result set before\n        display.  Therefore only a\n        limited amount of memory is used, regardless of the size of\n        the result set.  Settings of 100 to 1000 are commonly used\n        when enabling this feature.\n        Keep in mind that when using this feature, a query might\n        fail after having already displayed some rows.\n        \u003c/p\u003e\u003cdiv class=\"tip\"\u003e\u003ch3 class=\"title\"\u003eTip\u003c/h3\u003e\u003cp\u003e\n        Although you can use any output format with this feature,\n        the default \u003ccode class=\"literal\"\u003ealigned\u003c/code\u003e format tends to look bad\n        because each group of \u003ccode class=\"varname\"\u003eFETCH_COUNT\u003c/code\u003e rows\n        will be formatted separately, leading to varying column\n        widths across the row groups.  The other output formats work better.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TABLEAM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, a table's access\n         method details are not displayed. This is mainly useful for\n         regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHIDE_TOAST_COMPRESSION\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003etrue\u003c/code\u003e, column\n         compression method details are not displayed. This is mainly\n         useful for regression tests.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTCONTROL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If this variable is set to \u003ccode class=\"literal\"\u003eignorespace\u003c/code\u003e,\n         lines which begin with a space are not entered into the history\n         list. If set to a value of \u003ccode class=\"literal\"\u003eignoredups\u003c/code\u003e, lines\n         matching the previous history line are not entered. A value of\n         \u003ccode class=\"literal\"\u003eignoreboth\u003c/code\u003e combines the two options. If\n         set to \u003ccode class=\"literal\"\u003enone\u003c/code\u003e (the default), all lines\n         read in interactive mode are saved on the history list.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTFILE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The file name that will be used to store the history list.  If unset,\n        the file name is taken from the \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e\n        environment variable.  If that is not set either, the default\n        is \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e,\n        or \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n        For example, putting:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\\set HISTFILE ~/.psql_history-:DBNAME\n\u003c/pre\u003e\u003cp\u003e\n        in \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e will cause\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to maintain a separate history for\n        each database.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HISTSIZE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHISTSIZE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The maximum number of commands to store in the command history\n        (default 500).  If set to a negative value, no limit is applied.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-HOST\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eHOST\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server host you are currently connected to. This is\n        set every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eIGNOREEOF\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         If set to 1 or less, sending an EOF character (usually\n         \u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eD\u003c/strong\u003e\u003c/span\u003e)\n         to an interactive session of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n         will terminate the application.  If set to a larger numeric value,\n         that many consecutive EOF characters must be typed to\n         make an interactive session terminate.  If the variable is set to a\n         non-numeric value, it is interpreted as 10.  The default is 0.\n        \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n        This feature was shamelessly plagiarized from\n        \u003cspan class=\"application\"\u003eBash\u003c/span\u003e.\n        \u003c/p\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LASTOID\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLASTOID\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the last affected OID, as returned from an\n        \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e or \u003ccode class=\"command\"\u003e\\lo_import\u003c/code\u003e\n        command. This variable is only guaranteed to be valid until\n        after the result of the next SQL command has\n        been displayed.\n        \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e servers since version 12 do not\n        support OID system columns anymore, thus LASTOID will always be 0\n        following \u003ccode class=\"command\"\u003eINSERT\u003c/code\u003e when targeting such servers.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_MESSAGE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eLAST_ERROR_SQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The primary error message and associated SQLSTATE code for the most\n         recent failed query in the current \u003cspan class=\"application\"\u003epsql\u003c/span\u003e session, or\n         an empty string and \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e if no error has occurred in\n         the current session.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"\u003e\u003cspan class=\"term\"\u003e\n\u003ccode class=\"varname\"\u003eON_ERROR_ROLLBACK\u003c/code\u003e\n\n\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, if a statement in a transaction block\n        generates an error, the error is ignored and the transaction\n        continues. When set to \u003ccode class=\"literal\"\u003einteractive\u003c/code\u003e, such errors are only\n        ignored in interactive sessions, and not when reading script\n        files. When set to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e (the default), a statement in a\n        transaction block that generates an error aborts the entire\n        transaction. The error rollback mode works by issuing an\n        implicit \u003ccode class=\"command\"\u003eSAVEPOINT\u003c/code\u003e for you, just before each command\n        that is in a transaction block, and then rolling back to the\n        savepoint if the command fails.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eON_ERROR_STOP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, command processing continues after an error.  When this\n        variable is set to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e, processing will instead stop\n        immediately.  In interactive mode,\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will return to the command prompt;\n        otherwise, \u003cspan class=\"application\"\u003epsql\u003c/span\u003e will exit, returning\n        error code 3 to distinguish this case from fatal error\n        conditions, which are reported using error code 1.  In either case,\n        any currently running scripts (the top-level script, if any, and any\n        other scripts which it may have in invoked) will be terminated\n        immediately.  If the top-level command string contained multiple SQL\n        commands, processing will stop with the current command.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_COMMAND_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_RESULT_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of commands of an ongoing pipeline that were followed\n        by either a \u003ccode class=\"command\"\u003e\\flushrequest\u003c/code\u003e or a\n        \u003ccode class=\"command\"\u003e\\syncpipeline\u003c/code\u003e, forcing the server to send the\n        results. These results can be retrieved with\n        \u003ccode class=\"command\"\u003e\\getresults\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePIPELINE_SYNC_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The number of sync messages queued in an ongoing pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PORT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePORT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database server port to which you are currently connected.\n        This is set every time you connect to a database (including\n        program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-PROMPT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These specify what the prompts \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n        issues should look like. See \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"Prompting\"\u003ePrompting\u003c/a\u003e below.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-QUIET\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eQUIET\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-q\u003c/code\u003e. It is probably not too useful in\n        interactive mode.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eROW_COUNT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The number of rows returned or affected by the last SQL query, or 0\n         if the query failed or did not report a row count.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVER_VERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The server's version number as a string, for\n        example \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e, \u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e or \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e,\n        and in numeric form, for\n        example \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e or \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e.\n        These are set every time you connect to a database\n        (including program start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SERVICE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSERVICE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The service name, if applicable.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n\u003ccode class=\"literal\"\u003etrue\u003c/code\u003e if the last shell command\n         failed, \u003ccode class=\"literal\"\u003efalse\u003c/code\u003e if it succeeded.\n         This applies to shell commands invoked via the \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e,\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e,\n         and \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHELL_EXIT_CODE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The exit status returned by the last shell command.\n         0–127 represent program exit codes, 128–255\n         indicate termination by a signal, and -1 indicates failure\n         to launch a program or to collect its exit status.\n         This applies to shell commands invoked via the \u003ccode class=\"literal\"\u003e\\!\u003c/code\u003e,\n         \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, \u003ccode class=\"literal\"\u003e\\w\u003c/code\u003e,\n         and \u003ccode class=\"literal\"\u003e\\copy\u003c/code\u003e meta-commands, as well as backquote\n         (\u003ccode class=\"literal\"\u003e`\u003c/code\u003e) expansion.  Note that\n         for \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e, this variable is updated when the output\n         pipe is closed by the next \u003ccode class=\"literal\"\u003e\\o\u003c/code\u003e command.\n         See also \u003ccode class=\"varname\"\u003eSHELL_ERROR\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_ALL_RESULTS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When this variable is set to \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e, only the last\n        result of a combined query (\u003ccode class=\"literal\"\u003e\\;\u003c/code\u003e) is shown instead of\n        all of them.  The default is \u003ccode class=\"literal\"\u003eon\u003c/code\u003e.  The off behavior\n        is for compatibility with older versions of\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSHOW_CONTEXT\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the\n        values \u003ccode class=\"literal\"\u003enever\u003c/code\u003e, \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e\n        to control whether \u003ccode class=\"literal\"\u003eCONTEXT\u003c/code\u003e fields are displayed in\n        messages from the server. The default is \u003ccode class=\"literal\"\u003eerrors\u003c/code\u003e (meaning\n        that context will be shown in error messages, but not in notice or\n        warning messages).  This setting has no effect\n        when \u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e is set to \u003ccode class=\"literal\"\u003eterse\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e.\n        (See also \u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLELINE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLELINE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-S\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSINGLESTEP\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Setting this variable to \u003ccode class=\"literal\"\u003eon\u003c/code\u003e is equivalent to the command\n        line option \u003ccode class=\"option\"\u003e-s\u003c/code\u003e.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-SQLSTATE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eSQLSTATE\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         The error code (see \u003ca class=\"xref\" href=\"/docs/18/errcodes-appendix.html\" title=\"Appendix A. PostgreSQL Error Codes\"\u003eAppendix A\u003c/a\u003e) associated\n         with the last SQL query's failure, or \u003ccode class=\"literal\"\u003e00000\u003c/code\u003e if it\n         succeeded.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-USER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The database user you are currently connected as. This is set\n        every time you connect to a database (including program\n        start-up), but can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERBOSITY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERBOSITY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable can be set to the values \u003ccode class=\"literal\"\u003edefault\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003everbose\u003c/code\u003e, \u003ccode class=\"literal\"\u003eterse\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003esqlstate\u003c/code\u003e to control the verbosity of error\n        reports.\n        (See also \u003ccode class=\"command\"\u003e\\errverbose\u003c/code\u003e, for use when you want a verbose\n        version of the error you just got.)\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-VERSION\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NAME\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eVERSION_NUM\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        These variables are set at program start-up to reflect\n        \u003cspan class=\"application\"\u003epsql\u003c/span\u003e's version, respectively as a verbose string,\n        a short string (e.g., \u003ccode class=\"literal\"\u003e9.6.2\u003c/code\u003e, \u003ccode class=\"literal\"\u003e10.1\u003c/code\u003e,\n        or \u003ccode class=\"literal\"\u003e11beta1\u003c/code\u003e), and a number (e.g., \u003ccode class=\"literal\"\u003e90602\u003c/code\u003e\n        or \u003ccode class=\"literal\"\u003e100001\u003c/code\u003e).  They can be changed or unset.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"varname\"\u003eWATCH_INTERVAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This variable sets the default interval, in seconds, which\n        \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e waits between executing the query. The\n        default is 2 seconds.  Specifying an interval in the command overrides\n        this variable.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\"\u003e\u003ch4\u003eSQL Interpolation\u003c/h4\u003e\u003cp\u003e\n    A key feature of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n    variables is that you can substitute (\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003einterpolate\u003c/span\u003e”\u003c/span\u003e)\n    them into regular SQL statements, as well as the\n    arguments of meta-commands.  Furthermore,\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e provides facilities for\n    ensuring that variable values used as SQL literals and identifiers are\n    properly quoted.  The syntax for interpolating a value without\n    any quoting is to prepend the variable name with a colon\n    (\u003ccode class=\"literal\"\u003e:\u003c/code\u003e).  For example,\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :foo;\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    would query the table \u003ccode class=\"literal\"\u003emy_table\u003c/code\u003e. Note that this\n    may be unsafe: the value of the variable is copied literally, so it can\n    contain unbalanced quotes, or even backslash commands. You must make sure\n    that it makes sense where you put it.\n    \u003c/p\u003e\u003cp\u003e\n    When a value is to be used as an SQL literal or identifier, it is\n    safest to arrange for it to be quoted.  To quote the value of\n    a variable as an SQL literal, write a colon followed by the variable\n    name in single quotes.  To quote the value as an SQL identifier, write\n    a colon followed by the variable name in double quotes.\n    These constructs deal correctly with quotes and other special\n    characters embedded within the variable value.\n    The previous example would be more safely written this way:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set foo 'my_table'\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM :\"foo\";\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Variable interpolation will not be performed within quoted\n    SQL literals and identifiers.  Therefore, a\n    construction such as \u003ccode class=\"literal\"\u003e':foo'\u003c/code\u003e doesn't work to produce a quoted\n    literal from a variable's value (and it would be unsafe if it did work,\n    since it wouldn't correctly handle quotes embedded in the value).\n    \u003c/p\u003e\u003cp\u003e\n    One example use of this mechanism is to\n    copy the contents of a file into a table column.\n    First load the file into a variable and then interpolate the variable's\n    value as a quoted string:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set content `cat my_file.txt`\u003c/code\u003e\u003c/strong\u003e\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eINSERT INTO my_table VALUES (:'content');\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n    (Note that this still won't work if \u003ccode class=\"filename\"\u003emy_file.txt\u003c/code\u003e contains NUL bytes.\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e does not support embedded NUL bytes in variable values.)\n    \u003c/p\u003e\u003cp\u003e\n    Since colons can legally appear in SQL commands, an apparent attempt\n    at interpolation (that is, \u003ccode class=\"literal\"\u003e:name\u003c/code\u003e,\n    \u003ccode class=\"literal\"\u003e:'name'\u003c/code\u003e, or \u003ccode class=\"literal\"\u003e:\"name\"\u003c/code\u003e) is not\n    replaced unless the named variable is currently set. In any case, you\n    can escape a colon with a backslash to protect it from substitution.\n    \u003c/p\u003e\u003cp\u003e\n    The \u003ccode class=\"literal\"\u003e:{?\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e}\u003c/code\u003e special syntax returns TRUE\n    or FALSE depending on whether the variable exists or not, and is thus\n    always substituted, unless the colon is backslash-escaped.\n    \u003c/p\u003e\u003cp\u003e\n    The colon syntax for variables is standard SQL for\n    embedded query languages, such as \u003cspan class=\"application\"\u003eECPG\u003c/span\u003e.\n    The colon syntaxes for array slices and type casts are\n    \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extensions, which can sometimes\n    conflict with the standard usage.  The colon-quote syntax for escaping a\n    variable's value as an SQL literal or identifier is a\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e extension.\n    \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-PROMPTING\"\u003e\u003ch4\u003ePrompting\u003c/h4\u003e\u003cp\u003e\n    The prompts \u003cspan class=\"application\"\u003epsql\u003c/span\u003e issues can be customized\n    to your preference. The three variables \u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e,\n    \u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e, and \u003ccode class=\"varname\"\u003ePROMPT3\u003c/code\u003e contain strings\n    and special escape sequences that describe the appearance of the\n    prompt. Prompt 1 is the normal prompt that is issued when\n    \u003cspan class=\"application\"\u003epsql\u003c/span\u003e requests a new command. Prompt 2 is\n    issued when more input is expected during command entry, for example\n    because the command was not terminated with a semicolon or a quote\n    was not closed.\n    Prompt 3 is issued when you are running an SQL\n\u003ccode class=\"command\"\u003eCOPY FROM STDIN\u003c/code\u003e command and you need to type in\n    a row value on the terminal.\n    \u003c/p\u003e\u003cp\u003e\n    The value of the selected prompt variable is printed literally,\n    except where a percent sign (\u003ccode class=\"literal\"\u003e%\u003c/code\u003e) is encountered.\n    Depending on the next character, certain other text is substituted\n    instead. Defined substitutions are:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%M\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The full host name (with domain name) of the database server,\n          or \u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e if the connection is over a Unix\n          domain socket, or\n          \u003ccode class=\"literal\"\u003e[local:\u003cem class=\"replaceable\"\u003e\u003ccode\u003e/dir/name\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e,\n          if the Unix domain socket is not at the compiled in default\n          location.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-M-LC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%m\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The host name of the database server, truncated at the\n          first dot, or \u003ccode class=\"literal\"\u003e[local]\u003c/code\u003e if the connection is\n          over a Unix domain socket.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-GT\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u0026gt;\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe port number at which the database server is listening.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-N\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%n\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The database session user name.  (The expansion of this\n          value might change during a database session as the result\n          of the command \u003ccode class=\"command\"\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-S\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%s\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the service.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SLASH\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%/\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of the current database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-TILDE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%~\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eLike \u003ccode class=\"literal\"\u003e%/\u003c/code\u003e, but the output is \u003ccode class=\"literal\"\u003e~\u003c/code\u003e\n         (tilde) if the database is your default database.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%#\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          If the session user is a database superuser, then a\n          \u003ccode class=\"literal\"\u003e#\u003c/code\u003e, otherwise a \u003ccode class=\"literal\"\u003e\u0026gt;\u003c/code\u003e.\n          (The expansion of this value might change during a database\n          session as the result of the command \u003ccode class=\"command\"\u003eSET SESSION\n          AUTHORIZATION\u003c/code\u003e.)\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%p\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe process ID of the backend currently connected to.\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-P-UC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%P\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Pipeline status: \u003ccode class=\"literal\"\u003eoff\u003c/code\u003e when not in a pipeline,\n        \u003ccode class=\"literal\"\u003eon\u003c/code\u003e when in an ongoing pipeline or\n        \u003ccode class=\"literal\"\u003eabort\u003c/code\u003e when in an aborted pipeline.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-R\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%R\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        In prompt 1 normally \u003ccode class=\"literal\"\u003e=\u003c/code\u003e,\n        but \u003ccode class=\"literal\"\u003e@\u003c/code\u003e if the session is in an inactive branch of a\n        conditional block, or \u003ccode class=\"literal\"\u003e^\u003c/code\u003e if in single-line mode,\n        or \u003ccode class=\"literal\"\u003e!\u003c/code\u003e if the session is disconnected from the\n        database (which can happen if \u003ccode class=\"command\"\u003e\\connect\u003c/code\u003e fails).\n        In prompt 2 \u003ccode class=\"literal\"\u003e%R\u003c/code\u003e is replaced by a character that\n        depends on why \u003cspan class=\"application\"\u003epsql\u003c/span\u003e expects more input:\n        \u003ccode class=\"literal\"\u003e-\u003c/code\u003e if the command simply wasn't terminated yet,\n        but \u003ccode class=\"literal\"\u003e*\u003c/code\u003e if there is an unfinished\n        \u003ccode class=\"literal\"\u003e/* ... */\u003c/code\u003e comment,\n        a single quote if there is an unfinished quoted string,\n        a double quote if there is an unfinished quoted identifier,\n        a dollar sign if there is an unfinished dollar-quoted string,\n        or \u003ccode class=\"literal\"\u003e(\u003c/code\u003e if there is an unmatched left parenthesis.\n        In prompt 3 \u003ccode class=\"literal\"\u003e%R\u003c/code\u003e doesn't produce anything.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-X\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%x\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Transaction status: an empty string when not in a transaction\n        block, or \u003ccode class=\"literal\"\u003e*\u003c/code\u003e when in a transaction block, or\n        \u003ccode class=\"literal\"\u003e!\u003c/code\u003e when in a failed transaction block, or \u003ccode class=\"literal\"\u003e?\u003c/code\u003e\n        when the transaction state is indeterminate (for example, because\n        there is no connection).\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-L\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%l\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n          The line number inside the current statement, starting from \u003ccode class=\"literal\"\u003e1\u003c/code\u003e.\n         \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-DIGITS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003edigits\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The character with the indicated octal code is substituted.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-NAME\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%:\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e:\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The value of the \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e. See\n        \u003ca class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"Variables\"\u003eVariables\u003c/a\u003e, above, for details.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-COMMAND\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%`\u003c/code\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e\u003ccode class=\"literal\"\u003e`\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        The output of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecommand\u003c/code\u003e\u003c/em\u003e, similar to ordinary\n        \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003eback-tick\u003c/span\u003e”\u003c/span\u003e substitution.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%[\u003c/code\u003e ... \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n         Prompts can contain terminal control characters which, for\n         example, change the color, background, or style of the prompt\n         text, or change the title of the terminal window. In order for\n         the line editing features of \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e to work properly, these\n         non-printing control characters must be designated as invisible\n         by surrounding them with \u003ccode class=\"literal\"\u003e%[\u003c/code\u003e and\n         \u003ccode class=\"literal\"\u003e%]\u003c/code\u003e. Multiple pairs of these can occur within\n         the prompt.  For example:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n\u003c/pre\u003e\u003cp\u003e\n         results in a boldfaced (\u003ccode class=\"literal\"\u003e1;\u003c/code\u003e) yellow-on-black\n         (\u003ccode class=\"literal\"\u003e33;40\u003c/code\u003e) prompt on VT100-compatible, color-capable\n         terminals.\n        \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-PROMPTING-W\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e%w\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Whitespace of the same width as the most recent output of\n        \u003ccode class=\"varname\"\u003ePROMPT1\u003c/code\u003e.  This can be used as a\n        \u003ccode class=\"varname\"\u003ePROMPT2\u003c/code\u003e setting, so that multi-line statements are\n        aligned with the first line, but there is no visible secondary prompt.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\n    To insert a percent sign into your prompt, write\n    \u003ccode class=\"literal\"\u003e%%\u003c/code\u003e. The default prompts are\n    \u003ccode class=\"literal\"\u003e'%/%R%x%# '\u003c/code\u003e for prompts 1 and 2, and\n    \u003ccode class=\"literal\"\u003e'\u0026gt;\u0026gt; '\u003c/code\u003e for prompt 3.\n    \u003c/p\u003e\u003cdiv class=\"note\"\u003e\u003ch3 class=\"title\"\u003eNote\u003c/h3\u003e\u003cp\u003e\n    This feature was shamelessly plagiarized from\n    \u003cspan class=\"application\"\u003etcsh\u003c/span\u003e.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect3\" id=\"APP-PSQL-READLINE\"\u003e\u003ch4\u003eCommand-Line Editing\u003c/h4\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e uses\n    the \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e\n    or \u003cspan class=\"application\"\u003elibedit\u003c/span\u003e library, if available, for\n    convenient line editing and retrieval.  The command history is\n    automatically saved when \u003cspan class=\"application\"\u003epsql\u003c/span\u003e exits and is\n    reloaded when \u003cspan class=\"application\"\u003epsql\u003c/span\u003e starts up.  Type\n    up-arrow or control-P to retrieve previous lines.\n    \u003c/p\u003e\u003cp\u003e\n    You can also use tab completion to fill in partially-typed keywords\n    and SQL object names in many (by no means all) contexts.  For example,\n    at the start of a command, typing \u003ccode class=\"literal\"\u003eins\u003c/code\u003e and pressing\n    TAB will fill in \u003ccode class=\"literal\"\u003einsert into \u003c/code\u003e.  Then, typing a few\n    characters of a table or schema name and pressing \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e\n    will fill in the unfinished name, or offer a menu of possible completions\n    when there's more than one.  (Depending on the library in use, you may need to\n    press \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e more than once to get a menu.)\n    \u003c/p\u003e\u003cp\u003e\n    Tab completion for SQL object names requires sending queries to the\n    server to find possible matches.  In some contexts this can interfere\n    with other operations.  For example, after \u003ccode class=\"command\"\u003eBEGIN\u003c/code\u003e\n    it will be too late to issue \u003ccode class=\"command\"\u003eSET TRANSACTION ISOLATION\n    LEVEL\u003c/code\u003e if a tab-completion query is issued in between.\n    If you do not want tab completion at all, you\n    can turn it off permanently by putting this in a file named\n    \u003ccode class=\"filename\"\u003e.inputrc\u003c/code\u003e in your home directory:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e$if psql\nset disable-completion on\n$endif\n\u003c/pre\u003e\u003cp\u003e\n    (This is not a \u003cspan class=\"application\"\u003epsql\u003c/span\u003e but a\n    \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e feature. Read its documentation\n    for further details.)\n    \u003c/p\u003e\u003cp\u003e\n     The \u003ccode class=\"option\"\u003e-n\u003c/code\u003e (\u003ccode class=\"option\"\u003e--no-readline\u003c/code\u003e) command line\n     option can also be useful to disable use\n     of \u003cspan class=\"application\"\u003eReadline\u003c/span\u003e for a single run\n     of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  This prevents tab completion,\n     use or recording of command line history, and editing of multi-line\n     commands.  It is particularly useful when you need to copy-and-paste\n     text that contains \u003ccode class=\"literal\"\u003eTAB\u003c/code\u003e characters.\n    \u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eCOLUMNS\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If \u003ccode class=\"literal\"\u003e\\pset columns\u003c/code\u003e is zero, controls the\n      width for the \u003ccode class=\"literal\"\u003ewrapped\u003c/code\u003e format and width for determining\n      if wide output requires the pager or should be switched to the\n      vertical format in expanded auto mode.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGDATABASE\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePGUSER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Default connection parameters (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Specifies whether to use color in diagnostic messages. Possible values\n      are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n      \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eEDITOR\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eVISUAL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Editor used by the \u003ccode class=\"command\"\u003e\\e\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e,\n      and \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e commands.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If none of them is set, the default is to use \u003ccode class=\"filename\"\u003evi\u003c/code\u003e\n      on Unix systems or \u003ccode class=\"filename\"\u003enotepad.exe\u003c/code\u003e on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_EDITOR_LINENUMBER_ARG\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When \u003ccode class=\"command\"\u003e\\e\u003c/code\u003e, \u003ccode class=\"command\"\u003e\\ef\u003c/code\u003e, or\n      \u003ccode class=\"command\"\u003e\\ev\u003c/code\u003e is used\n      with a line number argument, this variable specifies the\n      command-line argument used to pass the starting line number to\n      the user's editor.  For editors such as \u003cspan class=\"productname\"\u003eEmacs\u003c/span\u003e or\n      \u003cspan class=\"productname\"\u003evi\u003c/span\u003e, this is a plus sign.  Include a trailing\n      space in the value of the variable if there needs to be space\n      between the option name and the line number.  Examples:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003ePSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n      The default is \u003ccode class=\"literal\"\u003e+\u003c/code\u003e on Unix systems\n      (corresponding to the default editor \u003ccode class=\"filename\"\u003evi\u003c/code\u003e,\n      and useful for many other common editors); but there is no\n      default on Windows systems.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location for the command history file. Tilde (\u003ccode class=\"literal\"\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      If a query's results do not fit on the screen, they are piped\n      through this command. Typical values are \u003ccode class=\"literal\"\u003emore\u003c/code\u003e\n      or \u003ccode class=\"literal\"\u003eless\u003c/code\u003e.\n      Use of the pager can be disabled by setting \u003ccode class=\"envar\"\u003ePSQL_PAGER\u003c/code\u003e\n      or \u003ccode class=\"envar\"\u003ePAGER\u003c/code\u003e to an empty string, or by adjusting the\n      pager-related options of the \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e command.\n      These variables are examined in the order listed;\n      the first that is set is used.\n      If neither of them is set, the default is to use \u003ccode class=\"literal\"\u003emore\u003c/code\u003e on most\n      platforms, but \u003ccode class=\"literal\"\u003eless\u003c/code\u003e on Cygwin.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      When a query is executed repeatedly with the \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e\n      command, a pager is not used by default.  This behavior can be changed\n      by setting \u003ccode class=\"envar\"\u003ePSQL_WATCH_PAGER\u003c/code\u003e to a pager command, on Unix\n      systems.  The \u003ccode class=\"literal\"\u003epspg\u003c/code\u003e pager (not part of\n      \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e but available in many open source\n      software distributions) can display the output of\n      \u003ccode class=\"command\"\u003e\\watch\u003c/code\u003e if started with the option\n      \u003ccode class=\"literal\"\u003e--stream\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Alternative location of the user's \u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e file. Tilde (\u003ccode class=\"literal\"\u003e~\u003c/code\u003e) expansion is performed.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-SHELL\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eSHELL\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Command executed by the \u003ccode class=\"command\"\u003e\\!\u003c/code\u003e command.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"envar\"\u003eTMPDIR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      Directory for storing temporary files.  The default is\n      \u003ccode class=\"filename\"\u003e/tmp\u003c/code\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   also uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.10\"\u003e\u003ch2\u003eFiles\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-FILES-PSQLRC\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e and \u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     Unless it is passed an \u003ccode class=\"option\"\u003e-X\u003c/code\u003e option,\n     \u003cspan class=\"application\"\u003epsql\u003c/span\u003e attempts to read and execute commands\n     from the system-wide startup file (\u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e) and then\n     the user's personal startup file (\u003ccode class=\"filename\"\u003e~/.psqlrc\u003c/code\u003e), after\n     connecting to the database but before accepting normal commands.\n     These files can be used to set up the client and/or the server to taste,\n     typically with \u003ccode class=\"command\"\u003e\\set\u003c/code\u003e and \u003ccode class=\"command\"\u003eSET\u003c/code\u003e\n     commands.\n    \u003c/p\u003e\u003cp\u003e\n     The system-wide startup file is named \u003ccode class=\"filename\"\u003epsqlrc\u003c/code\u003e.\n     By default it is\n     sought in the installation's \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003esystem configuration\u003c/span\u003e”\u003c/span\u003e directory,\n     which is most reliably identified by running \u003ccode class=\"literal\"\u003epg_config\n     --sysconfdir\u003c/code\u003e.\n     Typically this directory will be \u003ccode class=\"filename\"\u003e../etc/\u003c/code\u003e\n     relative to the directory containing\n     the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e executables.\n     The directory to look in can be set explicitly via\n     the \u003ccode class=\"envar\"\u003ePGSYSCONFDIR\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     The user's personal startup file is named \u003ccode class=\"filename\"\u003e.psqlrc\u003c/code\u003e\n     and is sought in the invoking user's home directory.\n     On Windows the personal startup file is instead named\n     \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psqlrc.conf\u003c/code\u003e.\n     In either case, this default file path can be overridden by setting\n     the \u003ccode class=\"envar\"\u003ePSQLRC\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003cp\u003e\n     Both the system-wide startup file and the user's personal startup file\n     can be made \u003cspan class=\"application\"\u003epsql\u003c/span\u003e-version-specific\n     by appending a dash and the \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n     major or minor release identifier to the file name,\n     for example \u003ccode class=\"filename\"\u003e~/.psqlrc-18\u003c/code\u003e or\n     \u003ccode class=\"filename\"\u003e~/.psqlrc-18.7\u003c/code\u003e.\n     The most specific version-matching file will be read in preference\n     to a non-version-specific file.\n     These version suffixes are added after determining the file path\n     as explained above.\n    \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"APP-PSQL-FILES-PSQL-HISTORY\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"filename\"\u003e.psql_history\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n     The command-line history is stored in the file\n     \u003ccode class=\"filename\"\u003e~/.psql_history\u003c/code\u003e, or\n     \u003ccode class=\"filename\"\u003e%APPDATA%\\postgresql\\psql_history\u003c/code\u003e on Windows.\n    \u003c/p\u003e\u003cp\u003e\n     The location of the history file can be set explicitly via\n     the \u003ccode class=\"varname\"\u003eHISTFILE\u003c/code\u003e \u003cspan class=\"application\"\u003epsql\u003c/span\u003e variable or\n     the \u003ccode class=\"envar\"\u003ePSQL_HISTORY\u003c/code\u003e environment variable.\n    \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.11\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\u003cspan class=\"application\"\u003epsql\u003c/span\u003e works best with servers of the same\n       or an older major version.  Backslash commands are particularly likely\n       to fail if the server is of a newer version than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e\n       itself.  However, backslash commands of the \u003ccode class=\"literal\"\u003e\\d\u003c/code\u003e family should\n       work with servers of versions back to 9.2, though not necessarily with\n       servers newer than \u003cspan class=\"application\"\u003epsql\u003c/span\u003e itself.  The general\n       functionality of running SQL commands and displaying query results\n       should also work with servers of a newer major version, but this cannot\n       be guaranteed in all cases.\n      \u003c/p\u003e\u003cp\u003e\n       If you want to use \u003cspan class=\"application\"\u003epsql\u003c/span\u003e to connect to several\n       servers of different major versions, it is recommended that you use the\n       newest version of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.  Alternatively, you\n       can keep around a copy of \u003cspan class=\"application\"\u003epsql\u003c/span\u003e from each\n       major version and be sure to use the version that matches the\n       respective server.  But in practice, this additional complication should\n       not be necessary.\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       Before \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.6,\n       the \u003ccode class=\"option\"\u003e-c\u003c/code\u003e option implied \u003ccode class=\"option\"\u003e-X\u003c/code\u003e\n       (\u003ccode class=\"option\"\u003e--no-psqlrc\u003c/code\u003e); this is no longer the case.\n      \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n       Before \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 8.4,\n       \u003cspan class=\"application\"\u003epsql\u003c/span\u003e allowed the\n       first argument of a single-letter backslash command to start\n       directly after the command, without intervening whitespace.\n       Now, some whitespace is required.\n      \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.21.12\"\u003e\u003ch2\u003eNotes for Windows Users\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epsql\u003c/span\u003e is built as a \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003econsole\n  application\u003c/span\u003e”\u003c/span\u003e.  Since the Windows console windows use a different\n  encoding than the rest of the system, you must take special care\n  when using 8-bit characters within \u003cspan class=\"application\"\u003epsql\u003c/span\u003e.\n  If \u003cspan class=\"application\"\u003epsql\u003c/span\u003e detects a problematic\n  console code page, it will warn you at startup. To change the\n  console code page, two things are necessary:\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      Set the code page by entering \u003cstrong class=\"userinput\"\u003e\u003ccode\u003ecmd.exe /c chcp\n      1252\u003c/code\u003e\u003c/strong\u003e. (1252 is a code page that is appropriate for\n      German; replace it with your value.) If you are using Cygwin,\n      you can put this command in \u003ccode class=\"filename\"\u003e/etc/profile\u003c/code\u003e.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      Set the console font to \u003ccode class=\"literal\"\u003eLucida Console\u003c/code\u003e, because the\n      raster font does not work with the ANSI code page.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n  The first example shows how to spread a command over several lines of\n  input. Notice the changing prompt:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eCREATE TABLE my_table (\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e first integer not null default 0,\u003c/code\u003e\u003c/strong\u003e\ntestdb(\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e second text)\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e;\u003c/code\u003e\u003c/strong\u003e\nCREATE TABLE\n\u003c/pre\u003e\u003cp\u003e\n  Now look at the table definition again:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\d my_table\u003c/code\u003e\u003c/strong\u003e\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n\u003c/pre\u003e\u003cp\u003e\n  Now we change the prompt to something more interesting:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\set PROMPT1 '%n@%m %~%R%# '\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb=\u0026gt;\n\u003c/pre\u003e\u003cp\u003e\n  Let's assume you have filled the table with data and want to take a\n  look at it:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n  You can display tables in different ways by using the\n  \u003ccode class=\"command\"\u003e\\pset\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 2\u003c/code\u003e\u003c/strong\u003e\nBorder style is 2.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 0\u003c/code\u003e\u003c/strong\u003e\nBorder style is 0.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset border 1\u003c/code\u003e\u003c/strong\u003e\nBorder style is 1.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format csv\u003c/code\u003e\u003c/strong\u003e\nOutput format is csv.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset tuples_only\u003c/code\u003e\u003c/strong\u003e\nTuples only is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset format unaligned\u003c/code\u003e\u003c/strong\u003e\nOutput format is unaligned.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\pset fieldsep '\\t'\u003c/code\u003e\u003c/strong\u003e\nField separator is \"    \".\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT second, first FROM my_table;\u003c/code\u003e\u003c/strong\u003e\none     1\ntwo     2\nthree   3\nfour    4\n\u003c/pre\u003e\u003cp\u003e\n  Alternatively, use the short commands:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\a \\t \\x\u003c/code\u003e\u003c/strong\u003e\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  Also, these output format options can be set for just one query by using\n  \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003epeter@localhost testdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT * FROM my_table\u003c/code\u003e\u003c/strong\u003e\npeter@localhost testdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\g (format=aligned tuples_only=off expanded=on)\u003c/code\u003e\u003c/strong\u003e\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here is an example of using the \u003ccode class=\"command\"\u003e\\df\u003c/code\u003e command to\n   find only functions with names matching \u003ccode class=\"literal\"\u003eint*pl\u003c/code\u003e\n   and whose second argument is of type \u003ccode class=\"type\"\u003ebigint\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df int*pl * bigint\u003c/code\u003e\u003c/strong\u003e\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Here, the \u003ccode class=\"literal\"\u003e+\u003c/code\u003e option is used to display additional\n   information about one of these functions, and \u003ccode class=\"literal\"\u003ex\u003c/code\u003e is used\n   to display the results in expanded mode:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\df+x int*pl integer bigint\u003c/code\u003e\u003c/strong\u003e\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n  When suitable, query results can be shown in a crosstab representation\n  with the \u003ccode class=\"command\"\u003e\\crosstabview\u003c/code\u003e command:\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT first, second, first \u0026gt; 2 AS gt2 FROM my_table;\u003c/code\u003e\u003c/strong\u003e\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview first second\u003c/code\u003e\u003c/strong\u003e\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n\u003c/pre\u003e\u003cp\u003e\n\nThis second example shows a multiplication table with rows sorted in reverse\nnumerical order and columns with an independent, ascending numerical order.\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003etestdb=\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eSELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003erow_number() over(order by t2.first) AS ord\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003eFROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC\u003c/code\u003e\u003c/strong\u003e\ntestdb-\u0026gt; \u003cstrong class=\"userinput\"\u003e\u003ccode\u003e\\crosstabview \"A\" \"B\" \"AxB\" ord\u003c/code\u003e\u003c/strong\u003e\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","related":[{"label":"psql meta-commands","url":"/wiki/psql/?v=18"},{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-a --echo-all","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL"},"summary":"Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."},{"signature":{"text":"-A --no-align","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN"},"summary":"Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."},{"signature":{"text":"-b --echo-errors","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS"},"summary":"Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."},{"signature":{"text":"-c command --command= command","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND"},"summary":"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence."},{"signature":{"text":"--csv","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-CSV"},"summary":"Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME"},"summary":"Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-e --echo-queries","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES"},"summary":"Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."},{"signature":{"text":"-E --echo-hidden","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN"},"summary":"Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FILE"},"summary":"Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i ."},{"signature":{"text":"-F separator --field-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR"},"summary":"Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."},{"signature":{"text":"-h hostname --host= hostname","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."},{"signature":{"text":"-H --html","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HTML"},"summary":"Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."},{"signature":{"text":"-l --list","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LIST"},"summary":"List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list ."},{"signature":{"text":"-L filename --log-file= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE"},"summary":"Write all query output into file filename , in addition to the normal output destination."},{"signature":{"text":"-n --no-readline","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE"},"summary":"Do not use Readline for line editing and do not use the command history (see the section called “Command-Line Editing” below)."},{"signature":{"text":"-o filename --output= filename","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT"},"summary":"Put all query output into file filename . This is equivalent to the command \\o ."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PORT"},"summary":"Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."},{"signature":{"text":"-P assignment --pset= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PSET"},"summary":"Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."},{"signature":{"text":"-q --quiet","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET"},"summary":"Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."},{"signature":{"text":"-R separator --record-separator= separator","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR"},"summary":"Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."},{"signature":{"text":"-s --single-step","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP"},"summary":"Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."},{"signature":{"text":"-S --single-line","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE"},"summary":"Runs in single-line mode where a newline terminates an SQL command, as a semicolon does."},{"signature":{"text":"-t --tuples-only","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY"},"summary":"Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."},{"signature":{"text":"-T table_options --table-attr= table_options","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR"},"summary":"Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME"},"summary":"Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"},{"signature":{"text":"-v assignment --set= assignment --variable= assignment","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE"},"summary":"Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."},{"signature":{"text":"-V --version","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION"},"summary":"Print the psql version and exit."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD"},"summary":"Force psql to prompt for a password before connecting to a database, even if the password will not be used."},{"signature":{"text":"-x --expanded","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED"},"summary":"Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."},{"signature":{"text":"-X --no-psqlrc","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC"},"summary":"Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."},{"signature":{"text":"-z --field-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO"},"summary":"Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."},{"signature":{"text":"-0 --record-separator-zero","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO"},"summary":"Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."},{"signature":{"text":"-1 --single-transaction","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION"},"summary":"This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied."},{"signature":{"text":"-? --help[= topic ]","url":"/docs/18/app-psql.html#APP-PSQL-OPTION-HELP"},"summary":"Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}],"title":"Documented options"},{"columns":[{"key":"name","label":"Variable"},{"key":"description","label":"Meaning"}],"key":"environment","rows":[{"description":"If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.","name":"COLUMNS"},{"description":"Default connection parameters (see Section 32.15 ).","name":"PGDATABASE PGHOST PGPORT PGUSER"},{"description":"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .","name":"PG_COLOR"},{"description":"Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.","name":"PSQL_EDITOR EDITOR VISUAL"},{"description":"When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.","name":"PSQL_EDITOR_LINENUMBER_ARG"},{"description":"Alternative location for the command history file. Tilde ( ~ ) expansion is performed.","name":"PSQL_HISTORY"},{"description":"If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.","name":"PSQL_PAGER PAGER"},{"description":"When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .","name":"PSQL_WATCH_PAGER"},{"description":"Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.","name":"PSQLRC"},{"description":"Command executed by the \\! command.","name":"SHELL"},{"description":"Directory for storing temporary files. The default is /tmp .","name":"TMPDIR"}],"title":"Environment variables"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
