diff --git a/doc/src/sgml/ref/ipcclean.sgml b/doc/src/sgml/ref/ipcclean.sgml index 514e2cc344..1ec6a4c346 100644 --- a/doc/src/sgml/ref/ipcclean.sgml +++ b/doc/src/sgml/ref/ipcclean.sgml @@ -1,5 +1,5 @@ @@ -12,7 +12,7 @@ PostgreSQL documentation ipcclean - remove shared memory and semaphores from an aborted PostgreSQL server + remove shared memory and semaphores from a failed PostgreSQL server @@ -59,10 +59,11 @@ PostgreSQL documentation - The script makes assumption about the format of output of the + The script makes assumptions about the output format of the ipcs utility which may not be true across different operating systems. - Therefore, it may not work on your particular OS. + Therefore, it may not work on your particular OS. It's wise to + look at the script before trying it. diff --git a/doc/src/sgml/ref/pg_config-ref.sgml b/doc/src/sgml/ref/pg_config-ref.sgml index d7ef8946a2..ea48699eb4 100644 --- a/doc/src/sgml/ref/pg_config-ref.sgml +++ b/doc/src/sgml/ref/pg_config-ref.sgml @@ -1,4 +1,4 @@ - + @@ -153,7 +153,7 @@ - In releases prior to PostgreSQL 7.1, before the + In releases prior to PostgreSQL 7.1, before pg_config came to be, a method for finding the equivalent configuration information did not exist. diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index a35fb49146..252b4fed29 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,5 +1,5 @@ @@ -45,21 +45,24 @@ PostgreSQL documentation - Dumps can be output in script or archive file formats. The script - files are in plain-text format and contain the SQL commands required + Dumps can be output in script or archive file formats. Script + dumps are plain-text files containing the SQL commands required to reconstruct the database to the state it was in at the time it was - saved. To restore these scripts, use . They + saved. To restore from such a script, feed it to . Script files can be used to reconstruct the database even on other machines and - other architectures, with some modifications even on other SQL + other architectures; with some modifications even on other SQL database products. - The alternative archive file formats that are meant to be used with - to rebuild the database, and they also + The alternative archive file formats must be used with + to rebuild the database. They allow pg_restore to be selective about what is restored, or even to reorder the items prior to being - restored. The archive files are also designed to be portable across + restored. The archive formats also allow saving and restoring + large objects, which is not possible in a script dump. + The archive files are also designed to be portable across architectures. @@ -76,7 +79,7 @@ PostgreSQL documentation by default. The tar format () is not compressed and it is not possible to reorder data when loading, but it is otherwise quite flexible; - moreover, it can be manipulated with other tools such as + moreover, it can be manipulated with standard Unix tools such as tar. @@ -92,17 +95,18 @@ PostgreSQL documentation Options - The following command-line options are used to control the output format. + The following command-line options control the content and + format of the output. dbname - Specifies the name of the database to be dumped. If this is - not specified, the environment variable - PGDATABASE is used. If that is not set, the - user name specified for the connection is used. + Specifies the name of the database to be dumped. If this is + not specified, the environment variable + PGDATABASE is used. If that is not set, the + user name specified for the connection is used. @@ -112,12 +116,12 @@ PostgreSQL documentation - Dump only the data, not the object definitions (schema) + Dump only the data, not the schema (data definitions). This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you + the archive formats, you may specify the option when you call pg_restore. @@ -128,7 +132,8 @@ PostgreSQL documentation - Include large objects in dump. + Include large objects in the dump. A non-text output format + must be selected. @@ -139,12 +144,12 @@ PostgreSQL documentation Output commands to clean (drop) - database objects prior to (the commands for) creating them. + database objects prior to (the commands for) creating them. This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you + the archive formats, you may specify the option when you call pg_restore. @@ -155,15 +160,15 @@ PostgreSQL documentation - Begin the output with a command to create the - database itself and reconnect to the created database. (With a - script of this form, it doesn't matter which database you connect - to before running the script.) + Begin the output with a command to create the + database itself and reconnect to the created database. (With a + script of this form, it doesn't matter which database you connect + to before running the script.) This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you + the archive formats, you may specify the option when you call pg_restore. @@ -174,12 +179,12 @@ PostgreSQL documentation - Dump data as INSERT commands (rather - than COPY). This will make restoration very slow; - it is mainly useful for making dumps that can be loaded into - non-PostgreSQL databases. Note that - the restore may fail altogether if you have rearranged column order. - The option is safer, though even slower. + Dump data as INSERT commands (rather + than COPY). This will make restoration very slow; + it is mainly useful for making dumps that can be loaded into + non-PostgreSQL databases. Note that + the restore may fail altogether if you have rearranged column order. + The option is safer, though even slower. @@ -190,13 +195,13 @@ PostgreSQL documentation - Dump data as INSERT commands with explicit - column names (INSERT INTO - table - (column, ...) VALUES - ...). This will make restoration very slow; it is mainly - useful for making dumps that can be loaded into - non-PostgreSQL databases. + Dump data as INSERT commands with explicit + column names (INSERT INTO + table + (column, ...) VALUES + ...). This will make restoration very slow; it is mainly + useful for making dumps that can be loaded into + non-PostgreSQL databases. @@ -206,8 +211,8 @@ PostgreSQL documentation - Send output to the specified file. If this is omitted, the - standard output is used. + Send output to the specified file. If this is omitted, the + standard output is used. @@ -218,7 +223,7 @@ PostgreSQL documentation Selects the format of the output. - format can be one of the following: + format can be one of the following: @@ -295,7 +300,7 @@ PostgreSQL documentation In this mode, pg_dump makes no attempt to dump any other database objects that objects in the - selected schema may depend upon. Therefore, there is no + selected schema may depend upon. Therefore, there is no guarantee that the results of a single-schema dump can be successfully restored by themselves into a clean database. @@ -308,10 +313,11 @@ PostgreSQL documentation - Dump object identifiers (OIDs) for every - table. Use this option if your application references the OID - columns in some way (e.g., in a foreign key constraint). - Otherwise, this option should not be used. + Dump object identifiers (OIDs) as part of the + data for every table. Use this option if your application references + the OID + columns in some way (e.g., in a foreign key constraint). + Otherwise, this option should not be used. @@ -322,20 +328,21 @@ PostgreSQL documentation Do not output commands to set - ownership of objects to match the original database. - By default, pg_dump issues - SET SESSION AUTHORIZATION - statements to set ownership of created database objects. - These statements - will fail when the script is run unless it is started by a superuser - (or the same user that owns all of the objects in the script). - To make a script that can be restored by any user, but will give - that user ownership of all the objects, specify This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you + the archive formats, you may specify the option when you call pg_restore. @@ -347,7 +354,7 @@ PostgreSQL documentation This option is obsolete but still accepted for backwards - compatibility. + compatibility. @@ -357,7 +364,7 @@ PostgreSQL documentation - Dump only the object definitions (schema), not data. + Dump only the object definitions (schema), not data. @@ -368,9 +375,9 @@ PostgreSQL documentation Specify the superuser user name to use when disabling triggers. - This is only relevant if @@ -380,18 +387,18 @@ PostgreSQL documentation - Dump data for table - only. It is possible for there to be - multiple tables with the same name in different schemas; if that - is the case, all matching tables will be dumped. Specify both - In this mode, pg_dump makes no attempt to dump any other database objects that the selected table - may depend upon. Therefore, there is no guarantee + may depend upon. Therefore, there is no guarantee that the results of a single-table dump can be successfully restored by themselves into a clean database. @@ -404,8 +411,8 @@ PostgreSQL documentation - Specifies verbose mode. This will cause - pg_dump to output detailed object + Specifies verbose mode. This will cause + pg_dump to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. @@ -418,7 +425,7 @@ PostgreSQL documentation - Prevent dumping of access privileges (grant/revoke commands). + Prevent dumping of access privileges (grant/revoke commands). @@ -456,7 +463,7 @@ PostgreSQL documentation This option is only meaningful for the plain-text format. For - the other formats, you may specify the option when you + the archive formats, you may specify the option when you call pg_restore. @@ -467,10 +474,10 @@ PostgreSQL documentation - Output SQL standard SET SESSION AUTHORIZATION commands instead - of OWNER TO commands. This makes the dump more standards compatible, - but depending on the history of the objects in the dump, may not - restore properly. + Output SQL standard SET SESSION AUTHORIZATION commands instead + of OWNER TO commands. This makes the dump more standards compatible, + but depending on the history of the objects in the dump, may not + restore properly. @@ -512,10 +519,10 @@ PostgreSQL documentation - Specifies the TCP port or local Unix domain socket file - extension on which the server is listening for connections. - Defaults to the PGPORT environment variable, if - set, or a compiled-in default. + Specifies the TCP port or local Unix domain socket file + extension on which the server is listening for connections. + Defaults to the PGPORT environment variable, if + set, or a compiled-in default. @@ -619,7 +626,7 @@ CREATE DATABASE foo WITH TEMPLATE template0; Members of tar archives are limited to a size less than 8 GB. (This is an inherent limitation of the tar file format.) Therefore - this format cannot be used if the textual representation of a table + this format cannot be used if the textual representation of any one table exceeds that size. The total size of a tar archive and any of the other output formats is not limited, except possibly by the operating system. diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 9a891cd1fb..64cc8a09fa 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -1,5 +1,5 @@ @@ -68,7 +68,8 @@ PostgreSQL documentation pg_dumpall needs to connect several - times to the PostgreSQL server and might be asking for + times to the PostgreSQL server (once per + database). If you use password authentication it is likely to ask for a password each time. It is convenient to have a $HOME/.pgpass file in such cases. @@ -79,7 +80,7 @@ PostgreSQL documentation Options - The following command-line options are used to control the content and + The following command-line options control the content and format of the output. @@ -88,7 +89,7 @@ PostgreSQL documentation - Dump only the data, not the schema (data definitions). + Dump only the data, not the schema (data definitions). @@ -98,8 +99,8 @@ PostgreSQL documentation - Include SQL commands to clean (drop) the databases before - recreating them. + Include SQL commands to clean (drop) the databases before + recreating them. @@ -109,10 +110,12 @@ PostgreSQL documentation - Dump data as INSERT commands (rather - than COPY). This will make restoration very - slow, but it makes the output more portable to other SQL database - management systems. + Dump data as INSERT commands (rather + than COPY). This will make restoration very slow; + it is mainly useful for making dumps that can be loaded into + non-PostgreSQL databases. Note that + the restore may fail altogether if you have rearranged column order. + The option is safer, though even slower. @@ -123,12 +126,13 @@ PostgreSQL documentation - Dump data as INSERT commands with explicit - column names (INSERT INTO - table - (column, ...) VALUES - ...). This will make restoration very slow, - but it is necessary if you desire to rearrange column ordering. + Dump data as INSERT commands with explicit + column names (INSERT INTO + table + (column, ...) VALUES + ...). This will make restoration very slow; it is mainly + useful for making dumps that can be loaded into + non-PostgreSQL databases. @@ -138,7 +142,7 @@ PostgreSQL documentation - Dump only global objects (users and groups), no databases. + Dump only global objects (users and groups), no databases. @@ -168,10 +172,11 @@ PostgreSQL documentation - Dump object identifiers (OIDs) for every - table. Use this option if your application references the OID - columns in some way (e.g., in a foreign key constraint). - Otherwise, this option should not be used. + Dump object identifiers (OIDs) as part of the + data for every table. Use this option if your application references + the OID + columns in some way (e.g., in a foreign key constraint). + Otherwise, this option should not be used. @@ -182,15 +187,16 @@ PostgreSQL documentation Do not output commands to set - ownership of objects to match the original database. - By default, pg_dumpall issues - SET SESSION AUTHORIZATION - statements to set ownership of created schema elements. - These statements - will fail when the script is run unless it is started by a superuser - (or the same user that owns all of the objects in the script). - To make a script that can be restored by any user, but will give - that user ownership of all the objects, specify @@ -200,7 +206,7 @@ PostgreSQL documentation - Dump only the schema (data definitions), no data. + Dump only the object definitions (schema), not data. @@ -211,9 +217,9 @@ PostgreSQL documentation Specify the superuser user name to use when disabling triggers. - This is only relevant if @@ -223,8 +229,8 @@ PostgreSQL documentation - Specifies verbose mode. This will cause - pg_dumpall to output start/stop + Specifies verbose mode. This will cause + pg_dumpall to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in pg_dump. @@ -237,7 +243,7 @@ PostgreSQL documentation - Prevent dumping of access privileges (grant/revoke commands). + Prevent dumping of access privileges (grant/revoke commands). @@ -280,10 +286,10 @@ PostgreSQL documentation - Output SQL standard SET SESSION AUTHORIZATION commands instead - of OWNER TO commands. This makes the dump more standards compatible, - but depending on the history of the objects in the dump, may not - restore properly. + Output SQL standard SET SESSION AUTHORIZATION commands instead + of OWNER TO commands. This makes the dump more standards compatible, + but depending on the history of the objects in the dump, may not + restore properly. @@ -299,11 +305,11 @@ PostgreSQL documentation -h host - Specifies the host name of the machine on which the database - server is running. If the value begins with a slash, it is - used as the directory for the Unix domain socket. The default - is taken from the PGHOST environment variable, - if set, else a Unix domain socket connection is attempted. + Specifies the host name of the machine on which the database + server is running. If the value begins with a slash, it is + used as the directory for the Unix domain socket. The default + is taken from the PGHOST environment variable, + if set, else a Unix domain socket connection is attempted. @@ -312,10 +318,10 @@ PostgreSQL documentation -p port - Specifies the TCP port or local Unix domain socket file - extension on which the server is listening for connections. - Defaults to the PGPORT environment variable, if - set, or a compiled-in default. + Specifies the TCP port or local Unix domain socket file + extension on which the server is listening for connections. + Defaults to the PGPORT environment variable, if + set, or a compiled-in default. diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 6ffad3b538..db731ca9ee 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1,4 +1,4 @@ - + @@ -88,7 +88,7 @@ - Restore only the data, not the schema (data definitions). + Restore only the data, not the schema (data definitions). @@ -98,7 +98,7 @@ - Clean (drop) database objects before recreating them. + Clean (drop) database objects before recreating them. @@ -158,10 +158,10 @@ - Specify format of the archive. It is not necessary to specify - the format, since pg_restore will - determine the format automatically. If specified, it can be - one of the following: + Specify format of the archive. It is not necessary to specify + the format, since pg_restore will + determine the format automatically. If specified, it can be + one of the following: @@ -198,7 +198,7 @@ - Ignore database version checks. + Ignore database version checks. @@ -208,7 +208,7 @@ - Restore definition of named index only. + Restore definition of named index only. @@ -245,15 +245,16 @@ Do not output commands to set - ownership of objects to match the original database. - By default, pg_restore issues - SET SESSION AUTHORIZATION - statements to set ownership of created schema elements. - These statements will fail unless the initial connection to the - database is made by a superuser - (or the same user that owns all of the objects in the script). - With , any user name can be used for the - initial connection, and this user will own all the created objects. + ownership of objects to match the original database. + By default, pg_restore issues + ALTER OWNER or + SET SESSION AUTHORIZATION + statements to set ownership of created schema elements. + These statements will fail unless the initial connection to the + database is made by a superuser + (or the same user that owns all of the objects in the script). + With , any user name can be used for the + initial connection, and this user will own all the created objects. @@ -264,8 +265,8 @@ Restore the named function only. Be careful to spell the function - name and arguments exactly as they appear in the dump file's table - of contents. + name and arguments exactly as they appear in the dump file's table + of contents. @@ -276,7 +277,7 @@ This option is obsolete but still accepted for backwards - compatibility. + compatibility. @@ -298,7 +299,7 @@ Specify the superuser user name to use when disabling triggers. - This is only relevant if @@ -328,7 +329,7 @@ - Specifies verbose mode. + Specifies verbose mode. @@ -339,7 +340,7 @@ - Prevent restoration of access privileges (grant/revoke commands). + Prevent restoration of access privileges (grant/revoke commands). @@ -349,10 +350,10 @@ - Output SQL standard SET SESSION AUTHORIZATION commands instead - of OWNER TO commands. This makes the dump more standards compatible, - but depending on the history of the objects in the dump, may not - restore properly. + Output SQL standard SET SESSION AUTHORIZATION commands instead + of OWNER TO commands. This makes the dump more standards compatible, + but depending on the history of the objects in the dump, may not + restore properly. @@ -363,19 +364,19 @@ This option is only relevant when performing a data-only restore. - It instructs pg_restore to execute commands - to temporarily disable triggers on the target tables while - the data is reloaded. Use this if you have referential - integrity checks or other triggers on the tables that you - do not want to invoke during data reload. + It instructs pg_restore to execute commands + to temporarily disable triggers on the target tables while + the data is reloaded. Use this if you have referential + integrity checks or other triggers on the tables that you + do not want to invoke during data reload. Presently, the commands emitted for - @@ -393,11 +394,11 @@ - 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. The default is taken - from the PGHOST environment variable, if set, - else a Unix domain socket connection is attempted. + 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. The default is taken + from the PGHOST environment variable, if set, + else a Unix domain socket connection is attempted. @@ -407,10 +408,10 @@ - Specifies the TCP port or local Unix domain socket file - extension on which the server is listening for connections. - Defaults to the PGPORT environment variable, if - set, or a compiled-in default. + Specifies the TCP port or local Unix domain socket file + extension on which the server is listening for connections. + Defaults to the PGPORT environment variable, if + set, or a compiled-in default. diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 53786ebf0a..30ebeebe3b 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -53,7 +53,7 @@ PostgreSQL documentation - Print all the lines to the screen as they are read. This is more + Print all input lines to standard output as they are read. This is more useful for script processing rather than interactive mode. This is equivalent to setting the variable ECHO to all. @@ -85,7 +85,7 @@ PostgreSQL documentation command must be either a command string that is completely parsable by the server (i.e., it contains no psql specific features), - or it is a single backslash command. Thus you cannot mix + or a single backslash command. Thus you cannot mix SQL and psql meta-commands. To achieve that, you could pipe the string into psql, like this: echo "\x \\ @@ -119,7 +119,8 @@ PostgreSQL documentation - Show all commands that are sent to the server. This is equivalent + Copy all SQL commands sent to the server to standard output as well. + This is equivalent to setting the variable ECHO to queries. @@ -132,8 +133,8 @@ PostgreSQL documentation Echo the actual queries generated by \d and other backslash - commands. You can use this if you wish to include similar - functionality into your own programs. This is equivalent to + commands. You can use this to study psql's + internal operations. This is equivalent to setting the variable ECHO_HIDDEN from within psql. @@ -214,7 +215,7 @@ PostgreSQL documentation - List all available databases, then exits. Other non-connection + List all available databases, then exit. Other non-connection options are ignored. This is similar to the internal command \list. @@ -326,8 +327,7 @@ PostgreSQL documentation Turn off printing of column names and result row count footers, - etc. It is completely equivalent to the \t - meta-command. + etc. This is equivalent to the \t command. @@ -396,7 +396,7 @@ PostgreSQL documentation - Show the psql version. + Print the psql version and exit. @@ -406,7 +406,7 @@ PostgreSQL documentation - Requests that psql should prompt for a + Cause psql to prompt for a password before connecting to a database. This will remain set for the entire session, even if you change the database connection with the meta-command \connect. @@ -418,7 +418,7 @@ PostgreSQL documentation requests password authentication. Because this is currently based on a hack, the automatic recognition might mysteriously fail, hence this option to force a prompt. If no password prompt is - issued and the server requires password authentication the + issued and the server requires password authentication, the connection attempt will fail. @@ -452,7 +452,7 @@ PostgreSQL documentation Show help about psql command line - arguments. + arguments, and exit. @@ -544,8 +544,8 @@ testdb=> Ordinarily, input lines are sent to the server when a command-terminating semicolon is reached. An end of line does not terminate a command. Thus commands can be spread over several lines for - clarity. If the command was sent and without error, the results of the command - are displayed on the screen. + clarity. If the command was sent and executed without error, the results + of the command are displayed on the screen. @@ -563,8 +563,8 @@ testdb=> Anything you enter in psql that begins with an unquoted backslash is a psql meta-command that is processed by psql - itself. These commands are what makes - psql interesting for administration or + itself. These commands help make + psql more useful for administration or scripting. Meta-commands are more commonly called slash or backslash commands. @@ -637,7 +637,7 @@ testdb=> If the current table output format is unaligned, it is switched to aligned. If it is not unaligned, it is set to unaligned. This command is kept for backwards compatibility. See \pset for a - general solution. + more general solution. @@ -831,6 +831,7 @@ testdb=> \db [ pattern ] + \db+ [ pattern ] @@ -991,6 +992,7 @@ testdb=> \dn [ pattern ] + \dn+ [ pattern ] @@ -1088,7 +1090,8 @@ testdb=> psql searches the environment variables PSQL_EDITOR, EDITOR, and VISUAL (in that order) for an editor to use. If - all of them are unset, /bin/vi is run. + all of them are unset, vi is used on Unix + systems, notepad.exe on Windows systems. @@ -1153,9 +1156,9 @@ Tue Oct 26 21:40:57 CEST 1999 Sends the current query input buffer to the server and - optionally saves the output in filename or pipes the output - into a separate Unix shell to execute command. A bare \g is virtually equivalent to a semicolon. A \g with argument is a one-shot @@ -1582,7 +1585,7 @@ lo_import 152801 This command is identical to \echo except - that all output will be written to the query output channel, as + that the output will be written to the query output channel, as set by \o. @@ -1921,7 +1924,7 @@ bar If set to all, all lines - entered or from a script are written to the standard output + entered from the keyboard or from a script are written to the standard output before they are parsed or executed. To select this behavior on program start-up, use the switch . If set to queries, @@ -2307,11 +2310,12 @@ testdb=> \set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\' disconnected from the database (which can happen if \connect fails). In prompt 2 the sequence is replaced by -, *, a single quote, - or a double quote, depending on whether + a double quote, or a dollar sign, depending on whether psql expects more input because the command wasn't terminated yet, because you are inside a /* ... */ comment, or because you are inside - a quote. In prompt 3 the sequence doesn't produce anything. + a quoted or dollar-escaped string. In prompt 3 the sequence doesn't + produce anything. @@ -2416,7 +2420,7 @@ testdb=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%#%] ' psql starts up. Tab-completion is also supported, although the completion logic makes no claim to be an SQL parser. If for some reason you do not like the tab completion, you - can turn if off by putting this in a file named + can turn it off by putting this in a file named .inputrc in your home directory: $if psql @@ -2625,8 +2629,8 @@ Field separator is "oo". testdb=> CREATE TABLE my_table ( testdb(> first integer not null default 0, -testdb(> second text -testdb-> ); +testdb(> second text) +testdb-> ; CREATE TABLE Now look at the table definition again: @@ -2657,7 +2661,7 @@ peter@localhost testdb=> SELECT * FROM my_table; (4 rows) - You can make this table look differently by using the + You can display tables in different ways by using the \pset command: peter@localhost testdb=> \pset border 2 diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 06dd5594a0..6755ae5bda 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -1,5 +1,5 @@ @@ -81,6 +81,16 @@ where from_item can be one of: + + + The actual output rows are computed using the + SELECT output expressions for each selected + row. (See + + below.) + + + Using the operators UNION, @@ -100,16 +110,6 @@ where from_item can be one of: - - - The actual output rows are computed using the - SELECT output expressions for each selected - row. (See - - below.) - - - If the ORDER BY clause is specified, the @@ -453,6 +453,34 @@ HAVING condition appears within an aggregate function. + + + <command>SELECT</command> List + + + The SELECT list (between the key words + SELECT and FROM) specifies expressions + that form the output rows of the SELECT + statement. The expressions can (and usually do) refer to columns + computed in the FROM clause. Using the clause + AS output_name, another + name can be specified for an output column. This name is + primarily used to label the column for display. It can also be + used to refer to the column's value in ORDER BY and + GROUP BY clauses, but not in the WHERE or + HAVING clauses; there you must write out the + expression instead. + + + + Instead of an expression, * can be written in + the output list as a shorthand for all the columns of the selected + rows. Also, one can write table_name.* as a + shorthand for the columns coming from just that table. + + <literal>UNION</literal> Clause @@ -486,7 +514,9 @@ HAVING condition The result of UNION does not contain any duplicate rows unless the ALL option is specified. - ALL prevents elimination of duplicates. + ALL prevents elimination of duplicates. (Therefore, + UNION ALL is usually significantly quicker than + UNION; use ALL when you can.) @@ -524,9 +554,9 @@ HAVING condition The result of INTERSECT does not contain any duplicate rows unless the ALL option is specified. - With ALL, a row that has m duplicates in the left - table and n duplicates in the right table will appear min(m,n) - times in the result set. + With ALL, a row that has m duplicates in the + left table and n duplicates in the right table will appear + min(m,n) times in the result set. @@ -538,6 +568,11 @@ HAVING condition C will be read as A UNION (B INTERSECT C). + + + Currently, FOR UPDATE may not be specified either for + an INTERSECT result or for any input of an INTERSECT. + @@ -562,9 +597,9 @@ HAVING condition The result of EXCEPT does not contain any duplicate rows unless the ALL option is specified. - With ALL, a row that has m duplicates in the left - table and n duplicates in the right table will appear max(m-n,0) - times in the result set. + With ALL, a row that has m duplicates in the + left table and n duplicates in the right table will appear + max(m-n,0) times in the result set. @@ -573,33 +608,10 @@ HAVING condition unless parentheses dictate otherwise. EXCEPT binds at the same level as UNION. - - - - <command>SELECT</command> List - + - The SELECT list (between the key words - SELECT and FROM) specifies expressions - that form the output rows of the SELECT - statement. The expressions can (and usually do) refer to columns - computed in the FROM clause. Using the clause - AS output_name, another - name can be specified for an output column. This name is - primarily used to label the column for display. It can also be - used to refer to the column's value in ORDER BY and - GROUP BY clauses, but not in the WHERE or - HAVING clauses; there you must write out the - expression instead. - - - - Instead of an expression, * can be written in - the output list as a shorthand for all the columns of the selected - rows. Also, one can write table_name.* as a - shorthand for the columns coming from just that table. + Currently, FOR UPDATE may not be specified either for + an EXCEPT result or for any input of an EXCEPT. @@ -707,7 +719,7 @@ OFFSET start When using LIMIT, it is a good idea to use an ORDER BY clause that constrains the result rows into a unique order. Otherwise you will get an unpredictable subset of - the query's rows---you may be asking for the tenth through + the query's rows — you may be asking for the tenth through twentieth rows, but tenth through twentieth in what ordering? You don't know what ordering unless you specify ORDER BY. diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index 1d5518d8a3..e0fdd47b91 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -1,5 +1,5 @@ @@ -95,12 +95,8 @@ SELECT [ ALL | DISTINCT [ ON ( expression Prior to PostgreSQL 8.0, the table created by - SELECT INTO always included OIDs. Furthermore, - these OIDs were newly generated: they were distinct from the OIDs - of any of the rows in the source tables of the SELECT - INTO statement. Therefore, if SELECT - INTO was frequently executed, the OID counter would be - rapidly incremented. As of PostgreSQL 8.0, the + SELECT INTO always included OIDs. + As of PostgreSQL 8.0, the inclusion of OIDs in the table created by SELECT INTO is controlled by the configuration variable. This diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index cbd78a9946..8fb07bc9e4 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -1,5 +1,5 @@ @@ -105,7 +105,7 @@ SHOW ALL True if the current session authorization identifier has - superuser privileges. + superuser privileges. @@ -118,7 +118,7 @@ SHOW ALL ALL - Show the values of all configurations parameters. + Show the values of all configuration parameters. @@ -164,17 +164,17 @@ SHOW geqo; Show all settings: SHOW ALL; - name | setting --------------------------------+--------------------------------------- - australian_timezones | off - authentication_timeout | 60 - checkpoint_segments | 3 + name | setting +--------------------------------+---------------------------------------------- + add_missing_from | on + archive_command | unset + australian_timezones | off . . . - wal_debug | off - wal_sync_method | fdatasync -(94 rows) + work_mem | 1024 + zero_damaged_pages | off +(140 rows) @@ -193,6 +193,7 @@ SHOW ALL; + diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 48d160b2ec..3fc3144dfe 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -1,5 +1,5 @@ @@ -150,6 +150,26 @@ UPDATE count + + Notes + + + When joining the target table to other tables using a fromlist, be careful that the join + produces at most one output row for each row to be modified. In + other words, a target row mustn't join to more than one row from + the other table(s). If it does, then only one of the join rows + will be used to update the target row, but which one will be used + is not readily predictable. + + + + Because of this indeterminancy, referencing other tables only within + sub-selects is safer, though often harder to read and slower than + using a join. + + + Examples