diff options
author | Kevin Grittner | 2011-08-08 15:44:17 +0000 |
---|---|---|
committer | Kevin Grittner | 2011-08-08 15:44:17 +0000 |
commit | cfa9d7f040ae1a9d1fe8fbf32b6a003d251a59f0 (patch) | |
tree | 4fcc95a1c691e5b89df2d2f16f5fc5a8c6812909 | |
parent | 9e80b9141c9751624d788d8f6b3ffe169a8ebaf2 (diff) | |
parent | b69f2e36402aaa222ed03c1769b3de6d5be5f302 (diff) |
Merge branch 'master' into bug6123
153 files changed, 735 insertions, 532 deletions
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c index 56dab6192d..0d809c915b 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -1066,9 +1066,23 @@ top: else max = atoi(argv[3]); - if (max < min || max > MAX_RANDOM_VALUE) + if (max < min) { - fprintf(stderr, "%s: invalid maximum number %d\n", argv[0], max); + fprintf(stderr, "%s: maximum is less than minimum\n", argv[0]); + st->ecnt++; + return true; + } + + /* + * getrand() neeeds to be able to subtract max from min and add + * one the result without overflowing. Since we know max > min, + * we can detect overflow just by checking for a negative result. + * But we must check both that the subtraction doesn't overflow, + * and that adding one to the result doesn't overflow either. + */ + if (max - min < 0 || (max - min) + 1 < 0) + { + fprintf(stderr, "%s: range too large\n", argv[0]); st->ecnt++; return true; } diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index f6e2a28cf3..6818d4ac43 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -48,6 +48,7 @@ struct _param char *pg_host; int verbose; int dry_run; + long transaction_limit; }; int vacuumlo(char *, struct _param *); @@ -65,11 +66,12 @@ vacuumlo(char *database, struct _param * param) PGresult *res, *res2; char buf[BUFSIZE]; - int matched; - int deleted; + long matched; + long deleted; int i; static char *password = NULL; bool new_pass; + bool success = true; if (param->pg_prompt == TRI_YES && password == NULL) password = simple_prompt("Password: ", 100, false); @@ -280,12 +282,19 @@ vacuumlo(char *database, struct _param * param) { fprintf(stderr, "\nFailed to remove lo %u: ", lo); fprintf(stderr, "%s", PQerrorMessage(conn)); + if (PQtransactionStatus(conn) == PQTRANS_INERROR) + { + success = false; + break; + } } else deleted++; } else deleted++; + if (param->transaction_limit != 0 && deleted >= param->transaction_limit) + break; } PQclear(res); @@ -298,10 +307,20 @@ vacuumlo(char *database, struct _param * param) PQfinish(conn); if (param->verbose) - fprintf(stdout, "\r%s %d large objects from %s.\n", - (param->dry_run ? "Would remove" : "Removed"), deleted, database); + { + if (param->dry_run) + fprintf(stdout, "\rWould remove %ld large objects from %s.\n", + deleted, database); + else if (success) + fprintf(stdout, + "\rSuccessfully removed %ld large objects from %s.\n", + deleted, database); + else + fprintf(stdout, "\rRemoval from %s failed at object %ld of %ld.\n", + database, deleted, matched); + } - return 0; + return ((param->dry_run || success) ? 0 : -1); } void @@ -311,6 +330,7 @@ usage(const char *progname) printf("Usage:\n %s [OPTION]... DBNAME...\n\n", progname); printf("Options:\n"); printf(" -h HOSTNAME database server host or socket directory\n"); + printf(" -l LIMIT stop after removing LIMIT large objects\n"); printf(" -n don't remove large objects, just show what would be done\n"); printf(" -p PORT database server port\n"); printf(" -U USERNAME user name to connect as\n"); @@ -342,6 +362,7 @@ main(int argc, char **argv) param.pg_port = NULL; param.verbose = 0; param.dry_run = 0; + param.transaction_limit = 0; if (argc > 1) { @@ -359,7 +380,7 @@ main(int argc, char **argv) while (1) { - c = getopt(argc, argv, "h:U:p:vnwW"); + c = getopt(argc, argv, "h:l:U:p:vnwW"); if (c == -1) break; @@ -395,6 +416,16 @@ main(int argc, char **argv) } param.pg_port = strdup(optarg); break; + case 'l': + param.transaction_limit = strtol(optarg, NULL, 10); + if (param.transaction_limit < 0) + { + fprintf(stderr, + "%s: transaction limit must not be negative (0 disables)\n", + progname); + exit(1); + } + break; case 'h': param.pg_host = strdup(optarg); break; diff --git a/doc/src/sgml/auth-delay.sgml b/doc/src/sgml/auth-delay.sgml index b91a7ecda7..e377c980ca 100644 --- a/doc/src/sgml/auth-delay.sgml +++ b/doc/src/sgml/auth-delay.sgml @@ -17,7 +17,7 @@ </para> <para> - In order to function, this module must be loaded via + In order to function, this module must be loaded via <xref linkend="guc-shared-preload-libraries"> in <filename>postgresql.conf</>. </para> diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 5e5f8a7554..6d5dad369d 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1157,6 +1157,15 @@ </entry> </row> + <row> + <entry><structfield>attfdwoptions</structfield></entry> + <entry><type>text[]</type></entry> + <entry></entry> + <entry> + Attribute-level foreign data wrapper options, as <quote>keyword=value</> strings + </entry> + </row> + </tbody> </tgroup> </table> diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 33db25f2a6..ee8ab32878 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -5261,7 +5261,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </para> <para> - Unlike <varname>local_preload_libraries</>, there is no + Unlike <xref linkend="guc-shared-preload-libraries">, there is no performance advantage to loading a library at session start rather than when it is first used. Rather, the intent of this feature is to allow debugging or performance-measurement diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 0b4f978d98..89b531fa1d 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -790,7 +790,7 @@ NUMERIC </indexterm> <para> - The data types <type>smallserial</type>, <type>serial</type> and + The data types <type>smallserial</type>, <type>serial</type> and <type>bigserial</type> are not true types, but merely a notational convenience for creating unique identifier columns (similar to the <literal>AUTO_INCREMENT</literal> property @@ -3898,7 +3898,7 @@ SELECT to_tsvector( 'postgraduate' ) @@ to_tsquery( 'postgres:*' ); t (1 row) </programlisting> - because <literal>postgres</> gets stemmed to <literal>postgr</>: + because <literal>postgres</> gets stemmed to <literal>postgr</>: <programlisting> SELECT to_tsquery('postgres:*'); to_tsquery diff --git a/doc/src/sgml/dblink.sgml b/doc/src/sgml/dblink.sgml index 22551402e3..855495c54d 100644 --- a/doc/src/sgml/dblink.sgml +++ b/doc/src/sgml/dblink.sgml @@ -76,8 +76,7 @@ dblink_connect(text connname, text connstr) returns text <varlistentry> <term><parameter>connstr</parameter></term> <listitem> - <para> - <application>libpq</>-style connection info string, for example + <para><application>libpq</>-style connection info string, for example <literal>hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres password=mypasswd</>. For details see <function>PQconnectdb</> in @@ -114,7 +113,7 @@ dblink_connect(text connname, text connstr) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_connect('dbname=postgres'); @@ -285,7 +284,7 @@ dblink_disconnect(text connname) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_disconnect(); @@ -447,12 +446,11 @@ CREATE VIEW myremote_pg_proc AS AS t1(proname name, prosrc text); SELECT * FROM myremote_pg_proc WHERE proname LIKE 'bytea%'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT * FROM dblink('dbname=postgres', 'select proname, prosrc from pg_proc') @@ -620,7 +618,7 @@ dblink_exec(text sql [, bool fail_on_error]) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_connect('dbname=dblink_test_standby'); @@ -761,7 +759,7 @@ dblink_open(text connname, text cursorname, text sql [, bool fail_on_error]) ret </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_connect('dbname=postgres'); @@ -878,7 +876,7 @@ dblink_fetch(text connname, text cursorname, int howmany [, bool fail_on_error]) </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_connect('dbname=postgres'); @@ -1011,7 +1009,7 @@ dblink_close(text connname, text cursorname [, bool fail_on_error]) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_connect('dbname=postgres'); @@ -1068,7 +1066,7 @@ dblink_get_connections() returns text[] </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <programlisting> SELECT dblink_get_connections(); @@ -1127,7 +1125,7 @@ dblink_error_message(text connname) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <programlisting> SELECT dblink_error_message('dtest1'); @@ -1205,7 +1203,7 @@ dblink_send_query(text connname, text sql) returns int </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <programlisting> SELECT dblink_send_query('dtest1', 'SELECT * FROM foo WHERE f1 < 3'); @@ -1264,7 +1262,7 @@ dblink_is_busy(text connname) returns int </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <programlisting> SELECT dblink_is_busy('dtest1'); @@ -1324,7 +1322,7 @@ dblink_get_notify(text connname) returns setof (notify_name text, be_pid int, ex </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_exec('LISTEN virtual'); @@ -1437,7 +1435,7 @@ dblink_get_result(text connname [, bool fail_on_error]) returns setof record </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> contrib_regression=# SELECT dblink_connect('dtest1', 'dbname=contrib_regression'); @@ -1554,7 +1552,7 @@ dblink_cancel_query(text connname) returns text </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <programlisting> SELECT dblink_cancel_query('dtest1'); @@ -1628,7 +1626,7 @@ CREATE TYPE dblink_pkey_results AS (position int, colname text); </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> CREATE TABLE foobar ( @@ -1769,7 +1767,7 @@ dblink_build_sql_insert(text relname, </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_build_sql_insert('foo', '1 2', 2, '{"1", "a"}', '{"1", "b''a"}'); @@ -1883,7 +1881,7 @@ dblink_build_sql_delete(text relname, </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_build_sql_delete('"MyFoo"', '1 2', 2, '{"1", "b"}'); @@ -2016,7 +2014,7 @@ dblink_build_sql_update(text relname, </refsect1> <refsect1> - <title>Example</title> + <title>Examples</title> <screen> SELECT dblink_build_sql_update('foo', '1 2', 2, '{"1", "a"}', '{"1", "b"}'); diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 674bfb8010..c1680301d3 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -872,7 +872,7 @@ primary_conninfo = 'host=192.168.1.50 port=5432 user=foo password=foopass' <literal>pg_stat_replication</></link> view. Large differences between <function>pg_current_xlog_location</> and <literal>sent_location</> field might indicate that the master server is under heavy load, while - differences between <literal>sent_location</> and + differences between <literal>sent_location</> and <function>pg_last_xlog_receive_location</> on the standby might indicate network delay, or that the standby is under heavy load. </para> diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index ed4f1572a0..0f0cbfaa83 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1018,6 +1018,69 @@ </table> </sect1> + <sect1 id="infoschema-column-options"> + <title><literal>column_options</literal></title> + + <para> + The view <literal>column_options</literal> contains all the + options defined for foreign table columns in the current database. Only + those foreign table columns are shown that the current user has access to + (by way of being the owner or having some privilege). + </para> + + <table> + <title><literal>column_options</literal> Columns</title> + + <tgroup cols="3"> + <thead> + <row> + <entry>Name</entry> + <entry>Data Type</entry> + <entry>Description</entry> + </row> + </thead> + + <tbody> + <row> + <entry><literal>table_catalog</literal></entry> + <entry><type>sql_identifier</type></entry> + <entry>Name of the database that contains the foreign table (always the current database)</entry> + </row> + + <row> + <entry><literal>table_schema</literal></entry> + <entry><type>sql_identifier</type></entry> + <entry>Name of the schema that contains the foreign table</entry> + </row> + + <row> + <entry><literal>table_name</literal></entry> + <entry><type>sql_identifier</type></entry> + <entry>Name of the foreign table</entry> + </row> + + <row> + <entry><literal>column_name</literal></entry> + <entry><type>sql_identifier</type></entry> + <entry>Name of the column</entry> + </row> + + <row> + <entry><literal>option_name</literal></entry> + <entry><type>sql_identifier</type></entry> + <entry>Name of an option</entry> + </row> + + <row> + <entry><literal>option_value</literal></entry> + <entry><type>character_data</type></entry> + <entry>Value of the option</entry> + </row> + </tbody> + </tgroup> + </table> + </sect1> + <sect1 id="infoschema-column-privileges"> <title><literal>column_privileges</literal></title> diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml index 439f5ad82b..bc2ed012f4 100644 --- a/doc/src/sgml/install-windows.sgml +++ b/doc/src/sgml/install-windows.sgml @@ -49,8 +49,8 @@ <xref linkend="installation-notes-mingw"> and <xref linkend="installation-notes-cygwin">. To produce native 64 bit binaries in these environments, use the tools from <productname>MinGW-w64</productname>. These tools can also be used to - cross-compile for 32 bit and 64 bit <productname>Windows</productname> - targets on other hosts, such as <productname>Linux</productname> and + cross-compile for 32 bit and 64 bit <productname>Windows</productname> + targets on other hosts, such as <productname>Linux</productname> and <productname>Darwin</productname>. <productname>Cygwin</productname> is not recommended for running a production server, and it should only be used for running on @@ -61,7 +61,7 @@ </para> <para> - Native builds of <application>psql</application> don't support command + Native builds of <application>psql</application> don't support command line editing. The <productname>Cygwin</productname> build does support command line editing, so it should be used where psql is needed for interactive use on <productname>Windows</productname>. diff --git a/doc/src/sgml/pgupgrade.sgml b/doc/src/sgml/pgupgrade.sgml index 102ca526bb..2d8bbce6b4 100644 --- a/doc/src/sgml/pgupgrade.sgml +++ b/doc/src/sgml/pgupgrade.sgml @@ -294,7 +294,7 @@ NET STOP pgsql-8.3 (<productname>PostgreSQL</> 8.3 and older used a different s <application>pg_upgrade</> requires the specification of the old and new cluster's data and executable (<filename>bin</>) directories. You can also specify user and port values, and whether you want the data linked instead of - copied (the default). + copied (the default). </para> <para> diff --git a/doc/src/sgml/ref/abort.sgml b/doc/src/sgml/ref/abort.sgml index 2bfc724be5..246e8f8126 100644 --- a/doc/src/sgml/ref/abort.sgml +++ b/doc/src/sgml/ref/abort.sgml @@ -75,8 +75,7 @@ ABORT [ WORK | TRANSACTION ] To abort all changes: <programlisting> ABORT; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_aggregate.sgml b/doc/src/sgml/ref/alter_aggregate.sgml index 618c432a79..26c5dc0175 100644 --- a/doc/src/sgml/ref/alter_aggregate.sgml +++ b/doc/src/sgml/ref/alter_aggregate.sgml @@ -125,8 +125,7 @@ ALTER AGGREGATE myavg(integer) OWNER TO joe; <type>integer</type> into schema <literal>myschema</literal>: <programlisting> ALTER AGGREGATE myavg(integer) SET SCHEMA myschema; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_collation.sgml b/doc/src/sgml/ref/alter_collation.sgml index 3aef656a0e..ebb30b8860 100644 --- a/doc/src/sgml/ref/alter_collation.sgml +++ b/doc/src/sgml/ref/alter_collation.sgml @@ -104,8 +104,7 @@ ALTER COLLATION "de_DE" RENAME TO german; <literal>joe</literal>: <programlisting> ALTER COLLATION "en_US" OWNER TO joe; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_conversion.sgml b/doc/src/sgml/ref/alter_conversion.sgml index 4f2269b849..4cc335b18e 100644 --- a/doc/src/sgml/ref/alter_conversion.sgml +++ b/doc/src/sgml/ref/alter_conversion.sgml @@ -104,8 +104,7 @@ ALTER CONVERSION iso_8859_1_to_utf8 RENAME TO latin1_to_unicode; <literal>joe</literal>: <programlisting> ALTER CONVERSION iso_8859_1_to_utf8 OWNER TO joe; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_database.sgml b/doc/src/sgml/ref/alter_database.sgml index 5a975adf5c..360732fd35 100644 --- a/doc/src/sgml/ref/alter_database.sgml +++ b/doc/src/sgml/ref/alter_database.sgml @@ -190,8 +190,7 @@ ALTER DATABASE <replaceable class="PARAMETER">name</replaceable> RESET ALL <programlisting> ALTER DATABASE test SET enable_indexscan TO off; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_default_privileges.sgml b/doc/src/sgml/ref/alter_default_privileges.sgml index cc4f3636a2..f7b52ef9d1 100644 --- a/doc/src/sgml/ref/alter_default_privileges.sgml +++ b/doc/src/sgml/ref/alter_default_privileges.sgml @@ -187,8 +187,7 @@ ALTER DEFAULT PRIVILEGES IN SCHEMA myschema REVOKE INSERT ON TABLES FROM webuser <programlisting> ALTER DEFAULT PRIVILEGES FOR ROLE admin REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_domain.sgml b/doc/src/sgml/ref/alter_domain.sgml index cf504c3bcc..4f60fe334c 100644 --- a/doc/src/sgml/ref/alter_domain.sgml +++ b/doc/src/sgml/ref/alter_domain.sgml @@ -270,8 +270,7 @@ ALTER DOMAIN zipcode DROP CONSTRAINT zipchk; To move the domain into a different schema: <programlisting> ALTER DOMAIN zipcode SET SCHEMA customers; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-ALTERDOMAIN-compatibility"> diff --git a/doc/src/sgml/ref/alter_extension.sgml b/doc/src/sgml/ref/alter_extension.sgml index 67e2c3be49..cbe5043fef 100644 --- a/doc/src/sgml/ref/alter_extension.sgml +++ b/doc/src/sgml/ref/alter_extension.sgml @@ -288,7 +288,15 @@ ALTER EXTENSION hstore SET SCHEMA utils; To add an existing function to the <literal>hstore</literal> extension: <programlisting> ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore); -</programlisting> +</programlisting></para> + </refsect1> + + <refsect1> + <title>Compatibility</title> + + <para> + <command>ALTER EXTENSION</command> is a <productname>PostgreSQL</> + extension. </para> </refsect1> diff --git a/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml b/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml index af56ed7561..59cf9c65e7 100644 --- a/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml +++ b/doc/src/sgml/ref/alter_foreign_data_wrapper.sgml @@ -141,8 +141,7 @@ ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar'); to <literal>bob.myvalidator</>: <programlisting> ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_foreign_table.sgml b/doc/src/sgml/ref/alter_foreign_table.sgml index a45df020ea..5c7a86fe87 100644 --- a/doc/src/sgml/ref/alter_foreign_table.sgml +++ b/doc/src/sgml/ref/alter_foreign_table.sgml @@ -36,6 +36,7 @@ ALTER FOREIGN TABLE <replaceable class="PARAMETER">name</replaceable> DROP [ COLUMN ] [ IF EXISTS ] <replaceable class="PARAMETER">column</replaceable> [ RESTRICT | CASCADE ] ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> [ SET DATA ] TYPE <replaceable class="PARAMETER">type</replaceable> ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET | DROP } NOT NULL + ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ]) OWNER TO <replaceable class="PARAMETER">new_owner</replaceable> OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ]) </synopsis> @@ -125,12 +126,13 @@ ALTER FOREIGN TABLE <replaceable class="PARAMETER">name</replaceable> <term><literal>OPTIONS ( [ ADD | SET | DROP ] <replaceable class="PARAMETER">option</replaceable> ['<replaceable class="PARAMETER">value</replaceable>'] [, ... ] )</literal></term> <listitem> <para> - Change options for the foreign table. + Change options for the foreign table or one of its columns. <literal>ADD</>, <literal>SET</>, and <literal>DROP</> specify the action to be performed. <literal>ADD</> is assumed - if no operation is explicitly specified. Option names must be - unique; names and values are also validated using the foreign - data wrapper library. + if no operation is explicitly specified. Duplicate option names are not + allowed (although it's OK for a table option and a column option to have + the same name). Option names and values are also validated using the + foreign data wrapper library. </para> </listitem> </varlistentry> @@ -286,8 +288,7 @@ ALTER FOREIGN TABLE distributors ALTER COLUMN street SET NOT NULL; To change options of a foreign table: <programlisting> ALTER FOREIGN TABLE myschema.distributors OPTIONS (ADD opt1 'value', SET opt2, 'value2', DROP opt3 'value3'); -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/alter_function.sgml b/doc/src/sgml/ref/alter_function.sgml index 22233af4aa..acb3e4fb93 100644 --- a/doc/src/sgml/ref/alter_function.sgml +++ b/doc/src/sgml/ref/alter_function.sgml @@ -153,8 +153,7 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ [ <replaceable class="paramet <term><literal>STRICT</literal></term> <listitem> - <para> - <literal>CALLED ON NULL INPUT</literal> changes the function so + <para><literal>CALLED ON NULL INPUT</literal> changes the function so that it will be invoked when some or all of its arguments are null. <literal>RETURNS NULL ON NULL INPUT</literal> or <literal>STRICT</literal> changes the function so that it is not diff --git a/doc/src/sgml/ref/alter_group.sgml b/doc/src/sgml/ref/alter_group.sgml index 63d42e1e16..177b11d28d 100644 --- a/doc/src/sgml/ref/alter_group.sgml +++ b/doc/src/sgml/ref/alter_group.sgml @@ -103,9 +103,7 @@ ALTER GROUP staff ADD USER karl, john; <programlisting> ALTER GROUP workers DROP USER beth; -</programlisting> - - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_index.sgml b/doc/src/sgml/ref/alter_index.sgml index 69b8e5d3f8..c701d165b8 100644 --- a/doc/src/sgml/ref/alter_index.sgml +++ b/doc/src/sgml/ref/alter_index.sgml @@ -190,8 +190,7 @@ ALTER INDEX distributors SET TABLESPACE fasttablespace; <programlisting> ALTER INDEX distributors SET (fillfactor = 75); REINDEX INDEX distributors; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/alter_operator.sgml b/doc/src/sgml/ref/alter_operator.sgml index a52f9f9cb4..32bde5af7c 100644 --- a/doc/src/sgml/ref/alter_operator.sgml +++ b/doc/src/sgml/ref/alter_operator.sgml @@ -105,8 +105,7 @@ ALTER OPERATOR <replaceable>name</replaceable> ( { <replaceable>left_type</repla Change the owner of a custom operator <literal>a @@ b</literal> for type <type>text</type>: <programlisting> ALTER OPERATOR @@ (text, text) OWNER TO joe; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_role.sgml b/doc/src/sgml/ref/alter_role.sgml index adc0273b83..2fbba53d25 100644 --- a/doc/src/sgml/ref/alter_role.sgml +++ b/doc/src/sgml/ref/alter_role.sgml @@ -289,8 +289,7 @@ ALTER ROLE worker_bee SET maintenance_work_mem = 100000; <programlisting> ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_sequence.sgml b/doc/src/sgml/ref/alter_sequence.sgml index 37644d83b1..79795d9db0 100644 --- a/doc/src/sgml/ref/alter_sequence.sgml +++ b/doc/src/sgml/ref/alter_sequence.sgml @@ -282,8 +282,7 @@ ALTER SEQUENCE <replaceable class="parameter">name</replaceable> SET SCHEMA <rep Restart a sequence called <literal>serial</literal>, at 105: <programlisting> ALTER SEQUENCE serial RESTART WITH 105; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_server.sgml b/doc/src/sgml/ref/alter_server.sgml index ab4731a434..c27b4c06a1 100644 --- a/doc/src/sgml/ref/alter_server.sgml +++ b/doc/src/sgml/ref/alter_server.sgml @@ -100,8 +100,7 @@ ALTER SERVER foo OPTIONS (host 'foo', dbname 'foodb'); change <literal>host</> option: <programlisting> ALTER SERVER foo VERSION '8.4' OPTIONS (SET host 'baz'); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 4c2a4cd22e..0b1e0440d1 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -1041,8 +1041,7 @@ ALTER TABLE myschema.distributors SET SCHEMA yourschema; CREATE UNIQUE INDEX CONCURRENTLY dist_id_temp_idx ON distributors (dist_id); ALTER TABLE distributors DROP CONSTRAINT distributors_pkey, ADD CONSTRAINT distributors_pkey PRIMARY KEY USING INDEX dist_id_temp_idx; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/alter_tablespace.sgml b/doc/src/sgml/ref/alter_tablespace.sgml index 0cfc26437d..ed04d8437f 100644 --- a/doc/src/sgml/ref/alter_tablespace.sgml +++ b/doc/src/sgml/ref/alter_tablespace.sgml @@ -111,8 +111,7 @@ ALTER TABLESPACE index_space RENAME TO fast_raid; Change the owner of tablespace <literal>index_space</literal>: <programlisting> ALTER TABLESPACE index_space OWNER TO mary; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_trigger.sgml b/doc/src/sgml/ref/alter_trigger.sgml index 2f943ee9c2..90c2e3d141 100644 --- a/doc/src/sgml/ref/alter_trigger.sgml +++ b/doc/src/sgml/ref/alter_trigger.sgml @@ -92,8 +92,7 @@ ALTER TRIGGER <replaceable class="PARAMETER">name</replaceable> ON <replaceable To rename an existing trigger: <programlisting> ALTER TRIGGER emp_stamp ON emp RENAME TO emp_track_chgs; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_type.sgml b/doc/src/sgml/ref/alter_type.sgml index a417c0d01b..a81fe6c340 100644 --- a/doc/src/sgml/ref/alter_type.sgml +++ b/doc/src/sgml/ref/alter_type.sgml @@ -313,8 +313,7 @@ ALTER TYPE compfoo ADD ATTRIBUTE f3 int; To add a new value to an enum type in a particular sort position: <programlisting> ALTER TYPE colors ADD VALUE 'orange' AFTER 'red'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/alter_user_mapping.sgml b/doc/src/sgml/ref/alter_user_mapping.sgml index d18fe36199..3245f83e08 100644 --- a/doc/src/sgml/ref/alter_user_mapping.sgml +++ b/doc/src/sgml/ref/alter_user_mapping.sgml @@ -92,8 +92,7 @@ ALTER USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> Change the password for user mapping <literal>bob</>, server<literal> foo</>: <programlisting> ALTER USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'public'); -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/alter_view.sgml b/doc/src/sgml/ref/alter_view.sgml index 0d509319a3..c3839057c0 100644 --- a/doc/src/sgml/ref/alter_view.sgml +++ b/doc/src/sgml/ref/alter_view.sgml @@ -123,8 +123,7 @@ ALTER VIEW <replaceable class="parameter">name</replaceable> SET SCHEMA <replace <literal>bar</literal>: <programlisting> ALTER VIEW foo RENAME TO bar; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/begin.sgml b/doc/src/sgml/ref/begin.sgml index 4c6a2b4a2c..acd823206a 100644 --- a/doc/src/sgml/ref/begin.sgml +++ b/doc/src/sgml/ref/begin.sgml @@ -122,8 +122,7 @@ BEGIN [ WORK | TRANSACTION ] [ <replaceable class="parameter">transaction_mode</ <programlisting> BEGIN; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/close.sgml b/doc/src/sgml/ref/close.sgml index 25e3c817eb..4af6af7492 100644 --- a/doc/src/sgml/ref/close.sgml +++ b/doc/src/sgml/ref/close.sgml @@ -107,8 +107,7 @@ CLOSE { <replaceable class="PARAMETER">name</replaceable> | ALL } Close the cursor <literal>liahona</literal>: <programlisting> CLOSE liahona; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/cluster.sgml b/doc/src/sgml/ref/cluster.sgml index addf652065..339990fa4d 100644 --- a/doc/src/sgml/ref/cluster.sgml +++ b/doc/src/sgml/ref/cluster.sgml @@ -197,8 +197,7 @@ CLUSTER employees; Cluster all tables in the database that have previously been clustered: <programlisting> CLUSTER; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/clusterdb.sgml b/doc/src/sgml/ref/clusterdb.sgml index 081f398706..c80cbac517 100644 --- a/doc/src/sgml/ref/clusterdb.sgml +++ b/doc/src/sgml/ref/clusterdb.sgml @@ -293,8 +293,7 @@ PostgreSQL documentation <literal>xyzzy</literal>: <screen> <prompt>$ </prompt><userinput>clusterdb --table foo xyzzy</userinput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index deda01281b..1c8b37c832 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -296,8 +296,7 @@ COMMENT ON TEXT SEARCH TEMPLATE snowball IS 'Snowball stemmer'; COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for RI'; COMMENT ON TYPE complex IS 'Complex number data type'; COMMENT ON VIEW my_view IS 'View of departmental costs'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/commit.sgml b/doc/src/sgml/ref/commit.sgml index 1a039c2e3e..40147a5476 100644 --- a/doc/src/sgml/ref/commit.sgml +++ b/doc/src/sgml/ref/commit.sgml @@ -72,8 +72,7 @@ COMMIT [ WORK | TRANSACTION ] To commit the current transaction and make all changes permanent: <programlisting> COMMIT; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/commit_prepared.sgml b/doc/src/sgml/ref/commit_prepared.sgml index 930435d81a..2af677fcb0 100644 --- a/doc/src/sgml/ref/commit_prepared.sgml +++ b/doc/src/sgml/ref/commit_prepared.sgml @@ -79,8 +79,7 @@ COMMIT PREPARED <replaceable class="PARAMETER">transaction_id</replaceable> <programlisting> COMMIT PREPARED 'foobar'; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 6429a4ef0d..a73b02276c 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -703,8 +703,7 @@ only one flag bit is defined, and the rest must be zero: </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -850,8 +849,7 @@ ZW ZIMBABWE 0000140 \0 002 Z M \0 \0 \0 006 Z A M B I A 377 377 0000160 377 377 \0 003 \0 \0 \0 002 Z W \0 \0 \0 \b Z I 0000200 M B A B W E 377 377 377 377 377 377 -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> @@ -910,7 +908,6 @@ COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable> [ WITH O TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT } [ [USING] DELIMITERS '<replaceable class="parameter">delimiter</replaceable>' ] [ WITH NULL AS '<replaceable class="parameter">null string</replaceable>' ] -</synopsis> - </para> +</synopsis></para> </refsect1> </refentry> diff --git a/doc/src/sgml/ref/create_conversion.sgml b/doc/src/sgml/ref/create_conversion.sgml index 4a37191222..084b60c4c1 100644 --- a/doc/src/sgml/ref/create_conversion.sgml +++ b/doc/src/sgml/ref/create_conversion.sgml @@ -113,8 +113,7 @@ conv_proc( internal, -- destination (fill with a null terminated C string) integer -- source string length ) RETURNS void; -</programlisting> - </para> +</programlisting></para> </listitem> </varlistentry> </variablelist> @@ -141,8 +140,7 @@ conv_proc( <literal>LATIN1</literal> using <function>myfunc</>: <programlisting> CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/create_domain.sgml b/doc/src/sgml/ref/create_domain.sgml index 8db90f911f..2c8b1f4e74 100644 --- a/doc/src/sgml/ref/create_domain.sgml +++ b/doc/src/sgml/ref/create_domain.sgml @@ -162,8 +162,7 @@ CREATE DOMAIN <replaceable class="parameter">name</replaceable> [ AS ] <replacea <varlistentry> <term><literal>CHECK (<replaceable class="PARAMETER">expression</replaceable>)</literal></term> <listitem> - <para> - <literal>CHECK</> clauses specify integrity constraints or tests + <para><literal>CHECK</> clauses specify integrity constraints or tests which values of the domain must satisfy. Each constraint must be an expression producing a Boolean result. It should use the key word <literal>VALUE</> @@ -202,8 +201,7 @@ CREATE TABLE us_snail_addy ( city TEXT NOT NULL, postal us_postal_code NOT NULL ); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-CREATEDOMAIN-compatibility"> diff --git a/doc/src/sgml/ref/create_extension.sgml b/doc/src/sgml/ref/create_extension.sgml index 7670d76f89..9ec0fa2fe1 100644 --- a/doc/src/sgml/ref/create_extension.sgml +++ b/doc/src/sgml/ref/create_extension.sgml @@ -111,8 +111,7 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name <varlistentry> <term><replaceable class="parameter">old_version</replaceable></term> <listitem> - <para> - <literal>FROM</> <replaceable class="parameter">old_version</> + <para><literal>FROM</> <replaceable class="parameter">old_version</> must be specified when, and only when, you are attempting to install an extension that replaces an <quote>old style</> module that is just a collection of objects not packaged into an extension. This option diff --git a/doc/src/sgml/ref/create_foreign_data_wrapper.sgml b/doc/src/sgml/ref/create_foreign_data_wrapper.sgml index 3093ebcb4a..804fb47c68 100644 --- a/doc/src/sgml/ref/create_foreign_data_wrapper.sgml +++ b/doc/src/sgml/ref/create_foreign_data_wrapper.sgml @@ -62,8 +62,7 @@ CREATE FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> <varlistentry> <term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term> <listitem> - <para> - <replaceable class="parameter">handler_function</replaceable> is the + <para><replaceable class="parameter">handler_function</replaceable> is the name of a previously registered function that will be called to retrieve the execution functions for foreign tables. The handler function must take no arguments, and @@ -81,8 +80,7 @@ CREATE FOREIGN DATA WRAPPER <replaceable class="parameter">name</replaceable> <varlistentry> <term><literal>VALIDATOR <replaceable class="parameter">validator_function</replaceable></literal></term> <listitem> - <para> - <replaceable class="parameter">validator_function</replaceable> is the + <para><replaceable class="parameter">validator_function</replaceable> is the name of a previously registered function that will be called to check the generic options given to the foreign-data wrapper, as well as options for foreign servers and user mappings using the @@ -157,8 +155,7 @@ CREATE FOREIGN DATA WRAPPER file HANDLER file_fdw_handler; <programlisting> CREATE FOREIGN DATA WRAPPER mywrapper OPTIONS (debug 'true'); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_foreign_table.sgml b/doc/src/sgml/ref/create_foreign_table.sgml index ad91072bd1..7f1cc4264d 100644 --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -19,7 +19,7 @@ <refsynopsisdiv> <synopsis> CREATE FOREIGN TABLE [ IF NOT EXISTS ] <replaceable class="PARAMETER">table_name</replaceable> ( [ - { <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ NULL | NOT NULL ] } + { <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ... ] ) ] [ NULL | NOT NULL ] } [, ... ] ] ) SERVER <replaceable class="parameter">server_name</replaceable> @@ -138,10 +138,12 @@ CREATE FOREIGN TABLE [ IF NOT EXISTS ] <replaceable class="PARAMETER">table_name <term><literal>OPTIONS ( <replaceable class="PARAMETER">option</replaceable> '<replaceable class="PARAMETER">value</replaceable>' [, ...] )</literal></term> <listitem> <para> - Options to be associated with the new foreign table. + Options to be associated with the new foreign table or one of its + columns. The allowed option names and values are specific to each foreign data wrapper and are validated using the foreign-data wrapper's - validator function. Option names must be unique. + validator function. Duplicate option names are not allowed (although + it's OK for a table option and a column option to have the same name). </para> </listitem> </varlistentry> @@ -167,8 +169,7 @@ CREATE FOREIGN TABLE films ( len interval hour to minute ) SERVER film_server; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index cd6ac69eb6..a617f96542 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -259,8 +259,7 @@ CREATE [ OR REPLACE ] FUNCTION <term><literal>WINDOW</literal></term> <listitem> - <para> - <literal>WINDOW</literal> indicates that the function is a + <para><literal>WINDOW</literal> indicates that the function is a <firstterm>window function</> rather than a plain function. This is currently only useful for functions written in C. The <literal>WINDOW</> attribute cannot be changed when @@ -282,8 +281,7 @@ CREATE [ OR REPLACE ] FUNCTION <literal>VOLATILE</literal> is the default assumption. </para> - <para> - <literal>IMMUTABLE</literal> indicates that the function + <para><literal>IMMUTABLE</literal> indicates that the function cannot modify the database and always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not @@ -292,8 +290,7 @@ CREATE [ OR REPLACE ] FUNCTION immediately replaced with the function value. </para> - <para> - <literal>STABLE</literal> indicates that the function + <para><literal>STABLE</literal> indicates that the function cannot modify the database, and that within a single table scan it will consistently return the same result for the same argument values, but that its @@ -306,8 +303,7 @@ CREATE [ OR REPLACE ] FUNCTION as stable, since their values do not change within a transaction. </para> - <para> - <literal>VOLATILE</literal> indicates that the function value can + <para><literal>VOLATILE</literal> indicates that the function value can change even within a single table scan, so no optimizations can be made. Relatively few database functions are volatile in this sense; some examples are <literal>random()</>, <literal>currval()</>, @@ -329,16 +325,14 @@ CREATE [ OR REPLACE ] FUNCTION <term><literal>STRICT</literal></term> <listitem> - <para> - <literal>CALLED ON NULL INPUT</literal> (the default) indicates + <para><literal>CALLED ON NULL INPUT</literal> (the default) indicates that the function will be called normally when some of its arguments are null. It is then the function author's responsibility to check for null values if necessary and respond appropriately. </para> - <para> - <literal>RETURNS NULL ON NULL INPUT</literal> or + <para><literal>RETURNS NULL ON NULL INPUT</literal> or <literal>STRICT</literal> indicates that the function always returns null whenever any of its arguments are null. If this parameter is specified, the function is not executed when there @@ -353,8 +347,7 @@ CREATE [ OR REPLACE ] FUNCTION <term><literal><optional>EXTERNAL</optional> SECURITY DEFINER</literal></term> <listitem> - <para> - <literal>SECURITY INVOKER</literal> indicates that the function + <para><literal>SECURITY INVOKER</literal> indicates that the function is to be executed with the privileges of the user that calls it. That is the default. <literal>SECURITY DEFINER</literal> specifies that the function is to be executed with the @@ -499,8 +492,7 @@ CREATE [ OR REPLACE ] FUNCTION <varlistentry> <term><literal>isCachable</></term> <listitem> - <para> - <literal>isCachable</literal> is an obsolete equivalent of + <para><literal>isCachable</literal> is an obsolete equivalent of <literal>IMMUTABLE</literal>; it's still accepted for backwards-compatibility reasons. </para> diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index f7f360875c..1a1e8d60d7 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -598,8 +598,7 @@ SELECT * FROM points To create an index without locking out writes to the table: <programlisting> CREATE INDEX CONCURRENTLY sales_quantity_index ON sales_table (quantity); -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml index 13c3baf993..6e72892375 100644 --- a/doc/src/sgml/ref/create_language.sgml +++ b/doc/src/sgml/ref/create_language.sgml @@ -118,8 +118,7 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa <term><literal>TRUSTED</literal></term> <listitem> - <para> - <literal>TRUSTED</literal> specifies that the language does + <para><literal>TRUSTED</literal> specifies that the language does not grant access to data that the user would not otherwise have. If this key word is omitted when registering the language, only users with the @@ -160,8 +159,7 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa <term><literal>HANDLER</literal> <replaceable class="parameter">call_handler</replaceable></term> <listitem> - <para> - <replaceable class="parameter">call_handler</replaceable> is + <para><replaceable class="parameter">call_handler</replaceable> is the name of a previously registered function that will be called to execute the procedural language's functions. The call handler for a procedural language must be written in a compiled @@ -178,8 +176,7 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa <term><literal>INLINE</literal> <replaceable class="parameter">inline_handler</replaceable></term> <listitem> - <para> - <replaceable class="parameter">inline_handler</replaceable> is the + <para><replaceable class="parameter">inline_handler</replaceable> is the name of a previously registered function that will be called to execute an anonymous code block (<xref linkend="sql-do"> command) @@ -199,8 +196,7 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa <term><literal>VALIDATOR</literal> <replaceable class="parameter">valfunction</replaceable></term> <listitem> - <para> - <replaceable class="parameter">valfunction</replaceable> is the + <para><replaceable class="parameter">valfunction</replaceable> is the name of a previously registered function that will be called when a new function in the language is created, to validate the new function. @@ -309,8 +305,7 @@ CREATE FUNCTION plsample_call_handler() RETURNS language_handler LANGUAGE C; CREATE LANGUAGE plsample HANDLER plsample_call_handler; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="sql-createlanguage-compat"> diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index 90da092450..28b5e7e0da 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -52,8 +52,7 @@ CREATE OPERATOR <replaceable>name</replaceable> ( There are a few restrictions on your choice of name: <itemizedlist> <listitem> - <para> - <literal>--</literal> and <literal>/*</literal> cannot appear anywhere in an operator name, + <para><literal>--</literal> and <literal>/*</literal> cannot appear anywhere in an operator name, since they will be taken as the start of a comment. </para> </listitem> @@ -215,8 +214,7 @@ CREATE OPERATOR <replaceable>name</replaceable> ( arguments, use the <literal>OPERATOR()</> syntax, for example: <programlisting> COMMUTATOR = OPERATOR(myschema.===) , -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> @@ -266,8 +264,7 @@ CREATE OPERATOR === ( JOIN = area_join_procedure, HASHES, MERGES ); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_role.sgml b/doc/src/sgml/ref/create_role.sgml index 43bec5d8e1..5a939346e7 100644 --- a/doc/src/sgml/ref/create_role.sgml +++ b/doc/src/sgml/ref/create_role.sgml @@ -268,8 +268,7 @@ CREATE ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replac <varlistentry> <term><literal>IN GROUP</> <replaceable class="parameter">role_name</replaceable></term> <listitem> - <para> - <literal>IN GROUP</literal> is an obsolete spelling of + <para><literal>IN GROUP</literal> is an obsolete spelling of <literal>IN ROLE</>. </para> </listitem> @@ -438,8 +437,7 @@ CREATE ROLE miriam WITH LOGIN PASSWORD 'jw8s0F4' VALID UNTIL '2005-01-01'; Create a role that can create databases and manage roles: <programlisting> CREATE ROLE admin WITH CREATEDB CREATEROLE; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml index e7c88497d6..8bccf7f1f1 100644 --- a/doc/src/sgml/ref/create_rule.sgml +++ b/doc/src/sgml/ref/create_rule.sgml @@ -149,8 +149,7 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS <varlistentry> <term><option>INSTEAD</option></term> <listitem> - <para> - <literal>INSTEAD</literal> indicates that the commands should be + <para><literal>INSTEAD</literal> indicates that the commands should be executed <emphasis>instead of</> the original command. </para> </listitem> @@ -159,8 +158,7 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS <varlistentry> <term><option>ALSO</option></term> <listitem> - <para> - <literal>ALSO</literal> indicates that the commands should be + <para><literal>ALSO</literal> indicates that the commands should be executed <emphasis>in addition to</emphasis> the original command. </para> diff --git a/doc/src/sgml/ref/create_schema.sgml b/doc/src/sgml/ref/create_schema.sgml index 89a624eda2..930d876814 100644 --- a/doc/src/sgml/ref/create_schema.sgml +++ b/doc/src/sgml/ref/create_schema.sgml @@ -147,8 +147,7 @@ CREATE SCHEMA hollywood; CREATE TABLE hollywood.films (title text, release date, awards text[]); CREATE VIEW hollywood.winners AS SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index f36b616db0..367f440b6c 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -318,8 +318,7 @@ BEGIN; COPY distributors FROM 'input_file'; SELECT setval('serial', max(id)) FROM distributors; END; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> @@ -348,8 +347,7 @@ END; extension. </para> </listitem> - </itemizedlist> - </para> + </itemizedlist></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_server.sgml b/doc/src/sgml/ref/create_server.sgml index f923dc84c8..be9be50b69 100644 --- a/doc/src/sgml/ref/create_server.sgml +++ b/doc/src/sgml/ref/create_server.sgml @@ -136,8 +136,7 @@ CREATE SERVER foo FOREIGN DATA WRAPPER "default"; foreign-data wrapper <literal>pgsql</>: <programlisting> CREATE SERVER myserver FOREIGN DATA WRAPPER pgsql OPTIONS (host 'foo', dbname 'foodb', port '5432'); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 0fbe116097..faff45900c 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -288,8 +288,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI error will be reported. </para> - <para> - <literal>CHECK</> constraints are merged in essentially the same way as + <para><literal>CHECK</> constraints are merged in essentially the same way as columns: if multiple parent tables and/or the new table definition contain identically-named <literal>CHECK</> constraints, these constraints must all have the same check expression, or an error will be @@ -340,8 +339,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI table, unless the <literal>INCLUDING INDEXES</literal> clause is specified. </para> - <para> - <literal>STORAGE</> settings for the copied column definitions will only + <para><literal>STORAGE</> settings for the copied column definitions will only be copied if <literal>INCLUDING STORAGE</literal> is specified. The default behavior is to exclude <literal>STORAGE</> settings, resulting in the copied columns in the new table having type-specific default @@ -354,8 +352,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI is specified. The default behavior is to exclude comments, resulting in the copied columns and constraints in the new table having no comments. </para> - <para> - <literal>INCLUDING ALL</literal> is an abbreviated form of + <para><literal>INCLUDING ALL</literal> is an abbreviated form of <literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>. </para> <para> @@ -798,8 +795,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -1061,9 +1057,7 @@ CREATE TABLE films ( kind varchar(10), len interval hour to minute ); -</programlisting> -<programlisting> CREATE TABLE distributors ( did integer PRIMARY KEY DEFAULT nextval('serial'), name varchar(40) NOT NULL CHECK (name <> '') @@ -1151,9 +1145,7 @@ CREATE TABLE distributors ( name varchar(40), PRIMARY KEY(did) ); -</programlisting> -<programlisting> CREATE TABLE distributors ( did integer PRIMARY KEY, name varchar(40) @@ -1259,8 +1251,7 @@ CREATE TABLE employees OF employee_type ( PRIMARY KEY (name), salary WITH OPTIONS DEFAULT 1000 ); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-CREATETABLE-compatibility"> diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml index ff71078d1e..e4797b6547 100644 --- a/doc/src/sgml/ref/create_table_as.sgml +++ b/doc/src/sgml/ref/create_table_as.sgml @@ -183,8 +183,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE <replaceable </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -291,8 +290,7 @@ PREPARE recentfilms(date) AS SELECT * FROM films WHERE date_prod > $1; CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS EXECUTE recentfilms('2002-01-01'); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> @@ -319,8 +317,7 @@ CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS </listitem> <listitem> - <para> - <productname>PostgreSQL</> handles temporary tables in a way + <para><productname>PostgreSQL</> handles temporary tables in a way rather different from the standard; see <xref linkend="sql-createtable"> for details. @@ -341,8 +338,7 @@ CREATE TEMP TABLE films_recent WITH (OIDS) ON COMMIT DROP AS is an extension. </para> </listitem> - </itemizedlist> - </para> + </itemizedlist></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml index beda4540c8..89c89072ae 100644 --- a/doc/src/sgml/ref/create_tablespace.sgml +++ b/doc/src/sgml/ref/create_tablespace.sgml @@ -118,8 +118,7 @@ CREATE TABLESPACE dbspace LOCATION '/data/dbs'; owned by user <literal>genevieve</>: <programlisting> CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/create_trigger.sgml b/doc/src/sgml/ref/create_trigger.sgml index 8e502d94e4..a7915cf09f 100644 --- a/doc/src/sgml/ref/create_trigger.sgml +++ b/doc/src/sgml/ref/create_trigger.sgml @@ -235,8 +235,7 @@ UPDATE OF <replaceable>column_name1</replaceable> [, <replaceable>column_name2</ is mentioned as a target of the <command>UPDATE</> command. </para> - <para> - <literal>INSTEAD OF UPDATE</> events do not support lists of columns. + <para><literal>INSTEAD OF UPDATE</> events do not support lists of columns. </para> </listitem> </varlistentry> @@ -311,8 +310,7 @@ UPDATE OF <replaceable>column_name1</replaceable> [, <replaceable>column_name2</ and <literal>DELETE</> triggers cannot refer to <literal>NEW</>. </para> - <para> - <literal>INSTEAD OF</> triggers do not support <literal>WHEN</> + <para><literal>INSTEAD OF</> triggers do not support <literal>WHEN</> conditions. </para> @@ -502,8 +500,7 @@ CREATE TRIGGER view_insert </listitem> <listitem> - <para> - <productname>PostgreSQL</productname> only allows the execution + <para><productname>PostgreSQL</productname> only allows the execution of a user-defined function for the triggered action. The standard allows the execution of a number of other SQL commands, such as <command>CREATE TABLE</command>, as the triggered action. This diff --git a/doc/src/sgml/ref/create_user_mapping.sgml b/doc/src/sgml/ref/create_user_mapping.sgml index c9606280fb..c7cc4ce574 100644 --- a/doc/src/sgml/ref/create_user_mapping.sgml +++ b/doc/src/sgml/ref/create_user_mapping.sgml @@ -94,8 +94,7 @@ CREATE USER MAPPING FOR { <replaceable class="parameter">user_name</replaceable> Create a user mapping for user <literal>bob</>, server <literal>foo</>: <programlisting> CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret'); -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml index 9c8171d049..3e50173e22 100644 --- a/doc/src/sgml/ref/createdb.sgml +++ b/doc/src/sgml/ref/createdb.sgml @@ -352,8 +352,7 @@ PostgreSQL documentation <screen> <prompt>$ </prompt><userinput>createdb -p 5000 -h eden -E LATIN1 -e demo</userinput> <computeroutput>CREATE DATABASE demo ENCODING 'LATIN1';</computeroutput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/declare.sgml b/doc/src/sgml/ref/declare.sgml index f2b75b7aca..d500faaa74 100644 --- a/doc/src/sgml/ref/declare.sgml +++ b/doc/src/sgml/ref/declare.sgml @@ -91,8 +91,7 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI <term><literal>SCROLL</literal></term> <term><literal>NO SCROLL</literal></term> <listitem> - <para> - <literal>SCROLL</literal> specifies that the cursor can be used + <para><literal>SCROLL</literal> specifies that the cursor can be used to retrieve rows in a nonsequential fashion (e.g., backward). Depending upon the complexity of the query's execution plan, specifying <literal>SCROLL</literal> might impose @@ -110,8 +109,7 @@ DECLARE <replaceable class="parameter">name</replaceable> [ BINARY ] [ INSENSITI <term><literal>WITH HOLD</literal></term> <term><literal>WITHOUT HOLD</literal></term> <listitem> - <para> - <literal>WITH HOLD</literal> specifies that the cursor can + <para><literal>WITH HOLD</literal> specifies that the cursor can continue to be used after the transaction that created it successfully commits. <literal>WITHOUT HOLD</literal> specifies that the cursor cannot be used outside of the transaction that diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml index 9406f4e3af..71ebeda880 100644 --- a/doc/src/sgml/ref/delete.sgml +++ b/doc/src/sgml/ref/delete.sgml @@ -275,8 +275,7 @@ DELETE FROM tasks WHERE status = 'DONE' RETURNING *; <literal>c_tasks</> is currently positioned: <programlisting> DELETE FROM tasks WHERE CURRENT OF c_tasks; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/discard.sgml b/doc/src/sgml/ref/discard.sgml index 74a2ce3b4e..65ebbae138 100644 --- a/doc/src/sgml/ref/discard.sgml +++ b/doc/src/sgml/ref/discard.sgml @@ -83,8 +83,7 @@ UNLISTEN *; SELECT pg_advisory_unlock_all(); DISCARD PLANS; DISCARD TEMP; -</programlisting> - </para> +</programlisting></para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/do.sgml b/doc/src/sgml/ref/do.sgml index 47f144f795..5f43d1cf52 100644 --- a/doc/src/sgml/ref/do.sgml +++ b/doc/src/sgml/ref/do.sgml @@ -107,9 +107,9 @@ BEGIN EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name) || ' TO webuser'; END LOOP; END$$; -</programlisting> - </para> +</programlisting></para> </refsect1> + <refsect1> <title>Compatibility</title> diff --git a/doc/src/sgml/ref/drop_aggregate.sgml b/doc/src/sgml/ref/drop_aggregate.sgml index 400b4d70eb..dd8aafa74d 100644 --- a/doc/src/sgml/ref/drop_aggregate.sgml +++ b/doc/src/sgml/ref/drop_aggregate.sgml @@ -99,8 +99,7 @@ DROP AGGREGATE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ( <type>integer</type>: <programlisting> DROP AGGREGATE myavg(integer); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_cast.sgml b/doc/src/sgml/ref/drop_cast.sgml index 139e89daca..589c6ac39b 100644 --- a/doc/src/sgml/ref/drop_cast.sgml +++ b/doc/src/sgml/ref/drop_cast.sgml @@ -92,8 +92,7 @@ DROP CAST [ IF EXISTS ] (<replaceable>source_type</replaceable> AS <replaceable> To drop the cast from type <type>text</type> to type <type>int</type>: <programlisting> DROP CAST (text AS int); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="sql-dropcast-compat"> diff --git a/doc/src/sgml/ref/drop_collation.sgml b/doc/src/sgml/ref/drop_collation.sgml index 0afcaaf2de..64a48eec2b 100644 --- a/doc/src/sgml/ref/drop_collation.sgml +++ b/doc/src/sgml/ref/drop_collation.sgml @@ -84,8 +84,7 @@ DROP COLLATION [ IF EXISTS ] <replaceable>name</replaceable> [ CASCADE | RESTRIC To drop the collation named <literal>german</>: <programlisting> DROP COLLATION german; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="sql-dropcollation-compat"> diff --git a/doc/src/sgml/ref/drop_conversion.sgml b/doc/src/sgml/ref/drop_conversion.sgml index 79e159dcbd..6f866438fb 100644 --- a/doc/src/sgml/ref/drop_conversion.sgml +++ b/doc/src/sgml/ref/drop_conversion.sgml @@ -77,8 +77,7 @@ DROP CONVERSION [ IF EXISTS ] <replaceable>name</replaceable> [ CASCADE | RESTRI To drop the conversion named <literal>myname</>: <programlisting> DROP CONVERSION myname; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="sql-dropconversion-compat"> diff --git a/doc/src/sgml/ref/drop_domain.sgml b/doc/src/sgml/ref/drop_domain.sgml index 689633f6dd..b7b9a167c1 100644 --- a/doc/src/sgml/ref/drop_domain.sgml +++ b/doc/src/sgml/ref/drop_domain.sgml @@ -87,8 +87,7 @@ DROP DOMAIN [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, . <programlisting> DROP DOMAIN box; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-DROPDOMAIN-compatibility"> diff --git a/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml b/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml index 0ac0722f3d..18fa4fe4a5 100644 --- a/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml +++ b/doc/src/sgml/ref/drop_foreign_data_wrapper.sgml @@ -87,8 +87,7 @@ DROP FOREIGN DATA WRAPPER [ IF EXISTS ] <replaceable class="parameter">name</rep Drop the foreign-data wrapper <literal>dbi</>: <programlisting> DROP FOREIGN DATA WRAPPER dbi; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_foreign_table.sgml b/doc/src/sgml/ref/drop_foreign_table.sgml index 71f26465bb..1f66126a33 100644 --- a/doc/src/sgml/ref/drop_foreign_table.sgml +++ b/doc/src/sgml/ref/drop_foreign_table.sgml @@ -21,7 +21,7 @@ DROP FOREIGN TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] </synopsis> </refsynopsisdiv> - + <refsect1> <title>Description</title> @@ -30,7 +30,7 @@ DROP FOREIGN TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceabl Only the owner of a foreign table can remove it. </para> </refsect1> - + <refsect1> <title>Parameters</title> @@ -80,15 +80,14 @@ DROP FOREIGN TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceabl <title>Examples</title> <para> - To destroy two foreign tables, <literal>films</literal> and + To destroy two foreign tables, <literal>films</literal> and <literal>distributors</literal>: <programlisting> DROP FOREIGN TABLE films, distributors; -</programlisting> - </para> +</programlisting></para> </refsect1> - + <refsect1> <title>Compatibility</title> diff --git a/doc/src/sgml/ref/drop_function.sgml b/doc/src/sgml/ref/drop_function.sgml index a26b4ff66c..2d0048be28 100644 --- a/doc/src/sgml/ref/drop_function.sgml +++ b/doc/src/sgml/ref/drop_function.sgml @@ -132,8 +132,7 @@ DROP FUNCTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ( <programlisting> DROP FUNCTION sqrt(integer); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-DROPFUNCTION-compatibility"> diff --git a/doc/src/sgml/ref/drop_index.sgml b/doc/src/sgml/ref/drop_index.sgml index fb4ce2bf9c..7177ef2d81 100644 --- a/doc/src/sgml/ref/drop_index.sgml +++ b/doc/src/sgml/ref/drop_index.sgml @@ -87,8 +87,7 @@ DROP INDEX [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, .. <programlisting> DROP INDEX title_idx; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_language.sgml b/doc/src/sgml/ref/drop_language.sgml index 21c9e5aced..c2cb7045de 100644 --- a/doc/src/sgml/ref/drop_language.sgml +++ b/doc/src/sgml/ref/drop_language.sgml @@ -100,8 +100,7 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] <replaceable class="PARAMETER">name</ <programlisting> DROP LANGUAGE plsample; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_operator.sgml b/doc/src/sgml/ref/drop_operator.sgml index aa227ab8d8..3091454fdc 100644 --- a/doc/src/sgml/ref/drop_operator.sgml +++ b/doc/src/sgml/ref/drop_operator.sgml @@ -123,8 +123,7 @@ DROP OPERATOR ~ (none, bit); for type <type>bigint</type>: <programlisting> DROP OPERATOR ! (bigint, none); -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_role.sgml b/doc/src/sgml/ref/drop_role.sgml index a3a999437c..92c0fb863d 100644 --- a/doc/src/sgml/ref/drop_role.sgml +++ b/doc/src/sgml/ref/drop_role.sgml @@ -96,8 +96,7 @@ DROP ROLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ... To drop a role: <programlisting> DROP ROLE jonathan; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_rule.sgml b/doc/src/sgml/ref/drop_rule.sgml index fd24c70127..b7ff6e6078 100644 --- a/doc/src/sgml/ref/drop_rule.sgml +++ b/doc/src/sgml/ref/drop_rule.sgml @@ -96,8 +96,7 @@ DROP RULE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ON <re <programlisting> DROP RULE newrule ON mytable; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_schema.sgml b/doc/src/sgml/ref/drop_schema.sgml index 50fb09b965..15dbc40817 100644 --- a/doc/src/sgml/ref/drop_schema.sgml +++ b/doc/src/sgml/ref/drop_schema.sgml @@ -93,8 +93,7 @@ DROP SCHEMA [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, . <programlisting> DROP SCHEMA mystuff CASCADE; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_sequence.sgml b/doc/src/sgml/ref/drop_sequence.sgml index 84a8ca188b..f810b5976c 100644 --- a/doc/src/sgml/ref/drop_sequence.sgml +++ b/doc/src/sgml/ref/drop_sequence.sgml @@ -86,8 +86,7 @@ DROP SEQUENCE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, <programlisting> DROP SEQUENCE serial; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_server.sgml b/doc/src/sgml/ref/drop_server.sgml index af08655a1d..6a64e83ebe 100644 --- a/doc/src/sgml/ref/drop_server.sgml +++ b/doc/src/sgml/ref/drop_server.sgml @@ -87,8 +87,7 @@ DROP SERVER [ IF EXISTS ] <replaceable class="parameter">server_name</replaceabl Drop a server <literal>foo</> if it exists: <programlisting> DROP SERVER IF EXISTS foo; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_table.sgml b/doc/src/sgml/ref/drop_table.sgml index 7fa7e32ee0..26fe76e1f8 100644 --- a/doc/src/sgml/ref/drop_table.sgml +++ b/doc/src/sgml/ref/drop_table.sgml @@ -100,8 +100,7 @@ DROP TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, .. <programlisting> DROP TABLE films, distributors; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_tablespace.sgml b/doc/src/sgml/ref/drop_tablespace.sgml index aa80be3c6f..107e049c8c 100644 --- a/doc/src/sgml/ref/drop_tablespace.sgml +++ b/doc/src/sgml/ref/drop_tablespace.sgml @@ -86,8 +86,7 @@ DROP TABLESPACE [ IF EXISTS ] <replaceable class="PARAMETER">tablespace_name</re To remove tablespace <literal>mystuff</literal> from the system: <programlisting> DROP TABLESPACE mystuff; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_trigger.sgml b/doc/src/sgml/ref/drop_trigger.sgml index 444c928d1e..2fcc690db7 100644 --- a/doc/src/sgml/ref/drop_trigger.sgml +++ b/doc/src/sgml/ref/drop_trigger.sgml @@ -99,8 +99,7 @@ DROP TRIGGER [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> ON <programlisting> DROP TRIGGER if_dist_exists ON films; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-DROPTRIGGER-compatibility"> diff --git a/doc/src/sgml/ref/drop_type.sgml b/doc/src/sgml/ref/drop_type.sgml index 9de13068a7..c3ddfa5f42 100644 --- a/doc/src/sgml/ref/drop_type.sgml +++ b/doc/src/sgml/ref/drop_type.sgml @@ -86,8 +86,7 @@ DROP TYPE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ... To remove the data type <type>box</type>: <programlisting> DROP TYPE box; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-DROPTYPE-compatibility"> diff --git a/doc/src/sgml/ref/drop_user_mapping.sgml b/doc/src/sgml/ref/drop_user_mapping.sgml index 747d7cbd2e..de21bfe5d7 100644 --- a/doc/src/sgml/ref/drop_user_mapping.sgml +++ b/doc/src/sgml/ref/drop_user_mapping.sgml @@ -85,8 +85,7 @@ DROP USER MAPPING [ IF EXISTS ] FOR { <replaceable class="parameter">user_name</ Drop a user mapping <literal>bob</>, server <literal>foo</> if it exists: <programlisting> DROP USER MAPPING IF EXISTS FOR bob SERVER foo; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_view.sgml b/doc/src/sgml/ref/drop_view.sgml index 5d7e413c0b..51b82664cb 100644 --- a/doc/src/sgml/ref/drop_view.sgml +++ b/doc/src/sgml/ref/drop_view.sgml @@ -86,8 +86,7 @@ DROP VIEW [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ... This command will remove the view called <literal>kinds</literal>: <programlisting> DROP VIEW kinds; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/dropdb.sgml b/doc/src/sgml/ref/dropdb.sgml index 1aa76cdb57..e20bcdb53f 100644 --- a/doc/src/sgml/ref/dropdb.sgml +++ b/doc/src/sgml/ref/dropdb.sgml @@ -253,8 +253,7 @@ PostgreSQL documentation <computeroutput>Database "demo" will be permanently deleted. Are you sure? (y/n) </computeroutput><userinput>y</userinput> <computeroutput>DROP DATABASE demo;</computeroutput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/droplang.sgml b/doc/src/sgml/ref/droplang.sgml index 0ad640b0b4..04c3a609e5 100644 --- a/doc/src/sgml/ref/droplang.sgml +++ b/doc/src/sgml/ref/droplang.sgml @@ -271,8 +271,7 @@ PostgreSQL documentation To remove the language <literal>pltcl</literal>: <screen> <prompt>$ </prompt><userinput>droplang pltcl dbname</userinput> -</screen> - </para> +</screen></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/dropuser.sgml b/doc/src/sgml/ref/dropuser.sgml index 3089a21954..c158103913 100644 --- a/doc/src/sgml/ref/dropuser.sgml +++ b/doc/src/sgml/ref/dropuser.sgml @@ -254,8 +254,7 @@ PostgreSQL documentation <computeroutput>Role "joe" will be permanently removed. Are you sure? (y/n) </computeroutput><userinput>y</userinput> <computeroutput>DROP ROLE joe;</computeroutput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/ecpg-ref.sgml b/doc/src/sgml/ref/ecpg-ref.sgml index 2bbd476158..9c13e93a27 100644 --- a/doc/src/sgml/ref/ecpg-ref.sgml +++ b/doc/src/sgml/ref/ecpg-ref.sgml @@ -166,8 +166,7 @@ PostgreSQL documentation </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -253,8 +252,7 @@ PostgreSQL documentation ecpg prog1.pgc cc -I/usr/local/pgsql/include -c prog1.c cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg -</programlisting> - </para> +</programlisting></para> </refsect1> </refentry> diff --git a/doc/src/sgml/ref/end.sgml b/doc/src/sgml/ref/end.sgml index 85248b4c2f..b60cb2c48b 100644 --- a/doc/src/sgml/ref/end.sgml +++ b/doc/src/sgml/ref/end.sgml @@ -74,8 +74,7 @@ END [ WORK | TRANSACTION ] To commit the current transaction and make all changes permanent: <programlisting> END; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/fetch.sgml b/doc/src/sgml/ref/fetch.sgml index b78fed267b..cc49b6f0ce 100644 --- a/doc/src/sgml/ref/fetch.sgml +++ b/doc/src/sgml/ref/fetch.sgml @@ -111,8 +111,7 @@ FETCH [ <replaceable class="PARAMETER">direction</replaceable> [ FROM | IN ] ] < <varlistentry> <term><replaceable class="PARAMETER">direction</replaceable></term> <listitem> - <para> - <replaceable class="PARAMETER">direction</replaceable> defines + <para><replaceable class="PARAMETER">direction</replaceable> defines the fetch direction and number of rows to fetch. It can be one of the following: @@ -266,16 +265,14 @@ FETCH [ <replaceable class="PARAMETER">direction</replaceable> [ FROM | IN ] ] < </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> <varlistentry> <term><replaceable class="PARAMETER">count</replaceable></term> <listitem> - <para> - <replaceable class="PARAMETER">count</replaceable> is a + <para><replaceable class="PARAMETER">count</replaceable> is a possibly-signed integer constant, determining the location or number of rows to fetch. For <literal>FORWARD</> and <literal>BACKWARD</> cases, specifying a negative <replaceable @@ -378,8 +375,7 @@ FETCH PRIOR FROM liahona; -- Close the cursor and end the transaction: CLOSE liahona; COMMIT WORK; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index 1f5fe1f41f..aa9bbcbdab 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -140,14 +140,14 @@ GRANT <replaceable class="PARAMETER">role_name</replaceable> [, ...] TO <replace <para> PostgreSQL grants default privileges on some types of objects to - <literal>PUBLIC</literal>. No privileges are granted to - <literal>PUBLIC</literal> by default on tables, - columns, schemas or tablespaces. For other types, the default privileges - granted to <literal>PUBLIC</literal> are as follows: - <literal>CONNECT</literal> and <literal>CREATE TEMP TABLE</literal> for - databases; <literal>EXECUTE</literal> privilege for functions; and - <literal>USAGE</literal> privilege for languages. - The object owner can, of course, <command>REVOKE</command> + <literal>PUBLIC</literal>. No privileges are granted to + <literal>PUBLIC</literal> by default on tables, + columns, schemas or tablespaces. For other types, the default privileges + granted to <literal>PUBLIC</literal> are as follows: + <literal>CONNECT</literal> and <literal>CREATE TEMP TABLE</literal> for + databases; <literal>EXECUTE</literal> privilege for functions; and + <literal>USAGE</literal> privilege for languages. + The object owner can, of course, <command>REVOKE</command> both default and expressly granted privileges. (For maximum security, issue the <command>REVOKE</> in the same transaction that creates the object; then there is no window in which another user @@ -587,8 +587,7 @@ GRANT ALL PRIVILEGES ON kinds TO manuel; <programlisting> GRANT admins TO joe; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="sql-grant-compatibility"> diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml index a5c0d5a0a6..6aae3396d2 100644 --- a/doc/src/sgml/ref/insert.sgml +++ b/doc/src/sgml/ref/insert.sgml @@ -312,8 +312,7 @@ WITH upd AS ( RETURNING * ) INSERT INTO employees_log SELECT *, current_timestamp FROM upd; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/listen.sgml b/doc/src/sgml/ref/listen.sgml index 98091c2856..7287d3fc29 100644 --- a/doc/src/sgml/ref/listen.sgml +++ b/doc/src/sgml/ref/listen.sgml @@ -113,8 +113,7 @@ LISTEN <replaceable class="PARAMETER">channel</replaceable> LISTEN virtual; NOTIFY virtual; Asynchronous notification "virtual" received from server process with PID 8448. -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/lock.sgml b/doc/src/sgml/ref/lock.sgml index 9b464580aa..53014ed34f 100644 --- a/doc/src/sgml/ref/lock.sgml +++ b/doc/src/sgml/ref/lock.sgml @@ -222,8 +222,7 @@ DELETE FROM films_user_comments WHERE id IN (SELECT id FROM films WHERE rating < 5); DELETE FROM films WHERE rating < 5; COMMIT WORK; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/notify.sgml b/doc/src/sgml/ref/notify.sgml index 330b2cd56d..4480706293 100644 --- a/doc/src/sgml/ref/notify.sgml +++ b/doc/src/sgml/ref/notify.sgml @@ -204,8 +204,7 @@ Asynchronous notification "virtual" with payload "This is the payload" received LISTEN foo; SELECT pg_notify('fo' || 'o', 'pay' || 'load'); Asynchronous notification "foo" with payload "payload" received from server process with PID 14728. -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgml index 47dce43b19..4150f2a408 100644 --- a/doc/src/sgml/ref/pg_basebackup.sgml +++ b/doc/src/sgml/ref/pg_basebackup.sgml @@ -138,8 +138,7 @@ PostgreSQL documentation </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index 10105e2524..07836e718f 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -519,8 +519,7 @@ PostgreSQL documentation running without <function>fsync</function>, use: <screen> <prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" start</userinput> -</screen> - </para> +</screen></para> </refsect2> <refsect2 id="R2-APP-PGCTL-4"> @@ -534,8 +533,7 @@ PostgreSQL documentation <emphasis>how</emphasis> the server shuts down: <screen> <prompt>$</prompt> <userinput>pg_ctl stop -m fast</userinput> -</screen> - </para> +</screen></para> </refsect2> <refsect2 id="R2-APP-PGCTL-5"> @@ -564,8 +562,7 @@ PostgreSQL documentation To restart using port 5433, disabling <function>fsync</> upon restart: <screen> <prompt>$</prompt> <userinput>pg_ctl -o "-F -p 5433" restart</userinput> -</screen> - </para> +</screen></para> </refsect2> <refsect2 id="R2-APP-PGCTL-6"> diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index c24cc394d6..f6f33de7e7 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -268,10 +268,7 @@ PostgreSQL documentation </para> </listitem> </varlistentry> - - </variablelist> - </para> - + </variablelist></para> </listitem> </varlistentry> @@ -1075,8 +1072,7 @@ CREATE DATABASE foo WITH TEMPLATE template0; <screen> <prompt>$</prompt> <userinput>pg_dump -t '"MixedCaseName"' mydb > mytab.sql</userinput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index be4851b657..be11d176cd 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -197,8 +197,7 @@ </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -286,8 +285,7 @@ if filtering switches such as <option>-n</> or <option>-t</> are used with <option>-L</>, they will further restrict the items restored. </para> - <para> - <replaceable class="PARAMETER">list-file</> is normally created by + <para><replaceable class="PARAMETER">list-file</> is normally created by editing the output of a previous <option>-l</> operation. Lines can be moved or removed, and can also be commented out by placing a semicolon (<literal>;</literal>) at the @@ -707,8 +705,7 @@ CREATE DATABASE foo WITH TEMPLATE template0; </listitem> <listitem> - <para> - <application>pg_restore</application> cannot restore large objects + <para><application>pg_restore</application> cannot restore large objects selectively; for instance, only those for a specific table. If an archive contains large objects, then all large objects will be restored, or none of them if they are excluded via <option>-L</option>, @@ -821,8 +818,7 @@ CREATE DATABASE foo WITH TEMPLATE template0; items 10 and 6, in that order: <screen> <prompt>$</prompt> <userinput>pg_restore -L db.list db.dump</userinput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/postgres-ref.sgml b/doc/src/sgml/ref/postgres-ref.sgml index bd4ae338f7..b16bbdfa4b 100644 --- a/doc/src/sgml/ref/postgres-ref.sgml +++ b/doc/src/sgml/ref/postgres-ref.sgml @@ -745,7 +745,7 @@ PostgreSQL documentation <para> Note that the single-user mode server does not provide sophisticated - line-editing features (no command history, for example). + line-editing features (no command history, for example). Single-User mode also does not do any background processing, like automatic checkpoints. diff --git a/doc/src/sgml/ref/prepare_transaction.sgml b/doc/src/sgml/ref/prepare_transaction.sgml index 261cedc8d9..a10aa35d38 100644 --- a/doc/src/sgml/ref/prepare_transaction.sgml +++ b/doc/src/sgml/ref/prepare_transaction.sgml @@ -153,8 +153,7 @@ PREPARE TRANSACTION <replaceable class="PARAMETER">transaction_id</replaceable> <programlisting> PREPARE TRANSACTION 'foobar'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index ecfafadc61..e2e2abe4d3 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -83,8 +83,7 @@ PostgreSQL documentation (<filename>psqlrc</filename> and <filename>~/.psqlrc</filename>) are ignored with this option. </para> - <para> - <replaceable class="parameter">command</replaceable> must be either + <para><replaceable class="parameter">command</replaceable> must be either a command string that is completely parsable by the server (i.e., it contains no <application>psql</application>-specific features), or a single backslash command. Thus you cannot mix @@ -839,8 +838,7 @@ testdb=> backslash escapes do not apply. </para> - <para> - <literal>\copy ... from stdin | to stdout</literal> + <para><literal>\copy ... from stdin | to stdout</literal> reads/writes based on the command input and output respectively. All rows are read from the same source that issued the command, continuing until <literal>\.</literal> is read or the stream @@ -892,6 +890,12 @@ testdb=> </para> <para> + For some types of relation, <literal>\d</> shows additional information + for each column: column values for sequences, indexed expression for + indexes and per-column foreign data wrapper options for foreign tables. + </para> + + <para> The command form <literal>\d+</literal> is identical, except that more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the @@ -1753,8 +1757,7 @@ lo_import 152801 specified, the query output will be reset to the standard output. </para> - <para> - <quote>Query results</quote> includes all tables, command + <para><quote>Query results</quote> includes all tables, command responses, and notices obtained from the database server, as well as output of various backslash commands that query the database (such as <command>\d</command>), but not error @@ -1922,21 +1925,18 @@ lo_import 152801 is enough.) </para> - <para> - <literal>unaligned</> format writes all columns of a row on one + <para><literal>unaligned</> format writes all columns of a row on one line, separated by the currently active field separator. This is useful for creating output that might be intended to be read in by other programs (for example, tab-separated or comma-separated format). </para> - <para> - <literal>aligned</literal> format is the standard, human-readable, + <para><literal>aligned</literal> format is the standard, human-readable, nicely formatted text output; this is the default. </para> - <para> - <literal>wrapped</> format is like <literal>aligned</> but wraps + <para><literal>wrapped</> format is like <literal>aligned</> but wraps wide data values across lines to make the output fit in the target column width. The target width is determined as described under the <literal>columns</> option. Note that <application>psql</> will @@ -1970,8 +1970,7 @@ lo_import 152801 <literal>wrapped</> output formats. </para> - <para> - <literal>ascii</literal> style uses plain <acronym>ASCII</acronym> + <para><literal>ascii</literal> style uses plain <acronym>ASCII</acronym> characters. Newlines in data are shown using a <literal>+</literal> symbol in the right-hand margin. When the <literal>wrapped</literal> format wraps data from @@ -1980,8 +1979,7 @@ lo_import 152801 and again in the left-hand margin of the following line. </para> - <para> - <literal>old-ascii</literal> style uses plain <acronym>ASCII</> + <para><literal>old-ascii</literal> style uses plain <acronym>ASCII</> characters, using the formatting style used in <productname>PostgreSQL</productname> 8.4 and earlier. Newlines in data are shown using a <literal>:</literal> @@ -1991,8 +1989,7 @@ lo_import 152801 symbol is used in place of the left-hand column separator. </para> - <para> - <literal>unicode</literal> style uses Unicode box-drawing characters. + <para><literal>unicode</literal> style uses Unicode box-drawing characters. Newlines in data are shown using a carriage return symbol in the right-hand margin. When the data is wrapped from one line to the next without a newline character, an ellipsis symbol @@ -2474,8 +2471,7 @@ testdb=> <userinput>\set foo bar</userinput> <programlisting> testdb=> <userinput>\echo :foo</userinput> bar -</programlisting> - </para> +</programlisting></para> <note> <para> @@ -3326,8 +3322,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line ' </listitem> <listitem> - <para> - <application>psql</application> is only guaranteed to work smoothly + <para><application>psql</application> is only guaranteed to work smoothly with servers of the same version. That does not mean other combinations will fail outright, but subtle and not-so-subtle problems might come up. Backslash commands are particularly likely to fail if the @@ -3370,8 +3365,7 @@ PSQL_EDITOR_LINENUMBER_ARG='--line ' raster font does not work with the ANSI code page. </para> </listitem> - </itemizedlist> - </para> + </itemizedlist></para> </refsect1> @@ -3477,8 +3471,7 @@ second | three -[ RECORD 4 ]- first | 4 second | four -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/reindex.sgml b/doc/src/sgml/ref/reindex.sgml index c9514f95ae..722266563e 100644 --- a/doc/src/sgml/ref/reindex.sgml +++ b/doc/src/sgml/ref/reindex.sgml @@ -74,8 +74,7 @@ REINDEX { INDEX | TABLE | DATABASE | SYSTEM } <replaceable class="PARAMETER">nam </para> </listitem> - </itemizedlist> - </para> + </itemizedlist></para> </refsect1> <refsect1> @@ -263,8 +262,7 @@ $ <userinput>psql broken_db</userinput> ... broken_db=> REINDEX DATABASE broken_db; broken_db=> \q -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/reindexdb.sgml b/doc/src/sgml/ref/reindexdb.sgml index 026bdcc718..7b0263c5a1 100644 --- a/doc/src/sgml/ref/reindexdb.sgml +++ b/doc/src/sgml/ref/reindexdb.sgml @@ -319,8 +319,7 @@ PostgreSQL documentation <literal>bar</literal> in a database named <literal>abcd</literal>: <screen> <prompt>$ </prompt><userinput>reindexdb --table foo --index bar abcd</userinput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/reset.sgml b/doc/src/sgml/ref/reset.sgml index 3e31a6c186..d1ce7fb124 100644 --- a/doc/src/sgml/ref/reset.sgml +++ b/doc/src/sgml/ref/reset.sgml @@ -91,8 +91,7 @@ SET <replaceable class="parameter">configuration_parameter</replaceable> TO DEFA Set the <varname>timezone</> configuration variable to its default value: <screen> RESET timezone; -</screen> - </para> +</screen></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/revoke.sgml b/doc/src/sgml/ref/revoke.sgml index 204c986ece..3229e4bcc7 100644 --- a/doc/src/sgml/ref/revoke.sgml +++ b/doc/src/sgml/ref/revoke.sgml @@ -261,8 +261,7 @@ REVOKE ALL PRIVILEGES ON kinds FROM manuel; <programlisting> REVOKE admins FROM joe; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1 id="SQL-REVOKE-compatibility"> diff --git a/doc/src/sgml/ref/rollback.sgml b/doc/src/sgml/ref/rollback.sgml index 49989c01bf..b26554567d 100644 --- a/doc/src/sgml/ref/rollback.sgml +++ b/doc/src/sgml/ref/rollback.sgml @@ -71,8 +71,7 @@ ROLLBACK [ WORK | TRANSACTION ] To abort all changes: <programlisting> ROLLBACK; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/rollback_prepared.sgml b/doc/src/sgml/ref/rollback_prepared.sgml index 9dfe1416e0..9592b92f32 100644 --- a/doc/src/sgml/ref/rollback_prepared.sgml +++ b/doc/src/sgml/ref/rollback_prepared.sgml @@ -79,8 +79,7 @@ ROLLBACK PREPARED <replaceable class="PARAMETER">transaction_id</replaceable> <programlisting> ROLLBACK PREPARED 'foobar'; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/rollback_to.sgml b/doc/src/sgml/ref/rollback_to.sgml index bf83822378..1b59af6443 100644 --- a/doc/src/sgml/ref/rollback_to.sgml +++ b/doc/src/sgml/ref/rollback_to.sgml @@ -124,8 +124,7 @@ FETCH 1 FROM foo; 2 COMMIT; -</programlisting> - </para> +</programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/security_label.sgml b/doc/src/sgml/ref/security_label.sgml index a9eda21b72..8f52664afc 100644 --- a/doc/src/sgml/ref/security_label.sgml +++ b/doc/src/sgml/ref/security_label.sgml @@ -196,8 +196,7 @@ SECURITY LABEL [ FOR <replaceable class="PARAMETER">provider</replaceable> ] ON <programlisting> SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 5ff1ee834e..7fb52833e8 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -125,8 +125,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] </listitem> <listitem> - <para> - <literal>SELECT DISTINCT</literal> eliminates duplicate rows from the + <para><literal>SELECT DISTINCT</literal> eliminates duplicate rows from the result. <literal>SELECT DISTINCT ON</literal> eliminates rows that match on all the specified expressions. <literal>SELECT ALL</literal> (the default) will return all candidate rows, including @@ -423,8 +422,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] separating <literal>FROM</> items. </para> - <para> - <literal>CROSS JOIN</> and <literal>INNER JOIN</literal> + <para><literal>CROSS JOIN</> and <literal>INNER JOIN</literal> produce a simple Cartesian product, the same result as you get from listing the two items at the top level of <literal>FROM</>, but restricted by the join condition (if any). @@ -435,8 +433,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] <literal>WHERE</>. </para> - <para> - <literal>LEFT OUTER JOIN</> returns all rows in the qualified + <para><literal>LEFT OUTER JOIN</> returns all rows in the qualified Cartesian product (i.e., all combined rows that pass its join condition), plus one copy of each row in the left-hand table for which there was no right-hand row that passed the join @@ -455,8 +452,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] OUTER JOIN</> by switching the left and right inputs. </para> - <para> - <literal>FULL OUTER JOIN</> returns all the joined rows, plus + <para><literal>FULL OUTER JOIN</> returns all the joined rows, plus one row for each unmatched left-hand row (extended with nulls on the right), plus one row for each unmatched right-hand row (extended with nulls on the left). @@ -467,8 +463,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] <varlistentry> <term><literal>ON <replaceable class="parameter">join_condition</replaceable></literal></term> <listitem> - <para> - <replaceable class="parameter">join_condition</replaceable> is + <para><replaceable class="parameter">join_condition</replaceable> is an expression resulting in a value of type <type>boolean</type> (similar to a <literal>WHERE</literal> clause) that specifies which rows in a join are considered to @@ -494,8 +489,7 @@ TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] <varlistentry> <term><literal>NATURAL</literal></term> <listitem> - <para> - <literal>NATURAL</literal> is shorthand for a + <para><literal>NATURAL</literal> is shorthand for a <literal>USING</> list that mentions all columns in the two tables that have the same names. </para> @@ -832,8 +826,7 @@ SELECT DISTINCT ON (location) location, time, report The <literal>UNION</literal> clause has this general form: <synopsis> <replaceable class="parameter">select_statement</replaceable> UNION [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable> -</synopsis> - <replaceable class="parameter">select_statement</replaceable> is +</synopsis><replaceable class="parameter">select_statement</replaceable> is any <command>SELECT</command> statement without an <literal>ORDER BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or <literal>FOR SHARE</literal> clause. @@ -885,8 +878,7 @@ SELECT DISTINCT ON (location) location, time, report The <literal>INTERSECT</literal> clause has this general form: <synopsis> <replaceable class="parameter">select_statement</replaceable> INTERSECT [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable> -</synopsis> - <replaceable class="parameter">select_statement</replaceable> is +</synopsis><replaceable class="parameter">select_statement</replaceable> is any <command>SELECT</command> statement without an <literal>ORDER BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or <literal>FOR SHARE</literal> clause. @@ -933,8 +925,7 @@ SELECT DISTINCT ON (location) location, time, report The <literal>EXCEPT</literal> clause has this general form: <synopsis> <replaceable class="parameter">select_statement</replaceable> EXCEPT [ ALL | DISTINCT ] <replaceable class="parameter">select_statement</replaceable> -</synopsis> - <replaceable class="parameter">select_statement</replaceable> is +</synopsis><replaceable class="parameter">select_statement</replaceable> is any <command>SELECT</command> statement without an <literal>ORDER BY</>, <literal>LIMIT</>, <literal>FOR UPDATE</literal>, or <literal>FOR SHARE</literal> clause. @@ -1072,8 +1063,7 @@ SELECT name FROM distributors ORDER BY code; <synopsis> LIMIT { <replaceable class="parameter">count</replaceable> | ALL } OFFSET <replaceable class="parameter">start</replaceable> -</synopsis> - <replaceable class="parameter">count</replaceable> specifies the +</synopsis><replaceable class="parameter">count</replaceable> specifies the maximum number of rows to return, while <replaceable class="parameter">start</replaceable> specifies the number of rows to skip before starting to return rows. When both are specified, @@ -1561,8 +1551,7 @@ SELECT 2+2; following query is invalid: <programlisting> SELECT distributors.* WHERE distributors.name = 'Westward'; -</programlisting> - <productname>PostgreSQL</productname> releases prior to +</programlisting><productname>PostgreSQL</productname> releases prior to 8.1 would accept queries of this form, and add an implicit entry to the query's <literal>FROM</literal> clause for each table referenced by the query. This is no longer allowed. diff --git a/doc/src/sgml/ref/select_into.sgml b/doc/src/sgml/ref/select_into.sgml index 02266083d4..48b789b580 100644 --- a/doc/src/sgml/ref/select_into.sgml +++ b/doc/src/sgml/ref/select_into.sgml @@ -125,8 +125,7 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="parameter">expression</replac <programlisting> SELECT * INTO films_recent FROM films WHERE date_prod >= '2002-01-01'; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml index 3ef700b60d..40e1bd4e60 100644 --- a/doc/src/sgml/ref/set.sgml +++ b/doc/src/sgml/ref/set.sgml @@ -154,8 +154,7 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep <varlistentry> <term><literal>SCHEMA</literal></term> <listitem> - <para> - <literal>SET SCHEMA '<replaceable>value</>'</> is an alias for + <para><literal>SET SCHEMA '<replaceable>value</>'</> is an alias for <literal>SET search_path TO <replaceable>value</></>. Only one schema can be specified using this syntax. </para> @@ -165,8 +164,7 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep <varlistentry> <term><literal>NAMES</literal></term> <listitem> - <para> - <literal>SET NAMES <replaceable>value</></> is an alias for + <para><literal>SET NAMES <replaceable>value</></> is an alias for <literal>SET client_encoding TO <replaceable>value</></>. </para> </listitem> @@ -187,16 +185,14 @@ SET [ SESSION | LOCAL ] TIME ZONE { <replaceable class="PARAMETER">timezone</rep <function>setseed</function>: <programlisting> SELECT setseed(<replaceable>value</replaceable>); -</programlisting> - </para> +</programlisting></para> </listitem> </varlistentry> <varlistentry> <term><literal>TIME ZONE</literal></term> <listitem> - <para> - <literal>SET TIME ZONE <replaceable>value</></> is an alias + <para><literal>SET TIME ZONE <replaceable>value</></> is an alias for <literal>SET timezone TO <replaceable>value</></>. The syntax <literal>SET TIME ZONE</literal> allows special syntax for the time zone specification. Here are examples of valid @@ -302,8 +298,7 @@ SET TIME ZONE 'PST8PDT'; Set the time zone for Italy: <screen> SET TIME ZONE 'Europe/Rome'; -</screen> - </para> +</screen></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/show.sgml b/doc/src/sgml/ref/show.sgml index ca26bb2687..4a6a3fc7fe 100644 --- a/doc/src/sgml/ref/show.sgml +++ b/doc/src/sgml/ref/show.sgml @@ -109,8 +109,7 @@ SHOW ALL </para> </listitem> </varlistentry> - </variablelist> - </para> + </variablelist></para> </listitem> </varlistentry> @@ -177,8 +176,7 @@ SHOW ALL; xmloption | content | Sets whether XML data in implicit parsing ... zero_damaged_pages | off | Continues processing past damaged page headers. (196 rows) -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml index 9f12ca4b3b..2fe47ca816 100644 --- a/doc/src/sgml/ref/truncate.sgml +++ b/doc/src/sgml/ref/truncate.sgml @@ -206,8 +206,7 @@ TRUNCATE bigtable, fattable RESTART IDENTITY; <programlisting> TRUNCATE othertable CASCADE; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/unlisten.sgml b/doc/src/sgml/ref/unlisten.sgml index ad3b9a12af..c6436829d6 100644 --- a/doc/src/sgml/ref/unlisten.sgml +++ b/doc/src/sgml/ref/unlisten.sgml @@ -111,8 +111,7 @@ Asynchronous notification "virtual" received from server process with PID 8448. UNLISTEN virtual; NOTIFY virtual; -- no NOTIFY event is received -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml index 5968db1f6f..ba5af8e884 100644 --- a/doc/src/sgml/ref/update.sgml +++ b/doc/src/sgml/ref/update.sgml @@ -348,8 +348,7 @@ COMMIT; <literal>c_films</> is currently positioned: <programlisting> UPDATE films SET kind = 'Dramatic' WHERE CURRENT OF c_films; -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/vacuum.sgml b/doc/src/sgml/ref/vacuum.sgml index 87283bca50..f05babc76a 100644 --- a/doc/src/sgml/ref/vacuum.sgml +++ b/doc/src/sgml/ref/vacuum.sgml @@ -254,8 +254,7 @@ CPU 0.07s/0.39u sec elapsed 1.56 sec. INFO: analyzing "public.onek" INFO: "onek": 36 pages, 1000 rows sampled, 1000 estimated total rows VACUUM -</programlisting> - </para> +</programlisting></para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index e9022fe947..4effa4188a 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -369,8 +369,7 @@ PostgreSQL documentation <literal>bar</literal> of the table for the optimizer: <screen> <prompt>$ </prompt><userinput>vacuumdb --analyze --verbose --table 'foo(bar)' xyzzy</userinput> -</screen> - </para> +</screen></para> </refsect1> diff --git a/doc/src/sgml/ref/values.sgml b/doc/src/sgml/ref/values.sgml index 552c80cf06..1f0e9a8ba1 100644 --- a/doc/src/sgml/ref/values.sgml +++ b/doc/src/sgml/ref/values.sgml @@ -214,8 +214,7 @@ UPDATE employees SET salary = salary * v.increase <programlisting> SELECT * FROM machines WHERE ip_address IN (VALUES('192.168.0.1'::inet), ('192.168.0.10'), ('192.168.1.43')); -</programlisting> - </para> +</programlisting></para> <tip> <para> @@ -230,8 +229,7 @@ WHERE ip_address IN (VALUES('192.168.0.1'::inet), ('192.168.0.10'), ('192.168.1. <refsect1> <title>Compatibility</title> - <para> - <command>VALUES</command> conforms to the SQL standard. + <para><command>VALUES</command> conforms to the SQL standard. <literal>LIMIT</literal> and <literal>OFFSET</literal> are <productname>PostgreSQL</productname> extensions; see also under <xref linkend="sql-select">. diff --git a/doc/src/sgml/sepgsql.sgml b/doc/src/sgml/sepgsql.sgml index fa42c191a1..fc379885d8 100644 --- a/doc/src/sgml/sepgsql.sgml +++ b/doc/src/sgml/sepgsql.sgml @@ -147,7 +147,7 @@ $ for DBNAME in template0 template1 postgres; do Second, build and install the policy package for the regression test. The <filename>sepgsql-regtest.pp</> is a special purpose policy package which provides a set of rules to be allowed during the regression tests. - It should be built from the policy source file + It should be built from the policy source file (<filename>sepgsql-regtest.te</>), which is normally done using <command>make</command>. You will need to locate the appropriate Makefile on your system; the path shown below is only an example. diff --git a/doc/src/sgml/spi.sgml b/doc/src/sgml/spi.sgml index 0d65c78b08..1b41cb40b3 100644 --- a/doc/src/sgml/spi.sgml +++ b/doc/src/sgml/spi.sgml @@ -392,8 +392,7 @@ typedef struct TupleDesc tupdesc; /* row descriptor */ HeapTuple *vals; /* rows */ } SPITupleTable; -</programlisting> - <structfield>vals</> is an array of pointers to rows. (The number +</programlisting><structfield>vals</> is an array of pointers to rows. (The number of valid entries is given by <varname>SPI_processed</varname>.) <structfield>tupdesc</> is a row descriptor which you can pass to SPI functions dealing with rows. <structfield>tuptabcxt</>, @@ -425,9 +424,7 @@ typedef struct <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> @@ -803,9 +800,7 @@ int SPI_execute_with_args(const char *<parameter>command</parameter>, <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> @@ -1421,9 +1416,7 @@ int SPI_execute_plan(SPIPlanPtr <parameter>plan</parameter>, Datum * <parameter> <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> @@ -1540,9 +1533,7 @@ int SPI_execute_plan_with_paramlist(SPIPlanPtr <parameter>plan</parameter>, <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> @@ -1777,9 +1768,7 @@ Portal SPI_cursor_open(const char * <parameter>name</parameter>, SPIPlanPtr <par <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> </variablelist> @@ -1915,9 +1904,7 @@ Portal SPI_cursor_open_with_args(const char *<parameter>name</parameter>, <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> @@ -2022,9 +2009,7 @@ Portal SPI_cursor_open_with_paramlist(const char *<parameter>name</parameter>, <varlistentry> <term><literal>bool <parameter>read_only</parameter></literal></term> <listitem> - <para> - <literal>true</> for read-only execution - </para> + <para><literal>true</> for read-only execution</para> </listitem> </varlistentry> </variablelist> diff --git a/doc/src/sgml/stylesheet-man.xsl b/doc/src/sgml/stylesheet-man.xsl index 8c614ca754..822b082522 100644 --- a/doc/src/sgml/stylesheet-man.xsl +++ b/doc/src/sgml/stylesheet-man.xsl @@ -8,19 +8,6 @@ <xsl:import href="stylesheet-common.xsl" /> -<!-- The following is a workaround for what may actually be a mistake - in our markup. The problem is in a situation like - -<para> - <command>FOO</command> is ... - - there is strictly speaking a line break before "FOO". In the - HTML output, this does not appear to be a problem, but in the man - page output, this shows up. Using this setting, pure whitespace - text nodes are removed, so the problem is solved. --> -<xsl:strip-space elements="para"/> - - <!-- Parameters --> <xsl:param name="man.authors.section.enabled">0</xsl:param> diff --git a/doc/src/sgml/vacuumlo.sgml b/doc/src/sgml/vacuumlo.sgml index 471a6ca32b..0ae39c71d2 100644 --- a/doc/src/sgml/vacuumlo.sgml +++ b/doc/src/sgml/vacuumlo.sgml @@ -57,6 +57,16 @@ vacuumlo [options] database [database2 ... databaseN] </varlistentry> <varlistentry> + <term><option>-l</option> <replaceable>limit</></term> + <listitem> + <para> + Stop after removing LIMIT large objects. Useful to avoid + exceeding <xref linkend="guc-max-locks-per-transaction">. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>-w</></term> <term><option>--no-password</></term> <listitem> diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 4656dba642..9e931df4b1 100644 --- a/src/backend/access/common/tupdesc.c +++ b/src/backend/access/common/tupdesc.c @@ -363,7 +363,7 @@ equalTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2) return false; if (attr1->attcollation != attr2->attcollation) return false; - /* attacl and attoptions are not even present... */ + /* attacl, attoptions and attfdwoptions are not even present... */ } if (tupdesc1->constr != NULL) @@ -483,7 +483,7 @@ TupleDescInitEntry(TupleDesc desc, att->attisdropped = false; att->attislocal = true; att->attinhcount = 0; - /* attacl and attoptions are not present in tupledescs */ + /* attacl, attoptions and attfdwoptions are not present in tupledescs */ tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(oidtypeid)); if (!HeapTupleIsValid(tuple)) diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 0aeaf5bfd7..d91af529f4 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -369,7 +369,8 @@ sub emit_pgattr_row attislocal => 't', attinhcount => '0', attacl => '_null_', - attoptions => '_null_' + attoptions => '_null_', + attfdwoptions => '_null_' ); return {%PGATTR_DEFAULTS, %row}; } @@ -400,6 +401,7 @@ sub emit_schemapg_row # Only the fixed-size portions of the descriptors are ever used. delete $row->{attacl}; delete $row->{attoptions}; + delete $row->{attfdwoptions}; # Expand booleans from 'f'/'t' to 'false'/'true'. # Some values might be other macros (eg FLOAT4PASSBYVAL), don't change. diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 4399493625..7ec658146f 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -126,7 +126,7 @@ static List *insert_ordered_unique_oid(List *list, Oid datum); */ /* - * The initializers below do not include the attoptions or attacl fields, + * The initializers below do not include trailing variable length fields, * but that's OK - we're never going to reference anything beyond the * fixed-size portion of the structure anyway. */ @@ -620,6 +620,7 @@ InsertPgAttributeTuple(Relation pg_attribute_rel, /* start out with empty permissions and empty options */ nulls[Anum_pg_attribute_attacl - 1] = true; nulls[Anum_pg_attribute_attoptions - 1] = true; + nulls[Anum_pg_attribute_attfdwoptions - 1] = true; tup = heap_form_tuple(RelationGetDescr(pg_attribute_rel), values, nulls); diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql index 80cd091ec8..47c48bfb27 100644 --- a/src/backend/catalog/information_schema.sql +++ b/src/backend/catalog/information_schema.sql @@ -2534,6 +2534,39 @@ GRANT SELECT ON element_types TO PUBLIC; -- SQL/MED views; these use section numbers from part 9 of the standard. +/* Base view for foreign table columns */ +CREATE VIEW _pg_foreign_table_columns AS + SELECT n.nspname, + c.relname, + a.attname, + a.attfdwoptions + FROM pg_foreign_table t, pg_authid u, pg_namespace n, pg_class c, + pg_attribute a + WHERE u.oid = c.relowner + AND (pg_has_role(c.relowner, 'USAGE') + OR has_column_privilege(c.oid, a.attnum, 'SELECT, INSERT, UPDATE, REFERENCES')) + AND n.oid = c.relnamespace + AND c.oid = t.ftrelid + AND c.relkind = 'f' + AND a.attrelid = c.oid + AND a.attnum > 0; + +/* + * 24.2 + * COLUMN_OPTIONS view + */ +CREATE VIEW column_options AS + SELECT CAST(current_database() AS sql_identifier) AS table_catalog, + c.nspname AS table_schema, + c.relname AS table_name, + c.attname AS column_name, + CAST((pg_options_to_table(c.attfdwoptions)).option_name AS sql_identifier) AS option_name, + CAST((pg_options_to_table(c.attfdwoptions)).option_value AS character_data) AS option_value + FROM _pg_foreign_table_columns c; + +GRANT SELECT ON column_options TO PUBLIC; + + /* Base view for foreign-data wrappers */ CREATE VIEW _pg_foreign_data_wrappers AS SELECT w.oid, diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 82bb756c75..4509cdab90 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -346,6 +346,8 @@ static void ATPrepAlterColumnType(List **wqueue, static bool ATColumnChangeRequiresRewrite(Node *expr, AttrNumber varattno); static void ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd, LOCKMODE lockmode); +static void ATExecAlterColumnGenericOptions(Relation rel, const char *colName, + List *options, LOCKMODE lockmode); static void ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode); static void ATPostAlterTypeParse(Oid oldId, char *cmd, List **wqueue, LOCKMODE lockmode, bool rewrite); @@ -2648,6 +2650,7 @@ AlterTableGetLockLevel(List *cmds) case AT_DropNotNull: /* may change some SQL plans */ case AT_SetNotNull: case AT_GenericOptions: + case AT_AlterColumnGenericOptions: cmd_lockmode = AccessExclusiveLock; break; @@ -2925,6 +2928,12 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, ATPrepAlterColumnType(wqueue, tab, rel, recurse, recursing, cmd, lockmode); pass = AT_PASS_ALTER_TYPE; break; + case AT_AlterColumnGenericOptions: + ATSimplePermissions(rel, ATT_FOREIGN_TABLE); + /* This command never recurses */ + /* No command-specific prep needed */ + pass = AT_PASS_MISC; + break; case AT_ChangeOwner: /* ALTER OWNER */ /* This command never recurses */ /* No command-specific prep needed */ @@ -3169,6 +3178,9 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, case AT_AlterColumnType: /* ALTER COLUMN TYPE */ ATExecAlterColumnType(tab, rel, cmd, lockmode); break; + case AT_AlterColumnGenericOptions: /* ALTER COLUMN OPTIONS */ + ATExecAlterColumnGenericOptions(rel, cmd->name, (List *) cmd->def, lockmode); + break; case AT_ChangeOwner: /* ALTER OWNER */ ATExecChangeOwner(RelationGetRelid(rel), get_role_oid(cmd->name, false), @@ -7397,6 +7409,100 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, heap_freetuple(heapTup); } +static void +ATExecAlterColumnGenericOptions(Relation rel, + const char *colName, + List *options, + LOCKMODE lockmode) +{ + Relation ftrel; + Relation attrel; + ForeignServer *server; + ForeignDataWrapper *fdw; + HeapTuple tuple; + HeapTuple newtuple; + bool isnull; + Datum repl_val[Natts_pg_attribute]; + bool repl_null[Natts_pg_attribute]; + bool repl_repl[Natts_pg_attribute]; + Datum datum; + Form_pg_foreign_table fttableform; + Form_pg_attribute atttableform; + + if (options == NIL) + return; + + /* First, determine FDW validator associated to the foreign table. */ + ftrel = heap_open(ForeignTableRelationId, AccessShareLock); + tuple = SearchSysCache1(FOREIGNTABLEREL, rel->rd_id); + if (!HeapTupleIsValid(tuple)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("foreign table \"%s\" does not exist", + RelationGetRelationName(rel)))); + fttableform = (Form_pg_foreign_table) GETSTRUCT(tuple); + server = GetForeignServer(fttableform->ftserver); + fdw = GetForeignDataWrapper(server->fdwid); + + heap_close(ftrel, AccessShareLock); + ReleaseSysCache(tuple); + + attrel = heap_open(AttributeRelationId, RowExclusiveLock); + tuple = SearchSysCacheAttName(RelationGetRelid(rel), colName); + if (!HeapTupleIsValid(tuple)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_COLUMN), + errmsg("column \"%s\" of relation \"%s\" does not exist", + colName, RelationGetRelationName(rel)))); + + /* Prevent them from altering a system attribute */ + atttableform = (Form_pg_attribute) GETSTRUCT(tuple); + if (atttableform->attnum <= 0) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot alter system column \"%s\"", colName))); + + + /* Initialize buffers for new tuple values */ + memset(repl_val, 0, sizeof(repl_val)); + memset(repl_null, false, sizeof(repl_null)); + memset(repl_repl, false, sizeof(repl_repl)); + + /* Extract the current options */ + datum = SysCacheGetAttr(ATTNAME, + tuple, + Anum_pg_attribute_attfdwoptions, + &isnull); + if (isnull) + datum = PointerGetDatum(NULL); + + /* Transform the options */ + datum = transformGenericOptions(AttributeRelationId, + datum, + options, + fdw->fdwvalidator); + + if (PointerIsValid(DatumGetPointer(datum))) + repl_val[Anum_pg_attribute_attfdwoptions - 1] = datum; + else + repl_null[Anum_pg_attribute_attfdwoptions - 1] = true; + + repl_repl[Anum_pg_attribute_attfdwoptions - 1] = true; + + /* Everything looks good - update the tuple */ + + newtuple = heap_modify_tuple(tuple, RelationGetDescr(attrel), + repl_val, repl_null, repl_repl); + ReleaseSysCache(tuple); + + simple_heap_update(attrel, &newtuple->t_self, newtuple); + CatalogUpdateIndexes(attrel, newtuple); + + heap_close(attrel, RowExclusiveLock); + + heap_freetuple(newtuple); +} + /* * Cleanup after we've finished all the ALTER TYPE operations for a * particular relation. We have to drop and recreate all the indexes diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 7a5145621f..d0704ed071 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -2312,6 +2312,7 @@ _copyColumnDef(ColumnDef *from) COPY_NODE_FIELD(collClause); COPY_SCALAR_FIELD(collOid); COPY_NODE_FIELD(constraints); + COPY_NODE_FIELD(fdwoptions); return newnode; } diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index b5be09af1a..417aeb8822 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -2102,6 +2102,7 @@ _outColumnDef(StringInfo str, ColumnDef *node) WRITE_NODE_FIELD(collClause); WRITE_OID_FIELD(collOid); WRITE_NODE_FIELD(constraints); + WRITE_NODE_FIELD(fdwoptions); } static void diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index ac094aa5f3..e9f3896bad 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -1769,6 +1769,15 @@ alter_table_cmd: def->raw_default = $8; $$ = (Node *)n; } + /* ALTER FOREIGN TABLE <name> ALTER [COLUMN] <colname> OPTIONS */ + | ALTER opt_column ColId alter_generic_options + { + AlterTableCmd *n = makeNode(AlterTableCmd); + n->subtype = AT_AlterColumnGenericOptions; + n->name = $3; + n->def = (Node *) $4; + $$ = (Node *)n; + } /* ALTER TABLE <name> ADD CONSTRAINT ... */ | ADD_P TableConstraint { @@ -2497,7 +2506,7 @@ TypedTableElement: | TableConstraint { $$ = $1; } ; -columnDef: ColId Typename ColQualList +columnDef: ColId Typename create_generic_options ColQualList { ColumnDef *n = makeNode(ColumnDef); n->colname = $1; @@ -2510,7 +2519,8 @@ columnDef: ColId Typename ColQualList n->raw_default = NULL; n->cooked_default = NULL; n->collOid = InvalidOid; - SplitColQualList($3, &n->constraints, &n->collClause, + n->fdwoptions = $3; + SplitColQualList($4, &n->constraints, &n->collClause, yyscanner); $$ = (Node *)n; } diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 1be2ac68a5..21b54f7f15 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -559,6 +559,31 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) break; } } + + /* + * Generate ALTER FOREIGN TABLE ALTER COLUMN statement which adds + * per-column foreign data wrapper options for this column. + */ + if (column->fdwoptions != NIL) + { + AlterTableStmt *stmt; + AlterTableCmd *cmd; + + cmd = makeNode(AlterTableCmd); + cmd->subtype = AT_AlterColumnGenericOptions; + cmd->name = column->colname; + cmd->def = (Node *) column->fdwoptions; + cmd->behavior = DROP_RESTRICT; + cmd->missing_ok = false; + + stmt = makeNode(AlterTableStmt); + stmt->relation = cxt->relation; + stmt->cmds = NIL; + stmt->relkind = OBJECT_FOREIGN_TABLE; + stmt->cmds = lappend(stmt->cmds, cmd); + + cxt->alist = lappend(cxt->alist, stmt); + } } /* diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y index 4930ad1d09..d99708ca8e 100644 --- a/src/backend/replication/repl_gram.y +++ b/src/backend/replication/repl_gram.y @@ -16,10 +16,10 @@ #include "postgres.h" #include "nodes/makefuncs.h" -#include "nodes/parsenodes.h" -#include "replication/replnodes.h" +#include "nodes/replnodes.h" #include "replication/walsender.h" + /* Result of the parsing is returned here */ Node *replication_parse_result; diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 63a63048db..7f83a32c0c 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -37,16 +37,16 @@ #include <signal.h> #include <unistd.h> -#include "funcapi.h" -#include "access/xlog_internal.h" #include "access/transam.h" +#include "access/xlog_internal.h" #include "catalog/pg_type.h" +#include "funcapi.h" #include "libpq/libpq.h" #include "libpq/pqformat.h" #include "libpq/pqsignal.h" #include "miscadmin.h" +#include "nodes/replnodes.h" #include "replication/basebackup.h" -#include "replication/replnodes.h" #include "replication/walprotocol.h" #include "replication/walreceiver.h" #include "replication/walsender.h" diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 7c7927509b..6e8e5aef4e 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -105,11 +105,12 @@ int Log_destination = LOG_DESTINATION_STDERR; /* * Max string length to send to syslog(). Note that this doesn't count the * sequence-number prefix we add, and of course it doesn't count the prefix - * added by syslog itself. On many implementations it seems that the hard - * limit is approximately 2K bytes including both those prefixes. + * added by syslog itself. Solaris and sysklogd truncate the final message + * at 1024 bytes, so this value leaves 124 bytes for those prefixes. (Most + * other syslog implementations seem to have limits of 2KB or so.) */ #ifndef PG_SYSLOG_LIMIT -#define PG_SYSLOG_LIMIT 1024 +#define PG_SYSLOG_LIMIT 900 #endif static bool openlog_done = false; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index f2ee57cabd..cf0fc4b5d3 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -5574,6 +5574,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) int i_attislocal; int i_attoptions; int i_attcollation; + int i_attfdwoptions; PGresult *res; int ntups; bool hasdefaults; @@ -5611,7 +5612,31 @@ getTableAttrs(TableInfo *tblinfo, int numTables) resetPQExpBuffer(q); - if (g_fout->remoteVersion >= 90100) + if (g_fout->remoteVersion >= 90200) + { + /* + * attfdwoptions is new in 9.2. + */ + appendPQExpBuffer(q, "SELECT a.attnum, a.attname, a.atttypmod, " + "a.attstattarget, a.attstorage, t.typstorage, " + "a.attnotnull, a.atthasdef, a.attisdropped, " + "a.attlen, a.attalign, a.attislocal, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "array_to_string(a.attoptions, ', ') AS attoptions, " + "CASE WHEN a.attcollation <> t.typcollation " + "THEN a.attcollation ELSE 0 END AS attcollation, " + "array_to_string(ARRAY(" + " SELECT option_name || ' ' || quote_literal(option_value) " + " FROM pg_options_to_table(attfdwoptions)), ', ') " + " AS attfdwoptions " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "ON a.atttypid = t.oid " + "WHERE a.attrelid = '%u'::pg_catalog.oid " + "AND a.attnum > 0::pg_catalog.int2 " + "ORDER BY a.attrelid, a.attnum", + tbinfo->dobj.catId.oid); + } + else if (g_fout->remoteVersion >= 90100) { /* * attcollation is new in 9.1. Since we only want to dump COLLATE @@ -5626,7 +5651,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " "array_to_string(a.attoptions, ', ') AS attoptions, " "CASE WHEN a.attcollation <> t.typcollation " - "THEN a.attcollation ELSE 0 END AS attcollation " + "THEN a.attcollation ELSE 0 END AS attcollation, " + "NULL AS attfdwoptions " "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " @@ -5643,7 +5669,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "a.attlen, a.attalign, a.attislocal, " "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " "array_to_string(a.attoptions, ', ') AS attoptions, " - "0 AS attcollation " + "0 AS attcollation, " + "NULL AS attfdwoptions " "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " @@ -5659,7 +5686,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " - "'' AS attoptions, 0 AS attcollation " + "'' AS attoptions, 0 AS attcollation, " + "NULL AS attfdwoptions " "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " @@ -5680,7 +5708,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "false AS attisdropped, a.attlen, " "a.attalign, false AS attislocal, " "format_type(t.oid,a.atttypmod) AS atttypname, " - "'' AS attoptions, 0 AS attcollation " + "'' AS attoptions, 0 AS attcollation, " + "NULL AS attfdwoptions " "FROM pg_attribute a LEFT JOIN pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::oid " @@ -5698,7 +5727,8 @@ getTableAttrs(TableInfo *tblinfo, int numTables) "attlen, attalign, " "false AS attislocal, " "(SELECT typname FROM pg_type WHERE oid = atttypid) AS atttypname, " - "'' AS attoptions, 0 AS attcollation " + "'' AS attoptions, 0 AS attcollation, " + "NULL AS attfdwoptions " "FROM pg_attribute a " "WHERE attrelid = '%u'::oid " "AND attnum > 0::int2 " @@ -5726,6 +5756,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) i_attislocal = PQfnumber(res, "attislocal"); i_attoptions = PQfnumber(res, "attoptions"); i_attcollation = PQfnumber(res, "attcollation"); + i_attfdwoptions = PQfnumber(res, "attfdwoptions"); tbinfo->numatts = ntups; tbinfo->attnames = (char **) malloc(ntups * sizeof(char *)); @@ -5742,6 +5773,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) tbinfo->attrdefs = (AttrDefInfo **) malloc(ntups * sizeof(AttrDefInfo *)); tbinfo->attoptions = (char **) malloc(ntups * sizeof(char *)); tbinfo->attcollation = (Oid *) malloc(ntups * sizeof(Oid)); + tbinfo->attfdwoptions = (char **) malloc(ntups * sizeof(char *)); tbinfo->inhAttrs = (bool *) malloc(ntups * sizeof(bool)); tbinfo->inhAttrDef = (bool *) malloc(ntups * sizeof(bool)); tbinfo->inhNotNull = (bool *) malloc(ntups * sizeof(bool)); @@ -5768,6 +5800,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) tbinfo->notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't'); tbinfo->attoptions[j] = strdup(PQgetvalue(res, j, i_attoptions)); tbinfo->attcollation[j] = atooid(PQgetvalue(res, j, i_attcollation)); + tbinfo->attfdwoptions[j] = strdup(PQgetvalue(res, j, i_attfdwoptions)); tbinfo->attrdefs[j] = NULL; /* fix below */ if (PQgetvalue(res, j, i_atthasdef)[0] == 't') hasdefaults = true; @@ -12469,6 +12502,21 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(q, "SET (%s);\n", tbinfo->attoptions[j]); } + + /* + * Dump per-column fdw options. + */ + if (tbinfo->relkind == RELKIND_FOREIGN_TABLE && + tbinfo->attfdwoptions[j] && + tbinfo->attfdwoptions[j][0] != '\0') + { + appendPQExpBuffer(q, "ALTER FOREIGN TABLE %s ", + fmtId(tbinfo->dobj.name)); + appendPQExpBuffer(q, "ALTER COLUMN %s ", + fmtId(tbinfo->attnames[j])); + appendPQExpBuffer(q, "OPTIONS (%s);\n", + tbinfo->attfdwoptions[j]); + } } } diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index c95614b16f..3d5d534269 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -275,6 +275,7 @@ typedef struct _tableInfo bool *attislocal; /* true if attr has local definition */ char **attoptions; /* per-attribute options */ Oid *attcollation; /* per-attribute collation selection */ + char **attfdwoptions; /* per-attribute fdw options */ /* * Note: we need to store per-attribute notnull, default, and constraint diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index e46568654e..a8d5ddc96c 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -1281,7 +1281,12 @@ describeOneTableDetails(const char *schemaname, res = NULL; } - /* Get column info */ + /* + * Get column info + * + * You need to modify value of "firstvcol" which willbe defined below if + * you are adding column(s) preceding to verbose-only columns. + */ printfPQExpBuffer(&buf, "SELECT a.attname,"); appendPQExpBuffer(&buf, "\n pg_catalog.format_type(a.atttypid, a.atttypmod)," "\n (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)" @@ -1295,6 +1300,12 @@ describeOneTableDetails(const char *schemaname, appendPQExpBuffer(&buf, "\n NULL AS attcollation"); if (tableinfo.relkind == 'i') appendPQExpBuffer(&buf, ",\n pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef"); + else + appendPQExpBuffer(&buf, ",\n NULL AS indexdef"); + if (tableinfo.relkind == 'f' && pset.sversion >= 90200) + appendPQExpBuffer(&buf, ",\n a.attfdwoptions"); + else + appendPQExpBuffer(&buf, ",\n NULL AS attfdwoptions"); if (verbose) { appendPQExpBuffer(&buf, ",\n a.attstorage"); @@ -1386,6 +1397,9 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.relkind == 'i') headers[cols++] = gettext_noop("Definition"); + if (tableinfo.relkind == 'f' && pset.sversion >= 90200) + headers[cols++] = gettext_noop("Options"); + if (verbose) { headers[cols++] = gettext_noop("Storage"); @@ -1471,10 +1485,14 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.relkind == 'i') printTableAddCell(&cont, PQgetvalue(res, i, 6), false, false); + /* FDW options for foreign table column, only for 9.2 or later */ + if (tableinfo.relkind == 'f' && pset.sversion >= 90200) + printTableAddCell(&cont, PQgetvalue(res, i, 7), false, false); + /* Storage and Description */ if (verbose) { - int firstvcol = (tableinfo.relkind == 'i' ? 7 : 6); + int firstvcol = 8; char *storage = PQgetvalue(res, i, firstvcol); /* these strings are literal in our syntax, so not translated. */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 2fadf30792..f5c9797c60 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201107201 +#define CATALOG_VERSION_NO 201108051 #endif diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 409d6ea3e7..3ea87e8229 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -156,6 +156,9 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK /* Column-level options */ text attoptions[1]; + + /* Column-level FDW options */ + text attfdwoptions[1]; } FormData_pg_attribute; /* @@ -179,7 +182,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; * ---------------- */ -#define Natts_pg_attribute 20 +#define Natts_pg_attribute 21 #define Anum_pg_attribute_attrelid 1 #define Anum_pg_attribute_attname 2 #define Anum_pg_attribute_atttypid 3 @@ -200,6 +203,7 @@ typedef FormData_pg_attribute *Form_pg_attribute; #define Anum_pg_attribute_attcollation 18 #define Anum_pg_attribute_attacl 19 #define Anum_pg_attribute_attoptions 20 +#define Anum_pg_attribute_attfdwoptions 21 /* ---------------- diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 002ae6b59c..e00618026e 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -132,7 +132,7 @@ typedef FormData_pg_class *Form_pg_class; /* Note: "3" in the relfrozenxid column stands for FirstNormalTransactionId */ DATA(insert OID = 1247 ( pg_type PGNSP 71 0 PGUID 0 0 0 0 0 0 0 f f p r 29 0 t f f f f 3 _null_ _null_ )); DESCR(""); -DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 20 0 f f f f f 3 _null_ _null_ )); +DATA(insert OID = 1249 ( pg_attribute PGNSP 75 0 PGUID 0 0 0 0 0 0 0 f f p r 21 0 f f f f f 3 _null_ _null_ )); DESCR(""); DATA(insert OID = 1255 ( pg_proc PGNSP 81 0 PGUID 0 0 0 0 0 0 0 f f p r 26 0 t f f f f 3 _null_ _null_ )); DESCR(""); diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index d8bc6b8214..ecf62b335b 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -403,6 +403,13 @@ typedef enum NodeTag T_CommonTableExpr, /* + * TAGS FOR REPLICATION GRAMMAR PARSE NODES (replnodes.h) + */ + T_IdentifySystemCmd, + T_BaseBackupCmd, + T_StartReplicationCmd, + + /* * TAGS FOR RANDOM OTHER STUFF * * These are objects that aren't part of parse/plan/execute node tree diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 92e40d3fb5..a4fb3b5f7f 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -500,6 +500,7 @@ typedef struct ColumnDef CollateClause *collClause; /* untransformed COLLATE spec, if any */ Oid collOid; /* collation OID (InvalidOid if not set) */ List *constraints; /* other constraints on column */ + List *fdwoptions; /* per-column FDW options */ } ColumnDef; /* @@ -1197,6 +1198,7 @@ typedef enum AlterTableType AT_DropConstraint, /* drop constraint */ AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */ AT_AlterColumnType, /* alter column type */ + AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ AT_ChangeOwner, /* change owner */ AT_ClusterOn, /* CLUSTER ON */ AT_DropCluster, /* SET WITHOUT CLUSTER */ diff --git a/src/include/replication/replnodes.h b/src/include/nodes/replnodes.h index e027f9203b..8cbd18a24c 100644 --- a/src/include/replication/replnodes.h +++ b/src/include/nodes/replnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * src/include/replication/replnodes.h + * src/include/nodes/replnodes.h * *------------------------------------------------------------------------- */ @@ -15,18 +15,8 @@ #define REPLNODES_H #include "access/xlogdefs.h" -#include "nodes/primnodes.h" -#include "nodes/value.h" +#include "nodes/pg_list.h" -/* - * NodeTags for replication parser - */ -typedef enum ReplNodeTag -{ - T_IdentifySystemCmd = 10, - T_BaseBackupCmd, - T_StartReplicationCmd -} ReplNodeTag; /* ---------------------- * IDENTIFY_SYSTEM command diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 3c38aa0200..e568a03519 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -4,7 +4,7 @@ /* This file is generated from MingW ./configure, and with the following * changes to be valid for Visual C++ (and compatible): * - * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_GETOPT, HAVE_GETOPT_H, + * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_GETOPT, HAVE_GETOPT_H, HAVE_INTTYPES_H, * HAVE_GETOPT_LONG, HAVE_LOCALE_T, HAVE_RINT, HAVE_STRINGS_H, HAVE_STRTOLL, * HAVE_STRTOULL, HAVE_STRUCT_OPTION, ENABLE_THREAD_SAFETY, * USE_INLINE, inline @@ -185,7 +185,7 @@ /* #undef HAVE_INT8 */ /* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 +//#define HAVE_INTTYPES_H 1 /* Define to 1 if you have the global variable 'int timezone'. */ #define HAVE_INT_TIMEZONE diff --git a/src/include/replication/basebackup.h b/src/include/replication/basebackup.h index 831c33fb4a..7ce1f38372 100644 --- a/src/include/replication/basebackup.h +++ b/src/include/replication/basebackup.h @@ -5,14 +5,14 @@ * * Portions Copyright (c) 2010-2011, PostgreSQL Global Development Group * - * src/include/replication/walsender.h + * src/include/replication/basebackup.h * *------------------------------------------------------------------------- */ #ifndef _BASEBACKUP_H #define _BASEBACKUP_H -#include "replication/replnodes.h" +#include "nodes/replnodes.h" extern void SendBaseBackup(BaseBackupCmd *cmd); diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out index 2b3eddfc8b..45292b5fde 100644 --- a/src/test/regress/expected/foreign_data.out +++ b/src/test/regress/expected/foreign_data.out @@ -646,19 +646,19 @@ ERROR: syntax error at or near "WITH OIDS" LINE 1: CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS; ^ CREATE FOREIGN TABLE ft1 ( - c1 integer NOT NULL, - c2 text, + c1 integer OPTIONS (param1 'val1') NOT NULL, + c2 text OPTIONS (param2 'val2', param3 'val3'), c3 date ) SERVER sc OPTIONS (delimiter ',', quote '"'); COMMENT ON FOREIGN TABLE ft1 IS 'ft1'; COMMENT ON COLUMN ft1.c1 IS 'ft1.c1'; \d+ ft1 - Foreign table "public.ft1" - Column | Type | Modifiers | Storage | Description ---------+---------+-----------+----------+------------- - c1 | integer | not null | plain | ft1.c1 - c2 | text | | extended | - c3 | date | | plain | + Foreign table "public.ft1" + Column | Type | Modifiers | Options | Storage | Description +--------+---------+-----------+---------------------------+----------+------------- + c1 | integer | not null | {param1=val1} | plain | ft1.c1 + c2 | text | | {param2=val2,param3=val3} | extended | + c3 | date | | | plain | Server: sc Has OIDs: no @@ -687,7 +687,7 @@ ALTER FOREIGN TABLE ft1 ADD COLUMN c6 integer; ALTER FOREIGN TABLE ft1 ADD COLUMN c7 integer NOT NULL; ALTER FOREIGN TABLE ft1 ADD COLUMN c8 integer; ALTER FOREIGN TABLE ft1 ADD COLUMN c9 integer; -ALTER FOREIGN TABLE ft1 ADD COLUMN c10 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c10 integer OPTIONS (p1 'v1'); ALTER FOREIGN TABLE ft1 ALTER COLUMN c4 SET DEFAULT 0; -- ERROR ERROR: "ft1" is not a table or view ALTER FOREIGN TABLE ft1 ALTER COLUMN c5 DROP DEFAULT; -- ERROR @@ -698,6 +698,27 @@ ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10) USING '0'; -- ERROR ERROR: "ft1" is not a table ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10); ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE text; +ALTER FOREIGN TABLE ft1 ALTER COLUMN xmin OPTIONS (ADD p1 'v1'); -- ERROR +ERROR: cannot alter system column "xmin" +ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 OPTIONS (ADD p1 'v1', ADD p2 'v2'), + ALTER COLUMN c8 OPTIONS (ADD p1 'v1', ADD p2 'v2'); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1); +\d+ ft1 + Foreign table "public.ft1" + Column | Type | Modifiers | Options | Storage | Description +--------+---------+-----------+---------------------------+----------+------------- + c1 | integer | not null | {param1=val1} | plain | + c2 | text | | {param2=val2,param3=val3} | extended | + c3 | date | | | plain | + c4 | integer | | | plain | + c6 | integer | not null | | plain | + c7 | integer | | {p1=v1,p2=v2} | plain | + c8 | text | | {p2=V2} | extended | + c9 | integer | | | plain | + c10 | integer | | {p1=v1} | plain | +Server: sc +Has OIDs: no + -- can't change the column type if it's used elsewhere CREATE TABLE use_ft1_column_type (x ft1); ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE integer; -- ERROR @@ -726,17 +747,17 @@ ERROR: relation "ft1" does not exist ALTER FOREIGN TABLE foreign_schema.ft1 RENAME c1 TO foreign_column_1; ALTER FOREIGN TABLE foreign_schema.ft1 RENAME TO foreign_table_1; \d foreign_schema.foreign_table_1 -Foreign table "foreign_schema.foreign_table_1" - Column | Type | Modifiers -------------------+---------+----------- - foreign_column_1 | integer | not null - c2 | text | - c3 | date | - c4 | integer | - c6 | integer | not null - c7 | integer | - c8 | text | - c10 | integer | + Foreign table "foreign_schema.foreign_table_1" + Column | Type | Modifiers | Options +------------------+---------+-----------+--------------------------- + foreign_column_1 | integer | not null | {param1=val1} + c2 | text | | {param2=val2,param3=val3} + c3 | date | | + c4 | integer | | + c6 | integer | not null | + c7 | integer | | {p1=v1,p2=v2} + c8 | text | | {p2=V2} + c10 | integer | | {p1=v1} Server: sc -- Information schema diff --git a/src/test/regress/sql/foreign_data.sql b/src/test/regress/sql/foreign_data.sql index 58e5060477..b3b49cc2e3 100644 --- a/src/test/regress/sql/foreign_data.sql +++ b/src/test/regress/sql/foreign_data.sql @@ -264,8 +264,8 @@ CREATE FOREIGN TABLE ft1 () SERVER no_server; -- ERROR CREATE FOREIGN TABLE ft1 (c1 serial) SERVER sc; -- ERROR CREATE FOREIGN TABLE ft1 () SERVER sc WITH OIDS; -- ERROR CREATE FOREIGN TABLE ft1 ( - c1 integer NOT NULL, - c2 text, + c1 integer OPTIONS (param1 'val1') NOT NULL, + c2 text OPTIONS (param2 'val2', param3 'val3'), c3 date ) SERVER sc OPTIONS (delimiter ',', quote '"'); COMMENT ON FOREIGN TABLE ft1 IS 'ft1'; @@ -288,7 +288,7 @@ ALTER FOREIGN TABLE ft1 ADD COLUMN c6 integer; ALTER FOREIGN TABLE ft1 ADD COLUMN c7 integer NOT NULL; ALTER FOREIGN TABLE ft1 ADD COLUMN c8 integer; ALTER FOREIGN TABLE ft1 ADD COLUMN c9 integer; -ALTER FOREIGN TABLE ft1 ADD COLUMN c10 integer; +ALTER FOREIGN TABLE ft1 ADD COLUMN c10 integer OPTIONS (p1 'v1'); ALTER FOREIGN TABLE ft1 ALTER COLUMN c4 SET DEFAULT 0; -- ERROR ALTER FOREIGN TABLE ft1 ALTER COLUMN c5 DROP DEFAULT; -- ERROR @@ -297,6 +297,11 @@ ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 DROP NOT NULL; ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10) USING '0'; -- ERROR ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE char(10); ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE text; +ALTER FOREIGN TABLE ft1 ALTER COLUMN xmin OPTIONS (ADD p1 'v1'); -- ERROR +ALTER FOREIGN TABLE ft1 ALTER COLUMN c7 OPTIONS (ADD p1 'v1', ADD p2 'v2'), + ALTER COLUMN c8 OPTIONS (ADD p1 'v1', ADD p2 'v2'); +ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 OPTIONS (SET p2 'V2', DROP p1); +\d+ ft1 -- can't change the column type if it's used elsewhere CREATE TABLE use_ft1_column_type (x ft1); ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 SET DATA TYPE integer; -- ERROR |