Skip to content

Commit 7446b78

Browse files
committed
Merge branch 'master' into ci2
2 parents 7df64c9 + e68432a commit 7446b78

File tree

102 files changed

+756
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+756
-435
lines changed

contrib/pg_standby/pg_standby.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ char *xlogFilePath; /* where we are going to restore to */
5757
char *nextWALFileName; /* the file we need to get from archive */
5858
char *restartWALFileName; /* the file from which we can restart restore */
5959
char *priorWALFileName; /* the file we need to get from archive */
60-
char WALFilePath[MAXPGPATH]; /* the file path including archive */
60+
char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */
6161
char restoreCommand[MAXPGPATH]; /* run this to restore */
6262
char exclusiveCleanupFileName[MAXFNAMELEN]; /* the file we need to
6363
* get from archive */
@@ -259,9 +259,9 @@ CustomizableCleanupPriorWALFiles(void)
259259
strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
260260
{
261261
#ifdef WIN32
262-
snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
262+
snprintf(WALFilePath, sizeof(WALFilePath), "%s\\%s", archiveLocation, xlde->d_name);
263263
#else
264-
snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, xlde->d_name);
264+
snprintf(WALFilePath, sizeof(WALFilePath), "%s/%s", archiveLocation, xlde->d_name);
265265
#endif
266266

267267
if (debug)

doc/src/sgml/catalogs.sgml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4291,21 +4291,21 @@
42914291
<tbody>
42924292

42934293
<row>
4294-
<entry><structfield>starelid</structfield></entry>
4294+
<entry><structfield>stxrelid</structfield></entry>
42954295
<entry><type>oid</type></entry>
42964296
<entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
42974297
<entry>The table that the described columns belongs to</entry>
42984298
</row>
42994299

43004300
<row>
4301-
<entry><structfield>staname</structfield></entry>
4301+
<entry><structfield>stxname</structfield></entry>
43024302
<entry><type>name</type></entry>
43034303
<entry></entry>
43044304
<entry>Name of the statistic.</entry>
43054305
</row>
43064306

43074307
<row>
4308-
<entry><structfield>stanamespace</structfield></entry>
4308+
<entry><structfield>stxnamespace</structfield></entry>
43094309
<entry><type>oid</type></entry>
43104310
<entry><literal><link linkend="catalog-pg-namespace"><structname>pg_namespace</structname></link>.oid</literal></entry>
43114311
<entry>
@@ -4314,24 +4314,26 @@
43144314
</row>
43154315

43164316
<row>
4317-
<entry><structfield>staowner</structfield></entry>
4317+
<entry><structfield>stxowner</structfield></entry>
43184318
<entry><type>oid</type></entry>
43194319
<entry><literal><link linkend="catalog-pg-authid"><structname>pg_authid</structname></link>.oid</literal></entry>
43204320
<entry>Owner of the statistic</entry>
43214321
</row>
43224322

43234323
<row>
4324-
<entry><structfield>staenabled</structfield></entry>
4324+
<entry><structfield>stxkind</structfield></entry>
43254325
<entry><type>char[]</type></entry>
43264326
<entry></entry>
43274327
<entry>
4328-
An array with the modes of the enabled statistic types, encoded as
4329-
<literal>d</literal> for ndistinct coefficients.
4328+
An array with the modes of the enabled statistic types. Valid values
4329+
are:
4330+
<literal>d</literal> for ndistinct coefficients,
4331+
<literal>f</literal> for functional dependencies.
43304332
</entry>
43314333
</row>
43324334

43334335
<row>
4334-
<entry><structfield>stakeys</structfield></entry>
4336+
<entry><structfield>stxkeys</structfield></entry>
43354337
<entry><type>int2vector</type></entry>
43364338
<entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</literal></entry>
43374339
<entry>
@@ -4342,7 +4344,7 @@
43424344
</row>
43434345

43444346
<row>
4345-
<entry><structfield>standistinct</structfield></entry>
4347+
<entry><structfield>stxndistinct</structfield></entry>
43464348
<entry><type>pg_ndistinct</type></entry>
43474349
<entry></entry>
43484350
<entry>
@@ -4351,7 +4353,7 @@
43514353
</row>
43524354

43534355
<row>
4354-
<entry><structfield>stadependencies</structfield></entry>
4356+
<entry><structfield>stxdependencies</structfield></entry>
43554357
<entry><type>pg_dependencies</type></entry>
43564358
<entry></entry>
43574359
<entry>

doc/src/sgml/client-auth.sgml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
412412
</varlistentry>
413413

414414
<varlistentry>
415-
<term><literal>scram</></term>
415+
<term><literal>scram-sha-256</></term>
416416
<listitem>
417417
<para>
418418
Perform SCRAM-SHA-256 authentication to verify the user's
@@ -683,7 +683,7 @@ host postgres all 192.168.93.0/24 ident
683683
# "postgres" if the user's password is correctly supplied.
684684
#
685685
# TYPE DATABASE USER ADDRESS METHOD
686-
host postgres all 192.168.12.10/32 scram
686+
host postgres all 192.168.12.10/32 scram-sha-256
687687

688688
# Allow any user from hosts in the example.com domain to connect to
689689
# any database if the user's password is correctly supplied.
@@ -694,7 +694,7 @@ host postgres all 192.168.12.10/32 scram
694694
#
695695
# TYPE DATABASE USER ADDRESS METHOD
696696
host all mike .example.com md5
697-
host all all .example.com scram
697+
host all all .example.com scram-sha-256
698698

699699
# In the absence of preceding "host" lines, these two lines will
700700
# reject all connections from 192.168.54.1 (since that entry will be
@@ -922,7 +922,7 @@ omicron bryanh guest1
922922
</indexterm>
923923

924924
<para>
925-
The password-based authentication methods are <literal>scram</>,
925+
The password-based authentication methods are <literal>scram-sha-256</>,
926926
<literal>md5</>, and <literal>password</>. These methods operate
927927
similarly except for the way that the password is sent across the
928928
connection.
@@ -939,8 +939,9 @@ omicron bryanh guest1
939939

940940

941941
<para>
942-
<literal>scram</> performs SCRAM-SHA-256 authentication, as described
943-
in <ulink url="https://tools.ietf.org/html/rfc5802">RFC5802</ulink>. It
942+
<literal>scram-sha-256</> performs SCRAM-SHA-256 authentication, as
943+
described in
944+
<ulink url="https://tools.ietf.org/html/rfc5802">RFC5802</ulink>. It
944945
is a challenge-response scheme, that prevents password sniffing on
945946
untrusted connections. It is more secure than the <literal>md5</>
946947
method, but might not be supported by older clients.
@@ -953,7 +954,7 @@ omicron bryanh guest1
953954
protection if an attacker manages to steal the password hash from the
954955
server, and it cannot be used with the <xref
955956
linkend="guc-db-user-namespace"> feature. For all other users,
956-
<literal>md5</> works the same as <literal>scram</>.
957+
<literal>md5</> works the same as <literal>scram-sha-256</>.
957958
</para>
958959

959960
<para>

doc/src/sgml/config.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,8 @@ include_dir 'conf.d'
11941194
stores the password as an MD5 hash. Setting this to <literal>plain</> stores
11951195
it in plaintext. <literal>on</> and <literal>off</> are also accepted, as
11961196
aliases for <literal>md5</> and <literal>plain</>, respectively. Setting
1197-
this parameter to <literal>scram</> will encrypt the password with
1198-
SCRAM-SHA-256.
1197+
this parameter to <literal>scram-sha-256</> will encrypt the password
1198+
with SCRAM-SHA-256.
11991199
</para>
12001200
</listitem>
12011201
</varlistentry>

doc/src/sgml/high-availability.sgml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,8 @@ primary_slot_name = 'node_a_slot'
10841084
In the case that <varname>synchronous_commit</> is set to
10851085
<literal>remote_apply</>, the standby sends reply messages when the commit
10861086
record is replayed, making the transaction visible.
1087-
If the standby is chosen as a synchronous standby, from a priority
1088-
list of <varname>synchronous_standby_names</> on the primary, the reply
1087+
If the standby is chosen as a synchronous standby, according to the setting
1088+
of <varname>synchronous_standby_names</> on the primary, the reply
10891089
messages from that standby will be considered along with those from other
10901090
synchronous standbys to decide when to release transactions waiting for
10911091
confirmation that the commit record has been received. These parameters
@@ -1246,9 +1246,20 @@ synchronous_standby_names = 'FIRST 2 (s1, s2, s3)'
12461246
The best solution for high availability is to ensure you keep as many
12471247
synchronous standbys as requested. This can be achieved by naming multiple
12481248
potential synchronous standbys using <varname>synchronous_standby_names</>.
1249-
The standbys whose names appear earlier in the list will be used as
1250-
synchronous standbys. Standbys listed after these will take over
1251-
the role of synchronous standby if one of current ones should fail.
1249+
</para>
1250+
1251+
<para>
1252+
In a priority-based synchronous replication, the standbys whose names
1253+
appear earlier in the list will be used as synchronous standbys.
1254+
Standbys listed after these will take over the role of synchronous standby
1255+
if one of current ones should fail.
1256+
</para>
1257+
1258+
<para>
1259+
In a quorum-based synchronous replication, all the standbys appearing
1260+
in the list will be used as candidates for synchronous standbys.
1261+
Even if one of them should fail, the other standbys will keep performing
1262+
the role of candidates of synchronous standby.
12521263
</para>
12531264

12541265
<para>

doc/src/sgml/logical-replication.sgml

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

201201
<para>
202202
Columns of a table are also matched by name. A different order of columns
203-
in the target table is allowed, but the column types have to match.
203+
in the target table is allowed, but the column types have to match. The
204+
target table can have additional columns not provided by the published
205+
table. Those will be filled with their default values.
204206
</para>
205207
</sect1>
206208

doc/src/sgml/planstats.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ EXPLAIN ANALYZE SELECT * FROM t WHERE a = 1 AND b = 1;
525525
you may do this:
526526

527527
<programlisting>
528-
SELECT staname,stadependencies FROM pg_statistic_ext WHERE staname = 's1';
529-
staname | stadependencies
528+
SELECT stxname,stxdependencies FROM pg_statistic_ext WHERE stxname = 's1';
529+
stxname | stxdependencies
530530
---------+--------------------------------------------
531531
s1 | [{1 => 2 : 1.000000}, {2 => 1 : 1.000000}]
532532
(1 row)

doc/src/sgml/protocol.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,9 @@ general, while the next subsection gives more details on SCRAM-SHA-256.
13531353

13541354
<step id="sasl-auth-begin">
13551355
<para>
1356-
To begin a SASL authentication exchange, the server an AuthenticationSASL
1357-
message. It includes a list of SASL authentication mechanisms that the
1358-
server can accept, in the server's preferred order.
1356+
To begin a SASL authentication exchange, the server sends an
1357+
AuthenticationSASL message. It includes a list of SASL authentication
1358+
mechanisms that the server can accept, in the server's preferred order.
13591359
</para>
13601360
</step>
13611361

doc/src/sgml/ref/alter_publication.sgml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> WITH ( <repl
3131

3232
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER }
3333
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
34-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> ADD TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
35-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> SET TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
36-
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE <replaceable class="PARAMETER">table_name</replaceable> [, ...]
34+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> ADD TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
35+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> SET TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
36+
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
3737
</synopsis>
3838
</refsynopsisdiv>
3939

@@ -116,7 +116,11 @@ ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE <
116116
<term><replaceable class="parameter">table_name</replaceable></term>
117117
<listitem>
118118
<para>
119-
Name of an existing table.
119+
Name of an existing table. If <literal>ONLY</> is specified before the
120+
table name, only that table is affected. If <literal>ONLY</> is not
121+
specified, the table and all its descendant tables (if any) are
122+
affected. Optionally, <literal>*</> can be specified after the table
123+
name to explicitly indicate that descendant tables are included.
120124
</para>
121125
</listitem>
122126
</varlistentry>

doc/src/sgml/ref/create_publication.sgml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PostgreSQL documentation
2222
<refsynopsisdiv>
2323
<synopsis>
2424
CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
25-
[ FOR TABLE <replaceable class="parameter">table_name</replaceable> [, ...]
25+
[ FOR TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [, ...]
2626
| FOR ALL TABLES ]
2727
[ WITH ( <replaceable class="parameter">option</replaceable> [, ... ] ) ]
2828

@@ -68,7 +68,12 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable>
6868
<term><literal>FOR TABLE</literal></term>
6969
<listitem>
7070
<para>
71-
Specifies a list of tables to add to the publication.
71+
Specifies a list of tables to add to the publication. If
72+
<literal>ONLY</> is specified before the table name, only
73+
that table is added to the publication. If <literal>ONLY</> is not
74+
specified, the table and all its descendant tables (if any) are added.
75+
Optionally, <literal>*</> can be specified after the table name to
76+
explicitly indicate that descendant tables are included.
7277
</para>
7378
</listitem>
7479
</varlistentry>

doc/src/sgml/ref/create_statistics.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CREATE STATISTICS [ IF NOT EXISTS ] <replaceable class="PARAMETER">statistics_na
3434

3535
<para>
3636
<command>CREATE STATISTICS</command> will create a new extended statistics
37-
object on the specified table.
37+
object on the specified table, foreign table or materialized view.
3838
The statistics will be created in the current database and
3939
will be owned by the user issuing the command.
4040
</para>

doc/src/sgml/ref/create_trigger.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ CREATE TRIGGER view_insert
531531
<programlisting>
532532
CREATE TRIGGER transfer_insert
533533
AFTER INSERT ON transfer
534-
FOR EACH STATEMENT
535534
REFERENCING NEW TABLE AS inserted
535+
FOR EACH STATEMENT
536536
EXECUTE PROCEDURE check_transfer_balances_to_zero();
537537
</programlisting>
538538

@@ -543,8 +543,8 @@ CREATE TRIGGER transfer_insert
543543
<programlisting>
544544
CREATE TRIGGER paired_items_update
545545
AFTER UPDATE ON paired_items
546-
FOR EACH ROW
547546
REFERENCING NEW TABLE AS newtab OLD TABLE AS oldtab
547+
FOR EACH ROW
548548
EXECUTE PROCEDURE check_matching_pairs();
549549
</programlisting>
550550
</para>

doc/src/sgml/runtime.sgml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,28 +2389,14 @@ pg_dumpall -p 5432 | psql -d postgres -p 5433
23892389
<title>Creating a Self-signed Certificate</title>
23902390

23912391
<para>
2392-
To create a quick self-signed certificate for the server, use the
2393-
following <productname>OpenSSL</productname> command:
2392+
To create a quick self-signed certificate for the server, valid for 365
2393+
days, use the following <productname>OpenSSL</productname> command,
2394+
replacing <replaceable>yourdomain.com</> with the server's host name:
23942395
<programlisting>
2395-
openssl req -new -text -out server.req
2396+
openssl req -new -x509 -days 365 -nodes -text -out server.crt \
2397+
-keyout server.key -subj "/CN=<replaceable>yourdomain.com</>"
23962398
</programlisting>
2397-
Fill out the information that <application>openssl</> asks for. Make sure
2398-
you enter the local host name as <quote>Common Name</>; the challenge
2399-
password can be left blank. The program will generate a key that is
2400-
passphrase protected; it will not accept a passphrase that is less
2401-
than four characters long. To remove the passphrase again (as you must
2402-
if you want automatic start-up of the server), next run the commands:
2403-
<programlisting>
2404-
openssl rsa -in privkey.pem -out server.key
2405-
rm privkey.pem
2406-
</programlisting>
2407-
Enter the old passphrase to unlock the existing key. Now do:
2408-
<programlisting>
2409-
openssl req -x509 -in server.req -text -key server.key -out server.crt
2410-
</programlisting>
2411-
to turn the certificate into a self-signed certificate and to copy
2412-
the key and certificate to where the server will look for them.
2413-
Finally do:
2399+
Then do:
24142400
<programlisting>
24152401
chmod og-rwx server.key
24162402
</programlisting>

src/backend/access/heap/rewriteheap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ CheckPointLogicalRewriteHeap(void)
12031203
XLogRecPtr redo;
12041204
DIR *mappings_dir;
12051205
struct dirent *mapping_de;
1206-
char path[MAXPGPATH];
1206+
char path[MAXPGPATH + 20];
12071207

12081208
/*
12091209
* We start of with a minimum of the last redo pointer. No new decoding
@@ -1234,7 +1234,7 @@ CheckPointLogicalRewriteHeap(void)
12341234
strcmp(mapping_de->d_name, "..") == 0)
12351235
continue;
12361236

1237-
snprintf(path, MAXPGPATH, "pg_logical/mappings/%s", mapping_de->d_name);
1237+
snprintf(path, sizeof(path), "pg_logical/mappings/%s", mapping_de->d_name);
12381238
if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
12391239
continue;
12401240

src/backend/access/transam/parallel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ LaunchParallelWorkers(ParallelContext *pcxt)
435435
oldcontext = MemoryContextSwitchTo(TopTransactionContext);
436436

437437
/* Configure a worker. */
438+
memset(&worker, 0, sizeof(worker));
438439
snprintf(worker.bgw_name, BGW_MAXLEN, "parallel worker for PID %d",
439440
MyProcPid);
440441
worker.bgw_flags =
@@ -446,7 +447,6 @@ LaunchParallelWorkers(ParallelContext *pcxt)
446447
sprintf(worker.bgw_function_name, "ParallelWorkerMain");
447448
worker.bgw_main_arg = UInt32GetDatum(dsm_segment_handle(pcxt->seg));
448449
worker.bgw_notify_pid = MyProcPid;
449-
memset(&worker.bgw_extra, 0, BGW_EXTRALEN);
450450

451451
/*
452452
* Start workers.

0 commit comments

Comments
 (0)