Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 174061f

Browse files
committed
Merge branch 'REL_10_STABLE' into PGPRO10
2 parents efb70c8 + dcc1e61 commit 174061f

38 files changed

+369
-197
lines changed

contrib/pgcrypto/expected/rijndael.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--
2-
-- AES / Rijndael-128 cipher
2+
-- AES cipher (aka Rijndael-128, -192, or -256)
33
--
44
-- ensure consistent test output regardless of the default bytea format
55
SET bytea_output TO escape;

contrib/pgcrypto/sql/rijndael.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--
2-
-- AES / Rijndael-128 cipher
2+
-- AES cipher (aka Rijndael-128, -192, or -256)
33
--
44
-- ensure consistent test output regardless of the default bytea format
55
SET bytea_output TO escape;

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 39 additions & 38 deletions
Large diffs are not rendered by default.

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,16 @@ SELECT ft5, ft5.c1, ft5.c2, ft5.c3, ft4.c1, ft4.c2 FROM ft5 left join ft4 on ft5
560560
SELECT ft5, ft5.c1, ft5.c2, ft5.c3, ft4.c1, ft4.c2 FROM ft5 left join ft4 on ft5.c1 = ft4.c1 WHERE ft4.c1 BETWEEN 10 and 30 ORDER BY ft5.c1, ft4.c1;
561561

562562
-- multi-way join involving multiple merge joins
563+
-- (this case used to have EPQ-related planning problems)
564+
SET enable_nestloop TO false;
565+
SET enable_hashjoin TO false;
563566
EXPLAIN (VERBOSE, COSTS OFF)
564-
SELECT * FROM ft1, ft2, ft4, ft5 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = ft4.c1
565-
AND ft1.c1 = ft5.c1 FOR UPDATE;
566-
SELECT * FROM ft1, ft2, ft4, ft5 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = ft4.c1
567-
AND ft1.c1 = ft5.c1 FOR UPDATE;
567+
SELECT * FROM ft1, ft2, ft4, ft5 WHERE ft1.c1 = ft2.c1 AND ft1.c2 = ft4.c1
568+
AND ft1.c2 = ft5.c1 AND ft1.c1 < 100 AND ft2.c1 < 100 FOR UPDATE;
569+
SELECT * FROM ft1, ft2, ft4, ft5 WHERE ft1.c1 = ft2.c1 AND ft1.c2 = ft4.c1
570+
AND ft1.c2 = ft5.c1 AND ft1.c1 < 100 AND ft2.c1 < 100 FOR UPDATE;
571+
RESET enable_nestloop;
572+
RESET enable_hashjoin;
568573

569574
-- check join pushdown in situations where multiple userids are involved
570575
CREATE ROLE regress_view_owner;

doc/src/sgml/contrib-spi.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
<para>
1212
The <application>spi</> module provides several workable examples
13-
of using SPI and triggers. While these functions are of some value in
13+
of using the <link linkend="spi">Server Programming Interface</link>
14+
(<acronym>SPI</acronym>) and triggers. While these functions are of
15+
some value in
1416
their own right, they are even more useful as examples to modify for
1517
your own purposes. The functions are general enough to be used
1618
with any table, but you have to specify table and field names (as described

doc/src/sgml/logicaldecoding.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
363363
</para>
364364
<sect2 id="logicaldecoding-output-init">
365365
<title>Initialization Function</title>
366-
<indexterm zone="logicaldecoding">
366+
<indexterm zone="logicaldecoding-output-init">
367367
<primary>_PG_output_plugin_init</primary>
368368
</indexterm>
369369
<para>

doc/src/sgml/pgcrypto.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ decrypt_iv(data bytea, key bytea, iv bytea, type text) returns bytea
10621062

10631063
<itemizedlist>
10641064
<listitem><para><literal>bf</literal> &mdash; Blowfish</para></listitem>
1065-
<listitem><para><literal>aes</literal> &mdash; AES (Rijndael-128)</para></listitem>
1065+
<listitem><para><literal>aes</literal> &mdash; AES (Rijndael-128, -192 or -256)</para></listitem>
10661066
</itemizedlist>
10671067
and <replaceable>mode</> is one of:
10681068
<itemizedlist>

doc/src/sgml/protocol.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ On error, the server can abort the authentication at any stage, and send an
14201420
ErrorMessage.
14211421
</para>
14221422

1423-
<sect2 id="sasl-scram-sha256">
1423+
<sect2 id="sasl-scram-sha-256">
14241424
<title>SCRAM-SHA-256 authentication</title>
14251425

14261426
<para>

doc/src/sgml/ref/create_trigger.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,10 @@ UPDATE OF <replaceable>column_name1</replaceable> [, <replaceable>column_name2</
501501

502502
<para>
503503
Modifying a partitioned table or a table with inheritance children fires
504-
statement-level triggers directly attached to that table, but not
504+
statement-level triggers attached to the explicitly named table, but not
505505
statement-level triggers for its partitions or child tables. In contrast,
506-
row-level triggers are fired for all affected partitions or child tables.
506+
row-level triggers are fired on the rows in affected partitions or
507+
child tables, even if they are not explicitly named in the query.
507508
If a statement-level trigger has been defined with transition relations
508509
named by a <literal>REFERENCING</literal> clause, then before and after
509510
images of rows are visible from all affected partitions or child tables.

doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<arg choice="plain"><option>-B</option></arg>
2525
<arg choice="plain"><replaceable>newbindir</replaceable></arg>
2626
<arg choice="plain"><option>-d</option></arg>
27-
<arg choice="plain"><replaceable>olddatadir</replaceable></arg>
27+
<arg choice="plain"><replaceable>oldconfigdir</replaceable></arg>
2828
<arg choice="plain"><option>-D</option></arg>
29-
<arg choice="plain"><replaceable>newdatadir</replaceable></arg>
29+
<arg choice="plain"><replaceable>newconfigdir</replaceable></arg>
3030
<arg rep="repeat"><replaceable>option</replaceable></arg>
3131
</cmdsynopsis>
3232
</refsynopsisdiv>
@@ -38,9 +38,9 @@
3838
<application>pg_upgrade</> (formerly called <application>pg_migrator</>) allows data
3939
stored in <productname>PostgreSQL</> or <productname>&productname;</> data files to be upgraded to a later <productname>&productname;</>
4040
major version without the data dump/reload typically required for
41-
major version upgrades, e.g. from 9.6.3 to the current major release
42-
of <productname>&productname;</>. It is not required for minor version upgrades, e.g. from
43-
9.6.2 to 9.6.3.
41+
major version upgrades, e.g. from 9.5.8 to 9.6.4 or from 10.7 to 11.2.
42+
It is not required for minor version upgrades, e.g. from 9.6.2 to 9.6.3
43+
or from 10.1 to 10.2.
4444
</para>
4545

4646
<para>
@@ -99,16 +99,16 @@
9999
</varlistentry>
100100

101101
<varlistentry>
102-
<term><option>-d</option> <replaceable>datadir</></term>
103-
<term><option>--old-datadir=</option><replaceable>datadir</></term>
104-
<listitem><para>the old cluster data directory; environment
102+
<term><option>-d</option> <replaceable>configdir</></term>
103+
<term><option>--old-datadir=</option><replaceable>configdir</></term>
104+
<listitem><para>the old database cluster configuration directory; environment
105105
variable <envar>PGDATAOLD</></para></listitem>
106106
</varlistentry>
107107

108108
<varlistentry>
109-
<term><option>-D</option> <replaceable>datadir</></term>
110-
<term><option>--new-datadir=</option><replaceable>datadir</></term>
111-
<listitem><para>the new cluster data directory; environment
109+
<term><option>-D</option> <replaceable>configdir</></term>
110+
<term><option>--new-datadir=</option><replaceable>configdir</>y</term>
111+
<listitem><para>the new database cluster configuration directory; environment
112112
variable <envar>PGDATANEW</></para></listitem>
113113
</varlistentry>
114114

@@ -476,7 +476,7 @@ pg_upgrade.exe
476476
<title>Save configuration files</title>
477477

478478
<para>
479-
Save any configuration files from the old standbys' data
479+
Save any configuration files from the old standbys' configuration
480480
directories you need to keep, e.g. <filename>postgresql.conf</>,
481481
<literal>recovery.conf</>, because these will be overwritten or
482482
removed in the next step.
@@ -494,10 +494,10 @@ pg_upgrade.exe
494494
server:
495495

496496
<programlisting>
497-
rsync --archive --delete --hard-links --size-only --no-inc-recursive old_pgdata new_pgdata remote_dir
497+
rsync --archive --delete --hard-links --size-only --no-inc-recursive old_cluster new_cluster remote_dir
498498
</programlisting>
499499

500-
where <option>old_pgdata</> and <option>new_pgdata</> are relative
500+
where <option>old_cluster</> and <option>new_cluster</> are relative
501501
to the current directory on the primary, and <option>remote_dir</>
502502
is <emphasis>above</> the old and new cluster directories
503503
on the standby. The directory structure under the specified
@@ -506,8 +506,8 @@ rsync --archive --delete --hard-links --size-only --no-inc-recursive old_pgdata
506506
remote directory, e.g.
507507

508508
<programlisting>
509-
rsync --archive --delete --hard-links --size-only --no-inc-recursive /opt/PostgreSQL/9.5/data \
510-
/opt/PostgreSQL/9.6/data standby.example.com:/opt/PostgreSQL
509+
rsync --archive --delete --hard-links --size-only --no-inc-recursive /opt/PostgreSQL/9.5 \
510+
/opt/PostgreSQL/9.6 standby.example.com:/opt/PostgreSQL
511511
</programlisting>
512512

513513
You can verify what the command will do using

doc/src/sgml/spi.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
have documented error-return conventions. Those conventions only apply
4343
for errors detected within the SPI functions themselves, however.)
4444
It is possible to recover control after an error by establishing your own
45-
subtransaction surrounding SPI calls that might fail. This is not currently
46-
documented because the mechanisms required are still in flux.
45+
subtransaction surrounding SPI calls that might fail.
4746
</para>
4847

4948
<para>

src/backend/access/hash/hashovfl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,10 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin)
341341
metap->hashm_mapp[metap->hashm_nmaps] = BufferGetBlockNumber(newmapbuf);
342342
metap->hashm_nmaps++;
343343
metap->hashm_spares[splitnum]++;
344-
MarkBufferDirty(metabuf);
345344
}
346345

346+
MarkBufferDirty(metabuf);
347+
347348
/*
348349
* for new overflow page, we don't need to explicitly set the bit in
349350
* bitmap page, as by default that will be set to "in use".

src/backend/access/transam/parallel.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ void
388388
ReinitializeParallelDSM(ParallelContext *pcxt)
389389
{
390390
FixedParallelState *fps;
391-
char *error_queue_space;
392-
int i;
393391

394392
/* Wait for any old workers to exit. */
395393
if (pcxt->nworkers_launched > 0)
@@ -409,18 +407,23 @@ ReinitializeParallelDSM(ParallelContext *pcxt)
409407
fps->last_xlog_end = 0;
410408

411409
/* Recreate error queues (if they exist). */
412-
error_queue_space =
413-
shm_toc_lookup(pcxt->toc, PARALLEL_KEY_ERROR_QUEUE, true);
414-
Assert(pcxt->nworkers == 0 || error_queue_space != NULL);
415-
for (i = 0; i < pcxt->nworkers; ++i)
410+
if (pcxt->nworkers > 0)
416411
{
417-
char *start;
418-
shm_mq *mq;
412+
char *error_queue_space;
413+
int i;
419414

420-
start = error_queue_space + i * PARALLEL_ERROR_QUEUE_SIZE;
421-
mq = shm_mq_create(start, PARALLEL_ERROR_QUEUE_SIZE);
422-
shm_mq_set_receiver(mq, MyProc);
423-
pcxt->worker[i].error_mqh = shm_mq_attach(mq, pcxt->seg, NULL);
415+
error_queue_space =
416+
shm_toc_lookup(pcxt->toc, PARALLEL_KEY_ERROR_QUEUE, false);
417+
for (i = 0; i < pcxt->nworkers; ++i)
418+
{
419+
char *start;
420+
shm_mq *mq;
421+
422+
start = error_queue_space + i * PARALLEL_ERROR_QUEUE_SIZE;
423+
mq = shm_mq_create(start, PARALLEL_ERROR_QUEUE_SIZE);
424+
shm_mq_set_receiver(mq, MyProc);
425+
pcxt->worker[i].error_mqh = shm_mq_attach(mq, pcxt->seg, NULL);
426+
}
424427
}
425428
}
426429

src/backend/catalog/partition.c

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,18 +1249,60 @@ make_partition_op_expr(PartitionKey key, int keynum,
12491249
{
12501250
case PARTITION_STRATEGY_LIST:
12511251
{
1252-
ScalarArrayOpExpr *saopexpr;
1253-
1254-
/* Build leftop = ANY (rightop) */
1255-
saopexpr = makeNode(ScalarArrayOpExpr);
1256-
saopexpr->opno = operoid;
1257-
saopexpr->opfuncid = get_opcode(operoid);
1258-
saopexpr->useOr = true;
1259-
saopexpr->inputcollid = key->partcollation[keynum];
1260-
saopexpr->args = list_make2(arg1, arg2);
1261-
saopexpr->location = -1;
1262-
1263-
result = (Expr *) saopexpr;
1252+
List *elems = (List *) arg2;
1253+
int nelems = list_length(elems);
1254+
1255+
Assert(nelems >= 1);
1256+
Assert(keynum == 0);
1257+
1258+
if (nelems > 1 &&
1259+
!type_is_array(key->parttypid[keynum]))
1260+
{
1261+
ArrayExpr *arrexpr;
1262+
ScalarArrayOpExpr *saopexpr;
1263+
1264+
/* Construct an ArrayExpr for the right-hand inputs */
1265+
arrexpr = makeNode(ArrayExpr);
1266+
arrexpr->array_typeid =
1267+
get_array_type(key->parttypid[keynum]);
1268+
arrexpr->array_collid = key->parttypcoll[keynum];
1269+
arrexpr->element_typeid = key->parttypid[keynum];
1270+
arrexpr->elements = elems;
1271+
arrexpr->multidims = false;
1272+
arrexpr->location = -1;
1273+
1274+
/* Build leftop = ANY (rightop) */
1275+
saopexpr = makeNode(ScalarArrayOpExpr);
1276+
saopexpr->opno = operoid;
1277+
saopexpr->opfuncid = get_opcode(operoid);
1278+
saopexpr->useOr = true;
1279+
saopexpr->inputcollid = key->partcollation[keynum];
1280+
saopexpr->args = list_make2(arg1, arrexpr);
1281+
saopexpr->location = -1;
1282+
1283+
result = (Expr *) saopexpr;
1284+
}
1285+
else
1286+
{
1287+
List *elemops = NIL;
1288+
ListCell *lc;
1289+
1290+
foreach (lc, elems)
1291+
{
1292+
Expr *elem = lfirst(lc),
1293+
*elemop;
1294+
1295+
elemop = make_opclause(operoid,
1296+
BOOLOID,
1297+
false,
1298+
arg1, elem,
1299+
InvalidOid,
1300+
key->partcollation[keynum]);
1301+
elemops = lappend(elemops, elemop);
1302+
}
1303+
1304+
result = nelems > 1 ? makeBoolExpr(OR_EXPR, elemops, -1) : linitial(elemops);
1305+
}
12641306
break;
12651307
}
12661308

@@ -1292,11 +1334,10 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec)
12921334
{
12931335
List *result;
12941336
Expr *keyCol;
1295-
ArrayExpr *arr;
12961337
Expr *opexpr;
12971338
NullTest *nulltest;
12981339
ListCell *cell;
1299-
List *arrelems = NIL;
1340+
List *elems = NIL;
13001341
bool list_has_null = false;
13011342

13021343
/*
@@ -1324,29 +1365,24 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec)
13241365
if (val->constisnull)
13251366
list_has_null = true;
13261367
else
1327-
arrelems = lappend(arrelems, copyObject(val));
1368+
elems = lappend(elems, copyObject(val));
13281369
}
13291370

1330-
if (arrelems)
1371+
if (elems)
13311372
{
1332-
/* Construct an ArrayExpr for the non-null partition values */
1333-
arr = makeNode(ArrayExpr);
1334-
arr->array_typeid = !type_is_array(key->parttypid[0])
1335-
? get_array_type(key->parttypid[0])
1336-
: key->parttypid[0];
1337-
arr->array_collid = key->parttypcoll[0];
1338-
arr->element_typeid = key->parttypid[0];
1339-
arr->elements = arrelems;
1340-
arr->multidims = false;
1341-
arr->location = -1;
1342-
1343-
/* Generate the main expression, i.e., keyCol = ANY (arr) */
1373+
/*
1374+
* Generate the operator expression from the non-null partition
1375+
* values.
1376+
*/
13441377
opexpr = make_partition_op_expr(key, 0, BTEqualStrategyNumber,
1345-
keyCol, (Expr *) arr);
1378+
keyCol, (Expr *) elems);
13461379
}
13471380
else
13481381
{
1349-
/* If there are no partition values, we don't need an = ANY expr */
1382+
/*
1383+
* If there are no partition values, we don't need an operator
1384+
* expression.
1385+
*/
13501386
opexpr = NULL;
13511387
}
13521388

src/backend/commands/copy.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "access/sysattr.h"
2626
#include "access/xact.h"
2727
#include "access/xlog.h"
28-
#include "catalog/dependency.h"
2928
#include "catalog/pg_type.h"
3029
#include "commands/copy.h"
3130
#include "commands/defrem.h"
@@ -3064,19 +3063,8 @@ BeginCopyFrom(ParseState *pstate,
30643063
{
30653064
/* attribute is NOT to be copied from input */
30663065
/* use default value if one exists */
3067-
Expr *defexpr;
3068-
3069-
if (attr[attnum - 1]->attidentity)
3070-
{
3071-
NextValueExpr *nve = makeNode(NextValueExpr);
3072-
3073-
nve->seqid = getOwnedSequence(RelationGetRelid(cstate->rel),
3074-
attnum);
3075-
nve->typeId = attr[attnum - 1]->atttypid;
3076-
defexpr = (Expr *) nve;
3077-
}
3078-
else
3079-
defexpr = (Expr *) build_column_default(cstate->rel, attnum);
3066+
Expr *defexpr = (Expr *) build_column_default(cstate->rel,
3067+
attnum);
30803068

30813069
if (defexpr != NULL)
30823070
{

0 commit comments

Comments
 (0)