summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/brin.sgml2
-rw-r--r--doc/src/sgml/catalogs.sgml8
-rw-r--r--doc/src/sgml/config.sgml2
-rwxr-xr-xdoc/src/sgml/ddl.sgml2
-rw-r--r--doc/src/sgml/dfunc.sgml26
-rw-r--r--doc/src/sgml/ecpg.sgml5
-rw-r--r--doc/src/sgml/external-projects.sgml48
-rw-r--r--doc/src/sgml/func.sgml2
-rw-r--r--doc/src/sgml/high-availability.sgml4
-rw-r--r--doc/src/sgml/information_schema.sgml26
-rw-r--r--doc/src/sgml/keywords.sgml44
-rw-r--r--doc/src/sgml/libpq.sgml8
-rw-r--r--doc/src/sgml/monitoring.sgml4
-rw-r--r--doc/src/sgml/parallel.sgml2
-rw-r--r--doc/src/sgml/pgstattuple.sgml14
-rw-r--r--doc/src/sgml/postgres-fdw.sgml2
-rw-r--r--doc/src/sgml/protocol.sgml4
-rw-r--r--doc/src/sgml/ref/alter_aggregate.sgml3
-rw-r--r--doc/src/sgml/ref/alter_publication.sgml37
-rw-r--r--doc/src/sgml/ref/alter_sequence.sgml15
-rw-r--r--doc/src/sgml/ref/alter_subscription.sgml41
-rw-r--r--doc/src/sgml/ref/alter_system.sgml3
-rwxr-xr-xdoc/src/sgml/ref/alter_table.sgml6
-rw-r--r--doc/src/sgml/ref/alter_type.sgml3
-rw-r--r--doc/src/sgml/ref/copy.sgml2
-rw-r--r--doc/src/sgml/ref/create_access_method.sgml3
-rw-r--r--doc/src/sgml/ref/create_publication.sgml3
-rw-r--r--doc/src/sgml/ref/create_subscription.sgml16
-rwxr-xr-xdoc/src/sgml/ref/create_table.sgml72
-rw-r--r--doc/src/sgml/ref/drop_aggregate.sgml3
-rw-r--r--doc/src/sgml/ref/drop_policy.sgml3
-rw-r--r--doc/src/sgml/ref/drop_publication.sgml4
-rw-r--r--doc/src/sgml/ref/drop_statistics.sgml4
-rw-r--r--doc/src/sgml/ref/drop_subscription.sgml26
-rw-r--r--doc/src/sgml/ref/import_foreign_schema.sgml4
-rw-r--r--doc/src/sgml/ref/initdb.sgml4
-rw-r--r--doc/src/sgml/ref/insert.sgml3
-rw-r--r--doc/src/sgml/ref/pg_dump.sgml28
-rw-r--r--doc/src/sgml/ref/pg_dumpall.sgml16
-rw-r--r--doc/src/sgml/ref/pg_recvlogical.sgml52
-rw-r--r--doc/src/sgml/ref/pgbench.sgml20
-rw-r--r--doc/src/sgml/ref/pgupgrade.sgml26
-rw-r--r--doc/src/sgml/ref/psql-ref.sgml89
-rwxr-xr-xdoc/src/sgml/ref/set_transaction.sgml6
-rw-r--r--doc/src/sgml/release-10.sgml57
-rw-r--r--doc/src/sgml/xfunc.sgml89
46 files changed, 488 insertions, 353 deletions
diff --git a/doc/src/sgml/brin.sgml b/doc/src/sgml/brin.sgml
index ad11109775..8dcc29925b 100644
--- a/doc/src/sgml/brin.sgml
+++ b/doc/src/sgml/brin.sgml
@@ -81,7 +81,7 @@
occur. (This last trigger is disabled by default and can be enabled
with the <literal>autosummarize</literal> parameter.)
Conversely, a range can be de-summarized using the
- <function>brin_desummarize_range(regclass, bigint)</function> range,
+ <function>brin_desummarize_range(regclass, bigint)</function> function,
which is useful when the index tuple is no longer a very good
representation because the existing values have changed.
</para>
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 7b7ac9ba6f..407ea2018c 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -3816,7 +3816,8 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;<
<entry><literal><link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.oid</literal></entry>
<entry>
For each column in the index key, this contains the OID of the
- collation to use for the index.
+ collation to use for the index, or zero if the column is not
+ of a collatable data type.
</entry>
</row>
@@ -4803,7 +4804,8 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;<
<entry><literal><link linkend="catalog-pg-opclass"><structname>pg_opclass</structname></link>.oid</literal></entry>
<entry>
For each column in the partition key, this contains the OID of the
- the collation to use for partitioning.
+ collation to use for partitioning, or zero if the column is not
+ of a collatable data type.
</entry>
</row>
@@ -6642,7 +6644,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</>:<replaceable>&lt;salt&gt;<
<para>
This catalog only contains tables known to the subscription after running
either <command>CREATE SUBSCRIPTION</command> or
- <command>ALTER SUBSCRIPTION ... REFRESH</command>.
+ <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command>.
</para>
<table>
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index b7c3ca8412..89eecb4758 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -3521,7 +3521,7 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
of these configuration parameters to force the optimizer to
choose a different plan.
Better ways to improve the quality of the
- plans chosen by the optimizer include adjusting the planer cost
+ plans chosen by the optimizer include adjusting the planner cost
constants (see <xref linkend="runtime-config-query-constants">),
running <xref linkend="sql-analyze"> manually, increasing
the value of the <xref
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 71339bf81d..a70047b340 100755
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3435,7 +3435,7 @@ CREATE INDEX ON measurement_y2008m01 (logdate);
<para>
Normally the set of partitions established when initially defining the
- the table are not intended to remain static. It is common to want to
+ table are not intended to remain static. It is common to want to
remove old partitions of data and periodically add new partitions for
new data. One of the most important advantages of partitioning is
precisely that it allows this otherwise painful task to be executed
diff --git a/doc/src/sgml/dfunc.sgml b/doc/src/sgml/dfunc.sgml
index 6a4b7d6e97..23af270e32 100644
--- a/doc/src/sgml/dfunc.sgml
+++ b/doc/src/sgml/dfunc.sgml
@@ -63,10 +63,10 @@
<listitem>
<para>
The compiler flag to create <acronym>PIC</acronym> is
- <option>-fpic</option>. To create shared libraries the compiler
+ <option>-fPIC</option>. To create shared libraries the compiler
flag is <option>-shared</option>.
<programlisting>
-gcc -fpic -c foo.c
+gcc -fPIC -c foo.c
gcc -shared -o foo.so foo.o
</programlisting>
This is applicable as of version 3.0 of
@@ -84,14 +84,14 @@ gcc -shared -o foo.so foo.o
<para>
The compiler flag of the system compiler to create
<acronym>PIC</acronym> is <option>+z</option>. When using
- <application>GCC</application> it's <option>-fpic</option>. The
+ <application>GCC</application> it's <option>-fPIC</option>. The
linker flag for shared libraries is <option>-b</option>. So:
<programlisting>
cc +z -c foo.c
</programlisting>
or:
<programlisting>
-gcc -fpic -c foo.c
+gcc -fPIC -c foo.c
</programlisting>
and then:
<programlisting>
@@ -112,13 +112,11 @@ ld -b -o foo.sl foo.o
<listitem>
<para>
The compiler flag to create <acronym>PIC</acronym> is
- <option>-fpic</option>. On some platforms in some situations
- <option>-fPIC</option> must be used if <option>-fpic</option>
- does not work. Refer to the GCC manual for more information.
+ <option>-fPIC</option>.
The compiler flag to create a shared library is
<option>-shared</option>. A complete example looks like this:
<programlisting>
-cc -fpic -c foo.c
+cc -fPIC -c foo.c
cc -shared -o foo.so foo.o
</programlisting>
</para>
@@ -149,12 +147,12 @@ cc -bundle -flat_namespace -undefined suppress -o foo.so foo.o
<listitem>
<para>
The compiler flag to create <acronym>PIC</acronym> is
- <option>-fpic</option>. For <acronym>ELF</acronym> systems, the
+ <option>-fPIC</option>. For <acronym>ELF</acronym> systems, the
compiler with the flag <option>-shared</option> is used to link
shared libraries. On the older non-ELF systems, <literal>ld
-Bshareable</literal> is used.
<programlisting>
-gcc -fpic -c foo.c
+gcc -fPIC -c foo.c
gcc -shared -o foo.so foo.o
</programlisting>
</para>
@@ -169,10 +167,10 @@ gcc -shared -o foo.so foo.o
<listitem>
<para>
The compiler flag to create <acronym>PIC</acronym> is
- <option>-fpic</option>. <literal>ld -Bshareable</literal> is
+ <option>-fPIC</option>. <literal>ld -Bshareable</literal> is
used to link shared libraries.
<programlisting>
-gcc -fpic -c foo.c
+gcc -fPIC -c foo.c
ld -Bshareable -o foo.so foo.o
</programlisting>
</para>
@@ -188,7 +186,7 @@ ld -Bshareable -o foo.so foo.o
<para>
The compiler flag to create <acronym>PIC</acronym> is
<option>-KPIC</option> with the Sun compiler and
- <option>-fpic</option> with <application>GCC</>. To
+ <option>-fPIC</option> with <application>GCC</>. To
link shared libraries, the compiler option is
<option>-G</option> with either compiler or alternatively
<option>-shared</option> with <application>GCC</>.
@@ -198,7 +196,7 @@ cc -G -o foo.so foo.o
</programlisting>
or
<programlisting>
-gcc -fpic -c foo.c
+gcc -fPIC -c foo.c
gcc -G -o foo.so foo.o
</programlisting>
</para>
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml
index dead4c3f86..f13a0e999f 100644
--- a/doc/src/sgml/ecpg.sgml
+++ b/doc/src/sgml/ecpg.sgml
@@ -240,8 +240,7 @@ EXEC SQL AT <replaceable>connection-name</replaceable> SELECT ...;
<para>
If your application uses multiple threads of execution, they cannot share a
connection concurrently. You must either explicitly control access to the connection
- (using mutexes) or use a connection for each thread. If each thread uses its own connection,
- you will need to use the AT clause to specify which connection the thread will use.
+ (using mutexes) or use a connection for each thread.
</para>
<para>
@@ -251,7 +250,7 @@ EXEC SQL AT <replaceable>connection-name</replaceable> SELECT ...;
EXEC SQL SET CONNECTION <replaceable>connection-name</replaceable>;
</programlisting>
This option is particularly convenient if many statements are to be
- executed on the same connection. It is not thread-aware.
+ executed on the same connection.
</para>
<para>
diff --git a/doc/src/sgml/external-projects.sgml b/doc/src/sgml/external-projects.sgml
index 8457426545..82aaad4e4b 100644
--- a/doc/src/sgml/external-projects.sgml
+++ b/doc/src/sgml/external-projects.sgml
@@ -70,7 +70,7 @@
<row>
<entry>JDBC</entry>
- <entry>JDBC</entry>
+ <entry>Java</entry>
<entry>Type 4 JDBC driver</entry>
<entry><ulink url="https://jdbc.postgresql.org/"></ulink></entry>
</row>
@@ -83,6 +83,13 @@
</row>
<row>
+ <entry>node-postgres</entry>
+ <entry>JavaScript</entry>
+ <entry>Node.js driver</entry>
+ <entry><ulink url="https://node-postgres.com/"></ulink></entry>
+ </row>
+
+ <row>
<entry>Npgsql</entry>
<entry>.NET</entry>
<entry>.NET data provider</entry>
@@ -97,6 +104,13 @@
</row>
<row>
+ <entry>pq</entry>
+ <entry>Go</entry>
+ <entry>Pure Go driver for Go's database/sql</entry>
+ <entry><ulink url="https://github.com/lib/pq"></ulink></entry>
+ </row>
+
+ <row>
<entry>psqlODBC</entry>
<entry>ODBC</entry>
<entry>ODBC driver</entry>
@@ -172,19 +186,13 @@
<row>
<entry>PL/Java</entry>
<entry>Java</entry>
- <entry><ulink url="https://github.com/tada/pljava"></ulink></entry>
+ <entry><ulink url="https://tada.github.io/pljava/"></ulink></entry>
</row>
<row>
- <entry>PL/PHP</entry>
- <entry>PHP</entry>
- <entry><ulink url="https://public.commandprompt.com/projects/plphp"></ulink></entry>
- </row>
-
- <row>
- <entry>PL/Py</entry>
- <entry>Python</entry>
- <entry><ulink url="http://python.projects.postgresql.org/backend/"></ulink></entry>
+ <entry>PL/Lua</entry>
+ <entry>Lua</entry>
+ <entry><ulink url="https://github.com/pllua/pllua"></ulink></entry>
</row>
<row>
@@ -194,22 +202,16 @@
</row>
<row>
- <entry>PL/Ruby</entry>
- <entry>Ruby</entry>
- <entry><ulink url="http://raa.ruby-lang.org/project/pl-ruby/"></ulink></entry>
- </row>
-
- <row>
- <entry>PL/Scheme</entry>
- <entry>Scheme</entry>
- <entry><ulink url="http://plscheme.projects.postgresql.org/"></ulink></entry>
- </row>
-
- <row>
<entry>PL/sh</entry>
<entry>Unix shell</entry>
<entry><ulink url="https://github.com/petere/plsh"></ulink></entry>
</row>
+
+ <row>
+ <entry>PL/v8</entry>
+ <entry>JavaScript</entry>
+ <entry><ulink url="https://github.com/plv8/plv8"></ulink></entry>
+ </row>
</tbody>
</tgroup>
</table>
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 7c5cbab2a2..58c1858121 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -4361,7 +4361,7 @@ SELECT (regexp_match('foobarbequebaz', 'bar.*que'))[1];
<para>
Some examples:
<programlisting>
- SELECT regexp_matches('foo', 'not there');
+SELECT regexp_matches('foo', 'not there');
regexp_matches
----------------
(0 rows)
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 48d5525b92..01f46d39b6 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -1175,7 +1175,7 @@ synchronous_standby_names = 'FIRST 2 (s1, s2, s3)'
An example of <varname>synchronous_standby_names</> for
a quorum-based multiple synchronous standbys is:
<programlisting>
- synchronous_standby_names = 'ANY 2 (s1, s2, s3)'
+synchronous_standby_names = 'ANY 2 (s1, s2, s3)'
</programlisting>
In this example, if four standby servers <literal>s1</>, <literal>s2</>,
<literal>s3</> and <literal>s4</> are running, transaction commits will
@@ -1829,7 +1829,7 @@ if (!triggered)
<para>
In normal operation, <quote>read-only</> transactions are allowed to
- update sequences and to use <command>LISTEN</>, <command>UNLISTEN</>, and
+ use <command>LISTEN</>, <command>UNLISTEN</>, and
<command>NOTIFY</>, so Hot Standby sessions operate under slightly tighter
restrictions than ordinary read-only sessions. It is possible that some
of these restrictions might be loosened in a future release.
diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml
index 02f7927436..b85849b258 100644
--- a/doc/src/sgml/information_schema.sgml
+++ b/doc/src/sgml/information_schema.sgml
@@ -1602,31 +1602,47 @@
<row>
<entry><literal>identity_start</literal></entry>
<entry><type>character_data</type></entry>
- <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
+ <entry>
+ If the column is an identity column, then the start value of the
+ internal sequence, else null.
+ </entry>
</row>
<row>
<entry><literal>identity_increment</literal></entry>
<entry><type>character_data</type></entry>
- <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
+ <entry>
+ If the column is an identity column, then the increment of the internal
+ sequence, else null.
+ </entry>
</row>
<row>
<entry><literal>identity_maximum</literal></entry>
<entry><type>character_data</type></entry>
- <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
+ <entry>
+ If the column is an identity column, then the maximum value of the
+ internal sequence, else null.
+ </entry>
</row>
<row>
<entry><literal>identity_minimum</literal></entry>
<entry><type>character_data</type></entry>
- <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
+ <entry>
+ If the column is an identity column, then the minimum value of the
+ internal sequence, else null.
+ </entry>
</row>
<row>
<entry><literal>identity_cycle</literal></entry>
<entry><type>yes_or_no</type></entry>
- <entry>Applies to a feature not available in <productname>PostgreSQL</></entry>
+ <entry>
+ If the column is an identity column, then <literal>YES</literal> if the
+ internal sequence cycles or <literal>NO</literal> if it does not;
+ otherwise null.
+ </entry>
</row>
<row>
diff --git a/doc/src/sgml/keywords.sgml b/doc/src/sgml/keywords.sgml
index 7b1f8a149c..a369a5b92b 100644
--- a/doc/src/sgml/keywords.sgml
+++ b/doc/src/sgml/keywords.sgml
@@ -794,7 +794,7 @@
</row>
<row>
<entry><token>COLUMNS</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
@@ -2013,7 +2013,7 @@
</row>
<row>
<entry><token>GENERATED</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
@@ -2601,13 +2601,6 @@
<entry></entry>
</row>
<row>
- <entry><token>LIST</token></entry>
- <entry>non-reserved</entry>
- <entry></entry>
- <entry></entry>
- <entry></entry>
- </row>
- <row>
<entry><token>LISTEN</token></entry>
<entry>non-reserved</entry>
<entry></entry>
@@ -2946,7 +2939,7 @@
</row>
<row>
<entry><token>NEW</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry></entry>
@@ -3170,7 +3163,7 @@
</row>
<row>
<entry><token>OLD</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry></entry>
@@ -3296,7 +3289,7 @@
</row>
<row>
<entry><token>OVERRIDING</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry>non-reserved</entry>
<entry></entry>
@@ -3631,6 +3624,13 @@
<entry>reserved</entry>
</row>
<row>
+ <entry><token>PUBLICATION</token></entry>
+ <entry>non-reserved</entry>
+ <entry></entry>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
<entry><token>QUOTE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
@@ -3716,7 +3716,7 @@
</row>
<row>
<entry><token>REFERENCING</token></entry>
- <entry></entry>
+ <entry>non-reserved</entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry></entry>
@@ -4082,6 +4082,13 @@
<entry>reserved</entry>
</row>
<row>
+ <entry><token>SCHEMAS</token></entry>
+ <entry>non-reserved</entry>
+ <entry></entry>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
<entry><token>SCHEMA_NAME</token></entry>
<entry></entry>
<entry>non-reserved</entry>
@@ -4523,6 +4530,13 @@
<entry></entry>
</row>
<row>
+ <entry><token>SUBSCRIPTION</token></entry>
+ <entry>non-reserved</entry>
+ <entry></entry>
+ <entry></entry>
+ <entry></entry>
+ </row>
+ <row>
<entry><token>SUBSTRING</token></entry>
<entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry>
@@ -5357,7 +5371,7 @@
</row>
<row>
<entry><token>XMLNAMESPACES</token></entry>
- <entry></entry>
+ <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry></entry>
@@ -5406,7 +5420,7 @@
</row>
<row>
<entry><token>XMLTABLE</token></entry>
- <entry></entry>
+ <entry>non-reserved (cannot be function or type)</entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry></entry>
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 67647e1f35..62a4303a6b 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -5947,12 +5947,12 @@ char *PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
<listitem>
<para>
Prepares the md5-encrypted form of a <productname>PostgreSQL</> password.
- <synopsis>
+<synopsis>
char *PQencryptPassword(const char *passwd, const char *user);
- </synopsis>
- <function>PQencryptPassword</> is an older, deprecated version of
+</synopsis>
+ <function>PQencryptPassword</> is an older, deprecated version of
<function>PQencryptPasswodConn</>. The difference is that
- <function>PQencryptPassword</> does not
+ <function>PQencryptPassword</> does not
require a connection object, and <literal>md5</> is always used as the
encryption algorithm.
</para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 79ca45a156..9ff5eea038 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -802,7 +802,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<row>
<entry><structfield>backend_type</structfield></entry>
<entry><type>text</type></entry>
- <entry>Type of current backend. Possible types are
+ <entry>Type of current backend. Possible types are
<literal>autovacuum launcher</>, <literal>autovacuum worker</>,
<literal>background worker</>, <literal>background writer</>,
<literal>client backend</>, <literal>checkpointer</>,
@@ -1827,7 +1827,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
the standby to catch up with the sending server assuming the current
rate of replay. Such a system would show similar times while new WAL is
being generated, but would differ when the sender becomes idle. In
- particular, when the standby has caught up completely,
+ particular, when the standby has caught up completely,
<structname>pg_stat_replication</structname> shows the time taken to
write, flush and replay the most recent reported WAL location rather than
zero as some users might expect. This is consistent with the goal of
diff --git a/doc/src/sgml/parallel.sgml b/doc/src/sgml/parallel.sgml
index a65129078c..ff31e7537e 100644
--- a/doc/src/sgml/parallel.sgml
+++ b/doc/src/sgml/parallel.sgml
@@ -275,7 +275,7 @@ EXPLAIN SELECT * FROM pgbench_accounts WHERE filler LIKE '%x%';
<para>
In a <emphasis>parallel sequential scan</>, the table's blocks will
be divided among the cooperating processes. Blocks are handed out one
- at a time, so that access to the table remains sequential.
+ at a time, so that access to the table remains sequential.
</para>
</listitem>
<listitem>
diff --git a/doc/src/sgml/pgstattuple.sgml b/doc/src/sgml/pgstattuple.sgml
index 63412b03ef..d2bc7916d9 100644
--- a/doc/src/sgml/pgstattuple.sgml
+++ b/doc/src/sgml/pgstattuple.sgml
@@ -124,13 +124,13 @@ free_percent | 1.95
</table>
<note>
- <para>
- The <literal>table_len</literal> will always be greater than the sum
- of the <literal>tuple_len</literal>, <literal>dead_tuple_len</literal>
- and <literal>free_space</literal>. The difference is accounted for by
- fixed page overhead, the per-page table of pointers to tuples, and
- padding to ensure that tuples are correctly aligned.
- </para>
+ <para>
+ The <literal>table_len</literal> will always be greater than the sum
+ of the <literal>tuple_len</literal>, <literal>dead_tuple_len</literal>
+ and <literal>free_space</literal>. The difference is accounted for by
+ fixed page overhead, the per-page table of pointers to tuples, and
+ padding to ensure that tuples are correctly aligned.
+ </para>
</note>
<para>
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index 3dfc0f84ed..23558e7ec0 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -566,7 +566,7 @@
</para>
</listitem>
</itemizedlist>
- These are less likely to be problematic than <varname>search_path</>, but
+ These are less likely to be problematic than <varname>search_path</>, but
can be handled with function <literal>SET</> options if the need arises.
</para>
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 4837be5016..a7a3d3b2f9 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1352,7 +1352,7 @@ general, while the next subsection gives more details on SCRAM-SHA-256.
<title>SASL Authentication Message Flow</title>
<step id="sasl-auth-begin">
-<para>
+<para>
To begin a SASL authentication exchange, the server sends an
AuthenticationSASL message. It includes a list of SASL authentication
mechanisms that the server can accept, in the server's preferred order.
@@ -1401,7 +1401,7 @@ ErrorMessage.
<para>
<firstterm>SCRAM-SHA-256</> (called just <firstterm>SCRAM</> from now on) is
the only implemented SASL mechanism, at the moment. It is described in detail
- in RFC 7677 and RFC 5802.
+ in RFC 7677 and RFC 5802.
</para>
<para>
diff --git a/doc/src/sgml/ref/alter_aggregate.sgml b/doc/src/sgml/ref/alter_aggregate.sgml
index 3aa7c259da..7b7616ca01 100644
--- a/doc/src/sgml/ref/alter_aggregate.sgml
+++ b/doc/src/sgml/ref/alter_aggregate.sgml
@@ -179,8 +179,7 @@ ALTER AGGREGATE mypercentile(float8 ORDER BY integer) SET SCHEMA myschema;
This will work too:
<programlisting>
ALTER AGGREGATE mypercentile(float8, integer) SET SCHEMA myschema;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml
index 7b8f114f54..f064ec5f32 100644
--- a/doc/src/sgml/ref/alter_publication.sgml
+++ b/doc/src/sgml/ref/alter_publication.sgml
@@ -34,28 +34,40 @@ ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> RENAME TO <r
<title>Description</title>
<para>
- The first variant of this command listed in the synopsis can change
+ The command <command>ALTER PUBLICATION</command> can change the attributes
+ of a publication.
+ </para>
+
+ <para>
+ The first three variants change which tables are part of the publication.
+ The <literal>SET TABLE</literal> clause will replace the list of tables in
+ the publication with the specified one. The <literal>ADD TABLE</literal>
+ and <literal>DROP TABLE</literal> clauses will add and remove one or more
+ tables from the publication. Note that adding tables to a publication that
+ is already subscribed to will require a <literal>ALTER SUBSCRIPTION
+ ... REFRESH PUBLICATION</literal> action on the subscribing side in order
+ to become effective.
+ </para>
+
+ <para>
+ The fourth variant of this command listed in the synopsis can change
all of the publication properties specified in
<xref linkend="sql-createpublication">. Properties not mentioned in the
command retain their previous settings.
</para>
<para>
+ The remaining variants change the owner and the name of the publication.
+ </para>
+
+ <para>
+ You must own the publication to use <command>ALTER PUBLICATION</command>.
To alter the owner, you must also be a direct or indirect member of the new
owning role. The new owner must have <literal>CREATE</literal> privilege on
the database. Also, the new owner of a <literal>FOR ALL TABLES</literal>
publication must be a superuser. However, a superuser can change the
ownership of a publication while circumventing these restrictions.
</para>
-
- <para>
- The other variants of this command deal with the table membership of the
- publication. The <literal>SET TABLE</literal> clause will replace the
- list of tables in the publication with the specified one.
- The <literal>ADD TABLE</literal> and
- <literal>DROP TABLE</literal> will add and remove one or more tables from
- the publication.
- </para>
</refsect1>
<refsect1>
@@ -128,8 +140,7 @@ ALTER PUBLICATION noinsert SET (publish = 'update, delete');
Add some tables to the publication:
<programlisting>
ALTER PUBLICATION mypublication ADD TABLE users, departments;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
@@ -147,6 +158,8 @@ ALTER PUBLICATION mypublication ADD TABLE users, departments;
<simplelist type="inline">
<member><xref linkend="sql-createpublication"></member>
<member><xref linkend="sql-droppublication"></member>
+ <member><xref linkend="sql-createsubscription"></member>
+ <member><xref linkend="sql-altersubscription"></member>
</simplelist>
</refsect1>
</refentry>
diff --git a/doc/src/sgml/ref/alter_sequence.sgml b/doc/src/sgml/ref/alter_sequence.sgml
index 30e5316b8c..3a04d07ecc 100644
--- a/doc/src/sgml/ref/alter_sequence.sgml
+++ b/doc/src/sgml/ref/alter_sequence.sgml
@@ -171,7 +171,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
<para>
The optional clause <literal>RESTART [ WITH <replaceable
class="parameter">restart</replaceable> ]</literal> changes the
- current value of the sequence. This is equivalent to calling the
+ current value of the sequence. This is similar to calling the
<function>setval</> function with <literal>is_called</literal> =
<literal>false</>: the specified value will be returned by the
<emphasis>next</> call of <function>nextval</>.
@@ -182,11 +182,11 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
</para>
<para>
- Like a <function>setval</function> call, a <literal>RESTART</literal>
- operation on a sequence is never rolled back, to avoid blocking of
- concurrent transactions that obtain numbers from the same sequence.
- (The other clauses cause ordinary catalog updates that can be rolled
- back.)
+ In contrast to a <function>setval</function> call,
+ a <literal>RESTART</literal> operation on a sequence is transactional
+ and blocks concurrent transactions from obtaining numbers from the
+ same sequence. If that's not the desired mode of
+ operation, <function>setval</> should be used.
</para>
</listitem>
</varlistentry>
@@ -307,8 +307,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
<para>
<command>ALTER SEQUENCE</command> blocks
concurrent <function>nextval</function>, <function>currval</function>,
- <function>lastval</function>, and <command>setval</command> calls, except
- if only the <literal>RESTART</literal> clause is used.
+ <function>lastval</function>, and <command>setval</command> calls.
</para>
<para>
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml
index 113e32bfd0..b1b7765d76 100644
--- a/doc/src/sgml/ref/alter_subscription.sgml
+++ b/doc/src/sgml/ref/alter_subscription.sgml
@@ -22,7 +22,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> CONNECTION '<replaceable>conninfo</replaceable>'
-ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> SET PUBLICATION <replaceable class="PARAMETER">publication_name</replaceable> [, ...] { REFRESH [ WITH ( <replaceable class="PARAMETER">refresh_option</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ] | SKIP REFRESH }
+ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> SET PUBLICATION <replaceable class="PARAMETER">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="PARAMETER">set_publication_option</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> REFRESH PUBLICATION [ WITH ( <replaceable class="PARAMETER">refresh_option</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> ENABLE
ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> DISABLE
@@ -42,8 +42,11 @@ ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> RENAME TO <
</para>
<para>
+ You must own the subscription to use <command>ALTER SUBSCRIPTION</>.
To alter the owner, you must also be a direct or indirect member of the
new owning role. The new owner has to be a superuser.
+ (Currently, all subscription owners must be superusers, so the owner checks
+ will be bypassed in practice. But this might change in the future.)
</para>
</refsect1>
@@ -77,18 +80,29 @@ ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> RENAME TO <
<para>
Changes list of subscribed publications. See
<xref linkend="SQL-CREATESUBSCRIPTION"> for more information.
+ By default this command will also act like <literal>REFRESH
+ PUBLICATION</literal>.
</para>
<para>
- When <literal>REFRESH</literal> is specified, this command will also act
- like <literal>REFRESH
- PUBLICATION</literal>. <literal>refresh_option</literal> specifies
- additional options for the refresh operation, as described
- under <literal>REFRESH PUBLICATION</literal>. When
- <literal>SKIP REFRESH</literal> is specified, the command will not try
- to refresh table information. Note that
- either <literal>REFRESH</literal> or <literal>SKIP REFRESH</literal>
- must be specified.
+ <replaceable>set_publication_option</replaceable> specifies additional
+ options for this operation. The supported options are:
+
+ <variablelist>
+ <varlistentry>
+ <term><literal>refresh</literal> (<type>boolean</type>)</term>
+ <listitem>
+ <para>
+ When false, the command will not try to refresh table information.
+ <literal>REFRESH PUBLICATION</literal> should then be executed separately.
+ The default is <literal>true</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ Additionally, refresh options as described
+ under <literal>REFRESH PUBLICATION</literal> may be specified.
</para>
</listitem>
</varlistentry>
@@ -104,7 +118,7 @@ ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> RENAME TO <
</para>
<para>
- <literal>refresh_option</literal> specifies additional options for the
+ <replaceable>refresh_option</replaceable> specifies additional options for the
refresh operation. The supported options are:
<variablelist>
@@ -182,7 +196,7 @@ ALTER SUBSCRIPTION <replaceable class="PARAMETER">name</replaceable> RENAME TO <
Change the publication subscribed by a subscription to
<literal>insert_only</literal>:
<programlisting>
-ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only REFRESH;
+ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;
</programlisting>
</para>
@@ -190,8 +204,7 @@ ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only REFRESH;
Disable (stop) the subscription:
<programlisting>
ALTER SUBSCRIPTION mysub DISABLE;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/alter_system.sgml b/doc/src/sgml/ref/alter_system.sgml
index c1d27b6564..b234793f3e 100644
--- a/doc/src/sgml/ref/alter_system.sgml
+++ b/doc/src/sgml/ref/alter_system.sgml
@@ -119,8 +119,7 @@ ALTER SYSTEM SET wal_level = replica;
in <filename>postgresql.conf</>:
<programlisting>
ALTER SYSTEM RESET wal_level;
-</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 1dfbf6d3c8..c2a484186f 100755
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -185,7 +185,7 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
table. Even if there is no <literal>NOT NULL</> constraint on the
parent, such a constraint can still be added to individual partitions,
if desired; that is, the children can disallow nulls even if the parent
- allows them, but not the other way around.
+ allows them, but not the other way around.
</para>
</listitem>
</varlistentry>
@@ -617,7 +617,7 @@ ALTER TABLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
</para>
<para>
- <literal>SHARE UPDATE EXCLUSIVE</literal> lock will be taken for
+ <literal>SHARE UPDATE EXCLUSIVE</literal> lock will be taken for
fillfactor and autovacuum storage parameters, as well as the
following planner related parameters:
effective_io_concurrency, parallel_workers, seq_page_cost
@@ -1605,7 +1605,7 @@ ALTER TABLE cities
<para>
Detach a partition from partitioned table:
<programlisting>
-ALTER TABLE cities
+ALTER TABLE measurement
DETACH PARTITION measurement_y2015m12;
</programlisting></para>
diff --git a/doc/src/sgml/ref/alter_type.sgml b/doc/src/sgml/ref/alter_type.sgml
index fdb4f3367d..d65f70f674 100644
--- a/doc/src/sgml/ref/alter_type.sgml
+++ b/doc/src/sgml/ref/alter_type.sgml
@@ -356,8 +356,7 @@ ALTER TYPE colors ADD VALUE 'orange' AFTER 'red';
To rename an enum value:
<programlisting>
ALTER TYPE colors RENAME VALUE 'purple' TO 'mauve';
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 413e69f4c5..48f0c5c751 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -431,7 +431,7 @@ COPY <replaceable class="parameter">count</replaceable>
</para>
<para>
- If row-level security is enabled for the table, the relevant
+ If row-level security is enabled for the table, the relevant
<command>SELECT</command> policies will apply to <literal>COPY
<replaceable class="parameter">table</> TO</literal> statements.
Currently, <command>COPY FROM</command> is not supported for tables
diff --git a/doc/src/sgml/ref/create_access_method.sgml b/doc/src/sgml/ref/create_access_method.sgml
index 0a30e6ea3c..891926dba5 100644
--- a/doc/src/sgml/ref/create_access_method.sgml
+++ b/doc/src/sgml/ref/create_access_method.sgml
@@ -93,8 +93,7 @@ CREATE ACCESS METHOD <replaceable class="parameter">name</replaceable>
handler function <literal>heptree_handler</>:
<programlisting>
CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml
index 48be476374..c5299dd74e 100644
--- a/doc/src/sgml/ref/create_publication.sgml
+++ b/doc/src/sgml/ref/create_publication.sgml
@@ -191,8 +191,7 @@ CREATE PUBLICATION alltables FOR ALL TABLES;
<programlisting>
CREATE PUBLICATION insert_only FOR TABLE mydata
WITH (publish = 'insert');
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml
index 2c91eb6f50..77bf87681b 100644
--- a/doc/src/sgml/ref/create_subscription.sgml
+++ b/doc/src/sgml/ref/create_subscription.sgml
@@ -226,6 +226,19 @@ CREATE SUBSCRIPTION <replaceable class="PARAMETER">subscription_name</replaceabl
how to configure access control between the subscription and the
publication instance.
</para>
+
+ <para>
+ Creating a subscription that connects to the same database cluster (for
+ example, to replicate between databases in the same cluster or to replicate
+ within the same database) will only succeed if the replication slot is not
+ created as part of the same command. Otherwise, the <command>CREATE
+ SUBSCRIPTION</command> call will hang. To make this work, create the
+ replication slot separately (using the
+ function <function>pg_create_logical_replication_slot</function> with the
+ plugin name <literal>pgoutput</literal>) and create the subscription using
+ the parameter <literal>create_slot = false</literal>. This is an
+ implementation restriction that might be lifted in a future release.
+ </para>
</refsect1>
<refsect1>
@@ -252,8 +265,7 @@ CREATE SUBSCRIPTION mysub
CONNECTION 'host=192.168.1.50 port=5432 user=foo dbname=foodb'
PUBLICATION insert_only
WITH (enabled = false);
-</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 8d1e4ee487..5a3821b25e 100755
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -98,8 +98,9 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<phrase>and <replaceable class="PARAMETER">partition_bound_spec</replaceable> is:</phrase>
-{ IN ( { <replaceable class="PARAMETER">bound_literal</replaceable> | NULL } [, ...] ) |
- FROM ( { <replaceable class="PARAMETER">bound_literal</replaceable> | UNBOUNDED } [, ...] ) TO ( { <replaceable class="PARAMETER">bound_literal</replaceable> | UNBOUNDED } [, ...] ) }
+IN ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replaceable class="PARAMETER">string_literal</replaceable> | NULL } [, ...] ) |
+FROM ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replaceable class="PARAMETER">string_literal</replaceable> | UNBOUNDED } [, ...] )
+ TO ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replaceable class="PARAMETER">string_literal</replaceable> | UNBOUNDED } [, ...] )
<phrase><replaceable class="PARAMETER">index_parameters</replaceable> in <literal>UNIQUE</literal>, <literal>PRIMARY KEY</literal>, and <literal>EXCLUDE</literal> constraints are:</phrase>
@@ -264,21 +265,34 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<term><literal>PARTITION OF <replaceable class="PARAMETER">parent_table</replaceable> FOR VALUES <replaceable class="PARAMETER">partition_bound_spec</replaceable></literal></term>
<listitem>
<para>
- Creates the table as <firstterm>partition</firstterm> of the specified
+ Creates the table as a <firstterm>partition</firstterm> of the specified
parent table.
</para>
<para>
- The partition bound specification must correspond to the partitioning
- method and partition key of the parent table, and must not overlap with
- any existing partition of that parent.
+ The <replaceable class="PARAMETER">partition_bound_spec</replaceable>
+ must correspond to the partitioning method and partition key of the
+ parent table, and must not overlap with any existing partition of that
+ parent. The form with <literal>IN</> is used for list partitioning,
+ while the form with <literal>FROM</> and <literal>TO</> is used for
+ range partitioning.
</para>
<para>
- Each of the values specified in the partition bound specification is
+ Each of the values specified in
+ the <replaceable class="PARAMETER">partition_bound_spec</> is
a literal, <literal>NULL</literal>, or <literal>UNBOUNDED</literal>.
- A literal is either a numeric constant or a string constant that is
- coercible to the corresponding partition key column's type.
+ Each literal value must be either a numeric constant that is coercible
+ to the corresponding partition key column's type, or a string literal
+ that is valid input for that type.
+ </para>
+
+ <para>
+ When creating a list partition, <literal>NULL</literal> can be
+ specified to signify that the partition allows the partition key
+ column to be null. However, there cannot be more than one such
+ list partition for a given parent table. <literal>NULL</literal>
+ cannot be specified for range partitions.
</para>
<para>
@@ -286,30 +300,25 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<literal>FROM</literal> is an inclusive bound, whereas the upper
bound specified with <literal>TO</literal> is an exclusive bound.
That is, the values specified in the <literal>FROM</literal> list
- are accepted values of the corresponding partition key columns in a
- given partition, whereas those in the <literal>TO</literal> list are
- not. To be precise, this applies only to the first of the partition
- key columns for which the corresponding values in the <literal>FROM</literal>
- and <literal>TO</literal> lists are not equal. All rows in a given
- partition contain the same values for all preceding columns, equal to
- those specified in <literal>FROM</literal> and <literal>TO</literal>
- lists. On the other hand, any subsequent columns are insignificant
- as far as implicit partition constraint is concerned.
+ are valid values of the corresponding partition key columns for this
+ partition, whereas those in the <literal>TO</literal> list are
+ not. Note that this statement must be understood according to the
+ rules of row-wise comparison (<xref linkend="row-wise-comparison">).
+ For example, given <literal>PARTITION BY RANGE (x,y)</>, a partition
+ bound <literal>FROM (1, 2) TO (3, 4)</literal>
+ allows <literal>x=1</> with any <literal>y&gt;=2</>,
+ <literal>x=2</> with any non-null <literal>y</>,
+ and <literal>x=3</> with any <literal>y&lt;4</>.
</para>
<para>
- Specifying <literal>UNBOUNDED</literal> in <literal>FROM</literal>
+ Writing <literal>UNBOUNDED</literal> in <literal>FROM</literal>
signifies <literal>-infinity</literal> as the lower bound of the
- corresponding column, whereas it signifies <literal>+infinity</literal>
- as the upper bound when specified in <literal>TO</literal>.
- </para>
-
- <para>
- When creating a list partition, <literal>NULL</literal> can be
- specified to signify that the partition allows the partition key
- column to be null. However, there cannot be more than one such
- list partition for a given parent table. <literal>NULL</literal>
- cannot be specified for range partitions.
+ corresponding column, whereas when written in <literal>TO</literal>,
+ it signifies <literal>+infinity</literal> as the upper bound.
+ All items following an <literal>UNBOUNDED</literal> item within
+ a <literal>FROM</literal> or <literal>TO</literal> list must also
+ be <literal>UNBOUNDED</literal>.
</para>
<para>
@@ -330,8 +339,9 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
<para>
Rows inserted into a partitioned table will be automatically routed to
the correct partition. If no suitable partition exists, an error will
- occur. Also, if updating a row in a given partition causes it to move
- to another partition due to the new partition key, an error will occur.
+ occur. Also, if updating a row in a given partition would require it
+ to move to another partition due to new partition key values, an error
+ will occur.
</para>
<para>
diff --git a/doc/src/sgml/ref/drop_aggregate.sgml b/doc/src/sgml/ref/drop_aggregate.sgml
index 631b578df7..dde1ea2444 100644
--- a/doc/src/sgml/ref/drop_aggregate.sgml
+++ b/doc/src/sgml/ref/drop_aggregate.sgml
@@ -160,8 +160,7 @@ DROP AGGREGATE myrank(VARIADIC "any" ORDER BY VARIADIC "any");
To remove multiple aggregate functions in one command:
<programlisting>
DROP AGGREGATE myavg(integer), myavg(bigint);
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/drop_policy.sgml b/doc/src/sgml/ref/drop_policy.sgml
index 69c87c0ade..f474692105 100644
--- a/doc/src/sgml/ref/drop_policy.sgml
+++ b/doc/src/sgml/ref/drop_policy.sgml
@@ -96,8 +96,7 @@ DROP POLICY [ IF EXISTS ] <replaceable class="parameter">name</replaceable> ON <
<programlisting>
DROP POLICY p1 ON my_table;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml
index 1a1be579ad..517d142251 100644
--- a/doc/src/sgml/ref/drop_publication.sgml
+++ b/doc/src/sgml/ref/drop_publication.sgml
@@ -82,9 +82,7 @@ DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
Drop a publication:
<programlisting>
DROP PUBLICATION mypublication;
-</programlisting>
- </para>
-
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/drop_statistics.sgml b/doc/src/sgml/ref/drop_statistics.sgml
index ef659fca61..37fc402589 100644
--- a/doc/src/sgml/ref/drop_statistics.sgml
+++ b/doc/src/sgml/ref/drop_statistics.sgml
@@ -73,9 +73,7 @@ DROP STATISTICS [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable>
DROP STATISTICS IF EXISTS
accounting.users_uid_creation,
public.grants_user_role;
-</programlisting>
- </para>
-
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml
index 4f34a35eef..f535c000c4 100644
--- a/doc/src/sgml/ref/drop_subscription.sgml
+++ b/doc/src/sgml/ref/drop_subscription.sgml
@@ -74,15 +74,35 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable
</refsect1>
<refsect1>
+ <title>Notes</title>
+
+ <para>
+ When dropping a subscription that is associated with a replication slot on
+ the remote host (the normal state), <command>DROP SUBSCRIPTION</command>
+ will connect to the remote host and try to drop the replication slot as
+ part of its operation. This is necessary so that the resources allocated
+ for the subscription on the remote host are released. If this fails,
+ either because the remote host is not reachable or because the remote
+ replication slot cannot be dropped or does not exist or never existed,
+ the <command>DROP SUBSCRIPTION</command> command will fail. To proceed in
+ this situation, disassociate the subscription from the replication slot by
+ executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
+ After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
+ actions on a remote host. Note that if the remote replication slot still
+ exists, it should then be dropped manually; otherwise it will continue to
+ reserve WAL and might eventually cause the disk to fill up. See
+ also <xref linkend="logical-replication-subscription-slot">.
+ </para>
+ </refsect1>
+
+ <refsect1>
<title>Examples</title>
<para>
Drop a subscription:
<programlisting>
DROP SUBSCRIPTION mysub;
-</programlisting>
- </para>
-
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/import_foreign_schema.sgml b/doc/src/sgml/ref/import_foreign_schema.sgml
index 331b362db7..b73dee9439 100644
--- a/doc/src/sgml/ref/import_foreign_schema.sgml
+++ b/doc/src/sgml/ref/import_foreign_schema.sgml
@@ -141,9 +141,7 @@ IMPORT FOREIGN SCHEMA foreign_films
<programlisting>
IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors)
FROM SERVER film_server INTO films;
-</programlisting>
- </para>
-
+</programlisting></para>
</refsect1>
<refsect1 id="SQL-IMPORTFOREIGNSCHEMA-compatibility">
diff --git a/doc/src/sgml/ref/initdb.sgml b/doc/src/sgml/ref/initdb.sgml
index 4aed43068e..e5b0490999 100644
--- a/doc/src/sgml/ref/initdb.sgml
+++ b/doc/src/sgml/ref/initdb.sgml
@@ -295,8 +295,8 @@ Datanode. A database
</varlistentry>
<varlistentry>
- <term><option>-T <replaceable>CFG</></option></term>
- <term><option>--text-search-config=<replaceable>CFG</></option></term>
+ <term><option>-T <replaceable>config</></option></term>
+ <term><option>--text-search-config=<replaceable>config</></option></term>
<listitem>
<para>
Sets the default text search configuration.
diff --git a/doc/src/sgml/ref/insert.sgml b/doc/src/sgml/ref/insert.sgml
index 95aa77b907..94dad00870 100644
--- a/doc/src/sgml/ref/insert.sgml
+++ b/doc/src/sgml/ref/insert.sgml
@@ -725,8 +725,7 @@ INSERT INTO distributors (did, dname) VALUES (9, 'Antwerp Design')
-- just use a regular unique constraint on "did"
INSERT INTO distributors (did, dname) VALUES (10, 'Conrad International')
ON CONFLICT (did) WHERE is_active DO NOTHING;
-</programlisting>
- </para>
+</programlisting></para>
</refsect1>
<refsect1>
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index bb0bf5d566..bafa031e1a 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -817,6 +817,20 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>--no-sync</option></term>
+ <listitem>
+ <para>
+ By default, <command>pg_dump</command> will wait for all files
+ to be written safely to disk. This option causes
+ <command>pg_dump</command> to return without waiting, which is
+ faster, but means that a subsequent operating system crash can leave
+ the dump corrupt. Generally, this option is useful for testing
+ but should not be used when dumping data from production installation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--no-synchronized-snapshots</></term>
<listitem>
<para>
@@ -857,20 +871,6 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
- <term><option>--no-sync</option></term>
- <listitem>
- <para>
- By default, <command>pg_dump</command> will wait for all files
- to be written safely to disk. This option causes
- <command>pg_dump</command> to return without waiting, which is
- faster, but means that a subsequent operating system crash can leave
- the dump corrupt. Generally, this option is useful for testing
- but should not be used when dumping data from production installation.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>--quote-all-identifiers</></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index b45e813486..2ab570ad4c 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -333,23 +333,23 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
- <term><option>--no-role-passwords</option></term>
+ <term><option>--no-publications</option></term>
<listitem>
<para>
- Do not dump passwords for roles. When restored, roles will have a NULL
- password and authentication will always fail until the password is reset.
- Since password values aren't needed when this option is specified we
- use the catalog view pg_roles in preference to pg_authid, since access
- to pg_authid may be restricted by security policy.
+ Do not dump publications.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><option>--no-publications</option></term>
+ <term><option>--no-role-passwords</option></term>
<listitem>
<para>
- Do not dump publications.
+ Do not dump passwords for roles. When restored, roles will have a NULL
+ password and authentication will always fail until the password is reset.
+ Since password values aren't needed when this option is specified we
+ use the catalog view pg_roles in preference to pg_authid, since access
+ to pg_authid may be restricted by security policy.
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/pg_recvlogical.sgml b/doc/src/sgml/ref/pg_recvlogical.sgml
index eaea94df8b..9c7bb1907b 100644
--- a/doc/src/sgml/ref/pg_recvlogical.sgml
+++ b/doc/src/sgml/ref/pg_recvlogical.sgml
@@ -114,6 +114,32 @@ PostgreSQL documentation
<variablelist>
<varlistentry>
+ <term><option>-E <replaceable>lsn</replaceable></option></term>
+ <term><option>--endpos=<replaceable>lsn</replaceable></option></term>
+ <listitem>
+ <para>
+ In <option>--start</option> mode, automatically stop replication
+ and exit with normal exit status 0 when receiving reaches the
+ specified LSN. If specified when not in <option>--start</option>
+ mode, an error is raised.
+ </para>
+
+ <para>
+ If there's a record with LSN exactly equal to <replaceable>lsn</>,
+ the record will be output.
+ </para>
+
+ <para>
+ The <option>--endpos</option> option is not aware of transaction
+ boundaries and may truncate output partway through a transaction.
+ Any partially output transaction will not be consumed and will be
+ replayed again when the slot is next read from. Individual messages
+ are never truncated.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-f <replaceable>filename</replaceable></option></term>
<term><option>--file=<replaceable>filename</replaceable></option></term>
<listitem>
@@ -163,32 +189,6 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
- <term><option>-E <replaceable>lsn</replaceable></option></term>
- <term><option>--endpos=<replaceable>lsn</replaceable></option></term>
- <listitem>
- <para>
- In <option>--start</option> mode, automatically stop replication
- and exit with normal exit status 0 when receiving reaches the
- specified LSN. If specified when not in <option>--start</option>
- mode, an error is raised.
- </para>
-
- <para>
- If there's a record with LSN exactly equal to <replaceable>lsn</>,
- the record will be output.
- </para>
-
- <para>
- The <option>--endpos</option> option is not aware of transaction
- boundaries and may truncate output partway through a transaction.
- Any partially output transaction will not be consumed and will be
- replayed again when the slot is next read from. Individual messages
- are never truncated.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>--if-not-exists</option></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml
index c3c8371c69..20912879b8 100644
--- a/doc/src/sgml/ref/pgbench.sgml
+++ b/doc/src/sgml/ref/pgbench.sgml
@@ -605,6 +605,16 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
</varlistentry>
<varlistentry>
+ <term><option>--log-prefix=<replaceable>prefix</></option></term>
+ <listitem>
+ <para>
+ Set the filename prefix for the log files created by
+ <option>--log</>. The default is <literal>pgbench_log</>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--progress-timestamp</option></term>
<listitem>
<para>
@@ -635,16 +645,6 @@ pgbench <optional> <replaceable>options</> </optional> <replaceable>dbname</>
</listitem>
</varlistentry>
- <varlistentry>
- <term><option>--log-prefix=<replaceable>prefix</></option></term>
- <listitem>
- <para>
- Set the filename prefix for the log files created by
- <option>--log</>. The default is <literal>pgbench_log</>.
- </para>
- </listitem>
- </varlistentry>
-
</variablelist>
</para>
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 9e3e98865c..26b6ba14ba 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -44,9 +44,9 @@
<application>pg_upgrade</> (formerly called <application>pg_migrator</>) allows data
stored in <productname>PostgreSQL</> data files to be upgraded to a later <productname>PostgreSQL</>
major version without the data dump/reload typically required for
- major version upgrades, e.g. from 8.4.7 to the current major release
+ major version upgrades, e.g. from 9.6.3 to the current major release
of <productname>PostgreSQL</>. It is not required for minor version upgrades, e.g. from
- 9.0.1 to 9.0.4.
+ 9.6.2 to 9.6.3.
</para>
<para>
@@ -72,7 +72,7 @@
<para>
pg_upgrade supports upgrades from 8.4.X and later to the current
- major release of <productname>PostgreSQL</>, including snapshot and alpha releases.
+ major release of <productname>PostgreSQL</>, including snapshot and beta releases.
</para>
</refsect1>
@@ -213,7 +213,7 @@
<para>
If you are using a version-specific installation directory, e.g.
- <filename>/opt/PostgreSQL/9.1</>, you do not need to move the old cluster. The
+ <filename>/opt/PostgreSQL/&majorversion;</>, you do not need to move the old cluster. The
graphical installers all use version-specific installation directories.
</para>
@@ -304,15 +304,15 @@ make prefix=/usr/local/pgsql.new install
Make sure both database servers are stopped using, on Unix, e.g.:
<programlisting>
-pg_ctl -D /opt/PostgreSQL/8.4 stop
-pg_ctl -D /opt/PostgreSQL/9.0 stop
+pg_ctl -D /opt/PostgreSQL/9.6 stop
+pg_ctl -D /opt/PostgreSQL/&majorversion; stop
</programlisting>
or on Windows, using the proper service names:
<programlisting>
-NET STOP postgresql-8.4
-NET STOP postgresql-9.0
+NET STOP postgresql-9.6
+NET STOP postgresql-&majorversion;
</programlisting>
</para>
@@ -372,17 +372,17 @@ NET STOP postgresql-9.0
<programlisting>
RUNAS /USER:postgres "CMD.EXE"
-SET PATH=%PATH%;C:\Program Files\PostgreSQL\9.0\bin;
+SET PATH=%PATH%;C:\Program Files\PostgreSQL\&majorversion;\bin;
</programlisting>
and then run <application>pg_upgrade</> with quoted directories, e.g.:
<programlisting>
pg_upgrade.exe
- --old-datadir "C:/Program Files/PostgreSQL/8.4/data"
- --new-datadir "C:/Program Files/PostgreSQL/9.0/data"
- --old-bindir "C:/Program Files/PostgreSQL/8.4/bin"
- --new-bindir "C:/Program Files/PostgreSQL/9.0/bin"
+ --old-datadir "C:/Program Files/PostgreSQL/9.6/data"
+ --new-datadir "C:/Program Files/PostgreSQL/&majorversion;/data"
+ --old-bindir "C:/Program Files/PostgreSQL/9.6/bin"
+ --new-bindir "C:/Program Files/PostgreSQL/&majorversion;/bin"
</programlisting>
Once started, <command>pg_upgrade</> will verify the two clusters are compatible
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 3b86612862..e6eba21eda 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -1251,6 +1251,23 @@ testdb=&gt;
<varlistentry>
+ <term><literal>\dD[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
+ <listitem>
+ <para>
+ Lists domains. If <replaceable
+ class="parameter">pattern</replaceable>
+ is specified, only domains whose names match the pattern are shown.
+ By default, only user-created objects are shown; supply a
+ pattern or the <literal>S</literal> modifier to include system
+ objects.
+ If <literal>+</literal> is appended to the command name, each object
+ is listed with its associated permissions and description.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
<term><literal>\ddp [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<listitem>
<para>
@@ -1273,23 +1290,6 @@ testdb=&gt;
<varlistentry>
- <term><literal>\dD[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
- <listitem>
- <para>
- Lists domains. If <replaceable
- class="parameter">pattern</replaceable>
- is specified, only domains whose names match the pattern are shown.
- By default, only user-created objects are shown; supply a
- pattern or the <literal>S</literal> modifier to include system
- objects.
- If <literal>+</literal> is appended to the command name, each object
- is listed with its associated permissions and description.
- </para>
- </listitem>
- </varlistentry>
-
-
- <varlistentry>
<term><literal>\dE[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<term><literal>\di[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<term><literal>\dm[S+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
@@ -1945,18 +1945,6 @@ Tue Oct 26 21:40:57 CEST 1999
<varlistentry>
- <term><literal>\gx [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
- <term><literal>\gx [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
- <listitem>
- <para>
- <literal>\gx</literal> is equivalent to <literal>\g</literal>, but
- forces expanded output mode for this query. See <literal>\x</literal>.
- </para>
- </listitem>
- </varlistentry>
-
-
- <varlistentry>
<term><literal>\gexec</literal></term>
<listitem>
@@ -2046,6 +2034,19 @@ hello 10
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>\gx [ <replaceable class="parameter">filename</replaceable> ]</literal></term>
+ <term><literal>\gx [ |<replaceable class="parameter">command</replaceable> ]</literal></term>
+ <listitem>
+ <para>
+ <literal>\gx</literal> is equivalent to <literal>\g</literal>, but
+ forces expanded output mode for this query. See <literal>\x</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
<varlistentry>
<term><literal>\h</literal> or <literal>\help</literal> <literal>[ <replaceable class="parameter">command</replaceable> ]</literal></term>
<listitem>
@@ -2118,21 +2119,6 @@ hello 10
<varlistentry>
- <term><literal>\ir</literal> or <literal>\include_relative</literal> <replaceable class="parameter">filename</replaceable></term>
- <listitem>
- <para>
- The <literal>\ir</> command is similar to <literal>\i</>, but resolves
- relative file names differently. When executing in interactive mode,
- the two commands behave identically. However, when invoked from a
- script, <literal>\ir</literal> interprets file names relative to the
- directory in which the script is located, rather than the current
- working directory.
- </para>
- </listitem>
- </varlistentry>
-
-
- <varlistentry>
<term><literal>\if</literal> <replaceable class="parameter">expression</replaceable></term>
<term><literal>\elif</literal> <replaceable class="parameter">expression</replaceable></term>
<term><literal>\else</literal></term>
@@ -2222,6 +2208,21 @@ SELECT
<varlistentry>
+ <term><literal>\ir</literal> or <literal>\include_relative</literal> <replaceable class="parameter">filename</replaceable></term>
+ <listitem>
+ <para>
+ The <literal>\ir</> command is similar to <literal>\i</>, but resolves
+ relative file names differently. When executing in interactive mode,
+ the two commands behave identically. However, when invoked from a
+ script, <literal>\ir</literal> interprets file names relative to the
+ directory in which the script is located, rather than the current
+ working directory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
<term><literal>\l[+]</literal> or <literal>\list[+] [ <link linkend="APP-PSQL-patterns"><replaceable class="parameter">pattern</replaceable></link> ]</literal></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/set_transaction.sgml b/doc/src/sgml/ref/set_transaction.sgml
index 11c3bfefcc..e67c29e2ec 100755
--- a/doc/src/sgml/ref/set_transaction.sgml
+++ b/doc/src/sgml/ref/set_transaction.sgml
@@ -226,8 +226,8 @@ SET SESSION CHARACTERISTICS AS TRANSACTION <replaceable class="parameter">transa
BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT pg_export_snapshot();
pg_export_snapshot
---------------------
- 000003A1-1
+---------------------
+ 00000003-0000001B-1
(1 row)
</programlisting>
@@ -237,7 +237,7 @@ SELECT pg_export_snapshot();
<programlisting>
BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-SET TRANSACTION SNAPSHOT '000003A1-1';
+SET TRANSACTION SNAPSHOT '00000003-0000001B-1';
</programlisting></para>
</refsect1>
diff --git a/doc/src/sgml/release-10.sgml b/doc/src/sgml/release-10.sgml
index 3ccac676ad..1918149333 100644
--- a/doc/src/sgml/release-10.sgml
+++ b/doc/src/sgml/release-10.sgml
@@ -129,18 +129,29 @@
<listitem>
<!--
+2017-01-16 [d43a619c6] Fix check_srf_call_placement() to handle VALUES cases co
2017-01-18 [69f4b9c85] Move targetlist SRF handling from expression evaluation
2017-01-18 [f13a1277a] Doc: improve documentation of new SRF-in-tlist behavior.
+2017-06-13 [0436f6bde] Disallow set-returning functions inside CASE or COALESCE
-->
<para>
- Allow <literal>COALESCE</> and <literal>CASE</> to return multiple
- rows when evaluating set-returning functions (Andres Freund).
+ Change the implementation of set-returning functions appearing in
+ a query's <literal>SELECT</> list (Andres Freund)
</para>
<para>
- This also prevents conditionals like <literal>CASE</> from
- controlling the execution of set-returning functions because
- set-returning functions are now executed earlier.
+ Set-returning functions are now evaluated before evaluation of scalar
+ expressions in the <literal>SELECT</> list, much as though they had
+ been placed in a <literal>LATERAL FROM</>-clause item. This allows
+ saner semantics for cases where multiple set-returning functions are
+ present. If they return different numbers of rows, the shorter results
+ are extended to match the longest result by adding nulls. Previously
+ the results were cycled until they all terminated at the same time,
+ producing a number of rows equal to the least common multiple of the
+ functions' periods. In addition, set-returning functions are now
+ disallowed within <literal>CASE</> and <literal>COALESCE</> constructs.
+ For more information
+ see <xref linkend="xfunc-sql-functions-returning-set">.
</para>
</listitem>
@@ -165,6 +176,26 @@
<listitem>
<!--
+2017-02-13 [8df9bd0b4] Change logical replication pg_hba.conf use
+-->
+ <para>
+ Change how logical replication
+ uses <link linkend="auth-pg-hba-conf"><filename>pg_hba.conf</filename></link>.
+ </para>
+
+ <para>
+ In previous releases, a logical replication connection required
+ the <literal>replication</literal> keyword in the database column. As
+ of this release, logical replication matches a normal entry with a
+ database name or keywords such as <literal>all</literal>. Physical
+ replication continues to use the <literal>replication</literal> keyword.
+ Since built-in logical replication is new in this release as well, this
+ change only affects users of third-party logical replication plugins.
+ </para>
+ </listitem>
+
+ <listitem>
+<!--
2017-01-14 [05cd12ed5] pg_ctl: Change default to wait for all actions
-->
<para>
@@ -505,7 +536,7 @@
</para>
<para>
- Specifically, a new <link linkend="SQL-ALTERINDEX"><command>CREATE
+ Specifically, a new <link linkend="SQL-CREATEINDEX"><command>CREATE
INDEX</></> option allows auto-summarizion of the
previous <acronym>BRIN</> page range when a new page
range is created.
@@ -1681,20 +1712,6 @@
</para>
</listitem>
- <listitem>
-<!--
-2017-01-16 [d43a619c6] Fix check_srf_call_placement() to handle VALUES cases co
--->
- <para>
- Fix <function>check_srf_call_placement()</> to handle
- <command>VALUES</> cases correctly (Tom Lane)
- </para>
-
- <para>
- NEED TEXT.
- </para>
- </listitem>
-
</itemizedlist>
</sect3>
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index bbe7475fb5..8acdb0500e 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -302,7 +302,7 @@ SELECT add_em(1, 2) AS answer;
bank account:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno;
@@ -333,7 +333,7 @@ SELECT tf1(17, 100.0);
is:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno;
@@ -345,7 +345,7 @@ $$ LANGUAGE SQL;
The same thing could be done in one command using <literal>RETURNING</>:
<programlisting>
-CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS integer AS $$
+CREATE FUNCTION tf1 (accountno integer, debit numeric) RETURNS numeric AS $$
UPDATE bank
SET balance = balance - debit
WHERE accountno = tf1.accountno
@@ -1004,6 +1004,29 @@ SELECT name, listchildren(name) FROM nodes;
</para>
<para>
+ <productname>PostgreSQL</>'s behavior for a set-returning function in a
+ query's select list is almost exactly the same as if the set-returning
+ function had been written in a <literal>LATERAL FROM</>-clause item
+ instead. For example,
+<programlisting>
+SELECT x, generate_series(1,5) AS g FROM tab;
+</programlisting>
+ is almost equivalent to
+<programlisting>
+SELECT x, g FROM tab, LATERAL generate_series(1,5) AS g;
+</programlisting>
+ It would be exactly the same, except that in this specific example,
+ the planner could choose to put <structname>g</> on the outside of the
+ nestloop join, since <structname>g</> has no actual lateral dependency
+ on <structname>tab</>. That would result in a different output row
+ order. Set-returning functions in the select list are always evaluated
+ as though they are on the inside of a nestloop join with the rest of
+ the <literal>FROM</> clause, so that the function(s) are run to
+ completion before the next row from the <literal>FROM</> clause is
+ considered.
+ </para>
+
+ <para>
If there is more than one set-returning function in the query's select
list, the behavior is similar to what you get from putting the functions
into a single <literal>LATERAL ROWS FROM( ... )</> <literal>FROM</>-clause
@@ -1034,32 +1057,19 @@ SELECT srf1(srf2(x), srf3(y)), srf4(srf5(z)) FROM tab;
</para>
<para>
- This behavior also means that set-returning functions will be evaluated
- even when it might appear that they should be skipped because of a
- conditional-evaluation construct, such as <literal>CASE</>
- or <literal>COALESCE</>. For example, consider
+ Set-returning functions cannot be used within conditional-evaluation
+ constructs, such as <literal>CASE</> or <literal>COALESCE</>. For
+ example, consider
<programlisting>
SELECT x, CASE WHEN x &gt; 0 THEN generate_series(1, 5) ELSE 0 END FROM tab;
</programlisting>
- It might seem that this should produce five repetitions of input
- rows that have <literal>x &gt; 0</>, and a single repetition of those
- that do not; but actually it will produce five repetitions of every
- input row. This is because <function>generate_series()</> is run first,
- and then the <literal>CASE</> expression is applied to its result rows.
- The behavior is thus comparable to
-<programlisting>
-SELECT x, CASE WHEN x &gt; 0 THEN g ELSE 0 END
- FROM tab, LATERAL generate_series(1,5) AS g;
-</programlisting>
- It would be exactly the same, except that in this specific example,
- the planner could choose to put <structname>g</> on the outside of the
- nestloop join, since <structname>g</> has no actual lateral dependency
- on <structname>tab</>. That would result in a different output row
- order. Set-returning functions in the select list are always evaluated
- as though they are on the inside of a nestloop join with the rest of
- the <literal>FROM</> clause, so that the function(s) are run to
- completion before the next row from the <literal>FROM</> clause is
- considered.
+ It might seem that this should produce five repetitions of input rows
+ that have <literal>x &gt; 0</>, and a single repetition of those that do
+ not; but actually, because <function>generate_series(1, 5)</> would be
+ run in an implicit <literal>LATERAL FROM</> item before
+ the <literal>CASE</> expression is ever evaluated, it would produce five
+ repetitions of every input row. To reduce confusion, such cases produce
+ a parse-time error instead.
</para>
<note>
@@ -1084,11 +1094,34 @@ SELECT x, CASE WHEN x &gt; 0 THEN g ELSE 0 END
functions. Also, nested set-returning functions did not work as
described above; instead, a set-returning function could have at most
one set-returning argument, and each nest of set-returning functions
- was run independently. The behavior for conditional execution
- (set-returning functions inside <literal>CASE</> etc) was different too.
+ was run independently. Also, conditional execution (set-returning
+ functions inside <literal>CASE</> etc) was previously allowed,
+ complicating things even more.
Use of the <literal>LATERAL</> syntax is recommended when writing
queries that need to work in older <productname>PostgreSQL</> versions,
because that will give consistent results across different versions.
+ If you have a query that is relying on conditional execution of a
+ set-returning function, you may be able to fix it by moving the
+ conditional test into a custom set-returning function. For example,
+<programlisting>
+SELECT x, CASE WHEN y &gt; 0 THEN generate_series(1, z) ELSE 5 END FROM tab;
+</programlisting>
+ could become
+<programlisting>
+CREATE FUNCTION case_generate_series(cond bool, start int, fin int, els int)
+ RETURNS SETOF int AS $$
+BEGIN
+ IF cond THEN
+ RETURN QUERY SELECT generate_series(start, fin);
+ ELSE
+ RETURN QUERY SELECT els;
+ END IF;
+END$$ LANGUAGE plpgsql;
+
+SELECT x, case_generate_series(y &gt; 0, 1, z, 5) FROM tab;
+</programlisting>
+ This formulation will work the same in all versions
+ of <productname>PostgreSQL</>.
</para>
</note>
</sect2>