Skip to content

Commit 876c1ea

Browse files
committed
Merge branch 'REL9_6_STABLE' into PGPRO9_6
2 parents 163c92d + bd75335 commit 876c1ea

File tree

16 files changed

+174
-100
lines changed

16 files changed

+174
-100
lines changed

configure

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,7 @@ else
27642764
fi
27652765

27662766

2767-
PGPRO_VERSION="$PACKAGE_VERSION.1"
2767+
PGPRO_VERSION="$PACKAGE_VERSION.2"
27682768
PGPRO_PACKAGE_NAME="PostgresPro"
27692769
PGPRO_EDITION="standard"
27702770

@@ -15955,24 +15955,6 @@ cat >>confdefs.h <<_ACEOF
1595515955
_ACEOF
1595615956

1595715957

15958-
15959-
if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
15960-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15961-
/* end confdefs.h. */
15962-
15963-
#define INT64CONST(x) x##LL
15964-
long long int foo = INT64CONST(0x1234567890123456);
15965-
15966-
_ACEOF
15967-
if ac_fn_c_try_compile "$LINENO"; then :
15968-
15969-
$as_echo "#define HAVE_LL_CONSTANTS 1" >>confdefs.h
15970-
15971-
fi
15972-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
15973-
fi
15974-
15975-
1597615958
# If we found "long int" is 64 bits, assume snprintf handles it. If
1597715959
# we found we need to use "long long int", better check. We cope with
1597815960
# snprintfs that use %lld, %qd, or %I64d as the format. If none of these

configure.in

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major versio
3838
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
3939
[PG_VERSION="$PACKAGE_VERSION$withval"],
4040
[PG_VERSION="$PACKAGE_VERSION"])
41-
PGPRO_VERSION="$PACKAGE_VERSION.1"
41+
PGPRO_VERSION="$PACKAGE_VERSION.2"
4242
PGPRO_PACKAGE_NAME="PostgresPro"
4343
PGPRO_EDITION="standard"
4444
AC_SUBST(PGPRO_PACKAGE_NAME)
@@ -1856,18 +1856,6 @@ fi
18561856
AC_DEFINE_UNQUOTED(PG_INT64_TYPE, $pg_int64_type,
18571857
[Define to the name of a signed 64-bit integer type.])
18581858

1859-
dnl If we need to use "long long int", figure out whether nnnLL notation works.
1860-
1861-
if test x"$HAVE_LONG_LONG_INT_64" = xyes ; then
1862-
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1863-
#define INT64CONST(x) x##LL
1864-
long long int foo = INT64CONST(0x1234567890123456);
1865-
])],
1866-
[AC_DEFINE(HAVE_LL_CONSTANTS, 1, [Define to 1 if constants of type 'long long int' should have the suffix LL.])],
1867-
[])
1868-
fi
1869-
1870-
18711859
# If we found "long int" is 64 bits, assume snprintf handles it. If
18721860
# we found we need to use "long long int", better check. We cope with
18731861
# snprintfs that use %lld, %qd, or %I64d as the format. If none of these

doc/src/sgml/backup.sgml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,11 @@ SELECT pg_start_backup('label', false, false);
889889
<programlisting>
890890
SELECT * FROM pg_stop_backup(false);
891891
</programlisting>
892-
This terminates the backup mode and performs an automatic switch to
893-
the next WAL segment. The reason for the switch is to arrange for
892+
This terminates backup mode. On a primary, it also performs an automatic
893+
switch to the next WAL segment. On a standby, it is not possible to
894+
automatically switch WAL segments, so you may wish to run
895+
<function>pg_switch_xlog</function> on the primary to perform a manual
896+
switch. The reason for the switch is to arrange for
894897
the last WAL segment file written during the backup interval to be
895898
ready to archive.
896899
</para>
@@ -908,7 +911,7 @@ SELECT * FROM pg_stop_backup(false);
908911
Once the WAL segment files active during the backup are archived, you are
909912
done. The file identified by <function>pg_stop_backup</>'s first return
910913
value is the last segment that is required to form a complete set of
911-
backup files. If <varname>archive_mode</> is enabled,
914+
backup files. On a primary, if <varname>archive_mode</> is enabled,
912915
<function>pg_stop_backup</> does not return until the last segment has
913916
been archived.
914917
Archiving of these files happens automatically since you have
@@ -924,6 +927,13 @@ SELECT * FROM pg_stop_backup(false);
924927
<function>pg_stop_backup</> terminates because of this your backup
925928
may not be valid.
926929
</para>
930+
931+
<para>
932+
Note that on a standby <function>pg_stop_backup</> does not wait for
933+
WAL segments to be archived so the backup process must ensure that all WAL
934+
segments required for the backup are successfully archived.
935+
</para>
936+
927937
</listitem>
928938
</orderedlist>
929939
</para>
@@ -932,9 +942,9 @@ SELECT * FROM pg_stop_backup(false);
932942
<title>Making an exclusive low level backup</title>
933943
<para>
934944
The process for an exclusive backup is mostly the same as for a
935-
non-exclusive one, but it differs in a few key steps. It does not allow
936-
more than one concurrent backup to run, and there can be some issues on
937-
the server if it crashes during the backup. Prior to &productname; 9.6, this
945+
non-exclusive one, but it differs in a few key steps. This type of backup
946+
can only be taken on a primary and does not allow concurrent backups.
947+
Prior to <productname>PostgreSQL</> 9.6, this
938948
was the only low-level method available, but it is now recommended that
939949
all users upgrade their scripts to use non-exclusive backups if possible.
940950
</para>
@@ -992,6 +1002,11 @@ SELECT pg_start_backup('label', true);
9921002
<xref linkend="backup-lowlevel-base-backup-data"> for things to
9931003
consider during this backup.
9941004
</para>
1005+
<para>
1006+
Note that if the server crashes during the backup it may not be
1007+
possible to restart until the <literal>backup_label</> file has been
1008+
manually deleted from the <envar>PGDATA</envar> directory.
1009+
</para>
9951010
</listitem>
9961011
<listitem>
9971012
<para>

doc/src/sgml/event-trigger.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@
565565
<entry align="center"><literal>X</literal></entry>
566566
<entry align="center"><literal>-</literal></entry>
567567
<entry align="center"><literal>-</literal></entry>
568+
<entry align="center"></entry>
568569
</row>
569570
<row>
570571
<entry align="left"><literal>CREATE USER MAPPING</literal></entry>

doc/src/sgml/func.sgml

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6277,19 +6277,19 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
62776277
<tbody>
62786278
<row>
62796279
<entry><literal>9</literal></entry>
6280-
<entry>value with the specified number of digits</entry>
6280+
<entry>digit position (can be dropped if insignificant)</entry>
62816281
</row>
62826282
<row>
62836283
<entry><literal>0</literal></entry>
6284-
<entry>value with leading zeros</entry>
6284+
<entry>digit position (will not be dropped, even if insignificant)</entry>
62856285
</row>
62866286
<row>
62876287
<entry><literal>.</literal> (period)</entry>
62886288
<entry>decimal point</entry>
62896289
</row>
62906290
<row>
62916291
<entry><literal>,</literal> (comma)</entry>
6292-
<entry>group (thousand) separator</entry>
6292+
<entry>group (thousands) separator</entry>
62936293
</row>
62946294
<row>
62956295
<entry><literal>PR</literal></entry>
@@ -6347,25 +6347,50 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
63476347
Usage notes for numeric formatting:
63486348

63496349
<itemizedlist>
6350+
<listitem>
6351+
<para>
6352+
<literal>0</> specifies a digit position that will always be printed,
6353+
even if it contains a leading/trailing zero. <literal>9</> also
6354+
specifies a digit position, but if it is a leading zero then it will
6355+
be replaced by a space, while if it is a trailing zero and fill mode
6356+
is specified then it will be deleted. (For <function>to_number()</>,
6357+
these two pattern characters are equivalent.)
6358+
</para>
6359+
</listitem>
6360+
6361+
<listitem>
6362+
<para>
6363+
The pattern characters <literal>S</>, <literal>L</>, <literal>D</>,
6364+
and <literal>G</> represent the sign, currency symbol, decimal point,
6365+
and thousands separator characters defined by the current locale
6366+
(see <xref linkend="guc-lc-monetary">
6367+
and <xref linkend="guc-lc-numeric">). The pattern characters period
6368+
and comma represent those exact characters, with the meanings of
6369+
decimal point and thousands separator, regardless of locale.
6370+
</para>
6371+
</listitem>
6372+
6373+
<listitem>
6374+
<para>
6375+
If no explicit provision is made for a sign
6376+
in <function>to_char()</>'s pattern, one column will be reserved for
6377+
the sign, and it will be anchored to (appear just left of) the
6378+
number. If <literal>S</> appears just left of some <literal>9</>'s,
6379+
it will likewise be anchored to the number.
6380+
</para>
6381+
</listitem>
6382+
63506383
<listitem>
63516384
<para>
63526385
A sign formatted using <literal>SG</literal>, <literal>PL</literal>, or
63536386
<literal>MI</literal> is not anchored to
63546387
the number; for example,
63556388
<literal>to_char(-12, 'MI9999')</literal> produces <literal>'-&nbsp;&nbsp;12'</literal>
63566389
but <literal>to_char(-12, 'S9999')</literal> produces <literal>'&nbsp;&nbsp;-12'</literal>.
6357-
The Oracle implementation does not allow the use of
6390+
(The Oracle implementation does not allow the use of
63586391
<literal>MI</literal> before <literal>9</literal>, but rather
63596392
requires that <literal>9</literal> precede
6360-
<literal>MI</literal>.
6361-
</para>
6362-
</listitem>
6363-
6364-
<listitem>
6365-
<para>
6366-
<literal>9</literal> results in a value with the same number of
6367-
digits as there are <literal>9</literal>s. If a digit is
6368-
not available it outputs a space.
6393+
<literal>MI</literal>.)
63696394
</para>
63706395
</listitem>
63716396

@@ -6412,8 +6437,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
64126437

64136438
<para>
64146439
Certain modifiers can be applied to any template pattern to alter its
6415-
behavior. For example, <literal>FM9999</literal>
6416-
is the <literal>9999</literal> pattern with the
6440+
behavior. For example, <literal>FM99.99</literal>
6441+
is the <literal>99.99</literal> pattern with the
64176442
<literal>FM</literal> modifier.
64186443
<xref linkend="functions-formatting-numericmod-table"> shows the
64196444
modifier patterns for numeric formatting.
@@ -6432,8 +6457,8 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
64326457
<tbody>
64336458
<row>
64346459
<entry><literal>FM</literal> prefix</entry>
6435-
<entry>fill mode (suppress leading zeroes and padding blanks)</entry>
6436-
<entry><literal>FM9999</literal></entry>
6460+
<entry>fill mode (suppress trailing zeroes and padding blanks)</entry>
6461+
<entry><literal>FM99.99</literal></entry>
64376462
</row>
64386463
<row>
64396464
<entry><literal>TH</literal> suffix</entry>
@@ -6480,6 +6505,10 @@ SELECT regexp_matches('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
64806505
<entry><literal>to_char(-0.1, 'FM9.99')</literal></entry>
64816506
<entry><literal>'-.1'</literal></entry>
64826507
</row>
6508+
<row>
6509+
<entry><literal>to_char(-0.1, 'FM90.99')</literal></entry>
6510+
<entry><literal>'-0.1'</literal></entry>
6511+
</row>
64836512
<row>
64846513
<entry><literal>to_char(0.1, '0.9')</literal></entry>
64856514
<entry><literal>'&nbsp;0.1'</literal></entry>
@@ -18064,11 +18093,22 @@ postgres=# select pg_start_backup('label_goes_here');
1806418093
<function>pg_start_backup</>. In a non-exclusive backup, the contents of
1806518094
the <filename>backup_label</> and <filename>tablespace_map</> are returned
1806618095
in the result of the function, and should be written to files in the
18067-
backup (and not in the data directory).
18096+
backup (and not in the data directory). When executed on a primary
18097+
<function>pg_stop_backup</> will wait for WAL to be archived, provided that
18098+
archiving is enabled.
18099+
</para>
18100+
18101+
<para>
18102+
On a standby <function>pg_stop_backup</> will return immediately without
18103+
waiting, so it's important to verify that all required WAL segments have
18104+
been archived. If write activity on the primary is low, it may be useful
18105+
to run <function>pg_switch_xlog</> on the primary in order to trigger a
18106+
segment switch.
1806818107
</para>
1806918108

1807018109
<para>
18071-
The function also creates a backup history file in the transaction log
18110+
When executed on a primary, the function also creates a backup history file
18111+
in the write-ahead log
1807218112
archive area. The history file includes the label given to
1807318113
<function>pg_start_backup</>, the starting and ending transaction log locations for
1807418114
the backup, and the starting and ending times of the backup. The return

doc/src/sgml/libpq.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3061,9 +3061,10 @@ void PQclear(PGresult *res);
30613061

30623062
<listitem>
30633063
<para>
3064-
Returns the number of rows (tuples) in the query result. Because
3065-
it returns an integer result, large result sets might overflow the
3066-
return value on 32-bit operating systems.
3064+
Returns the number of rows (tuples) in the query result.
3065+
(Note that <structname>PGresult</> objects are limited to no more
3066+
than <literal>INT_MAX</> rows, so an <type>int</> result is
3067+
sufficient.)
30673068

30683069
<synopsis>
30693070
int PQntuples(const PGresult *res);

doc/src/sgml/logicaldecoding.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ $ pg_recvlogical -d postgres --slot test --drop-slot
338338
<para>
339339
The <link linkend="view-pg-replication-slots"><structname>pg_replication_slots</structname></link>
340340
view and the
341-
<link linkend="monitoring-stats-views-table"><structname>pg_stat_replication</structname></link>
341+
<link linkend="pg-stat-replication-view"><structname>pg_stat_replication</structname></link>
342342
view provide information about the current state of replication slots and
343343
streaming replication connections respectively. These views apply to both physical and
344344
logical replication.

doc/src/sgml/perform.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ SELECT * FROM x, y, a, b, c WHERE something AND somethingelse;
16101610
<listitem>
16111611
<para>
16121612
Increase <xref linkend="guc-max-wal-size"> and <xref
1613-
linkend="guc-checkpoint-timeout"> ; this reduces the frequency
1613+
linkend="guc-checkpoint-timeout">; this reduces the frequency
16141614
of checkpoints, but increases the storage requirements of
16151615
<filename>/pg_xlog</>.
16161616
</para>

src/bin/pg_rewind/libpq_fetch.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ receiveFileChunks(const char *sql)
271271
char *filename;
272272
int filenamelen;
273273
int64 chunkoff;
274+
char chunkoff_str[32];
274275
int chunksize;
275276
char *chunk;
276277

@@ -343,8 +344,13 @@ receiveFileChunks(const char *sql)
343344
continue;
344345
}
345346

346-
pg_log(PG_DEBUG, "received chunk for file \"%s\", offset " INT64_FORMAT ", size %d\n",
347-
filename, chunkoff, chunksize);
347+
/*
348+
* Separate step to keep platform-dependent format code out of
349+
* translatable strings.
350+
*/
351+
snprintf(chunkoff_str, sizeof(chunkoff_str), INT64_FORMAT, chunkoff);
352+
pg_log(PG_DEBUG, "received chunk for file \"%s\", offset %s, size %d\n",
353+
filename, chunkoff_str, chunksize);
348354

349355
open_target_file(filename, false);
350356

src/include/c.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ typedef long int int64;
285285
#ifndef HAVE_UINT64
286286
typedef unsigned long int uint64;
287287
#endif
288+
#define INT64CONST(x) (x##L)
289+
#define UINT64CONST(x) (x##UL)
288290
#elif defined(HAVE_LONG_LONG_INT_64)
289291
/* We have working support for "long long int", use that */
290292

@@ -294,20 +296,13 @@ typedef long long int int64;
294296
#ifndef HAVE_UINT64
295297
typedef unsigned long long int uint64;
296298
#endif
299+
#define INT64CONST(x) (x##LL)
300+
#define UINT64CONST(x) (x##ULL)
297301
#else
298302
/* neither HAVE_LONG_INT_64 nor HAVE_LONG_LONG_INT_64 */
299303
#error must have a working 64-bit integer datatype
300304
#endif
301305

302-
/* Decide if we need to decorate 64-bit constants */
303-
#ifdef HAVE_LL_CONSTANTS
304-
#define INT64CONST(x) ((int64) x##LL)
305-
#define UINT64CONST(x) ((uint64) x##ULL)
306-
#else
307-
#define INT64CONST(x) ((int64) x)
308-
#define UINT64CONST(x) ((uint64) x)
309-
#endif
310-
311306
/* snprintf format strings to use for 64-bit integers */
312307
#define INT64_FORMAT "%" INT64_MODIFIER "d"
313308
#define UINT64_FORMAT "%" INT64_MODIFIER "u"
@@ -335,11 +330,20 @@ typedef unsigned PG_INT128_TYPE uint128;
335330
#define PG_UINT16_MAX (0xFFFF)
336331
#define PG_INT32_MIN (-0x7FFFFFFF-1)
337332
#define PG_INT32_MAX (0x7FFFFFFF)
338-
#define PG_UINT32_MAX (0xFFFFFFFF)
333+
#define PG_UINT32_MAX (0xFFFFFFFFU)
339334
#define PG_INT64_MIN (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)
340335
#define PG_INT64_MAX INT64CONST(0x7FFFFFFFFFFFFFFF)
341336
#define PG_UINT64_MAX UINT64CONST(0xFFFFFFFFFFFFFFFF)
342337

338+
/* Max value of size_t might also be missing if we don't have stdint.h */
339+
#ifndef SIZE_MAX
340+
#if SIZEOF_SIZE_T == 8
341+
#define SIZE_MAX PG_UINT64_MAX
342+
#else
343+
#define SIZE_MAX PG_UINT32_MAX
344+
#endif
345+
#endif
346+
343347
/* Select timestamp representation (float8 or int64) */
344348
#ifdef USE_INTEGER_DATETIMES
345349
#define HAVE_INT64_TIMESTAMP

src/include/pg_config.h.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,6 @@
339339
/* Define to 1 if you have the `z' library (-lz). */
340340
#undef HAVE_LIBZ
341341

342-
/* Define to 1 if constants of type 'long long int' should have the suffix LL.
343-
*/
344-
#undef HAVE_LL_CONSTANTS
345-
346342
/* Define to 1 if the system has the type `locale_t'. */
347343
#undef HAVE_LOCALE_T
348344

0 commit comments

Comments
 (0)