From 1ac838edba409abe87649c6820a9ee492cb1a1c5 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Mon, 14 Jun 1999 07:37:05 +0000 Subject: Minor updates for release. Split reference pages for CREATE TABLE AS and SELECT INTO to allow psgml (the emacs parser) to handle parsing. --- doc/src/sgml/ref/psql-ref.sgml | 843 +++++++++++++++++++++-------------------- 1 file changed, 426 insertions(+), 417 deletions(-) (limited to 'doc/src/sgml/ref/psql-ref.sgml') diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 454e4c0ec4..cb58dd0894 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,69 +1,73 @@ - - - + + + psql - - Application - - - + + Application + + + psql - - + + Postgres interactive client - + - - - 1998-09-26 - - + + + 1998-09-26 + + psql [ dbname ] psql -A [ -c query ] [ -d dbname ] - -e -E [ -f filename ] [ -F separator ] [ -h hostname ] -Hln - [ -o filename ] [ -p port ] -qsSt ] [ -T table_options ] -ux [ dbname ] - - - - - 1998-09-26 - - + -e -E [ -f <replaceable class="parameter">filename</replaceable> ] + [ -F <replaceable class="parameter">separator</replaceable> ] [ -h <replaceable class="parameter">hostname</replaceable> ] + -Hln [ -o <replaceable class="parameter">filename</replaceable> ] [ -p +<replaceable class="parameter">port</replaceable> ] + -qsSt [ -T <replaceable class="parameter">table_o</replaceable> ] -ux + [ <replaceable class="parameter">dbname</replaceable> ] + </synopsis> + + <refsect2 id="R2-APP-PSQL-1"> + <refsect2info> + <date>1998-09-26</date> + </refsect2info> + <title> Inputs - - + + psql accepts many command-line arguments, a rich set of meta-commands, and the full SQL language supported by Postgres. The most common command-line arguments are: - - - - dbname - - - + + + + dbname + + + The name of an existing database to access. dbname defaults to the value of the USER environment variable or, if that's not set, to the Unix account name of the current user. - - - + + + - - + + -c query - - - + + + A single query to run. psql will exit on completion. - - - + + + @@ -85,65 +89,65 @@ psql -A [ -c query ] [ -d - - + + + PGHOST - - - + + + The DNS host name of the database server. Setting PGHOST to a non-zero-length string causes TCP/IP communication to be used, rather than the default local Unix domain sockets. - - - + + + - - + + PGPORT - - - + + + The port number on which a Postgres server is listening. Defaults to 5432. - - - + + + - - + + PGTTY - - - + + + The target for display of messages from the client support library. Not required. - - - + + + - - + + PGOPTION - - - + + + If PGOPTION is specified, then the options it contains are parsed before any command-line options. - - - + + + - - + + PGREALM - - - + + + PGREALM only applies if Kerberos @@ -161,14 +165,14 @@ psql -A [ -c query ] [ -d - - - 1998-09-26 - - + <refsect2 id="R2-APP-PSQL-2"> + <refsect2info> + <date>1998-09-26</date> + </refsect2info> + <title> Outputs - - + + psql returns 0 to the shell on successful completion of all queries, 1 for errors, 2 for abrupt disconnection from the backend. @@ -180,14 +184,14 @@ psql -A [ -c query ] [ -d - - - 1998-09-26 - - + <refsect1 id="R1-APP-PSQL-1"> + <refsect1info> + <date>1998-09-26</date> + </refsect1info> + <title> Description - - + + psql is a character-based front-end to Postgres. It enables you to @@ -220,13 +224,13 @@ psql -A [ -c query ] [ -d - - - 1998-09-26 - - + <refsect2 id="R2-APP-PSQL-3"> + <refsect2info> + <date>1998-09-26</date> + </refsect2info> + <title> Connecting To A Database - + psql attempts to make a connection to the database at the hostname and @@ -242,13 +246,13 @@ psql -A [ -c query ] [ -d - - - 1998-09-26 - - + <refsect2 id="R2-APP-PSQL-4"> + <refsect2info> + <date>1998-09-26</date> + </refsect2info> + <title> Entering Queries - + In normal operation, psql provides a prompt with the name of the @@ -288,67 +292,67 @@ testdb=> - Paging To Screen + Paging To Screen - - Author - + + Author + From Brett McCormick on the mailing list 1998-04-04. - - + + - - To affect the paging behavior of your psql output, + + To affect the paging behavior of your psql output, set or unset your PAGER environment variable. I always have to set mine before it will pause. And of course you have to do this before starting the program. - + In csh/tcsh or other C shells: - + % unsetenv PAGER - + while in sh/bash or other Bourne shells: - + % unset PAGER - + - - - 1998-09-26 - - + <refsect1 id="R1-APP-PSQL-2"> + <refsect1info> + <date>1998-09-26</date> + </refsect1info> + <title> Command-line Options - + psql understands the following command-line options: - - - + + + -A - - - + + + Turn off fill justification when printing out table elements. - - + + -c query - - - + + + Specifies that psql is to execute one query string, @@ -359,12 +363,12 @@ testdb=> - - + + -d dbname - - - + + + Specifies the name of the database to connect to. This is equivalent to specifying dbname as the last field in the command line. @@ -372,34 +376,34 @@ testdb=> - - + + -e - - - + + + Echo the query sent to the backend - - + + -E - - - + + + Echo the actual query generated by \d and other backslash commands - - + + -f filename - - - + + + Use the file filename as the source of queries instead of reading queries interactively. This file must be specified for and visible to the client frontend. @@ -407,12 +411,12 @@ testdb=> - - + + -F separator - - - + + + Use separator as the field separator. The default is an ASCII vertical bar ("|"). @@ -420,12 +424,12 @@ testdb=> - - + + -h hostname - - - + + + Specifies the host name of the machine on which the postmaster is running. @@ -435,12 +439,12 @@ testdb=> - - + + -H - - - + + + Turns on HTML 3.0 tabular output. @@ -448,46 +452,46 @@ testdb=> - - + + -l - - - + + + Lists all available databases, then exit. Other non-connection options are ignored. - - + + -n - - - + + + Do not use the readline library for input line editing and command history. - - + + -o filename - - - + + + Put all output into file filename. The path must be writable by the client. - - + + -p port - - - + + + Specifies the TCP/IP port or, by omission, the local Unix domain socket file extension on which the postmaster @@ -498,12 +502,12 @@ testdb=> - - + + -q - - - + + + Specifies that psql should do its work quietly. By default, it @@ -515,36 +519,36 @@ testdb=> - - + + -s - - - + + + Run in single-step mode where the user is prompted for each query before it is sent to the backend. - - + + -S - - - + + + Runs in single-line mode where each query is terminated by a newline, instead of a semicolon. - - + + -t - - - + + + Turn off printing of column names. This is useful with the @@ -553,12 +557,12 @@ testdb=> - - + + -T table_options - - - + + + Allows you to specify options to be placed within the table ... tag for HTML 3.0 tabular output.For example, border @@ -568,12 +572,12 @@ testdb=> - - + + -u - - - + + + Asks the user for the user name and password before connecting to the database. If the database does not require password authentication then these are ignored. If the option is not used (and the PGPASSWORD environment variable @@ -583,12 +587,12 @@ testdb=> - - + + -x - - - + + + Turns on extended row format mode. When enabled each row will have its column names printed on the left with the column values printed on the right. This is useful for rows which are otherwise too long to fit into @@ -604,13 +608,13 @@ testdb=> - - - 1998-09-26 - - + <refsect1 id="R1-APP-PSQL-3"> + <refsect1info> + <date>1998-09-26</date> + </refsect1info> + <title> <application>psql</application> Meta-Commands - + Anything you enter in psql that begins with an unquoted backslash is a psql @@ -618,7 +622,7 @@ testdb=> and simply goes into the current query buffer (and once you have at least one complete query, it gets automatically submitted to the backend). - psql meta-commands are also called slash commands. + psql meta-commands are also called slash commands. The format of a psql command is the backslash, @@ -634,36 +638,37 @@ testdb=> The following meta-commands are defined: - - - + + + \a - - - + + + Toggle field alignment when printing out table elements. - - + + \C caption - - - + + + Set the HTML3.0 table caption to caption. - - - \connect dbname [ username ] - - - + + + \connect meter"ceable> [ username ] + + + Establish a connection to a new database, using the default username if none is specified. The previous connection is closed. @@ -671,17 +676,19 @@ testdb=> - - - \copy dbname { FROM | TO } filename - - - + + + \copy meter"ceable> { FROM | TO } + filename + + + Perform a frontend (client) copy. This is an operation that runs a SQL COPY command, but instead of the backend reading or writing the specified file, and consequently requiring backend access and special user privilege, psql reads or writes the - file and routes the data to or from the backend. The default tab + file and routes the data to or from the backend. The default + tab delimiter is used. @@ -695,13 +702,14 @@ testdb=> - - + + \d [ table ] - - - - List tables in the database, or if table + + + + List tables in the database, or if table is specified, list the columns in that table. If table name is specified as an asterisk (*), list all tables and column information for each tables. @@ -709,23 +717,23 @@ testdb=> - - + + \da - - - + + + List all available aggregates. - - + + \dd object - - - + + + List the description from pg_description of the specified object, which can be a table, table.column, type, operator, or aggregate. @@ -740,101 +748,101 @@ testdb=> - - + + \df - - - + + + List functions. - - + + \di - - - + + + List only indexes. - - + + \do - - - + + + List only operators. - - + + \ds - - - + + + List only sequences. - - + + \dS - - - + + + List system tables and indexes. - - + + \dt - - - + + + List only non-system tables. - - + + \dT - - - + + + List types. - - + + \e [ filename ] - - - + + + Edit the current query buffer or the contents of the file filename. - - + + \E [ filename ] - - - + + + Edit the current query buffer or the contents of the file filename and execute it upon editor exit. @@ -842,23 +850,23 @@ testdb=> - - + + \f [ separator ] - - - + + + Set the field separator. Default is a single blank space. - - + + \g [ { filename | |command } ] - - - + + + Send the current query input buffer to the backend and optionally save the output in filename or pipe the output into a separate Unix shell to execute @@ -867,12 +875,12 @@ testdb=> - - + + \h [ command ] - - - + + + Give syntax help on the specified SQL command. If command is not a defined SQL command (or is not documented in psql), or if @@ -886,47 +894,48 @@ testdb=> - - + + \H - - - - Toggle HTML3 output. This is equivalent to the + + + + Toggle HTML3 output. This is equivalent to + the command-line option. - - + + \i filename - - - + + + Read queries from the file filename into the query input buffer. - - + + \l - - - + + + List all the databases in the server. - - + + \m - - - + + + Toggle the old monitor-like table display, which includes border characters surrounding the table. This is standard SQL output. @@ -936,12 +945,12 @@ testdb=> - - + + \o [ { filename | |command } ] - - - + + + Save future query results to the file filename or pipe future results into a separate Unix shell to execute @@ -952,45 +961,45 @@ testdb=> - - + + \p - - - + + + Print the current query buffer. - - + + \q - - - + + + Quit the psql program. - - + + \r - - - + + + Reset(clear) the query buffer. - - + + \s [ filename ] - - - + + + Print or save the command line history to filename. If filename is omitted, @@ -1001,23 +1010,23 @@ testdb=> - - + + \t - - - + + + Toggle display of output column name headings and row count footer (defaults to on). - - + + \T table_options - - - + + + Allows you to specify options to be placed within the table ... tag for HTML 3.0 @@ -1028,12 +1037,12 @@ testdb=> - - + + \x - - - + + + Toggles extended row format mode. When enabled each row will have its column names printed on the left with the column values printed on the right. This is useful for rows which are otherwise too long to fit into @@ -1042,48 +1051,48 @@ testdb=> - - + + \w filename - - - + + + Outputs the current query buffer to the file filename. - - + + \z - - - + + + Produces a list of all tables in the database with their appropriate ACLs (grant/revoke permissions) listed. - - + + \! [ command ] - - - + + + Escape to a separate Unix shell or execute the Unix command command. - - + + \? - - - + + + Get help information about the slash (\) commands. -- cgit v1.2.1