Skip to content

Commit d55509c

Browse files
committed
Merge branch 'REL9_5_STABLE' into PGPRO9_5
Conflicts: doc/src/sgml/ref/create_index.sgml
2 parents 5efaafc + 8ef3d9f commit d55509c

File tree

21 files changed

+156
-61
lines changed

21 files changed

+156
-61
lines changed

contrib/postgres_fdw/deparse.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,27 @@ deparseNullTest(NullTest *node, deparse_expr_cxt *context)
18061806

18071807
appendStringInfoChar(buf, '(');
18081808
deparseExpr(node->arg, context);
1809-
if (node->nulltesttype == IS_NULL)
1810-
appendStringInfoString(buf, " IS NULL)");
1809+
1810+
/*
1811+
* For scalar inputs, we prefer to print as IS [NOT] NULL, which is
1812+
* shorter and traditional. If it's a rowtype input but we're applying a
1813+
* scalar test, must print IS [NOT] DISTINCT FROM NULL to be semantically
1814+
* correct.
1815+
*/
1816+
if (node->argisrow || !type_is_rowtype(exprType((Node *) node->arg)))
1817+
{
1818+
if (node->nulltesttype == IS_NULL)
1819+
appendStringInfoString(buf, " IS NULL)");
1820+
else
1821+
appendStringInfoString(buf, " IS NOT NULL)");
1822+
}
18111823
else
1812-
appendStringInfoString(buf, " IS NOT NULL)");
1824+
{
1825+
if (node->nulltesttype == IS_NULL)
1826+
appendStringInfoString(buf, " IS NOT DISTINCT FROM NULL)");
1827+
else
1828+
appendStringInfoString(buf, " IS DISTINCT FROM NULL)");
1829+
}
18131830
}
18141831

18151832
/*

doc/src/sgml/information_schema.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5881,7 +5881,7 @@ ORDER BY c.ordinal_position;
58815881
The view <literal>udt_privileges</literal> identifies
58825882
<literal>USAGE</literal> privileges granted on user-defined types to a
58835883
currently enabled role or by a currently enabled role. There is one row for
5884-
each combination of column, grantor, and grantee. This view shows only
5884+
each combination of type, grantor, and grantee. This view shows only
58855885
composite types (see under <xref linkend="infoschema-user-defined-types">
58865886
for why); see
58875887
<xref linkend="infoschema-usage-privileges"> for domain privileges.

doc/src/sgml/ref/create_table.sgml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,51 +329,60 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
329329
table.
330330
</para>
331331
<para>
332-
Default expressions for the copied column definitions will only be
333-
copied if <literal>INCLUDING DEFAULTS</literal> is specified.
334-
Defaults that call database-modification functions, like
335-
<function>nextval</>, create a linkage between the original and
336-
new tables. The
332+
Default expressions for the copied column definitions will be copied
333+
only if <literal>INCLUDING DEFAULTS</literal> is specified. The
337334
default behavior is to exclude default expressions, resulting in the
338335
copied columns in the new table having null defaults.
336+
Note that copying defaults that call database-modification functions,
337+
such as <function>nextval</>, may create a functional linkage between
338+
the original and new tables.
339339
</para>
340340
<para>
341341
Not-null constraints are always copied to the new table.
342342
<literal>CHECK</literal> constraints will be copied only if
343343
<literal>INCLUDING CONSTRAINTS</literal> is specified.
344-
Indexes, <literal>PRIMARY KEY</>, and <literal>UNIQUE</> constraints
345-
on the original table will be created on the new table only if the
346-
<literal>INCLUDING INDEXES</literal> clause is specified.
347344
No distinction is made between column constraints and table
348345
constraints.
349346
</para>
350-
<para><literal>STORAGE</> settings for the copied column definitions will only
351-
be copied if <literal>INCLUDING STORAGE</literal> is specified. The
347+
<para>
348+
Indexes, <literal>PRIMARY KEY</>, <literal>UNIQUE</>,
349+
and <literal>EXCLUDE</> constraints on the original table will be
350+
created on the new table only if <literal>INCLUDING INDEXES</literal>
351+
is specified. Names for the new indexes and constraints are
352+
chosen according to the default rules, regardless of how the originals
353+
were named. (This behavior avoids possible duplicate-name failures for
354+
the new indexes.)
355+
</para>
356+
<para>
357+
<literal>STORAGE</> settings for the copied column definitions will be
358+
copied only if <literal>INCLUDING STORAGE</literal> is specified. The
352359
default behavior is to exclude <literal>STORAGE</> settings, resulting
353360
in the copied columns in the new table having type-specific default
354361
settings. For more on <literal>STORAGE</> settings, see
355362
<xref linkend="storage-toast">.
356363
</para>
357364
<para>
358365
Comments for the copied columns, constraints, and indexes
359-
will only be copied if <literal>INCLUDING COMMENTS</literal>
366+
will be copied only if <literal>INCLUDING COMMENTS</literal>
360367
is specified. The default behavior is to exclude comments, resulting in
361368
the copied columns and constraints in the new table having no comments.
362369
</para>
363-
<para><literal>INCLUDING ALL</literal> is an abbreviated form of
370+
<para>
371+
<literal>INCLUDING ALL</literal> is an abbreviated form of
364372
<literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
365373
</para>
366374
<para>
367-
Note also that unlike <literal>INHERITS</literal>, columns and
375+
Note that unlike <literal>INHERITS</literal>, columns and
368376
constraints copied by <literal>LIKE</> are not merged with similarly
369377
named columns and constraints.
370378
If the same name is specified explicitly or in another
371379
<literal>LIKE</literal> clause, an error is signaled.
372380
</para>
373381
<para>
374-
The <literal>LIKE</literal> clause can also be used to copy columns from
375-
views, foreign tables, or composite types. Inapplicable options (e.g., <literal>INCLUDING
376-
INDEXES</literal> from a view) are ignored.
382+
The <literal>LIKE</literal> clause can also be used to copy column
383+
definitions from views, foreign tables, or composite types.
384+
Inapplicable options (e.g., <literal>INCLUDING INDEXES</literal> from
385+
a view) are ignored.
377386
</para>
378387
</listitem>
379388
</varlistentry>
@@ -1514,6 +1523,17 @@ CREATE TABLE employees OF employee_type (
15141523
</para>
15151524
</refsect2>
15161525

1526+
<refsect2>
1527+
<title><literal>LIKE</> Clause</title>
1528+
1529+
<para>
1530+
While a <literal>LIKE</> clause exists in the SQL standard, many of the
1531+
options that <productname>PostgreSQL</productname> accepts for it are not
1532+
in the standard, and some of the standard's options are not implemented
1533+
by <productname>PostgreSQL</productname>.
1534+
</para>
1535+
</refsect2>
1536+
15171537
<refsect2>
15181538
<title><literal>WITH</> Clause</title>
15191539

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ doc/src/sgml/ref/pg_basebackup.sgml
364364
<listitem>
365365
<para>
366366
Enables gzip compression of tar file output, and specifies the
367-
compression level (1 through 9, 9 being best
367+
compression level (0 through 9, 0 being no compression and 9 being best
368368
compression). Compression is only available when using the tar
369369
format.
370370
</para>

doc/src/sgml/ref/pgbench.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ END;
10451045
within the interval, <replaceable>latency_sum</replaceable> is a sum of latencies
10461046
(so you can compute average latency easily). The following two fields are useful
10471047
for variance estimation - <replaceable>latency_sum</> is a sum of latencies and
1048-
<replaceable>latency_2_sum</> is a sum of 2nd powers of latencies. The last two
1048+
<replaceable>latency_2_sum</> is a sum of 2nd powers of latencies. The next two
10491049
fields are <replaceable>min_latency</> - a minimum latency within the interval, and
10501050
<replaceable>max_latency</> - maximum latency within the interval. A transaction is
10511051
counted into the interval when it was committed. The fields in the end,

doc/src/sgml/runtime.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
184184
</para>
185185

186186
<para>
187-
Non<literal>C</> and and non-<literal>POSIX</> locales rely on the
187+
Non-<literal>C</> and and non-<literal>POSIX</> locales rely on the
188188
operating system's collation library for character set ordering.
189189
This controls the ordering of keys stored in indexes. For this reason,
190190
a cluster cannot switch to an incompatible collation library version,

src/backend/libpq/pqmq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ mq_putmessage(char msgtype, const char *s, size_t len)
172172
break;
173173

174174
WaitLatch(&MyProc->procLatch, WL_LATCH_SET, 0);
175-
CHECK_FOR_INTERRUPTS();
176175
ResetLatch(&MyProc->procLatch);
176+
CHECK_FOR_INTERRUPTS();
177177
}
178178

179179
pq_mq_busy = false;

src/backend/optimizer/util/plancat.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,13 @@ get_relation_constraints(PlannerInfo *root,
10971097
att->attcollation,
10981098
0);
10991099
ntest->nulltesttype = IS_NOT_NULL;
1100-
ntest->argisrow = type_is_rowtype(att->atttypid);
1100+
1101+
/*
1102+
* argisrow=false is correct even for a composite column,
1103+
* because attnotnull does not represent a SQL-spec IS NOT
1104+
* NULL test in such a case, just IS DISTINCT FROM NULL.
1105+
*/
1106+
ntest->argisrow = false;
11011107
ntest->location = -1;
11021108
result = lappend(result, ntest);
11031109
}

src/backend/parser/parse_utilcmd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
10951095

10961096
/*
10971097
* We don't try to preserve the name of the source index; instead, just
1098-
* let DefineIndex() choose a reasonable name.
1098+
* let DefineIndex() choose a reasonable name. (If we tried to preserve
1099+
* the name, we'd get duplicate-relation-name failures unless the source
1100+
* table was in a different schema.)
10991101
*/
11001102
index->idxname = NULL;
11011103

src/backend/storage/ipc/shm_mq.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -868,11 +868,11 @@ shm_mq_send_bytes(shm_mq_handle *mqh, Size nbytes, const void *data,
868868
*/
869869
WaitLatch(MyLatch, WL_LATCH_SET, 0);
870870

871-
/* An interrupt may have occurred while we were waiting. */
872-
CHECK_FOR_INTERRUPTS();
873-
874871
/* Reset the latch so we don't spin. */
875872
ResetLatch(MyLatch);
873+
874+
/* An interrupt may have occurred while we were waiting. */
875+
CHECK_FOR_INTERRUPTS();
876876
}
877877
else
878878
{
@@ -965,11 +965,11 @@ shm_mq_receive_bytes(shm_mq *mq, Size bytes_needed, bool nowait,
965965
*/
966966
WaitLatch(MyLatch, WL_LATCH_SET, 0);
967967

968-
/* An interrupt may have occurred while we were waiting. */
969-
CHECK_FOR_INTERRUPTS();
970-
971968
/* Reset the latch so we don't spin. */
972969
ResetLatch(MyLatch);
970+
971+
/* An interrupt may have occurred while we were waiting. */
972+
CHECK_FOR_INTERRUPTS();
973973
}
974974
}
975975

@@ -1071,11 +1071,11 @@ shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr,
10711071
/* Wait to be signalled. */
10721072
WaitLatch(MyLatch, WL_LATCH_SET, 0);
10731073

1074-
/* An interrupt may have occurred while we were waiting. */
1075-
CHECK_FOR_INTERRUPTS();
1076-
10771074
/* Reset the latch so we don't spin. */
10781075
ResetLatch(MyLatch);
1076+
1077+
/* An interrupt may have occurred while we were waiting. */
1078+
CHECK_FOR_INTERRUPTS();
10791079
}
10801080
}
10811081
PG_CATCH();

0 commit comments

Comments
 (0)