PostgreSQL 15.0 commit log

Doc: update release date for v15.

commit   : 2a7ce2e2ce474504a707ec03e128fde66cfb8b48    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 16:57:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 16:57:37 -0400    

Click here for diff

Drat, forgot this ...  

M doc/src/sgml/release-15.sgml

Stamp 15.0.

commit   : 957d1993c13d8477a3db5e319ece845fb3e0e5a7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 16:28:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Oct 2022 16:28:16 -0400    

Click here for diff

M configure
M configure.ac

Translation updates

commit   : 77d500abb8a112df81486b1a717d3dd09479070e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 12:03:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 12:03:38 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 59f93a503842f7c06b4ea5d022397ab3c2a0acd2  

M src/backend/po/de.po
M src/backend/po/ja.po
M src/backend/po/ru.po
M src/backend/po/sv.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/fr.po
A src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/pg_archivecleanup/nls.mk
A src/bin/pg_archivecleanup/po/pt_BR.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_checksums/nls.mk
A src/bin/pg_checksums/po/pt_BR.po
M src/bin/pg_config/po/pt_BR.po
M src/bin/pg_controldata/nls.mk
A src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_ctl/nls.mk
A src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_resetwal/nls.mk
A src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_test_fsync/nls.mk
A src/bin/pg_test_fsync/po/pt_BR.po
M src/bin/pg_test_timing/nls.mk
A src/bin/pg_test_timing/po/pt_BR.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/ru.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/po/ru.po
M src/bin/scripts/nls.mk
A src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/interfaces/ecpg/ecpglib/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/pt_BR.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/sv.po
M src/pl/plperl/po/pt_BR.po
M src/pl/plpgsql/src/po/pt_BR.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpython/po/pt_BR.po
M src/pl/tcl/nls.mk
A src/pl/tcl/po/pt_BR.po

Update list of acknowledgments in release notes

commit   : 48c81b57e942075f40702787f14acb2451871b4f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 08:15:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Oct 2022 08:15:29 +0200    

Click here for diff

current through c3b5992b91c4b0d2c4f4eab0fb856f34854c129d  

M doc/src/sgml/release-15.sgml

pgstat: Prevent stats reset from corrupting slotname by removing slotname

commit   : c3b5992b91c4b0d2c4f4eab0fb856f34854c129d    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 8 Oct 2022 09:33:23 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 8 Oct 2022 09:33:23 -0700    

Click here for diff

Previously PgStat_StatReplSlotEntry contained the slotname, which was mainly  
used when writing out the stats during shutdown, to identify the slot in the  
serialized data (at runtime the index in ReplicationSlotCtl->replication_slots  
is used, but that can change during a restart). Unfortunately the slotname was  
overwritten when the slot's stats were reset.  
  
That turned out to only cause "real" problems if the slot was active during  
the reset, triggering an assertion failure at the next  
pgstat_report_replslot(). In other paths the stats were re-initialized during  
pgstat_acquire_replslot().  
  
Fix this by removing slotname from PgStat_StatReplSlotEntry. Instead we can  
get the slot's name from the slot itself. Besides fixing a bug, this also is  
architecturally cleaner (a name is not really statistics). This is safe  
because stats, for a slot removed while shut down, will not be restored at  
startup.  
  
In 15 the slotname is not removed, but renamed, to avoid changing the stats  
format. In master, bump PGSTAT_FILE_FORMAT_ID.  
  
This commit does not contain a test for the fix. I think this can only be  
tested by a tap test starting pg_recvlogical in the background and checking  
pg_recvlogical's output. That type of test is notoriously hard to be reliable,  
so committing it shortly before the release is wrapped seems like a bad idea.  
  
Reported-by: Jaime Casanova <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/YxfagaTXUNa9ggLb@ahch-to  
Backpatch: 15-, where the bug was introduced in 5891c7a8ed8f  

M src/backend/replication/slot.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/include/pgstat.h
M src/include/replication/slot.h
M src/include/utils/pgstat_internal.h

Fix self-referencing foreign keys with partitioned tables

commit   : 6083132abdd46462a0eca15412bb35fa3495eab2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 7 Oct 2022 19:37:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 7 Oct 2022 19:37:48 +0200    

Click here for diff

There are a number of bugs in this area.  Two of them are fixed here,  
namely:  
1. get_relation_idx_constraint_oid does not restrict the type of  
   constraint that's returned, so with sufficient bad luck it can  
   return the OID of a foreign key constraint.  This has the effect that  
   a primary key in a partition can end up as a child of a foreign key,  
   which makes no sense (it needs to be the child of the equivalent  
   primary key.)  
   Change the API contract so that only index-backed constraints are  
   returned, mimicking get_constraint_index().  
  
2. Both CloneFkReferenced and CloneFkReferencing clone a  
   self-referencing foreign key, so the partition ends up with  
   a duplicate foreign key.  Change the former function to ignore such  
   constraints.  
  
Add some tests to verify that things are better now.  (However, these  
new tests show some additional misbehavior that will be fixed later --  
namely that there's a constraint marked NOT VALID.)  
  
Backpatch to 12, where these constraints are possible at all.  
  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://postgr.es/m/20220603154232.1715b14c@karst  

M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

relnotes: fix author names

commit   : be5cf460817b54c31dcf84f8e9b947c902327ae9    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 16:17:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 16:17:30 -0400    

Click here for diff

Reported-by: Elena Indrupskaya  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Elena Indrupskaya  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

doc: clarify description for log_startup_progress_interval

commit   : d2d67949f5ca95cf4bd66d849e947f3bbe065e0d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 15:53:40 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Oct 2022 15:53:40 -0400    

Click here for diff

Reported-by: Elena Indrupskaya  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Elena Indrupskaya  
  
Backpatch-through: 15  

M doc/src/sgml/config.sgml

Stamp 15rc2.

commit   : 2a40d040c924b1707cd03a9c66c80fcc4795c2d1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 17:03:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 17:03:12 -0400    

Click here for diff

M configure
M configure.ac

Fix psql's behavior with \g for a multiple-command string.

commit   : 595580aa1243df5f199516ff11a27ba9680e6904    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    

Click here for diff

The pre-v15 behavior was to discard all but the last result,  
but with the new behavior of printing all results by default,  
we will send each such result to the \g file.  However,  
we're still opening and closing the \g file for each result,  
so you lose all but the last result anyway.  Move the output-file  
state up to ExecQueryAndProcessResults so that we open/close the  
\g file only once per command string.  
  
To support this without changing other behavior, we must  
adjust PrintQueryResult to have separate FILE * arguments  
for query and status output (since status output has never  
gone to the \g file).  That in turn makes it a good idea  
to push the responsibility for fflush'ing output down to  
PrintQueryTuples and PrintQueryStatus.  
  
Also fix an infinite loop if COPY IN/OUT is attempted in \watch.  
We used to reject that, but that error exit path got broken  
somewhere along the line in v15.  There seems no real reason  
to reject it anyway as the code now stands, so just remove  
the error exit and make sure that COPY OUT data goes to the  
right place.  
  
Also remove PrintQueryResult's unused is_watch parameter,  
and make some other cosmetic cleanups (adjust obsolete  
comments, break some overly-long lines).  
  
Daniel Vérité and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/common.c

Doc: update v15 release notes.

commit   : b1c73e1cf1ffdfedeed4f2cd7f34247dcad308bf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 11:06:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 11:06:33 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

Revert "Optimize order of GROUP BY keys".

commit   : 443df6e2db932a7cd6d85ddfb67e11a43345130d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    

Click here for diff

This reverts commit db0d67db2401eb6238ccc04c6407a4fd4f985832 and  
several follow-on fixes.  The idea of making a cost-based choice  
of the order of the sorting columns is not fundamentally unsound,  
but it requires cost information and data statistics that we don't  
really have.  For example, relying on procost to distinguish the  
relative costs of different sort comparators is pretty pointless  
so long as most such comparator functions are labeled with cost 1.0.  
Moreover, estimating the number of comparisons done by Quicksort  
requires more than just an estimate of the number of distinct values  
in the input: you also need some idea of the sizes of the larger  
groups, if you want an estimate that's good to better than a factor of  
three or so.  That's data that's often unknown or not very reliable.  
Worse, to arrive at estimates of the number of calls made to the  
lower-order-column comparison functions, the code needs to make  
estimates of the numbers of distinct values of multiple columns,  
which are necessarily even less trustworthy than per-column stats.  
Even if all the inputs are perfectly reliable, the cost algorithm  
as-implemented cannot offer useful information about how to order  
sorting columns beyond the point at which the average group size  
is estimated to drop to 1.  
  
Close inspection of the code added by db0d67db2 shows that there  
are also multiple small bugs.  These could have been fixed, but  
there's not much point if we don't trust the estimates to be  
accurate in-principle.  
  
Finally, the changes in cost_sort's behavior made for very large  
changes (often a factor of 2 or so) in the cost estimates for all  
sorting operations, not only those for multi-column GROUP BY.  
That naturally changes plan choices in many situations, and there's  
precious little evidence to show that the changes are for the better.  
Given the above doubts about whether the new estimates are really  
trustworthy, it's hard to summon much confidence that these changes  
are better on the average.  
  
Since we're hard up against the release deadline for v15, let's  
revert these changes for now.  We can always try again later.  
  
Note: in v15, I left T_PathKeyInfo in place in nodes.h even though  
it's unreferenced.  Removing it would be an ABI break, and it seems  
a bit late in the release cycle for that.  
  
Discussion: https://postgr.es/m/TYAPR01MB586665EB5FB2C3807E893941F5579@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/pathnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/join.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/expected/union.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/incremental_sort.sql

ci: macos: Reduce test concurrency

commit   : b507a7a19b5d9a8ed2500c5a7159353e02846901    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    

Click here for diff

Test performance regresses noticably when using all cores. This is more  
pronounced with meson than with autoconf, presumably because meson will  
schedule the "full number" of tests more consistently.  8 seems to work  
OK.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where CI was introduced  

M .cirrus.yml

doc: Fix some grammar and typos

commit   : 64b431d15c49ce39a12dcaec78a60b884be1efba    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 1 Oct 2022 15:28:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 1 Oct 2022 15:28:11 +0900    

Click here for diff

This fixes some areas related to logical replication and custom RMGRs.  
  
Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logical-replication.sgml
M src/backend/access/transam/rmgr.c

Avoid improbable PANIC during heap_update, redux.

commit   : 2267085c168899b43dadc4ca52fb516773068228    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    

Click here for diff

Commit 34f581c39 intended to ensure that RelationGetBufferForTuple  
would acquire a visibility-map page pin in case the otherBuffer's  
all-visible bit had become set since we last had lock on that page.  
But I missed a case: when we're extending the relation, VM concerns  
were dealt with only in the relatively-less-likely case that we  
fail to conditionally lock the otherBuffer.  I think I'd believed  
that we couldn't need to worry about it if the conditional lock  
succeeds, which is true for the target buffer; but the otherBuffer  
was unlocked for awhile so its bit might be set anyway.  So we need  
to do the GetVisibilityMapPins dance, and then also recheck the  
page's free space, in both cases.  
  
Per report from Jaime Casanova.  Back-patch to v12 as the previous  
patch was (although there's still no evidence that the bug is  
reachable pre-v14).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/hio.c

Fix tab-completion after commit 790bf615ddba

commit   : d8e6ae9f38984ca16dc0e18924cc26568bb75960    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    

Click here for diff

I (Álvaro) broke tab-completion for GRANT .. ALL TABLES IN SCHEMA while  
removing ALL from the publication syntax for schemas in the  
aforementioned commit.  I also missed to update a bunch of  
tab-completion rules for ALTER/CREATE PUBLICATION that match each  
individual piece of ALL TABLES IN SCHEMA.  Repair those bugs.  
  
While fixing up that commit, update a couple of outdated comments  
related to the same change.  
  
Backpatch to 15.  
  
Author: Shi yu <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/OSZPR01MB6310FCE8609185A56344EED2FD559@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/tablesync.c
M src/bin/psql/tab-complete.c
M src/test/subscription/t/031_column_list.pl

doc: Fix PQsslAttribute docs for compression

commit   : a613474411e690947fbf869ef519da13a35d993d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    

Click here for diff

The compression parameter to PQsslAttribute has never returned the  
compression method used, it has always returned "on" or "off since  
it was added in commit 91fa7b4719ac. Backpatch through v10.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v10  

M doc/src/sgml/libpq.sgml

Fix bogus behavior of PQsslAttribute(conn, "library").

commit   : cae4688ce81b8449aa6e1e7bfa384d53520a81fb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    

Click here for diff

Commit ebc8b7d44 intended to change the behavior of  
PQsslAttribute(NULL, "library"), but accidentally also changed  
what happens with a non-NULL conn pointer.  Undo that so that  
only the intended behavior change happens.  Clarify some  
associated documentation.  
  
Per bug #17625 from Heath Lord.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-secure-openssl.c

Update comment in ExecInsert() regarding batch insertion.

commit   : d460faf00285fd99d3c80e890c8f6fe798233b48    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 29 Sep 2022 16:55:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 29 Sep 2022 16:55:01 +0900    

Click here for diff

Remove the stale text that is a leftover from an earlier version of the  
patch to add support for batch insertion, and adjust the wording in the  
remaining text.  
  
Back-patch to v14 where batch insertion came in.  
  
Review and wording adjustment by Tom Lane.  
  
Discussion: https://postgr.es/m/CAPmGK14goatHPHQv2Aeu_UTKqZ%2BBO%2BP%2Bzd3HKv5D%2BdyyfWKDSw%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Restrict Datum sort optimization to byval types only

commit   : f7ae8a2e186ca27f4ea64fddc21bfabaf0618507    
  
author   : David Rowley <[email protected]>    
date     : Thu, 29 Sep 2022 11:43:40 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 29 Sep 2022 11:43:40 +1300    

Click here for diff

91e9e89dc modified nodeSort.c so that it used datum sorts when the  
targetlist of the outer node contained only a single column.  That commit  
failed to recognise that the Datum returned by tuplesort_getdatum() must  
be pfree'd when the type is a byref type.  Ronan Dunklau did originally  
propose the patch with that restriction, but that, probably through my own  
fault, got lost during further development work.  
  
Due to the timing of this report (PG15 RC1 is almost out the door), let's  
just restrict the datum sort optimization to apply for byval types only.  
We might want to look harder into making this work for byref types in  
PG16.  
  
Reported-by: Önder Kalacı  
Diagnosis-by: Tom Lane  
Discussion: https://postgr.es/m/CACawEhVxe0ufR26UcqtU7GYGRuubq3p6ZWPGXL4cxy_uexpAAQ@mail.gmail.com  
Backpatch-through: 15, where 91e9e89dc was introduced.  

M src/backend/executor/nodeSort.c

doc: clarify internal behavior of RECURSIVE CTE queries

commit   : 517fab6a405628a7e4d2aad4cb19ab652adea720    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

revert "warn of SECURITY DEFINER schemas for non-sql_body funcs"

commit   : 9bb5412885d12fd8598e0aacc29c3d9afdce857d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:05:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 28 Sep 2022 13:05:20 -0400    

Click here for diff

doc revert of commit 1703726488.  Change was applied to irrelevant  
branches, and was not detailed enough to be helpful in relevant  
branches.  
  
Reported-by: Peter Eisentraut, Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

Change some errdetail() to errdetail_internal()

commit   : 1eeac95dc4a639c51ff6cc6e2ac6ae52dab32b32    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    

Click here for diff

This prevents marking the argument string for translation for gettext,  
and it also prevents the given string (which is already translated) from  
being translated at runtime.  
  
Also, mark the strings used as arguments to check_rolespec_name for  
translation.  
  
Backpatch all the way back as appropriate.  None of this is caught by  
any tests (necessarily so), so I verified it manually.  

M src/backend/catalog/dependency.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/user.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/jsonfuncs.c
M src/common/jsonapi.c

Remove publicationcmds.c's expr_allowed_in_node as a function

commit   : a60b11327bbd4ae9f661563644a15b0c324f3d9d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    

Click here for diff

Its API is quite strange, and since there's only one caller, there's no  
reason for it to be a separate function in the first place.  Inline it  
instead.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c

commit   : f5441b912493e14fc2ca904971aeb000ceddca4e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    

Click here for diff

While at it, remove an unused queryString parameter from  
CheckPubRelationColumnList() and make other minor stylistic changes.  
  
Backpatch to 15.  
  
Reported by Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Hou zj <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c
M src/test/regress/expected/publication.out

Fix pg_stat_statements for MERGE

commit   : 72abf03b6491a8df880e1fea45798797bcc86c47    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    

Click here for diff

We weren't jumbling the merge action list, so wildly different commands  
would be considered to use the same query ID.  Add that, mention it in  
the docs, and some test lines.  
  
Backpatch to 15.  
  
Author: Tatsu <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml
M src/backend/nodes/nodeFuncs.c
M src/backend/utils/misc/queryjumble.c

ci: Add hint about downloadable logs to README

commit   : d1f95fa2476bcf427a3e3677f67ceee26552e23e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    

Click here for diff

I (Andres) chose to backpatch this to 15, as it seems better to keep the  
README the same.  
  
Author: James Coleman <[email protected]>  
Discussion: https://postgr.es/m/CAAaqYe_7BXDjpk0Ks_eqf1r6LZpC_rfB7kjhb_T3+eC4t6yiGQ@mail.gmail.com  
Backpatch: 15-, where CI came in  

M src/tools/ci/README

Doc: last minute adjustment to the release notes

commit   : bb76510a07f3705a28d93e065ebe4261d6ddf54d    
  
author   : David Rowley <[email protected]>    
date     : Tue, 27 Sep 2022 10:57:07 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 27 Sep 2022 10:57:07 +1300    

Click here for diff

The change made in 9d9c02ccd also affects the dense_rank() function.  
Mention this in the release notes.  
  
Author: Jonathan S. Katz  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Stamp 15rc1.

commit   : 6abbd212b2828717fb3b10ed2925edf8f212e38d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 16:36:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 16:36:49 -0400    

Click here for diff

M configure
M configure.ac

Doc: more tweaking of v15 release notes.

commit   : 780add2c32a7577f1eab81ae3d8802cd02c4f8fe    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:32:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:32:51 -0400    

Click here for diff

Per suggestions from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Doc: further adjust notes about pg_upgrade_output.d.

commit   : 796aa20a11b4060e07b0864081e6977eb66b64bd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    

Click here for diff

I'd misunderstood how it worked in 5f1048881.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml

Translation updates

commit   : 0570eba3dcf8c819a6b100b14e25290eaedb4b5a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 13:16:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 13:16:06 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 0a336c1e07ac371cf445a0cecac6b27720da228c  

M src/backend/nls.mk
M src/backend/po/de.po
M src/backend/po/es.po
D src/backend/po/id.po
D src/backend/po/it.po
M src/backend/po/ja.po
D src/backend/po/pl.po
D src/backend/po/pt_BR.po
M src/backend/po/ru.po
M src/backend/po/sv.po
D src/backend/po/tr.po
M src/backend/po/uk.po
M src/bin/initdb/nls.mk
D src/bin/initdb/po/cs.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/es.po
D src/bin/initdb/po/he.po
D src/bin/initdb/po/it.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
D src/bin/initdb/po/ko.po
D src/bin/initdb/po/pl.po
D src/bin/initdb/po/pt_BR.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
D src/bin/initdb/po/tr.po
M src/bin/initdb/po/uk.po
D src/bin/initdb/po/vi.po
M src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/ru.po
M src/bin/pg_amcheck/po/uk.po
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_archivecleanup/po/es.po
D src/bin/pg_archivecleanup/po/pl.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_archivecleanup/po/uk.po
D src/bin/pg_archivecleanup/po/vi.po
M src/bin/pg_basebackup/nls.mk
D src/bin/pg_basebackup/po/cs.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/es.po
D src/bin/pg_basebackup/po/he.po
D src/bin/pg_basebackup/po/it.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/ka.po
D src/bin/pg_basebackup/po/ko.po
D src/bin/pg_basebackup/po/pl.po
D src/bin/pg_basebackup/po/pt_BR.po
M src/bin/pg_basebackup/po/ru.po
M src/bin/pg_basebackup/po/sv.po
D src/bin/pg_basebackup/po/tr.po
M src/bin/pg_basebackup/po/uk.po
D src/bin/pg_basebackup/po/vi.po
D src/bin/pg_basebackup/po/zh_CN.po
M src/bin/pg_checksums/nls.mk
D src/bin/pg_checksums/po/cs.po
D src/bin/pg_checksums/po/el.po
M src/bin/pg_checksums/po/es.po
D src/bin/pg_checksums/po/ko.po
M src/bin/pg_checksums/po/ru.po
D src/bin/pg_checksums/po/tr.po
M src/bin/pg_checksums/po/uk.po
D src/bin/pg_checksums/po/zh_CN.po
M src/bin/pg_config/nls.mk
M src/bin/pg_config/po/es.po
D src/bin/pg_config/po/nb.po
D src/bin/pg_config/po/ro.po
M src/bin/pg_config/po/ru.po
D src/bin/pg_config/po/ta.po
M src/bin/pg_config/po/uk.po
D src/bin/pg_config/po/zh_TW.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/es.po
D src/bin/pg_controldata/po/pl.po
D src/bin/pg_controldata/po/pt_BR.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/uk.po
D src/bin/pg_controldata/po/vi.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/es.po
D src/bin/pg_ctl/po/he.po
D src/bin/pg_ctl/po/pl.po
D src/bin/pg_ctl/po/pt_BR.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/po/es.po
D src/bin/pg_dump/po/he.po
D src/bin/pg_dump/po/it.po
M src/bin/pg_dump/po/ka.po
D src/bin/pg_dump/po/pl.po
D src/bin/pg_dump/po/pt_BR.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/uk.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/es.po
D src/bin/pg_resetwal/po/it.po
D src/bin/pg_resetwal/po/pl.po
D src/bin/pg_resetwal/po/pt_BR.po
M src/bin/pg_resetwal/po/ru.po
D src/bin/pg_resetwal/po/tr.po
M src/bin/pg_resetwal/po/uk.po
M src/bin/pg_rewind/nls.mk
D src/bin/pg_rewind/po/cs.po
M src/bin/pg_rewind/po/de.po
M src/bin/pg_rewind/po/es.po
D src/bin/pg_rewind/po/it.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_rewind/po/ka.po
D src/bin/pg_rewind/po/ko.po
D src/bin/pg_rewind/po/pl.po
D src/bin/pg_rewind/po/pt_BR.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/sv.po
D src/bin/pg_rewind/po/tr.po
M src/bin/pg_rewind/po/uk.po
M src/bin/pg_test_fsync/nls.mk
D src/bin/pg_test_fsync/po/cs.po
D src/bin/pg_test_fsync/po/el.po
M src/bin/pg_test_fsync/po/es.po
D src/bin/pg_test_fsync/po/ko.po
D src/bin/pg_test_fsync/po/pl.po
M src/bin/pg_test_fsync/po/ru.po
D src/bin/pg_test_fsync/po/tr.po
M src/bin/pg_test_fsync/po/uk.po
D src/bin/pg_test_fsync/po/vi.po
D src/bin/pg_test_fsync/po/zh_CN.po
M src/bin/pg_test_timing/nls.mk
D src/bin/pg_test_timing/po/cs.po
M src/bin/pg_test_timing/po/es.po
D src/bin/pg_test_timing/po/ko.po
D src/bin/pg_test_timing/po/pl.po
D src/bin/pg_test_timing/po/tr.po
M src/bin/pg_test_timing/po/uk.po
D src/bin/pg_test_timing/po/vi.po
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_upgrade/po/ru.po
D src/bin/pg_upgrade/po/tr.po
M src/bin/pg_upgrade/po/uk.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_waldump/nls.mk
D src/bin/pg_waldump/po/cs.po
M src/bin/pg_waldump/po/de.po
D src/bin/pg_waldump/po/el.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/ka.po
D src/bin/pg_waldump/po/ko.po
M src/bin/pg_waldump/po/ru.po
M src/bin/pg_waldump/po/sv.po
D src/bin/pg_waldump/po/tr.po
M src/bin/pg_waldump/po/uk.po
D src/bin/pg_waldump/po/vi.po
D src/bin/pg_waldump/po/zh_CN.po
M src/bin/psql/nls.mk
M src/bin/psql/po/es.po
D src/bin/psql/po/he.po
D src/bin/psql/po/it.po
D src/bin/psql/po/pl.po
D src/bin/psql/po/pt_BR.po
M src/bin/psql/po/ru.po
D src/bin/psql/po/tr.po
M src/bin/psql/po/uk.po
D src/bin/psql/po/zh_TW.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/es.po
D src/bin/scripts/po/he.po
D src/bin/scripts/po/it.po
D src/bin/scripts/po/pl.po
D src/bin/scripts/po/pt_BR.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/uk.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
D src/interfaces/libpq/po/he.po
D src/interfaces/libpq/po/it.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ka.po
D src/interfaces/libpq/po/pl.po
D src/interfaces/libpq/po/pt_BR.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/sv.po
D src/interfaces/libpq/po/tr.po
M src/interfaces/libpq/po/uk.po
D src/interfaces/libpq/po/zh_TW.po
M src/pl/plperl/nls.mk
M src/pl/plperl/po/es.po
D src/pl/plperl/po/ro.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/uk.po
D src/pl/plperl/po/zh_TW.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/es.po
D src/pl/plpgsql/src/po/ro.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/uk.po
D src/pl/plpgsql/src/po/zh_TW.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/ka.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/uk.po
M src/pl/tcl/nls.mk
M src/pl/tcl/po/es.po
D src/pl/tcl/po/pt_BR.po
D src/pl/tcl/po/ro.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/uk.po
D src/pl/tcl/po/zh_TW.po

Update list of acknowledgments in release notes

commit   : 5483649cd6875c219beb10465b515ba096dc7f34    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 12:57:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Sep 2022 12:57:12 +0200    

Click here for diff

current through 15113bfb467a84688744b57b74a14550878d0224  

M doc/src/sgml/release-15.sgml

Doc: Remove the use of a duplicate word.

commit   : 15113bfb467a84688744b57b74a14550878d0224    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 26 Sep 2022 09:26:47 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 26 Sep 2022 09:26:47 +0530    

Click here for diff

This has been removed in HEAD by commit a234177906, so doing just backpatch  
to 15 where it was introduced in commit 860ea46ba7.  
  
Author: Zhang Mingli  
Discussion: https://postgr.es/m/OS0PR01MB57162559C01FE2848C12E8F7944D9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/runtime.sgml

Fix tupdesc lifespan bug with AfterTriggersTableData.storeslot.

commit   : c82766c0298a6c73b1e768b9239288d96879286e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    

Click here for diff

Commit 25936fd46 adjusted things so that the "storeslot" we use  
for remapping trigger tuples would have adequate lifespan, but it  
neglected to consider the lifespan of the tuple descriptor that  
the slot depends on.  It turns out that in at least some cases, the  
tupdesc we are passing is a refcounted tupdesc, and the refcount for  
the slot's reference can get assigned to a resource owner having  
different lifespan than the slot does.  That leads to an error like  
"tupdesc reference 0x7fdef236a1b8 is not owned by resource owner  
SubTransaction".  Worse, because of a second oversight in the same  
commit, we'd try to free the same tupdesc refcount again while  
cleaning up after that error, leading to recursive errors and an  
"ERRORDATA_STACK_SIZE exceeded" PANIC.  
  
To fix the initial problem, let's just make a non-refcounted copy  
of the tupdesc we're supposed to use.  That seems likely to guard  
against additional problems, since there's no strong reason for  
this code to assume that what it's given is a refcounted tupdesc;  
in which case there's an independent hazard of the tupdesc having  
shorter lifespan than the slot does.  (I didn't bother trying to  
free said copy, since it should go away anyway when the (sub)  
transaction context is cleaned up.)  
  
The other issue can be fixed by making the code added to  
AfterTriggerFreeQuery work like the rest of that function, ie be  
sure that it doesn't try to free the same slot twice in the event  
of recursive error cleanup.  
  
While here, also clean up minor stylistic issues in the test case  
added by 25936fd46: don't use "create or replace function", as any  
name collision within the tests is likely to have ill effects  
that that won't mask; and don't use function names as generic as  
trigger_function1, especially if you're not going to drop them  
at the end of the test stanza.  
  
Per bug #17607 from Thomas Mc Kay.  Back-patch to v12, as the  
previous fix was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Avoid loss of code coverage with unlogged-index test cases.

commit   : 7a84c35fe6dcec62c95d023ad057e5717d9304a1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    

Click here for diff

Commit 4fb5c794e intended to add coverage of some ambuildempty  
methods that were not getting reached, without removing any  
test coverage.  However, by changing a temp table to unlogged  
it managed to negate the intent of 4c51a2d1e, which means that  
we didn't have reliable test coverage of ginvacuum.c anymore.  
As things stand, much of that file might or might not get reached  
depending on timing, which seems pretty undesirable.  
  
Although this is only clearly broken for the GIN test, it seems  
best to revert 4fb5c794e altogether and instead add bespoke test  
cases covering unlogged indexes for these four AMs.  We don't  
need to do very much with them, so the extra tests are cheap.  
(Note that btree, hash, and bloom already have similar test cases,  
so they need no additional work.)  
  
We can also undo dec8ad367.  Since the testing deficiency that that  
hacked around was later fixed by 2f2e24d90, let's intentionally leave  
an unlogged table behind to improve test coverage in the modules that  
use the regression database for other test purposes.  (The case I used  
also leaves an unlogged sequence behind.)  
  
Per report from Alex Kozhemyakin.  Back-patch to v15 where the  
faulty test came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/brin.out
M src/test/regress/expected/gin.out
M src/test/regress/expected/gist.out
M src/test/regress/expected/spgist.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/gin.sql
M src/test/regress/sql/gist.sql
M src/test/regress/sql/spgist.sql

Add missing source files to pg_waldump/nls.mk

commit   : 7a41e34e68a9be767279d17e051555b9cb9477c9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    

Click here for diff

M src/bin/pg_waldump/nls.mk

Message style improvements

commit   : 517484b5820e9e20057ff066b5df7d09cbb5f464    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    

Click here for diff

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_server.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/dbcommands.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeModifyTable.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walsender.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_xact.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/scripts/t/020_createdb.pl
M src/common/compression.c
M src/test/recovery/t/006_logical_decoding.pl
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/triggers.out
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/029_on_error.pl

Improve terminology

commit   : 8d985560fc1de6197323d4397d2a2bf762657463    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    

Click here for diff

Use "prepared transaction" instead of "two-phrase transaction".  This  
is in line with c5d67881d343a507269bde124a49df19e0296157.  

M doc/src/sgml/ref/pg_recvlogical.sgml
M src/bin/pg_basebackup/pg_recvlogical.c

Doc: make an editorial pass over the v15 release notes.

commit   : 2b14b5b5d9d5cf2f039a90a670abaf7b2f37bbe6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:22:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:22:33 -0400    

Click here for diff

Rearrange, reword, clarify, fix markup, etc etc.  
  
Also include commit bd8ac900d.  

M doc/src/sgml/release-15.sgml

Doc: minor cleanups.

commit   : cea5aa988ea84182f61b1b84d7dafe06e4d90a9b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    

Click here for diff

Improve a couple of things I noticed while working on v15  
release notes.  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/pgupgrade.sgml

pgstat: Fix transactional stats dropping for indexes

commit   : 43e496e242984320efcf42c51c1e2b379aa03344    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    

Click here for diff

Because index creation does not go through heap_create_with_catalog() we  
didn't call pgstat_create_relation(), leading to index stats of a newly  
created realtion not getting dropped during rollback. To fix, move the  
pgstat_create_relation() to heap_create(), which indexes do use.  
  
Similarly, because dropping an index does not go through  
heap_drop_with_catalog(), we didn't drop index stats when the transaction  
dropping an index committed. Here there's no convenient common path for  
indexes and relations, so index_drop() now calls pgstat_drop_relation().  
  
Add tests for transactional index stats handling.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, like 8b1dccd37c71, which introduced the bug  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Doc: update v15 release notes through today.

commit   : e956325c8bc8c7257b04c322bf996fff2d81b514    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 13:59:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 13:59:29 -0400    

Click here for diff

Account for commits since 2022-06-11.  

M doc/src/sgml/release-15.sgml

Remove PQsendQuery support in pipeline mode

commit   : bd8ac900df4d2824f50ce4b1674754685aeaed56    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    

Click here for diff

The extended query protocol implementation I added in commit  
acb7e4eb6b1c has bugs when used in pipeline mode.  Rather than spend  
more time trying to fix it, remove that code and make the function rely  
on simple query protocol only, meaning it can no longer be used in  
pipeline mode.  
  
Users can easily change their applications to use PQsendQueryParams  
instead.  We leave PQsendQuery in place for Postgres 14, just in case  
somebody is using it and has not hit the mentioned bugs; but we should  
recommend that it not be used.  
  
Backpatch to 15.  
  
Per bug report from Gabriele Varrazzo.  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Stop using PQsendQuery in libpq_pipeline

commit   : 27e04412c9c3c3c3b2d182821c759f95693c0039    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    

Click here for diff

The "emulation" I wrote for PQsendQuery in pipeline mode to use extended  
query protocol, in commit acb7e4eb6b1c, is problematic.  Due to numerous  
bugs we'll soon remove it.  As a first step and for all branches back to  
14, stop using PQsendQuery in libpq_pipeline.  Also remove a few test  
lines that will no longer be relevant.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/pipeline_abort.trace
M src/test/modules/libpq_pipeline/traces/pipeline_idle.trace

Doc: add list of major features to the v15 release notes.

commit   : a2ab0ad88cf87e0dcd9fc4c7fcfac132a4e88d2a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 11:24:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Sep 2022 11:24:12 -0400    

Click here for diff

Jonathan Katz (word-smithed a bit by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Allow publications with schema and table of the same schema.

commit   : b7256753ec251fd6a1f6bd205dbe62ccbb3261c4    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 23 Sep 2022 08:08:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 23 Sep 2022 08:08:24 +0530    

Click here for diff

We previously thought that allowing such cases can confuse users when they  
specify DROP TABLES IN SCHEMA but that doesn't seem to be the case based  
on discussion. This helps to uplift the restriction during  
ALTER TABLE ... SET SCHEMA which used to ensure that we couldn't end up  
with a publication having both a schema and the same schema's table.  
  
To allow this, we need to forbid having any schema on a publication if  
column lists on a table are specified (and vice versa). This is because  
otherwise we still need a restriction during ALTER TABLE ... SET SCHEMA to  
forbid cases where it could lead to a publication having both a schema and  
the same schema's table with column list.  
  
Based on suggestions by Peter Eisentraut.  
  
Author: Hou Zhijie and Vignesh C  
Reviewed-By: Peter Smith, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/028_row_filter.pl

Fix race condition where heap_delete() fails to pin VM page.

commit   : dd6070bc81733c3174f2e257d43908f98b0255fb    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    

Click here for diff

Similar to 5f12bc94dc, the code must re-check PageIsAllVisible() after  
buffer lock is re-acquired. Backpatching to the same version, 12.  
  
Discussion: https://postgr.es/m/CAEP4nAw9jYQDKd_5Y+-s2E4YiUJq1vqiikFjYGpLShtp-K3gag@mail.gmail.com  
Reported-by: Robins Tharakan  
Reviewed-by: Robins Tharakan  
Backpatch-through: 12  

M src/backend/access/heap/heapam.c

Remove ALL keyword from TABLES IN SCHEMA for publication

commit   : f256236fb1b00e9d05f889a53e93feeecbd50991    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    

Click here for diff

This may be a bit too subtle, but removing that word from there makes  
this clause no longer a perfect parallel of the GRANT variant "ALL  
TABLES IN SCHEMA": indeed, for publications what we record is the schema  
itself, not the tables therein, which means that any tables added to the  
schema in the future are also published.  This is completely different  
to what GRANT does, which is affect only the tables that exist when the  
command is executed.  
  
There isn't resounding support for this change, but there are a few  
positive votes and no opposition.  Because the time to 15 RC1 is very  
short, let's get this out now.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl

Restore archive_command documentation

commit   : 5f56933ea5d5b0b1a0bbe4c7b8f5110f8fe256ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    

Click here for diff

Commit 5ef1eefd76f404ddc59b885d50340e602b70f05f, which added  
archive_library, purged most mentions of archive_command from the  
documentation.  This is inappropriate, since archive_command is still  
a feature in use and users will want to see information about it.  
  
This restores all the removed mentions and rephrases things so that  
archive_command and archive_library are presented as alternatives of  
each other.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/wal.sgml

Use min/max bounds defined by Zstd for compression level

commit   : ade925e1693a595ef1c278583fa699ca6fc1ff45    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 20:03:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 20:03:30 +0900    

Click here for diff

The bounds hardcoded in compression.c since ffd5365 (minimum at 1 and  
maximum at 22) do not match the reality of what zstd is able to  
handle, these values being available via ZSTD_maxCLevel() and  
ZSTD_minCLevel() at run-time.  The maximum of 22 is actually correct  
in recent versions, but the minimum was not as the library can go down  
to -131720 by design.  This commit changes the code to use the run-time  
values in the code instead of some hardcoded ones.  
  
Zstd seems to assume that these bounds could change in the future, and  
Postgres will be able to adapt automatically to such changes thanks to  
what's being done in this commit.  
  
Reported-by: Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/common/compression.c

Fix thinko in comment.

commit   : 901ef14afe981065a0c5c61b1759d36482869d98    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 22 Sep 2022 15:55:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 22 Sep 2022 15:55:01 +0900    

Click here for diff

This comment has been wrong since its introduction in commit 0d5f05cde;  
backpatch to v12 where that came in.  
  
Discussion: https://postgr.es/m/CAPmGK14VGf-xQjGQN4o1QyAbXAaxugU5%3DqfcmTDh1iufUDnV_w%40mail.gmail.com  

M src/backend/commands/copyfrom.c

Clear ps display of startup process at the end of recovery

commit   : 848c323c1295dd724587d9c91275414db15e2772    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 14:25:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Sep 2022 14:25:12 +0900    

Click here for diff

If the ps display is not cleared at this point, the process could  
continue displaying "recovering NNN" even if handling end-of-recovery  
steps.  df9274a has tackled that by providing some information with the  
end-of-recovery checkpoint but 7ff23c6 has nullified the effect of the  
first commit.  
  
Per a suggestion from Justin, just clear the ps display when we are done  
with recovery, so as no incorrect information is displayed.  This may  
get extended in the future, but for now restore the pre-7ff23c6  
behavior.  
  
Author: Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/access/transam/xlog.c

docs: Fix snapshot name in SET TRANSACTION docs.

commit   : 4230279f357602bd99c038e0aec8087a7076522b    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    

Click here for diff

Commit 6c2003f8a1 changed the snapshot names mentioned in  
SET TRANSACTION docs, however, there was one place that  
the commit missed updating the name.  
  
Back-patch to all supported versions.  
  
Author: Japin Li  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/MEYP282MB1669BD4280044501165F8B07B64F9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/set_transaction.sgml

psql: Improve tab-completion for MERGE.

commit   : f80919df950ab05cbe79c7ab34fb359aa79641d4    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    

Click here for diff

Commit 7103ebb7aa added the tab-completion for MERGE accidentally  
in the middle of that for LOCK TABLE. This commit fixes this issue.  
  
This also adds some tab-completion for MERGE.  
  
Back-patch to v15 where MERGE was introduced.  
  
Author: Kotaro Kawamoto, Fujii Masao  
Reviewed-by: Shinya Kato, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

ci: windows: set error mode to not include SEM_NOGPFAULTERRORBOX

commit   : 0c400445dbe316d67d19f79fdd096f0b77458b86    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    

Click here for diff

Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That prevents  
crash reporting from working unless binaries do SetErrorMode()  
themselves. Furthermore, it appears that either python or, more likely, the C  
runtime has a bug where SEM_NOGPFAULTERRORBOX can very occasionally *trigger*  
a crash on process exit - which is hard to debug, given that it explicitly  
prevents crash dumps from working...  
  
Discussion: https://postgr.es/m/20220909235836.lz3igxtkcjb5w7zb%40awork3.anarazel.de  
Backpatch: 15-, where CI was added  

M .cirrus.yml

ci: Increase requested memory size.

commit   : 08ddb3c0852d87394b44eea45709b9d9b8154f68    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    

Click here for diff

CI builds recently started failing with:  
  
"Memory size for 4.0 vCPU instance should be between 3840MiB and  
26624MiB, while 2048MiB is requested."  
  
Ok then, let's ask for 4G instead of 2G.  
  
This may be due to a change in the type of instance used to work around  
an outage, per:  
  
https://twitter.com/cirrus_labs/status/1572657320093712384  

M .cirrus.yml

Improve ICU option handling in CREATE DATABASE

commit   : 865b52af61049719e0a289419a0eceded6ea7bae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    

Click here for diff

We check that the ICU locale is only specified if the ICU locale  
provider is selected.  But we did that too early.  We need to wait  
until we load the settings of the template database, since that could  
also set what the locale provider is.  
  
Reported-by: Marina Polyakova <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

Tighten pg_get_object_address argument checking

commit   : ab7032b3a8fec281db71acfc37c5c92fc65b08ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    

Click here for diff

For publication schemas (OBJECT_PUBLICATION_NAMESPACE) and user  
mappings (OBJECT_USER_MAPPING), pg_get_object_address() checked the  
array length of the second argument, but not of the first argument.  
If the first argument was too long, it would just silently ignore  
everything but the first argument.  Fix that by checking the length of  
the first argument as well.  
  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/caaef70b-a874-1088-92ef-5ac38269c33b%40enterprisedb.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/object_address.out
M src/test/regress/sql/object_address.sql

Improve some GUC description strings

commit   : 1d3955266a5d9e71dc002634926210ccab8b15dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    

Click here for diff

It is not our usual style to use "we" in messages.  Also, remove some  
noise words.  Backpatch to 15.  
  
Noted by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c

Disable -Wdeprecated-non-prototype in the back branches.

commit   : f9a56e726334e4776ac0e5b2ead282793c1d9857    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 18:59:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 18:59:53 -0400    

Click here for diff

There doesn't seem to be any good ABI-preserving way to silence  
clang 15's -Wdeprecated-non-prototype warnings about our tree-walk  
APIs.  While we've fixed it properly in HEAD, the only way to not  
see hundreds of these in the back branches is to disable the  
warnings.  We're not going to do anything about them, so we might  
as well disable them.  
  
I noticed that we also get some of these warnings about fmgr.c's  
support for V0 function call convention, in branches before v10  
where we removed that.  That's another area we aren't going to  
change, so turning off the warning seems fine for that too.  
  
Per project policy, this is a candidate for back-patching into  
out-of-support branches: it suppresses annoying compiler warnings  
but changes no behavior.  Hence, back-patch all the way to 9.2.  
  
Discussion: https://postgr.es/m/CA+hUKGKpHPDTv67Y+s6yiC8KH5OXeDg6a-twWo_xznKTcG0kSA@mail.gmail.com  

M configure
M configure.ac

Suppress variable-set-but-not-used warnings from clang 15.

commit   : b7d9b0c2667e823404552e968431198288aee55e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    

Click here for diff

clang 15+ will issue a set-but-not-used warning when the only  
use of a variable is in autoincrements (e.g., "foo++;").  
That's perfectly sensible, but it detects a few more cases that  
we'd not noticed before.  Silence the warnings with our usual  
methods, such as PG_USED_FOR_ASSERTS_ONLY, or in one case by  
actually removing a useless variable.  
  
One thing that we can't nicely get rid of is that with %pure-parser,  
Bison emits "yynerrs" as a local variable that falls foul of this  
warning.  To silence those, I inserted "(void) yynerrs;" in the  
top-level productions of affected grammars.  
  
Per recently-established project policy, this is a candidate  
for back-patching into out-of-support branches: it suppresses  
annoying compiler warnings but changes no behavior.  Hence,  
back-patch to 9.5, which is as far as these patches go without  
issues.  (A preliminary check shows that the prior branches  
need some other set-but-not-used cleanups too, so I'll leave  
them for another day.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gistxlog.c
M src/backend/access/transam/xlog.c
M src/backend/parser/gram.y
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/jsonpath_gram.y
M src/bin/pgbench/exprparse.y

Disable autovacuum in MERGE test script

commit   : c922f924d348254f2d03d2949d1085084aafc480    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    

Click here for diff

Otherwise, it can fail given sufficient bad luck.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

doc: Fix parameter name for pg_create_logical_replication_slot()

commit   : 05af876267b7673f5ccaa1479ed6ea12fc303343    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 19:28:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 19:28:43 +0900    

Click here for diff

The parameter controlling if two-phase transactions can be decoded was  
named "two_phase" in the documentation while its procedure defines  
"twophase".  
  
Author: Florin Irion  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/func.sgml

Fix incorrect variable types for origin IDs in decode.c

commit   : 449f1d05416e8df79e25c433a603af1b18fd7147    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 18:13:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Sep 2022 18:13:39 +0900    

Click here for diff

These variables used XLogRecPtr instead of RepOriginId.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBm-vNyBSXGp4bmJGvhr=S-EGc5q1dtV70cFTcJvLhC=Q@mail.gmail.com  
Backpatch-through: 14  

M src/backend/replication/logical/decode.c

Fix misleading comment for get_cheapest_group_keys_order

commit   : 1ec2d0bc68db9ddffeeaa7f8a9f79ac2620d52e1    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 10:04:13 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 10:04:13 +1200    

Click here for diff

The header comment for get_cheapest_group_keys_order() claimed that the  
output arguments were set to a newly allocated list which may be freed by  
the calling function, however, this was not always true as the function  
would simply leave these arguments untouched in some cases.  
  
This tripped me up when working on 1349d2790 as I mistakenly assumed I  
could perform a list_concat with the output parameters.  That turned out  
bad due to list_concat modifying the original input lists.  
  
In passing, make it more clear that the number of distinct values is  
important to reduce tiebreaks during sorts.  Also, explain what the  
n_preordered parameter means.  
  
Backpatch-through: 15, where get_cheapest_group_keys_order was introduced.  

M src/backend/optimizer/path/pathkeys.c

Fix out-dated comment in preprocess_groupclause()

commit   : f6c70b81802a869303be9916d1a64a15f4dd29d1    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 09:15:04 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Sep 2022 09:15:04 +1200    

Click here for diff

The comment claimed we don't consider other orders of the GROUP BY clause,  
but this is no longer true as of db0d67db2.  
  
Discussion: https://postgr.es/m/CAApHDvq65=9Ro+hLX1i9ugWEiNDvHrBibAO7ARcTnf38_JE+UQ@mail.gmail.com  
Backpatch-through: 15, where db0d67db2 was introduced.  

M src/backend/optimizer/plan/planner.c

Fix icu tests with C locale

commit   : 7fbf9b1b07dcfb656d9c389c76ae74dd35542c21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    

Click here for diff

Similar to 1e08576691bf1a25c0e28745e5e800c44f2a1c76, but for the icu  
test suite.  
  
Reported-by: Christoph Berg <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/icu/t/010_database.pl

Future-proof the recursion inside ExecShutdownNode().

commit   : c403f97b4eabbfec90ab195a664b7aec3ad58004    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    

Click here for diff

The API contract for planstate_tree_walker() callbacks is that they  
take a PlanState pointer and a context pointer.  Somebody figured  
they could save a couple lines of code by ignoring that, and passing  
ExecShutdownNode itself as the walker even though it has but one  
argument.  Somewhat remarkably, we've gotten away with that so far.  
However, it seems clear that the upcoming C2x standard means to  
forbid such cases, and compilers that actively break such code  
likely won't be far behind.  So spend the extra few lines of code  
to do it honestly with a separate walker function.  
  
In HEAD, we might as well go further and remove ExecShutdownNode's  
useless return value.  I left that as-is in back branches though,  
to forestall complaints about ABI breakage.  
  
Back-patch, with the thought that this might become of practical  
importance before our stable branches are all out of service.  
It doesn't seem to be fixing any live bug on any currently known  
platform, however.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execProcnode.c

Improve GUC description punctuation

commit   : e4861b2322b74619a1124cd72d4987be0f2815e8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:45:23 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:45:23 -0400    

Click here for diff

partial backpatch of 0b039e3a8489c08ec61b4d40382047c389af91ad  

M src/backend/utils/misc/guc.c

Add missing serial commas

commit   : cacf12e92f7854547b8125f8a9d58694a05d1479    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    

Click here for diff

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Make check_usermap() parameter names consistent.

commit   : 1ef00afe2e457161421dc61f6bc329af3aa6cc4b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 16:54:16 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 17 Sep 2022 16:54:16 -0700    

Click here for diff

The function has a bool argument named "case_insensitive", but that was  
spelled "case_sensitive" in the declaration.  Make them consistent now  
to avoid confusion in the future.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Michael Paquiër <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  
Backpatch: 10-  

M src/include/libpq/hba.h

Include c.h instead of postgres.h in src/port/*p{read,write}*.c

commit   : 940c1c7ed3d14ae132c9b96643be6901b2d92993    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    

Click here for diff

Frontend code shouldn't include postgres.h. Some files in src/port/ need to  
include postgres.h/postgres_fe.h, but these files don't.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, where 3fd2a7932ef introduced (some) of these files  

M src/port/pread.c
M src/port/preadv.c
M src/port/pwrite.c
M src/port/pwritev.c

pgstat: Create memory contexts below TopMemoryContext

commit   : fb503793ef50eb16eb1924251d2ed58e1621eeb3    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    

Click here for diff

So far they were created below CacheMemoryContext. However, that's not  
guaranteed to exist in all situations, leading to memory contexts created as  
top-level contexts. There isn't actually a good reason anymore to create them  
below CacheMemoryContext, so just creating them below TopMemoryContext seems  
the best approach.  
  
Reported-by: Reid Thompson <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Author: "Drouvot, Bertrand" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c

Message style improvements

commit   : 23bcc8d877efde5cbbfe50bbbf12a96434e41f36    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    

Click here for diff

M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_target.c

Fix race condition in stats.sql added in 5264add7847

commit   : 885826f95d1c7803d3ff97bde64078b257543266    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    

Click here for diff

Very occasionally the stats test failed due to the number of sessions not  
being updated yet. Likely this requires that there is contention on the  
database's stats entry. Solve this by forcing pending stats to be flushed  
before fetching the stats.  
  
I verified that there are no other test failures after making  
pgstat_report_stat() only flush stats when force = true.  
  
Per message from Tom Lane and buildfarm member crake.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where 5264add7847 added the test  

M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Improve plpgsql's ability to handle arguments declared as RECORD.

commit   : b759bb6714f03e91071b8fe6d29c28a1f87ea4bb    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    

Click here for diff

Treat arguments declared as RECORD as if that were a polymorphic type  
(which it is, sort of), in that we substitute the actual argument type  
while forming the function cache lookup key.  This allows the specific  
composite type to be known in some cases where it was not before,  
at the cost of making a separate function cache entry for each named  
composite type that's passed to the function during a session.  The  
particular symptom discussed in bug #17610 could be solved in other  
more-efficient ways, but only at the cost of considerable development  
work, and there are other cases where we'd still fail without this.  
  
Per bug #17610 from Martin Jurča.  Back-patch to v11 where we first  
allowed plpgsql functions to be declared as taking type RECORD.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

Message wording improvements

commit   : c946425176f39e4656718a684a53e8dde5cc641a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    

Click here for diff

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/020_messages.pl

Fix createdb tests for C locale

commit   : 8135d0bd455217bd345090bae085b2bbcf62bdb0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    

Click here for diff

If the createdb tests run under the C locale, the database cluster  
will be initialized with encoding SQL_ASCII.  With the checks added in  
c7db01e325a530ec38ec7ba57cd3ed32e123e33c, this will cause several  
ICU-related tests to fail because SQL_ASCII is not supported by ICU.  
To work around that, use initdb option -E UTF8 for those tests to get  
past that check.  

M src/bin/scripts/t/020_createdb.pl

Don't allow creation of database with ICU locale with unsupported encoding

commit   : 148f66d59e2c2fa8bc79918973874e2803892664    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    

Click here for diff

Check in CREATE DATABASE and initdb that the selected encoding is  
supported by ICU.  Before, they would pass but users would later get  
an error from the server when they tried to use the database.  
  
Also document that initdb sets the encoding to UTF8 by default if the  
ICU locale provider is chosen.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/initdb.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/020_createdb.pl

Detect format-string mistakes in the libpq_pipeline test module.

commit   : 4e2a88905d7c05066a3caddc1f6ee76864e24c38    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    

Click here for diff

I happened to notice that libpq_pipeline's private implementation  
of pg_fatal lacked any pg_attribute_printf decoration.  Indeed,  
adding that turned up a mistake!  We'd likely never have noticed  
because the error exits in this code are unlikely to get hit,  
but still, it's a bug.  
  
We're so used to having the compiler check this stuff for us that  
a printf-like function without pg_attribute_printf is a land mine.  
I wonder if there is a way to detect such omissions.  
  
Back-patch to v14 where this code came in.  

M src/test/modules/libpq_pipeline/libpq_pipeline.c

Copy-edit docs for logical replication column lists

commit   : bfa58a679a577bffa58cd122b77483f508ed5933    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    

Click here for diff

There was a excessive structure, leading to somewhat disorganized  
presentation of the information. Remove a few tags and reorder  
paragraphs to make the text flow more easily.  Also, reword some of it  
to be more concise.  
  
The bit about column list combination is not modified, other than to  
remove an uninteresting (and IMO confusing and wrong) paragraph; I  
intend to deal with it differently afterwards.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml

Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.

commit   : e36cbef04bd59f5e2e56a180475d64b0dc06d069    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    

Click here for diff

After commit cc2c7d65fc27e877c9f407587b0b92d46cd6dd16 added this flag,  
failure to reset it caused assertion failures.  In non-assert builds, it  
made the system fail to achieve the objectives listed in that commit;  
chiefly, we might emit a spurious log message.  Back-patch to v15, where  
that commit first appeared.  
  
Bharath Rupireddy and Kyotaro Horiguchi.  Reviewed by Dilip Kumar,  
Nathan Bossart and Michael Paquier.  Reported by Dilip Kumar.  
  
Discussion: https://postgr.es/m/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c

Fix grammar in error message

commit   : eed548822ca23d3a35dfda7f559b1b7e443ac056    
  
author   : John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    

Click here for diff

While at it, make ellipses formatting consistent when describing SQL statements.  
  
Ekaterina Kiryanova and Alexander Lakhin  
  
Reviewed by myself and Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/eed5cec0-a542-53da-6a5e-7789c6ed9817%40postgrespro.ru  
Backpatch only the grammar fix to v15  

M src/backend/postmaster/bgworker.c

Fix outdated convert_saop_to_hashed_saop comment

commit   : d068b4108c2e8eda9dbc9fffb7055334c62c4f6a    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Sep 2022 09:41:32 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Sep 2022 09:41:32 +1200    

Click here for diff

In 29f45e299, we added support for optimizing the execution of NOT  
IN(values) by using a hash table instead of a linear search over the  
array.  That commit neglected to update the header comment for  
convert_saop_to_hashed_saop() to mention this fact.  Here we fix that.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe99NUpAPcxgchGstgM23fmiGjqQPot8627YgkBgNt=BfA@mail.gmail.com  
Backpatch-through: 15, where 29f45e299 was added.  

M src/backend/optimizer/util/clauses.c

Small wording improvements

commit   : 12a5214df4b784e793958c931c07836606efac9b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    

Click here for diff

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc.c

Remove duplicate initialization

commit   : ef81b7f8697807e57363d22b1e80389cd1efc4f8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    

Click here for diff

This appears to be a merge mistake in 96ef3237bf74.  We could put it  
back the way it was before JSON_TABLE and it'd be two lines shorter, but  
it's likely that JSON_TABLE will be back and will prefer things this  
way.  It makes no other difference in practice.  
  
Backpatch to 15.  
  
Reported by Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAr4nOcNQskC4oBEZN4S+4heJ=1ch_ZKOxU+_Ef-FQSf-g@mail.gmail.com  

M src/backend/parser/parse_relation.c

postgres_fdw: Avoid 'variable not found in subplan target list' error.

commit   : 64387c540805e392d051cf484ebcf937a9bd8b1b    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 14 Sep 2022 18:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 14 Sep 2022 18:45:01 +0900    

Click here for diff

The tlist of the EvalPlanQual outer plan for a ForeignScan node is  
adjusted to produce a tuple whose descriptor matches the scan tuple slot  
for the ForeignScan node.  But in the case where the outer plan contains  
an extra Sort node, if the new tlist contained columns required only for  
evaluating PlaceHolderVars or columns required only for evaluating local  
conditions, this would cause setrefs.c to fail with the error.  
  
The cause of this is that when creating the outer plan by injecting the  
Sort node into an alternative local join plan that could emit such extra  
columns as well, we fail to arrange for the outer plan to propagate them  
up through the Sort node, causing setrefs.c to fail to match up them in  
the new tlist to what is available from the outer plan.  Repair.  
  
Per report from Alexander Pyhalov.  
  
Richard Guo and Etsuro Fujita, reviewed by Alexander Pyhalov and Tom Lane.  
Backpatch to all supported versions.  
  
Discussion: http://postgr.es/m/cfb17bf6dfdf876467bd5ef533852d18%40postgrespro.ru  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix incorrect value for "strategy" with deflateParams() in walmethods.c

commit   : b3c630cc9230ef1ead0dab0ec1498fb4fd2d0de6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 14:52:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 14:52:26 +0900    

Click here for diff

The zlib documentation mentions the values supported for the compression  
strategy, but this code has been using a hardcoded value of 0 rather  
than Z_DEFAULT_STRATEGY.  This commit adjusts the code to use  
Z_DEFAULT_STRATEGY.  
  
Backpatch down to where this code has been added to ease the backport of  
any future patch touching this area.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_basebackup/walmethods.c

Expand palloc/pg_malloc API for more type safety

commit   : 7fe55d5e12b66c7807d8af1f45946d7d48f5d6db    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 06:04:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Sep 2022 06:04:24 +0200    

Click here for diff

This adds additional variants of palloc, pg_malloc, etc. that  
encapsulate common usage patterns and provide more type safety.  
  
Specifically, this adds palloc_object(), palloc_array(), and  
repalloc_array(), which take the type name of the object to be  
allocated as its first argument and cast the return as a pointer to  
that type.  There are also palloc0_object() and palloc0_array()  
variants for initializing with zero, and pg_malloc_*() variants of all  
of the above.  
  
Inspired by the talloc library.  
  
This is backpatched from master so that future backpatchable code can  
make use of these APIs.  This patch by itself does not contain any  
users of these APIs.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/common/fe_memutils.h
M src/include/utils/palloc.h

Simplify handling of compression level with compression specifications

commit   : 53332eacaff6a391f79294193d0c39bff9d14b43    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 12:17:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Sep 2022 12:17:03 +0900    

Click here for diff

PG_COMPRESSION_OPTION_LEVEL is removed from the compression  
specification logic, and instead the compression level is always  
assigned with each library's default if nothing is directly given.  This  
centralizes the checks on the compression methods supported by a given  
build, and always assigns a default compression level when parsing a  
compression specification.  This results in complaining at an earlier  
stage than previously if a build supports a compression method or not,  
aka when parsing a specification in the backend or the frontend, and not  
when processing it.  zstd, lz4 and zlib are able to handle in their  
respective routines setting up the compression level the case of a  
default value, hence the backend or frontend code (pg_receivewal or  
pg_basebackup) has now no need to know what the default compression  
level should be if nothing is specified: the logic is now done so as the  
specification parsing assigns it.  It can also be enforced by passing  
down a "level" set to the default value, that the backend will accept  
(the replication protocol is for example able to handle a command like  
BASE_BACKUP (COMPRESSION_DETAIL 'gzip:level=-1')).  
  
This code simplification fixes an issue with pg_basebackup --gzip  
introduced by ffd5365, where the tarball of the streamed WAL segments  
would be created as of pg_wal.tar.gz with uncompressed contents, while  
the intention is to compress the segments with gzip at a default level.  
The origin of the confusion comes from the handling of the default  
compression level of gzip (-1 or Z_DEFAULT_COMPRESSION) and the value of  
0 was getting assigned, which is what walmethods.c would consider  
as equivalent to no compression when streaming WAL segments with its tar  
methods.  Assigning always the compression level removes the confusion  
of some code paths considering a value of 0 set in a specification as  
either no compression or a default compression level.  
  
Note that 010_pg_basebackup.pl has to be adjusted to skip a few tests  
where the shape of the compression detail string for client and  
server-side compression was checked using gzip.  This is a result of the  
code simplification, as gzip specifications cannot be used if a build  
does not support it.  
  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/common/compression.c
M src/include/common/compression.h

Make locale option behavior more consistent

commit   : 3e694b318d20c876a3fd64f8e44d2ba5eab7a022    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    

Click here for diff

Locale options can be specified for initdb, createdb, and CREATE  
DATABASE.  In initdb, it has always been possible to specify --locale  
and then some --lc-* option to override a category.  CREATE DATABASE  
and createdb didn't allow that, requiring either the all-categories  
option or only per-category options.  In  
f2553d43060edb210b36c63187d52a632448e1d2, this was changed in CREATE  
DATABASE (perhaps by accident?) to be more like the initdb behavior,  
but createdb still had the old behavior.  
  
Now we change createdb to match the behavior of CREATE DATABASE and  
initdb, and also update the documentation of CREATE DATABASE to match  
the new behavior, which was not done in the above commit.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/ref/create_database.sgml
M src/bin/scripts/createdb.c

Improve wal_decode_buffer_size description some more

commit   : 892cac91249921af73cfe5a7209b64a16589ae18    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    

Click here for diff

Per Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGJ9wP9kpvgoxHvqA=4g1d9-y_w3LhhdhFVU=mFiqjwHww@mail.gmail.com  

M src/backend/utils/misc/guc.c

Move any remaining files generated by pg_upgrade into an internal subdir

commit   : f5047c1293acce3c6c3802b06825aa3a9f9aa55a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:38:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 13 Sep 2022 10:38:59 +0900    

Click here for diff

This change concerns a couple of .txt files (for internal state checks)  
that were still written in the path where the binary is executed, and  
not in the subdirectory located in the target cluster.  Like the other  
.txt files doing already so (like loadable_libraries.txt), these are  
saved in the base output directory.  Note that on failure, the logs  
report the full path to the .txt file generated, so these are easy to  
find.  
  
Oversight in 38bfae3.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/version.c

Don't reference out-of-bounds array elements in brin_minmax_multi.c

commit   : 4d5d35858c898a64a96cdff62d6d1ff9f08f9fa5    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Sep 2022 11:04:37 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Sep 2022 11:04:37 +1200    

Click here for diff

The primary fix here is to fix has_matching_range() so it does not  
reference ranges->values[-1] when nranges == 0.  Similar problems existed  
in AssertCheckRanges() too.  It does not look like any of these problems  
could lead to a crash as the array in question is at the end of the Ranges  
struct, and values[-1] is memory that belongs to other fields in the  
struct.  However, let's get rid of these rather unsafe coding practices.  
  
In passing, I (David) adjusted some comments to try to make it more clear  
what some of the fields are for in the Ranges struct.  I had to study the  
code to find out what nsorted was for as I couldn't tell from the  
comments.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com  
Backpatch-through: 14, where multi-range brin was added.  

M src/backend/access/brin/brin_minmax_multi.c

commit   : 7d7d72c195e89b3eb9f9c9a03f70f9d238207c59    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    

Click here for diff

The FreeBSD site was changed with a redirect, which in turn seems to  
lead to a 404. Replace with the working link.  
  
Author: James Coleman <[email protected]>  
Discussion: https://postgr.es/m/CAAaqYe_JZRj+KPn=hACtwsg1iLRYs=jYvxG1NW4AnDeUL1GD-Q@mail.gmail.com  

M doc/src/sgml/docguide.sgml

Add list of acknowledgments to release notes

commit   : cb49042b58f8ca42da1cd7f2baf56bf52d92cd69    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 16:51:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 16:51:00 +0200    

Click here for diff

This contains all individuals mentioned in the commit messages during  
PostgreSQL 15 development.  
  
current through REL_15_BETA4  

M doc/src/sgml/release-15.sgml

Fix NaN comparison in circle_same test

commit   : 56d238846fe6e1772c8652cd4945da6c0a42534a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    

Click here for diff

Commit c4c340088 changed geometric operators to use float4 and float8  
functions, and handle NaN's in a better way. The circle sameness test  
had a typo in the code which resulted in all comparisons with the left  
circle having a NaN radius considered same.  
  
  postgres=# select '<(0,0),NaN>'::circle ~= '<(0,0),1>'::circle;  
  ?column?  
  ----------  
  t  
  (1 row)  
  
This fixes the sameness test to consider the radius of both the left  
and right circle.  
  
Backpatch to v12 where this was introduced.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://postgr.es/m/CAEudQAo8dK=yctg2ZzjJuzV4zgOPBxRU5+Kb+yatFiddtQk6Rw@mail.gmail.com  
Backpatch-through: v12  

M src/backend/utils/adt/geo_ops.c
M src/test/regress/expected/geometry.out

Use float8 datatype for percentiles in pg_walinspect stat functions

commit   : c8a1bc01c6b05d394d5b6d0e0f594ccf9b46bbcb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    

Click here for diff

pg_walinspect uses datatype double (double precision floating point  
number) for WAL stats percentile calculations and expose them via  
float4 (single precision floating point number), which an unnecessary  
loss of precision and confusing. Even though, it's harmless that way,  
let's use float8 (double precision floating-point number) to be in  
sync with what pg_walinspect does internally and what it exposes to  
the users. This seems to be the pattern used elsewhere in the code.  
  
Reported-by: Peter Eisentraut  
Author: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com  

M contrib/pg_walinspect/pg_walinspect–1.0.sql
M contrib/pg_walinspect/pg_walinspect.c
M doc/src/sgml/pgwalinspect.sgml

Doc: improve explanation of when custom GUCs appear in pg_settings.

commit   : 44a51dc990cc39fcd5ae6359bf1e27bd6699449b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2022 16:42:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Sep 2022 16:42:25 -0400    

Click here for diff

Be more clear about when and how an extension-defined GUC comes to be  
visible in pg_settings.  (Move the para to the bottom of the page, too;  
whoever thought this point was more important than the para about the  
view being updatable had odd priorities IMNSHO.)  
  
Back-patch to v15 where archive modules were added, since that seems  
to have made this more of a sore spot than it was before.  
  
Benoit Lobréau, Nathan Bossart  
  
Discussion: https://postgr.es/m/CAPE8EZ7KHaXMHKwT=HOim23tDVKYA1PruRuTfeYdCrYWwPGhag@mail.gmail.com  

M doc/src/sgml/system-views.sgml

Fix possible omission of variable storage markers in ECPG.

commit   : fbb54d742ac888370e3221c556c5f336a1f4e888    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    

Click here for diff

The ECPG preprocessor converted code such as  
  
static varchar str1[10], str2[20], str3[30];  
  
into  
  
static  struct varchar_1  { int len; char arr[ 10 ]; }  str1 ;  
        struct varchar_2  { int len; char arr[ 20 ]; }  str2 ;  
        struct varchar_3  { int len; char arr[ 30 ]; }  str3 ;  
  
thus losing the storage attribute for the later variables.  
Repeat the declaration for each such variable.  
  
(Note that this occurred only for variables declared "varchar"  
or "bytea", which may help explain how it escaped detection  
for so long.)  
  
Andrey Sokolov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-variable.stderr
M src/interfaces/ecpg/test/expected/preproc-variable.stdout
M src/interfaces/ecpg/test/preproc/variable.pgc

Doc: improve documentation about where the psqlrc files are.

commit   : e0636ca90b819d7ca2e6e6dd35cf84d7032d473b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    

Click here for diff

Remove no-longer-accurate claim that Windows lacks home directories.  
Clarify the text by more clearly distinguishing which statements  
reflect hard-wired choices versus which ones reflect overridable  
defaults.  Update the examples of version-specific file names,  
and make them track future version changes by using "&majorversion;"  
and "&version;".  (BTW, in devel and beta releases this method  
correctly says that you can use strings like "16devel" and "15beta4"  
as minor version identifiers.)  
  
Back-patch to v15, but not further, with the thought that in older  
releases the examples with three-part version numbers still had  
some historical relevance.  v15 will be the first major release after  
the last 9.x branch went out of support.  
  
Robert Treat and Tom Lane, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/CAJSLCQ07F-WCYYYOY8+dWhHcVeJ1Pb01cWc-c0Hu=M3EjKT2Eg@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml

Reject bogus output from uuid_create(3).

commit   : 100a8ca2c2852a990135f6de4268b89f6ab19449    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    

Click here for diff

When using the BSD UUID functions, contrib/uuid-ossp expects  
uuid_create() to produce a version-1 UUID.  FreeBSD still does so,  
but in recent NetBSD releases that function produces a version-4  
(random) UUID instead.  That's not acceptable for our purposes:  
if the user wanted v4 she would have asked for v4, not v1.  
Hence, check the version digit and complain if it's not '1'.  
  
Also drop the documentation's claim that the NetBSD implementation  
is usable.  It might be, depending on which OS version you're using,  
but we're not going to get into that kind of detail.  
  
(Maybe someday we should ditch all these external libraries  
and just write our own UUID code, but today is not that day.)  
  
Nazir Bilal Yavuz, with cosmetic adjustments and docs by me.  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/uuid-ossp/uuid-ossp.c
M doc/src/sgml/installation.sgml
M doc/src/sgml/uuid-ossp.sgml

Doc fixes for MERGE statement

commit   : 5bb88967ed5cdfda05969557068229196d171276    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    

Click here for diff

In commit 3d895bc846f2 I introduced a bogus semicolon mid-statement by  
careless cut-n-paste; move it.  This had already been reported by Justin  
Pryzby.  
  
Also, change the styling a bit by avoiding names in CamelCase.  This is  
more consistent with the style we use elsewhere.  
  
Backpatch to 15.  
  
Author: Vitaly Burovoy <[email protected]>  
Reviewed-by: Vik Fearing <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/merge.sgml

Fix GetForeignKey*Triggers for self-referential FKs

commit   : 68b0da67794e62df53d07956482770cbfbc5e786    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    

Click here for diff

Because of inadequate filtering, the check triggers were confusing the  
search for action triggers in GetForeignKeyActionTriggers and vice-versa  
in GetForeignKeyCheckTriggers; this confusion results in seemingly  
random assertion failures, and can have real impact in non-asserting  
builds depending on catalog order.  Change these functions so that they  
correctly ignore triggers that are not relevant to each side.  
  
To reduce the odds of further problems, do not break out of the  
searching loop in assertion builds.  This break is likely to hide bugs;  
without it, we would have detected this bug immediately.  
  
This problem was introduced by f4566345cf40, so backpatch to 15 where  
that commit first appeared.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Add more error context to RestoreBlockImage() and consume it

commit   : 0a7c9ee50062e0f48cdd89b9c0e166ff59caabc8    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:01:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Sep 2022 10:01:14 +0900    

Click here for diff

On failure in restoring a block image, no details were provided, while  
it is possible to see failure with an inconsistent record state, a  
failure in processing decompression or a failure in decompression  
because a build does not support this option.  
  
RestoreBlockImage() is used in two code paths in the backend code,  
during recovery and when checking a page consistency after applying  
masking, and both places are changed to consume the error message  
produced by the internal routine when it returns a false status.  All  
the error messages are reported under ERRCODE_INTERNAL_ERROR, that gets  
used also when attempting to access a page compressed by a method  
not supported by the build attempting the decompression.  This is  
something that can happen in core when doing physical replication with  
primary and standby using inconsistent build options, for example.  
  
This routine is available since 2c03216d and it has never provided any  
context about the error happening when it failed.  This change is  
justified even more after 57aa5b2, that introduced compression of FPWs  
in WAL.  
  
Reported-by: Justin Prysby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c

Choose FK name correctly during partition attachment

commit   : ade2409b18e9c5d68afb13831da69198d06e5062    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    

Click here for diff

During ALTER TABLE ATTACH PARTITION, if the name of a parent's foreign  
key constraint is already used on the partition, the code tries to  
choose another one before the FK attributes list has been populated,  
so the resulting constraint name was "<relname>__fkey" instead of  
"<relname>_<attrs>_fkey".  Repair, and add a test case.  
  
Backpatch to 12.  In 11, the code to attach a partition was not smart  
enough to cope with conflicting constraint names, so the problem doesn't  
exist there.  
  
Author: Jehan-Guillaume de Rorthais <[email protected]>  
Discussion: https://postgr.es/m/20220901184156.738ebee5@karst  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Fix recovery_prefetch with low maintenance_io_concurrency.

commit   : dd38ff28addc13594c0f9e2a62ef2ffa59230598    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    

Click here for diff

We should process completed IOs *before* trying to start more, so that  
it is always possible to decode one more record when the decoded record  
queue is empty, even if maintenance_io_concurrency is set so low that a  
single earlier WAL record might have saturated the IO queue.  
  
That bug was hidden because the effect of maintenance_io_concurrency was  
arbitrarily clamped to be at least 2.  Fix the ordering, and also remove  
that clamp.  We need a special case for 0, which is now treated the same  
as recovery_prefetch=off, but otherwise the number is used directly.  
This allows for testing with 1, which would have made the problem  
obvious in simple test scenarios.  
  
Also add an explicit error message for missing contrecords.  It was a  
bit strange that we didn't report an error already, and became a latent  
bug with prefetching, since the internal state that tracks aborted  
contrecords would not survive retrying, as revealed by  
026_overwrite_contrecord.pl with this adjustment.  Reporting an error  
prevents that.  
  
Back-patch to 15.  
  
Reported-by: Justin Pryzby <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/20220831140128.GS31833%40telsasoft.com  

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/include/access/xlogreader.h

Message style fixes

commit   : 144cefac92644f338c35b77f6d9b4a9456c80563    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    

Click here for diff

M src/backend/replication/logical/worker.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/test/subscription/t/029_on_error.pl

Doc: Explain about Column List feature.

commit   : 25996a82a44629bdedeae73b36c37ee35b37e9fe    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Sep 2022 08:46:32 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Sep 2022 08:46:32 +0530    

Click here for diff

Add a new logical replication section for "Column Lists" (analogous to the  
Row Filters page). This explains how the feature can be used and the  
caveats in it.  
  
Author: Peter Smith  
Reviewed-by: Shi yu, Vignesh C, Erik Rijkers, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml

Fix new pg_publication_tables query.

commit   : e25631265a233e0c315458b206e419eca69fdb22    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    

Click here for diff

The addition of published column names forgot to filter on attisdropped,  
leading to cases where you could see "........pg.dropped.1........"  
or the like as a reportedly-published column.  
  
While we're here, rewrite the new subquery to get a more efficient plan  
for it.  
  
Hou Zhijie, per report from Jaime Casanova.  Back-patch to v15 where  
the bug was introduced.  (Sadly, this means we need a post-beta4  
catversion bump before beta4 has even hit the streets.  I see no  
good alternative though.)  
  
Discussion: https://postgr.es/m/Yxa1SU4nH2HfN3/i@ahch-to  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Stamp 15beta4.

commit   : 6e55ea79faa56db85a2b6c5bf94cee8acf8bfdb8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2022 17:12:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Sep 2022 17:12:45 -0400    

Click here for diff

M configure
M configure.ac

Translation updates

commit   : 77ce482e9efb9f1eaf62cd77ad1e5f17b6cc9d16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Sep 2022 14:37:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Sep 2022 14:37:22 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: f2c273bb8723eb69911a4b0b9d02ca15bbc7c60f  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/ja.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/ja.po
M src/bin/pg_amcheck/po/ka.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_archivecleanup/po/ka.po
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/po/es.po
M src/bin/pg_basebackup/po/ja.po
A src/bin/pg_basebackup/po/ka.po
M src/bin/pg_checksums/po/es.po
M src/bin/pg_checksums/po/ja.po
M src/bin/pg_checksums/po/ka.po
M src/bin/pg_config/po/ja.po
M src/bin/pg_config/po/ka.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_controldata/po/ka.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/ja.po
M src/bin/pg_ctl/po/ka.po
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/ja.po
A src/bin/pg_dump/po/ka.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_resetwal/po/ka.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_rewind/po/ka.po
M src/bin/pg_test_fsync/po/es.po
M src/bin/pg_test_fsync/po/ja.po
M src/bin/pg_test_fsync/po/ka.po
M src/bin/pg_test_timing/po/ja.po
M src/bin/pg_test_timing/po/ka.po
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/ja.po
A src/bin/pg_upgrade/po/ka.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/ka.po
M src/bin/pg_waldump/po/es.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/ka.po
M src/bin/psql/po/es.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ka.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/ka.po
M src/interfaces/ecpg/ecpglib/po/ja.po
M src/interfaces/ecpg/ecpglib/po/ka.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/ka.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ka.po
M src/pl/plperl/po/ja.po
M src/pl/plperl/po/ka.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/ja.po
A src/pl/plpgsql/src/po/ka.po
M src/pl/plpython/po/ka.po
M src/pl/tcl/po/ja.po
M src/pl/tcl/po/ka.po

Doc: clarify partitioned table limitations

commit   : 6ce4c4d83101886e0a9fea026faa3480a572bc84    
  
author   : David Rowley <[email protected]>    
date     : Mon, 5 Sep 2022 18:43:36 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 5 Sep 2022 18:43:36 +1200    

Click here for diff

Improve documentation regarding the limitations of unique and primary key  
constraints on partitioned tables.  The existing documentation didn't make  
it clear that the constraint columns had to be present in the partition  
key as bare columns.  The reader could be led to believe that it was ok to  
include the constraint columns as part of a function call's parameters or  
as part of an expression.  Additionally, the documentation didn't mention  
anything about the fact that we disallow unique and primary key  
constraints if the partition keys contain *any* function calls or  
expressions, regardless of if the constraint columns appear as columns  
elsewhere in the partition key.  
  
The confusion here was highlighted by a report on the general mailing list  
by James Vanns.  
  
Discussion: https://postgr.es/m/CAH7vdhNF0EdYZz3GLpgE3RSJLwWLhEk7A_fiKS9dPBT3Dz_3eA@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvoU-u9iTqKjteYRFfi+UNEk7dbSAcyxEQD==vZt9B1KnA@mail.gmail.com  
Reviewed-by: Erik Rijkers  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml

Reinstate tests accidentally removed by e3fcca0d0d

commit   : 46b588afcdc6891bb0972bdeb6bc36bad5c01033    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 5 Sep 2022 00:06:39 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 5 Sep 2022 00:06:39 +0200    

Click here for diff

Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also  
removed a couple unrelated tests from stats.sql. Reinstate those tests.  
  
Reported-by: Peter Eisentraut  

M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Force parallelism in partition_aggregate

commit   : 01474f56981a4b27fe5e304a61b0fce2ac025c69    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 4 Sep 2022 23:37:42 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 4 Sep 2022 23:37:42 +0200    

Click here for diff

Commit db0d67db2 tweaked sort costing, which however resulted in a  
couple plan changes in our regression tests. Most of the new plans were  
fine, but partition_aggregate were meant to test parallel plans and the  
new plans were serial.  
  
Fix that by lowering parallel_setup_cost to 0, which is enough to switch  
to the parallel plan again.  
  
Report and patch by David Rowley.  
  
Author: David Rowley  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAApHDvpVFgWzXdtUQkjyOPhNrNvumRi_=ftgS79KeAZ92tnHKQ@mail.gmail.com  

M src/test/regress/expected/partition_aggregate.out
M src/test/regress/sql/partition_aggregate.sql

commit   : 4209126655ccac68fe582c5fea3e638a4a1c503c    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 3 Sep 2022 20:57:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 3 Sep 2022 20:57:23 +0900    

Click here for diff

These have been updated by the revert done in 2f2b18b, but the  
pre-revert state was correct.  Note that the result was incorrectly  
formatted in the first case.  
  
Author: Erik Rijkers  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

doc: simplify docs about analyze and inheritance/partitions

commit   : a3e88e5a099eed5577771110b6824b376d5a44ae    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/analyze.sgml

doc: clarify recursion internal behavior

commit   : 170704da68c5150776c0ee4ed51350acde47b4a5    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    

Click here for diff

Reported-by: Drew DeVault  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

relnotes: improve collation check and ICU items

commit   : 4ddcb20592270ac3aa1082531d8057ca3d229951    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:47:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Sep 2022 21:47:30 -0400    

Click here for diff

Reported-by: Matthias van de Meent  
  
Discussion: https://postgr.es/m/CAEze2WhrNAT2g8upDUhfqt1nWfV_JdUgXAQu7oT4rY2L68O-HQ@mail.gmail.com  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

Fix cache invalidation bug in recovery_prefetch.

commit   : d0d934490020f9311662da8cdba4ccc2070e420d    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    

Click here for diff

XLogPageRead() can retry internally after a pread() system call has  
succeeded, in the case of short reads, and page validation failures  
while in standby mode (see commit 0668719801).  Due to an oversight in  
commit 3f1ce973, these cases could leave stale data in the internal  
cache of xlogreader.c without marking it invalid.  The main defense  
against stale cached data on failure to read a page was in the error  
handling path of the calling function ReadPageInternal(), but that  
wasn't quite enough for errors handled internally by XLogPageRead()'s  
retry loop if we then exited with XLREAD_WOULDBLOCK.  
  
1.  ReadPageInternal() now marks the cache invalid before calling the  
    page_read callback, by setting state->readLen to 0.  It'll be set to  
    a non-zero value only after a successful read.  It'll stay valid as  
    long as the caller requests data in the cached range.  
  
2.  XLogPageRead() no long performs internal retries while reading  
    ahead.  While such retries should work, the general philosophy is  
    that we should give up prefetching if anything unusual happens so we  
    can handle it when recovery catches up, to reduce the complexity of  
    the system.  Let's do that here too.  
  
3.  While here, a new function XLogReaderResetError() improves the  
    separation between xlogrecovery.c and xlogreader.c, where the former  
    previously clobbered the latter's internal error buffer directly.  
    The new function makes this more explicit, and also clears a related  
    flag, without which a standby would needlessly retry in the outer  
    function.  
  
Thanks to Noah Misch for tracking down the conditions required for a  
rare build farm failure in src/bin/pg_ctl/t/003_promote.pl, and  
providing a reproducer.  
  
Back-patch to 15.  
  
Reported-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/20220807003627.GA4168930%40rfd.leadboat.com  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/include/access/xlogreader.h

Doc: fix column list vs. replica identity rules.

commit   : ab3131880d8ada5bd03ede38e9d8c0c545997b69    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 2 Sep 2022 16:33:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 2 Sep 2022 16:33:18 +0530    

Click here for diff

It was not strictly correct to say that a column list must always include  
replica identity columns because that is true for only updates and  
deletes.  
  
Author: Peter Smith  
Reviwed-by: Vignesh C, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

M doc/src/sgml/ref/create_publication.sgml

Doc: Update struct Trigger definition.

commit   : ea4a066e5f15f0c8b721845dc7ecbe3b206e1991    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 2 Sep 2022 16:45:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 2 Sep 2022 16:45:01 +0900    

Click here for diff

Commit 487e9861d added a new field to struct Trigger, but failed to  
update the documentation to match; backpatch to v13 where that came in.  
  
Reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/CAPmGK17NY92CyxJ%2BBG7A3JZurmng4jfRfzPiBTtNupGMF0xW1g%40mail.gmail.com  

M doc/src/sgml/trigger.sgml

Revert SQL/JSON features

commit   : 96ef3237bf741c12390003e90a4d7115c0c854b7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Sep 2022 17:09:46 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Sep 2022 17:09:46 -0400    

Click here for diff

The reverts the following and makes some associated cleanups:  
  
    commit f79b803dc: Common SQL/JSON clauses  
    commit f4fb45d15: SQL/JSON constructors  
    commit 5f0adec25: Make STRING an unreserved_keyword.  
    commit 33a377608: IS JSON predicate  
    commit 1a36bc9db: SQL/JSON query functions  
    commit 606948b05: SQL JSON functions  
    commit 49082c2cc: RETURNING clause for JSON() and JSON_SCALAR()  
    commit 4e34747c8: JSON_TABLE  
    commit fadb48b00: PLAN clauses for JSON_TABLE  
    commit 2ef6f11b0: Reduce running time of jsonb_sqljson test  
    commit 14d3f24fa: Further improve jsonb_sqljson parallel test  
    commit a6baa4bad: Documentation for SQL/JSON features  
    commit b46bcf7a4: Improve readability of SQL/JSON documentation.  
    commit 112fdb352: Fix finalization for json_objectagg and friends  
    commit fcdb35c32: Fix transformJsonBehavior  
    commit 4cd8717af: Improve a couple of sql/json error messages  
    commit f7a605f63: Small cleanups in SQL/JSON code  
    commit 9c3d25e17: Fix JSON_OBJECTAGG uniquefying bug  
    commit a79153b7a: Claim SQL standard compliance for SQL/JSON features  
    commit a1e7616d6: Rework SQL/JSON documentation  
    commit 8d9f9634e: Fix errors in copyfuncs/equalfuncs support for JSON node types.  
    commit 3c633f32b: Only allow returning string types or bytea from json_serialize  
    commit 67b26703b: expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.  
  
The release notes are also adjusted.  
  
Backpatch to release 15.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/keywords/sql2016-02-reserved.txt
M doc/src/sgml/release-15.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
D src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/utils/formatting.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
D src/test/regress/expected/json_sqljson.out
D src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/opr_sanity.out
D src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
D src/test/regress/sql/json_sqljson.sql
D src/test/regress/sql/jsonb_sqljson.sql
M src/test/regress/sql/opr_sanity.sql
D src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Fix some possibly latent bugs in slab.c

commit   : c4e861b7bba3c4766beac53239c5435b9abe1275    
  
author   : David Rowley <[email protected]>    
date     : Thu, 1 Sep 2022 19:21:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 1 Sep 2022 19:21:58 +1200    

Click here for diff

Primarily, this fixes an incorrect calculation in SlabCheck which was  
looking in the wrong byte for the sentinel check.  The reason that we've  
never noticed this before in the form of a failing sentinel check is  
because the pre-check to this always fails because all current core users  
of slab contexts have a chunk size which is already MAXALIGNed, therefore  
there's never any space for the sentinel byte.  It is possible that an  
extension needs to use a slab context and if they do with a chunk size  
that's not MAXALIGNed, then they'll likely get errors about overwritten  
sentinel bytes.  
  
Additionally, this patch changes various calculations which are being done  
based on the sizeof(SlabBlock).  Currently, sizeof(SlabBlock) is a  
multiple of 8, therefore sizeof(SlabBlock) is the same as  
MAXALIGN(sizeof(SlabBlock)), however, if we were to ever have to add any  
fields to that struct as part of a bug fix, then SlabAlloc could end up  
returning a non-MAXALIGNed pointer.  To be safe, let's ensure we always  
MAXALIGN sizeof(SlabBlock) before using it in any calculations.  
  
This patch has already been applied to master in d5ee4db0e.  
  
Diagnosed-by: Tomas Vondra, Tom Lane  
Author: Tomas Vondra, David Rowley  
Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com  
Backpatch-through: 10  

M src/backend/utils/mmgr/slab.c

doc: in create statistics docs, mention analyze for parent info

commit   : 974299a808554a0983e92923a06e14e899cb2b55    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_statistics.sgml

doc: mention "bloom" as a possible index access method

commit   : 7d78fdb5f0618a38a0b34a541c328c80e9e37766    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    

Click here for diff

Also remove USING erroneously added recently.  
  
Reported-by: Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml

doc: use FILTER in aggregate example

commit   : 6a27e2f5339479debb6ac79c2dfcdbf7f8bc695c    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/query.sgml

doc: clarify that pgcrypto's gen_random_uuid calls core func.

commit   : 8dc12a9b64e9e2f49bcbc52fd69e7296529ff315    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    

Click here for diff

Previously it was just marked as a duplicate of the core function.  
  
Reported-by: Andreas Dijkman  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 13  

M doc/src/sgml/pgcrypto.sgml

doc: split out the NATURAL/CROSS JOIN in SELECT syntax

commit   : 8d489a30c0da319b24f9d22a0267c3c7f26564a7    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    

Click here for diff

This allows the syntax to be more accurate about what clauses are  
supported.  Also switch an example query to use the ANSI join syntax.  
  
Reported-by: Joel Jacobson  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/ref/select.sgml

doc: warn of SECURITY DEFINER schemas for non-sql_body functions

commit   : a2039b1f8e90d26a7e2a115ad5784476bd6deaa2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    

Click here for diff

Non-sql_body functions are evaluated at runtime.  
  
Reported-by: Erki Eessaar  
  
Discussion: https://postgr.es/m/AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

doc: mention that SET TIME ZONE often needs to be quoted

commit   : 0b16ee7e6fc79738bbd9ac6629276acee642d24a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    

Click here for diff

Also mention that time zone abbreviations are not supported.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/set.sgml

doc: document the maximum char/varchar length value

commit   : e40707c0e752822189de2f15ab955b87ca60ecd3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    

Click here for diff

Reported-by: Japin Li  
  
Discussion: https://postgr.es/m/MEYP282MB1669B13E98AE531617CB1386B6979@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
  
Backpatch-through: 10  

M doc/src/sgml/datatype.sgml

doc: show direction is optional in FETCH/MOVE's FROM/IN syntax

commit   : 27e8fc4bcc33e94cd0016b81464bbb7b13d47775    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    

Click here for diff

It used to show direction was required for FROM/IN.  
  
Reported-by: Rob <[email protected]>  
  
Discussion: https://postgr.es/m/20211015165248.isqjceyilelhnu3k@localhost  
  
Author: Rob <[email protected]>  
  
Backpatch-through: 10  

M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/move.sgml

doc: simplify WITH clause syntax in CREATE DATABASE

commit   : 3da5ecb98c80be0a5c8064b7e4b8f147862f1581    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    

Click here for diff

Reported-by: Rob <[email protected]>  
  
Discussion: https://postgr.es/m/20211016171149.yaouvlw5kvux6dvk@localhost  
  
Author: Rob <[email protected]>  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_database.sgml

Prevent long-term memory leakage in autovacuum launcher.

commit   : 0c599e748f2c81e415bb39567c4fd40a6bc64815    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    

Click here for diff

get_database_list() failed to restore the caller's memory context,  
instead leaving current context set to TopMemoryContext which is  
how CommitTransactionCommand() leaves it.  The callers both think  
they are using short-lived contexts, for the express purpose of  
not having to worry about cleaning up individual allocations.  
The net effect therefore is that supposedly short-lived allocations  
could accumulate indefinitely in the launcher's TopMemoryContext.  
  
Although this has been broken for a long time, it seems we didn't  
have any obvious memory leak here until v15's rearrangement of the  
stats logic.  I (tgl) am not entirely convinced that there's no  
other leak at all, though, and we're surely at risk of adding one  
in future back-patched fixes.  So back-patch to all supported  
branches, even though this may be only a latent bug in pre-v15.  
  
Reid Thompson  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

In the Snowball dictionary, don't try to stem excessively-long words.

commit   : 61f6e5c2360382be99846be904af33e3406c938a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    

Click here for diff

If the input word exceeds 1000 bytes, don't pass it to the stemmer;  
just return it as-is after case folding.  Such an input is surely  
not a word in any human language, so whatever the stemmer might  
do to it would be pretty dubious in the first place.  Adding this  
restriction protects us against a known recursion-to-stack-overflow  
problem in the Turkish stemmer, and it seems like good insurance  
against any other safety or performance issues that may exist in  
the Snowball stemmers.  (I note, for example, that they contain no  
CHECK_FOR_INTERRUPTS calls, so we really don't want them running  
for a long time.)  The threshold of 1000 bytes is arbitrary.  
  
An alternative definition could have been to treat such words as  
stopwords, but that seems like a bigger break from the old behavior.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  
Thanks to Olly Betts for the recommendation to fix it this way.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/snowball/dict_snowball.c

plpython: Don't create pgxsdir subdirectory in installdir target

commit   : fe9d009e3e945945e1e3bb0f65514217fc8566e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    

Click here for diff

As of db23464715f4792298c639153dda7bfd9ad9d602, we don't install  
anything there anymore from plpython, so we don't need to create the  
installation directory anymore.  

M src/pl/plpython/Makefile

On NetBSD, force dynamic symbol resolution at postmaster start.

commit   : 529d8f3736a1c62dc00ee272e04a6decaacc300b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    

Click here for diff

The default of lazy symbol resolution means that when the postmaster  
first reaches the select() call in ServerLoop, it'll need to resolve  
the link to that libc entry point.  NetBSD's dynamic loader takes  
an internal lock while doing that, and if a signal interrupts the  
operation then there is a risk of self-deadlock should the signal  
handler do anything that requires that lock, as several of the  
postmaster signal handlers do.  The window for this is pretty narrow,  
and timing considerations make it unlikely that a signal would arrive  
right then anyway.  But it's semi-repeatable on slow single-CPU  
machines, and in principle the race could happen with any hardware.  
  
The least messy solution to this is to force binding of dynamic  
symbols at postmaster start, using the "-z now" linker option.  
While we're at it, also use "-z relro" so as to provide a small  
security gain.  
  
It's not entirely clear whether any other platforms share this  
issue, but for now we'll assume it's NetBSD-specific.  (We might  
later try to use "-z now" on more platforms for performance  
reasons, but that would not likely be something to back-patch.)  
  
Report and patch by me; the idea to fix it this way is from  
Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/template/netbsd

Prevent WAL corruption after a standby promotion.

commit   : eb29fa38895c06814c30f758161a905e67f02ed1    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    

Click here for diff

When a PostgreSQL instance performing archive recovery but not using  
standby mode is promoted, and the last WAL segment that it attempted  
to read ended in a partial record, the previous code would create  
invalid WAL on the new timeline. The WAL from the previously timeline  
would be copied to the new timeline up until the end of the last valid  
record, but instead of beginning to write WAL at immediately  
afterwards, the promoted server would write an overwrite contrecord at  
the beginning of the next segment. The end of the previous segment  
would be left as all-zeroes, resulting in failures if anything tried  
to read WAL from that file.  
  
The root of the issue is that ReadRecord() decides whether to set  
abortedRecPtr and missingContrecPtr based on the value of StandbyMode,  
but ReadRecord() switches to a new timeline based on the value of  
ArchiveRecoveryRequested. We shouldn't try to write an overwrite  
contrecord if we're switching to a new timeline, so change the test in  
ReadRecod() to check ArchiveRecoveryRequested instead.  
  
Code fix by Dilip Kumar. Comments by me incorporating suggested  
language from Álvaro Herrera. Further review from Kyotaro Horiguchi  
and Sami Imseih.  
  
Discussion: http://postgr.es/m/CAFiTN-t7umki=PK8dT1tcPV=mOUe2vNhHML6b3T7W7qqvvajjg@mail.gmail.com  
Discussion: http://postgr.es/m/FB0DEA0B-E14E-43A0-811F-C1AE93D00FF3%40amazon.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c

Doc: fix example of recursive query.

commit   : ebe2b4097b5a5ce069a60358b1361d2702cac67f    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    

Click here for diff

Compute total number of sub-parts correctly, per [email protected]  
  
Simon Riggs  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/queries.sgml

Switch format specifier for replication origins to %d

commit   : 73cbdb7f1944b2ad847fb62d71011b96cd96c8fd    
  
author   : John Naylor <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    

Click here for diff

Using %u with uint16 causes warnings with -Wformat-signedness. There are many  
other warnings, but for now change only these since c920fe4818 already changed  
the message string for most of them.  
  
Per report from Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/31e63649-0355-7088-831e-b07d5f908a8c%40enterprisedb.com  

M src/backend/replication/logical/origin.c

Use correct connection for cancellation in frontend's parallel slots

commit   : 44817d97bca361f2be7fac64afa50715f959c11c    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 27 Aug 2022 15:22:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 27 Aug 2022 15:22:07 +0900    

Click here for diff

While waiting for slots to become available in wait_on_slots() in  
parallel_slot.c, the cancellation always relied on the first connection  
in the set to do the job.  This could cause problems when this slot's  
socket is gone as PQgetCancel() would return NULL in this case.  Rather  
than always using the first connection, this changes the logic to use  
the first valid connection for the cancellation.  
  
Author: Ranier Vilela  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com  
Backpatch-through: 14  

M src/fe_utils/parallel_slot.c

Remove obsolete comment

commit   : d4e9bca40309fff78c1a585cdb3dabf6fabfb6f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    

Click here for diff

The comment in basebackup.c updated by 33bd4698c11 was actually  
obsolete to begin with, since the symbols it was referring to haven't  
existed in that header file for quite some time.  The header file is  
still needed for other reasons, though, so keep the #include, just  
drop the comment.  

M src/backend/backup/basebackup.c

Fix typo in comment.

commit   : 2829cfaf78b6b9d1909ce1dbbdb2839be9697853    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 26 Aug 2022 16:55:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 26 Aug 2022 16:55:01 +0900    

Click here for diff

M src/backend/commands/copyfromparse.c

libpq code should use libpq_gettext(), not _()

commit   : c742eb36b1eb516166cdcb307a37dded51fa6089    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    

Click here for diff

Fix some wrong use and install a safeguard against future mistakes.  

M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/libpq-int.h

Fix doc oversight for custom WAL resource managers.

commit   : 01b23daa9bab9648457935e0c24376637eecd2e4    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    

Click here for diff

Reported-by: Bharath Rupireddy  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CALj2ACU+at7RqnWEzS59QsFg3ZOF4C4GSp7pt+PWiLEp0zrEKg@mail.gmail.com  

M doc/src/sgml/tableam.sgml

Update another comment still referring to pg_start/stop_backup()

commit   : 19c4de8289bedf90ac10d496e3896f8838937a83    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    

Click here for diff

M src/test/recovery/t/020_archive_status.pl

pg_dump: Fix new ICU tests

commit   : f2dcf1acfbd8d23e1651293cd3c83c0443b45143    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    

Click here for diff

ICU doesn't support some server encodings, so we need to exclude them  
if a non-supported encoding was set up.  

M src/bin/pg_dump/t/002_pg_dump.pl

Fix code comments still referring to pg_start/stop_backup()

commit   : 36a8881c4bfe578e94ba97a5140d7850ffa87bed    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Jul 2022 09:37:17 +0900    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 09:37:17 +0900    

Click here for diff

pg_start_backup() and pg_stop_backup() have been respectively renamed to  
pg_backup_start() and pg_backup_stop() as of 39969e2, but a few comments  
did not get the call.  
  
Reviewed-by: Kyotaro Horiguchi, David Steele  
Discussion: https://postgr.es/m/YrqGlj1+4DF3dbZ/@paquier.xyz  

M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c

pg_dump: Dump colliculocale

commit   : 72b6828da3f72bdcf87f680fe37a90ce964793cc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    

Click here for diff

This was forgotten when the new column was introduced.  
  
Author: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/7ad26354e75259f59c4a6c6997b8ee32%40postgrespro.ru  

M src/bin/pg_dump/Makefile
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Defend against stack overrun in a few more places.

commit   : 3d3c05c70fc7c1ce7794ebff55aa251a589de851    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    

Click here for diff

SplitToVariants() in the ispell code, lseg_inside_poly() in geo_ops.c,  
and regex_selectivity_sub() in selectivity estimation could recurse  
until stack overflow; fix by adding check_stack_depth() calls.  
So could next() in the regex compiler, but that case is better fixed by  
converting its tail recursion to a loop.  (We probably get better code  
that way too, since next() can now be inlined into its sole caller.)  
  
There remains a reachable stack overrun in the Turkish stemmer, but  
we'll need some advice from the Snowball people about how to fix that.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  These mistakes  
are old, so back-patch to all supported branches.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regc_lex.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/like_support.c

Doc: remove duplicate "a" from func.sgml

commit   : e6828053d9d62aab68f74d0f3a024db10a4ce5fd    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 23:46:40 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Aug 2022 23:46:40 +1200    

Click here for diff

Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15, where that change was introduced  

M doc/src/sgml/func.sgml

Fix ICU locale option handling in CREATE DATABASE

commit   : f02147bd237eb59d908ed3166895081ba17df4a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    

Click here for diff

The code took the LOCALE option as the default/fallback for  
ICU_LOCALE, but this was neither documented nor intended, so remove  
it.  (It was probably left in from an earlier patch version.)  
  
Reported-by: Marina Polyakova <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c

Message style adjustment

commit   : dfe2eb7633f53c26cac6d31d1cb5736113d16349    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    

Click here for diff

M src/interfaces/libpq/fe-auth-scram.c

Doc: document possible need to raise kernel's somaxconn limit.

commit   : 2c63b0930aee1bb5c265fad4a65c9d0b62b1f9da    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    

Click here for diff

On fast machines, it's possible for applications such as pgbench  
to issue connection requests so quickly that the postmaster's  
listen queue overflows in the kernel, resulting in unexpected  
failures (with not-very-helpful error messages).  Most modern OSes  
allow the queue size to be increased, so document how to do that.  
  
Per report from Kevin McKibbin.  
  
Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com  

M doc/src/sgml/runtime.sgml

Doc: prefer sysctl to /proc/sys in docs and comments.

commit   : d53ff6a44b32c15dd150c383ffbe4b0f5dd13037    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    

Click here for diff

sysctl is more portable than Linux's /proc/sys file tree, and  
often easier to use too.  That's why most of our docs refer to  
sysctl when talking about how to adjust kernel parameters.  
Bring the few stragglers into line.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/postmaster/postmaster.c

Add CHECK_FOR_INTERRUPTS while decoding changes.

commit   : 42681dffafa2f9dea3e034d0c29a3f1a7b3b07e8    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 23 Aug 2022 10:08:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 23 Aug 2022 10:08:43 +0530    

Click here for diff

While decoding changes in a loop, if we skip all the changes there is no  
CFI making the loop uninterruptible.  
  
Reported-by: Whale Song and Andrey Borodin  
Bug: 17580  
Author: Masahiko Sawada  
Reviwed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/reorderbuffer.c

pgstat: Acquire lock when reading variable-numbered stats

commit   : 045ec347857b66e8a494b2c12126a6d476702065    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    

Click here for diff

Somewhere during the development of the patch acquiring a lock during read  
access to variable-numbered stats got lost. The missing lock acquisition won't  
cause corruption, but can lead to reading torn values when accessing  
stats. Add the missing lock acquisitions.  
  
Reported-by: Greg Stark <[email protected]>  
Reviewed-by: "Drouvot, Bertrand" <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@mail.gmail.com  
Backpatch: 15-  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/include/utils/pgstat_internal.h

Fix assertion failure in CREATE DATABASE

commit   : a2caf182a2edcee7b1c00036b7dba6762941473c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    

Click here for diff

An assertion would fail when creating a database with libc locale  
provider from a template database with icu locale provider.  
  
Reported-by: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

pg_upgrade: Fix thinko in database info acquisition routine

commit   : 3725b7f3c93eac3148fe36cffbb7db47d4a9fae0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    

Click here for diff

When checking whether the major version supports per-database locale  
providers, it was always looking at the version of the old cluster  
instead of the cluster that was passed in.  This would lead to  
failures to detect locale provider mismatches.  
  
Reported-by: Marina Polyakova <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/bin/pg_upgrade/info.c

Use logical operator && instead of & in vacuumparallel.c.

commit   : 254d79f0b23dfe107594c90ee8375165422db2c4    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 22 Aug 2022 08:51:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 22 Aug 2022 08:51:25 +0530    

Click here for diff

As such the current usage of & won't produce incorrect results but it  
would be better to use && to short-circuit the evaluation of second  
condition when the same is not required.  
  
Author: Ranier Vilela  
Reviewed-by: Tom Lane, Bharath Rupireddy  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAEudQApL8QcoYwQuutkWKY_h7gBY8F0Xs34YKfc7-G0i83K_pw@mail.gmail.com  

M src/backend/commands/vacuumparallel.c

Remove shadowed local variables that are new in v15

commit   : 24f457aa2b7006e4b427a3ac1e7ce0f248b55ba3    
  
author   : David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 11:40:59 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 20 Aug 2022 11:40:59 +1200    

Click here for diff

Compiling with -Wshadow=compatible-local yields quite a few warnings about  
local variables being shadowed by compatible local variables in an inner  
scope.  Of course, this is perfectly valid in C, but we have had bugs in  
the past as a result of developers failing to notice this.  af7d270dd is a  
recent example.  
  
Here we do a cleanup of warnings we receive from -Wshadow=compatible-local  
for code which is new to PostgreSQL 15.  We've yet to have the discussion  
about if we actually ever want to run that as a standard compilation flag.  
We'll need to at least get the number of warnings down to something easier  
to manage before we can realistically consider if we want this or not.  
This commit is the first step towards reducing the warnings.  
  
The changes being made here are all fairly trivial.  Because of that, and  
the fact that v15 is still in beta, this is being back-patched into 15.  
It seems more risky not to do this as the risk of future bugs is increased  
by the additional conflicts that this commit could cause for any future  
bug fixes touching the same areas as this commit.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220817145434.GC26426%40telsasoft.com  
Backpatch-through: 15  

M src/backend/backup/basebackup_target.c
M src/backend/parser/parse_jsontable.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/jsonpath_exec.c
M src/bin/pg_dump/pg_dump.c

Avoid reltuples distortion in very small tables.

commit   : 4496020e6dfaffe8217e4d3f85567bb2b6927b45    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 19 Aug 2022 09:26:06 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 19 Aug 2022 09:26:06 -0700    

Click here for diff

Consistently avoid trusting a sample of only one page at the point that  
VACUUM determines a new reltuples for the target table (though only when  
the table is larger than a single page).  This is follow-up work to  
commit 74388a1a, which added a heuristic to prevent reltuples from  
becoming distorted by successive VACUUM operations that each scan only a  
single heap page (which was itself more or less a bugfix for an issue in  
commit 44fa8488, which simplified VACUUM's handling of scanned pages).  
  
The original bugfix commit did not account for certain remaining cases  
that where not affected by its "2% of total relpages" heuristic.  This  
happened with relations that are small enough that just one of its pages  
exceeded the 2% threshold, yet still big enough for VACUUM to deem  
skipping most of its pages via the visibility map worthwhile.  reltuples  
could still become distorted over time with such a table, at least in  
scenarios where the VACUUM command is run repeatedly and without the  
table itself ever changing.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk7d4m3oEbEWkWQKd+gz-eD_peBvdXVk1a_KBygXadFeg@mail.gmail.com  
Backpatch: 15-, where the rules for scanned pages changed.  

M src/backend/commands/vacuum.c

doc: Improve some markups and some wording around archiving modules

commit   : 4afe79bd31e82b1b2d725c463a4aff2f85d8a3d0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Aug 2022 10:00:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Aug 2022 10:00:23 +0900    

Click here for diff

This commit adds or fixes used markups in a couple of places in the docs  
(for <command>, <systemitem> and <literal>).  While on it, clarify some  
of the documentation added recently for archiving modules with  
archive_command, that would still be used as default choice if no  
external module is defined (though an archive module could as well use  
an archive_command).  
  
Author: Maxim Yablokov  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/archive-modules.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/psql-ref.sgml

Initialize index stats during parallel VACUUM.

commit   : 08c23f4204066aa86361eb6232d94284aa8dff00    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 18 Aug 2022 17:34:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 18 Aug 2022 17:34:12 -0700    

Click here for diff

Initialize shared memory allocated for index stats to avoid a hard  
crash.  This was possible when parallel VACUUM became confused about the  
current phase of index processing.  
  
Oversight in commit 8e1fae1938, which refactored parallel VACUUM.  
  
Author: Masahiko Sawada <[email protected]>  
Reported-By: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, the first version with the refactoring commit.  

M src/backend/commands/vacuumparallel.c

Use correct LSN for error reporting in pg_walinspect

commit   : 72af71aad9ce541ecea67ceaa7961ca39f89f227    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Aug 2022 14:23:59 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Aug 2022 14:23:59 -0700    

Click here for diff

Usage of ReadNextXLogRecord()'s first_record parameter for error  
reporting isn't always correct. For instance, in GetWALRecordsInfo()  
and GetWalStats(), we're reading multiple records, and first_record  
is always passed as the LSN of the first record which is then used  
for error reporting for later WAL record read failures. This isn't  
correct.  
  
The correct parameter to use for error reports in case of WAL  
reading failures is xlogreader->EndRecPtr. This change fixes it.  
  
While on it, removed an unnecessary Assert in pg_walinspect code.  
  
Reported-by: Robert Haas  
Author: Bharath Rupireddy  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZAOGzPUifrcZRjFZ2vbtcw3mp-mN6UgEoEcQg6bY3OVg%40mail.gmail.com  
Backpatch-through: 15  

M contrib/pg_walinspect/pg_walinspect.c

Fix subtly-incorrect matching of parent and child partitioned indexes.

commit   : 2a42c1c51d15f8848d81739d6417376808597045    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    

Click here for diff

When creating a partitioned index, DefineIndex tries to identify  
any existing indexes on the partitions that match the partitioned  
index, so that it can absorb those as child indexes instead of  
building new ones.  Part of the matching is to compare IndexInfo  
structs --- but that wasn't done quite right.  We're comparing  
the IndexInfo built within DefineIndex itself to one made from  
existing catalog contents by BuildIndexInfo.  Notably, while  
BuildIndexInfo will run index expressions and predicates through  
expression preprocessing, that has not happened to DefineIndex's  
struct.  The result is failure to match and subsequent creation  
of duplicate indexes.  
  
The easiest and most bulletproof fix is to build a new IndexInfo  
using BuildIndexInfo, thereby guaranteeing that the processing done  
is identical.  
  
While here, let's also extract the opfamily and collation data  
from the new partitioned index, removing ad-hoc logic that  
duplicated knowledge about how those are constructed.  
  
Per report from Christophe Pettus.  Back-patch to v11 where  
we invented partitioned indexes.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c
M src/test/regress/expected/indexing.out
M src/test/regress/sql/indexing.sql

When using the WAL-logged CREATE DATABASE strategy, bulk extend.

commit   : 576bb0fc93423890761f77384415936bf61267d3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    

Click here for diff

This should improve performance, and was suggested by Andres Freund.  
Back-patch to v15 to keep the code consistent across branches.  
  
Dilip Kumar  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAFiTN-sJ0vVpJrZ=R5M+g7Tr8=NN4wKOtrqOcDEsfFfnZgivVA@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c

Simplify and clarify an error message

commit   : 9c4c22fdfeab86a65fdba9d2fe63879c034001ae    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    

Click here for diff

M src/backend/commands/copyfromparse.c
M src/test/regress/expected/copy.out

Refer to replication origin roident as "ID" in user facing messages and docs

commit   : 7cadaac5130ec60d905c5ad69af98056b54c4e37    
  
author   : John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    

Click here for diff

The table column that stores this is of type oid, but is actually limited  
to uint16 and has a different path for creating new values. Some of  
the documentation already referred to it as an ID, so let's standardize  
on that.  
  
While at it, most format strings already use %u, so for consintency  
change the remaining stragglers using %d.  
  
Per suggestions from Tom Lane and Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/3437166.1659620465%40sss.pgh.pa.us  
Backpatch to v15  

M doc/src/sgml/replication-origins.sgml
M src/backend/replication/logical/origin.c

Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW

commit   : 522ae011fa010a74cd74ef13036df5138751eee2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 14:55:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Aug 2022 14:55:24 +0900    

Click here for diff

This event can happen when using SET ACCESS METHOD, as the data files of  
the materialized need a full refresh but this command tag was not  
updated to reflect that.  The documentation is updated to track this  
behavior.  
  
Author: Onder Kalaci  
Discussion: https://postgr.es/m/CACawEhXwHN3X34FiwoYG8vXR-oyUdrp7qcfRWSzS+NPahS5gSw@mail.gmail.com  
Backpatch-through: 15  

M doc/src/sgml/event-trigger.sgml
M src/include/tcop/cmdtaglist.h
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Fix assert in logicalmsg_desc

commit   : be6aadf07d005c292ac05e4b80761f7962facb71    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 16 Aug 2022 23:52:10 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 16 Aug 2022 23:52:10 +0200    

Click here for diff

The assert, introduced by 9f1cf97bb5, is intended to check if the prefix  
is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size  
includes the \0 byte, so prefix[prefix_size] points to the byte after  
the null byte. Secondly, the check ensures the byte is not equal \0,  
while it should be checking the opposite.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/rmgrdesc/logicalmsgdesc.c

doc: Remove reference to tty libpq connstring param

commit   : ac222a3c374080f241936d2e47149d01ea006d6d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 22:54:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 22:54:43 +0200    

Click here for diff

The tty connection string parameter was removed in commit 14d9b3760  
but the reference to it in the docs was mistakenly kept.  Fix by  
removing it from the libpq documentation.  Backpatch through v14  
where the parameter was removed.  
  
Author: Noriyoshi Shinoda <[email protected]>  
Discussion: https://postgr.es/m/DM4PR84MB173433216FCC2A3961879000EE6B9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  
Backpatch-through: 14  

M doc/src/sgml/libpq.sgml

doc: Add missing parenthesis to keycombo

commit   : 207fc754664492e3b61f18946bc3720db9781681    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 12:44:24 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Aug 2022 12:44:24 +0200    

Click here for diff

The SIGINT keycombo for the pg_waldump stats emission was lacking a  
closing parenthesis.  Backpatch to 15 where this feature was added.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/ref/pg_waldump.sgml

Fix replica identity check for a partitioned table.

commit   : 76d257925994556bb49a7ce13dcb4785fbe7f395    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 16 Aug 2022 15:14:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 16 Aug 2022 15:14:27 +0530    

Click here for diff

The current publisher code checks if UPDATE or DELETE can be executed with  
the replica identity of the table even if it's a partitioned table. We can  
skip checking the replica identity for partitioned tables because the  
operations are actually performed on the leaf partitions (not the  
partitioned table).  
  
Reported-by: Brad Nicholson  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAMMnM%3D8i5DohH%3DYKzV0_wYuYSYvuOJoL9F5nzXTc%2ByzsG1f6rg%40mail.gmail.com  

M src/backend/executor/execReplication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

doc: fix wrong tag used in create sequence manual.

commit   : 16c68567b58e328e97a00c7f273ee26cee6bbf01    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Aug 2022 09:26:40 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 16 Aug 2022 09:26:40 +0900    

Click here for diff

In ref/create_sequence.sgml <literal> tag was used for nextval function name.  
This should have been <function> tag.  
  
Author: Noboru Saito  
Discussion: https://postgr.es/m/CAAM3qnJTDFFfRf5JHJ4AYrNcqXgMmj0pbH0%2Bvm%3DYva%2BpJyGymA%40mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ref/create_sequence.sgml

Add missing bad-PGconn guards in libpq entry points.

commit   : ef9f35964dea10d522fdb3aadef3e92f50b03d1c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2022 15:40:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 15 Aug 2022 15:40:07 -0400    

Click here for diff

There's a convention that externally-visible libpq functions should  
check for a NULL PGconn pointer, and fail gracefully instead of  
crashing.  PQflush() and PQisnonblocking() didn't get that memo  
though.  Also add a similar check to PQdefaultSSLKeyPassHook_OpenSSL;  
while it's not clear that ordinary usage could reach that with a  
null conn pointer, it's cheap enough to check, so let's be consistent.  
  
Daniele Varrazzo and Tom Lane  
  
Discussion: https://postgr.es/m/CA+mi_8Zm_mVVyW1iNFgyMd9Oh0Nv8-F+7Y3-BqwMgTMHuo_h2Q@mail.gmail.com  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-secure-openssl.c

Fix outdated --help message for postgres -f

commit   : a5d2337005820a2227d2d9970cdd5a7ac67bfc75    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 13:37:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Aug 2022 13:37:32 +0900    

Click here for diff

This option switch supports a total of 8 values, as told by  
set_plan_disabling_options() and the documentation, but this was not  
reflected in the output generated by --help.  
  
Author: Junwang Zhao  
Discussion: https://postgr.es/m/CAEG8a3+pT3cWzyjzKs184L1XMNm8NDnoJLiSjAYSO7XqpRh_vA@mail.gmail.com  
Backpatch-through: 10  

M src/backend/main/main.c

Preserve memory context of VarStringSortSupport buffers.

commit   : 9ae484121f5225e00e899ed9bd67b7ef4191a133    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2022 12:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Aug 2022 12:05:27 -0400    

Click here for diff

When enlarging the work buffers of a VarStringSortSupport object,  
varstrfastcmp_locale was careful to keep them in the ssup_cxt  
memory context; but varstr_abbrev_convert just used palloc().  
The latter creates a hazard that the buffers could be freed out  
from under the VarStringSortSupport object, resulting in stomping  
on whatever gets allocated in that memory later.  
  
In practice, because we only use this code for ICU collations  
(cf. 3df9c374e), the problem is confined to use of ICU collations.  
I believe it may have been unreachable before the introduction  
of incremental sort, too, as traditional sorting usually just  
uses one context for the duration of the sort.  
  
We could fix this by making the broken stanzas in varstr_abbrev_convert  
match the non-broken ones in varstrfastcmp_locale.  However, it seems  
like a better idea to dodge the issue altogether by replacing the  
pfree-and-allocate-anew coding with repalloc, which automatically  
preserves the chunk's memory context.  This fix does add a few cycles  
because repalloc will copy the chunk's content, which the existing  
coding assumes is useless.  However, we don't expect that these buffer  
enlargement operations are performance-critical.  Besides that, it's  
far from obvious that copying the buffer contents isn't required, since  
these stanzas make no effort to mark the buffers invalid by resetting  
last_returned, cache_blob, etc.  That seems to be safe upon examination,  
but it's fragile and could easily get broken in future, which wouldn't  
get revealed in testing with short-to-moderate-size strings.  
  
Per bug #17584 from James Inform.  Whether or not the issue is  
reachable in the older branches, this code has been broken on its  
own terms from its introduction, so patch all the way back.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/varlena.c

Avoid misbehavior when hash_table_bytes < bucket_size.

commit   : aee95437362db0ef2c4caed942272c86b4509390    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 16:59:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 16:59:58 -0400    

Click here for diff

It's possible to reach this case when work_mem is very small and tupsize  
is (relatively) very large.  In that case ExecChooseHashTableSize would  
get an assertion failure, or with asserts off it'd compute nbuckets = 0,  
which'd likely cause misbehavior later (I've not checked).  To fix,  
clamp the number of buckets to be at least 1.  
  
This is due to faulty conversion of old my_log2() coding in 28d936031.  
Back-patch to v13, as that was.  
  
Zhang Mingli  
  
Discussion: https://postgr.es/m/beb64ca0-91e2-44ac-bf4a-7ea36275ec02@Spark  

M src/backend/executor/nodeHash.c

Catch stack overflow when recursing in transformFromClauseItem().

commit   : 00ac61695e5c7d573b14bb7a61387a3fae017928    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 15:21:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Aug 2022 15:21:28 -0400    

Click here for diff

Most parts of the parser can expect that the stack overflow check  
in transformExprRecurse() will trigger before things get desperate.  
However, transformFromClauseItem() can recurse directly to self  
without having analyzed any expressions, so it's possible to drive  
it to a stack-overrun crash.  Add a check to prevent that.  
  
Per bug #17583 from Egor Chindyaskin.  Back-patch to all supported  
branches.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_clause.c

Add missing fields to _outConstraint()

commit   : 94478f44a4a0628efa5f7f9184f528a12475a4a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 10:32:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 10:32:38 +0200    

Click here for diff

As of 897795240cfaaed724af2f53ed2c50c9862f951f, check constraints can  
be declared invalid.  But that patch didn't update _outConstraint() to  
also show the relevant struct fields (which were only applicable to  
foreign keys before that).  This currently only affects debugging  
output, so no impact in practice.  

M src/backend/nodes/outfuncs.c

pg_upgrade: Fix some minor code issues

commit   : c7bc39cec78da20c31861ca57a4749ca3c3cfec0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 00:00:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Aug 2022 00:00:41 +0200    

Click here for diff

96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56 accidentally copied a not  
applicable comment from the float8_pass_by_value code to the  
data_checksums code.  Remove that.  
  
87d3b35a1ca31a9d947a8f919a6006679216dff0 changed pg_upgrade to  
checking the checksum version rather than just the Boolean presence of  
checksums, but didn't change the field type in its ControlData struct  
from bool.  So this would not work correctly if there ever is a  
checksum version larger than 1.  

M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.h

doc: add missing role attributes to user management section

commit   : 560d052ebdb287965a5f34a8191e246d5aaf6cda    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:43:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:43:23 -0400    

Click here for diff

Reported-by: Shinya Kato  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Shinya Kato  
  
Backpatch-through: 10  

M doc/src/sgml/user-manag.sgml

doc: add section about heap-only tuples (HOT)

commit   : 4445461cdff3580a2a698e89f66efd467f1bb5df    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:05:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 15:05:13 -0400    

Click here for diff

Reported-by: Jonathan S. Katz  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/storage.sgml

doc: warn about security issues around log files

commit   : 5eb38dc1efc6a83043eabbd4d26271ff232389ca    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 12:02:21 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 12:02:21 -0400    

Click here for diff

Reported-by: Simon Riggs  
  
Discussion: https://postgr.es/m/CANP8+jJESuuXYq9Djvf-+tx2vY2OFLmfEuu+UvwHNJ1RT7iJCQ@mail.gmail.com  
  
Author: Simon Riggs  
  
Backpatch-through: 10  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml

doc: clarify configuration file for Windows builds

commit   : c90dfb62b8bce062c81581bb379c9fdaac54e082    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:35:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:35:23 -0400    

Click here for diff

The use of file 'config.pl' was not clearly explained.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/install-windows.sgml

doc: document the CREATE INDEX "USING" clause

commit   : 5d499dab755f6e2abe365983c2f9a70f220fa703    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:26:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 11:26:03 -0400    

Click here for diff

Somehow this was in the syntax but had no description.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_index.sgml

doc: clarify CREATE TABLE AS ... IF NOT EXISTS

commit   : b79e62632313d279bb265c7689a2fd79dd0cfcf3    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:59:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:59:00 -0400    

Click here for diff

Mention that the table is not modified if it already exists.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_table_as.sgml

doc: improve wal_level docs for the 'minimal' level

commit   : cdb257766ba252709aeb6bcd28017a7eab8ff965    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:30:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 10:30:01 -0400    

Click here for diff

Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwZ24UcfkoyLLSW3PMGQATomOcw1nuYFRuMev-NoOF+mYw@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 14, partial to 13  

M doc/src/sgml/config.sgml

doc: clarify DROP EXTENSION dependent members text

commit   : 89512ee14cc302d060bd215ce4d9a938280cbbb5    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 09:06:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 12 Aug 2022 09:06:48 -0400    

Click here for diff

Member tracking was added in PG 13.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwY1YtxQHVWUFYvSnOjZ5VPpXjF33V52bSKEwFjK2K=1Aw@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 13  

M doc/src/sgml/ref/drop_extension.sgml

Avoid using a fake relcache entry to own an SmgrRelation.

commit   : 1b94f8f232f681890680a866f79dce649a78bd2d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Aug 2022 08:55:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Aug 2022 08:55:07 -0400    

Click here for diff

If an error occurs before we close the fake relcache entry, the the  
fake relcache entry will be destroyed by the SmgrRelation will  
survive until end of transaction. Its smgr_owner pointer ends up  
pointing to already-freed memory.  
  
The original reason for using a fake relcache entry here was to try  
to avoid reusing an SMgrRelation across a relevant invalidation. To  
avoid that problem, just call smgropen() again each time we need a  
reference to it. Hopefully someday we will come up with a more  
elegant approach, but accessing uninitialized memory is bad so let's  
do this for now.  
  
Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by  
Justin Pryzby.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com  

M src/backend/commands/dbcommands.c
M src/backend/storage/buffer/bufmgr.c

MERGE docs adjustments

commit   : d6d1fbf353d12b88509af40116ce90047d1db440    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 13:16:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 13:16:50 +0200    

Click here for diff

Per Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/merge.sgml

Reject MERGE in CTEs and COPY

commit   : 455d254d22665eb7af3b714435f3fecc63696cc7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 12:05:50 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Aug 2022 12:05:50 +0200    

Click here for diff

The grammar added for MERGE inadvertently made it accepted syntax in  
places that were not prepared to deal with it -- namely COPY and inside  
CTEs, but invoking these things with MERGE currently causes assertion  
failures or weird misbehavior in non-assertion builds.  Protect those  
places by checking for it explicitly until somebody decides to implement  
it.  
  
Reported-by: Alexey Borzov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copy.c
M src/backend/parser/parse_cte.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Fix _outConstraint() for "identity" constraints

commit   : e1878cf94134429bf951b41ed523363c2fa2d6b4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 08:17:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Aug 2022 08:17:30 +0200    

Click here for diff

The set of fields printed by _outConstraint() in the CONSTR_IDENTITY  
case didn't match the set of fields actually used in that case.  (The  
code was probably uncarefully copied from the CONSTR_DEFAULT case.)  
Fix that by using the right set of fields.  Since there is no read  
support for this node type, this is really just for debugging output  
right now, so it doesn't affect anything important.  

M src/backend/nodes/outfuncs.c

Back-Patch "Add wait_for_subscription_sync for TAP tests."

commit   : 15014b82320347981b7f25fdad0ccb08870337cb    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 12 Aug 2022 11:28:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 12 Aug 2022 11:28:54 +0530    

Click here for diff

This was originally done in commit 0c20dd33db for 16 only, to eliminate  
duplicate code and as an infrastructure that makes it easier to write  
future tests. However, it has been suggested that it would be good to  
back-patch this testing infrastructure to aid future tests in  
back-branches.  
  
Backpatch to all supported versions.  
  
Author: Masahiko Sawada  
Reviewed by: Amit Kapila, Shi yu  
Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/100_bugs.pl

Add missing space in _outA_Const() output

commit   : eeb1671b1195341df156c9b11a3c676000e1bcd1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Aug 2022 10:35:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Aug 2022 10:35:39 +0200    

Click here for diff

Mistake introduced by 639a86e36aaecb84faaf941dcd0b183ba0aba9e9.  

M src/backend/nodes/outfuncs.c

Fix catalog lookup with the wrong snapshot during logical decoding.

commit   : 272248a0c1b18a82c4266e0dc3b526d4d2637de3    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 11 Aug 2022 09:56:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 11 Aug 2022 09:56:49 +0530    

Click here for diff

Previously, we relied on HEAP2_NEW_CID records and XACT_INVALIDATION  
records to know if the transaction has modified the catalog, and that  
information is not serialized to snapshot. Therefore, after the restart,  
if the logical decoding decodes only the commit record of the transaction  
that has actually modified a catalog, we will miss adding its XID to the  
snapshot. Thus, we will end up looking at catalogs with the wrong  
snapshot.  
  
To fix this problem, this changes the snapshot builder so that it  
remembers the last-running-xacts list of the decoded RUNNING_XACTS record  
after restoring the previously serialized snapshot. Then, we mark the  
transaction as containing catalog changes if it's in the list of initial  
running transactions and its commit record has XACT_XINFO_HAS_INVALS. To  
avoid ABI breakage, we store the array of the initial running transactions  
in the static variables InitialRunningXacts and NInitialRunningXacts,  
instead of storing those in SnapBuild or ReorderBuffer.  
  
This approach has a false positive; we could end up adding the transaction  
that didn't change catalog to the snapshot since we cannot distinguish  
whether the transaction has catalog changes only by checking the COMMIT  
record. It doesn't have the information on which (sub) transaction has  
catalog changes, and XACT_XINFO_HAS_INVALS doesn't necessarily indicate  
that the transaction has catalog change. But that won't be a problem since  
we use snapshot built during decoding only to read system catalogs.  
  
On the master branch, we took a more future-proof approach by writing  
catalog modifying transactions to the serialized snapshot which avoids the  
above false positive. But we cannot backpatch it because of a change in  
the SnapBuild.  
  
Reported-by: Mike Oh  
Author: Masahiko Sawada  
Reviewed-by: Amit Kapila, Shi yu, Takamichi Osumi, Kyotaro Horiguchi, Bertrand Drouvot, Ahsan Hadi  
Backpatch-through: 10  
Discussion: https://postgr.es/m/81D0D8B0-E7C4-4999-B616-1E5004DBDCD2%40amazon.com  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/catalog_change_snapshot.out
A contrib/test_decoding/specs/catalog_change_snapshot.spec
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Move basebackup code to new directory src/backend/backup

commit   : f88798c098d2afd5223e1ca5c9d107cc18864fcc    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Aug 2022 14:03:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Aug 2022 14:03:09 -0400    

Click here for diff

Reviewed by David Steele and Justin Pryzby  
  
Discussion: http://postgr.es/m/CA+TgmoafqboATDSoXHz8VLrSwK_MDhjthK4hEpYjqf9_1Fmczw%40mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M src/backend/Makefile
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
A src/backend/backup/Makefile
R098 src/backend/replication/backup_manifest.c src/backend/backup/backup_manifest.c
R099 src/backend/replication/basebackup.c src/backend/backup/basebackup.c
R099 src/backend/replication/basebackup_copy.c src/backend/backup/basebackup_copy.c
R099 src/backend/replication/basebackup_gzip.c src/backend/backup/basebackup_gzip.c
R099 src/backend/replication/basebackup_lz4.c src/backend/backup/basebackup_lz4.c
R098 src/backend/replication/basebackup_progress.c src/backend/backup/basebackup_progress.c
R098 src/backend/replication/basebackup_server.c src/backend/backup/basebackup_server.c
R097 src/backend/replication/basebackup_sink.c src/backend/backup/basebackup_sink.c
R098 src/backend/replication/basebackup_target.c src/backend/backup/basebackup_target.c
R098 src/backend/replication/basebackup_throttle.c src/backend/backup/basebackup_throttle.c
R099 src/backend/replication/basebackup_zstd.c src/backend/backup/basebackup_zstd.c
M src/backend/replication/Makefile
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
R094 src/include/replication/backup_manifest.h src/include/backup/backup_manifest.h
R096 src/include/replication/basebackup.h src/include/backup/basebackup.h
R099 src/include/replication/basebackup_sink.h src/include/backup/basebackup_sink.h
R096 src/include/replication/basebackup_target.h src/include/backup/basebackup_target.h

Fix handling of R/W expanded datums that are passed to SQL functions.

commit   : ad3e07c156544f31d02e55e95ba7954ea87a2ee8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2022 13:37:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Aug 2022 13:37:25 -0400    

Click here for diff

fmgr_sql must make expanded-datum arguments read-only, because  
it's possible that the function body will pass the argument to  
more than one callee function.  If one of those functions takes  
the datum's R/W property as license to scribble on it, then later  
callees will see an unexpected value, leading to wrong answers.  
  
From a performance standpoint, it'd be nice to skip this in the  
common case that the argument value is passed to only one callee.  
However, detecting that seems fairly hard, and certainly not  
something that I care to attempt in a back-patched bug fix.  
  
Per report from Adam Mackler.  This has been broken since we  
invented expanded datums, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/functions.c
M src/test/regress/expected/create_function_sql.out
M src/test/regress/sql/create_function_sql.sql

Fix typo in test_oat_hooks README

commit   : df64c24a31e110327135a8590c4500887e4773ae    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Aug 2022 14:16:31 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 10 Aug 2022 14:16:31 +0200    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/README

Improve the protocol message descriptions for 2PC logical replication.

commit   : c5d67881d343a507269bde124a49df19e0296157    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 10 Aug 2022 16:30:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 10 Aug 2022 16:30:59 +0530    

Click here for diff

The messages were using 'two-phase transaction' at some places and  
'prepared transaction' at other places. Make them consistently use  
'prepared transaction'.  
  
Reported-by: Ekaterina Kiryanova  
Author: Peter Smith  
Reviewed by: Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml

doc: mention that COPY MATCH requires columns _in_ _order_

commit   : b876b7e2d12786b101ad178fae29cd6a3d9137e9    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2022 20:37:53 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 9 Aug 2022 20:37:53 -0400    

Click here for diff

Question asked at SCaLE conference.  
  
Reported-by: doc suggestion by Stephen Frost  
  
Backpatch-through: 15  

M doc/src/sgml/ref/copy.sgml

Stamp 15beta3.

commit   : 6778361e411195ec1f6919604e607351cc1fda89    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 16:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 16:42:02 -0400    

Click here for diff

M configure
M configure.ac

Stabilize output of new regression test.

commit   : 2a4d82aadf8c3c2cf7f586c6ba2766f9bd2ba657    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 12:16:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 12:16:01 -0400    

Click here for diff

Per buildfarm, the output order of \dx+ isn't consistent across  
locales.  Apply NO_LOCALE to force C locale.  There might be a  
more localized way, but I'm not seeing it offhand, and anyway  
there is nothing in this test module that particularly cares  
about locales.  
  
Security: CVE-2022-2625  

M src/test/modules/test_extensions/Makefile

In extensions, don't replace objects not belonging to the extension.

commit   : cc7e0feba51b4aeb0adf9bdac659f83e9986b90d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 11:12:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Aug 2022 11:12:31 -0400    

Click here for diff

Previously, if an extension script did CREATE OR REPLACE and there was  
an existing object not belonging to the extension, it would overwrite  
the object and adopt it into the extension.  This is problematic, first  
because the overwrite is probably unintentional, and second because we  
didn't change the object's ownership.  Thus a hostile user could create  
an object in advance of an expected CREATE EXTENSION command, and would  
then have ownership rights on an extension object, which could be  
modified for trojan-horse-type attacks.  
  
Hence, forbid CREATE OR REPLACE of an existing object unless it already  
belongs to the extension.  (Note that we've always forbidden replacing  
an object that belongs to some other extension; only the behavior for  
previously-free-standing objects changes here.)  
  
For the same reason, also fail CREATE IF NOT EXISTS when there is  
an existing object that doesn't belong to the extension.  
  
Our thanks to Sven Klemm for reporting this problem.  
  
Security: CVE-2022-2625  

M doc/src/sgml/extend.sgml
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/commands/createas.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/view.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/dependency.h
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_cine–1.0–1.1.sql
A src/test/modules/test_extensions/test_ext_cine–1.0.sql
A src/test/modules/test_extensions/test_ext_cine.control
A src/test/modules/test_extensions/test_ext_cor–1.0.sql
A src/test/modules/test_extensions/test_ext_cor.control

Translation updates

commit   : 7fb82889a37fc6484b71bafd6473f21470f1d3aa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 8 Aug 2022 12:39:52 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 8 Aug 2022 12:39:52 +0200    

Click here for diff

Source-Git-URL: ssh://[email protected]/pgtranslation/messages.git  
Source-Git-Hash: 32d3177724e332eac673a46449d46a4ee8670147  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/ja.po
M src/backend/po/sv.po
M src/bin/initdb/nls.mk
M src/bin/initdb/po/es.po
M src/bin/initdb/po/ja.po
A src/bin/initdb/po/ka.po
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/ka.po
M src/bin/pg_archivecleanup/nls.mk
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/ja.po
A src/bin/pg_archivecleanup/po/ka.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_checksums/nls.mk
M src/bin/pg_checksums/po/ja.po
A src/bin/pg_checksums/po/ka.po
M src/bin/pg_config/nls.mk
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/ja.po
A src/bin/pg_config/po/ka.po
M src/bin/pg_controldata/nls.mk
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/ja.po
A src/bin/pg_controldata/po/ka.po
M src/bin/pg_ctl/nls.mk
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/ja.po
A src/bin/pg_ctl/po/ka.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/ja.po
A src/bin/pg_resetwal/po/ka.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/ja.po
A src/bin/pg_rewind/po/ka.po
M src/bin/pg_test_fsync/nls.mk
M src/bin/pg_test_fsync/po/ja.po
A src/bin/pg_test_fsync/po/ka.po
M src/bin/pg_test_timing/nls.mk
M src/bin/pg_test_timing/po/es.po
M src/bin/pg_test_timing/po/ja.po
A src/bin/pg_test_timing/po/ka.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_verifybackup/nls.mk
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/ja.po
A src/bin/pg_verifybackup/po/ka.po
M src/bin/pg_waldump/nls.mk
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/ja.po
A src/bin/pg_waldump/po/ka.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/nls.mk
M src/bin/psql/po/de.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ja.po
A src/bin/psql/po/ka.po
M src/bin/psql/po/sv.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/es.po
M src/bin/scripts/po/ja.po
A src/bin/scripts/po/ka.po
M src/interfaces/ecpg/ecpglib/nls.mk
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/ja.po
A src/interfaces/ecpg/ecpglib/po/ka.po
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/ja.po
A src/interfaces/ecpg/preproc/po/ka.po
M src/interfaces/libpq/nls.mk
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ja.po
A src/interfaces/libpq/po/ka.po
M src/interfaces/libpq/po/sv.po
M src/pl/plperl/nls.mk
M src/pl/plperl/po/es.po
M src/pl/plperl/po/ja.po
A src/pl/plperl/po/ka.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/ja.po
M src/pl/plpython/nls.mk
M src/pl/plpython/po/es.po
A src/pl/plpython/po/ka.po
M src/pl/tcl/nls.mk
M src/pl/tcl/po/es.po
M src/pl/tcl/po/ja.po
A src/pl/tcl/po/ka.po

Doc: remove in-place tablespaces from v15 release notes.

commit   : 501851dea2d57e3fa1bcadb1d18a1a77bf77ec9e    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2022 15:53:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Aug 2022 15:53:34 -0400    

Click here for diff

Now that these have been back-patched, they're no longer a new  
feature for v15.  

M doc/src/sgml/release-15.sgml

Remove unportable use of timezone in recent test

commit   : 9c3006000791ef3629b93864453a0609b282e79e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 7 Aug 2022 10:19:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 7 Aug 2022 10:19:40 +0200    

Click here for diff

Per buildfarm member snapper  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/brin/t/02_wal_consistency.pl

Fix data-corruption hazard in WAL-logged CREATE DATABASE.

commit   : 811203d4aff505c414e4a9e8c57ea6bb3edfe92e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 11:50:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Aug 2022 11:50:23 -0400    

Click here for diff

RelationCopyStorageUsingBuffer thought it could skip copying  
empty pages, but of course that does not work at all, because  
subsequent blocks will be out of place.  
  
Also fix it to acquire share lock on the source buffer.  It *might*  
be safe to not do that, but it's not very certain, and I don't think  
this code deserves any benefit of the doubt.  
  
Dilip Kumar, per complaint from me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c

Improve recently-added test reliability

commit   : 6390bc740f902557cad40106708a5d40c6e3389e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 6 Aug 2022 15:52:10 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 6 Aug 2022 15:52:10 +0200    

Click here for diff

Commit 59be1c942a47 already tried to make  
src/test/recovery/t/033_replay_tsp_drops more reliable, but it wasn't  
enough.  Try to improve on that by making this use of a replication slot  
to be more like others.  Also, don't drop the slot.  
  
Make a few other stylistic changes while at it.  It's still quite slow,  
which is another thing that we need to fix in this script.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/033_replay_tsp_drops.pl

Partially undo commit 94da73281.

commit   : 6303df08f0c4961c4e13b8e2aefab2dc1be7cd2d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:57:46 -0400    

Click here for diff

On closer inspection, mcv.c isn't as broken for ScalarArrayOpExpr  
as I thought.  The Var-on-right issue is real enough, but actually  
it does cope fine with a NULL array constant --- I was misled by  
an XXX comment suggesting it didn't.  Undo that part of the code  
change, and replace the XXX comment with something less misleading.  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c

Fix handling of bare boolean expressions in mcv_get_match_bitmap.

commit   : 43f76fb1944ea5219856819535e2386362ccad49    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:00:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 15:00:03 -0400    

Click here for diff

Since v14, the extended stats machinery will try to estimate for  
otherwise-unsupported boolean expressions if they match an expression  
available from an extended stats object.  mcv.c did not get the memo  
about this, and would spit up with "unknown clause type".  Fortunately  
the case is easy to handle, since we can expect the expression yields  
boolean.  
  
While here, replace some not-terribly-on-point assertions with  
simpler runtime tests for lookup failure.  That seems appropriate  
so that we get an elog not a crash if we somehow get to the new  
it-should-be-a-bool-expression code with a subexpression that  
doesn't match any stats column.  
  
Per report from Danny Shemesh.  Thanks to Justin Pryzby for  
preliminary investigation.  
  
Discussion: https://postgr.es/m/CAFZC=QqD6=27wQPOW1pbRa98KPyuyn+7cL_Ay_Ck-roZV84vHg@mail.gmail.com  

M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix non-bulletproof ScalarArrayOpExpr code for extended statistics.

commit   : b6d147bcbbf29b7f422f7185192eb57593f3cfc7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 13:58:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 13:58:37 -0400    

Click here for diff

statext_is_compatible_clause_internal() checked that the arguments  
of a ScalarArrayOpExpr are one Var and one Const, but it would allow  
cases where the Const was on the left.  Subsequent uses of the clause  
are not expecting that and would suffer assertion failures or core  
dumps.  mcv.c also had not bothered to cope with the case of a NULL  
array constant, which seems really unacceptably sloppy of somebody.  
(Although our tools failed us there too, since AFAIK neither Coverity  
nor any compiler warned of the obvious use-of-uninitialized-variable  
condition.)  It seems best to handle that by having  
statext_is_compatible_clause_internal() reject it.  
  
Noted while fixing bug #17570.  Back-patch to v13 where the  
extended stats code grew some awareness of ScalarArrayOpExpr.  

M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Backpatch addition of .git-blame-ignore-revs

commit   : 261f1a4372885581fb3fec509329f460b6a35211    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 19:36:24 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 19:36:24 +0200    

Click here for diff

This makes it more convenient for git config to contain the  
blame.ignoreRevsFile setting; otherwise current git versions complain if  
the file is not present.  
  
I constructed the file for each branch by scraping the file in branch  
master for commits that appear in that branch.  Because a few additional  
pgindent commits have been added to the list in master since the list  
was first created, this also propagates those to branches 14 and 15  
where the file already existed.  Also, some entries appear to have been  
made using author-date rather than committer-date in the format string,  
so some timestamps are changed.  Also remove bogus whitespace in the  
suggested `git log` format string.  
  
Backpatch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M .git-blame-ignore-revs

Fix incorrect permissions-checking code for extended statistics.

commit   : 7394028beafb909204510570a0790376fe66ad94    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 12:46:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Aug 2022 12:46:34 -0400    

Click here for diff

Commit a4d75c86b improved the extended-stats logic to allow extended  
stats to be collected on expressions not just bare Vars.  To apply  
such stats, we first verify that the user has permissions to read all  
columns used in the stats.  (If not, the query will likely fail at  
runtime, but the planner ought not do so.)  That had to get extended  
to check permissions of columns appearing within such expressions,  
but the code for that was completely wrong: it applied pull_varattnos  
to the wrong pointer, leading to "unrecognized node type" failures.  
Furthermore, although you couldn't get to this because of that bug,  
it failed to account for the attnum offset applied by pull_varattnos.  
  
This escaped recognition so far because the code in question is not  
reached when the user has whole-table SELECT privilege (which is the  
common case), and because only subexpressions not specially handled  
by statext_is_compatible_clause_internal() are at risk.  
  
I think a large part of the reason for this bug is under-documentation  
of what statext_is_compatible_clause() is doing and what its arguments  
are, so do some work on the comments to try to improve that.  
  
Per bug #17570 from Alexander Kozhemyakin.  Patch by Richard Guo;  
comments and other cosmetic improvements by me.  (Thanks also to  
Japin Li for diagnosis.)  Back-patch to v14 where the bug came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

BRIN: mask BRIN_EVACUATE_PAGE for WAL consistency checking

commit   : 2cff3025906c657297ef7bf323fa715f81d20038    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 18:00:17 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 18:00:17 +0200    

Click here for diff

That bit is unlogged and therefore it's wrong to consider it in WAL page  
comparison.  
  
Add a test that tickles the case, as branch testing technology allows.  
  
This has been a problem ever since wal consistency checking was  
introduced (commit a507b86900f6 for pg10), so backpatch to all supported  
branches.  
  
Author: 王海洋 (Haiyang Wang) <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CACciXAD2UvLMOhc4jX9VvOKt7DtYLr3OYRBhvOZ-jRxtzc_7Jg@mail.gmail.com  
Discussion: https://postgr.es/m/CACciXADOfErX9Bx0nzE_SkdfXr6Bbpo5R=v_B6MUTEYW4ya+cg@mail.gmail.com  

M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_xlog.c
M src/test/modules/brin/Makefile
A src/test/modules/brin/t/02_wal_consistency.pl

regress: fix test instability

commit   : aa242501afb76d6806260bff3bc8494e0a7f2a69    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 11:55:52 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Aug 2022 11:55:52 +0200    

Click here for diff

Having additional triggers in a test table made the ORDER BY clauses in  
old queries underspecified.  Add another column there for stability.  
  
Per sporadic buildfarm pink.  

M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

postgres_fdw: Disable batch insertion when there are WCO constraints.

commit   : 1d49db259884a4e5579e63c05f1743608caa97b5    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 5 Aug 2022 17:15:01 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 5 Aug 2022 17:15:01 +0900    

Click here for diff

When inserting a view referencing a foreign table that has WITH CHECK  
OPTION constraints, in single-insert mode postgres_fdw retrieves the  
data that was actually inserted on the remote side so that the WITH  
CHECK OPTION constraints are enforced with the data locally, but in  
batch-insert mode it cannot currently retrieve the data (except for the  
row first inserted through the view), resulting in enforcing the WITH  
CHECK OPTION constraints with the data passed from the core (except for  
the first-inserted row), which led to incorrect results when inserting  
into a view referencing a foreign table in which a remote BEFORE ROW  
INSERT trigger changes the rows inserted through the view so that they  
violate the view's WITH CHECK OPTION constraint.  Also, the query  
inserting into the view caused an assertion failure in assert-enabled  
builds.  
  
Fix these by disabling batch insertion when inserting into such a view.  
  
Back-patch to v14 where batch insertion was added.  
  
Discussion: https://postgr.es/m/CAPmGK17LpbTZs4m4a_6THP54UBeK9fHvX8aVVA%2BC6yEZDZwQcg%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix ENABLE/DISABLE TRIGGER to handle recursion correctly

commit   : e78fd9084587cd485fdec3eb3eaeef567e1707d5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Aug 2022 20:02:02 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Aug 2022 20:02:02 +0200    

Click here for diff

Using ATSimpleRecursion() in ATPrepCmd() to do so as bbb927b4db9b did is  
not correct, because ATPrepCmd() can't distinguish between triggers that  
may be cloned and those that may not, so would wrongly try to recurse  
for the latter category of triggers.  
  
So this commit restores the code in EnableDisableTrigger() that  
86f575948c77 had added to do the recursion, which would do it only for  
triggers that may be cloned, that is, row-level triggers.  This also  
changes tablecmds.c such that ATExecCmd() is able to pass the value of  
ONLY flag down to EnableDisableTrigger() using its new 'recurse'  
parameter.  
  
This also fixes what seems like an oversight of 86f575948c77 that the  
recursion to partition triggers would only occur if EnableDisableTrigger()  
had actually changed the trigger.  It is more apt to recurse to inspect  
partition triggers even if the parent's trigger didn't need to be  
changed: only then can we be certain that all descendants share the same  
state afterwards.  
  
Backpatch all the way back to 11, like bbb927b4db9b.  Care is taken not  
to break ABI compatibility (and that no catversion bump is needed.)  
  
Co-authored-by: Amit Langote <[email protected]>  
Reviewed-by: Dmitry Koval <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqG-cZT3XzGAnEgZQLoQbyfJApVwOTQaCaas1mhpf+4V5A@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/include/commands/trigger.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Fix failure to set correct operator in window run condition

commit   : 270eb4b5d4986534f2d522ebb19f67396d13cf44    
  
author   : David Rowley <[email protected]>    
date     : Fri, 5 Aug 2022 10:14:40 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 5 Aug 2022 10:14:40 +1200    

Click here for diff

This was a simple omission in 9d9c02ccd where the code didn't correctly  
set the operator to use in the run condition OpExpr when the window  
function was both monotonically increasing and decreasing.  
  
Bug discovered by Julien Roze, although he did not report it.  
  
Reported-by: Phil Florent  
Discussion: https://postgr.es/m/PA4P191MB160009A09B9D0624359278CFBA9F9@PA4P191MB1600.EURP191.PROD.OUTLOOK.COM  
Backpatch-through: 15, where 9d9c02ccd was added  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Revert recent changes to 002_pg_upgrade.pl.

commit   : 6f7e7d0c482dd3c635f0de8e77fe6f783e43a078    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 4 Aug 2022 15:17:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 4 Aug 2022 15:17:14 -0400    

Click here for diff

The test is proving to be unreliable in the buildfarm, and we neither  
agree on how best to fix it nor have time to do so before the upcoming  
release. So for now, put things back to the way they were before commit  
d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix check_exclusion_or_unique_constraint for UNIQUE NULLS NOT DISTINCT.

commit   : 3419d51e1957855f527b94ae983fe8503aafe15c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:16:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:16:26 -0400    

Click here for diff

Adjusting this function was overlooked in commit 94aa7cc5f.  The only  
visible symptom (so far) is that INSERT ... ON CONFLICT could go into  
an endless loop when inserting a null that has a conflict.  
  
Richard Guo and Tom Lane, per bug #17558 from Andrew Kesper  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execIndexing.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Add CHECK_FOR_INTERRUPTS in ExecInsert's speculative insertion loop.

commit   : 4c7b16312ea3381b04a412c91f1e882cd928806e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:10:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 14:10:06 -0400    

Click here for diff

Ordinarily the functions called in this loop ought to have plenty  
of CFIs themselves; but we've now seen a case where no such CFI is  
reached, making the loop uninterruptible.  Even though that's from  
a recently-introduced bug, it seems prudent to install a CFI at  
the loop level in all branches.  
  
Per discussion of bug #17558 from Andrew Kesper (an actual fix for  
that bug will follow).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Add proper regression test for the recent SRFs-in-pathkeys problem.

commit   : 11e7d626cee43cf1eb5dd214ef001dfba38ea2a3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 11:11:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Aug 2022 11:11:22 -0400    

Click here for diff

Remove the test case added by commit fac1b470a, which never actually  
worked to expose the problem it claimed to test.  Replace it with  
a case that does expose the problem, and also covers the SRF-not-  
at-the-top deficiency repaired in 1aa8dad41.  
  
Richard Guo, with some editorialization by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/incremental_sort.sql
M src/test/regress/sql/select_parallel.sql

Fix assorted doc typos

commit   : b25566ab3c6536040df4df3ad99dd69c812215d9    
  
author   : John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:59:32 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:59:32 +0700    

Click here for diff

Erik Rijkers and Justin Pryzby  
  
Backpatch to v14  
  
Discussion: https://www.postgresql.org/message-id/b79bfeff-d0e3-29a3-2576-0e325848dede%40xs4all.nl  

M doc/src/sgml/brin.sgml
M doc/src/sgml/ref/drop_extension.sgml

Clarify DROP EXTENSION docs regarding explicitly dependent routines

commit   : 0436f34d406a782451b1087a117f66eb72ea8ef8    
  
author   : John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:29:25 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 4 Aug 2022 15:29:25 +0700    

Click here for diff

Per suggestion from Robert Haas  
  
Backpatch to v14  
  
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZ1QvHquYHLkMy1oHKqz4-E7QQctj6e0ocq_GP1B5%2B9bA%40mail.gmail.com  

M doc/src/sgml/ref/drop_extension.sgml

Fix incorrect tests for SRFs in relation_can_be_sorted_early().

commit   : 14168d57bb91e889ff03b3098f67299608289573    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 17:33:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 17:33:42 -0400    

Click here for diff

Commit fac1b470a thought we could check for set-returning functions  
by testing only the top-level node in an expression tree.  This is  
wrong in itself, and to make matters worse it encouraged others  
to make the same mistake, by exporting tlist.c's special-purpose  
IS_SRF_CALL() as a widely-visible macro.  I can't find any evidence  
that anyone's taken the bait, but it was only a matter of time.  
  
Use expression_returns_set() instead, and stuff the IS_SRF_CALL()  
genie back in its bottle, this time with a warning label.  I also  
added a couple of cross-reference comments.  
  
After a fair amount of fooling around, I've despaired of making  
a robust test case that exposes the bug reliably, so no test case  
here.  (Note that the test case added by fac1b470a is itself  
broken, in that it doesn't notice if you remove the code change.  
The repro given by the bug submitter currently doesn't fail either  
in v15 or HEAD, though I suspect that may indicate an unrelated bug.)  
  
Per bug #17564 from Martijn van Oosterhout.  Back-patch to v13,  
as the faulty patch was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/optimizer.h

Reduce test runtime of src/test/modules/snapshot_too_old.

commit   : c628ca3500aff8fd34949102af9a56586e7c3a34    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 11:14:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 3 Aug 2022 11:14:55 -0400    

Click here for diff

The sto_using_cursor and sto_using_select tests were coded to exercise  
every permutation of their test steps, but AFAICS there is no value in  
exercising more than one.  This matters because each permutation costs  
about six seconds, thanks to the "pg_sleep(6)".  Perhaps we could  
reduce that, but the useless permutations seem worth getting rid of  
in any case.  (Note that sto_using_hash_index got it right already.)  
  
While here, clean up some other sloppiness such as an unused table.  
  
This doesn't make too much difference in interactive testing, since the  
wasted time is typically masked by parallelization with other tests.  
However, the buildfarm runs this as a serial step, which means we can  
expect to shave ~40 seconds from every buildfarm run.  That makes it  
worth back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/snapshot_too_old/expected/sto_using_cursor.out
M src/test/modules/snapshot_too_old/expected/sto_using_select.out
M src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec
M src/test/modules/snapshot_too_old/specs/sto_using_select.spec

Be more wary about 32-bit integer overflow in pg_stat_statements.

commit   : 82ebc70d1c7fd9b301e15cec658696d28df01835    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 18:05:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 18:05:34 -0400    

Click here for diff

We've heard a couple of reports of people having trouble with  
multi-gigabyte-sized query-texts files.  It occurred to me that on  
32-bit platforms, there could be an issue with integer overflow  
of calculations associated with the total query text size.  
Address that with several changes:  
  
1. Limit pg_stat_statements.max to INT_MAX / 2 not INT_MAX.  
The hashtable code will bound it to that anyway unless "long"  
is 64 bits.  We still need overflow guards on its use, but  
this helps.  
  
2. Add a check to prevent extending the query-texts file to  
more than MaxAllocHugeSize.  If it got that big, qtext_load_file  
would certainly fail, so there's not much point in allowing it.  
Without this, we'd need to consider whether extent, query_offset,  
and related variables shouldn't be off_t not size_t.  
  
3. Adjust the comparisons in need_gc_qtexts() to be done in 64-bit  
arithmetic on all platforms.  It appears possible that under duress  
those multiplications could overflow 32 bits, yielding a false  
conclusion that we need to garbage-collect the texts file, which  
could lead to repeatedly garbage-collecting after every hash table  
insertion.  
  
Per report from Bruno da Silva.  I'm not convinced that these  
issues fully explain his problem; there may be some other bug that's  
contributing to the query-texts file becoming so large in the first  
place.  But it did get that big, so #2 is a reasonable defense,  
and #3 could explain the reported performance difficulties.  
  
(See also commit 8bbe4cbd9, which addressed some related bugs.  
The second Discussion: link is the thread that led up to that.)  
  
This issue is old, and is primarily a problem for old platforms,  
so back-patch.  
  
Discussion: https://postgr.es/m/CAB+Nuk93fL1Q9eLOCotvLP07g7RAv4vbdrkm0cVQohDVMpAb9A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c

Change type "char"'s I/O format for non-ASCII characters.

commit   : c034b629cc6f44099c9f54f3f0b3f4340e02d9bc    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 10:29:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Aug 2022 10:29:35 -0400    

Click here for diff

Previously, a byte with the high bit set was just transmitted  
as-is by charin() and charout().  This is problematic if the  
database encoding is multibyte, because the result of charout()  
won't be validly encoded, which breaks various stuff that  
expects all text strings to be validly encoded.  We've  
previously decided to enforce encoding validity rather than try  
to individually harden each place that might have a problem with  
such strings, so it's time to do something about "char".  
  
To fix, represent high-bit-set characters as \ooo (backslash  
and three octal digits), following the ancient "escape" format  
for bytea.  charin() will continue to accept the old way as well,  
though that is only reachable in single-byte encodings.  
  
Add some test cases just so there is coverage for this code.  
We'll otherwise leave this question undocumented as it was before,  
because we don't really want to encourage end-user use of "char".  
  
For the moment, back-patch into v15 so that this change appears  
in 15beta3.  If there's not great pushback we should consider  
absorbing this change into the older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/char.c
M src/test/regress/expected/char.out
M src/test/regress/expected/char_1.out
M src/test/regress/expected/char_2.out
M src/test/regress/sql/char.sql

doc: Fix typos in protocol.sgml

commit   : 5b94d3ccb7ad9be902c37505ed54aabd2aeeccf1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Aug 2022 19:56:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Aug 2022 19:56:06 +0900    

Click here for diff

Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml

Remove duplicated wait for subscription sync from 007_ddl.pl.

commit   : 572baf2b3e203db1f9d15a796bb9a23e81986828    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 09:20:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Aug 2022 09:20:38 +0530    

Click here for diff

An oversight in 8f2e2bbf14.  
  
Author: Masahiko Sawada  
Reviewed by: Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com  

M src/test/subscription/t/007_ddl.pl

Check maximum number of columns in function RTEs, too.

commit   : adc3ae6eb313360800b4b97d3557a175269a240e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 12:22:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Aug 2022 12:22:35 -0400    

Click here for diff

I thought commit fd96d14d9 had plugged all the holes of this sort,  
but no, function RTEs could produce oversize tuples too, either  
via long coldeflists or just from multiple functions in one RTE.  
(I'm pretty sure the other variants of base RTEs aren't a problem,  
because they ultimately refer to either a table or a sub-SELECT,  
whose widths are enforced elsewhere.  But we explicitly allow join  
RTEs to be overwidth, as long as you don't try to form their  
tuple result.)  
  
Per further discussion of bug #17561.  As before, patch all branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c

Fix error reporting after ioctl() call with pg_upgrade --clone

commit   : 07abcd9ab712b843568e2f9a00006dd25797dc02    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 16:39:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Aug 2022 16:39:16 +0900    

Click here for diff

errno was not reported correctly after attempting to clone a file,  
leading to incorrect error reports.  While scanning through the code, I  
have not noticed any similar mistakes.  
  
Error introduced in 3a769d8.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/pg_upgrade/file.c

ci: remove minor version from freebsd image name

commit   : feae5c0cba8088fb85d9365348e59047d1c2919a    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 17:40:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 17:40:42 -0700    

Click here for diff

This way .cirrus.yml does not need to be changed just because freebsd releases  
a new minor version.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, just like the CI support  

M .cirrus.yml

Remove test_oat_hooks.c's nodetag_to_string().

commit   : 6e37312a2a595b7f75e1190b2d15e88d54b366a7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 16:58:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 16:58:20 -0400    

Click here for diff

In the short time this function has existed, it's already proven to be  
a nontrivial maintenance burden, since it has to be updated whenever a  
node tag is added or removed.  Although in principle we could now  
automate that, I see little justification for having such functionality  
here at all.  The function is only being applied to utility statements,  
for which we already have infrastructure for obtaining string names.  
Moreover, that infrastructure produces already-familiar-to-users names,  
unlike nodetag_to_string().  
  
So, remove this function and use the existing infrastructure instead.  
That saves over a thousand lines of largely-unreachable code.  
  
Back-patch to v15 where this code came in.  Although it seems unlikely  
that v15's nodetag list will change anymore, we might as well keep the  
two branches looking and acting alike; otherwise back-patching any  
test-results changes in this area will be painful.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/test_oat_hooks.c

ci: switch to freebsd 13.1

commit   : 9c9fc20e6fdf34d480b55bd517487b0affbf18e0    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 12:31:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 31 Jul 2022 12:31:40 -0700    

Click here for diff

freebsd 13.0 is out of support, switch to 13.1. It might be a good idea to  
remove the minor version number from the image name, but there's not been a  
response to that so far...  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, just like the CI support  

M .cirrus.yml

Fix trim_array() for zero-dimensional array argument.

commit   : d386b75df553b11ba20707b2f0a74215bb9c120b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 13:43:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 13:43:17 -0400    

Click here for diff

The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0]  
whether or not those values exist.  This made the range check  
on the "n" argument unstable --- it might or might not fail, and  
if it did it would report garbage for the allowed upper limit.  
These bogus accesses would probably annoy Valgrind, and if you  
were very unlucky even lead to SIGSEGV.  
  
Report and fix by Martin Kalcher.  Back-patch to v14 where this  
function was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/arrayfuncs.c
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Make new auto_explain test safe for log_error_verbosity = verbose.

commit   : e65f94982ed32d87daf53fb4d4067b2fe4a4df90    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 12:29:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Jul 2022 12:29:44 -0400    

Click here for diff

Allow for the possible presence of a SQLSTATE code in the expected  
warning message, similarly to b998196bb and 19408aae7 (although  
here I see no need to allow more than one specific SQLSTATE).  
Per gripe from Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl

Fix incorrect is-this-the-topmost-join tests in parallel planning.

commit   : a3699c599ced03ace09646b74b8299d8f570ca76    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 13:05:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Jul 2022 13:05:15 -0400    

Click here for diff

Two callers of generate_useful_gather_paths were testing the wrong  
thing when deciding whether to call that function: they checked for  
being at the top of the current join subproblem, rather than being at  
the actual top join.  This'd result in failing to construct parallel  
paths for a sub-join for which they might be useful.  
  
While set_rel_pathlist() isn't actively broken, it seems best to  
make its identical-in-intention test for this be like the other two.  
  
This has been wrong all along, but given the lack of field complaints  
I'm hesitant to back-patch into stable branches; we usually prefer  
to avoid non-bug-fix changes in plan choices in minor releases.  
It seems not too late for v15 though.  
  
Richard Guo, reviewed by Antonin Houska and Tom Lane  
  
Discussion: https://postgr.es/m/CAMbWs4-mH8Zf87-w+3P2J=nJB+5OyicO28ia9q_9o=Lamf_VHg@mail.gmail.com  

M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c

Revise test case added in 43746996399541ecb5c7b188725a5f097c15ceae.

commit   : d92f2bc0dae35747387f006519a74d3058a6bcb8    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 23:24:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 23:24:39 -0400    

Click here for diff

Instead of using command_ok() to run psql, use safe_psql(). wrasse  
isn't happy, and it be because of failure to pass -X to the psql  
invocation, which safe_psql() will do automatically.  
  
Since safe_psql() returns standard output instead of writing it to  
a file, this requires some changes to the incantation for running  
'diff'.  
  
Test against the 'regression' database rather than 'postgres' so  
we test more than just one table. That also means we need to record  
the horizons later, after the test does "VACUUM FULL pg_largeobject".  
  
Add an ORDER BY clause to the horizon query for stability.  
  
Patch by me, reviewed by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmoaGBbpzgu3=du1f9zDUbkfycO0y=_uWrLFy=KKEqXWeLQ@mail.gmail.com  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix new recovery test for log_error_verbosity=verbose case

commit   : 2eb3f167f991d4e37b101c56de4e449f63b7a637    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Jul 2022 17:43:34 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Jul 2022 17:43:34 -0400    

Click here for diff

The new test is from commit 9e4f914b5e.  
  
With this setting messages have SQL error numbers included, so that  
needs to be provided for in the pattern looked for.  
  
Backpatch to all live branches like the original.  

M src/test/recovery/t/033_replay_tsp_drops.pl

Fix brown paper bag bug in bbe08b8869bd29d587f24ef18eb45c7d4d14afca.

commit   : 5c9ea19b79d0a65f1fb21e87995ae32e1b10de8a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 16:31:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 16:31:57 -0400    

Click here for diff

We must issue the TRUNCATE command first and update relfrozenxid  
and relminmxid afterward; otherwise, TRUNCATE overwrites the  
previously-set values.  
  
Add a test case like I should have done the first time.  
  
Per buildfarm report from TestUpgradeXversion.pm, by way of Tom  
Lane.  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

In transformRowExpr(), check for too many columns in the row.

commit   : e6e804aa2726e720971393d7f598cea3c924e7f7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 13:30:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Jul 2022 13:30:50 -0400    

Click here for diff

A RowExpr with more than MaxTupleAttributeNumber columns would fail at  
execution anyway, since we cannot form a tuple datum with more than that  
many columns.  While heap_form_tuple() has a check for too many columns,  
it emerges that there are some intermediate bits of code that don't  
check and can be driven to failure with sufficiently many columns.  
Checking this at parse time seems like the most appropriate place to  
install a defense, since we already check SELECT list length there.  
  
While at it, make the SELECT-list-length error use the same errcode  
(TOO_MANY_COLUMNS) as heap_form_tuple does, rather than the generic  
PROGRAM_LIMIT_EXCEEDED.  
  
Per bug #17561 from Egor Chindyaskin.  The given test case crashes  
in all supported branches (and probably a lot further back),  
so patch all.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c

Fix mistake in bbe08b8869bd29d587f24ef18eb45c7d4d14afca.

commit   : 665ca54c551c27ec77f133cd72fbc0f7be7aa845    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 11:20:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Jul 2022 11:20:07 -0400    

Click here for diff

The earlier commit used pg_class.relfilenode where it should have  
used pg_class.oid. This could lead to emitting an UPDATE statement  
into the dump that would update nothing (or the wrong thing) when  
executed in the new cluster, resulting in relfrozenxid and  
relminmxid being improperly carried forward for pg_largeobject.  
  
Noticed by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CAFiTN-ty1Gzs6stk2vt9BJiq0m0hzf=aPnh3a-4Z3Tk5GzoENw@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c

Fix test instability

commit   : 798d64488ca91df3382fa195bf9f0f772995bdf4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jul 2022 12:50:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 29 Jul 2022 12:50:47 +0200    

Click here for diff

On FreeBSD, the new test fails due to a WAL file being removed before  
the standby has had the chance to copy it.  Fix by adding a replication  
slot to prevent the removal until after the standby has connected.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAEze2Wj5nau_qpjbwihvmXLfkAWOZ5TKdbnqOc6nKSiRJEoPyQ@mail.gmail.com  

M src/test/recovery/t/033_replay_tsp_drops.pl

Use TRUNCATE to preserve relfilenode for pg_largeobject + index.

commit   : 4ab5dae9472c5c6ada5f5627ec0e0f9f965ade28    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 15:32:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 28 Jul 2022 15:32:24 -0400    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged to preserve  
the relfilenode of user tables across pg_upgrade, but failed to notice  
that pg_upgrade treats pg_largeobject as a user table and thus it needs  
the same treatment. Otherwise, large objects will appear to vanish  
after a  pg_upgrade.  
  
Commit d498e052b4b84ae21b3b68d5b3fda6ead65d1d4d fixed this problem  
by teaching pg_dump to UPDATE pg_class.relfilenode for pg_largeobject  
and its index. However, because an UPDATE on the catalog rows doesn't  
change anything on disk, this can leave stray files behind in the new  
cluster. They will normally be empty, but it's a little bit untidy.  
  
Hence, this commit arranges to do the same thing using DDL. Specifically,  
it makes TRUNCATE work for the pg_largeobject catalog when in  
binary-upgrade mode, and it then uses that command in binary-upgrade  
dumps as a way of setting pg_class.relfilenode for pg_largeobject and  
its index. That way, the old files are removed from the new cluster.  
  
Discussion: http://postgr.es/m/CA+TgmoYYMXGUJO5GZk1-MByJGu_bB8CbOL6GJQC8=Bzt6x6vDg@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/storage/smgr/md.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c

doc: avoid saying "inheritance" ...

commit   : 02e5c273a2dc9e4c2c59d05a030e74552f897210    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 18:21:56 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 18:21:56 +0200    

Click here for diff

... when it applies to partitioned relations.  This is almost the  
opposite of 0c06534bd63b, which removed references to "partition" in  
favour of "child".  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/system-views.sgml

Fix replay of create database records on standby

commit   : 8348413dbded3c5880cf64e6a51d2a362c93ded4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 08:26:05 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 28 Jul 2022 08:26:05 +0200    

Click here for diff

Crash recovery on standby may encounter missing directories  
when replaying database-creation WAL records.  Prior to this  
patch, the standby would fail to recover in such a case;  
however, the directories could be legitimately missing.  
Consider the following sequence of commands:  
  
    CREATE DATABASE  
    DROP DATABASE  
    DROP TABLESPACE  
  
If, after replaying the last WAL record and removing the  
tablespace directory, the standby crashes and has to replay the  
create database record again, crash recovery must be able to continue.  
  
A fix for this problem was already attempted in 49d9cfc68bf4, but it  
was reverted because of design issues.  This new version is based  
on Robert Haas' proposal: any missing tablespaces are created  
during recovery before reaching consistency.  Tablespaces  
are created as real directories, and should be deleted  
by later replay.  CheckRecoveryConsistency ensures  
they have disappeared.  
  
The problems detected by this new code are reported as PANIC,  
except when allow_in_place_tablespaces is set to ON, in which  
case they are WARNING.  Apart from making tests possible, this  
gives users an escape hatch in case things don't go as planned.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Asim R Praveen <[email protected]>  
Author: Paul Guo <[email protected]>  
Reviewed-by: Anastasia Lubennikova <[email protected]> (older versions)  
Reviewed-by: Fujii Masao <[email protected]> (older versions)  
Reviewed-by: Michaël Paquier <[email protected]>  
Diagnosed-by: Paul Guo <[email protected]>  
Discussion: https://postgr.es/m/CAEET0ZGx9AvioViLf7nbR_8tH9-=27DN5xWJ2P9-ROH16e4JUA@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
A src/test/recovery/t/033_replay_tsp_drops.pl

commit   : fc4e5af30749eadc2acf98de426fa51910f8766b    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 28 Jul 2022 14:13:37 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 28 Jul 2022 14:13:37 +1200    

Click here for diff

On Windows with MSVC, get_dirent_type() was recently made to return  
DT_LNK for junction points by commit 9d3444dc, which fixed some  
defective dirent.c code.  
  
On Windows with Cygwin, get_dirent_type() already worked for symlinks,  
as it does on POSIX systems, because Cygwin has its own fake symlinks  
that behave like POSIX (on closer inspection, Cygwin's dirent has the  
BSD d_type extension but it's probably always DT_UNKNOWN, so we fall  
back to lstat(), which understands Cygwin symlinks with S_ISLNK()).  
  
On Windows with MinGW/MSYS, we need extra code, because the MinGW  
runtime has its own readdir() without d_type, and the lstat()-based  
fallback has no knowledge of our convention for treating junctions as  
symlinks.  
  
Back-patch to 14, where get_dirent_type() landed.  
  
Reported-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/b9ddf605-6b36-f90d-7c30-7b3e95c46276%40dunslane.net  

M src/common/file_utils.c

Fix new auto_explain test case for Windows.

commit   : 1d01d198536f24995f2d5271f55c73be644438fc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 18:58:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 27 Jul 2022 18:58:20 -0400    

Click here for diff

In commit 7c34555f8, I overlooked the need to configure SSPI  
on Windows to allow login as the non-superuser role.  
Fix that by adding auth_extra/--create-role incantation  
(which, oddly enough, doesn't actually create the role).  
Per buildfarm.  
  
While here, upgrade the mechanism for temporarily setting  
$ENV{PGUSER}, as per recommendation from ilmari.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auto_explain/t/001_auto_explain.pl

Force immediate commit after CREATE DATABASE etc in extended protocol.

commit   : a0c632c1dea74de042110e204bd2dc634e87b7ea    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 13:07:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 26 Jul 2022 13:07:03 -0400    

Click here for diff

We have a few commands that "can't run in a transaction block",  
meaning that if they complete their processing but then we fail  
to COMMIT, we'll be left with inconsistent on-disk state.  
However, the existing defenses for this are only watertight for  
simple query protocol.  In extended protocol, we didn't commit  
until receiving a Sync message.  Since the client is allowed to  
issue another command instead of Sync, we're in trouble if that  
command fails or is an explicit ROLLBACK.  In any case, sitting  
in an inconsistent state while waiting for a client message  
that might not come seems pretty risky.  
  
This case wasn't reachable via libpq before we introduced pipeline  
mode, but it's always been an intended aspect of extended query  
protocol, and likely there are other clients that could reach it  
before.  
  
To fix, set a flag in PreventInTransactionBlock that tells  
exec_execute_message to force an immediate commit.  This seems  
to be the approach that does least damage to existing working  
cases while still preventing the undesirable outcomes.  
  
While here, add some documentation to protocol.sgml that explicitly  
says how to use pipelining.  That's latent in the existing docs if  
you know what to look for, but it's better to spell it out; and it  
provides a place to document this new behavior.  
  
Per bug #17434 from Yugo Nagata.  It's been wrong for ages,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/include/access/xact.h

Fix path reference when parsing pg_ident.conf for pg_ident_file_mappings

commit   : 7977ac1640a76416eb99c843ad06015bab884bf1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 15:57:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Jul 2022 15:57:33 +0900    

Click here for diff

Since a2c8499, HbaFileName (default pg_hba.conf) was getting used  
instead of IdentFileName (default pg_ident.conf) as the parent file to  
use as reference when parsing the contents of pg_ident.conf, with  
pg_ident.conf correctly opened, when feeding this information to  
pg_ident_file_mappings.  This had two consequences:  
- On an I/O error when reading pg_ident.conf, the user would get an  
ERROR message referring to pg_hba.conf and not pg_ident.conf.  
- When reading an external file with a relative path using '@' in  
pg_ident.conf, the directory used to look at the file to load would be  
the base directory of pg_hba.conf rather than the one of pg_ident.conf,  
leading to errors in pg_ident_file_mappings inconsistent with what gets  
loaded at startup when pg_ident.conf and pg_hba.conf are located in  
different directories.  
  
This error only impacted the SQL view pg_ident_file_mappings that uses a  
logic new to v15 to fill the view with the parsed information, not the  
code paths loading these authentication files at startup.  
  
Author: Julien Rouhaud  
Discussion: https://postgr.es/m/20220726050402.vsr6fmz7rsgpmdz3@jrouhaud  
Backpatch-through: 15  

M src/backend/utils/adt/hbafuncs.c

Add test for session_preload_libraries and parameter permissions checks.

commit   : e1bd4990b2b599b2de7ae531516660c86fbb910b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 15:45:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 15:45:24 -0400    

Click here for diff

We weren't exercising the session_preload_libraries option in any  
meaningful way.  auto_explain is a good testbed for doing so, since  
it's one of the primary use-cases for session_preload_libraries.  
Hence, adjust its TAP test to load the library via  
session_preload_libraries not shared_preload_libraries.  While at it,  
feed test-specific settings to the backend via PGOPTIONS rather than  
tediously rewriting postgresql.conf.  
  
Also, since auto_explain has some PGC_SUSET parameters, we can use it  
to provide a test case for the permissions-checking bug just fixed  
by commit b35617de3.  
  
Back-patch to v15 so that we have coverage for the permissions issue  
in that branch too.  To do that, I back-patched the refactoring  
recently done by commit 550bc0a6c.  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/CABwTF4VEpwTHhRQ+q5MiC5ucngN-whN-PdcKeufX7eLSoAfbZA@mail.gmail.com  

M contrib/auto_explain/t/001_auto_explain.pl

Process session_preload_libraries within InitPostgres's transaction.

commit   : 31ed3cf746a61538876c66a778ec8a372a3b4ffb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 10:27:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 25 Jul 2022 10:27:43 -0400    

Click here for diff

Previously we did this after InitPostgres, at a somewhat randomly chosen  
place within PostgresMain.  However, since commit a0ffa885e doing this  
outside a transaction can cause a crash, if we need to check permissions  
while replacing a placeholder GUC.  (Besides which, a preloaded library  
could itself want to do database access within _PG_init.)  
  
To avoid needing an additional transaction start/end in every session,  
move the process_session_preload_libraries call to within InitPostgres's  
transaction.  That requires teaching the code not to call it when  
InitPostgres is called from somewhere other than PostgresMain, since  
we don't want session_preload_libraries to affect background workers.  
The most future-proof solution here seems to be to add an additional  
flag parameter to InitPostgres; fortunately, we're not yet very worried  
about API stability for v15.  
  
Doing this also exposed the fact that we're currently honoring  
session_preload_libraries in walsenders, even those not connected to  
any database.  This seems, at minimum, a POLA violation: walsenders  
are not interactive sessions.  Let's stop doing that.  
  
(All these comments also apply to local_preload_libraries, of course.)  
  
Per report from Gurjeet Singh (thanks also to Nathan Bossart and Kyotaro  
Horiguchi for review).  Backpatch to v15 where a0ffa885e came in.  
  
Discussion: https://postgr.es/m/CABwTF4VEpwTHhRQ+q5MiC5ucngN-whN-PdcKeufX7eLSoAfbZA@mail.gmail.com  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Fix ReadRecentBuffer for local buffers.

commit   : 19f82323db6312e0f2c4483dab95189c7f110648    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Jul 2022 08:48:38 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Jul 2022 08:48:38 +0300    

Click here for diff

It incorrectly used GetBufferDescriptor instead of  
GetLocalBufferDescriptor, causing it to not find the correct buffer in  
most cases, and performing an out-of-bounds memory read in the corner  
case that temp_buffers > shared_buffers.  
  
It also bumped the usage-count on the buffer, even if it was  
previously pinned. That won't lead to crashes or incorrect results,  
but it's different from what the shared-buffer case does, and  
different from the usual code in LocalBufferAlloc. Fix that too, and  
make the code ordering match LocalBufferAlloc() more closely, so that  
it's easier to verify that it's doing the same thing.  
  
Currently, ReadRecentBuffer() is only used with non-temp relations, in  
WAL redo, so the broken code is currently dead code. However, it could  
be used by extensions.  
  
Backpatch-through: 14  
Discussion: https://www.postgresql.org/message-id/2d74b46f-27c9-fb31-7f99-327a87184cc0%40iki.fi  
Reviewed-by: Thomas Munro, Zhang Mingli, Richard Guo  

M src/backend/storage/buffer/bufmgr.c

Doc: improve documentation about random().

commit   : bd6cfbf338e5c3d65b9271f632142716d67d7c34    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 19:00:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 19:00:30 -0400    

Click here for diff

We didn't explicitly say that random() uses a randomly-chosen seed  
if you haven't called setseed().  Do so.  
  
Also, remove ref/set.sgml's no-longer-accurate (and never very  
relevant) statement that the seed value is multiplied by 2^31-1.  
  
Back-patch to v12 where set.sgml's claim stopped being true.  
The claim that we use a source of random bits as seed was debatable  
before 4203842a1, too, so v12 seems like a good place to stop.  
  
Per question from Carl Sopchak.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/set.sgml

Doc: update recovery/README.

commit   : 44d0e41319f2379d610eec059da273ae4e3c4e6f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 16:10:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 16:10:14 -0400    

Click here for diff

Commit e2f65f425 added contrib/pg_prewarm to the prerequisites for  
running the src/test/recovery suite, but did not bother to update  
the documentation about that.  

M src/test/recovery/README

Increase minimum supported GNU make version to 3.81.

commit   : 3b474a2e660f53f0a5aebfbb4c706d30aa145c16    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 12:12:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Jul 2022 12:12:42 -0400    

Click here for diff

We've long held the minimum at 3.80, but that's required more than  
one workaround.  Commit 0f39b70a6 broke it again, because it turns  
out that exporting a target-specific variable didn't work in 3.80.  
Considering that 3.81 is now old enough to get a driver's license,  
and that the only remaining buildfarm member testing 3.80 (prairiedog)  
is likely to be retired soon, let's just stop supporting 3.80.  
  
Adjust docs and Makefile.global's minimum-version check to match.  
There are a couple of comments in the Makefiles suggesting that  
random things could be done differently after we desupport 3.80,  
but I couldn't get excited about changing any of them right now.  
  
Back-patch to v15, as 0f39b70a6 was.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml
M src/Makefile.global.in

Fix [install]check in interfaces/libpq/Makefile

commit   : 1846202fe108bbcc0b0063dd3a2aecddf4d1ccd0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 20:15:11 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 22 Jul 2022 20:15:11 +0200    

Click here for diff

The common recipe when TAP tests are disabled doesn't work, because the  
libpq-specific recipe wants to define the PATH environment variable, so  
the starting '@' is misinterpreted as part of the command instead of  
silencing said command.  
  
Fix by setting the environment variable in a way that doesn't interfere  
with the recipe.  
  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

Close old gap in dependency checks for functions returning composite.

commit   : c2fa113ddb1117b1f03e91960f65d5d7d8a90270    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 12:46:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 12:46:42 -0400    

Click here for diff

The dependency logic failed to register a column-level dependency  
when a view or rule contains a reference to a specific column of  
the result of a function-returning-composite.  That meant you could  
drop the column from the composite type, causing trouble for future  
executions of the view.  We've known about this for years, but never  
summoned the energy to actually fix it, instead installing various  
low-level defenses to prevent crashing on references to dropped columns.  
We had to do that to plug the hole in stable branches, where there might  
be pre-existing broken references; but let's fix the root cause today.  
  
To do that, add some logic (borrowed from get_rte_attribute_is_dropped)  
to find_expr_references_walker, to check whether a Var referencing an  
RTE_FUNCTION RTE is referencing a column of a composite type, and if  
so add the proper dependency.  
  
However ... it seems mighty unwise to remove said low-level defenses,  
since there could be other bugs now or in the future that allow  
reaching them.  By the same token, letting those defenses go untested  
seems unwise.  Hence, rather than just dropping the associated test  
cases, hack them to continue working by the expedient of manually  
dropping the pg_depend entries that this fix installs.  
  
Back-patch into v15.  I don't want to risk changing this behavior  
in stable branches, but it seems not too late for v15.  (Since  
we have already forced initdb for beta3, we can be sure that all  
production v15 installations will have these added dependencies.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/rangefuncs.sql

Fix minor memory leaks in psql's tab completion.

commit   : 00cf40328a3178b0be69ac75549fc5d6857b77c3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 10:53:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Jul 2022 10:53:26 -0400    

Click here for diff

Tang Haiying and Tom Lane  
  
Discussion: https://postgr.es/m/OS0PR01MB6113EA19F05E217C823B4CCAFB909@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c
M src/fe_utils/string_utils.c

Remove unnecessary Windows-specific basebackup code.

commit   : 202b56ba91cb6c0741cc9340ac57a50dbcdac549    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 17:37:39 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 17:37:39 +1200    

Click here for diff

Commit c6f2f016 added an explicit check for a Windows "junction point".  
That turned out to be needed only because get_dirent_type() was busted  
on Windows.  It's been fixed by commit 9d3444dc, so remove it.  
  
Add a TAP-test to demonstrate that in-place tablespaces are copied by  
pg_basebackup.  This exercises the codepath that would fail before  
c6f2f016 on Windows, and shows that it still doesn't fail now that we're  
using get_dirent_type() on both Windows and Unix.  
  
Back-patch to 15, where in-place tablespaces arrived and caused this  
problem (ie directories where previously only symlinks were expected).  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix get_dirent_type() for Windows junction points.

commit   : 6d306ab731689ca01cdcafda9862732dcc075778    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 16:57:12 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 22 Jul 2022 16:57:12 +1200    

Click here for diff

Commit 87e6ed7c8 added code that intended to report Windows "junction  
points" as DT_LNK (the same way we report symlinks on Unix).  Windows  
junction points are *also* directories according to the Windows  
attributes API, and we were reporting them as as DT_DIR.  Change the  
order we check the attribute flags, to prioritize DT_LNK.  
  
If at some point we start using Windows' recently added real symlinks  
and need to distinguish them from junction points, we may need to  
rethink this, but for now this continues the tradition of wrapper  
functions that treat junction points as symlinks.  
  
Back-patch to 14, where get_dirent_type() landed.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLzLK4PUPx0_AwXEWXOYAejU%3D7XpxnYE55Y%2Be7hB2N3FA%40mail.gmail.com  
Discussion: https://postgr.es/m/20220721111751.x7hod2xgrd76xr5c%40alvherre.pgsql  

M src/port/dirent.c

postgres_fdw: Fix bug in checking of return value of PQsendQuery().

commit   : 63a8c689b0d49b8f426c5075d37dd67a63e06f82    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 21 Jul 2022 22:52:50 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 21 Jul 2022 22:52:50 +0900    

Click here for diff

When postgres_fdw begins an asynchronous data fetch, it submits FETCH query  
by using PQsendQuery(). If PQsendQuery() fails and returns 0, postgres_fdw  
should report an error. But, previously, postgres_fdw reported an error  
only when the return value is less than 0, though PQsendQuery() never return  
the values other than 0 and 1. Therefore postgres_fdw could not handle  
the failure to send FETCH query in an asynchronous data fetch.  
  
This commit fixes postgres_fdw so that it reports an error  
when PQsendQuery() returns 0.  
  
Back-patch to v14 where asynchronous execution was supported in postgres_fdw.  
  
Author: Fujii Masao  
Reviewed-by: Japin Li, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c

doc: use wording "restore" instead of "reload" of dumps

commit   : d5623c447c743cce3913559a353451711b6fa2f4    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 14:55:23 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 14:55:23 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/plhandler.sgml
M doc/src/sgml/ref/alter_type.sgml
M doc/src/sgml/ref/create_domain.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_resetwal.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/textsearch.sgml

doc: clarify that auth. names are lower case and case-sensitive

commit   : 97f6e4d5b2b6d2d69963c9b275c4f8918e076142    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:58:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:58:20 -0400    

Click here for diff

This is true even for acronyms that are usually upper case, like LDAP.  
  
Reported-by: Alvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/client-auth.sgml

Fix ruleutils issues with dropped cols in functions-returning-composite.

commit   : c1d1e8469c77ce6b8e5310955580b4a3eee7fe96    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2022 13:56:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Jul 2022 13:56:02 -0400    

Click here for diff

Due to lack of concern for the case in the dependency code, it's  
possible to drop a column of a composite type even though stored  
queries have references to the dropped column via functions-in-FROM  
that return the composite type.  There are "soft" references,  
namely FROM-clause aliases for such columns, and "hard" references,  
that is actual Vars referring to them.  The right fix for hard  
references is to add dependencies preventing the drop; something  
we've known for many years and not done (and this commit still doesn't  
address it).  A "soft" reference shouldn't prevent a drop though.  
We've been around on this before (cf. 9b35ddce9, 2c4debbd0), but  
nobody had noticed that the current behavior can result in dump/reload  
failures, because ruleutils.c can print more column aliases than the  
underlying composite type now has.  So we need to rejigger the  
column-alias-handling code to treat such columns as dropped and not  
print aliases for them.  
  
Rather than writing new code for this, I used expandRTE() which already  
knows how to figure out which function result columns are dropped.  
I'd initially thought maybe we could use expandRTE() in all cases, but  
that fails for EXPLAIN's purposes, because the planner strips a lot of  
RTE infrastructure that expandRTE() needs.  So this patch just uses it  
for unplanned function RTEs and otherwise does things the old way.  
  
If there is a hard reference (Var), then removing the column alias  
causes us to fail to print the Var, since there's no longer a name  
to print.  Failing seems less desirable than printing a made-up  
name, so I made it print "?dropped?column?" instead.  
  
Per report from Timo Stolz.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_relation.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

relnotes: improve PG 15 schema permission change wording

commit   : c69616c9386003fd62692bd33003a136e04b5e40    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:43:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 21 Jul 2022 13:43:13 -0400    

Click here for diff

Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

Correct some uses of e.g. and i.e. in message strings and documentation

commit   : 895723473ed8060a2afb50232a724471ae6743a2    
  
author   : John Naylor <[email protected]>    
date     : Thu, 14 Jul 2022 09:38:06 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 14 Jul 2022 09:38:06 +0700    

Click here for diff

E.g. means "for example" and i.e. means "that is". Fix a couple uses  
that don't match the intended meaning.  
  
Kyotaro Horiguchi  
  
Reviewed by Junwang Zhao and Aleksander Alekseev, with one addition by me  
Discussion: https://www.postgresql.org/message-id/flat/20220713.180943.589079824955875739.horikyota.ntt%40gmail.com  
  
This is a backpatch of 82785effc0 to v15  

M doc/src/sgml/ecpg.sgml
M src/bin/pg_upgrade/check.c

Fix various memory leaks in psql's describe commands \d*

commit   : eac3e00f8140e5a17b8021ba14e2239e3fd2a640    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 10:42:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Jul 2022 10:42:07 +0900    

Click here for diff

Most of these have been introduced in d2d3547 with the new pattern  
validation logic, and would leak memory worth an amount of one  
PQExpBuffer each time (as of 256 bytes at minimum, possibly more).  
  
Most of the patch has been written by Tang Haiying, with a few tweaks  
coming from Álvaro Herrera.  
  
Reported-by: Tang Haiying  
Author: Tang Haiying, Álvaro Herrera  
Reviewed-by: Mark Dilger, Andres Freund, Álvaro Herrera, Tom Lane, Japin  
Li, Michael Paquier, Junwang Zhao  
Backpatch-through: 15  

M src/bin/psql/describe.c

Process shared_preload_libraries in single-user mode.

commit   : 2103266a360df688062c4188f1de074b957fd6e9    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 15 Jul 2022 12:24:10 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 15 Jul 2022 12:24:10 -0700    

Click here for diff

Without processing shared_preload_libraries, it's impossible to  
recover if custom WAL resource managers are needed. It may also pose a  
problem running VACUUM on a table with a custom AM, if the module  
implementing the AM is expecting to be loaded by  
shared_preload_libraries.  
  
The reason this wasn't done before was just the general principle to  
do fewer things in single-user mode. But it's easy enough to just set  
shared_preload_libraries to empty, for the same effect.  
  
Discussion: https://postgr.es/m/9decc18a42634f8a2f15c97a385a0f51a752f396.camel%40j-davis.com  
Reviewed-by: Tom Lane, Andres Freund  
Backpatch-through: 15  

M src/backend/tcop/postgres.c

Fix assertion failure and segmentation fault in backup code.

commit   : 0829cc43ed69252184f90161b4940444d8b48574    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 11:53:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 11:53:29 +0900    

Click here for diff

When a non-exclusive backup is canceled, do_pg_abort_backup() is called  
and resets some variables set by pg_backup_start (pg_start_backup in v14  
or before). But previously it forgot to reset the session state indicating  
whether a non-exclusive backup is in progress or not in this session.  
  
This issue could cause an assertion failure when the session running  
BASE_BACKUP is terminated after it executed pg_backup_start and  
pg_backup_stop (pg_stop_backup in v14 or before). Also it could cause  
a segmentation fault when pg_backup_stop is called after BASE_BACKUP  
in the same session is canceled.  
  
This commit fixes the issue by making do_pg_abort_backup reset  
that session state.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Prevent BASE_BACKUP in the middle of another backup in the same session.

commit   : 286793b9889f8adaf76025debb7925a56a20b29c    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:31:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Jul 2022 09:31:57 +0900    

Click here for diff

Multiple non-exclusive backups are able to be run conrrently in different  
sessions. But, in the same session, only one non-exclusive backup can be  
run at the same moment. If pg_backup_start (pg_start_backup in v14 or before)  
is called in the middle of another non-exclusive backup in the same session,  
an error is thrown.  
  
However, previously, in logical replication walsender mode, even if that  
walsender session had already called pg_backup_start and started  
a non-exclusive backup, it could execute BASE_BACKUP command and  
start another non-exclusive backup. Which caused subsequent pg_backup_stop  
to throw an error because BASE_BACKUP unexpectedly reset the session state  
marked by pg_backup_start.  
  
This commit prevents BASE_BACKUP command in the middle of another  
non-exclusive backup in the same session.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi, Masahiko Sawada, Michael Paquier, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c

Tweak detail and hint messages to be consistent with project policy

commit   : 535f1fc9da728f5c692c96d5a4d635b43eeef7b7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Jul 2022 09:50:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Jul 2022 09:50:57 +0900    

Click here for diff

Detail and hint messages should be full sentences and should end with a  
period, but some of the messages newly-introduced in v15 did not follow  
that.  
  
Author: Justin Pryzby  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M contrib/basic_archive/basic_archive.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/misc/guc.c
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/sqljson.out
M src/test/regress/expected/triggers.out

Fix missed corner cases for grantable permissions on GUCs.

commit   : a2944d8724522c5659c024b191f2fbfa9770faaf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 17:22:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Jul 2022 17:22:03 -0400    

Click here for diff

We allow users to set the values of not-yet-loaded extension GUCs,  
remembering those values in "placeholder" GUC entries.  When/if  
the extension is loaded later in the session, we need to verify that  
the user had permissions to set the GUC.  That was done correctly  
before commit a0ffa885e, but as of that commit, we'd check the  
permissions of the active role when the LOAD happens, not the role  
that had set the value.  (This'd be a security bug if it had made it  
into a released version.)  
  
In principle this is simple enough to fix: we just need to remember  
the exact role OID that set each GUC value, and use that not  
GetUserID() when verifying permissions.  Maintaining that data in  
the guc.c data structures is slightly tedious, but fortunately it's  
all basically just copy-n-paste of the logic for tracking the  
GucSource of each setting, as we were already doing.  
  
Another oversight is that validate_option_array_item() hadn't  
been taught to check for granted GUC privileges.  This appears  
to manifest only in that ALTER ROLE/DATABASE RESET ALL will  
fail to reset settings that the user should be allowed to reset.  
  
Patch by myself and Nathan Bossart, per report from Nathan Bossart.  
Back-patch to v15 where the faulty code came in.  
  
Discussion: https://postgr.es/m/20220706224727.GA2158260@nathanxps13  

M src/backend/commands/extension.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/pl/plperl/expected/plperl_init.out
M src/pl/plperl/sql/plperl_init.sql
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql

relnotes: clarify pg_basebackup compression options

commit   : 795ccd44037cbe14a7366d90de94764a7136deb7    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Jul 2022 16:45:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Jul 2022 16:45:25 -0400    

Click here for diff

Also, a few wording improvements  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

relnotes: improve wording of several PG 15 items

commit   : 15ff26d559537989e17b8bd23c99ae7ca75f0691    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 19 Jul 2022 13:35:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 19 Jul 2022 13:35:00 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

Use STDOUT/STDERR_FILENO in most of syslogger.

commit   : c91a216ef7385e78e7eb80355c4d02953711bdba    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    

Click here for diff

This fixes problems on windows when logging collector is used in a service,  
failing with:  
FATAL:  could not redirect stderr: Bad file descriptor  
  
This is triggered by 76e38b37a5. The problem is that STDOUT/STDERR_FILENO  
aren't defined on windows, which lead us to use _fileno(stdout) etc, but that  
doesn't work if stdout/stderr are closed.  
  
Author: Andres Freund <[email protected]>  
Reported-By: Sandeep Thakkar <[email protected]>  
Message-Id: [email protected] (on pgsql-packagers)  
Backpatch: 15-, where 76e38b37a5 came in  

M src/backend/postmaster/syslogger.c

windows: msvc: Define STDIN/OUT/ERR_FILENO.

commit   : 92f478657c5544eba560047c39eba8a030ddb83e    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 17:06:34 -0700    

Click here for diff

Because they are not available we've used _fileno(stdin) in some places, but  
that doesn't reliably work, because stdin might be closed. This is the  
prerequisite of the subsequent commit, fixing a failure introduced in  
76e38b37a5.  
  
Author: Andres Freund <[email protected]>  
Reported-By: Sandeep Thakkar <[email protected]>  
Message-Id: [email protected] (on pgsql-packagers)  
Backpatch: 15-, where 76e38b37a5 came in  

M src/include/port/win32_msvc/unistd.h

Deal with paths containing \ and spaces in basebackup_to_shell tests

commit   : 1ab07198363744eea5620d964570e674dc7eeb52    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 10:14:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 18 Jul 2022 10:14:43 -0700    

Click here for diff

As $gzip is embedded in postgresql.conf \ needs to be escaped, otherwise guc.c  
will take it as a string escape. Similarly, if "$gzip" contains spaces, the  
prior incantation will fail. Both of these are common on windows.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-, where the test was added in 027fa0fd726  

M contrib/basebackup_to_shell/t/001_basic.pl

pg_upgrade: Adjust quoting style in message to match guidelines

commit   : 9a01ea73dac662019677e982999712acd6c1f899    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:53:00 +0200    

Click here for diff

M src/bin/pg_upgrade/check.c

Add another SQL/JSON error code

commit   : b681ca7635c4082c76f069d4d1dc2ca61975ca59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:26:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 18 Jul 2022 14:26:43 +0200    

Click here for diff

A code comment said that the standard does not define a number for  
ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE, but this was  
fixed in a later draft version of the standard, so use that number  
now.  

M src/backend/executor/execExprInterp.c
M src/backend/utils/errcodes.txt

Fix omissions in support for the "regcollation" type.

commit   : 96dbbf828c5f188e9fec0b706ad33c20900f918d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:43:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:43:28 -0400    

Click here for diff

The patch that added regcollation doesn't seem to have been too  
thorough about supporting it everywhere that other reg* types  
are supported.  Fix that.  (The find_expr_references omission  
is moderately serious, since it could result in missing expression  
dependencies.  The others are less exciting.)  
  
Noted while fixing bug #17483.  Back-patch to v13 where  
regcollation was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/catcache.c

postgres_fdw: set search_path to 'pg_catalog' while deparsing constants.

commit   : b8032f4816c3a5bd178841492d8f249d8b4572ba    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:27:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 17 Jul 2022 17:27:50 -0400    

Click here for diff

The motivation for this is to ensure successful transmission of the  
values of constants of regconfig and other reg* types.  The remote  
will be reading them with search_path = 'pg_catalog', so schema  
qualification is necessary when referencing objects in other schemas.  
  
Per bug #17483 from Emmanuel Quincerot.  Back-patch to all supported  
versions.  (There's some other stuff to do here, but it's less  
back-patchable.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Make dsm_impl_posix_resize more future-proof.

commit   : 91377a4559d8d8c0b119eb7dad97e11f3d566fcf    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 10:59:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 16 Jul 2022 10:59:52 +1200    

Click here for diff

Commit 4518c798 blocks signals for a short region of code, but it  
assumed that whatever called it had the signal mask set to UnBlockSig on  
entry.  That may be true today (or may even not be, in extensions in the  
wild), but it would be better not to make that assumption.  We should  
save-and-restore the caller's signal mask.  
  
The PG_SETMASK() portability macro couldn't be used for that, which is  
why it wasn't done before.  But... considering that commit a65e0864  
established back in 9.6 that supported POSIX systems have sigprocmask(),  
and that this is POSIX-only code, there is no reason not to use standard  
sigprocmask() directly to achieve that.  
  
Back-patch to all supported releases, like 4518c798 and 80845b7c.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKx6Biq7_UuV0kn9DW%2B8QWcpJC1qwhizdtD9tN-fn0H0g%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Fix inconsistent parameter names between prototype and declaration

commit   : 8c297dd5f4ff581f7a70c514d1512c22f47989e5    
  
author   : David Rowley <[email protected]>    
date     : Fri, 15 Jul 2022 15:27:14 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 15 Jul 2022 15:27:14 +1200    

Click here for diff

Noticed while working in this area.  This code was introduced in PG15,  
which is still in beta, so backpatch to there for consistency.  
  
Backpatch-through: 15  

M src/include/optimizer/paths.h

Clarify that pg_dump takes ACCESS SHARE lock

commit   : b32a588961161ba36d01ff8dbccfc949493232c7    
  
author   : John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 11:41:36 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 1 Jul 2022 11:41:36 +0700    

Click here for diff

Add link to the description of lock levels to avoid confusing "shared locks"  
with SHARE locks.  
  
Florin Irion  
  
Reviewed-by: Álvaro Herrera, Tom Lane, and Nathan Bossart  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  
  
This is a backpatch of 4e2e8d71f, applied through version 14  

M doc/src/sgml/ref/pg_dump.sgml

docs: make monitoring "phases" table titles consistent

commit   : ad8c8ee415da2d5437a346f1a57d873467d60812    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 20:01:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 20:01:11 -0400    

Click here for diff

Reported-by: Nitin Jadhav  
  
Discussion: https://postgr.es/m/CAMm1aWbmTHwHKC2PERH0CCaFVPoxrtLeS8=wNuoge94qdSp3vA@mail.gmail.com  
  
Author: Nitin Jadhav  
  
Backpatch-through: 13  

M doc/src/sgml/monitoring.sgml

doc: clarify how dropping of extensions affects dependent objs.

commit   : 8ef2859163d2355c47e0cce2aef11b0480ca1e5f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 17:41:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 17:41:03 -0400    

Click here for diff

Clarify that functions/procedures are dropped when any extension that  
depends on them is dropped.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwbPSHMDGkisRUmewopweC1bFvytVqB=a=X4GFg=4ZWxPA@mail.gmail.com  
  
Backpatch-through: 13  

M doc/src/sgml/ref/alter_function.sgml
M doc/src/sgml/ref/alter_procedure.sgml
M doc/src/sgml/ref/drop_extension.sgml

pg_upgrade doc: mention that replication slots must be recreated

commit   : e24ea2a97f059aece02925def9889351a3ac3110    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:34:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:34:30 -0400    

Click here for diff

Reported-by: Nikhil Shetty  
  
Discussion: https://postgr.es/m/CAFpL5Vxastip0Jei-K-=7cKXTg=5sahSe5g=om=x68NOX8+PUA@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/pgupgrade.sgml

doc: add documentation about ecpg Oracle-compatibility mode

commit   : fc130b8e2d38bc710dbfc052a46ca9e017a5cb02    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:19:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:19:45 -0400    

Click here for diff

Reported-by: Takeshi Ideriha  
  
Discussion: https://postgr.es/m/TYCPR01MB7041A157067208327D8DAAF9EAA59@TYCPR01MB7041.jpnprd01.prod.outlook.com  
  
Backpatch-through: 11  

M doc/src/sgml/ecpg.sgml

doc: move system views section to its own chapter

commit   : 5766443695d2ee82c2c4b9a23983c0af4b29711f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:07:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 16:07:12 -0400    

Click here for diff

Previously it was inside the system catalogs chapter.  
  
Reported-by: Peter Smith  
  
Discussion: https://postgr.es/m/CAHut+PsMc18QP60D+L0hJBOXrLQT5m88yVaCDyxLq34gfPHsow@mail.gmail.com  
  
Backpatch-through: 15  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/postgres.sgml
A doc/src/sgml/system-views.sgml

doc: clarify the behavior of identically-named savepoints

commit   : 890efb49c86f3893c2fe8920ea21e4c7e4d21b1a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:44:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:44:22 -0400    

Click here for diff

Original patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwYQCxSSuSL18skCWG8QHFswOJ3hjovHsOZUE346i4OpVQ@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/release_savepoint.sgml
M doc/src/sgml/ref/savepoint.sgml

doc: clarify that "excluded" ON CONFLICT is a single row

commit   : 1b308c95ace496ce66022f5cf27e85d9dfc1e122    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:33:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:33:28 -0400    

Click here for diff

Original patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwa4J0+WuO7kW1PLbjoEvzPN+Q_j+P2bXxNnCLaszY7ZdQ@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/insert.sgml

doc: mention that INSERT can block because of unique indexes

commit   : 106ab8531f2255819256581b8f4d23c6ba0373e7    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:17:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 15:17:19 -0400    

Click here for diff

Initial patch by David G. Johnston.  
  
Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwZpbdzceO41VE-xt1Xh8rWRRfgopTAK1wL9EhCo0Am-Sw@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/insert.sgml

doc: mention the pg_locks lock names in parentheses

commit   : 8db5026d0a0852ae2f6dfc4bc726a5184b71bafd    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 12:08:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 14 Jul 2022 12:08:55 -0400    

Click here for diff

Reported-by: Troy Frericks  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/mvcc.sgml

Don't clobber postmaster sigmask in dsm_impl_resize.

commit   : a715c20043c1396bc28f19514e667bfb081e8ad2    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 15 Jul 2022 01:23:29 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 15 Jul 2022 01:23:29 +1200    

Click here for diff

Commit 4518c798 intended to block signals in regular backends that  
allocate DSM segments, but dsm_impl_resize() is also reached by  
dsm_postmaster_startup().  It's not OK to clobber the postmaster's  
signal mask, so only manipulate the signal mask when under the  
postmaster.  
  
Back-patch to all releases, like 4518c798.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Block signals while allocating DSM memory.

commit   : c4a617ea117e9ca1e79c20d4d8430e0784cc9139    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 13 Jul 2022 16:16:07 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 13 Jul 2022 16:16:07 +1200    

Click here for diff

On Linux, we call posix_fallocate() on shm_open()'d memory to avoid  
later potential SIGBUS (see commit 899bd785).  
  
Based on field reports of systems stuck in an EINTR retry loop there,  
there, we made it possible to break out of that loop via slightly odd  
coding where the CHECK_FOR_INTERRUPTS() call was somewhat removed from  
the loop (see commit 422952ee).  
  
On further reflection, that was not a great choice for at least two  
reasons:  
  
1.  If interrupts were held, the CHECK_FOR_INTERRUPTS() would do nothing  
and the EINTR error would be surfaced to the user.  
  
2.  If EINTR was reported but neither QueryCancelPending nor  
ProcDiePending was set, then we'd dutifully retry, but with a bit more  
understanding of how posix_fallocate() works, it's now clear that you  
can get into a loop that never terminates.  posix_fallocate() is not a  
function that can do some of the job and tell you about progress if it's  
interrupted, it has to undo what it's done so far and report EINTR, and  
if signals keep arriving faster than it can complete (cf recovery  
conflict signals), you're stuck.  
  
Therefore, for now, we'll simply block most signals to guarantee  
progress.  SIGQUIT is not blocked (see InitPostmasterChild()), because  
its expected handler doesn't return, and unblockable signals like  
SIGCONT are not expected to arrive at a high rate.  For good measure,  
we'll include the ftruncate() call in the blocked region, and add a  
retry loop.  
  
Back-patch to all supported releases.  
  
Reported-by: Alvaro Herrera <[email protected]>  
Reported-by: Nicola Contu <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220701154105.jjfutmngoedgiad3%40alvherre.pgsql  

M src/backend/storage/ipc/dsm_impl.c

Plug memory leak

commit   : e6909307044016c3236d904d14a6740bc42aa0c7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 12:10:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Jul 2022 12:10:03 +0200    

Click here for diff

Commit 054325c5eeb3 created a memory leak in PQsendQueryInternal in case  
an error occurs while sending the message.  Repair.  
  
Backpatch to 14, like that commit.  Reported by Coverity.  

M src/interfaces/libpq/fe-exec.c

Small cleanup of create_list_bounds()

commit   : 559ec79e320e51a1a6ab24af1ff4a07fbb4de19f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 17:01:39 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 17:01:39 +1200    

Click here for diff

When checking for interleaved partitions, we mark the partition as  
interleaved when;  
  
1. we find an earlier partition index when looping over the  
sorted-by-Datum indexes[] array, or;  
  
2. we find that the NULL partition allows some non-NULL Datum value.  
  
In the code, as it was written in db632fbca we'll continue to check for  
case 2 when we've already marked the partition as interleaved for case 1.  
Here we make it so we don't bother marking the partition as interleaved  
for case 2 when it's already been marked due to case 1.  
  
Really all this saves is a useless call to bms_add_member(), but since  
this code is new to PG15, it seems worth fixing it now to save anyone the  
trouble of complaining at some time in the future.  We have the  
opportunity to improve this now before PG15 is out.  This might ease some  
future back-patching pain.  
  
Per report and patch by Zhihong Yu.  However, I slightly revised the  
comments and altered the bms_add_member() code to match in both locations.  
We already know that index is equal to boundinfo->null_index from the if  
condition.  
  
Author: Zhihong Yu  
Discussion: https://postgr.es/m/CALNJ-vQbZR0pYxz9zQ5bqXVcwtGgNgVupeEpNT65HZ+yWZnc4g@mail.gmail.com  
Backpatch-through: 15, same as db632fbca.  

M src/backend/partitioning/partbounds.c

Tidy up code in get_cheapest_group_keys_order()

commit   : 44b5d5625389c2e001e0ffe3d435c35965862adc    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 14:03:24 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Jul 2022 14:03:24 +1200    

Click here for diff

There are a few things that we could do a little better within  
get_cheapest_group_keys_order():  
  
1. We should be using list_free() rather than pfree() on a List.  
  
2. We should use for_each_from() instead of manually coding a for loop to  
skip the first n elements of a List  
  
3. list_truncate(list_copy(...), n) is not a great way to copy the first n  
elements of a list. Let's invent list_copy_head() for that.  That way we  
don't need to copy the entire list just to truncate it directly  
afterwards.  
  
4. We can simplify finding the cheapest cost by setting the cheapest cost  
variable to DBL_MAX.  That allows us to skip special-casing the initial  
iteration of the loop.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvrGyL3ft8waEkncG9y5HDMu5TFFJB1paoTC8zi9YK97Nw@mail.gmail.com  
Backpatch-through: 15, where get_cheapest_group_keys_order was added.  

M src/backend/nodes/list.c
M src/backend/optimizer/path/pathkeys.c
M src/include/nodes/pg_list.h

Invent qsort_interruptible().

commit   : 12c99c88442d18e82daf521907a6e3d9003295ee    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 16:30:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Jul 2022 16:30:36 -0400    

Click here for diff

Justin Pryzby reported that some scenarios could cause gathering  
of extended statistics to spend many seconds in an un-cancelable  
qsort() operation.  To fix, invent qsort_interruptible(), which is  
just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS  
every so often.  This bloats the backend by a couple of kB, which  
seems like a good investment.  (We considered just enabling  
CHECK_FOR_INTERRUPTS in the existing qsort and qsort_arg functions,  
but there are some callers for which that'd demonstrably be unsafe.  
Opt-in seems like a better way.)  
  
For now, just apply qsort_interruptible() in statistics collection.  
There's probably more places where it could be useful, but we can  
always change other call sites as we find problems.  
  
Back-patch to v14.  Before that we didn't have extended stats on  
expressions, so that the problem was less severe.  Also, this patch  
depends on the sort_template infrastructure introduced in v14.  
  
Tom Lane and Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/sort/Makefile
A src/backend/utils/sort/qsort_interruptible.c
M src/include/port.h

relnotes: updates "cumulative statistics system" mention

commit   : d8759a40bfce756f655b2afab129915640bebf0a    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 11 Jul 2022 14:21:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 11 Jul 2022 14:21:24 -0400    

Click here for diff

Also add "the".  
  
Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

Fix lock assertions in dshash.c.

commit   : 53df1e28d2f7554ab23292414ce3200f732ee1c1    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 14:47:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 11 Jul 2022 14:47:16 +1200    

Click here for diff

dshash.c previously maintained flags to be able to assert that you  
didn't hold any partition lock.  These flags could get out of sync with  
reality in error scenarios.  
  
Get rid of all that, and make assertions about the locks themselves  
instead.  Since LWLockHeldByMe() loops internally, we don't want to put  
that inside another loop over all partition locks.  Introduce a new  
debugging-only interface LWLockAnyHeldByMe() to avoid that.  
  
This problem was noted by Tom and Andres while reviewing changes to  
support the new shared memory stats system, and later showed up in  
reality while working on commit 389869af.  
  
Back-patch to 11, where dshash.c arrived.  
  
Reported-by: Tom Lane <[email protected]>  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Kyotaro HORIGUCHI <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CA%2BhUKGJ31Wce6HJ7xnVTKWjFUWQZPBngxfJVx4q0E98pDr3kAw%40mail.gmail.com  

M src/backend/lib/dshash.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Fix two portability issues with the tests of test_oat_hooks

commit   : 03b87d08a4163d23d4acd83e3c022ab82b43a7ac    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 12:48:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 12:48:06 +0900    

Click here for diff

This addresses two issues in the tests of test_oat_hooks:  
- The role regress_test_user was being left behind, preventing the test  
to succeed on repeated runs.  It makes sense to leave some objects  
behind to have more coverage for pg_upgrade (as does test_pg_dump), but  
the role dropped here does not own any objects so there is no reason to  
keep it.  
- GRANT SET ON PARAMETER is issued, creating an entry in  
pg_parameter_acl without cleaning up the entry created.  This causes  
an overlap with unsafe_tests as both use work_mem, making the latter  
fail.  This commit adds an extra REVOKE SET ON PARAMETER to clean the  
contents of pg_parameter_acl, switching to maintenance_work_mem rather  
than work_mem to avoid an overlap between both tests.  
  
The tests of test_oat_hooks cannot use installcheck yet as these are  
proving to be unstable with caching and the namespace search hooks, so  
the issues fixed here cannot be reached yet, but they would be once the  
hook issue is addressed and installcheck is allowed again in  
test_oat_hooks.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql

Improve error message with JSON_SERIALIZE()

commit   : 834fce52f941cd228beca2067dca82f6e33a4d98    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:20:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 11:20:52 +0900    

Click here for diff

The error message introduced in 3c633f3 can share the same format string  
with an existing message used for JSON(), reducing the translation  
effort.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson.out

doc: Fix inconsistent quotes in some jsonb fields

commit   : b2b6c1be0569548893a80f15c74084243fb8d8a1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 10:56:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Jul 2022 10:56:42 +0900    

Click here for diff

Single quotes are not allowed in json internals, double quotes are.  
  
Reported-by: Eric Mutta  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/json.sgml

Fix \watch's interaction with libedit on ^C.

commit   : 31b485f883a7db27319d4ea8a724151c21db7bb8    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 10 Jul 2022 16:30:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 10 Jul 2022 16:30:03 +1200    

Click here for diff

When you hit ^C, the terminal driver in Unix-like systems echoes "^C" as  
well as sending an interrupt signal (depending on stty settings).  At  
least libedit (but maybe also libreadline) is then confused about the  
current cursor location, and corrupts the display if you try to scroll  
back.  Fix, by moving to a new line before the next prompt is displayed.  
  
Back-patch to all supported released.  
  
Author: Pavel Stehule <[email protected]>  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/3278793.1626198638%40sss.pgh.pa.us  

M src/bin/psql/command.c

doc: add examples for array_length() and jsonb_array_length()

commit   : 6763b2525cdae1b1424d8df7fcf2c669325e34eb    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 20:23:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 20:23:35 -0400    

Click here for diff

The examples show the output of array_length() and jsonb_array_length()  
for empty arrays.  
  
Discussion: https://postgr.es/m/CAKFQuwaoBmRuWdMLzLHDCFDJDX3wvfQ7egAF0bpik_BFgG1KWg@mail.gmail.com  
  
Author: David G. Johnston  
  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

doc: add pg_prewarm example

commit   : 0a1c5a6b966782e4f2de67a3613dae7c5880dd83    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 18:36:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 8 Jul 2022 18:36:27 -0400    

Click here for diff

Discussion: https://postgr.es/m/20220618085541.ezxdaljlpo6x7msc@home-desktop  
  
Author: Dong Wook Lee  
  
Backpatch-through: 11  

M doc/src/sgml/pgprewarm.sgml

Preserve relfilenode of pg_largeobject and its index across pg_upgrade.

commit   : a2996478c32d27171a786f59eff0505b1722b9ea    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Jul 2022 10:15:19 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Jul 2022 10:15:19 -0400    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 did this for user  
tables, but pg_upgrade treats pg_largeobject as a user table, and so  
needs the same treatment. Without this fix, if you rewrite the  
pg_largeobject table and then perform an upgrade with pg_upgrade, the  
table will apparently be empty on the new cluster, while all of your  
objects will end up with an orphaned file.  
  
With this fix, instead of the old cluster's pg_largeobject files ending  
up orphaned, the original files fro the new cluster do. That's mostly  
harmless because we expect the table to be empty, but we might want  
to arrange to remove the as part of the upgrade. Since we're still  
debating the best way of doing that, I (rhaas) have decided to postpone  
dealing with that problem and get the basic fix committed.  
  
Justin Pryzby, reviewed by Shruthi Gowda and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Only allow returning string types or bytea from json_serialize

commit   : 2b2bcc22e571c27a9ea8861e29e0c40874dae714    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Jul 2022 17:40:02 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Jul 2022 17:40:02 -0400    

Click here for diff

These are documented to be the allowed types for the RETURNING clause,  
but the restriction was not being enforced, which caused a segfault if  
another type was specified. Add some testing for this.  
  
Per report from a.kozhemyakin  
  
Backpatch to release 15.  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix alias matching in transformLockingClause().

commit   : ea9e59d701b3bfdfebcc67647ed203fa22eed9b0    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 7 Jul 2022 13:08:06 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 7 Jul 2022 13:08:06 +0100    

Click here for diff

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE  
clause, transformLockingClause() finds the relation to lock by  
scanning the rangetable for an RTE with a matching eref->aliasname.  
However, it failed to account for the visibility rules of a join RTE.  
  
If a join RTE doesn't have a user-supplied alias, it will have a  
generated eref->aliasname of "unnamed_join" that is not visible as a  
relation name in the parse namespace. Such an RTE needs to be skipped,  
otherwise it might be found in preference to a regular base relation  
with a user-supplied alias of "unnamed_join", preventing it from being  
locked.  
  
In addition, if a join RTE doesn't have a user-supplied alias, but  
does have a join_using_alias, then the RTE needs to be matched using  
that alias rather than the generated eref->aliasname, otherwise a  
misleading "relation not found" error will be reported rather than a  
"join cannot be locked" error.  
  
Backpatch all the way, except for the second part which only goes back  
to 14, where JOIN USING aliases were added.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com  

M src/backend/parser/analyze.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

postgres_fdw: Fix grammar.

commit   : 54bc816810bca2041bee4997efbe67e63d927bcc    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 7 Jul 2022 16:25:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 7 Jul 2022 16:25:00 +0900    

Click here for diff

Oversight in commit 4036bcbbb; back-patch to v15 where that appeared.  

M contrib/postgres_fdw/connection.c

Re-order disable_on_error in tab-complete.

commit   : 2d94d090e4dc830bf2f1c342720330d092c443f9    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 7 Jul 2022 09:15:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 7 Jul 2022 09:15:52 +0530    

Click here for diff

By convention, the tab-complete subscription parameters are listed in the  
COMPLETE_WITH lists in alphabetical order, but when the "disable_on_error"  
parameter was introduced this was not done.  
  
This patch just tidies that up.  
  
Reported-by: Peter Smith  
Author: Peter Smith  
Reviewed-by: Euler Taveira, Takamichi Osumi  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PucvKZgg_eJzUW--iL6DXHg1Jwj6F09tQziE3kUF67uLg@mail.gmail.com  

M src/bin/psql/tab-complete.c

pgstat: slru: remove outdated comment

commit   : 9d51c628c4a0a9affa1d4c84e596c32361b5c25a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 15:50:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 15:50:38 -0700    

Click here for diff

That comment might have been true at some point during development, but  
definitely isn't anymore.  
  
Reported-By: Melanie Plageman <[email protected]>  
Backpatch: 15-  

M src/backend/utils/activity/pgstat_slru.c

Fix wrong field order in _readMergeWhenClause().

commit   : dcffdc53496b47ece19bdf84a24997c4088c584d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Jul 2022 17:26:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Jul 2022 17:26:27 -0400    

Click here for diff

We hadn't noticed this because it's dead code: there is no  
situation where we read raw parse trees from text format.  
So maybe the right fix is to remove the function altogether,  
but I'll forbear for now; it's not the only dead code in  
readfuncs.c, I think.  
  
Noted while comparing existing code to the results of  
Peter's auto-generation script.  

M src/backend/nodes/readfuncs.c

Overload index_form_tuple to allow the memory context to be supplied

commit   : ae1123f9899fe80935ae344e38f18632beb1bf9a    
  
author   : David Rowley <[email protected]>    
date     : Thu, 7 Jul 2022 08:14:32 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 7 Jul 2022 08:14:32 +1200    

Click here for diff

40af10b57 changed things so we make use of a generation memory context for  
storing tuples to be sorted by tuplesort.c. That change does not play  
nicely with the changes made in 9f03ca915 (back in 2014). That commit  
changed things so that index_form_tuple() is called while switched into  
the tuplestore's tuplecontext. In order to fetch the tuple from the index,  
index_form_tuple() must do various memory allocations which are unrelated  
to the storage of the final returned tuple. Although all of these  
allocations are pfree'd, the fact that we now use a generation context  
means that the memory for these pfree'd allocations won't be used again by  
any other allocation due to generation.c's lack of freelists.  This could  
result in sorts used for building indexes exceeding maintenance_work_mem  
by a very large amount.  
  
Here we fix it so we no longer allocate anything apart from the tuple  
itself into the generation context by adding a new version of  
index_form_tuple named index_form_tuple_context, which can be called to  
specify the MemoryContext to allocate the tuple into.  
  
Discussion: https://postgr.es/m/CAApHDvrHQkiFRHiGiAS-LMOvJN-eK-s762=tVzBz8ZqUea-a_A@mail.gmail.com  
Backpatch-through: 15, where 40af10b57 was added.  

M src/backend/access/common/indextuple.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/itup.h

pgstat: drop subscription stats regardless of slot, fix comment

commit   : 596172260a6ddc78be85d929c309da3c941fe683    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:46:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Jul 2022 08:46:04 -0700    

Click here for diff

There's no reason anymore to only drop subscription stats if associated with a  
slot, now that stats drops are transactional. Additionally, the comment  
referring to autovacuum cleaning up stats was clearly outdated.  
  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoAwiby3HeJE7vJe16Gr75RFfJ640dyHqvsiUhyKJTXPtw@mail.gmail.com  
Backpatch: 15-  

M src/backend/commands/subscriptioncmds.c

Remove size increase in ExprEvalStep caused by hashed saops

commit   : 30efc3b5a3648bc64c7a8b058030756bb81292e1    
  
author   : David Rowley <[email protected]>    
date     : Wed, 6 Jul 2022 19:41:09 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 6 Jul 2022 19:41:09 +1200    

Click here for diff

50e17ad28 increased the size of ExprEvalStep from 64 bytes up to 88 bytes.  
Lots of effort was spent during the development of the current expression  
evaluation code to make an instance of this struct as small as possible.  
Making this struct larger than needed reduces CPU cache efficiency during  
expression evaluation which causes noticeable slowdowns during query  
execution.  
  
In order to reduce the size of the struct, here we remove the fn_addr  
field. The values from this field can be obtained via fcinfo, just with  
some extra pointer dereferencing. The extra indirection does not seem to  
cause any noticeable slowdowns.  
  
Various other fields have been moved into the ScalarArrayOpExprHashTable  
struct. These fields are only used when the ScalarArrayOpExprHashTable  
pointer has already been dereferenced, so no additional pointer  
dereferences occur for these. Here we also make hash_fcinfo_data the last  
field in ScalarArrayOpExprHashTable so that we can avoid a further pointer  
dereference to get the FunctionCallInfoBaseData. This also saves a call to  
palloc().  
  
50e17ad28 was added in 14, but it's too late to adjust the size of the  
ExprEvalStep in that version, so here we just backpatch to 15, which is  
currently in beta.  
  
Author: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h

Tighten pg_upgrade's new check for non-upgradable anyarray usages.

commit   : c7e21e96646436d523f489ad53912aa2af0e2227    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 18:23:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 18:23:19 -0400    

Click here for diff

We only need to reject cases when the aggregate or operator is  
itself declared with a polymorphic type.  Per buildfarm.  
  
Discussion: https://postgr.es/m/3383880.QJadu78ljV@vejsadalnx  

M src/bin/pg_upgrade/check.c

pgstat: reduce timer overhead by leaving timer running.

commit   : 4a37527fde3c0959475636dcc88c19b7315f891a    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 17 Jun 2022 12:48:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 17 Jun 2022 12:48:34 -0700    

Click here for diff

Previously the timer was enabled whenever there were any pending stats after  
executing a statement, just to then be disabled again when not idle  
anymore. That lead to an increase in GetCurrentTimestamp() calls from within  
timeout.c compared to 14.  
  
To avoid that increase, leave the timer enabled until stats are reported,  
rather than until idle. The timer is only disabled once the pending stats have  
been reported.  
  
For me this fixes the increase in GetCurrentTimestamp() calls, there now are  
fewer calls in 15 than in 14, in the previously slowed down workload.  
  
While at it, also update assertion in pgstat_report_stat() to be more precise.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat.c

expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.

commit   : 5a1ab894f758fae95b8d40fff0b0fa5048b09467    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Jun 2022 18:33:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Jun 2022 18:33:42 -0700    

Click here for diff

The new expression step types increased the size of ExprEvalStep by ~4 for all  
types of expression steps, slowing down expression evaluation noticeably. Move  
them out of line.  
  
There's other issues with these expression steps, but addressing them is  
largely independent of this aspect.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h
M src/tools/pgindent/typedefs.list

commit   : 49ddd98763624cfb6020f8b525a021e9788473a5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 5 Jul 2022 11:01:10 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 5 Jul 2022 11:01:10 -0700    

Click here for diff

This reverts most of 91c0570a791, f28bf667f60, fe0972ee5e6, afdeff10526. The  
only thing left is the retry loop in 019_replslot_limit.pl that avoids  
spurious failures by retrying a couple times.  
  
We haven't seen any hard evidence that this is caused by anything but slow  
process shutdown. We did not find any cases where walsenders did not vanish  
after waiting for longer. Therefore there's no reason for this debugging code  
to remain.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 15-  

M src/backend/replication/slot.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/init/postinit.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/include/storage/lwlock.h
M src/test/recovery/t/019_replslot_limit.pl

relnotes: clarify that PG 15 multi-xid is advanced more

commit   : db1fff1ea43720d7aba41e5f03a62009731e559c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 5 Jul 2022 14:06:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 5 Jul 2022 14:06:45 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzk-oOpKObMKJ=Df4WBERX0ja14ymu3h5JrDt_FtmvH1yQ@mail.gmail.com  
  
Backpatch-through: 15 only  

M doc/src/sgml/release-15.sgml

Rename pg_checkpointer predefined role to pg_checkpoint.

commit   : d3526e59fd11a0a876b3b3186c6ed8db8270bf32    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Jul 2022 13:31:55 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Jul 2022 13:31:55 -0400    

Click here for diff

This is more consistent with how other predefined roles that confer  
specific privileges are named.  
  
Nathan Bosart  
  
Discussion: http://postgr.es/m/CA+TgmoatH7+yYe+A8uJFNogg3VUDtFE6c-77yHAY8TRWR7oqyw@mail.gmail.com  

M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/tcop/utility.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat

Fix pg_upgrade to detect non-upgradable anyarray usages.

commit   : c069f427855a486a4d32d84e2bf4c932df00d7d5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 13:06:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 13:06:31 -0400    

Click here for diff

When we changed some built-in functions to use anycompatiblearray  
instead of anyarray, we created a dump/restore hazard for user-defined  
operators and aggregates relying on those functions: the user objects  
have to be modified to change their signatures similarly.  This causes  
pg_upgrade to fail partway through if the source installation contains  
such objects.  We generally try to have pg_upgrade detect such hazards  
and fail before it does anything exciting, so add logic to detect  
this case too.  
  
Back-patch to v14 where the change was made.  
  
Justin Pryzby, reviewed by Andrey Borodin  
  
Discussion: https://postgr.es/m/3383880.QJadu78ljV@vejsadalnx  

M src/bin/pg_upgrade/check.c

Fix errors in copyfuncs/equalfuncs support for JSON node types.

commit   : 90d6c65a2c2358bd80103afc0686c90c70d5417b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 11:12:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Jul 2022 11:12:33 -0400    

Click here for diff

Noted while comparing existing code to the output of the proposed  
patch to automate creation of these functions.  Some of the changes  
are just cosmetic, but others represent real bugs.  I've not  
attempted to analyze the user-visible impact.  
  
Back-patch to v15 where this code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

libpq: Improve idle state handling in pipeline mode

commit   : 93cf9233cd546b31d08d02ab803fae25472c03c5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 14:21:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 14:21:20 +0200    

Click here for diff

We were going into IDLE state too soon when executing queries via  
PQsendQuery in pipeline mode, causing several scenarios to misbehave in  
different ways -- most notably, as reported by Daniele Varrazzo, that a  
warning message is produced by libpq:  
  message type 0x33 arrived from server while idle  
But it is also possible, if queries are sent and results consumed not in  
lockstep, for the expected mediating NULL result values from PQgetResult  
to be lost (a problem which has not been reported, but which is more  
serious).  
  
Fix this by introducing two new concepts: one is a command queue element  
PGQUERY_CLOSE to tell libpq to wait for the CloseComplete server  
response to the Close message that is sent by PQsendQuery.  Because the  
application is not expecting any PGresult from this, the mechanism to  
consume it is a bit hackish.  
  
The other concept, authored by Horiguchi-san, is a PGASYNC_PIPELINE_IDLE  
state for libpq's state machine to differentiate "really idle" from  
merely "the idle state that occurs in between reading results from the  
server for elements in the pipeline".  This makes libpq not go fully  
IDLE when the libpq command queue contains entries; in normal cases, we  
only go IDLE once at the end of the pipeline, when the server response  
to the final SYNC message is received.  (However, there are corner cases  
it doesn't fix, such as terminating the query sequence by  
PQsendFlushRequest instead of PQpipelineSync; this sort of scenario is  
what requires PGQUERY_CLOSE bit above.)  
  
This last bit helps make the libpq state machine clearer; in particular  
we can get rid of an ugly hack in pqParseInput3 to avoid considering  
IDLE as such when the command queue contains entries.  
  
A new test mode is added to libpq_pipeline.c to tickle some related  
problematic cases.  
  
Reported-by: Daniele Varrazzo <[email protected]>  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CA+mi_8bvD0_CW3sumgwPvWdNzXY32itoG_16tDYRu_1S2gV2iw@mail.gmail.com  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
A src/test/modules/libpq_pipeline/traces/pipeline_idle.trace

BRIN: improve documentation on summarization

commit   : e5085fc947249cf9a120cc1328aaa8bf9aea8685    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 13:38:26 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Jul 2022 13:38:26 +0200    

Click here for diff

The existing wording wasn't clear enough and some details weren't  
anywhere, such as the fact that autosummarization is off by default.  
Improve.  
  
Authors: Roberto Mello, Jaime Casanova, Justin Pryzby, Álvaro Herrera  
Discussion: https://postgr.es/m/CAKz==bK_NoJytRyQfX8K-erCW3Ff7--oGYpiB8+ePVS7dRVW_A@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/brin.sgml
M doc/src/sgml/ref/create_index.sgml

Use a short socket directory path in pg_upgrade testing.

commit   : 5c1d80ea7797dc4a8e2cdc7e8e62edff50238abe    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 21:38:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 21:38:32 -0400    

Click here for diff

Several buildfarm members are failing the pg_upgrade test in  
REL_15_STABLE, though the identical test is fine in HEAD.  
On thorntail it's possible to see that the problem is an  
overlength socket path name, and I bet the same is true  
on the others.  
  
The normally-started postmasters used in the test are already  
set up with short socket directory paths, but we neglected to  
tell pg_upgrade itself to do likewise when starting child  
postmasters, and indeed it seems to be explicitly selecting  
the test directory instead.  
  
Back-patch to v15 where the current test script was introduced.  
(The previous script might have the same issue, because I don't  
see any use of -s/--socketdir in it either; but we've had no  
complaints, so leave it alone for now.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Remove %error-verbose directive from jsonpath parser

commit   : 7d9bf589ba840e9f0167a32226ff91a0b50fed95    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 3 Jul 2022 17:08:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 3 Jul 2022 17:08:25 -0400    

Click here for diff

None of the other bison parsers contains this directive, and it gives  
rise to some unfortunate and impenetrable messages, so just remove it.  
  
Backpatch to release 12, where it was introduced.  
  
Per gripe from Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonpath_gram.y
M src/test/regress/expected/jsonb_sqljson.out

Add Windows file version information to libpq/test programs.

commit   : 8b042df51eac7255291272f6a3cc48b4f3244016    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 3 Jul 2022 13:07:17 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 3 Jul 2022 13:07:17 -0700    

Click here for diff

Back-patch to v15, the first version to install these programs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/test/Makefile

Simplify tab completion of extension versions, redux.

commit   : 207fc033bd9f7d7f6f8a5609cf2c8caab5ce57f5    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 15:27:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Jul 2022 15:27:27 -0400    

Click here for diff

After commit 662dbe2c8, psql tab completion didn't conveniently  
support the case of "ALTER EXTENSION foo UPDATE".  It'd always  
add "TO", which is fine if you want to specify a target version  
but not if you don't ... and surely the latter is the much more  
common case.  
  
To fix, remove "TO" from the initially offered completion; you now  
need to press TAB one additional time to get that.  We won't try to  
duplicate the old behavior of attempting initial completion on the  
target version along with TO.  It's too squirrelly to get the quoting  
right, and this is such an infrequent usage that it doesn't seem worth  
expending a lot of effort and special code on.  
  
Noted by Noah Misch.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Fix previous commit's ecpg_clocale for ppc Darwin.

commit   : 8533eb181ae452d558b585f9a6b15233e720d447    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 21:03:19 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 21:03:19 -0700    

Click here for diff

Per buildfarm member prairiedog, this platform rejects uninitialized  
global variables in shared libraries.  Back-patch to v10, like the  
addition of the variable.  
  
Reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c

ecpglib: call newlocale() once per process.

commit   : 7a28f7cb09bffaa24d8c573cee0c99ab5c14795d    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 13:00:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 2 Jul 2022 13:00:30 -0700    

Click here for diff

ecpglib has been calling it once per SQL query and once per EXEC SQL GET  
DESCRIPTOR.  Instead, if newlocale() has not succeeded before, call it  
while establishing a connection.  This mitigates three problems:  
- If newlocale() failed in EXEC SQL GET DESCRIPTOR, the command silently  
  proceeded without the intended locale change.  
- On AIX, each newlocale()+freelocale() cycle leaked memory.  
- newlocale() CPU usage may have been nontrivial.  
  
Fail the connection attempt if newlocale() fails.  Rearrange  
ecpg_do_prologue() to validate the connection before its uselocale().  
  
The sort of program that may regress is one running in an environment  
where newlocale() fails.  If that program establishes connections  
without running SQL statements, it will stop working in response to this  
change.  I'm betting against the importance of such an ECPG use case.  
Most SQL execution (any using ECPGdo()) has long required newlocale()  
success, so there's little a connection could do without newlocale().  
  
Back-patch to v10 (all supported versions).  
  
Reviewed by Tom Lane.  Reported by Guillaume Lelarge.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c

Default to dynamic_shared_memory_type=sysv on Solaris.

commit   : a2b0719cc22d6f7fffa316b5da0fb5b22526c63e    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 2 Jul 2022 16:06:47 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 2 Jul 2022 16:06:47 +1200    

Click here for diff

POSIX shm_open() can sleep for a long time and fail spuriously because  
of contention on an internal lock file on Solaris (and presumably  
illumos).  Commit 389869af fixed the main problem with this, namely that  
we could crash, but it's now clear that "posix" is not a good default.  
  
Therefore, choose "sysv" at initdb time on Solaris and illumos.  Other  
choices are still available by editing the postgresql.conf file.  
  
Back-patch only to 15, because contention is much less likely further  
back, and it doesn't seem like a good idea to change this in released  
branches.  This should clear up the failures on build farm animal  
margay.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKqKrCV5xKWfh9rnm%3Do%3DDwZLTLtnsj_XpUi9g5%3DV%2B9oyg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c

Fix race condition in t/028_pitr_timelines.pl.

commit   : 0806cd29be01c837bc2f6b07bf14fb6aa0f4ad80    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:18 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 1 Jul 2022 18:27:18 -0700    

Click here for diff

Per buildfarm members sungazer and mylodon.  Back-patch to v15, which  
introduced this test.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/028_pitr_timelines.pl

Add missing GETTEXT_FLAGS entry

commit   : 37ef8e1dfe37b02212755eb8797d7b2598b46b96    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 16:41:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Jul 2022 16:41:46 +0200    

Click here for diff

M src/bin/psql/nls.mk

doc: Add index entry for MERGE SQL command.

commit   : 1201e0f03872fba64db04368063fa95aedf08f78    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 1 Jul 2022 14:19:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 1 Jul 2022 14:19:52 +0900    

Click here for diff

Back-patch to v15, where MERGE command was supported.  
  
Author: Fujii Masao  
Reviewed-by: Alvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/merge.sgml

Harden dsm_impl.c against unexpected EEXIST.

commit   : fef8c7a0c5771863073a20423d2bbd86602954a0    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 1 Jul 2022 12:05:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 1 Jul 2022 12:05:52 +1200    

Click here for diff

Previously, we trusted the OS not to report EEXIST unless we'd passed in  
IPC_CREAT | IPC_EXCL or O_CREAT | O_EXCL, as appropriate.  Solaris's  
shm_open() can in fact do that, causing us to crash because we didn't  
ereport and then we blithely assumed the mapping was successful.  
  
Let's treat EEXIST just like any other error, unless we're actually  
trying to create a new segment.  This applies to shm_open(), where this  
behavior has been seen, and also to the equivalent operations for our  
sysv and mmap modes just on principle.  
  
Based on the underlying reason for the error, namely contention on a  
lock file managed by Solaris librt for each distinct name, this problem  
is only likely to happen on 15 and later, because the new shared memory  
stats system produces shm_open() calls for the same path from  
potentially large numbers of backends concurrently during  
authentication.  Earlier releases only shared memory segments between a  
small number of parallel workers under one Gather node.  You could  
probably hit it if you tried hard enough though, and we should have been  
more defensive in the first place.  Therefore, back-patch to all  
supported releases.  
  
Per build farm animal margay.  This isn't the end of the story, though,  
it just changes random crashes into random "File exists" errors; more  
work needed for a green build farm.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKqKrCV5xKWfh9rnm%3Do%3DDwZLTLtnsj_XpUi9g5%3DV%2B9oyg%40mail.gmail.com  

M src/backend/storage/ipc/dsm_impl.c

Add 82d0ffae3 to git-blame-ignore-revs.

commit   : adadae45816e14caabeccf0324980136b996db4a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:08:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:08:12 -0400    

Click here for diff

M .git-blame-ignore-revs

pgindent run prior to branching v15.

commit   : 82d0ffae3219e4bc153a1306ce23013d168e04a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:03:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Jun 2022 11:03:03 -0400    

Click here for diff

pgperltidy and reformat-dat-files too.  Not many changes.  

M src/backend/access/transam/xact.c
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/psql/t/001_basic.pl
M src/include/catalog/pg_proc.dat
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/031_column_list.pl

relnotes: update item about public schema permission change

commit   : f5135d2aba87f59944bdab4f54129fc43a3f03d0    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2022 16:35:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 Jun 2022 16:35:32 -0400    

Click here for diff

Also mention the bootstrap superuser.  
  
Reported-by: Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Stamp 15beta2.

commit   : c1d033fcb5ecf306241cd729d1edcaa846456335    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Jun 2022 16:11:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Jun 2022 16:11:56 -0400    

Click here for diff

M configure
M configure.ac

Remove outdated recommendation for manual VACUUM

commit   : 27f953ea9901c08fb3e4064f9a31e07bc30c1e6d    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 27 Jun 2022 19:43:27 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 27 Jun 2022 19:43:27 +0200    

Click here for diff

We have had a working and tunable autovacuum  
for at least a decade now, so remove the recommendation to  
manually vacuum tables at least every night.  
Autovacuum is now also triggered by INSERTs, so we can also  
remove the recommendation to run VACUUM (ANALYZE) after lots  
of INSERTs or DELETEs.  
  
Instead, suggest using autovacuum by moving the respective  
paragraph up to where the importance of VACUUM is emphasized.  
  
Author: Laurenz Albe <[email protected]>  
Reviewed-By: Magnus Hagander, Peter Geoghegan  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/vacuum.sgml

PL/Python: Update guide to alternative expected files

commit   : d28e26bbe288c786d8211d8c526c34c775170dea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 12:53:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 12:53:05 +0200    

Click here for diff

plpython_unicode_3.out was already removed a long time ago, so it  
being listed here was very out of date.  
  
plpython_types_3.out was removed with the Python 2 removal.  

M src/pl/plpython/expected/README

pg_upgrade: Fix version comparison for global ICU support

commit   : fa06a34d14ea053e1e405a6ab2a1c3f1631c3a5e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 09:06:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 09:06:44 +0200    

Click here for diff

Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_upgrade/info.c

doc: Mention attribute "inherited" in pg_stats_ext[_exprs]

commit   : 401f623c7b14890011b9bb9dda7639b1de4d40ad    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Jun 2022 15:33:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Jun 2022 15:33:39 +0900    

Click here for diff

These have been added in 269b532, but the documentation did not reflect  
that.  
  
Author: Noriyoshi Shinoda  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/DM4PR84MB17349C4E7D88A68264C18AF3EED69@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

Translation updates

commit   : 3c0bcdbc663ebf00e3da57ae32361f21b6af495d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 08:19:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 27 Jun 2022 08:19:02 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 46c120873f1e906cc8dab74d8d756417e1b367f6  

M src/backend/po/de.po
M src/backend/po/ja.po
M src/backend/po/sv.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_waldump/po/de.po
M src/bin/pg_waldump/po/ja.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ja.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/ja.po

Fix visibility check when XID is committed in CLOG but not in procarray.

commit   : adf6d5dfb2094cc2bb28b4dea0565dcd0e775ed9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jun 2022 08:21:08 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 27 Jun 2022 08:21:08 +0300    

Click here for diff

TransactionIdIsInProgress had a fast path to return 'false' if the  
single-item CLOG cache said that the transaction was known to be  
committed. However, that was wrong, because a transaction is first  
marked as committed in the CLOG but doesn't become visible to others  
until it has removed its XID from the proc array. That could lead to an  
error:  
  
    ERROR:  t_xmin is uncommitted in tuple to be updated  
  
or for an UPDATE to go ahead without blocking, before the previous  
UPDATE on the same row was made visible.  
  
The window is usually very short, but synchronous replication makes it  
much wider, because the wait for synchronous replica happens in that  
window.  
  
Another thing that makes it hard to hit is that it's hard to get such  
a commit-in-progress transaction into the single item CLOG cache.  
Normally, if you call TransactionIdIsInProgress on such a transaction,  
it determines that the XID is in progress without checking the CLOG  
and without populating the cache. One way to prime the cache is to  
explicitly call pg_xact_status() on the XID. Another way is to use a  
lot of subtransactions, so that the subxid cache in the proc array is  
overflown, making TransactionIdIsInProgress rely on pg_subtrans and  
CLOG checks.  
  
This has been broken ever since it was introduced in 2008, but the race  
condition is very hard to hit, especially without synchronous  
replication. There were a couple of reports of the error starting from  
summer 2021, but no one was able to find the root cause then.  
  
TransactionIdIsKnownCompleted() is now unused. In 'master', remove it,  
but I left it in place in backbranches in case it's used by extensions.  
  
Also change pg_xact_status() to check TransactionIdIsInProgress().  
Previously, it only checked the CLOG, and returned "committed" before  
the transaction was actually made visible to other queries. Note that  
this also means that you cannot use pg_xact_status() to reproduce the  
bug anymore, even if the code wasn't fixed.  
  
Report and analysis by Konstantin Knizhnik. Patch by Simon Riggs, with  
the pg_xact_status() change added by me.  
  
Author: Simon Riggs  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/flat/4da7913d-398c-e2ad-d777-f752cf7f0bbb%40garret.ru  

M src/backend/access/transam/transam.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/xid8funcs.c
M src/include/access/transam.h

Fix relptr's encoding of the base address.

commit   : 7201cd18627afc64850537806da7f22150d1a83b    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Jun 2022 10:30:15 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Jun 2022 10:30:15 +1200    

Click here for diff

Previously, we encoded both NULL and the first byte at the base address  
as 0.  That confusion led to the assertion in commit e07d4ddc, which  
failed when min_dynamic_shared_memory was used.  Give them distinct  
encodings, by switching to 1-based offsets for non-NULL pointers.  Also  
improve macro hygiene in passing (missing/misplaced parentheses), and  
remove open-coded access to the raw offset value from freepage.c/h.  
  
Although e07d4ddc was back-patched to 10, the only code that actually  
makes use of relptr at the base address arrived in 84b1c63a, so no need  
to back-patch further than 14 for now.  
  
Reported-by: Justin Pryzby <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/20220519193839.GT19626%40telsasoft.com  

M src/backend/utils/mmgr/freepage.c
M src/include/utils/freepage.h
M src/include/utils/relptr.h

Harden range_table_mutator() against null RangeTblEntry.subquery.

commit   : ebc584ed495d7ad3a3f33db4e75d9543ff6a87d1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2022 08:58:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Jun 2022 08:58:05 -0400    

Click here for diff

Commit 64919aaab made pull_up_simple_subquery set rte->subquery = NULL  
after doing the deed, so that we don't waste cycles copying a  
now-useless subquery tree around.  This turns out to create a core dump  
hazard in range_table_mutator, which supposes that that field is never  
NULL.  Apparently none of our own code invokes query_tree_mutator or  
range_table_mutator on the top Query after subquery pullup; but it  
wouldn't be surprising if outside code does, and anyway I'm working  
on a v16 patch that will need it.  
  
We can fix this cleanly by just getting rid of the special-case  
handling of this field and treating it more like all the rest.  
I think the special case might be left over from a time when  
QTW_DONT_COPY_QUERY was the default behavior, but that was eons ago.  
  
Thanks to Dean Rasheed for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c

Don't trust signalfd() on illumos.

commit   : 3ab4fc5dcf30ebc90a23ad878342dc528e2d25ce    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 26 Jun 2022 10:40:06 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 26 Jun 2022 10:40:06 +1200    

Click here for diff

Since commit 6a2a70a02, we've used signalfd() to receive latch wakeups  
when building with WAIT_USE_EPOLL (default for Linux and illumos), and  
our traditional self-pipe when falling back to WAIT_USE_POLL (default  
for other Unixes with neither epoll() nor kqueue()).  
  
Unexplained hangs and kernel panics have been reported on illumos  
systems, apparently linked to this use of signalfd(), leading illumos  
users and build farm members to have to define WAIT_USE_POLL explicitly  
as a work-around.  A bug report exists at  
https://www.illumos.org/issues/13700 but no fix is available yet.  
  
Let's provide a way for illumos users to go back to self-pipes with  
epoll(), like releases before 14, and choose that by default.  No change  
for Linux users.  To help with development/debugging, macros  
WAIT_USE_{EPOLL,POLL} and WAIT_USE_{SIGNALFD,SELF_PIPE} can be defined  
explicitly to override the defaults.  
  
Back-patch to 14, where we started using signalfd().  
  
Reported-by: Japin Li <[email protected]>  
Reported-by: Olaf Bohlen <[email protected]> (off-list)  
Reviewed-by: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/MEYP282MB1669C8D88F0997354C2313C1B6CA9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/storage/ipc/latch.c

CREATE INDEX: use the original userid for more ACL checks.

commit   : 00377b9a02b89a831ae50e1c718d34565356698f    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Jun 2022 09:07:41 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Jun 2022 09:07:41 -0700    

Click here for diff

Commit a117cebd638dd02e5c2e791c25e43745f233111b used the original userid  
for ACL checks located directly in DefineIndex(), but it still adopted  
the table owner userid for more ACL checks than intended.  That broke  
dump/reload of indexes that refer to an operator class, collation, or  
exclusion operator in a schema other than "public" or "pg_catalog".  
Back-patch to v10 (all supported versions), like the earlier commit.  
  
Nathan Bossart and Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/Makefile
A contrib/citext/expected/create_index_acl.out
A contrib/citext/sql/create_index_acl.sql
M src/backend/commands/indexcmds.c

Use --no-unlogged-table-data in t/027_stream_regress.pl.

commit   : 2f2e24d90c402738765cb7a458bfc459138ae6b9    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 25 Jun 2022 09:07:41 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 25 Jun 2022 09:07:41 -0700    

Click here for diff

This removes the need to drop unlogged relations in the src/test/regress  
suite, like commit dec8ad367e46180f826d5b6dc820fbecba1b71d2 did.  
  
Reviewed by Thomas Munro.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/027_stream_regress.pl

Remove unportable test

commit   : 901a9d53011573e45cd7b87682f0520ef3b0fd2d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jun 2022 13:03:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 24 Jun 2022 13:03:59 +0200    

Click here for diff

The ssl test "IPv4 host with CIDR mask does not match" apparently has  
a portability problem.  Some operating systems don't reject the host  
name specification "192.0.2.1/32" as an IP address, and that is then  
later rejected when the SNI is set, which results in a different error  
message that the test is supposed to verify.  
  
The value of the test has been questioned in the discussion, and it  
was suggested that removing it would be an acceptable fix, so that's  
what this is doing.  
  
Reported-by: Nazir Bilal Yavuz <[email protected]>  
Bug: #17522  
Discussion: https://www.postgresql.org/message-id/flat/17522-bfcd5c603b5f4daa%40postgresql.org  

M src/test/ssl/t/001_ssltests.pl

Fix intermetent test failure in 028_row_filter.pl.

commit   : 1f50918a6fb02207d151e7cb4aae4c36de9d827c    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 24 Jun 2022 09:21:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 24 Jun 2022 09:21:24 +0530    

Click here for diff

The test was not waiting for the subscriber's data synchronization to  
happen after refreshing the publication on the subscriber side. This leads  
subscriber's apply worker to skip applying the changes on the  
corresponding relation which results in a test failure.  
  
Reported-by: Hou Zhijie, as per buildfarm  
Author: Hou Zhijie  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716A69496A8E2F2E155DB8D94B59@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/test/subscription/t/028_row_filter.pl

Doc: clarify that tablesync ignores publish operation.

commit   : 1ce34519c79e9eed1b6b8dd2f47ae95564e739d7    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 24 Jun 2022 08:37:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 24 Jun 2022 08:37:26 +0530    

Click here for diff

This patch documents that the initial data synchronization (tablesync) for  
logical replication does not take into account the publication 'publish'  
parameter when copying the existing table data.  
  
Author: Peter Smith  
Reviewed-by: Shi yu, Euler Taveira, Robert Haas, Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PtbfALjFpS2MkrvQ+wWQKByP7CNh9RtFta-r=BHEU3S3w@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml

Fix missing newline at end of message

commit   : 75f2171e6c8fa4e1f0ce4fdbf907ee7d0fcb404d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jun 2022 22:40:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jun 2022 22:40:52 +0200    

Click here for diff

M src/bin/pg_upgrade/util.c

Fix typo in pg_publication.c

commit   : 52b5c53ae8ca63449788dea31d766895ba9c8553    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Jun 2022 16:42:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Jun 2022 16:42:27 +0900    

Click here for diff

Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PuV2XXjC4spHXy_EOhpD6MDrmmDMWnVJLYpd1_P=2+mJw@mail.gmail.com  

M src/backend/catalog/pg_publication.c

commit   : 41a2b56ae80bd13bc4cb09c48c6f873fd4382e05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jun 2022 08:59:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Jun 2022 08:59:27 +0200    

Click here for diff

It has been reported that PL/Tcl built on macOS with GCC >=11 crashes.  
The reason is that there is a hash_search() function in the operating  
system's libraries, and that ends up being called instead of the one  
in postgres.  This has something to do with how the linker resolves  
references between the various possibilities it has been given, and  
somehow something changed that it is now picking that one in this  
configuration.  
  
We found that removing the -lc from the link command line fixes this  
problem.  The -lc was introduced a long time ago in commit  
e3909672f12e0ddf3e202b824fda068ad2195ef2, and we think the reasons  
might be obsolete, so we decided that we'll try to just remove it and  
see if any problems arise.  
  
Discussion: https://www.postgresql.org/message-id/flat/a78c847a-4f79-9286-be99-e819e9e4139e%40enterprisedb.com  

M src/pl/tcl/Makefile

Fix memory leak due to LogicalRepRelMapEntry.attrmap.

commit   : ac0e2d387a044faed310cbfe2fae78ecb0f6a4b6    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 23 Jun 2022 09:23:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 23 Jun 2022 09:23:46 +0530    

Click here for diff

When rebuilding the relation mapping on subscribers, we were not releasing  
the attribute mapping's memory which was no longer required.  
  
The attribute mapping used in logical tuple conversion was refactored in  
PG13 (by commit e1551f96e6) but we forgot to update the related code that  
frees the attribute map.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Langote, Amit Kapila, Shi yu  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/relation.c

Fix two issues with HEADER MATCH in COPY

commit   : ca7a0d1d368216e89359c63531a4df0b99a437e4    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 Jun 2022 10:49:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 Jun 2022 10:49:20 +0900    

Click here for diff

072132f0 used the attnum offset to access the raw_fields array when  
checking that the attribute names of the header and of the relation  
match, leading to incorrect results or even crashes if the attribute  
numbers of a relation are changed, like on a dropped attribute.  This  
fixes the logic to use the correct attribute names for the header  
matching requirements.  
  
Also, this commit disallows HEADER MATCH in COPY TO as there is no  
validation that can be done in this case.  
  
The tests are expanded for HEADER MATCH with COPY FROM and dropped  
columns, with cases where a relation has a dropped and re-added column,  
as well as a reduced set of columns.  
  
Author: Julien Rouhaud  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/20220607154744.vvmitnqhyxrne5ms@jrouhaud  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

pgstat: Mention pgstat_replslot.c in pgstat.c.

commit   : eba331ae2aad781d498f8a424a12185146c7f1f7    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 22 Jun 2022 16:50:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 22 Jun 2022 16:50:14 -0700    

Click here for diff

Oversight, by me, in commit 5891c7a8ed8.  
  
Author: "Drouvot, Bertrand" <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat.c

doc: improve wording of plpgsql RAISE format text

commit   : 0b135e4c2ec9b8dbdcf1d01a40d11e27afbeef54    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Jun 2022 16:59:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Jun 2022 16:59:54 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/plpgsql.sgml

doc: clarify wording about phantom reads

commit   : a9a230e623e551889b325bc5d50d9929e4d11a22    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Jun 2022 14:33:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Jun 2022 14:33:26 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/mvcc.sgml

amcheck: Fix incorrect use of VARATT_IS_COMPRESSED.

commit   : e243de03fb4583dd4a9f0afb41493727d7946c02    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 22 Jun 2022 13:11:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 22 Jun 2022 13:11:49 -0400    

Click here for diff

The macro is being applied to a TOAST pointer, not a varlena header.  
Therefore the use of VARATT_IS_COMPRESSED() is wrong. We can check  
VARATT_EXTERNAL_IS_COMPRESSED(), but then we don't need the length  
check that follows.  
  
Report and fix by Kyotaro Horiguchi.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/amcheck/verify_heapam.c

doc: Clean up title case use

commit   : 9f0b953457012a41321ab62cffa6aeabcb6e99b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Jun 2022 14:24:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Jun 2022 14:24:48 +0200    

Click here for diff

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/pgbench.sgml

Simplify tab completion of extension versions.

commit   : 662dbe2c8657b01b436105754dff918a39a67365    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2022 12:04:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Jun 2022 12:04:11 -0400    

Click here for diff

Second thoughts about 9cd43f6cb: given that we're staying bug-compatible  
with the old behavior of using double not single quotes for extension  
versions, we can simplify this completion code by pretending that  
extension versions *are* identifiers, and not using VERBATIM.  Then  
_complete_from_query() will think that the query results are identifiers  
in need of quoting, and we end up with the same behavior as before.  
  
This doesn't work for Query_for_list_of_available_extension_versions_with_TO,  
but let's just drop that: there is no other place where we handle  
multi-keyword phrases that way, and it doesn't seem very desirable here  
either.  Handle completion of "UPDATE TO" in our more usual pattern.  
  
Discussion: https://postgr.es/m/CAMkU=1yV+egSYrzWvbDY8VZ6bKEMrKbzxr-HTuiHi+wDgSUMgA@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix stale values in partition map entries on subscribers.

commit   : 75bfe7434d415fcd7e879a187f9e8dfcd3e0b017    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 21 Jun 2022 15:39:35 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 21 Jun 2022 15:39:35 +0530    

Click here for diff

We build the partition map entries on subscribers while applying the  
changes for update/delete on partitions. The component relation in each  
entry is closed after its use so we need to update it on successive use of  
cache entries.  
  
This problem was there since the original commit f1ac27bfda that  
introduced this code but we didn't notice it till the recent commit  
26b3455afa started to use the component relation of partition map cache  
entry.  
  
Reported-by: Tom Lane, as per buildfarm  
Author: Amit Langote, Hou Zhijie  
Reviewed-by: Amit Kapila, Shi Yu  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/relation.c

doc: Make some synopsis punctuation consistent

commit   : 26a6d1495c6876fc2cb69f39d7d6d56f6f3baa4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jun 2022 11:21:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 21 Jun 2022 11:21:04 +0200    

Click here for diff

M doc/src/sgml/ref/merge.sgml

Fix partition table's REPLICA IDENTITY checking on the subscriber.

commit   : 26b3455afaa968fb48d0e468528d79de56624559    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 21 Jun 2022 08:07:43 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 21 Jun 2022 08:07:43 +0530    

Click here for diff

In logical replication, we will check if the target table on the  
subscriber is updatable by comparing the replica identity of the table on  
the publisher with the table on the subscriber. When the target table is a  
partitioned table, we only check its replica identity but not for the  
partition tables. This leads to assertion failure while applying changes  
for update/delete as we expect those to succeed only when the  
corresponding partition table has a primary key or has a replica  
identity defined.  
  
Fix it by checking the replica identity of the partition table while  
applying changes.  
  
Reported-by: Shi Yu  
Author: Shi Yu, Hou Zhijie  
Reviewed-by: Amit Langote, Amit Kapila  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/test/subscription/t/013_partition.pl

Fix file references inside some SGML comments

commit   : 2253f5b49748ff7b48ccc67260c84cbca99db688    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Jun 2022 14:33:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Jun 2022 14:33:41 +0200    

Click here for diff

In some cases, the comments mentioning their own file or another file  
were not correct.  
  
Author: Josh Soref <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CACZqfqCyhE-voJUrUkc3GQuDakfJKx1ViiCdY7B8tQwyL6727g%40mail.gmail.com  

M doc/src/sgml/appendix-obsolete-default-roles.sgml
M doc/src/sgml/appendix-obsolete-pgreceivexlog.sgml
M doc/src/sgml/appendix-obsolete-pgresetxlog.sgml
M doc/src/sgml/appendix-obsolete-pgxlogdump.sgml
M doc/src/sgml/appendix-obsolete-recovery-config.sgml
M doc/src/sgml/appendix-obsolete.sgml
M doc/src/sgml/backup-manifest.sgml

relnotes: simplify wording of pg_basebackup compression item

commit   : 2adeaa809cd40f527f3949bd062759d26de7df19    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 19 Jun 2022 18:05:27 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 19 Jun 2022 18:05:27 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

Message and documentation refinements

commit   : 660ee7bec276b69605b3c997ee740d5d386ad2c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 19 Jun 2022 17:39:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 19 Jun 2022 17:39:50 +0200    

Click here for diff

M doc/src/sgml/protocol.sgml
M src/bin/psql/describe.c
M src/test/regress/expected/subscription.out

Fix busted tab completion of extension versions.

commit   : 9cd43f6cbd8b6fbac6837bcdba5e12f0ecbafefb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2022 19:45:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 Jun 2022 19:45:38 -0400    

Click here for diff

In 02b8048ba I (tgl) got rid of the need for most tab-completion queries  
to return pre-quoted identifiers.  But I over-hastily removed the  
quote_ident call from Query_for_list_of_available_extension_versions*  
too; those still need it, because what is returned isn't an identifier  
at all and will (almost?) always need quoting.  
  
Arguably we should use quote_literal here instead.  But quote_ident  
works too and people may be used to that behavior, so stick with it.  
  
In passing, fix inconsistent omission of schema-qualification in  
Query_for_list_of_encodings.  That's not a security issue per our  
current guidelines, but it ought to be like the rest.  
  
Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1yV+egSYrzWvbDY8VZ6bKEMrKbzxr-HTuiHi+wDgSUMgA@mail.gmail.com  

M src/bin/psql/tab-complete.c

doc: Do s/int/integer/ to describe the type of some GUC parameters

commit   : 7bd4a9e9901966fb35acd509af0d468881aa5d22    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Jun 2022 09:03:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Jun 2022 09:03:07 +0900    

Click here for diff

Three parameters have been using "int" rather than "integer" to describe  
their type:  
auth_delay.milliseconds  
max_logical_replication_workers  
pg_prewarm.autoprewarm_interval  
  
This is inconsistent with any other integer GUCs listed in the docs  
(148, as far as I can see).  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pv6X5T-veN2abUDUvBxZm+SSm-9otfi3LZPGyOc6u6hiA@mail.gmail.com  

M doc/src/sgml/auth-delay.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/pgprewarm.sgml

Revert changes in HOT handling of BRIN indexes

commit   : e3fcca0d0d2414f3a50d6fd40eddf48b7df81475    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 16 Jun 2022 15:02:48 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 16 Jun 2022 15:02:48 +0200    

Click here for diff

This reverts commits 5753d4ee32 and fe60b67250 that modified HOT to  
ignore BRIN indexes. The commit message for 5753d4ee32 claims that:  
  
    When determining whether an index update may be skipped by using  
    HOT, we can ignore attributes indexed only by BRIN indexes. There  
    are no index pointers to individual tuples in BRIN, and the page  
    range summary will be updated anyway as it relies on visibility  
    info.  
  
This is partially incorrect - it's true BRIN indexes don't point to  
individual tuples, so HOT chains are not an issue, but the visibitlity  
info is not sufficient to keep the index up to date. This can easily  
result in corrupted indexes, as demonstrated in the hackers thread.  
  
This does not mean relaxing the HOT restrictions for BRIN is a lost  
cause, but it needs to handle the two aspects (allowing HOT chains and  
updating the page range summaries) as separate. But that requires a  
major changes, and it's too late for that in the current dev cycle.  
  
Reported-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/utils/cache/relcache.c
M src/include/access/amapi.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/regress/expected/brin.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/stats.sql

Fix comment in regression tests for large objects

commit   : 664da2a389e5d1d4ebf0f98c82997739cd496e8e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Jun 2022 17:21:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Jun 2022 17:21:04 +0900    

Click here for diff

The values assigned to INV_WRITE and INV_READ were reversed in the  
tests, which would be confusing when writing tests specific to read or  
write operations on LOs.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/largeobject.out
M src/test/regress/expected/largeobject_1.out
M src/test/regress/sql/largeobject.sql

Fix data inconsistency between publisher and subscriber.

commit   : b7658c24c7c1ffad131a7fdf67ce7fc008be1177    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 16 Jun 2022 08:45:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 16 Jun 2022 08:45:07 +0530    

Click here for diff

We were not updating the partition map cache in the subscriber even when  
the corresponding remote rel is changed. Due to this data was getting  
incorrectly replicated for partition tables after the publisher has  
changed the table schema.  
  
Fix it by resetting the required entries in the partition map cache after  
receiving a new relation mapping from the publisher.  
  
Reported-by: Shi Yu  
Author: Shi Yu, Hou Zhijie  
Reviewed-by: Amit Langote, Amit Kapila  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalrelation.h
M src/test/subscription/t/013_partition.pl

commit   : ffffeebf244770a9450d9fe2597abde725a9b984    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jun 2022 16:54:38 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 15 Jun 2022 16:54:38 +0200    

Click here for diff

In addition, this moves the new paragraph in the MVCC page upwards, for  
a more consistent flow; some minor markup mistakes, style issues and  
typos are fixed too.  
  
Per comments from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/merge.sgml

Re-add locally-generated files in pg_upgrade's .gitignore and Makefile

commit   : a059e15cdeef3e8de9a34de48c49c29d398bf4e8    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Jun 2022 15:36:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Jun 2022 15:36:16 +0900    

Click here for diff

This reverts the changes to pg_upgrade's Makefile and .gitignore done in  
15b6d21.  The TAP tests run in isolation, executing pg_upgrade in  
tmp_check/ in the build directory so as any files created in the  
execution path (reindex_hash.sql and delete_old_cluster.{sh,bat}) are  
never in the tree, so entries are not necessary in this case.  However,  
not having these impacts the cleanliness of the code tree when running  
./pg_upgrade directly from src/bin/pg_upgrade/.  
  
This commit adds back to .gitignore all the files generated in the  
execution path, and the Makefile rule to clean them up if they exist.  
  
Per gripe from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/.gitignore
M src/bin/pg_upgrade/Makefile

Fix cache look-up failures while applying changes in logical replication.

commit   : 5a97b1325453d641a795710a92b233c665b662b1    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 15 Jun 2022 09:52:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 15 Jun 2022 09:52:12 +0530    

Click here for diff

While building a new attrmap which maps partition attribute numbers to  
remoterel's, we incorrectly update the map for dropped column attributes.  
Later, it caused cache look-up failure when we tried to use the map to  
fetch the information about attributes.  
  
This also fixes the partition map cache invalidation which was using the  
wrong type cast to fetch the entry. We were using stale partition map  
entry after invalidation which leads to the assertion or cache look-up  
failure.  
  
Reported-by: Shi Yu  
Author: Hou Zhijie, Shi Yu  
Reviewed-by: Amit Langote, Amit Kapila  
Backpatch-through: 13, where it was introduced  
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/relation.c
M src/test/subscription/t/013_partition.pl

Tweak behavior of psql --single-transaction depending on ON_ERROR_STOP

commit   : a3ff08e0b08dbfeb777ccfa8f13ebaa95d064c04    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Jun 2022 11:24:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Jun 2022 11:24:52 +0900    

Click here for diff

This commit, in completion of 157f873, forces a ROLLBACK for  
--single-transaction only when ON_ERROR_STOP is used when one of the  
steps defined by -f/-c fails.  Hence, COMMIT is always used when  
ON_ERROR_STOP is not set, ignoring the status code of the last action  
taken in the set of switches specified by -c/-f (previously ROLLBACK  
would have been issued even without ON_ERROR_STOP if the last step  
failed, while COMMIT was issued if a step in-between failed as long as  
the last step succeeded, leading to more inconsistency).  
  
While on it, this adds much more test coverage in this area when not  
using ON_ERROR_STOP with multiple switch patterns involving -c and -f  
for query files, single queries and slash commands.  
  
The behavior of ON_ERROR_STOP is arguably a bug, but there was no much  
support for a backpatch to force a ROLLBACK on a step failure, so this  
change is done only on HEAD for now.  
  
Per discussion with Tom Lane and Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl

Avoid ecpglib core dump with out-of-order operations.

commit   : ba412c905af14699a128a7bcd8ce5234adb93ceb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2022 18:16:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2022 18:16:46 -0400    

Click here for diff

If an application executed operations like EXEC SQL PREPARE  
without having first established a database connection, it could  
get a core dump instead of the expected clean failure.  This  
occurred because we did "pthread_getspecific(actual_connection_key)"  
without ever having initialized the TSD key actual_connection_key.  
The results of that are probably platform-specific, but at least  
on Linux it often leads to a crash.  
  
To fix, add calls to ecpg_pthreads_init() in the code paths that  
might use actual_connection_key uninitialized.  It's harmless  
(and hopefully inexpensive) to do that more than once.  
  
Per bug #17514 from Okano Naoki.  The problem's ancient, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/connect.c

Doc: clarify the default collation behavior of domains.

commit   : d26ac35d0d7cb42a0453e69e0e9ce6d163b55927    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2022 17:47:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Jun 2022 17:47:09 -0400    

Click here for diff

The previous wording was "the underlying data type's default collation  
is used", which is wrong or at least misleading.  The domain inherits  
the base type's collation behavior, which if "default" actually can  
mean that we use some non-default collation obtained from elsewhere.  
  
Per complaint from Jian He.  
  
Discussion: https://postgr.es/m/CACJufxHMR8_4WooDPjjvEdaxB2hQ5a49qthci8fpKP0MKemVRQ@mail.gmail.com  

M doc/src/sgml/ref/create_domain.sgml

pg_upgrade: further tweaking of make_outputdirs().

commit   : 4e54d231aecb68cf64daf56ab7851c699719762e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2022 14:28:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Jun 2022 14:28:05 -0400    

Click here for diff

Use the same error message for all cases of pathname overrun,  
since users aren't going to much care which one was too long.  
Add missing newline to said error (as pg_upgrade's version  
of pg_fatal requires that).  
Add pathname overrun checks for the individual log files,  
not just the directories.  
Remove initial newline in log files; the new scheme here  
guarantees that we'll never be appending to an old file.  
  
Kyotaro Horiguchi and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/pg_upgrade.c

Make subscription tests pass with log_error_verbosity=verbose

commit   : 19408aae7fa2bf28866fb262b27f08405e71152e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 12 Jun 2022 09:17:17 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 12 Jun 2022 09:17:17 -0400    

Click here for diff

Recent additions to the subscription tests check for log entries, but  
fail to account for the possible presence of an SQL errror code, which  
happens if log_error_verbosity is set to 'verbose'. Add this into the  
regular expressions that are checked for.  

M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/029_on_error.pl

relnotes: update word wrapping

commit   : 0d932a9d990fdb78d58abc42c03a1e84cfa2facd    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 15:28:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 15:28:20 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

relnotes: update AS OF date

commit   : 4d3b4d7bfa39420c12dd8af9269a5b68f006011f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 14:59:18 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 14:59:18 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

commit   : 9dcae643698f0a0caf77e40181c7af278e146ea7    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 14:37:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 11 Jun 2022 14:37:50 -0400    

Click here for diff

M doc/src/sgml/func.sgml
M doc/src/sgml/release-15.sgml

relnotes: add markup of text

commit   : d43cafaf4990e220d2f71fee4da276e98b874e91    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 Jun 2022 13:40:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 Jun 2022 13:40:50 -0400    

Click here for diff

Doc link additions coming  

M doc/src/sgml/release-15.sgml

Un-break whole-row Vars referencing domain-over-composite types.

commit   : 1218780ccebace6a4c4d5872d7b158aa36e6882e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2022 10:35:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Jun 2022 10:35:57 -0400    

Click here for diff

In commit ec62cb0aa, I foolishly replaced ExecEvalWholeRowVar's  
lookup_rowtype_tupdesc_domain call with just lookup_rowtype_tupdesc,  
because I didn't see how a domain could be involved there, and  
there were no regression test cases to jog my memory.  But the  
existing code was correct, so revert that change and add a test  
case showing why it's necessary.  (Note: per comment in struct  
DatumTupleFields, it is correct to produce an output tuple that's  
labeled with the base composite type, not the domain; hence just  
blindly looking through the domain is correct here.)  
  
Per bug #17515 from Dan Kubb.  Back-patch to v11 where domains over  
composites became a thing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Fix collation of JSON_TABLE output columns

commit   : 21724558650a7387ffbc2b0da53d6314389419bb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 Jun 2022 06:05:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 Jun 2022 06:05:08 +0200    

Click here for diff

The output columns of JSON_TABLE should have the collations of their  
data type.  The existing implementation sets the default collation if  
the type is collatable.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/9d75ce67-0121-5050-5bec-bf5009db55ce%40enterprisedb.com  

M src/backend/parser/parse_jsontable.c

Improve comments for trivial_subqueryscan().

commit   : 4a8a5dd7f59cd8dd9969cef1969cb5f7c5124eec    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 9 Jun 2022 19:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 9 Jun 2022 19:30:00 +0900    

Click here for diff

This function can be called from mark_async_capable_plan(), a helper  
function for create_append_plan(), before set_subqueryscan_references(),  
to determine the triviality of a SubqueryScan that is a child of an  
Append plan node, which is done before doing finalize_plan() on the  
SubqueryScan (if necessary) and set_plan_references() on the subplan,  
unlike when called from set_subqueryscan_references().  The reason why  
this is safe wouldn't be that obvious, so add comments explaining this.  
  
Follow-up for commit c2bb02bc2.  
  
Reviewed by Zhihong Yu.  
  
Discussion: https://postgr.es/m/CAPmGK17%2BGiJBthC6va7%2B9n6t75e-M1N0U18YB2G1B%2BE5OdrNTA%40mail.gmail.com  

M src/backend/optimizer/plan/setrefs.c

psql: Show notices immediately (again)

commit   : e77de23fbb0f4ef27090c144edcfa889bb2a06d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Jun 2022 08:49:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Jun 2022 08:49:13 +0200    

Click here for diff

The new show-all-results feature in psql (7844c9918) went out of its  
way to show notices next to the results of the statements (in a  
multi-statement string) that caused them.  This also had the  
consequence that notices for a single statement were not shown until  
after the statement had executed, instead of right away.  After some  
discussion, it seems very difficult to satisfy both of these goals, so  
here we are giving up on the first goal and just show the notices as  
we get them.  This restores the pre-7844c9918 behavior for notices.  
  
Reported-by: Alastair McKinley <[email protected]>  
Author: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/PAXPR02MB760039506C87A2083AD85575E3DA9%40PAXPR02MB7600.eurprd02.prod.outlook.com  

M src/bin/psql/common.c
M src/test/regress/expected/psql.out

Be more careful about GucSource for internally-driven GUC settings.

commit   : 7ab5b4eb483478bc85ad45ef5405b4a70c3f4c94    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Jun 2022 13:26:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Jun 2022 13:26:18 -0400    

Click here for diff

The original advice for hard-wired SetConfigOption calls was to use  
PGC_S_OVERRIDE, particularly for PGC_INTERNAL GUCs.  However,  
that's really overkill for PGC_INTERNAL GUCs, since there is no  
possibility that we need to override a user-provided setting.  
Instead use PGC_S_DYNAMIC_DEFAULT in most places, so that the  
value will appear with source = 'default' in pg_settings and thereby  
not be shown by psql's new \dconfig command.  The one exception is  
that when changing in_hot_standby in a hot-standby session, we still  
use PGC_S_OVERRIDE, because people felt that seeing that in \dconfig  
would be a good thing.  
  
Similarly use PGC_S_DYNAMIC_DEFAULT for the auto-tune value of  
wal_buffers (if possible, that is if wal_buffers wasn't explicitly  
set to -1), and for the typical 2MB value of max_stack_depth.  
  
In combination these changes remove four not-very-interesting  
entries from the typical output of \dconfig, all of which people  
fingered as "why is that showing up?" in the discussion thread.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Doc: copy-edit "jsonb Indexing" section.

commit   : abed46aea4739c78802ab2ce5e93dc9a7e23c113    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Jun 2022 12:01:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Jun 2022 12:01:51 -0400    

Click here for diff

The patch introducing jsonpath dropped a para about that between  
two related examples, and didn't bother updating the introductory  
sentences that it falsified.  The grammar was pretty shaky as well.  

M doc/src/sgml/json.sgml

Put option listing back into alphabetical order

commit   : b46e8a83e978c7f7edfe70b3a47bca3e9806e101    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jun 2022 15:35:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Jun 2022 15:35:44 +0200    

Click here for diff

M doc/src/sgml/ref/pgbench.sgml

Fix portability issue in TAP tests of psql for locales

commit   : ca899d98b4aa50d80df9232c5c6ea9e4038cdf48    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Jun 2022 11:24:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Jun 2022 11:24:06 +0900    

Click here for diff

Some locales use a comma as decimal separator (like Czech or French),  
and psql's 001_basic.pl for \timing was not able to handle that  
properly.  This fixes the matching regexes to be able to handle both  
comma and dot as possible decimal separators, as per a suggestion from  
Andrew Dunstan.  
  
psql tests were the only place with such a portability issue  
(check-world passed here with a forced LANG/LANGUAGE).  These tests are  
new as of c0280bc, so there is no need for a backpatch.  
  
Reported-by: Pavel Stehule  
Discussion: https://postgr.es/m/CAFj8pRBz8iQmd2aOaCLvO-rJY6vZr-h6Q0qvV0J+yb78J7uiaA@mail.gmail.com  

M src/bin/psql/t/001_basic.pl

Restructure pg_upgrade output directories for better idempotence

commit   : 4fff78f00910af0137f9de7532f8eb21d08ab1c3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Jun 2022 10:53:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Jun 2022 10:53:01 +0900    

Click here for diff

38bfae3 has moved the contents written to files by pg_upgrade under a  
new directory called pg_upgrade_output.d/ located in the new cluster's  
data folder, and it used a simple structure made of two subdirectories  
leading to a fixed structure: log/ and dump/.  This design has made  
weaker pg_upgrade on repeated calls, as we could get failures when  
creating one or more of those directories, while potentially losing the  
logs of a previous run (logs are retained automatically on failure, and  
cleaned up on success unless --retain is specified).  So a user would  
need to clean up pg_upgrade_output.d/ as an extra step for any repeated  
calls of pg_upgrade.  The most common scenario here is --check followed  
by the actual upgrade, but one could see a failure when specifying an  
incorrect input argument value.  Removing entirely the logs would have  
the disadvantage of removing all the past information, even if --retain  
was specified at some past step.  
  
This result is annoying for a lot of users and automated upgrade flows.  
So, rather than requiring a manual removal of pg_upgrade_output.d/, this  
redesigns the set of output directories in a more dynamic way, based on  
a suggestion from Tom Lane and Daniel Gustafsson.  pg_upgrade_output.d/  
is still the base path, but a second directory level is added, mostly  
named after an ISO-8601-formatted timestamp (in short human-readable,  
with milliseconds appended to the name to avoid any conflicts).  The  
logs and dumps are saved within the same subdirectories as previously,  
as of log/ and dump/, but these are located inside the subdirectory  
named after the timestamp.  
  
The logs of a given run are removed only after a successful run if  
--retain is not used, and pg_upgrade_output.d/ is kept if there are any  
logs from a previous run.  Note that previously, pg_upgrade would have  
kept the logs even after a successful --check but that was inconsistent  
compared to the case without --check when using --retain.  The code in  
charge of the removal of the output directories is now refactored into a  
single routine.  
  
Two TAP tests are added with some --check commands (one failure case and  
one success case), to look after the issue fixed here.  Note that the  
tests had to be tweaked a bit to fit with the new directory structure so  
as it can find any logs generated on failure.  This is still going to  
require a change in the buildfarm client for the case where pg_upgrade  
is tested without the TAP test, though, but I'll tackle that with a  
separate patch where needed.  
  
Reported-by: Tushar Ahuja  
Author: Michael Paquier  
Reviewed-by: Daniel Gustafsson, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/util.c

Harden Memoization code against broken data types

commit   : fa5185b26c45afb8407bca2941bec95e0aef862b    
  
author   : David Rowley <[email protected]>    
date     : Wed, 8 Jun 2022 12:39:09 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 8 Jun 2022 12:39:09 +1200    

Click here for diff

Bug #17512 highlighted that a suitably broken data type could cause the  
backend to crash if either the hash function or equality function were in  
someway non-deterministic based on their input values.  Such a data type  
could cause a crash of the backend due to some code which assumes that  
we'll always find a hash table entry corresponding to an item in the  
Memoize LRU list.  
  
Here we remove the assumption that we'll always find the entry  
corresponding to the given LRU list item and add run-time checks to verify  
we have found the given item in the cache.  
  
This is not a fix for bug #17512, but it will turn the crash reported by  
that bug report into an internal ERROR.  
  
Reported-by: Ales Zeleny  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAApHDvpxFSTwvoYWT7kmFVSZ9zLAeHb=S9vrz=RExMgSkQNWqw@mail.gmail.com  
Backpatch-through: 14, where Memoize was added.  

M src/backend/executor/nodeMemoize.c

Fix off-by-one loop termination condition in pg_stat_get_subscription().

commit   : bf4717b0910763e81ffbf0358de06a88faee5132    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2022 15:34:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Jun 2022 15:34:30 -0400    

Click here for diff

pg_stat_get_subscription scanned one more LogicalRepWorker array entry  
than is really allocated.  In the worst case this could lead to SIGSEGV,  
if the LogicalRepCtx data structure is near the end of shared memory.  
That seems quite unlikely though (thanks to the ordering of calls in  
CreateSharedMemoryAndSemaphores) and we've heard no field reports of it.  
A more likely misbehavior is one row of garbage data in the function's  
result, but even that is not real likely because of the check that the  
pid field matches some live backend.  
  
Report and fix by Kuntal Ghosh.  This bug is old, so back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/CAGz5QCJykEDzW6jQK6Yz7Qh_PMtD=95de_7QoocbVR2Qy8hWZA@mail.gmail.com  

M src/backend/replication/logical/launcher.c

Don't fail on libpq-generated error reports in pg_amcheck.

commit   : 51da231597a9e414174cf621b219559e18269dc3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2022 11:26:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2022 11:26:57 -0400    

Click here for diff

An error PGresult generated by libpq itself, such as a report of  
connection loss, won't have broken-down error fields.  
should_processing_continue() blithely assumed that  
PG_DIAG_SEVERITY_NONLOCALIZED would always be present, and would  
dump core if it wasn't.  
  
Per grepping to see if 6d157e7cb's mistake was repeated elsewhere.  

M src/bin/pg_amcheck/pg_amcheck.c

Don't fail on libpq-generated error reports in ecpg_raise_backend().

commit   : 6d157e7cb8d3f4aa28a9fef95c498ce8ac3c31a9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2022 11:20:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Jun 2022 11:20:21 -0400    

Click here for diff

An error PGresult generated by libpq itself, such as a report of  
connection loss, won't have broken-down error fields.  
ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY  
would always be present, and would end up passing a NULL string  
pointer to snprintf when it isn't.  That would typically crash  
before 3779ac62d, and it would fail to provide a useful error report  
in any case.  Best practice is to substitute PQerrorMessage(conn)  
in such cases, so do that.  
  
Per bug #17421 from Masayuki Hirose.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/error.c

Fix psql's single transaction mode on client-side errors with -c/-f switches

commit   : 157f8739ad18278ca946758b2f274a8109a0aa08    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Jun 2022 11:05:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Jun 2022 11:05:59 +0900    

Click here for diff

psql --single-transaction is able to handle multiple -c and -f switches  
in a single transaction since d5563d7d, but this had the surprising  
behavior of forcing a transaction COMMIT even if psql failed with an  
error in the client (for example incorrect path given to \copy), which  
would generate an error, but still commit any changes that were already  
applied in the backend.  This commit makes the behavior more consistent,  
by enforcing a transaction ROLLBACK if any commands fail, both  
client-side and backend-side, so as no changes are applied if one error  
happens in any of them.  
  
Some tests are added on HEAD to provide some coverage about all that.  
Backend-side errors are unreliable as IPC::Run can complain on SIGPIPE  
if psql quits before reading a query result, but that should work  
properly in the case where any errors come from psql itself, which is  
what the original report is about.  
  
Reported-by: Christoph Berg  
Author: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl

Automatically count the number of output lines in psql/help.c.

commit   : f00a4f02ac2e31aaa6f74f8ef916624b9018370f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Jun 2022 11:54:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Jun 2022 11:54:05 -0400    

Click here for diff

The hard-wired PageOutput arguments in usage() and sibling functions  
have been a perennial maintenance gotcha, and there's no reason to  
think we'll ever get any better about that.  Let's get rid of those  
magic constants by constructing the output in a buffer where we can  
count the newlines before calling PageOutput.  (Perhaps this is  
microscopically slower; but none of these functions are performance  
critical, and anyway we might well be buying back all the cost by  
avoiding having to pass most of the data through snprintf.c.  I could  
not detect any speed difference in a desultory check.)  This also  
gets rid of the need to assume that platform-specific variations in  
the output are insignificant.  
  
While at it, make the code shorter and more abstract by inventing  
helper macros HELP0() and HELPN() to encapsulate the specific  
output actions being invoked.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/help.c
M src/bin/psql/nls.mk

Force run of pg_upgrade in the build directory in its TAP test

commit   : 15b6d2155375dee2fcba072fffa03c1c8b44656c    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 4 Jun 2022 12:16:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 4 Jun 2022 12:16:52 +0900    

Click here for diff

TAP tests are run from their own directory in the source tree, and in a  
VPATH build the execution of the pg_upgrade command was leaving behind a  
file in the source tree, that should be left untouched.  In order to  
avoid this issue, the test moves to PostgreSQL::Test::Utils::tmp_check,  
so as any files generated by pg_upgrade do not impact the source tree,  
but the build tree.  This has as nice side-effect to make unnessary the  
presence of such files in pg_upgrade's .gitignore and Makefile.  This  
strategy is similar to psql's test 010_tab_completion.pl, though the  
reasons behind this choice are different.  
  
In passing, fix one misleading test name that was added by 99f6f19.  
  
Per discussion with Peter Eisentraut, Andrew Dunstan, Tom Lane, Andres  
Freund and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/.gitignore
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/t/002_pg_upgrade.pl

commit   : 1fbe94084fd34200e61dd1db6225e8c8c65c000d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 15:49:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 15:49:36 -0400    

Click here for diff

Provide a gloss of which command does what, as all other backslash  
commands have.  Put the large-object command section into a more  
considered spot in the list.  
  
In passing, update the output-lines count in helpVariables()  
(oversight in 7844c9918, looks like).  
  
Thibaud Walkowiak, reviewed by Nathan Bossart and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/help.c

Doc: improve example for intarray's uniq() function.

commit   : 4ecacc3c8cb4b27374bdb1ca83696c0c09ee7f79    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 13:54:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 13:54:53 -0400    

Click here for diff

The previous entry invited confusion between what uniq() does  
by itself and what it does when combined with sort().  The latter  
usage is pretty useful so we should show it, but add an additional  
example to clarify the results of uniq() alone.  
  
Per suggestion from Martin Kalcher.  Back-patch to v13, where  
we switched to formatting that supports multiple examples.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/intarray.sgml

Doc: fix incorrect bit-reversal in example of macaddr formatting.

commit   : 94c7db4f1dc33f6e393c53cde48775449a593176    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 11:51:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Jun 2022 11:51:37 -0400    

Click here for diff

Will Mortensen (minor additional copy-editing by me)  
  
Discussion: https://postgr.es/m/CAMpnoC5Y6jiZHSA82FG+e_AqkwMg-i94EYqs1C_9kXXFc3_3Yw@mail.gmail.com  

M doc/src/sgml/datatype.sgml

Run tests of libpq on installcheck-world, checkprep and check-world

commit   : 2cc96f23391437e976aa830c5a955a2804d66452    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 3 Jun 2022 13:15:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 3 Jun 2022 13:15:20 +0900    

Click here for diff

The regression tests of libpq have been converted to a TAP test as of  
ac25173, but they were not run when running the global make targets  
mentioned in $subject as the code only considered src/interfaces/ecpg/  
as a path to run.  This switches to src/interfaces/, to always include  
the tests of libpq in each run.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in

Doc: Further fix CREATE FOREIGN TABLE synopsis.

commit   : 642e9165fd511315f0c5c3ad940f6ded42752dbe    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 2 Jun 2022 18:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 2 Jun 2022 18:00:00 +0900    

Click here for diff

This patch fixes the partitioning synopsis in the Parameters section in  
the CREATE FOREIGN TABLE documentation.  Follow-up for commit ce21a36cf.  
  
Back-patch to v11 where default partition was introduced.  
  
Reviewed by Amit Langote and Robert Haas.  
  
Discussion: https://postgr.es/m/CAPmGK17U5jEqVZuo3r38wB0VFWomEtJCBGn_h92HQzQ2sP-49Q%40mail.gmail.com  

M doc/src/sgml/ref/create_foreign_table.sgml

Prohibit combining publications with different column lists.

commit   : fd0b9dcebda7b931a41ce5c8e86d13f2efd0af2e    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 2 Jun 2022 08:31:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 2 Jun 2022 08:31:50 +0530    

Click here for diff

Currently, we simply combine the column lists when publishing tables on  
multiple publications and that can sometimes lead to unexpected behavior.  
Say, if a column is published in any row-filtered publication, then the  
values for that column are sent to the subscriber even for rows that don't  
match the row filter, as long as the row matches the row filter for any  
other publication, even if that other publication doesn't include the  
column.  
  
The main purpose of introducing a column list is to have statically  
different shapes on publisher and subscriber or hide sensitive column  
data. In both cases, it doesn't seem to make sense to combine column  
lists.  
  
So, we disallow the cases where the column list is different for the same  
table when combining publications. It can be later extended to combine the  
column lists for selective cases where required.  
  
Reported-by: Alvaro Herrera  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/test/subscription/t/031_column_list.pl

Add missing test names in TAP tests of pg_upgrade

commit   : 99f6f19799edbba5e0a73702c0a1bd13bdd285a2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Jun 2022 09:21:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Jun 2022 09:21:32 +0900    

Click here for diff

While on it, this removes the inclusion of getcwd() as The test code  
does not rely on it.  
  
Author: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Silence compiler warnings from some older compilers.

commit   : dd1c8dd1015f4548d6c29de56e54eda317b39319    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 17:21:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 17:21:45 -0400    

Click here for diff

Since a117cebd6, some older gcc versions issue "variable may be used  
uninitialized in this function" complaints for brin_summarize_range.  
Silence that using the same coding pattern as in bt_index_check_internal;  
arguably, a117cebd6 had too narrow a view of which compilers might give  
trouble.  
  
Nathan Bossart and Tom Lane.  Back-patch as the previous commit was.  
  
Discussion: https://postgr.es/m/20220601163537.GA2331988@nathanxps13  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c

Fix pl/perl test case so it will still work under Perl 5.36.

commit   : eb39610f82679e015dd990a3fbba1c62e399c32a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 16:15:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 16:15:47 -0400    

Click here for diff

Perl 5.36 has reclassified the warning condition that this test  
case used, so that the expected error fails to appear.  Tweak  
the test so it instead exercises a case that's handled the same  
way in all Perl versions of interest.  
  
This appears to meet our standards for back-patching into  
out-of-support branches: it changes no user-visible behavior  
but enables testing of old branches with newer tools.  
Hence, back-patch as far as 9.2.  
  
Dagfinn Ilmari Mannsåker, per report from Jitka Plesníková.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/expected/plperl.out
M src/pl/plperl/sql/plperl.sql

Doc: fix a couple of erroneous examples.

commit   : 1d0de97ba1e6ac9f76c63daee574f599df5f2f42    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 10:39:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Jun 2022 10:39:46 -0400    

Click here for diff

The example given for anyelement <@ anymultirange didn't return  
true as claimed; adjust it so it does.  
  
In passing, change a couple of sample results where the modern  
numeric-based logic produces a different number of trailing zeroes  
than before.  
  
Erik Rijkers  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Doc: mention limitation of the number of resultset columns

commit   : bbb6489042a8928ccba7d72343b9ea6d0c607974    
  
author   : David Rowley <[email protected]>    
date     : Wed, 1 Jun 2022 12:44:45 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 1 Jun 2022 12:44:45 +1200    

Click here for diff

The PostgreSQL limitations section of the documents mentioned the limit  
on the number of columns that can exist in a table.  Users might be  
surprised to find that there's also a limit on the number of columns that  
can exist in a targetlist.  Users may experience restrictions which  
surprise them if they happened to select a large number of columns from  
several tables with many columns.  Here we document that there is a  
limitation on this and mention what that limit actually is.  
  
Wording proposal by Alvaro Herrera  
  
Reported-by: Vladimir Sitnikov  
Author: Dave Crammer  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAB=Je-E18aTYpNqje4mT0iEADpeGLSzwUvo3H9kRRuDdsNo4aQ@mail.gmail.com  
Backpatch-through: 12, where the limitations section was added  

M doc/src/sgml/limits.sgml

Recommend scram-sha-256 instead of md5 authentication in docs

commit   : e1ed1a7aa5477a52faad2699c881966fb73128cb    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 31 May 2022 21:59:47 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 31 May 2022 21:59:47 +0200    

Click here for diff

PostgreSQL 14 changed the default to be scram-sha-256, so we should stop  
recommending the user to use md5 or even worse password.  
  
Suggested-By: Daniel Westermann  
Author: Jonathan S. Katz  
Backpatch-through: 14  
Discussion: https://postgr.es/m/GV0P278MB0419A8BAC0B0B84AFA5263D9D2DC9@GV0P278MB0419.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/runtime.sgml

Revert changes to CONCURRENTLY that "sped up" Xmin advance

commit   : e28bb885196916b0a3d898ae4f2be0e38108d81b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 31 May 2022 21:24:59 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 31 May 2022 21:24:59 +0200    

Click here for diff

This reverts commit d9d076222f5b "VACUUM: ignore indexing operations  
with CONCURRENTLY".  
  
These changes caused indexes created with the CONCURRENTLY option to  
miss heap tuples that were HOT-updated and HOT-pruned during the index  
creation.  Before these changes, HOT pruning would have been prevented  
by the Xmin of the transaction creating the index, but because this  
change was precisely to allow the Xmin to move forward ignoring that  
backend, now other backends scanning the table can prune them.  This is  
not a problem for VACUUM (which requires a lock that conflicts with a  
CREATE INDEX CONCURRENTLY operation), but HOT-prune can definitely  
occur.  In other words, Xmin advancement was sped up, but at the cost of  
corrupting the resulting index.  
  
Regrettably, this means that the new feature in PG14 that RIC/CIC on  
very large tables no longer force VACUUM to retain very old tuples goes  
away.  We might try to implement it again in a later release, but for  
now the risk of indexes missing tuples is too high and there's no easy  
fix.  
  
Backpatch to 14, where this change appeared.  
  
Reported-by: Peter Slavov <[email protected]>  
Diagnosys-by: Andrey Borodin <[email protected]>  
Diagnosys-by: Michael Paquier <[email protected]>  
Diagnosys-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/17485-396609c6925b982d%40postgresql.org  

M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/reindex.sgml
M src/backend/storage/ipc/procarray.c

Ensure ParseTzFile() closes the input file after failing.

commit   : 16c80e7d0cdad933103968aec7cd024bca5274c0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 14:47:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 14:47:44 -0400    

Click here for diff

We hadn't noticed this because (a) few people feed invalid  
timezone abbreviation files to the server, and (b) in typical  
scenarios guc.c would throw ereport(ERROR) and then transaction  
abort handling would silently clean up the leaked file reference.  
However, it was possible to observe file leakage warnings if one  
breaks an already-active abbreviation file, because guc.c does  
not throw ERROR when loading supposedly-validated settings during  
session start or SIGHUP processing.  
  
Report and fix by Kyotaro Horiguchi (cosmetic adjustments by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/tzparser.c

Doc: fix mention of psql's minimum supported server version.

commit   : c03b7f52607f20e8b49e662927ba5810d49f3427    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 12:18:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 12:18:27 -0400    

Click here for diff

Commit cf0cab868 removed describe.c's support for pre-9.2 server  
versions, but neglected to update this documentation reference.  
  
Discussion: https://postgr.es/m/GV0P278MB041917EB3E2FE8704B5AE2C6D2DC9@GV0P278MB0419.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/psql-ref.sgml

Doc: fix mention of pg_dump's minimum supported server version.

commit   : 492046fa9ed4a236d490f56bc5afcaa2f3b6ad6c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 12:14:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 May 2022 12:14:02 -0400    

Click here for diff

runtime.sgml contains a passing reference to the minimum server  
version that pg_dump[all] can dump from.  That was 7.0 for many  
years, but when 64f3524e2 raised it to 8.0, we missed updating this  
bit.  Then when 30e7c175b raised it to 9.2, we missed it again.  
  
Given that track record, I'm not too hopeful that we'll remember  
to fix this in future changes ... but for now, make the docs match  
reality in each branch.  
  
Noted by Daniel Westermann.  
  
Discussion: https://postgr.es/m/GV0P278MB041917EB3E2FE8704B5AE2C6D2DC9@GV0P278MB0419.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/runtime.sgml

shm_mq_sendv: Fix flushing bug when receiver not yet attached.

commit   : f5bfba5413f51b4fa0a7b0dc879d39ae6881d8be    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 24 May 2022 10:55:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 24 May 2022 10:55:01 -0400    

Click here for diff

With the old logic, when the reciever had not yet attached, we would  
never call shm_mq_inc_bytes_written(), even if force_flush = true  
was specified. That could result in a situation where data that the  
sender believes it has sent is never received.  
  
Along the way, remove a useless function prototype for a nonexistent  
function from shm_mq.h.  
  
Commit 46846433a03dff4f2e08c8a161e54a842da360d6 introduced these  
problems.  
  
Pavan Deolasee, with a few changes by me.  
  
Discussion: https://postgr.es/m/CABOikdPkwtLLCTnzzmpSMXo3QZa2yXq0J7Q61ssdLFAJYrOVvQ@mail.gmail.com  

M src/backend/storage/ipc/shm_mq.c
M src/include/storage/shm_mq.h

Fix typo in hash README.

commit   : 0a050ee000b6783ac4b78e9eadb47a4e72912672    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 31 May 2022 14:37:41 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 31 May 2022 14:37:41 +0530    

Click here for diff

Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pu-V22PiJF2ym9_NVZe-+qnycfyEX24dZm=7URWhDHJ3w@mail.gmail.com  

M src/backend/access/hash/README

Remove useless tests for TRUNCATE on foreign tables

commit   : 0efa51357e0fe0fd69f0c27245ed7e68039b1ea8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 May 2022 09:44:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 May 2022 09:44:00 +0900    

Click here for diff

foreign_data has kept around a set of tests for TRUNCATE to look after  
the case of foreign tables, with[out] inheritance and with[out]  
partitions, assuming that the command is not supported for this relkind.  
However, TRUNCATE is supported on foreign tables if the FDW involved is  
able to handle the command, like postgres_fdw.  
  
Note that postgres_fdw includes tests to cover all the cases removed by  
this commit (which had misleading comments), so these did not provide  
any additional coverage anyway.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Add debugging help in OwnLatch().

commit   : 12e28aac8e8eb76cab13a4e9b696e3dab17f1c99    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 31 May 2022 11:38:19 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 31 May 2022 11:38:19 +1200    

Click here for diff

Build farm animal gharial recently failed a few times in a parallel  
worker's call to OwnLatch() with "ERROR:  latch already owned".  Let's  
turn that into a PANIC and show the PID of the owner, to try to learn  
more.  
  
Discussion: https://postgr.es/m/CA%2BhUKGJ_0RGcr7oUNzcHdn7zHqHSB_wLSd3JyS2YC_DYB%2B-V%3Dg%40mail.gmail.com  

M src/backend/storage/ipc/latch.c

Make STRING an unreserved_keyword.

commit   : 5f0adec2537dab531ef63ff6e0fe640698a291d9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 30 May 2022 14:05:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 30 May 2022 14:05:20 -0400    

Click here for diff

Commit 1a36bc9db (SQL/JSON query functions) introduced STRING as a  
type_func_name_keyword, thereby breaking applications that use  
"string" as a table name, column name, function parameter name, etc.  
That seems like a pretty bad thing, not least because the SQL spec  
says that STRING is an unreserved keyword.  
  
This is easy enough to fix so far as the core grammar is concerned.  
However, doing so causes some ECPG test cases to fail, specifically  
those that use "string" as a typedef name.  It turns out this is  
because portions of the ECPG grammar allow type_func_name_keywords  
but not unreserved_keywords as typedef names.  That's pretty horrid,  
and it's mildly astonishing that we've not heard complaints about it  
before.  We can fix two of those uses trivially, but the ones in the  
var_type production are less easy.  As a stopgap, hard-code STRING as  
an allowed alternative in var_type.  
  
Per report from Alastair McKinley.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/gram.y
M src/include/parser/kwlist.h
M src/interfaces/ecpg/preproc/ecpg.trailer

logging: Also add the command prefix to detail and hint messages

commit   : a8cca6026e992d9b627c7dbee5f8a50bde507a94    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 30 May 2022 07:18:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 30 May 2022 07:18:57 +0200    

Click here for diff

This makes the output line up better and allows filtering messages by  
command.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/common/logging.c

doc: Reword description of roles able to view track_activities's info

commit   : b3fb16e8bb3eaadc6bd4e7cc6af816b0359d7b3d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 May 2022 10:50:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 May 2022 10:50:21 +0900    

Click here for diff

The information generated when track_activities is accessible to  
superusers, roles with the privileges of pg_read_all_stats, as well as  
roles one has the privileges of.  The original text did not outline the  
last point, while the change done in ac1ae47 was unclear about the  
second point.  
  
Per discussion with Nathan Bossart.  
  
Discussion: https://postgr.es/m/20220521185743.GA886636@nathanxps13  
Backpatch-through: 10  

M doc/src/sgml/config.sgml

Fix COPY FROM when database encoding is SQL_ASCII.

commit   : fc36ac52ebd3b0c879877c424f94318728b25935    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 29 May 2022 23:53:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 29 May 2022 23:53:45 +0300    

Click here for diff

In the codepath when no encoding conversion is required, the check for  
incomplete character at the end of input incorrectly used server  
encoding's max character length, instead of the client's. Usually the  
server and client encodings are the same when we're not performing  
encoding conversion, but SQL_ASCII is an exception.  
  
In the passing, also fix some outdated comments that still talked about  
the old COPY protocol. It was removed in v14.  
  
Per bug #17501 from Vitaly Voronov. Backpatch to v14 where this was  
introduced.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/copyfromparse.c

Doc: fix missing/bogus documentation of range_intersect_agg().

commit   : f6b6a8fb94f115c5197fbba0c004a262dc710134    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 May 2022 13:25:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 May 2022 13:25:21 -0400    

Click here for diff

The form taking anymultirange had not been documented.  This was  
fixed in HEAD in b21c4cf95, but that should have been back-patched  
to v14 since the function was added there.  Do so now.  
  
Also, the form taking anyrange was incorrectly documented as  
returning anymultirange, when it returns anyrange.  
  
Remove b21c4cf95 from the v15 release notes, since it no longer  
qualifies as new-in-v15.  
  
Noted by Shay Rojansky.  
  
Discussion: https://postgr.es/m/CADT4RqAktzP7t6SFf0Xqm9YhahzvsmxFbzXe-gFOd=+_CHm0JA@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/release-15.sgml

Doc: Document pg_stat_recovery_prefetch.stats_reset.

commit   : cfce3be818ab6778cf2c314ff4f6f398b74f75eb    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 29 May 2022 16:33:26 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 29 May 2022 16:33:26 +1200    

Click here for diff

This column was missing from the table that describes the new view.  
  
Author: Shinoda, Noriyoshi (PN Japan FSIP) <[email protected]>  
Discussion: https://postgr.es/m/DM4PR84MB173401C19A0EB9B1CAAB197CEED29@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/monitoring.sgml

Align stats_fetch_consistency definition with guc.c default.

commit   : 0107855b1480d381f28f935e279ec3b64f410ef7    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 28 May 2022 13:08:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 28 May 2022 13:08:19 -0700    

Click here for diff

Somewhat embarrassing oversight in 98f897339b0. Does not have a functional  
impact, but is unnecessarily confusing.  
  
Reported-By: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/Yo2351qVYqd/[email protected]  

M src/backend/utils/activity/pgstat.c

Revert "Add single-item cache when looking at topmost XID of a subtrans XID"

commit   : b4529005fd387e863bfa9eb863629b1183c0449c    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 28 May 2022 15:02:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 28 May 2022 15:02:08 +0900    

Click here for diff

This reverts commit 06f5295 as per issues with this approach, both in  
terms of efficiency impact and stability.  First, contrary to the  
single-item cache for transaction IDs in transam.c, the cache may finish  
by not be hit for a long time, and without an invalidation mechanism to  
clear it, it would cause inconsistent results on wraparound for  
example.  Second, the use of SubTransGetTopmostTransaction() for the  
caching has a limited impact on performance.  SubTransGetParent() could  
have more impact, though the benchmarking of the single-item approach  
still needs to be proved, particularly under the conditions where SLRU  
lookups are stressed in parallel with overflowed snapshots (aka more  
than 64 subxids generated, for example).  
  
After discussion with Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/subtrans.c

Handle NULL for short descriptions of custom GUC variables

commit   : f1431f3bffa00962ae8debb98a750ed2fb09fa3b    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 28 May 2022 12:12:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 28 May 2022 12:12:40 +0900    

Click here for diff

If a short description is specified as NULL in one of the various  
DefineCustomXXXVariable() functions available to external modules to  
define a custom parameter, SHOW ALL would crash.  This change teaches  
SHOW ALL to properly handle NULL short descriptions, as well as any code  
paths that manipulate it, to gain in flexibility.  Note that  
help_config.c was already able to do that, when describing a set of GUCs  
for postgres --describe-config.  
  
Author: Steve Chavez  
Reviewed by: Nathan Bossart, Andres Freund, Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/CAGRrpzY6hO-Kmykna_XvsTv8P2DshGiU6G3j8yGao4mk0CqjHA%40mail.gmail.com  
Backpatch-through: 10  

M src/backend/utils/misc/guc.c

Teach remove_unused_subquery_outputs about window run conditions

commit   : 3e9abd2eb1b1f6863250f060290f514f30ce8044    
  
author   : David Rowley <[email protected]>    
date     : Fri, 27 May 2022 10:37:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 27 May 2022 10:37:58 +1200    

Click here for diff

9d9c02ccd added code to allow the executor to take shortcuts when quals  
on monotonic window functions guaranteed that once the qual became false  
it could never become true again.  When possible, baserestrictinfo quals  
are converted to become these quals, which we call run conditions.  
  
Unfortunately, in 9d9c02ccd, I forgot to update  
remove_unused_subquery_outputs to teach it about these run conditions.  
This could cause a WindowFunc column which was unused in the target list  
but referenced by an upper-level WHERE clause to be removed from the  
subquery when the qual in the WHERE clause was converted into a window run  
condition.  Because of this, the entire WindowClause would be removed from  
the query resulting in additional rows making it into the resultset when  
they should have been filtered out by the WHERE clause.  
  
Here we fix this by recording which target list items in the subquery have  
run conditions. That gets passed along to remove_unused_subquery_outputs  
to tell it not to remove these items from the target list.  
  
Bug: #17495  
Reported-by: Jeremy Evans  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/parser/parse_clause.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Remove misguided SSL key file ownership check in libpq.

commit   : 2b65de7fc296bb5060c8d4ae8cb680f71364fbe0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 May 2022 14:14:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 May 2022 14:14:05 -0400    

Click here for diff

Commits a59c79564 et al. tried to sync libpq's SSL key file  
permissions checks with what we've used for years in the backend.  
We did not intend to create any new failure cases, but it turns out  
we did: restricting the key file's ownership breaks cases where the  
client is allowed to read a key file despite not having the identical  
UID.  In particular a client running as root used to be able to read  
someone else's key file; and having seen that I suspect that there are  
other, less-dubious use cases that this restriction breaks on some  
platforms.  
  
We don't really need an ownership check, since if we can read the key  
file despite its having restricted permissions, it must have the right  
ownership --- under normal conditions anyway, and the point of this  
patch is that any additional corner cases where that works should be  
deemed allowable, as they have been historically.  Hence, just drop  
the ownership check, and rearrange the permissions check to get rid  
of its faulty assumption that geteuid() can't be zero.  (Note that the  
comparable backend-side code doesn't have to cater for geteuid() == 0,  
since the server rejects that very early on.)  
  
This does have the end result that the permissions safety check used  
for a root user's private key file is weaker than that used for  
anyone else's.  While odd, root really ought to know what she's doing  
with file permissions, so I think this is acceptable.  
  
Per report from Yogendra Suralkar.  Like the previous patch,  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/MW3PR15MB3931DF96896DC36D21AFD47CA3D39@MW3PR15MB3931.namprd15.prod.outlook.com  

M src/backend/libpq/be-secure-common.c
M src/interfaces/libpq/fe-secure-openssl.c

In CREATE FOREIGN TABLE syntax synopsis, fix partitioning stuff.

commit   : ce21a36cf837083cb41521aff035d9c1310f0f66    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 26 May 2022 12:54:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 26 May 2022 12:54:33 -0400    

Click here for diff

Foreign tables can be partitioned, but previous documentation commits  
left the syntax synopsis both incomplete and incorrect.  
  
Justin Pryzby and Amit Langote  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_foreign_table.sgml

Avoid ERRCODE_INTERNAL_ERROR in oracle_compat.c functions.

commit   : 6217053f4e856159442629bd50c583ce3e4bc1fb    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 26 May 2022 12:25:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 26 May 2022 12:25:10 -0400    

Click here for diff

repeat() checked for integer overflow during its calculation of the  
required output space, but it just passed the resulting integer to  
palloc().  This meant that result sizes between 1GB and 2GB led to  
ERRCODE_INTERNAL_ERROR, "invalid memory alloc request size" rather  
than ERRCODE_PROGRAM_LIMIT_EXCEEDED, "requested length too large".  
That seems like a bit of a wart, so add an explicit AllocSizeIsValid  
check to make these error cases uniform.  
  
Do likewise in the sibling functions lpad() etc.  While we're here,  
also modernize their overflow checks to use pg_mul_s32_overflow() etc  
instead of expensive divisions.  
  
Per complaint from Japin Li.  This is basically cosmetic, so I don't  
feel a need to back-patch.  
  
Discussion: https://postgr.es/m/ME3P282MB16676ED32167189CB0462173B6D69@ME3P282MB1667.AUSP282.PROD.OUTLOOK.COM  

M src/backend/utils/adt/oracle_compat.c

relnotes: update ordered partition scan item

commit   : de89d8711e2b70150a2c5b3215d99da108fbe1e8    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 25 May 2022 22:19:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 25 May 2022 22:19:20 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFMmOK9cjrqxJeY1HKKbgMup0HcZ+Co7JuzJG_8ZypceA@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Add tab completion for table_rewrite's CREATE EVENT TRIGGER in psql

commit   : 0dc379de646309d388990399132f9c12137e86e4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 May 2022 14:21:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 May 2022 14:21:05 +0900    

Click here for diff

Author: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB5716DEFF787B925C4778228C94D69@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c

Fix stats_fetch_consistency default value indicated in postgresql.conf.sample.

commit   : 98f897339b011d04f3b9f48050aa31de9a5a4869    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 24 May 2022 21:24:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 24 May 2022 21:24:13 -0700    

Click here for diff

Mistake in 5891c7a8ed8, likely made when switching the default value from none  
to fetch during development.  
  
Reported-By: Nathan Bossart <[email protected]>  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/20220524220147.GA1298892@nathanxps13  

M src/backend/utils/misc/postgresql.conf.sample

relnotes: add Heikki to UTF8 item

commit   : 335e444f2269086c22146d885afb9d6e92d5cb01    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 24 May 2022 19:37:50 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 24 May 2022 19:37:50 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsFhbhMbK_ZaLpH6J8BfJL_uowtGg+Qs9XA=F4uPU3aucA@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Remove duplicated words in comments of pgstat.c and pgstat_internal.h

commit   : c9dfe2e83a8dbc30e6992ced01da2f7cfa0f63f3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 24 May 2022 11:00:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 24 May 2022 11:00:41 +0900    

Click here for diff

Author: Atsushi Torikoshi  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat.c
M src/include/utils/pgstat_internal.h

doc: Improve COPY synopsis

commit   : d45e824b6719147ef5d225c1949c2e65548e00ff    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 13:09:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 13:09:18 +0200    

Click here for diff

Upper-case MATCH so that it is clearer that it is a keyword in this  
context.  
  
Discussion: https://www.postgresql.org/message-id/flat/20220517.174342.1884842412165214815.horikyota.ntt%40gmail.com  

M doc/src/sgml/ref/copy.sgml

pg_upgrade: Tweak translatable strings

commit   : da1c0acd0a61eb8c1d62725ded9c219e783cc6a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:54:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:54:39 +0200    

Click here for diff

"\r" (for progress output) must not be inside a translatable string  
(gettext gets upset).  
  
In passing, move the minimum supported version number to a separate  
argument, so that we don't have to retranslate this string every year  
now.  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/util.c

doc: Add documentation for pg_database.datlocprovider column

commit   : 09ed73f1a4af5cdcbe9725727822e54bd8e9f743    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:31:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:31:33 +0200    

Click here for diff

This was apparently missed in the original commit.  
  
Author: Shinoda, Noriyoshi (PN Japan FSIP) <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/DM4PR84MB1734BA51BC8B08CF3FA239BBEED49%40DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

psql: Update \timing also in case of an error

commit   : 9520f8d92a8681e441cc863422babd544353dd39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:07:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 23 May 2022 10:07:36 +0200    

Click here for diff

The changes to show all query results (7844c9918) broke \timing output  
in case of an error; it didn't update the timing result and showed  
0.000 ms.  
  
Fix by updating the timing result also in the error case.  Also, for  
robustness, update the timing result any time a result is obtained,  
not only for the last, so a sensible value is always available.  
  
Reported-by: Tom Lane <[email protected]>  
Author: Richard Guo <[email protected]>  
Author: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/3813350.1652111765%40sss.pgh.pa.us  

M src/bin/psql/common.c
M src/bin/psql/t/001_basic.pl

Remove debug messages from tuplesort_sort_memtuples()

commit   : 6e647ef0e750bc5007e4af48b19023d68ae91b6a    
  
author   : John Naylor <[email protected]>    
date     : Mon, 23 May 2022 13:11:43 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 23 May 2022 13:11:43 +0700    

Click here for diff

These were of value only during development.  
  
Reported by Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/20220519201254.GU19626%40telsasoft.com  

M src/backend/utils/sort/tuplesort.c

pgstat: fix stats.spec instability on slow machines.

commit   : 7fdbdf204920ac279f280d0a8e96946fdaf41aef    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 22 May 2022 15:09:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 22 May 2022 15:09:50 -0700    

Click here for diff

On slow machines the modified test could end up switching the order in which  
transactional stats are reported in one session and non-transactional stats in  
another session. As stats handling of truncate is implemented as setting  
live/dead rows 0, the order in which a truncate's stats changes are applied,  
relative to normal stats updates, matters. The handling of stats for truncate  
hasn't changed due to shared memory stats, this is longstanding behavior.  
  
We might want to improve truncate's stats handling in the future, but for now  
just change the order of forced flushed to make the test stable.  
  
Reported-By: Christoph Berg <[email protected]>  
Discussion: https://postgr.es/m/YoZf7U/[email protected]  

M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec

Show 'AS "?column?"' explicitly when it's important.

commit   : c7461fc25558832dd347a9c8150b0f1ed85e36e8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 14:45:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 14:45:58 -0400    

Click here for diff

ruleutils.c was coded to suppress the AS label for a SELECT output  
expression if the column name is "?column?", which is the parser's  
fallback if it can't think of something better.  This is fine, and  
avoids ugly clutter, so long as (1) nothing further up in the parse  
tree relies on that column name or (2) the same fallback would be  
assigned when the rule or view definition is reloaded.  Unfortunately  
(2) is far from certain, both because ruleutils.c might print the  
expression in a different form from how it was originally written  
and because FigureColname's rules might change in future releases.  
So we shouldn't rely on that.  
  
Detecting exactly whether there is any outer-level use of a SELECT  
column name would be rather expensive.  This patch takes the simpler  
approach of just passing down a flag indicating whether there *could*  
be any outer use; for example, the output column names of a SubLink  
are not referenceable, and we also do not care about the names exposed  
by the right-hand side of a setop.  This is sufficient to suppress  
unwanted clutter in all but one case in the regression tests.  That  
seems like reasonable evidence that it won't be too much in users'  
faces, while still fixing the cases we need to fix.  
  
Per bug #17486 from Nicolas Lutic.  This issue is ancient, so  
back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/matview.out

Remove unused-and-misspelled function extern declaration.

commit   : e19272ef603bdb11a09e7f8500dc4e0fb4ec73de    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 13:26:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 13:26:08 -0400    

Click here for diff

Commit c65507763 added "extern XLogRecPtr CalculateMaxmumSafeLSN(void)",  
which bears no trace of connection to anything else in that patch  
or anywhere else.  Remove it again.  
  
Sergei Kornilov (also spotted by Bharath Rupireddy)  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CALj2ACVoQ7NEf43Xz0rfxsGOKYTN5r4VZp2DO2_5p+CMzsRPFw@mail.gmail.com  

M src/include/access/xlog.h

Avoid overflow hazard when clamping group counts to "long int".

commit   : a916cb9d5a89804998dd4e7fd7bbb27cb5a7abc8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 13:13:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 May 2022 13:13:41 -0400    

Click here for diff

Several places in the planner tried to clamp a double value to fit  
in a "long" by doing  
	(long) Min(x, (double) LONG_MAX);  
This is subtly incorrect, because it casts LONG_MAX to double and  
potentially back again.  If long is 64 bits then the double value  
is inexact, and the platform might round it up to LONG_MAX+1  
resulting in an overflow and an undesirably negative output.  
  
While it's not hard to rewrite the expression into a safe form,  
let's put it into a common function to reduce the risk of someone  
doing it wrong in future.  
  
In principle this is a bug fix, but since the problem could only  
manifest with group count estimates exceeding 2^63, it seems unlikely  
that anyone has actually hit this or will do so anytime soon.  We're  
fixing it mainly to satisfy fuzzer-type tools.  That being the case,  
a HEAD-only fix seems sufficient.  
  
Andrey Lepikhov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeSubplan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/include/optimizer/optimizer.h

doc: Mention pg_read_all_stats in description of track_activities

commit   : ac1ae477f85c6aeb3119071c1c00eb042b4afa4d    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 19:05:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 19:05:47 +0900    

Click here for diff

The description of track_activities mentioned that it is visible to  
superusers and that the information related to the current session can  
be seen, without telling about pg_read_all_stats.  Roles that are  
granted the privileges of pg_read_all_stats can also see this  
information, so mention it in the docs.  
  
Author: Ian Barwick  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CAB8KJ=jhPyYFu-A5r-ZGP+Ax715mUKsMxAGcEQ9Cx_mBAmrPow@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/config.sgml

doc: Fix description of the JIT time fields in pg_stat_statements

commit   : d1436555f5ab33b1e4d458e9b2722e5eaf0548f6    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 17:57:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 17:57:23 +0900    

Click here for diff

The four fields tracking the time spent by queries for JIT operations  
added in 57d6aea were listed as having bigint as data type, but these  
are of type double precision.  
  
Author: Noriyoshi Shinoda  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/DM4PR84MB1734375E63148AADC6A1E6B4EED39@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/pgstatstatements.sgml

Improve and fix some issues in the TAP tests of pg_upgrade

commit   : eaa5ebe046c4f247d843bdfd36da4c28be9dbfab    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 12:01:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 21 May 2022 12:01:48 +0900    

Click here for diff

This is based on a set of suggestions from Noah, with the following  
changes made:  
- The set of databases created in the tests are now prefixed with  
"regression" to not trigger any warnings with name restrictions when  
compiling the code with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, and  
now only the first name checks after the Windows case of double quotes  
mixed with backslashes.  
- Fix an issue with EXTRA_REGRESS_OPTS, which were not processed in a  
way consistent with 027_stream_regress.pl (missing space between the  
option string and pg_regress).  This got introduced in 7dd3ee5.  
- Add a check on the exit code of the pg_regress command, to catch  
failures after running the regression tests.  
  
Reviewed-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Remove portability hazard in unsafe_tests/sql/guc_privs.sql.

commit   : 5e5fa323350060360799004f96840bbf3cb51e49    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 May 2022 13:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 May 2022 13:42:02 -0400    

Click here for diff

This new-in-v15 test case assumed it could set max_stack_depth as high  
as 2MB.  You might think that'd be true on any modern platform but  
you'd be wrong, as I found out while experimenting with NetBSD/hppa.  
  
This test is about privileges not platform capabilities, so there seems  
no need to use any value greater than the 100kB setting already used  
in a couple of places in the core regression tests.  There's certainly  
no call to expect people to raise their platform's default ulimit just  
to run this test.  

M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql

Fix DDL deparse of CREATE OPERATOR CLASS

commit   : 6029861916e8e2c0155c332c10f182a22619c663    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 May 2022 18:52:55 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 May 2022 18:52:55 +0200    

Click here for diff

When an implicit operator family is created, it wasn't getting reported.  
Make it do so.  
  
This has always been missing.  Backpatch to 10.  
  
Author: Masahiko Sawada <[email protected]>  
Reported-by: Leslie LEMAIRE <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Michael Paquiër <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/opclasscmds.c
M src/backend/tcop/utility.c
M src/test/modules/test_ddl_deparse/expected/opfamily.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Add pg_version() to PostgreSQL::Test::Cluster

commit   : b39838889e76274b107935fa8e8951baf0e8b31b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 20 May 2022 18:29:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 20 May 2022 18:29:51 +0900    

Click here for diff

_pg_version (version number based on PostgreSQL::Version) is a field  
private to Cluster.pm but there was no helper routine to retrieve it  
from a Cluster's node.  The same is done for install_path, for example,  
and the version object becomes handy when writing tests that need  
version-specific handling.  
  
Reviewed-by: Andrew Dunstan, Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

doc: Explain 'invalid' index state for CREATE INDEX CONCURRENTLY

commit   : a5084a10fe60412036899a79b3aee76ba31a3579    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 20 May 2022 10:05:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 20 May 2022 10:05:31 +0200    

Click here for diff

It wasn't previously mentioned that the index is created as invalid,  
which is confusing to new users.  
  
Backpatch to 14 (only because of a conflict in 13).  
  
Author: Laurenz Albe <[email protected]>  
Reported-by: Lauren Fliksteen <[email protected]>  
Reviewed-by: Rajakavitha Kodhandapani <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_index.sgml

pg_waldump: Improve option parsing error messages

commit   : 25f915b31e41e5c86e1905d199c7d41cc66161ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 May 2022 09:26:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 May 2022 09:26:21 +0200    

Click here for diff

I rephrased the error messages to be more in the style of  
option_parse_int(), and also made use of the new "detail" message  
facility.  I didn't actually use option_parse_int() (which could be  
used for -n) because libpgfeutils wasn't used here yet and I wanted to  
keep this just to string changes.  But it could be done in the future.  

M src/bin/pg_waldump/pg_waldump.c

Doc: clarify location of libpq's default service file on Windows.

commit   : 1d8ef62f6e1982c3019fc044dea070a8861a91bf    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 May 2022 18:36:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 May 2022 18:36:07 -0400    

Click here for diff

The documentation didn't specify the name of the per-user service file  
on Windows, and extrapolating from the pattern used for other config  
files gave the wrong answer.  The fact that it isn't consistent with the  
others sure seems like a bug, but it's far too late to change that now;  
we'd just penalize people who worked it out in the past.  So, simply  
document the true state of affairs.  
  
In passing, fix some gratuitous differences between the discussions  
of the service file and the password file.  
  
Julien Rouhaud, per question from Dominique Devienne.  
  
Backpatch to all supported branches.  I (tgl) also chose to back-patch  
the part of commit ba356a397 that touched libpq.sgml's description of  
the service file --- in hindsight, I'm not sure why I didn't do so at  
the time, as it includes some fairly essential information.  
  
Discussion: https://postgr.es/m/CAFCRh-_mdLrh8eYVzhRzu4c8bAFEBn=rwoHOmFJcQOTsCy5nig@mail.gmail.com  

M doc/src/sgml/libpq.sgml

Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS

commit   : 8d061acd12af26551b607299aa204c946d2b6ba2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 19 May 2022 16:20:32 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 19 May 2022 16:20:32 +0200    

Click here for diff

This is a slight, convenient semantics change from what commit  
0f0cfb494004 ("Fix parallel operations that prevent oldest xmin from  
advancing") introduced that lets us simplify the coding in the one place  
where it is used.  
  
Backpatch to 13.  This is related to commit 6fea65508a1a ("Tighten  
ComputeXidHorizons' handling of walsenders") rewriting the code site  
where this is used, which has not yet been backpatched, but it may well  
be in the future.  
  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h

Rework SQL/JSON documentation

commit   : a1e7616d6e1e8056b6eae6d68be9e1e658afaf96    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 19 May 2022 10:03:43 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 19 May 2022 10:03:43 -0400    

Click here for diff

This makes the documentation conform more closely the style of other  
function sections.  
  
Includes suggestions from Erik Rijkers, Alvaro Herrera, and Justin  
Pryzby.  
  
Discussion: https://postgr.es/m/CAKFQuwaq5Ny6d3nWbJo=QO4RmhSk9JD8zrkURLR-wWmB2Pkz7Q@mail.gmail.com  

M doc/src/sgml/func.sgml

doc: Properly punctuate "etc."

commit   : 648aa6734fefb2cc2c9bba7d6444890e727eaca1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 19 May 2022 09:27:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 19 May 2022 09:27:34 +0200    

Click here for diff

M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xml2.sgml

Fix incorrect comments for Memoize struct

commit   : c4a4e760f6b0e7933e7d3bff0b589af9da49f8e6    
  
author   : David Rowley <[email protected]>    
date     : Thu, 19 May 2022 17:14:23 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 19 May 2022 17:14:23 +1200    

Click here for diff

Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Memoize was added  

M src/include/nodes/plannodes.h

Extend pg_publication_tables to display column list and row filter.

commit   : 0ff20288e1cb3282efb43401896a939916fceb4d    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 May 2022 08:20:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 May 2022 08:20:55 +0530    

Click here for diff

Commit 923def9a53 and 52e4f0cd47 allowed to specify column lists and row  
filters for publication tables. This commit extends the  
pg_publication_tables view and pg_get_publication_tables function to  
display that information.  
  
This information will be useful to users and we also need this for the  
later commit that prohibits combining multiple publications with different  
column lists for the same table.  
  
Author: Hou Zhijie  
Reviewed By: Amit Kapila, Alvaro Herrera, Shi Yu, Takamichi Osumi  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/tablesync.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out

Update xml_1.out and xml_2.out

commit   : 62221ef187b0098c8f331f804b7c63859e5ee6ff    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 23:19:53 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 23:19:53 +0200    

Click here for diff

Commit 0fbf01120023 should have updated them but didn't.  

M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out

Fix EXPLAIN MERGE output when no tuples are processed

commit   : 12e423e21d8ef47d95a099c12f625f6d191eaf92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 21:20:49 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 21:20:49 +0200    

Click here for diff

An 'else' clause was misplaced in commit 598ac10be1c2, making zero-rows  
output look a bit silly.  Add a test case for it.  
  
Pointed out by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Check column list length in XMLTABLE/JSON_TABLE alias

commit   : 0fbf0112002355efb2bb525ab88edf891dbfd033    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 20:28:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 20:28:31 +0200    

Click here for diff

We weren't checking the length of the column list in the alias clause of  
an XMLTABLE or JSON_TABLE function (a "tablefunc" RTE), and it was  
possible to make the server crash by passing an overly long one.  Fix it  
by throwing an error in that case, like the other places that deal with  
alias lists.  
  
In passing, modify the equivalent test used for join RTEs to look like  
the other ones, which was different for no apparent reason.  
  
This bug came in when XMLTABLE was born in version 10; backpatch to all  
stable versions.  
  
Reported-by: Wang Ke <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/test/regress/expected/int2.out
M src/test/regress/expected/join.out
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xml.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/jsonb_sqljson.sql
M src/test/regress/sql/with.sql
M src/test/regress/sql/xml.sql

Make EXPLAIN MERGE output format more compact

commit   : 598ac10be1c20961baac44db773eb826f788fdfa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 18:33:04 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 18 May 2022 18:33:04 +0200    

Click here for diff

We can use a single line to print all tuple counts that MERGE processed,  
for conciseness, and elide those that are zeroes.  Non-text formats  
report all numbers, as is typical.  
  
Per comment from Justin Pryzby <[email protected]>  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/test/regress/expected/merge.out

Fix markup in synopsis

commit   : 81e3c83d988daa8fd763ec5104d540713832dd1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 18 May 2022 18:18:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 18 May 2022 18:18:22 +0200    

Click here for diff

There is no need for a <literal> inside a <synopsis>, since the latter  
is already all "literal" implicitly.  Also, create_help.pl misparses  
it.  So just remove it.  
  
Reported-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20220517.174342.1884842412165214815.horikyota.ntt%40gmail.com  

M doc/src/sgml/ref/copy.sgml

pgbench: Restore compatibility of --partitions=0

commit   : 27f1366050c6cd8c1ea5f03b367a5a167ebf34b7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 May 2022 09:47:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 May 2022 09:47:38 +0900    

Click here for diff

A value of 0 is allowed for this option since its creation, that would  
map with the default of having no partitions for pgbench_accounts, but  
6f164e6 broke that by enforcing an error.  This commit restores the  
original behavior.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGAGobiiHR8nH382HJxqm1mzZs8=3oKPXnXivWoFSZmNA@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Fix typo in walreceiver.c

commit   : bbf7c2d9e932db873469cd9cecf0e05e39c1962d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 18 May 2022 09:06:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 18 May 2022 09:06:22 +0900    

Click here for diff

s/primary_slotname/primary_slot_name/.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACX3=pHkCpoGG-z+O=7Gp5YZv70jmfTyGnNV7YF3SkK73g@mail.gmail.com  

M src/backend/replication/walreceiver.c

Stamp 15beta1.

commit   : 05a5a1775c89f6beb326725282e7eea1373cbec8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 May 2022 17:10:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 May 2022 17:10:42 -0400    

Click here for diff

M configure
M configure.ac

relnotes: improve updated UTF8 item wording

commit   : 4bfa420075b4e85012837b6b6d376edf8af5ede5    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 16 May 2022 10:18:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 16 May 2022 10:18:17 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

relnotes: improve UTF8 text item in relation to ASCII

commit   : 9499c0fcf488e2f8e0e3ae71b06003fe7735feb4    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 16 May 2022 10:09:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 16 May 2022 10:09:36 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsE-US0sgVxVHjt99GCGky4TCD57gwMHWPF9XWo7R5rXPg@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Translation updates

commit   : 6a8a7b1ccbc0e92ce2b301e9aad26a4caedfd9b5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 11:12:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 11:12:42 +0200    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: dde45df385dab9032155c1f867b677d55695310c  

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.po
M src/backend/po/ja.po
M src/backend/po/ru.po
M src/backend/po/sv.po
M src/backend/po/uk.po
M src/bin/initdb/po/de.po
M src/bin/initdb/po/el.po
M src/bin/initdb/po/es.po
M src/bin/initdb/po/fr.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
M src/bin/initdb/po/uk.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/po/de.po
M src/bin/pg_amcheck/po/el.po
M src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/fr.po
A src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/ru.po
A src/bin/pg_amcheck/po/sv.po
A src/bin/pg_amcheck/po/uk.po
M src/bin/pg_amcheck/po/zh_CN.po
M src/bin/pg_archivecleanup/po/de.po
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/fr.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_archivecleanup/po/sv.po
M src/bin/pg_archivecleanup/po/tr.po
M src/bin/pg_archivecleanup/po/uk.po
M src/bin/pg_archivecleanup/po/zh_CN.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_checksums/po/de.po
M src/bin/pg_checksums/po/fr.po
M src/bin/pg_checksums/po/ja.po
M src/bin/pg_checksums/po/sv.po
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/ja.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_config/po/tr.po
M src/bin/pg_config/po/uk.po
M src/bin/pg_config/po/zh_CN.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/el.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/sv.po
M src/bin/pg_controldata/po/uk.po
M src/bin/pg_controldata/po/zh_CN.po
M src/bin/pg_ctl/po/cs.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_ctl/po/el.po
M src/bin/pg_ctl/po/es.po
M src/bin/pg_ctl/po/fr.po
M src/bin/pg_ctl/po/ja.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/po/cs.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/el.po
M src/bin/pg_dump/po/es.po
M src/bin/pg_dump/po/fr.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/ru.po
M src/bin/pg_dump/po/sv.po
M src/bin/pg_dump/po/uk.po
M src/bin/pg_dump/po/zh_CN.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/de.po
A src/bin/pg_resetwal/po/el.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/fr.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_resetwal/po/sv.po
M src/bin/pg_resetwal/po/uk.po
M src/bin/pg_resetwal/po/zh_CN.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/de.po
A src/bin/pg_rewind/po/el.po
M src/bin/pg_rewind/po/es.po
M src/bin/pg_rewind/po/fr.po
M src/bin/pg_rewind/po/ja.po
M src/bin/pg_rewind/po/ru.po
M src/bin/pg_rewind/po/sv.po
M src/bin/pg_rewind/po/uk.po
M src/bin/pg_rewind/po/zh_CN.po
M src/bin/pg_test_fsync/po/de.po
M src/bin/pg_test_fsync/po/fr.po
M src/bin/pg_test_fsync/po/ja.po
M src/bin/pg_test_fsync/po/sv.po
M src/bin/pg_test_timing/po/el.po
M src/bin/pg_test_timing/po/fr.po
M src/bin/pg_test_timing/po/ja.po
M src/bin/pg_test_timing/po/ru.po
M src/bin/pg_test_timing/po/sv.po
M src/bin/pg_test_timing/po/uk.po
M src/bin/pg_test_timing/po/zh_CN.po
M src/bin/pg_upgrade/po/cs.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_upgrade/po/uk.po
M src/bin/pg_upgrade/po/zh_CN.po
M src/bin/pg_verifybackup/po/de.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/sv.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_verifybackup/po/zh_CN.po
M src/bin/pg_waldump/po/de.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/sv.po
M src/bin/psql/po/de.po
M src/bin/psql/po/el.po
M src/bin/psql/po/es.po
M src/bin/psql/po/fr.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ru.po
M src/bin/psql/po/sv.po
M src/bin/psql/po/uk.po
M src/bin/psql/po/zh_CN.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/cs.po
M src/bin/scripts/po/de.po
A src/bin/scripts/po/el.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/sv.po
M src/bin/scripts/po/tr.po
M src/bin/scripts/po/uk.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/ecpg/ecpglib/nls.mk
A src/interfaces/ecpg/ecpglib/po/el.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/fr.po
M src/interfaces/ecpg/ecpglib/po/ja.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/sv.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/ecpglib/po/zh_CN.po
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/ecpg/preproc/po/cs.po
M src/interfaces/ecpg/preproc/po/de.po
A src/interfaces/ecpg/preproc/po/el.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/ecpg/preproc/po/sv.po
M src/interfaces/ecpg/preproc/po/tr.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/ecpg/preproc/po/zh_CN.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/sv.po
M src/interfaces/libpq/po/uk.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/de.po
M src/pl/plperl/po/el.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/ja.po
M src/pl/plperl/po/ru.po
M src/pl/plperl/po/sv.po
M src/pl/plperl/po/uk.po
M src/pl/plperl/po/zh_CN.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/de.po
A src/pl/plpgsql/src/po/el.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/ja.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/sv.po
M src/pl/plpgsql/src/po/uk.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/po/el.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/ja.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/sv.po
M src/pl/plpython/po/uk.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/po/de.po
M src/pl/tcl/po/el.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/ja.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/sv.po
M src/pl/tcl/po/uk.po
M src/pl/tcl/po/zh_CN.po

pg_upgrade: Add missing gettext triggers

commit   : cd690e07fd47f245df02ab461754755956bf3e00    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 09:41:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 09:41:02 +0200    

Click here for diff

Forgot to add it in one place in the previous commit.  

M src/bin/pg_upgrade/nls.mk

pg_upgrade: Add missing gettext triggers

commit   : cd46d42a515918e88ae8ccb5990d59b3ad451455    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 08:55:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 16 May 2022 08:55:01 +0200    

Click here for diff

prep_status_progress() is new.  

M src/bin/pg_upgrade/nls.mk

Fix incorrect row estimates used for Memoize costing

commit   : 1e731ed12aac3f2ed99cf13244f5a1571a6eb6e6    
  
author   : David Rowley <[email protected]>    
date     : Mon, 16 May 2022 16:07:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 16 May 2022 16:07:56 +1200    

Click here for diff

In order to estimate the cache hit ratio of a Memoize node, one of the  
inputs we require is the estimated number of times the Memoize node will  
be rescanned.  The higher this number, the large the cache hit ratio is  
likely to become.  Unfortunately, the value being passed as the number of  
"calls" to the Memoize was incorrectly using the Nested Loop's  
outer_path->parent->rows instead of outer_path->rows.  This failed to  
account for the fact that the outer_path might be parameterized by some  
upper-level Nested Loop.  
  
This problem could lead to Memoize plans appearing more favorable than  
they might actually be.  It could also lead to extended executor startup  
times when work_mem values were large due to the planner setting overly  
large MemoizePath->est_entries resulting in the Memoize hash table being  
initially made much larger than might be required.  
  
Fix this simply by passing outer_path->rows rather than  
outer_path->parent->rows.  Also, adjust the expected regression test  
output for a plan change.  
  
Reported-by: Pavel Stehule  
Author: David Rowley  
Discussion: https://postgr.es/m/CAFj8pRAMp%3DQsMi6sPQJ4W3hczoFJRvyXHJV3AZAZaMyTVM312Q%40mail.gmail.com  
Backpatch-through: 14, where Memoize was introduced  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out

commit   : 5bcc4d09332844ae369bcf99f18ace1c982b7301    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 14 May 2022 09:57:03 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 14 May 2022 09:57:03 +0200    

Click here for diff

Reaction to a suggestion from [email protected], though this doesn't  
directly address the complaint.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/initdb.sgml

commit   : dce7072e5106456a1f1f003c2fcc2d7901ab89d8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 14 May 2022 09:03:16 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 14 May 2022 09:03:16 +0200    

Click here for diff

Suggested by David G. Johnston <[email protected]>  
  
Discussion: https://postgr.es/m/CAKFQuwYK4OqwoHscZi3yws-urv3NvVfoKHessyso5D=5qqChYQ@mail.gmail.com  

M doc/src/sgml/client-auth.sgml

Fix slow animal timeouts in 032_relfilenode_reuse.pl.

commit   : 93759c665d482b5bf76ca22c9cac91e713e9386e    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 14 May 2022 11:58:10 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 14 May 2022 11:58:10 +1200    

Click here for diff

Per BF animal chipmunk:  CREATE DATABASE could apparently fail due to an  
AV process being in the template database and not quitting fast enough  
for the 5 second timeout in CountOtherDBBackends().  The test script had  
autovacuum_naptime=1s to encourage more activity and opening of fds, but  
that wasn't strictly necessary for this test.  Take it out.  
  
Per BF animal skink:  there was a 300s timeout for all tests in the  
script, but apparently that was not enough under valgrind.  Let's use  
the standard timeout $PostgreSQL::Test::Utils::timeout_default, but  
restart it for each query we run.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKa8HNJaA24gqiiFoGy0ysndeVoJsHvX_q1-DVLFaGAmw%40mail.gmail.com  

M src/test/recovery/t/032_relfilenode_reuse.pl

Fix comment in pg_proc.c

commit   : fcab82a2d79b4533cfdc8e8d5e00dbdf6830d63a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 14 May 2022 08:27:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 14 May 2022 08:27:59 +0900    

Click here for diff

pgstat_create_function() creates stats for a function in a transactional  
fashion, so the stats would be dropped if transaction creating the  
function is aborted, not committed.  
  
Author: Amul Sul  
Discussion: https://postgr.es/m/CAAJ_b97x1T3xgAMWNj4w7kSgN0nTuG-vLrQJ4NB-dsNr0Kudxw@mail.gmail.com  

M src/backend/catalog/pg_proc.c

Clean up newlines following left parentheses

commit   : c4f113e8fef900e9e7e7c77a3a21db1535e5be72    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 13 May 2022 23:52:35 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 13 May 2022 23:52:35 +0200    

Click here for diff

Like commit c9d297751959.  

M src/backend/executor/nodeAgg.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/standby.c

relnotes: add null logical replication item

commit   : 3715850ecc524544546e696bb0a7bbc44095d12a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 13 May 2022 11:50:24 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 13 May 2022 11:50:24 -0400    

Click here for diff

Also move system view item to logical replication, mention "infinite  
_error_ loops".  
  
Reported-by: Euler Taveira, Takamichi Osumi, Amit Langote  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Rename JsonIsPredicate.value_type, fix JSON backend/nodes/ infrastructure.

commit   : 3ab9a63cb638a1fd99475668e2da9c237495aeda    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 May 2022 11:40:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 May 2022 11:40:01 -0400    

Click here for diff

I started out with the intention to rename value_type to item_type to  
avoid a collision with a typedef name that appears on some platforms.  
  
Along the way, I noticed that the adjacent field "format" was not being  
correctly handled by the backend/nodes/ infrastructure functions:  
copyfuncs.c erroneously treated it as a scalar, while equalfuncs,  
outfuncs, and readfuncs omitted handling it at all.  This looks like  
it might be cosmetic at the moment because the field is always NULL  
after parse analysis; but that's likely a bug in itself, and the code's  
certainly not very future-proof.  Let's fix it while we can still do so  
without forcing an initdb on beta testers.  
  
Further study found a few other inconsistencies in the backend/nodes/  
infrastructure for the recently-added JSON node types, so fix those too.  
  
catversion bumped because of potential change in stored rules.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/catversion.h
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h

Indent protocol.sgml

commit   : 2454cb07eed1ec7e68b9953b03d473d3c334ba05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2022 16:14:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2022 16:14:16 +0200    

Click here for diff

protocol.sgml had some unusual indentation that kept getting added on  
to with new additions in that file.  This reindents it to be more in  
line with the style elsewhere.  
  
Discussion: https://www.postgresql.org/message-id/flat/15113594-649b-ce82-24c8-7522f1373da4%40enterprisedb.com  

M doc/src/sgml/protocol.sgml

Add a new shmem_request_hook hook.

commit   : 4f2400cb3f10aa79f99fba680c198237da28dd38    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 13 May 2022 09:31:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 13 May 2022 09:31:06 -0400    

Click here for diff

Currently, preloaded libraries are expected to request additional  
shared memory and LWLocks in _PG_init().  However, it is not unusal  
for such requests to depend on MaxBackends, which won't be  
initialized at that time.  Such requests could also depend on GUCs  
that other modules might change.  This introduces a new hook where  
modules can safely use MaxBackends and GUCs to request additional  
shared memory and LWLocks.  
  
Furthermore, this change restricts requests for shared memory and  
LWLocks to this hook.  Previously, libraries could make requests  
until the size of the main shared memory segment was calculated.  
Unlike before, we no longer silently ignore requests received at  
invalid times.  Instead, we FATAL if someone tries to request  
additional shared memory or LWLocks outside of the hook.  
  
Nathan Bossart and Julien Rouhaud  
  
Discussion: https://postgr.es/m/20220412210112.GA2065815%40nathanxps13  
Discussion: https://postgr.es/m/Yn2jE/[email protected]  

M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h
M src/tools/pgindent/typedefs.list

Doc: Improve description of the "parallel_commit" option for postgres_fdw.

commit   : 8c8d307f82976122980bbccf940319d1b8a71403    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 13 May 2022 18:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 13 May 2022 18:30:00 +0900    

Click here for diff

It wasn't very clear that if this option was enabled, postgres_fdw would  
commit remote transactions in parallel at main-transaction end, and  
commit remote subtransactions in parallel at subtransaction end, due to  
the references to (sub)transaction and other too specific documentation.  
Clarify that.  Also reword to simplify.  
  
Follow-up for commit 04e706d42.  
  
Jonathan S. Katz, reviewed by Justin Pryzby, with some modifications by  
me.  
  
Discussion: https://postgr.es/m/1435bfd1-172b-de38-f590-4404a5a62eb0%40postgresql.org  

M doc/src/sgml/postgres-fdw.sgml

Indent C code in flex and bison files

commit   : 30ed71e423ee63b263730b86326da2a629a29f84    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2022 07:17:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 May 2022 07:17:29 +0200    

Click here for diff

In the style of pgindent, done semi-manually.  
  
Discussion: https://www.postgresql.org/message-id/flat/7d062ecc-7444-23ec-a159-acd8adf9b586%40enterprisedb.com  

M contrib/cube/cubeparse.y
M contrib/seg/segparse.y
M src/backend/bootstrap/bootparse.y
M src/backend/parser/gram.y
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/guc-file.l
M src/bin/pgbench/exprparse.y
M src/interfaces/ecpg/preproc/pgc.l
M src/pl/plpgsql/src/pl_gram.y

Don't report stats in LogicalRepApplyLoop() when in xact.

commit   : 0cf16cb8ca4853b084c40eca310c4c9c3ebf7e2a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 18:49:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 18:49:33 -0700    

Click here for diff

pgstat_report_stat() is only supposed to be called outside of transactions. In  
5891c7a8ed8 I added a pgstat_report_stat() call into LogicalRepApplyLoop()'s  
timeout branch. While not commonly reached inside a transaction, it is  
reachable (e.g. due to network bottlenecks or the sender being stalled / slow  
for some reason).  
  
To fix, add a !IsTransactionState() check.  
  
No test added because there's no easy way to reproduce this case without  
patching the code.  
  
Reported-By: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/worker.c

Remove PGDLLIMPORT marker from __pg_log_level

commit   : 8d3341266508fc1aed1f1a6bdb4ed885821c81b0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 13 May 2022 09:39:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 13 May 2022 09:39:13 +0900    

Click here for diff

Per discussion with Tom Lane and Andres Freund.  I have misunderstood  
the intention behind the choice done in 9a374b7.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/logging.h

Remove function declaration for function in pg_proc.

commit   : 07d683b54af854098cc559d4b8640905f9efa0ea    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:25:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:25:14 -0700    

Click here for diff

The declaration is automatically generated. Noticed when experimenting with  
adding PGDLLIMPORT markers for functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c

Add missing binary_upgrade.h includes.

commit   : 0699b1ae2d8e7b8763a2019d9cd651ab55521779    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:20:36 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:20:36 -0700    

Click here for diff

A few places used binary_upgrade_* variables without including the header,  
which worked without warnings because the variables are defined in those  
places. However that can cause linker complaints with MSVC - except that we  
don't see them right now, due to the use of a symbol export file.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c
M src/backend/commands/tablespace.c

Add 'static' to file-local variables missing it.

commit   : 09cd33f47bb32f904c32b5aabe607a5125159cc4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:19:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:19:04 -0700    

Click here for diff

Noticed when comparing the set of exported symbols without / with  
-fvisibility=hidden after adding PGDLLIMPORT to intentionally exported  
symbols.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/reloptions.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xact.c
M src/backend/catalog/storage.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/tcop/cmdtag.c

Add missing 'extern' to function prototypes.

commit   : 905c020bef99e16b37529203084cd93932e73805    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:17:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:17:14 -0700    

Click here for diff

Postgres style is to spell out extern. Noticed while scripting adding  
PGDLLIMPORT markers to functions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/rewriteheap.h
M src/include/port/win32_port.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/worker_internal.h
M src/include/storage/s_lock.h
M src/include/tsearch/dicts/regis.h
M src/include/utils/attoptcache.h
M src/include/utils/numeric.h
M src/include/utils/pgstat_internal.h
M src/include/utils/spccache.h

Do pre-release housekeeping on catalog data.

commit   : c2f436151edc818601c2499e400e1ad53d0da66f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:35:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:35:15 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  For reference, the command was  
  
./renumber_oids.pl --first-mapped-oid 8000 --target-oid 6205  

M src/include/catalog/catversion.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h

Add 23e7b38bf to git-blame-ignore-revs.

commit   : 03501aceae5d27bf5a23942035299d52600e3279    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:22:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:22:20 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification.

commit   : 23e7b38bfe396f919fdb66057174d29e17086418    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:17:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 15:17:30 -0400    

Click here for diff

Run pgindent, pgperltidy, and reformat-dat-files.  
I manually fixed a couple of comments that pgindent uglified.  

M config/check_modules.pl
M contrib/amcheck/verify_heapam.c
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/btree_gist/btree_bool.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/openssl.c
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/common/toast_internals.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/storage.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/matview.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/lib/dshash.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/value.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_zstd.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/page/bufpage.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/util.c
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/tab-complete.c
M src/bin/scripts/t/020_createdb.pl
M src/common/compression.c
M src/common/cryptohash_openssl.c
M src/common/exec.c
M src/include/access/amapi.h
M src/include/access/heapam.h
M src/include/access/rmgr.h
M src/include/access/xact.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/catalog/objectaccess.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/renumber_oids.pl
M src/include/commands/publicationcmds.h
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/fmgr.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/paths.h
M src/include/parser/analyze.h
M src/include/parser/parse_param.h
M src/include/port.h
M src/include/postmaster/pgarch.h
M src/include/replication/basebackup_target.h
M src/include/replication/decode.h
M src/include/replication/slot.h
M src/include/storage/latch.h
M src/include/tcop/tcopprot.h
M src/include/utils/formatting.h
M src/include/utils/jsonpath.h
M src/include/utils/rel.h
M src/include/utils/relmapper.h
M src/include/utils/selfuncs.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/t/002_api.pl
M src/test/icu/t/010_database.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/regress/regress.c
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl
M src/tools/PerfectHash.pm
M src/tools/ci/windows_build_config.pl
M src/tools/mark_pgdllimport.pl
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/vcregress.pl
M src/tools/pgindent/typedefs.list

libpq: drop pending pipelined commands in pqDropConnection().

commit   : 93909599cdba64c8759d646983c0a4ef93de1e50    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 12:42:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 12:42:29 -0400    

Click here for diff

The original coding did this in pqDropServerData(), which seems  
fairly backwards.  Pending commands are more like already-queued  
output data, which is dropped in pqDropConnection().  Moving the  
operation means that we clear the command queue immediately upon  
detecting connection drop, which improves the sanity of subsequent  
behavior.  In particular this eliminates duplicated error message  
text as a consequence of code added in b15f25446, which supposed  
that a nonempty command queue must mean the prior operation is  
still active.  
  
There might be an argument for backpatching this to v14; but as with  
b15f25446, I'm unsure about interactions with 618c16707.  For now,  
given the lack of complaints about v14's behavior, leave it alone.  
  
Per report from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c

commit   : b5f44225b833a2fd07b4a7c77e33ae0c37e6a7d6    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:10:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 12 May 2022 09:10:03 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_progress.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_throttle.c
M src/backend/replication/basebackup_zstd.c

Make pull_var_clause() handle GroupingFuncs exactly like Aggrefs.

commit   : 79b58c6f684315d39dfdbd721da7576d90bd9f99    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 11:31:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 12 May 2022 11:31:46 -0400    

Click here for diff

This follows in the footsteps of commit 2591ee8ec by removing one more  
ill-advised shortcut from planning of GroupingFuncs.  It's true that  
we don't intend to execute the argument expression(s) at runtime, but  
we still have to process any Vars appearing within them, or we risk  
failure at setrefs.c time (or more fundamentally, in EXPLAIN trying  
to print such an expression).  Vars in upper plan nodes have to have  
referents in the next plan level, whether we ever execute 'em or not.  
  
Per bug #17479 from Michael J. Sullivan.  Back-patch to all supported  
branches.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/var.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

relnotes: adjust several logical replication items and FK text

commit   : 25285e5d4ee5b5655ddf93204180aedc873f19d6    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 12 May 2022 10:11:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 12 May 2022 10:11:55 -0400    

Click here for diff

Reported-by: Amit Langote, Amit Kapila, Takamichi Osumi  
  
Discussion: https://postgr.es/m/CAA4eK1KdAho_fNkYRe=o=XpxWs_TG4O0V8CJBAvTG8HamWt6OQ@mail.gmail.com  

M doc/src/sgml/release-15.sgml

postgres_fdw: Update comments in make_new_connection().

commit   : 4036bcbbb92839f20ed6d0db418996954dd66470    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 12 May 2022 17:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 12 May 2022 17:30:00 +0900    

Click here for diff

Expand the comment about the parallel_commit option to mention that the  
default is false.  
  
Also, since the comment about alteration of the keep_connections option,  
which was located above the expanded comment, holds true for the  
parallel_commit option, rewrite it to reflect this, and move it to after  
the expanded comment.  
  
Follow-up for commit 04e706d42.  
  
Discussion: https://postgr.es/m/CAPmGK16Kg2Bf90sqzcZ4YM5cN_G-4h7wFUS01qQpqNB%2B2BG5_w%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Add some missing PGDLLIMPORT markings

commit   : 5edeb574285ecbcc47f0b769a7e363404db0155b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 May 2022 15:08:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 May 2022 15:08:45 +0900    

Click here for diff

Three variables in pqsignal.h (UnBlockSig, BlockSig and StartupBlockSig)  
were not marked with PGDLLIMPORT, as they are declared in a way that  
prevents mark_pgdllimport.pl to detect them.  These variables are  
redefined in a style more consistent with the other headers, allowing  
the script to find and mark them.  
  
PGDLLIMPORT was missing for __pg_log_level in logging.h, so add it  
back.  The marking got accidentally removed in 9a374b77, just after its  
addition in 8ec5694.  
  
While on it, add a comment in mark_pgdllimport.pl explaining what are  
the arguments needed by the script (aka a list of header paths).  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/logging.h
M src/include/libpq/pqsignal.h
M src/tools/mark_pgdllimport.pl

relnotes: mention non-exclusive backup mode was deprecated

commit   : 6bfecf33f6ed558deee4f801e296b058261dbef3    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:46:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:46:36 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=j9VhsFXuN+xv5qzxQV7gj-6TKqqwVLSgz5zU7F8nHCYw@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Use correct datum macros in more tuplesort specialization functions.

commit   : 7761b9faabae15217fe0e5bbb54230b425222f81    
  
author   : John Naylor <[email protected]>    
date     : Thu, 12 May 2022 09:18:21 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 12 May 2022 09:18:21 +0700    

Click here for diff

Also clarify that ApplySignedSortComparator() is not built on 32-bit machines.  
  
Folow-up to c90c16591  
  
Reviewed-by: David Rowley  
Discussion: https://www.postgresql.org/message-id/CAFBsxsFmt4_JUP8XgSJqwaAS9a9s8K8_PvMu%3Dj%3DDfwU%3D8QjNPw%40mail.gmail.com  

M src/include/utils/sortsupport.h

relnotes: add author to in-memory sorts item

commit   : d70b95a7178af84212487438b5509871090f5b05    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:19:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:19:12 -0400    

Click here for diff

Reported-by: Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGKha50-H2ye-9x3PJWU5wBq_MPc2rmVKM1xJ0tL+ntROw@mail.gmail.com  

M doc/src/sgml/release-15.sgml

relnotes: update for non-exclusive backup mode removal

commit   : da82c62469865e11c29881b42e955482194ca781    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:01:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 22:01:46 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=jmLBMAmxjcew12-yntb7m3FH-8A2+Qb7+RybZp1w9GOg@mail.gmail.com  

M doc/src/sgml/release-15.sgml

relnote: improve sorting entries

commit   : 922d1a27e9bd3415522a5ec5578c7c1324b16b93    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 20:55:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 20:55:01 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvrToHFvL-W03vSi6T50uScyhrdUGzTtcuLAjdjtRF8FLA@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Remove non-functional code for unloading loadable modules.

commit   : ab02d702ef08343fba30d90fdf7df5950063e8c9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 11 May 2022 15:27:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 11 May 2022 15:27:33 -0400    

Click here for diff

The code for unloading a library has been commented-out for over 12  
years, ever since commit 602a9ef5a7c60151e10293ae3c4bb3fbb0132d03, and we're  
no closer to supporting it now than we were back then.  
  
Nathan Bossart, reviewed by Michael Paquier and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/auto_explain/auto_explain.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/pgarch.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/include/fmgr.h
M src/pl/plpgsql/src/plpgsql.h
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c

relnotes: adjustments from Álvaro Herrera

commit   : 78ccd6cca48dab098fcce62528c2b471f7a0010a    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 11:28:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 11:28:29 -0400    

Click here for diff

Reported-by: Álvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

relnotes: update foreign key partition and add sort items

commit   : 279d957efebb4fe0636981cf0354b310fd2a109b    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 10:45:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 11 May 2022 10:45:17 -0400    

Click here for diff

Reported-by: David Rowley, Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFcEdbNinfK94aTgBJKmtkYGdtkPnjt3b0fVzKi+WZ+KA@mail.gmail.com  

M doc/src/sgml/release-15.sgml

Fix typos and grammar in code and test comments

commit   : 45edde037efc6ec76714e0be7309b348fe34351e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 15:38:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 15:38:55 +0900    

Click here for diff

This fixes the grammar of some comments in a couple of tests (SQL and  
TAP), and in some C files.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M src/backend/executor/execGrouping.c
M src/backend/parser/parse_expr.c
M src/backend/replication/basebackup_target.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

Add logging for excessive ProcSignalBarrier waits.

commit   : 0d3431497dbe91ba1e428ace4e9537c109eaff07    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 11 May 2022 18:03:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 11 May 2022 18:03:03 +1200    

Click here for diff

To enable diagnosis of systems that are not processing ProcSignalBarrier  
requests promptly, add a LOG message every 5 seconds if we seem to be  
wedged.  Although you could already see this state as a wait event in  
pg_stat_activity, the log message also shows the PID of the process that  
is preventing progress.  
  
Also add DEBUG1 logging around the whole wait loop.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BTgmoYJ03r5359gQutRGP9BtigYCg3_UskcmnVjBf-QO3-0pQ%40mail.gmail.com  

M src/backend/storage/ipc/procsignal.c

Fix the logical replication timeout during large transactions.

commit   : f95d53eded55ecbf037f6416ced6af29a2c3caca    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 11 May 2022 11:11:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 11 May 2022 11:11:44 +0530    

Click here for diff

The problem is that we don't send keep-alive messages for a long time  
while processing large transactions during logical replication where we  
don't send any data of such transactions. This can happen when the table  
modified in the transaction is not published or because all the changes  
got filtered. We do try to send the keep_alive if necessary at the end of  
the transaction (via WalSndWriteData()) but by that time the  
subscriber-side can timeout and exit.  
  
To fix this we try to send the keepalive message if required after  
processing certain threshold of changes.  
  
Reported-by: Fabrice Chapuis  
Author: Wang wei and Amit Kapila  
Reviewed By: Masahiko Sawada, Euler Taveira, Hou Zhijie, Hayato Kuroda  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAA5-nLARN7-3SLU_QUxfy510pmrYK6JJb=bk3hcgemAM_pAv+w@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/include/replication/logical.h

Silence extra logging when using "postgres -C" on runtime-computed GUCs

commit   : 8bbf8461a3a2a38ce5f2952a025385b6938a61f7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 14:21:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 14:21:06 +0900    

Click here for diff

Presently, the server may emit a variety of log messages when inspecting  
a runtime-computed GUC, mostly in the shape of one LOG message with the  
default configuration, related to the startup sequence launched as such  
GUCs require a load of the control file and of external shared  
libraries.  
  
For example, the server will always emit a "database system is shut  
down" LOG (unless the user has set log_min_messages higher than LOG),  
which is an annoying behavior as "postgres -C" is expected to only emit  
in its output the parameter value we are looking for.  The parameter  
value is sent to stdout, while the logs are sent to stderr so we could  
recommend to use a redirection, but there was not much love for this  
workaround either.  
  
To avoid such extra log messages, per discussion, this change sets  
log_min_messages to FATAL internally when -C is used on a  
runtime-computed GUC (even if set to PANIC in postgresql.conf).  At  
FATAL, the user will still receive messages explaining why a GUC value  
cannot be inspected, and will know if the command is attempted on a  
server already running, something not supported yet for a  
runtime-computed GUC.  
  
Reported-by: Magnus Hagander, Bruce Momjian  
Author: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml
M src/backend/postmaster/postmaster.c

Add missing source files to nls.mk

commit   : 3aa7a3d2a3d1177d32680b94541dc2db7f3d7b0b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 11 May 2022 06:16:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 11 May 2022 06:16:21 +0200    

Click here for diff

M src/bin/psql/nls.mk
M src/interfaces/libpq/nls.mk

relnotes: more adjustments

commit   : 38fbbb5bb293c4cceebb130b42357a2d6ee8d294    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 23:41:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 23:41:26 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

relnotes: logical replication permissions checked by subscrib.

commit   : 581c4e5b31853045473949822bcd0c90daf850fb    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 22:10:45 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 22:10:45 -0400    

Click here for diff

Reported-by: Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

relnotes: adjustments

commit   : a3c5f56c213e5799f7f5eb08890f6ddebacbb83c    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 21:57:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 21:57:11 -0400    

Click here for diff

Remove SSL item backpatched (Jonathan S. Katz), adjust logical  
replication item (Mark Dilger), adjust --compress wording (Justin  
Pryzby).  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Improve setup of environment values for commands in MSVC's vcregress.pl

commit   : 0826ac89ac18ab05b9991cfbba72351a502ef12c    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 10:21:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 11 May 2022 10:21:52 +0900    

Click here for diff

The current setup assumes that commands for lz4, zstd and gzip always  
exist by default if not enforced by a user's environment.  However,  
vcpkg, as one example, installs libraries but no binaries, so this  
default setup to assume that a command should always be present would  
cause failures.  This commit improves the detection of such external  
commands as follows:  
* If a ENV value is available, trust the environment/user and use it.  
* If a ENV value is not available, check its execution by looking in the  
current PATH, by launching a simple "$command --version" (that should be  
portable enough).  
** On execution failure, ignore ENV{command}.  
** On execution success, set ENV{command} = "$command".  
  
Note that this new rule applies to gzip, lz4 and zstd but not tar that  
we assume will always exist.  Those commands are set up in the  
environment only when using bincheck and taptest.  The CI includes all  
those commands and I have checked that their setup is correct there.  I  
have also tested this change in a MSVC environment where we have none of  
those commands.  
  
While on it, remove the references to lz4 from the documentation and  
vcregress.pl in ~v13.  --with-lz4 has been added in v14~ so there is no  
point to have this information in these older branches.  
  
Reported-by: Andrew Dunstan  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/tools/msvc/vcregress.pl

Fix some incorrect preprocessor tests in tuplesort specializations

commit   : c90c16591c438e4146b1d4b9e4539f80b58845ba    
  
author   : David Rowley <[email protected]>    
date     : Wed, 11 May 2022 11:38:13 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 11 May 2022 11:38:13 +1200    

Click here for diff

697492434 added 3 new quicksort specialization functions for common  
datatypes.  
  
That commit was not very consistent in how it would determine if we're  
compiling for 32-bit or 64-bit machines.  It would sometimes use  
USE_FLOAT8_BYVAL and at other times check if SIZEOF_DATUM == 8.  This  
could cause theoretical problems due to the way USE_FLOAT8_BYVAL is now  
defined based on SIZEOF_VOID_P >= 8.  If pointers for some reason were  
ever larger than 8-bytes then we'd end up doing 32-bit comparisons  
mistakenly.  Let's just always check SIZEOF_DATUM >= 8.  
  
It also seems that ssup_datum_signed_cmp is just never used on 32-bit  
builds, so let's just ifdef that out to make sure we never accidentally  
use that comparison function on such machines.  This also allows us to  
ifdef out 1 of the 3 new specialization quicksort functions in 32-bit  
builds which seems to shrink down the binary by over 4KB on my machine.  
  
In passing, also add the missing DatumGetInt32() / DatumGetInt64() macros  
in the comparison functions.  
  
Discussion: https://postgr.es/m/CAApHDvqcQExRhtRa9hJrJB_5egs3SUfOcutP3m+3HO8A+fZTPA@mail.gmail.com  
Reviewed-by: John Naylor  

M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

configure: don't probe for libldap_r if libldap is 2.5 or newer.

commit   : aff45c879e018d18951a9bc4cd8e2a395ee52c43    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 May 2022 18:42:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 May 2022 18:42:02 -0400    

Click here for diff

In OpenLDAP 2.5 and later, libldap itself is always thread-safe and  
there's never a libldap_r.  Our existing coding dealt with that  
by assuming it wouldn't find libldap_r if libldap is thread-safe.  
But that rule fails to cope if there are multiple OpenLDAP versions  
visible, as is likely to be the case on macOS in particular.  We'd  
end up using shiny new libldap in the backend and a hoary libldap_r  
in libpq.  
  
Instead, once we've found libldap, check if it's >= 2.5 (by  
probing for a function introduced then) and don't bother looking  
for libldap_r if so.  While one can imagine library setups that  
this'd still give the wrong answer for, they seem unlikely to  
occur in practice.  
  
Per report from Peter Eisentraut.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

relnotes: adjust sections for various items

commit   : b0d4b3c386f5372474575a4eeba2450951d9b44a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 17:49:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 17:49:51 -0400    

Click here for diff

Also improve postgres_fdw.application_name  
  
Reported-by: Justin Pryzby, Tatsuo Ishii  
  
Diagnosed-by: [email protected]  

M doc/src/sgml/release-15.sgml

relnote: add ARM64 spinlock item

commit   : 40131af573514d9915798f5fa6399ddc3d214937    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:47:48 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:47:48 -0400    

Click here for diff

Reported-by: Jonathan Katz  
  
Discussion: per private email  

M doc/src/sgml/release-15.sgml

relnotes: remove sequence replication and update 'postgres -C'

commit   : 653443ed83f03820d29604b65dca6a56f3f8ab06    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:34:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:34:11 -0400    

Click here for diff

Reported-by: Nathan Bossart, Jonathan Katz  
  
Discussion: https://postgr.es/m/20220510194456.GA3716556@nathanxps13  

M doc/src/sgml/release-15.sgml

relnote: extensive updates

commit   : 9d89bb8a025d0374f7705cea9fead4eae9ae80ed    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:05:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 16:05:12 -0400    

Click here for diff

Reported-by: Erik Rijkers, Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/release-15.sgml

Formatting and punctuation improvements in sample configuration files

commit   : 9700b250c5b84a083261add9f6e3507c9c72e076    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 21:15:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 21:15:56 +0200    

Click here for diff

M contrib/basic_archive/basic_archive.conf
M src/backend/utils/misc/postgresql.conf.sample

Remove some tabs in SQL code in C string literals

commit   : 93e6892f6717d5777c9decef301728e8bb3f011b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 20:57:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 20:57:37 +0200    

Click here for diff

This is not handled uniformly throughout the code, but at least nearby  
code can be consistent.  

M src/bin/psql/describe.c

doc: Update SQL keywords for SQL:2016 technical corrigenda

commit   : a9c018565eb306b5a884c31ca6e26efed4dfc774    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 20:31:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 10 May 2022 20:31:13 +0200    

Click here for diff

Several keywords were missing or misclassified in the original  
SQL:2016 standard.  This has been corrected in later technical  
corrigenda.  This change updates the PostgreSQL documentation  
accordingly.  
  
This also fixes a mistake in 606948b058d: The keywords JSON_SCALAR and  
JSON_SERIALIZE added there are not from SQL:2016 but from future  
SQL:202x, so they don't belong in that list yet.  
  
(606948b058d also added JSON to the reserved list, which is what the  
corrigendum also does, but failed to remove it from the nonreserved  
list.)  

M doc/src/sgml/keywords/sql2016-02-nonreserved.txt
M doc/src/sgml/keywords/sql2016-02-reserved.txt

relnotes: "training" -> "trailing"

commit   : 3c534949bbb0c7f312175879d1bf7de4f336c6e1    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 12:51:25 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 12:51:25 -0400    

Click here for diff

Reported-by: Geoff Winkless  
  
Discussion: https://postgr.es/m/CAEzk6fdF_J4jqicLz=FZ6R1u2EjpEtmzD55tFjVbxw-O-kR1=w@mail.gmail.com  

M doc/src/sgml/release-15.sgml

doc: first draft of PG 15 release notes

commit   : 9499606db00290562096d74f62cf47f953795b58    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 11:35:28 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 10 May 2022 11:35:28 -0400    

Click here for diff

M doc/src/sgml/release-15.sgml

Fix several issues with the TAP tests of pg_upgrade

commit   : 7dd3ee508432730d15c5d3032f37362f6b6e4dd8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 May 2022 11:31:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 May 2022 11:31:31 +0900    

Click here for diff

This commit addresses the following issues in the TAP tests of  
pg_upgrade, introduced in 322becb:  
- Remove --port and --host for commands that already rely on a node's  
environment PGHOST and PGPORT.  
- Switch from run_log() to command_ok(), as all the commands executed in  
the tests should succeed.  
- Change EXTRA_REGRESS_OPTS to make it count as a shell fragment (fixing  
s/OPT/OPTS on a way), to be compatible with the various Makefiles using  
it as well as 027_stream_regress.pl in the recovery tests.  The command  
built for the execution the pg_regress command is reformatted, while on  
it, to map with the recovery test doing the same thing (we should  
refactor and consolidate that in the future, perhaps).  
- Re-add the test for database names stressing the behavior of  
backslashes with double quotes, mostly here for Windows.  
  
Tests doable with the upgrade across different major versions still work  
the same way.  
  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix core dump in transformValuesClause when there are no columns.

commit   : fe20afaee8aac7838ed6e4a76baa83e547629582    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 May 2022 14:15:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 May 2022 14:15:37 -0400    

Click here for diff

The parser code that transformed VALUES from row-oriented to  
column-oriented lists failed if there were zero columns.  
You can't write that straightforwardly (though probably you  
should be able to), but the case can be reached by expanding  
a "tab.*" reference to a zero-column table.  
  
Per bug #17477 from Wang Ke.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/test/regress/expected/select.out
M src/test/regress/sql/select.sql

Revert "Disallow infinite endpoints in generate_series() for timestamps."

commit   : 29904f5f2fdafbbb96ef3685fd361053b061aeb1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 May 2022 11:02:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 May 2022 11:02:36 -0400    

Click here for diff

This reverts commit eafdf9de06e9b60168f5e47cedcfceecdc6d4b5f  
and its back-branch counterparts.  Corey Huinker pointed out that  
we'd discussed this exact change back in 2016 and rejected it,  
on the grounds that there's at least one usage pattern with LIMIT  
where an infinite endpoint can usefully be used.  Perhaps that  
argument needs to be re-litigated, but there's no time left before  
our back-branch releases.  To keep our options open, restore the  
status quo ante; if we do end up deciding to change things, waiting  
one more quarter won't hurt anything.  
  
Rather than just doing a straight revert, I added a new test case  
demonstrating the usage with LIMIT.  That'll at least remind us of  
the issue if we forget again.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CADkLM=dzw0Pvdqp5yWKxMd+VmNkAMhG=4ku7GnCZxebWnzmz3Q@mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

In REFRESH MATERIALIZED VIEW, set user ID before running user code.

commit   : 0abc1a059e27c5a71a1a186c97d9c0af407469cc    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 9 May 2022 08:35:08 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 9 May 2022 08:35:08 -0700    

Click here for diff

It intended to, but did not, achieve this.  Adopt the new standard of  
setting user ID just after locking the relation.  Back-patch to v10 (all  
supported versions).  
  
Reviewed by Simon Riggs.  Reported by Alvaro Herrera.  
  
Security: CVE-2022-1552  

M src/backend/commands/matview.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Make relation-enumerating operations be security-restricted operations.

commit   : a117cebd638dd02e5c2e791c25e43745f233111b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 9 May 2022 08:35:08 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 9 May 2022 08:35:08 -0700    

Click here for diff

When a feature enumerates relations and runs functions associated with  
all found relations, the feature's user shall not need to trust every  
user having permission to create objects.  BRIN-specific functionality  
in autovacuum neglected to account for this, as did pg_amcheck and  
CLUSTER.  An attacker having permission to create non-temp objects in at  
least one schema could execute arbitrary SQL functions under the  
identity of the bootstrap superuser.  CREATE INDEX (not a  
relation-enumerating operation) and REINDEX protected themselves too  
late.  This change extends to the non-enumerating amcheck interface.  
Back-patch to v10 (all supported versions).  
  
Sergey Shinderuk, reviewed (in earlier versions) by Alexander Lakhin.  
Reported by Alexander Lakhin.  
  
Security: CVE-2022-1552  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/utils/init/miscinit.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Add missing source files to nls.mk

commit   : f45f8b7ff3fe6c8b8139e177bb3fec7629ef9f05    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 9 May 2022 07:17:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 9 May 2022 07:17:08 +0200    

Click here for diff

M src/bin/pg_amcheck/nls.mk
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_checksums/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_test_fsync/nls.mk
M src/bin/scripts/nls.mk

Fix control file update done in restartpoints still running after promotion

commit   : 7863ee4def653f2c2193cb0b0cf4a8f0f3ca6c56    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 9 May 2022 08:39:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 9 May 2022 08:39:59 +0900    

Click here for diff

If a cluster is promoted (aka the control file shows a state different  
than DB_IN_ARCHIVE_RECOVERY) while CreateRestartPoint() is still  
processing, this function could miss an update of the control file for  
"checkPoint" and "checkPointCopy" but still do the recycling and/or  
removal of the past WAL segments, assuming that the to-be-updated LSN  
values should be used as reference points for the cleanup.  This causes  
a follow-up restart attempting crash recovery to fail with a PANIC on a  
missing checkpoint record if the end-of-recovery checkpoint triggered by  
the promotion did not complete while the cluster abruptly stopped or  
crashed before the completion of this checkpoint.  The PANIC would be  
caused by the redo LSN referred in the control file as located in a  
segment already gone, recycled by the previous restartpoint with  
"checkPoint" out-of-sync in the control file.  
  
This commit fixes the update of the control file during restartpoints so  
as "checkPoint" and "checkPointCopy" are updated even if the cluster has  
been promoted while a restartpoint is running, to be on par with the set  
of WAL segments actually recycled in the end of CreateRestartPoint().  
  
This problem exists in all the stable branches.  However, commit  
7ff23c6, by removing the last call of CreateCheckPoint() from the  
startup process, has made this bug much easier to reason about as  
concurrent checkpoints are not possible anymore.  No backpatch is done  
yet, mostly out of caution from me as a point release is close by, but  
we need to think harder about the case of concurrent checkpoints at  
promotion if the bgwriter is not considered as running by the startup  
process in ~v14, so this change is done only on HEAD for the moment.  
  
Reported-by: Fujii Masao, Rui Zhao  
Author: Kyotaro Horiguchi  
Reviewed-by: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Fix race in 032_relfilenode_reuse.pl.

commit   : a22652ebbcb33a6a271cc69841ad61d971d7db30    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 8 May 2022 16:54:09 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 8 May 2022 16:54:09 +1200    

Click here for diff

Add wait_for_catchup() call to the test added by commit e2f65f42.  Per  
slow build farm animal grison.  
  
Also fix a comment.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLJ2Vy8hVQmnYotmTaEKZK0%3D-GcXgNAgcHzArZvtS4L_g%40mail.gmail.com  

M src/test/recovery/t/032_relfilenode_reuse.pl

Under has_wal_read_bug, skip contrib/bloom/t/001_wal.pl.

commit   : ad76c9708bd1a333c28e7be2178e34b745fb23d1    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 7 May 2022 00:33:15 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 7 May 2022 00:33:15 -0700    

Click here for diff

Per buildfarm members snapper and kittiwake.  Back-patch to v10 (all  
supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/t/001_wal.pl

Fix old-fd issues using global barriers everywhere.

commit   : e2f65f42555ff531c6d7c8f151526b4ef7c016f8    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 7 May 2022 15:19:52 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 7 May 2022 15:19:52 +1200    

Click here for diff

Commits 4eb21763 and b74e94dc introduced a way to force every backend to  
close all relation files, to fix an ancient Windows-only bug.  
  
This commit extends that behavior to all operating systems and adds  
a couple of extra barrier points, to fix a totally different class of  
bug: the reuse of relfilenodes in scenarios that have no other kind of  
cache invalidation to prevent file descriptor mix-ups.  
  
In all releases, data corruption could occur when you moved a database  
to another tablespace and then back again.  Despite that, no back-patch  
for now as the infrastructure required is too new and invasive.  In  
master only, since commit aa010514, it could also happen when using  
CREATE DATABASE with a user-supplied OID or via pg_upgrade.  
  
Author: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de  

M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/include/pg_config_manual.h
M src/test/recovery/Makefile
A src/test/recovery/t/032_relfilenode_reuse.pl

Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.

commit   : b74e94dc27fdbb13954f230b1d1298430afa6c0c    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 7 May 2022 16:19:42 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 7 May 2022 16:19:42 +1200    

Click here for diff

With sufficiently bad luck, it was possible for IssuePendingWritebacks()  
to reopen a file after we'd processed PROCSIGNAL_BARRIER_SMGRRELEASE and  
before the file was unlinked by some other backend.  That left a small  
hole in commit 4eb21763's plan to fix all spurious errors from DROP  
TABLESPACE and similar on Windows.  
  
Fix by closing md.c's segments, instead of just closing fd.c's  
descriptors, and then teaching smgrwriteback() not to open files that  
aren't already open.  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de  

M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/md.h
M src/include/storage/smgr.h

Fix misleading comments about background worker registration.

commit   : 701d918a426b394620ce4d046533f77262c70829    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 6 May 2022 09:24:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 6 May 2022 09:24:06 -0400    

Click here for diff

Since 6bc8ef0b7f1f1df3998745a66e1790e27424aa0c, the maximum number  
of backends can't change as background workers are registered, but  
these comments still reflect the way things worked prior to that.  
  
Also, per recent discussion, some modules call SetConfigOption()  
from _PG_init(). It's not entirely clear to me whether we want to  
regard that as a fully supported operation, but since we know it's  
a thing that happens, it at least deserves a mention in the comments,  
so add that.  
  
Nathan Bossart, reviewed by Anton A. Melnikov  
  
Discussion: http://postgr.es/m/20220419154658.GA2487941@nathanxps13  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c

pgcrypto: remove questionmark from error message

commit   : ee97d46cdb7e23f8ee98fe22648a1c3c75a80261    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:36 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:36 +0200    

Click here for diff

The PXE_CIPHER_INIT error is used to report initialization errors, so  
appending a questionmark to the error isn't entirely accurate (using a  
space before the questionmark doubly so).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/expected/blowfish_1.out
M contrib/pgcrypto/expected/cast5_1.out
M contrib/pgcrypto/expected/des_1.out
M contrib/pgcrypto/px.c

pgcrypto: report init errors as PXE_CIPHER_INIT

commit   : 0250a167a07d4d2cff932e467d84306cbd3704fe    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:33 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:33 +0200    

Click here for diff

Report OpenSSL errors during initialization as PXE_CIPHER_INIT since  
that's just what they were, and not generic unknown errors. This also  
removes the last users of the generic error, and thus it can be removed.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h

Clear the OpenSSL error queue before cryptohash operations

commit   : 17ec5fa502d299b1919b1afacda839fb7d8206ad    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:31 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 6 May 2022 14:41:31 +0200    

Click here for diff

Setting up an EVP context for ciphers banned under FIPS generate  
two OpenSSL errors in the queue, and as we only consume one from  
the queue the other is at the head for the next invocation:  
  
  postgres=# select md5('foo');  
  ERROR:  could not compute MD5 hash: unsupported  
  postgres=# select md5('foo');  
  ERROR:  could not compute MD5 hash: initialization error  
  
Clearing the error queue when creating the context ensures that  
we don't pull in an error from an earlier operation.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/cryptohash_openssl.c
M src/common/hmac_openssl.c

Fix typo in origin.c

commit   : 59a32f00937c85fe944cf1fac3e8b98d091e2bc6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 6 May 2022 20:01:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 6 May 2022 20:01:15 +0900    

Click here for diff

Introduced in 5aa2350.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PsuWz6_7aCmivNU5FahgQxDUTQtc3+__XnWkBzQcfn43w@mail.gmail.com  

M src/backend/replication/logical/origin.c

Update SQL features

commit   : 7e367924e33e47e0b0b135b0649c406a589bd496    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:17:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:17:38 +0200    

Click here for diff

Update a few items that have become supported or mostly supported but  
weren't updated at the time.  

M src/backend/catalog/sql_features.txt

Fix some whitespace in documentation markup

commit   : 7d6a4fdf3243a7a18e2cfc6cf03bce01cc6ce651    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:14:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:14:15 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Fix typos

commit   : a6f12520bed073d1d548a691e85d7f5371cc4ed4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:07:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 May 2022 09:07:14 +0200    

Click here for diff

introduced by 222b697ec077047024a96392a2f5cb9b1803ccf7  

M doc/src/sgml/func.sgml

Update time zone data files to tzdata release 2022a.

commit   : ab3479bf55066f3dc827796f5bf1e957ffc97d2d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 5 May 2022 14:54:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 5 May 2022 14:54:53 -0400    

Click here for diff

DST law changes in Palestine.  Historical corrections for  
Chile and Ukraine.  

M src/timezone/data/tzdata.zi

Fix timing issue in deadlock recovery conflict test.

commit   : 9e6b7b45ca92cccd6b870fa4e0a98059a86ce79d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 May 2022 12:50:38 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 May 2022 12:50:38 -0700    

Click here for diff

Per buildfarm members longfin and skink.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

M src/test/recovery/t/031_recovery_conflict.pl

Fix rowcount estimate for SubqueryScan that's under a Gather.

commit   : c40ba5f318f96a6a5a29729b987ead11c5dc65c1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 4 May 2022 14:44:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 4 May 2022 14:44:40 -0400    

Click here for diff

SubqueryScan was always getting labeled with a rowcount estimate  
appropriate for non-parallel cases.  However, nodes that are  
underneath a Gather should be treated as processing only one  
worker's share of the rows, whether the particular node is explicitly  
parallel-aware or not.  Most non-scan-level node types get this  
right automatically because they base their rowcount estimate on  
that of their input sub-Path(s).  But SubqueryScan didn't do that,  
instead using the whole-relation rowcount estimate as if it were  
a non-parallel-aware scan node.  If there is a parallel-aware node  
below the SubqueryScan, this is wrong, and it results in inflating  
the cost estimates for nodes above the SubqueryScan, which can cause  
us to not choose a parallel plan, or choose a silly one --- as indeed  
is visible in the one regression test whose results change with this  
patch.  (Although that plan tree appears to contain no SubqueryScans,  
there were some in it before setrefs.c deleted them.)  
  
To fix, use path->subpath->rows not baserel->tuples as the number  
of input tuples we'll process.  This requires estimating the quals'  
selectivity afresh, which is slightly annoying; but it shouldn't  
really add much cost thanks to the caching done in RestrictInfo.  
  
This is pretty clearly a bug fix, but I'll refrain from back-patching  
as people might not appreciate plan choices changing in stable branches.  
The fact that it took us this long to identify the bug suggests that  
it's not a major problem.  
  
Per report from bucoo, though this is not his proposed patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/incremental_sort.out

Remove JsonPathSpec typedef

commit   : dc2be6ed47e54004666a78e1592896c08f2be80e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 17:36:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 17:36:31 +0200    

Click here for diff

It doesn't seem very useful, and it's a bit in the way of the planned  
node support automation.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/parser/parse_jsontable.c
M src/include/nodes/parsenodes.h

Add missing enum tag in enum used in nodes

commit   : d47a11da9e5c5bad3eb0f353ab7b883d3f0eb48a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 17:34:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 17:34:22 +0200    

Click here for diff

Similar to 983bdc4fac492a99bb8ab5a471ca7437139e5cf6.  
  
Author: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/parsenodes.h

Simplify configure test

commit   : cfb63b994e91af8315f5262b3dc630c565f2420a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 13:33:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 13:33:59 +0200    

Click here for diff

The test for lz4.h used AC_CHECK_HEADERS, but nothing was using the  
resulting symbol HAVE_LZ4_H.  Change this to use AC_CHECK_HEADER  
instead.  This was probably an oversight, seeing that the nearby  
similar tests do this correctly.  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Rename libpq test programs with libpq_ prefix

commit   : 0432490d290f679cad773ce4735e8769e2c4db75    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 4 May 2022 14:15:25 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 4 May 2022 14:15:25 +0200    

Click here for diff

The testclient and uri-regress programs in the libpq test suite had  
quite generic names which didn't convey much meaning. Since they are  
installed as part of the MSVC test runs, ensure that their purpose  
is a little bit clearer by renaming with a libpq_ prefix. While at  
it rename uri-regress to uri_regress to avoid mixing dash and under-  
score in the same filename.  
  
Reported-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile
R088 src/interfaces/libpq/test/testclient.c src/interfaces/libpq/test/libpq_testclient.c
R090 src/interfaces/libpq/test/uri-regress.c src/interfaces/libpq/test/libpq_uri_regress.c
M src/tools/msvc/Mkvcbuild.pm

Fix incorrect format placeholders

commit   : 2e77180d4572ddb892f9c2e253ee95dc0fa26b5f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 07:57:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 4 May 2022 07:57:39 +0200    

Click here for diff

M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/xactdesc.c

Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin().

commit   : 8f1537d10e83ad9c23ed2772cc28f74582b237ea    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 2 May 2022 18:25:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 2 May 2022 18:25:00 -0700    

Click here for diff

The tests added in 9f8a050f68d failed nearly reliably on FreeBSD in CI, and  
occasionally on the buildfarm. That turns out to be caused not by a bug in the  
test, but by a longstanding bug in recovery conflict handling.  
  
The standby timeout handler, used by ResolveRecoveryConflictWithBufferPin(),  
executed SendRecoveryConflictWithBufferPin() inside a signal handler. A bad  
idea, because the deadlock timeout handler (or a spurious latch set) could  
have interrupted ProcWaitForSignal(). If unlucky that could cause a  
self-deadlock on ProcArrayLock, if the deadlock check is in  
SendRecoveryConflictWithBufferPin()->CancelDBBackends().  
  
To fix, set a flag in StandbyTimeoutHandler(), and check the flag in  
ResolveRecoveryConflictWithBufferPin().  
  
Subsequently the recovery conflict tests will be backpatched.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

M src/backend/storage/ipc/standby.c

Add tests for recovery deadlock conflicts.

commit   : 21e184403bf92c52191d1f03dd6566a3d54dc907    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 2 May 2022 17:19:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 2 May 2022 17:19:11 -0700    

Click here for diff

The recovery conflict tests added in 9f8a050f68d surfaced a bug in the  
interaction between buffer pin and deadlock recovery conflicts. To make sure  
that the bugfix won't break deadlock conflict detection, add a test for that  
scenario.  
  
031_recovery_conflict.pl will later be backpatched, with this included.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/031_recovery_conflict.pl

basebackup_to_shell: Add missing MarkGUCPrefixReserved()

commit   : 7307988abdff6c948d87e6d9dc9aaaa1f4c5283f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 2 May 2022 20:16:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 2 May 2022 20:16:19 +0900    

Click here for diff

Oversight in c6306db24, as per a requirement from 88103567.  All the  
other modules in the tree, be they in contrib/ or src/test/modules/,  
already do that.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACUy7q_KwSMda+2SHPSWep32tNUM8cXGRS3=-Vfodo9OUg@mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c

Fix typo in comment.

commit   : d89f97e83efed4b2ac0a1803a1b6813c8277de73    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 2 May 2022 16:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 2 May 2022 16:45:00 +0900    

Click here for diff

M src/backend/storage/ipc/latch.c

pg_walinspect: fix case where flush LSN is in the middle of a record.

commit   : ed57cac84d1c5642737dab1e4c4b8cb4f0c4305f    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 30 Apr 2022 08:28:33 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 30 Apr 2022 08:28:33 -0700    

Click here for diff

Instability in the test for pg_walinspect revealed that  
pg_get_wal_records_info_till_end_of_wal(x) would try to decode all the  
records with a start LSN earlier than the flush LSN, even though that  
might include a partial record at the end of the range. In that case,  
read_local_xlog_page_no_wait() would return NULL when it tried to read  
past the flush LSN, which would be interpreted as an error by the  
caller. That caused a test failure only on a BF animal that had been  
restarted recently, but could be expected to happen in the wild quite  
easily depending on the alignment of various parameters.  
  
Fix by using private data in read_local_xlog_page_no_wait() to signal  
end-of-wal to the caller, so that it can be properly distinguished  
from a real error.  
  
Discussion: https://postgr.es/m/Ymd/e5eeZMNAkrXo%40paquier.xyz  
Discussion: https://postgr.es/m/[email protected]  
  
Authors: Thomas Munro, Bharath Rupireddy.  

M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/xlogutils.c
M src/include/access/xlogutils.h

Tighten enforcement of variable CONSTANT markings in plpgsql.

commit   : ccd10a9bfa54c1aad3561232bf24222f1b455e1c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2022 11:54:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 30 Apr 2022 11:54:28 -0400    

Click here for diff

I noticed that plpgsql would allow assignment of a new value to a  
variable even when that variable is marked CONSTANT, if the variable  
is used as an output parameter in CALL or is a refcursor variable  
that OPEN assigns a new value to.  Fix these oversights.  
  
In the CALL case, the check has to be done at runtime because we  
cannot know at parse time which parameters are OUT parameters.  
For OPEN, it seems best to likewise enforce at runtime because  
then we needn't throw error if the variable has a nonnull value  
(since OPEN will only try to overwrite a null value).  
  
Although this is surely a bug fix, no back-patch: it seems unlikely  
that anyone would thank us for breaking formerly-working code in  
minor releases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Claim SQL standard compliance for SQL/JSON features

commit   : a79153b7a28579bda02e0d72464383dca4929e62    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2022 09:01:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 29 Apr 2022 09:01:05 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/sql_features.txt

Fix JSON_OBJECTAGG uniquefying bug

commit   : 9c3d25e17894f35045a2d57dfb834e25c9dc4c21    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 28 Apr 2022 15:28:20 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 28 Apr 2022 15:28:20 -0400    

Click here for diff

Commit f4fb45d15c contained a bug in removing items with null values when  
unique keys are required, where the leading items that are sorted  
contained such values. Fix that and add a test for it.  
  
Discussion: https://postgr.es/m/CAJA4AWQ_XbSmsNbW226UqNyRLJ+wb=iQkQMj77cQyoNkqtf=2Q@mail.gmail.com  

M src/backend/utils/adt/jsonb_util.c
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Disable asynchronous execution if using gating Result nodes.

commit   : 5c854e7a2c8a6cd26040e0f9949e7a4a007f6366    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 28 Apr 2022 15:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 28 Apr 2022 15:15:00 +0900    

Click here for diff

mark_async_capable_plan(), which is called from create_append_plan() to  
determine whether subplans are async-capable, failed to take into  
account that the given subplan created from a given subpath might  
include a gating Result node if the subpath is a SubqueryScanPath or  
ForeignPath, causing a segmentation fault there when the subplan created  
from a SubqueryScanPath includes the Result node, or causing  
ExecAsyncRequest() to throw an error about an unrecognized node type  
when the subplan created from a ForeignPath includes the Result node,  
because in the latter case the Result node was unintentionally  
considered as async-capable, but we don't currently support executing  
Result nodes asynchronously.  Fix by modifying mark_async_capable_plan()  
to disable asynchronous execution in such cases.  Also, adjust code in  
the ProjectionPath case in mark_async_capable_plan(), for consistency  
with other cases, and adjust/improve comments there.  
  
is_async_capable_path() added in commit 27e1f1456, which was rewritten  
to mark_async_capable_plan() in a later commit, has the same issue,  
causing the error at execution mentioned above, so back-patch to v14  
where the aforesaid commit went in.  
  
Per report from Justin Pryzby.  
  
Etsuro Fujita, reviewed by Zhihong Yu and Justin Pryzby.  
  
Discussion: https://postgr.es/m/20220408124338.GK24419%40telsasoft.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/createplan.c

Revert recent changes with durable_rename_excl()

commit   : 55b56865115eccd6449e79d6f06fe49d6ba3b792    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 13:08:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 13:08:16 +0900    

Click here for diff

This reverts commits 2c902bb and ccfbd92.  Per buildfarm members  
kestrel, rorqual and calliphoridae, the assertions checking that a TLI  
history file should not exist when created by a WAL receiver have been  
failing, and switching to durable_rename() over durable_rename_excl()  
would cause the newest TLI history file to overwrite the existing one.  
We need to think harder about such cases, so revert the new logic for  
now.  
  
Note that all the failures have been reported in the test  
025_stuck_on_old_timeline.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/basic_archive/basic_archive.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Fix SQL syntax in comment in logical/worker.c

commit   : e84f82ab5cff2811745ae8e2ac163a4b8b733394    
  
author   : John Naylor <[email protected]>    
date     : Thu, 28 Apr 2022 09:27:32 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 28 Apr 2022 09:27:32 +0700    

Click here for diff

Euler Taveira  
  
Disussion: https://www.postgresql.org/message-id/25f95189-eef8-43c4-9d7b-419b651963c8%40www.fastmail.com  

M src/backend/replication/logical/worker.c

Remove durable_rename_excl()

commit   : 2c902bbf1911a3c3dd68b817209eca9be81e381c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 11:10:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 11:10:40 +0900    

Click here for diff

ccfbd92 has replaced all existing in-core callers of this function in  
favor of durable_rename().  durable_rename_excl() is by nature unsafe on  
crashes happening at the wrong time, so just remove it.  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  

M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Replace existing durable_rename_excl() calls with durable_rename()

commit   : ccfbd9287d70038518bdd3e85d7f5fd3dd1bb880    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 10:11:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Apr 2022 10:11:45 +0900    

Click here for diff

durable_rename_excl() attempts to avoid overwriting any existing files  
by using link() and unlink(), falling back to rename() on some platforms  
(e.g., Windows where link() followed by unlink() is not concurrent-safe,  
see 909b449).  Most callers of durable_rename_excl() use it just in case  
there is an existing file, but it happens that for all of them we never  
expect a target file to exist (WAL segment recycling, creation of  
timeline history file and basic_archive).  
  
basic_archive used durable_rename_excl() to avoid overwriting an archive  
concurrently created by another server.  Now, there is a stat() call to  
avoid overwriting an existing archive a couple of lines above, so note  
that this change opens a small TOCTOU window in this module between the  
stat() call and durable_rename().  
  
Furthermore, as mentioned in the top comment of durable_rename_excl(),  
this routine can result in multiple hard links to the same file and data  
corruption, with two or more links to the same file in pg_wal/ if a  
crash happens before the unlink() call during WAL recycling.  
Specifically, this would produce links to the same file for the current  
WAL file and the next one because the half-recycled WAL file was  
re-recycled during crash recovery of a follow-up cluster restart.  
  
This change replaces all calls to durable_rename_excl() with  
durable_rename().  This removes the protection against accidentally  
overwriting an existing file, but some platforms are already living  
without it, and all those code paths never expect an existing file (a  
couple of assertions are added to check after that, in case).  
  
This is a bug fix, but knowing the unlikeliness of the problem involving  
one of more crashes at an exceptionally bad moment, no backpatch is  
done.  This could be revisited in the future.  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  

M contrib/basic_archive/basic_archive.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c

Fix incorrect format placeholders

commit   : 755df30e48b0a9ff8428f4c1ccb468dac29fc320    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Apr 2022 09:49:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Apr 2022 09:49:10 +0200    

Click here for diff

M src/backend/executor/execExprInterp.c
M src/backend/utils/activity/pgstat_xact.c

Handle NULL fields in WRITE_INDEX_ARRAY

commit   : 9ddf251f94090cebf1bd8fc18396cb8a4b580d04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 27 Apr 2022 09:15:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 27 Apr 2022 09:15:09 +0200    

Click here for diff

Unlike existing WRITE_*_ARRAY macros, WRITE_INDEX_ARRAY needs to  
handle the case that the field is NULL.  We already have the  
convention to print NULL fields as "<>", so we do that here as well.  
There is currently no corresponding read function for this, so reading  
this back in is not implemented, but it could be if needed.  
  
Reported-by: Richard Guo <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs4-LN%3DbF8f9eU2R94dJtF54DfDvBq%2BovqHnOQqbinYDrUw%40mail.gmail.com  

M src/backend/nodes/outfuncs.c

Fix typo in pg_walinspect.c

commit   : 06cafd6f577ba251ac10d4f009fc3be424705a37    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Apr 2022 14:24:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Apr 2022 14:24:13 +0900    

Click here for diff

Spotted while looking at the surroundings, introduced by 2258e76.  

M contrib/pg_walinspect/pg_walinspect.c

Add some isolation tests for CLUSTER

commit   : 21a10368eb3fce73f146d7e48b4d81496f60d965    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Apr 2022 13:41:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Apr 2022 13:41:17 +0900    

Click here for diff

This commit adds two isolation tests for CLUSTER, using:  
- A normal table, making sure that CLUSTER blocks and completes if the  
table is locked by a concurrent session.  
- A partitioned table with a partition owned by a different user.  If  
the partitioned table is locked by a concurrent session, CLUSTER on the  
partitioned table should block.  If the partition owned by a different  
user is locked, CLUSTER on its partitioned table should complete and  
skip the partition.  3f19e17 has added an early check to ignore such a  
partition with a SQL regression test, but this was not checking that  
CLUSTER should not block.  
  
Discussion: https://postgr.es/m/[email protected]  

A src/test/isolation/expected/cluster-conflict-partition.out
A src/test/isolation/expected/cluster-conflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/cluster-conflict-partition.spec
A src/test/isolation/specs/cluster-conflict.spec

Inhibit mingw CRT's auto-globbing of command line arguments

commit   : b787c554c264cbed4de4eff2bb170a5224f0cfa5    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 25 Apr 2022 15:02:13 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 25 Apr 2022 15:02:13 -0400    

Click here for diff

For some reason by default the mingw C Runtime takes it upon itself to  
expand program arguments that look like shell globbing characters. That  
has caused much scratching of heads and mis-attribution of the causes of  
some TAP test failures, so stop doing that.  
  
This removes an inconsistency with Windows binaries built with MSVC,  
which have no such behaviour.  
  
Per suggestion from Noah Misch.  
  
Backpatch to all live branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/exec.c

Drop unlogged table after test is done

commit   : dec8ad367e46180f826d5b6dc820fbecba1b71d2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 15:48:13 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 15:48:13 +0200    

Click here for diff

Another test is constructed on top of regression tests, which does not  
work correctly with unlogged tables.  For now, cope with that by making  
sure no unlogged table is left behind.  
  
Per buildfarm pink after 4fb5c794e586.  

M src/test/regress/expected/spgist.out
M src/test/regress/sql/spgist.sql

Cover brin/gin/gist/spgist ambuildempty routines in regression tests

commit   : 4fb5c794e58613561f94ad5ea1197729be7791dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 15:00:49 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 15:00:49 +0200    

Click here for diff

Changing some TEMP or permanent tables to UNLOGGED is sufficient to  
invoke these ambuildempty routines, which were all not uncovered by any  
tests.  These changes do not otherwise affect the test suite.  
  
Author: Amul Sul <[email protected]>  
Discussion: https://postgr.es/m/CAAJ_b95nneRCLM-=qELEdgCYSk6W_++-C+Q_t+wH3SW-hF50iw@mail.gmail.com  

M src/test/regress/expected/brin.out
M src/test/regress/expected/gin.out
M src/test/regress/expected/gist.out
M src/test/regress/expected/spgist.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/gin.sql
M src/test/regress/sql/gist.sql
M src/test/regress/sql/spgist.sql

Always pfree strings returned by GetDatabasePath

commit   : 0bd56172b2871e94c0d7115ffbf430308317ac49    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 10:32:13 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 25 Apr 2022 10:32:13 +0200    

Click here for diff

Several places didn't do it, and in many cases it didn't matter because  
it would be a small allocation in a short-lived context; but other  
places may accumulate a few (for example, in CreateDatabaseUsingFileCopy,  
one per tablespace).  In most databases this is highly unlikely to be  
very serious either, but it seems better to make the code consistent in  
case there's future copy-and-paste.  
  
The only case of actual concern seems to be the aforementioned routine,  
which is new with commit 9c08aea6a309, so there's no need to backpatch.  
  
As pointed out by Coverity.  

M src/backend/commands/dbcommands.c
M src/backend/utils/init/postinit.c

Fix incautious CTE matching in rewriteSearchAndCycle().

commit   : f819020d400f1dbd96ee1a9fd44a1f6f44932b4d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 23 Apr 2022 12:16:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 23 Apr 2022 12:16:12 -0400    

Click here for diff

This function looks for a reference to the recursive WITH CTE,  
but it checked only the CTE name not ctelevelsup, so that it could  
seize on a lower CTE that happened to have the same name.  This  
would result in planner failures later, either weird errors such as  
"could not find attribute 2 in subquery targetlist", or crashes  
or assertion failures.  The code also merely Assert'ed that it found  
a matching entry, which is not guaranteed at all by the parser.  
  
Per bugs #17320 and #17318 from Zhiyong Wu.  
Thanks to Kyotaro Horiguchi for investigation.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteSearchCycle.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Test ALIGNOF_DOUBLE==4 compatibility under ALIGNOF_DOUBLE==8.

commit   : c1da0acbb06e9175044b436d14c51cef03339109    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 22 Apr 2022 20:20:11 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 22 Apr 2022 20:20:11 -0700    

Click here for diff

Today's test case detected alignment problems only when executing on  
AIX.  This change lets popular platforms detect the same problems.  
  
Reviewed by Masahiko Sawada.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/test_setup.out
M src/test/regress/regress.c
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/test_setup.sql

Remove some recently-added pg_dump test cases.

commit   : a66e722cc1180cd7a2046fb552195a7d7703a592    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 22 Apr 2022 16:16:52 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 22 Apr 2022 16:16:52 -0400    

Click here for diff

Commit d2d35479796c3510e249d6fc72adbd5df918efbf included a pretty  
extensive set of test cases, and some of them don't work on all  
of our Windows machines. This happens because IPC::Run expands  
its arguments as shell globs on a few machines, but doesn't on most  
of the buildfarm. It might be good to fix that problem systematically  
somehow, but in the meantime, there are enough test cases for this  
commit that it seems OK to just remove the ones that are failing.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CA+TgmoYRGUcFBy6VgN0+Pn4f6Wv=2H0HZLuPHqSy6VC8Ba7vdg@mail.gmail.com  

M src/bin/pg_dump/t/002_pg_dump.pl

commit   : 826be1ffb28dde083552150243dbbdcac55ab28e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 22 Apr 2022 11:19:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 22 Apr 2022 11:19:17 +0200    

Click here for diff

Formal tables should generally have an xref in the text that points to  
them.  Add them here.  

M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml

Fix performance regression in tuplesort specializations

commit   : 99c754129d787ea4ce3b34b9f4c5f5e74c45ab6a    
  
author   : David Rowley <[email protected]>    
date     : Fri, 22 Apr 2022 16:02:15 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 22 Apr 2022 16:02:15 +1200    

Click here for diff

697492434 added 3 new qsort specialization functions aimed to improve the  
performance of sorting many of the common pass-by-value data types when  
they're the leading or only sort key.  
  
Unfortunately, that has caused a performance regression when sorting  
datasets where many of the values being compared were equal.  What was  
happening here was that we were falling back to the standard sort  
comparison function to handle tiebreaks.  When the two given Datums  
compared equally we would incur both the overhead of an indirect function  
call to the standard comparer to perform the tiebreak and also the  
standard comparer function would go and compare the leading key needlessly  
all over again.  
  
Here improve the situation in the 3 new comparison functions.  We now  
return 0 directly when the two Datums compare equally and we're performing  
a 1-key sort.  
  
Here we don't do anything to help the multi-key sort case where the  
leading key uses one of the sort specializations functions.  On testing  
this case, even when the leading key's values are all equal, there  
appeared to be no performance regression.  Let's leave it up to future  
work to optimize that case so that the tiebreak function no longer  
re-compares the leading key over again.  
  
Another possible fix for this would have been to add 3 additional sort  
specialization functions to handle single-key sorts for these  
pass-by-value types.  The reason we didn't do that here is that we may  
deem some other sort specialization to be more useful than single-key  
sorts.  It may be impractical to have sort specialization functions for  
every single combination of what may be useful and it was already decided  
that further analysis into which ones are the most useful would be delayed  
until the v16 cycle.  Let's not let this regression force our hand into  
trying to make that decision for v15.  
  
Author: David Rowley  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CA+hUKGJRbzaAOUtBUcjF5hLtaSHnJUqXmtiaLEoi53zeWSizeA@mail.gmail.com  

M src/backend/utils/sort/tuplesort.c

Remove inadequate assertion check in CTE inlining.

commit   : 92e7a537520927107742af654619e55f34072942    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 17:58:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 17:58:52 -0400    

Click here for diff

inline_cte() expected to find exactly as many references to the  
target CTE as its cterefcount indicates.  While that should be  
accurate for the tree as emitted by the parser, there are some  
optimizations that occur upstream of here that could falsify it,  
notably removal of unused subquery output expressions.  
  
Trying to make the accounting 100% accurate seems expensive and  
doomed to future breakage.  It's not really worth it, because  
all this code is protecting is downstream assumptions that every  
referenced CTE has a plan.  Let's convert those assertions to  
regular test-and-elog just in case there's some actual problem,  
and then drop the failing assertion.  
  
Per report from Tomas Vondra (thanks also to Richard Guo for  
analysis).  Back-patch to v12 where the faulty code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Fix missed cases in libpq's error handling.

commit   : 914611ea738a3601717990faff0f5d71a0f14a3d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 17:12:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 17:12:49 -0400    

Click here for diff

Commit 618c16707 invented an "error_result" flag in PGconn, which  
intends to represent the state that we have an error condition and  
need to build a PGRES_FATAL_ERROR PGresult from the message text in  
conn->errorMessage, but have not yet done so.  (Postponing construction  
of the error object simplifies dealing with out-of-memory conditions  
and with concatenation of messages for multiple errors.)  For nearly all  
purposes, this "virtual" PGresult object should act the same as if it  
were already materialized.  But a couple of places in fe-protocol3.c  
didn't get that memo, and were only testing conn->result as they used  
to, without also checking conn->error_result.  
  
In hopes of reducing the probability of similar mistakes in future,  
I invented a pgHavePendingResult() macro that includes both tests.  
  
Per report from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

Rethink method for assigning OIDs to the template0 and postgres DBs.

commit   : 2cb1272445d2a6616991fc6ede274d9f1f62ff73    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 16:23:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 16:23:12 -0400    

Click here for diff

Commit aa0105141 assigned fixed OIDs to template0 and postgres  
in a very ad-hoc way.  Notably, instead of teaching Catalog.pm  
about these OIDs, the unused_oids script was just hacked to  
not show them as unused.  That's problematic since, for example,  
duplicate_oids wouldn't report any future conflict.  Hence,  
invent a macro DECLARE_OID_DEFINING_MACRO() that can be used to  
define an OID that is known to Catalog.pm and will participate  
in duplicate-detection as well as renumbering by renumber_oids.pl.  
(We don't anticipate renumbering these particular OIDs, but we  
might as well build out all the Catalog.pm infrastructure while  
we're here.)  
  
Another issue is that aa0105141 neglected to touch IsPinnedObject,  
with the result that it now claimed template0 and postgres are  
pinned.  The right thing to do there seems to be to teach it that  
no database is pinned, since in fact DROP DATABASE doesn't check  
for pinned-ness (and at least for these cases, that is an  
intentional choice).  It's not clear whether this wrong answer  
had any visible effect, but perhaps it could have resulted in  
erroneous management of dependency entries.  
  
In passing, rename the TemplateDbOid macro to Template1DbOid  
to reduce confusion (likely we should have done that way back  
when we invented template0, but we didn't), and rename the  
OID macros for template0 and postgres to have a similar style.  
  
There are no changes to postgres.bki here, so no need for a  
catversion bump.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/catalog.c
M src/backend/catalog/genbki.pl
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/include/access/transam.h
M src/include/catalog/genbki.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/renumber_oids.pl
M src/include/catalog/unused_oids

Standardize references to Zstandard as <productname>

commit   : 586955dddecc95e0003262a3954ae83b68ce0372    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Apr 2022 19:12:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Apr 2022 19:12:21 +0200    

Click here for diff

Some places used ZSTD, which isn't widely used anywhere.  Use ZSTD only  
to refer to the environment variable; use zstd (all lowercase) to refer  
to the utility.  
  
Per complaint from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml

CREATE PUBLICATION ref: Minor tweaks to row filters

commit   : bb85eec6fe9178aa849b43414f2db440bb5edfbd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 21 Apr 2022 18:57:40 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 21 Apr 2022 18:57:40 +0200    

Click here for diff

Prompted by a complaint from Justin Pryzby.  
  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_publication.sgml

Use DECLARE_TOAST_WITH_MACRO() to simplify toast-table declarations.

commit   : 40eba064b24d98e343b45ccef6907fe8c9784dc1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 12:02:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Apr 2022 12:02:23 -0400    

Click here for diff

This is needed so that renumber_oids.pl can handle renumbering  
shared catalog declarations, which need to provide C macros for  
the OIDs of the shared toast table and index.  The previous  
method of writing a C macro separately was error-prone anyway.  
  
Also teach renumber_oids.pl about DECLARE_UNIQUE_INDEX_PKEY,  
as we missed doing when inventing that macro.  
  
There are no changes to postgres.bki here, so no need for a  
catversion bump.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/genbki.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/renumber_oids.pl

postgres_fdw: Disable batch insert when BEFORE ROW INSERT triggers exist.

commit   : 4eea2202beadbba67638bb129149abe5650aaaf6    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 21 Apr 2022 15:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 21 Apr 2022 15:30:00 +0900    

Click here for diff

Previously, we allowed this, but such triggers might query the table to  
insert into and act differently if the tuples that have already been  
processed and prepared for insertion are not there, so disable it in  
such cases.  
  
Back-patch to v14 where batch insert was added.  
  
Discussion: https://postgr.es/m/CAPmGK16_uPqsmgK0-LpLSUk54_BoK13bPrhxhfjSoSTVz414hA%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

vacuumlazy.c: MultiXactIds are MXIDs, not XMIDs.

commit   : ba6af6aa0b764d76cfca79d9dfbddc7134a16bfc    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Apr 2022 18:29:02 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Apr 2022 18:29:02 -0700    

Click here for diff

Oversights in commits 0b018fab and f3c15cbe.  

M src/backend/access/heap/vacuumlazy.c

Fix CLUSTER tuplesorts on abbreviated expressions.

commit   : 8ab0ebb9a842dc6063d1374a38b47a3b7ee64afe    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 20 Apr 2022 17:17:43 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 20 Apr 2022 17:17:43 -0700    

Click here for diff

CLUSTER sort won't use the datum1 SortTuple field when clustering  
against an index whose leading key is an expression.  This makes it  
unsafe to use the abbreviated keys optimization, which was missed by the  
logic that sets up SortSupport state.  Affected tuplesorts output tuples  
in a completely bogus order as a result (the wrong SortSupport based  
comparator was used for the leading attribute).  
  
This issue is similar to the bug fixed on the master branch by recent  
commit cc58eecc5d.  But it's a far older issue, that dates back to the  
introduction of the abbreviated keys optimization by commit 4ea51cdfe8.  
  
Backpatch to all supported versions.  
  
Author: Peter Geoghegan <[email protected]>  
Author: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKG+bA+bmwD36_oDxAoLrCwZjVtST2fqe=b4=qZcmU7u89A@mail.gmail.com  
Backpatch: 10-  

M src/backend/utils/sort/tuplesort.c
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Disallow infinite endpoints in generate_series() for timestamps.

commit   : eafdf9de06e9b60168f5e47cedcfceecdc6d4b5f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2022 18:08:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2022 18:08:15 -0400    

Click here for diff

Such cases will lead to infinite loops, so they're of no practical  
value.  The numeric variant of generate_series() already threw error  
for this, so borrow its message wording.  
  
Per report from Richard Wesley.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Allow db.schema.table patterns, but complain about random garbage.

commit   : d2d35479796c3510e249d6fc72adbd5df918efbf    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2022 11:02:35 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 20 Apr 2022 11:02:35 -0400    

Click here for diff

psql, pg_dump, and pg_amcheck share code to process object name  
patterns like 'foo*.bar*' to match all tables with names starting in  
'bar' that are in schemas starting with 'foo'. Before v14, any number  
of extra name parts were silently ignored, so a command line '\d  
foo.bar.baz.bletch.quux' was interpreted as '\d bletch.quux'.  In v14,  
as a result of commit 2c8726c4b0a496608919d1f78a5abc8c9b6e0868, we  
instead treated this as a request for table quux in a schema named  
'foo.bar.baz.bletch'. That caused problems for people like Justin  
Pryzby who were accustomed to copying strings of the form  
db.schema.table from messages generated by PostgreSQL itself and using  
them as arguments to \d.  
  
Accordingly, revise things so that if an object name pattern contains  
more parts than we're expecting, we throw an error, unless there's  
exactly one extra part and it matches the current database name.  
That way, thisdb.myschema.mytable is accepted as meaning just  
myschema.mytable, but otherdb.myschema.mytable is an error, and so  
is some.random.garbage.myschema.mytable.  
  
Mark Dilger, per report from Justin Pryzby and discussion among  
various people.  
  
Discussion: https://www.postgresql.org/message-id/20211013165426.GD27491%40telsasoft.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Remove trailing whitespace from *.sgml files.

commit   : 836af9756b742f5a8ae77b4bef9d27311772a13c    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2022 11:04:28 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Apr 2022 11:04:28 -0400    

Click here for diff

Historically we've been lax about this, but seeing that we're not  
lax in C files, there doesn't seem to be a good reason to be so  
in the documentation.  Remove the existing occurrences (mostly  
though not entirely in copied-n-pasted psql output), and modify  
.gitattributes so that "git diff --check" will warn about future  
cases.  
  
While at it, add *.pm to the set of extensions .gitattributes  
knows about, and remove some obsolete entries for files that  
we don't have in the tree anymore.  
  
Per followup discussion of commit 5a892c9b1.  
  
Discussion: https://postgr.es/m/[email protected]  

M .gitattributes
M doc/src/sgml/advanced.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgsurgery.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/release-15.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/test-decoding.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml

Fix incorrect format placeholders

commit   : 6c0f9f60f1c24aead1bfdd0ed294ac5b6f1d1ac1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 20 Apr 2022 16:11:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 20 Apr 2022 16:11:14 +0200    

Click here for diff

M src/bin/pgbench/pgbench.c

set_deparse_plan: Reuse variable to appease Coverity

commit   : e70813fbc4aaca35ec012d5a426706bd54e4acab    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 11:44:08 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 11:44:08 +0200    

Click here for diff

Coverity complains that dpns->outer_plan is deferenced (to obtain  
->targetlist) when possibly NULL.  We can avoid this by using  
dpns->outer_tlist instead, which was already obtained a few lines up.  
  
The fact that we end up with  
  dpns->inner_tlist = dpns->outer_tlist  
is a bit suspicious-looking and maybe worthy of more investigation, but  
I'll leave that for another day.  
  
Reviewed-by: Michaël Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c

Move ModifyTableContext->lockmode to UpdateContext

commit   : a87e75956926f966d90bdd1a6bd495cf59cdc3ad    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 11:18:04 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 11:18:04 +0200    

Click here for diff

Should have been done this way to start with, but I failed to notice  
This way we avoid some pointless initialization, and better contains the  
variable to exist in the scope where it is really used.  
  
Reviewed-by: Michaël Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

ExecModifyTable: use context.planSlot instead of planSlot

commit   : 3dcc6bf4068a29be2bebee80bb919f8057af0fd9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 10:34:58 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Apr 2022 10:34:58 +0200    

Click here for diff

There's no reason to keep a separate local variable when we have a place  
for it elsewhere.  This allows to simplify some code.  
  
Reviewed-by: Michaël Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Stabilize streaming tests in test_decoding.

commit   : 74547b9c23f9f7ecfc6511e055982b8d5f51ae88    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 20 Apr 2022 08:59:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 20 Apr 2022 08:59:55 +0530    

Click here for diff

We have some streaming tests that rely on the size of changes which can  
fail if there are additional changes like invalidation messages by  
background activity like auto analyze. Avoid such failures by increasing  
autovacuum_naptime to a reasonably high value (1d).  
  
Author: Dilip Kumar  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/logical.conf

Doc: use "an SQL" consistently rather than "a SQL"

commit   : 7bdd489d3d32d6ab5af1d2b22eaf8cc7dc148027    
  
author   : David Rowley <[email protected]>    
date     : Wed, 20 Apr 2022 15:17:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 20 Apr 2022 15:17:56 +1200    

Click here for diff

Similarly to what was done in 04539e73f, we standardized on SQL being  
pronounced "es-que-ell" rather than "sequel" in our documentation.  
  
Two inconsistencies have crept in during the v15 cycle.  The others  
existed before but were missed in 04539e73f due to none of the searches  
accounting for "SQL" being wrapped in tags.  
  
As with 04539e73f, we don't touch code comments here in order to not  
create unnecessary back-patching pain.  
  
Discussion: https://postgr.es/m/CAApHDvpML27UqFXnrYO1MJddsKVMQoiZisPvsAGhKE_tsKXquw%40mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/xfunc.sgml

Fix breakage in AlterFunction().

commit   : 344a225cb9d42f20df063e4d0e0d4559c5de7910    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Apr 2022 23:03:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Apr 2022 23:03:59 -0400    

Click here for diff

An ALTER FUNCTION command that tried to update both the function's  
proparallel property and its proconfig list failed to do the former,  
because it stored the new proparallel value into a tuple that was  
no longer the interesting one.  Carelessness in 7aea8e4f2.  
  
(I did not bother with a regression test, because the only likely  
future breakage would be for someone to ignore the comment I added  
and add some other field update after the heap_modify_tuple step.  
A test using existing function properties could not catch that.)  
  
Per report from Bryn Llewellyn.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/functioncmds.c

Remove duplicated word in comment of basebackup.c

commit   : 83cca409edf276cfbd2ff691ceea1b10027c5205    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Apr 2022 11:05:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Apr 2022 11:05:34 +0900    

Click here for diff

Oversight in 39969e2.  
  
Author: Martín Marqués  
Discussion: https://postgr.es/m/CABeG9LviA01oHC5h=ksLUuhMyXxmZR_tftRq6q3341CMT=j=4g@mail.gmail.com  

M src/backend/replication/basebackup.c

Fix extract epoch from interval calculation

commit   : f2a2bf66c87e14f07aefe23cbbe2f2d9edcd9734    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 19 Apr 2022 20:38:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 19 Apr 2022 20:38:53 +0200    

Click here for diff

The new numeric code for extract epoch from interval accidentally  
truncated the DAYS_PER_YEAR value to an integer, leading to results  
that mismatched the floating-point interval_part calculations.  
  
The commit a2da77cdb4661826482ebf2ddba1f953bc74afe4 that introduced  
this actually contains the regression test change that this reverts.  
I suppose this was missed at the time.  
  
Reported-by: Joseph Koshakow <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAAvxfHd5n%3D13NYA2q_tUq%3D3%3DSuWU-CufmTf-Ozj%3DfrEgt7pXwQ%40mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/interval.out

Fix aggregate logging of pgbench.

commit   : a62bff74b135b191de0417d1cc8ec52f144c8fe7    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Tue, 19 Apr 2022 17:04:27 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Tue, 19 Apr 2022 17:04:27 +0900    

Click here for diff

Remove meaningless "failures" column from the aggregate logging. It  
was just a sum of "serialization failures" and "deadlock failures".  
Pointed out by Tom Lane. Patch reviewed by Fabien COELHO.  
  
Discussion: https://postgr.es/m/4183048.1649536705%40sss.pgh.pa.us  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Fix the check to limit sync workers.

commit   : dd4ab6fd6528e160571986fa8817cee9f2645aa8    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 19 Apr 2022 08:49:49 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 19 Apr 2022 08:49:49 +0530    

Click here for diff

We don't allow to invoke more sync workers once we have reached the sync  
worker limit per subscription. But the check to enforce this also doesn't  
allow to launch an apply worker if it gets restarted.  
  
This code was introduced by commit de43897122 but we caught the problem  
only with the test added by recent commit c91f71b9dc which started failing  
occasionally in the buildfarm.  
  
As per buildfarm.  
Diagnosed-by: Amit Kapila, Masahiko Sawada, Tomas Vondra  
Author: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com  
	    https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c

Add missing error handling in pg_md5_hash().

commit   : 587de223f03e6086d511dab16b17406eb21277ce    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2022 20:04:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2022 20:04:55 -0400    

Click here for diff

It failed to provide an error string as expected for the  
admittedly-unlikely case of OOM in pg_cryptohash_create().  
Also, make it initialize *errstr to NULL for success,  
as pg_md5_binary() does.  
  
Also add missing comments.  Readers should not have to  
reverse-engineer the API spec for a publicly visible routine.  

M src/common/md5_common.c

Avoid invalid array reference in transformAlterTableStmt().

commit   : 36d4efe779bfc7190ea1c1cf8deb0d945b726663    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2022 12:16:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 18 Apr 2022 12:16:45 -0400    

Click here for diff

Don't try to look at the attidentity field of system attributes,  
because they're not there in the TupleDescAttr array.  Sometimes  
this is harmless because we accidentally pick up a zero, but  
otherwise we'll report "no owned sequence found" from an attempt  
to alter a system attribute.  (It seems possible that a SIGSEGV  
could occur, too, though I've not seen it in testing.)  
  
It's not in this function's charter to complain that you can't  
alter a system column, so instead just hard-wire an assumption  
that system attributes aren't identities.  I didn't bother with  
a regression test because the appearance of the bug is very  
erratic.  
  
Per bug #17465 from Roman Zharkov.  Back-patch to all supported  
branches.  (There's not actually a live bug before v12, because  
before that get_attidentity() did the right thing anyway.  
But for consistency I changed the test in the older branches too.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_utilcmd.c

Fix second race condition in 002_archiving.pl with archive_cleanup_command

commit   : 1a8b110539efe18803c1fa8aa452a2178dbad9a9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 13:41:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 13:41:40 +0900    

Click here for diff

Checking the execution of archive_cleanup_command on a standby requires  
a valid checkpoint coming from its primary, but the logic did not check  
that the standby replayed up to the point of the checkpoint, causing the  
test checking for the execution of archive_cleanup_command to fail.  
This race was more visible in slow environments.  
  
Issue introduced in 46dea24, so no backpatch is needed.  
  
Author: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/002_archiving.pl

Add additional documentation for row filters.

commit   : 676eeb6dd1655f7a3ee783b7ca0d645580630acc    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 18 Apr 2022 08:42:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 18 Apr 2022 08:42:37 +0530    

Click here for diff

Commit 52e4f0cd47 added a feature to allow specifying row filters for  
logical replication of tables. This patch adds detailed documentation on  
that feature including examples to make it easier for users to understand.  
  
Author: Peter Smith, Euler Taveira  
Reviewed By: Greg Nancarrow, Aleksander Alekseev, Amit Kapila, Ajin Cherian, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHut+PtnsBr59=_NvxXp_=S-em0WxyuDOQmSTuHGb4sVhkHffg@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml

Fix race in TAP test 002_archiving.pl when restoring history file

commit   : e61efafcb82c605dcc78f668685223e20d2f7ad8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 11:39:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 11:39:50 +0900    

Click here for diff

This test, introduced in df86e52, uses a second standby to check that  
it is able to remove correctly RECOVERYHISTORY and RECOVERYXLOG at the  
end of recovery.  This standby uses the archives of the primary to  
restore its contents, with some of the archive's contents coming from  
the first standby previously promoted.  In slow environments, it was  
possible that the test did not check what it should, as the history file  
generated by the promotion of the first standby may not be stored yet on  
the archives the second standby feeds on.  So, it could be possible that  
the second standby selects an incorrect timeline, without restoring a  
history file at all.  
  
This commits adds a wait phase to make sure that the history file  
required by the second standby is archived before this cluster is  
created.  This relies on poll_query_until() with pg_stat_file() and an  
absolute path, something not supported in REL_10_STABLE.  
  
While on it, this adds a new test to check that the history file has  
been restored by looking at the logs of the second standby.  This  
ensures that a RECOVERYHISTORY, whose removal needs to be checked,  
is created in the first place.  This should make the test more robust.  
  
This test has been introduced by df86e52, but it came in light as an  
effect of the bug fixed by acf1dd42, where the extra restore_command  
calls made the test much slower.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M src/test/recovery/t/002_archiving.pl

Handle compression level in pg_receivewal for LZ4

commit   : 42e44f3b3830cbc051a5d83956546e2ef553b047    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 10:18:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Apr 2022 10:18:34 +0900    

Click here for diff

The new option set of pg_receivewal introduced in 042a923 to control the  
compression method makes it now easy to pass down various options,  
including the compression level.  The change to be able to do is simple,  
and requires one LZ4F_preferences_t fed to LZ4F_compressBegin().  
  
Note that LZ4F_INIT_PREFERENCES could be used to initialize the contents  
of LZ4F_preferences_t as required by LZ4, but this is only available  
since v1.8.3.  memset()'ing its structure to 0 is enough.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/walmethods.c

Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

commit   : 42dbbca58e8e87e461bb0a4fe48a450e90e1e932    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 16 Apr 2022 17:43:54 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 16 Apr 2022 17:43:54 -0700    

Click here for diff

The target failed, tested $PATH binaries, or tested a stale temporary  
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed  
this.  Back-patch to v10 (all supported versions).  

M src/interfaces/ecpg/Makefile

Don't retry restore_command while reading ahead.

commit   : acf1dd42342d6d84ca8e7a1998335e2e8809759e    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 17 Apr 2022 10:22:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 17 Apr 2022 10:22:03 +1200    

Click here for diff

Suppress further attempts to read ahead in the WAL if we run out of  
data, until the records already decoded have been replayed.  This  
restores the traditional behavior for continuous archive recovery, which  
is to retry the failing restore_command only every 5 seconds.  With the  
coding in 5dc0418f, we would start retrying every time through the  
recovery loop when our WAL decoding window hit the end of the current  
segment and we tried to look ahead into a not-yet-available next file.  
That was very slow.  
  
Also change the no_readahead_until mechanism to use <= rather than <,  
which seems more useful.  Otherwise we'd either get one extra unwanted  
retry of restore_command, or we'd need to add 1 to an LSN.  
  
No change in behavior for regular streaming.  That was already limited  
by the flushedUpto variable, which won't be updated until we replay what  
we have already.  
  
Reported by Andres Freund while analyzing the failure of a TAP test on  
build farm animal skink (investigation ongoing but probably due to  
otherwise unrelated timing bugs triggered by this slowness magnified by  
valgrind).  
  
Discussion: https://postgr.es/m/20220409005910.alw46xqmmgny2sgr%40alap3.anarazel.de  

M src/backend/access/transam/xlogprefetcher.c

pgstat: Use correct lock level in pgstat_drop_all_entries().

commit   : 4a736a161c306fcfed970e6b649f2f03f465ac24    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 16 Apr 2022 12:13:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 16 Apr 2022 12:13:31 -0700    

Click here for diff

Previously we didn't, which lead to an assertion failure when resetting  
partially loaded statistics. This was encountered on the buildfarm, for  
as-of-yet unknown reasons.  
  
Ttighten up a validity check when reading the stats file, verifying 'E'  
signals the end of the file (rather than just stopping reading). That's then  
used in a test appending to the stats file that crashed before the fix in  
pgstat_drop_all_entries().  
  
Reported by buildfarm animals mylodon and kestrel, via Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/test/recovery/t/029_stats_restart.pl

Fix incorrect logic in HaveRegisteredOrActiveSnapshot().

commit   : 9f4f0a0dad4c7422a97d94e4051c08ec6d181dd6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2022 16:04:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Apr 2022 16:04:50 -0400    

Click here for diff

This function gave the wrong answer when there's more than one  
RegisteredSnapshots entry, whether or not any of them is the  
CatalogSnapshot.  This leads to assertion failure in some scenarios  
involving fetching toasted data using a cursor.  (As per discussion,  
I'm dubious that this is the right contract to be enforcing at all;  
but it surely doesn't help to be enforcing it incorrectly.)  
  
Fetching toasted data using a cursor is evidently under-tested,  
so add a test case too.  
  
Per report from Erik Rijkers.  This is new code, so no need for  
back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/time/snapmgr.c
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Build libpq test programs under MSVC

commit   : a17fd67d2f2861ae0ce00d1aeefdf2facc47cd5e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 16 Apr 2022 09:35:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 16 Apr 2022 09:35:15 -0400    

Click here for diff

This allows the newly added TAP tests to run.  

M src/tools/msvc/Mkvcbuild.pm

Fix some trailing whitespace in documentation files

commit   : 5a892c9b154f513a42c4a42cdfdae524ce33c86a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2022 09:05:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 16 Apr 2022 09:05:07 +0200    

Click here for diff

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/runtime.sgml

Use standard timeout, in 010_pg_basebackup.pl.

commit   : 5fbb2d8f105efee1d059a7edb86f45e38616d329    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 15 Apr 2022 23:15:38 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 15 Apr 2022 23:15:38 -0700    

Click here for diff

Per buildfarm member mandrill.  The test is new in v15, so no back-patch.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Fix multi-table VACUUM VERBOSE accounting.

commit   : d3609dd2547b3ed807bc3b6dd27a008d65e86668    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 15:48:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 15:48:39 -0700    

Click here for diff

Per-backend global variables like VacuumPageHit are initialized once per  
VACUUM command.  This was missed by commit 49c9d9fc, which unified  
VACUUM VERBOSE and autovacuum logging.  As a result of that oversight,  
incorrect values were shown when multiple relations were processed by a  
single VACUUM VERBOSE command.  
  
Relations that happened to be processed later on would show "buffer  
usage:" values that incorrectly included buffer accesses made while  
processing earlier unrelated relations.  The same accesses were counted  
multiple times.  
  
To fix, take initial values for the tracker variables at the start of  
heap_vacuum_rel(), and report delta values later on.  

M src/backend/access/heap/vacuumlazy.c

psql: fix \l display for pre-v15 databases.

commit   : 7129a9791eafdd825eae0187b7dd7b99ed48fdc7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 18:31:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 18:31:01 -0400    

Click here for diff

With a pre-v15 server, show NULL for the "ICU Locale" column,  
matching what you see in v15 when the database locale isn't ICU.  
The previous coding incorrectly repeated datcollate here.  
  
(There's an unfinished discussion about whether to consolidate  
these columns in \l output, but in any case we'd want this fix  
for \l+ output.)  
  
Euler Taveira, per report from Christoph Berg  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Tighten ComputeXidHorizons' handling of walsenders.

commit   : 6fea65508a1aa6a1caa5f3e7b4d27bcccb0740d8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 17:50:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 17:50:01 -0400    

Click here for diff

ComputeXidHorizons (nee GetOldestXmin) thought that it could identify  
walsenders by checking for proc->databaseId == 0.  Perhaps that was  
safe when the code was written, but it's been wrong at least since  
autovacuum was invented.  Background processes that aren't connected  
to any particular database, such as the autovacuum launcher and  
logical replication launcher, look like that too.  
  
This imprecision is harmful because when such a process advertises an  
xmin, the result is to hold back dead-tuple cleanup in all databases,  
though it'd be sufficient to hold it back in shared catalogs (which  
are the only relations such a process can access).  Aside from being  
generally inefficient, this has recently been seen to cause regression  
test failures in the buildfarm, as a consequence of the logical  
replication launcher's startup transaction preventing VACUUM from  
marking pages of a user table as all-visible.  
  
We only want that global hold-back effect for the case where a  
walsender is advertising a hot standby feedback xmin.  Therefore,  
invent a new PGPROC flag that says that a process' xmin should be  
considered globally, and check that instead of using the incorrect  
databaseId == 0 test.  Currently only a walsender sets that flag,  
and only if it is not connected to any particular database.  (This is  
for bug-compatibility with the undocumented behavior of the existing  
code, namely that feedback sent by a client who has connected to a  
particular database would not be applied globally.  I'm not sure this  
is a great definition; however, such a client is capable of issuing  
plain SQL commands, and I don't think we want xmins advertised for  
such commands to be applied globally.  Perhaps this could do with  
refinement later.)  
  
While at it, I rewrote the comment in ComputeXidHorizons, and  
re-ordered the commented-upon if-tests, to make them match up  
for intelligibility's sake.  
  
This is arguably a back-patchable bug fix, but given the lack of  
complaints I think it prudent to let it age awhile in HEAD first.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h

VACUUM VERBOSE: Show dead items for an empty table.

commit   : bdb71dbe80d0560f84255e05b73f449e11007325    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 14:20:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 14:20:56 -0700    

Click here for diff

Be consistent about the lines that VACUUM VERBOSE outputs by including  
an "index scan not needed: " line for completely empty tables. This  
makes the output more readable, especially with multiple distinct VACUUM  
operations processed by the same VACUUM command.  It's also more  
consistent; even empty tables can use the failsafe, which wasn't  
reported in the standard way until now.  
  
Follow-up to commit 6e20f460, which taught VACUUM VERBOSE to be more  
consistent about reporting on scanned pages with empty tables.  

M src/backend/access/heap/vacuumlazy.c

Adjust VACUUM's removable cutoff log message.

commit   : 357c8455e64915f2d8f50ca5853eb91b74470d96    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 13:21:43 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 15 Apr 2022 13:21:43 -0700    

Click here for diff

The age of OldestXmin (a.k.a. "removable cutoff") when VACUUM ends often  
indicates the approximate number of XIDs consumed while VACUUM ran.  
However, there is at least one important exception: the cutoff could be  
held back by a snapshot that was acquired before our VACUUM even began.  
Successive VACUUM operations may even use exactly the same old cutoff in  
extreme cases involving long held snapshots.  
  
The log messages that described how removable cutoff aged (which were  
added by commit 872770fd) created the impression that we were reporting  
on how VACUUM's usable cutoff advanced while VACUUM ran, which was  
misleading in these extreme cases.  Fix by using a more general wording.  
  
Per gripe from Tom Lane.  
  
In passing, relocate related instrumentation code for clarity.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/vacuumlazy.c

Revert "Temporarily add some probes of tenk1's relallvisible in create_index.sql."

commit   : 91998539b227dfc6dd091714da7d106f2c95a321    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 13:29:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 15 Apr 2022 13:29:39 -0400    

Click here for diff

This reverts commit 5bb2b6abc8d6cf120a814317816e4384bcbb9c1e.  
Not needed anymore.  

M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Small cleanups in SQL/JSON code

commit   : f7a605f636d62935b80f9905575d40bc4eeca5ae    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 15 Apr 2022 07:47:12 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 15 Apr 2022 07:47:12 -0400    

Click here for diff

These are to keep Coverity happy. In one case remove a redundant NULL  
check, and in another explicitly ignore a function result that is already  
known.  

M src/backend/parser/parse_expr.c
M src/backend/utils/adt/jsonb.c

pgstat: set timestamps of fixed-numbered stats after a crash.

commit   : 5cd1c40b3ce9600f129fd1fea9850e1affaf31d5    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2022 17:40:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 14 Apr 2022 17:40:25 -0700    

Click here for diff

When not loading stats at startup (i.e. pgstat_discard_stats() getting  
called), reset timestamps of fixed numbered stats would be left at  
0. Oversight in 5891c7a8ed8.  
  
Instead use pgstat_reset_after_failure() and add tests verifying that  
fixed-numbered reset timestamps are set appropriately.  
  
Reported-By: "David G. Johnston" <[email protected]>  
Discussion: https://postgr.es/m/CAKFQuwamFuaQHKdhcMt4Gbw5+Hca2UE741B8gOOXoA=TtAd2Yw@mail.gmail.com  

M src/backend/utils/activity/pgstat.c
M src/test/recovery/t/029_stats_restart.pl

Have CLUSTER ignore partitions not owned by caller

commit   : 3f19e176ae0f55a653d62e1504dbe5ad8c1006a0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 14 Apr 2022 22:11:06 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 14 Apr 2022 22:11:06 +0200    

Click here for diff

If a partitioned table has partitions owned by roles other than the  
owner of the partitioned table, don't include them in the to-be-  
clustered list.  This is similar to what VACUUM FULL does (except we do  
it sooner, because there is no reason to postpone it).  Add a simple  
test to verify that only owned partitions are clustered.  
  
While at it, change memory context switch-and-back to occur once per  
partition instead of outside of the loop.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Reword text on ROW SHARE lock as acquired by SELECT FOR <lock>

commit   : 275e719d910459db747346a51d56185e2440763b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 14 Apr 2022 21:52:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 14 Apr 2022 21:52:20 +0200    

Click here for diff

It was missing lock levels FOR KEY SHARE and FOR NO KEY EXCLUSIVE; but  
also SELECT FOR UPDATE is not a command separate from SELECT, as the  
original text implied.  It is clearer to state that FOR <lock strength>  
is an option of regular SELECT.  
  
Per suggestion from Joey Bodoia <[email protected]>  
  
Reviewed-by: Joey Bodoia <[email protected]> (offlist)  
Reviewed-by: Erikjan Rijkers <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/mvcc.sgml

Temporarily add some probes of tenk1's relallvisible in create_index.sql.

commit   : 5bb2b6abc8d6cf120a814317816e4384bcbb9c1e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2022 12:14:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Apr 2022 12:14:01 -0400    

Click here for diff

This is to gather some more evidence about why buildfarm member wrasse  
is failing.  We should revert it (or at least scale it way back) once  
that's resolved.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Improve a couple of sql/json error messages

commit   : 4cd8717af3f0345c758d46fea06fb390b4d593f2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 14 Apr 2022 10:26:29 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 14 Apr 2022 10:26:29 -0400    

Click here for diff

Fix the grammar in two, and add a hint to one.  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/json_sqljson.out

Fix transformJsonBehavior

commit   : fcdb35c32ac70a113c134a66daf9ba28523ff32b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 14 Apr 2022 08:57:09 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 14 Apr 2022 08:57:09 -0400    

Click here for diff

Commit 1a36bc9dba8 conained some logic that was a little opaque and  
could have involved a NULL dereference, as complained about by Coverity.  
Make the logic more transparent and in doing so avoid the NULL  
dereference.  

M src/backend/parser/parse_expr.c

pageinspect: Fix handling of all-zero pages

commit   : cd4868a5700fadf5a840d44686658517433b338c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 14 Apr 2022 15:08:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 14 Apr 2022 15:08:03 +0900    

Click here for diff

Getting from get_raw_page() an all-zero page is considered as a valid  
case by the buffer manager and it can happen for example when finding a  
corrupted page with zero_damaged_pages enabled (using zero_damaged_pages  
to look at corrupted pages happens), or after a crash when a relation  
file is extended before any WAL for its new data is generated (before a  
vacuum or autovacuum job comes in to do some cleanup).  
  
However, all the functions of pageinspect, as of the index AMs (except  
hash that has its own idea of new pages), heap, the FSM or the page  
header have never worked with all-zero pages, causing various crashes  
when going through the page internals.  
  
This commit changes all the pageinspect functions to be compliant with  
all-zero pages, where the choice is made to return NULL or no rows for  
SRFs when finding a new page.  get_raw_page() still works the same way,  
returning a batch of zeros in the bytea of the page retrieved.  A hard  
error could be used but NULL, while more invasive, is useful when  
scanning relation files in full to get a batch of results for a single  
relation in one query.  Tests are added for all the code paths  
impacted.  
  
Reported-by: Daria Lepikhova  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/expected/gin.out
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/brin.sql
M contrib/pageinspect/sql/btree.sql
M contrib/pageinspect/sql/gin.sql
M contrib/pageinspect/sql/gist.sql
M contrib/pageinspect/sql/hash.sql
M contrib/pageinspect/sql/page.sql

Add missing spaces after single-line comments

commit   : a00fd066b1b632e675bae74841a87de1ffc1cd33    
  
author   : David Rowley <[email protected]>    
date     : Thu, 14 Apr 2022 09:28:56 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 14 Apr 2022 09:28:56 +1200    

Click here for diff

Only 1 of 3 of these changes appear to be handled by pgindent. That change  
is new to v15.  The remaining two appear to be left alone by pgindent. The  
exact reason for that is not 100% clear to me.  It seems related to the  
fact that it's a line that contains *only* a single line comment and no  
actual code.  It does not seem worth investigating this in too much  
detail.  In any case, these do not conform to our usual practices, so fix  
them.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c
M src/include/replication/message.h
M src/include/tsearch/ts_type.h

Docs: fix some spelling mistakes and also do some wordsmithing

commit   : ac8be0cb957811d04d7564f4d710ceb3e5f2fb9f    
  
author   : David Rowley <[email protected]>    
date     : Thu, 14 Apr 2022 09:16:05 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 14 Apr 2022 09:16:05 +1200    

Click here for diff

All except one of these are new to v15.  Only one of the wordsmithing  
changes appears in older versions. The wordsmithing improvement does not  
seem significant enough to warrant backpatching.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/initdb.sgml

Fix case sensitivity in psql's tab completion for GUC names.

commit   : b5607b0746f40b3f5b38004c64ccc9697ee1e222    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 16:26:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 16:26:34 -0400    

Click here for diff

Input for these should be case-insensitive, but was not completely  
so.  Comparing to the similar queries for timezone names, I realized  
that we'd missed forcing the comparison pattern to lower-case.  
With that, it behaves as I expect.  
  
While here, flatten the sub-selects in these queries; I don't  
find that those add any readability.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Further tweak the default behavior of psql's \dconfig.

commit   : 139d46ee26a2c7813d02739d35fa305890643ac1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 15:03:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 15:03:58 -0400    

Click here for diff

Define "parameters with non-default settings" as being those that  
not only have pg_settings.source different from 'default', but  
also have a current value different from the hard-wired boot_val.  
Adding the latter restriction removes a number of not-very-interesting  
cases where the active setting is chosen by initdb but in practice  
tends to be the same all the time.  
  
Per discussion with Jonathan Katz.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Prevent access to no-longer-pinned buffer in heapam_tuple_lock().

commit   : 7b7ed046cb2ad9f6efac90380757d5977f0f563f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 13:35:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 13 Apr 2022 13:35:02 -0400    

Click here for diff

heap_fetch() used to have a "keep_buf" parameter that told it to return  
ownership of the buffer pin to the caller after finding that the  
requested tuple TID exists but is invisible to the specified snapshot.  
This was thoughtlessly removed in commit 5db6df0c0, which broke  
heapam_tuple_lock() (formerly EvalPlanQualFetch) because that function  
needs to do more accesses to the tuple even if it's invisible.  The net  
effect is that we would continue to touch the page for a microsecond or  
two after releasing pin on the buffer.  Usually no harm would result;  
but if a different session decided to defragment the page concurrently,  
we could see garbage data and mistakenly conclude that there's no newer  
tuple version to chain up to.  (It's hard to say whether this has  
happened in the field.  The bug was actually found thanks to a later  
change that allowed valgrind to detect accesses to non-pinned buffers.)  
  
The most reasonable way to fix this is to reintroduce keep_buf,  
although I made it behave slightly differently: buffer ownership  
is passed back only if there is a valid tuple at the requested TID.  
In HEAD, we can just add the parameter back to heap_fetch().  
To avoid an API break in the back branches, introduce an additional  
function heap_fetch_extended() in those branches.  
  
In HEAD there is an additional, less obvious API change: tuple->t_data  
will be set to NULL in all cases where buffer ownership is not returned,  
in particular when the tuple exists but fails the time qual (and  
!keep_buf).  This is to defend against any other callers attempting to  
access non-pinned buffers.  We concluded that making that change in back  
branches would be more likely to introduce problems than cure any.  
  
In passing, remove a comment about heap_fetch that was obsoleted by  
9a8ee1dc6.  
  
Per bug #17462 from Daniil Anisimov.  Back-patch to v12 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/include/access/heapam.h

Remove extraneous blank lines before block-closing braces

commit   : 24d2b2680a8d0e01b30ce8a41c4eb3b47aca5031    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Apr 2022 19:14:20 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Apr 2022 19:14:20 +0200    

Click here for diff

These are useless and distracting.  We wouldn't have written the code  
with them to begin with, so there's no reason to keep them.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/attachment/133167/0016-Extraneous-blank-lines.patch  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_ts.c
M contrib/dblink/dblink.c
M contrib/intarray/_int_bool.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/connection.c
M contrib/spi/refint.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_attrdef.c
M src/backend/commands/copyto.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execParallel.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeMergejoin.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/hba.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/plan/planner.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/psql/describe.c
M src/bin/psql/prompt.c
M src/common/jsonapi.c
M src/fe_utils/print.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/pl/tcl/pltcl.c
M src/port/chklocale.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c

Release cache tuple when no longer needed

commit   : ed0fbc8e5ac995eada933250c1d5535336442b97    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Apr 2022 18:19:38 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Apr 2022 18:19:38 +0200    

Click here for diff

There was a small buglet in commit 52e4f0cd472d whereby a tuple acquired  
from cache was not released, giving rise to WARNING messages; fix that.  
  
While at it, restructure the code a bit on stylistic grounds.  
  
Author: Hou zj <[email protected]>  
Reported-by: Peter Smith <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://postgr.es/m/CAHut+PvKTyhTBtYCQsP6Ph7=o-oWRSX+v+PXXLXp81-o2bazig@mail.gmail.com  

M src/backend/commands/publicationcmds.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Fix finalization for json_objectagg and friends

commit   : 112fdb3528465cc14a2f1dff3dc27f100326d885    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 13 Apr 2022 10:26:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 13 Apr 2022 10:26:38 -0400    

Click here for diff

Commit f4fb45d15c misguidedly tried to free some state during aggregate  
finalization for json_objectagg. This resulted in attempts to access  
freed memory, especially when the function is used as a window function.  
Commit 4eb9798879 attempted to ameliorate that, but in fact it should  
just be ripped out, which is done here. Also add some regression tests  
for json_objectagg in various flavors as a window function.  
  
Original report from Jaime Casanova, diagnosis by Andres Freund.  
  
Discussion: https://postgr.es/m/YkfeMNYRCGhySKyg@ahch-to  

M src/backend/utils/adt/json.c
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix incorrect format placeholders

commit   : a038679cd876f63e17a08f64fafad27cd5bc23fe    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Apr 2022 14:04:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Apr 2022 14:04:51 +0200    

Click here for diff

M src/backend/utils/error/jsonlog.c

Docs: wording improvement for compute_query_id = regress

commit   : a59746d311264305bbe68aaf48d5b20e8fd56920    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 21:28:25 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 21:28:25 +1200    

Click here for diff

It's more accurate to say that the query identifier is not shown when  
compute_query_id = regress rather than to say it is hidden.  
  
This change (ebf6c5249) appeared in v14, so it makes sense to backpatch  
this small adjustment to keep the documents consistent between v14 and  
master.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where compute_query_id = regress was added  

M doc/src/sgml/config.sgml

Remove "recheck" argument from check_index_is_clusterable()

commit   : b940918dc888b9b797f29d965f8beafe0a4271b5    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Apr 2022 15:32:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Apr 2022 15:32:35 +0900    

Click here for diff

The last usage of this argument in this routine can be tracked down to  
7e2f9062, aka 11 years ago.  Getting rid of this argument can also be an  
advantage for extensions calling check_index_is_clusterable(), as it  
removes any need to worry about the meaning of what a recheck would be  
at this level.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/include/commands/cluster.h

Docs: tidy up various usages of the productname tag

commit   : fdc18ea23b393d4a34c78b94ad3fcaf547e74959    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 17:42:13 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 17:42:13 +1200    

Click here for diff

This tries to bring a bit more consistency to the use of the <productname>  
tag in the documents.  This fixes a couple of mistakes with our own  
product.  We definitely should be consistently calling that PostgreSQL  
when we're referring to the modern-day version of the software.  
  
This also tidies up a couple of inconsistencies with the case of other  
product names, namely Emacs and Python.  We also get rid of some incorrect  
usages of <productname> and replace them with <literal>.  
  
Many of these mistakes exist in the back branches, but they don't quite  
seem critical enough to warrant fixing them in prior versions at this  
stage.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/sources.sgml

Rework compression options of pg_receivewal

commit   : 042a923ad53dfbe39a9d5012d6c3cf3c9c338884    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Apr 2022 11:09:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Apr 2022 11:09:51 +0900    

Click here for diff

Since babbbb5 and the introduction of LZ4 in pg_receivewal, the  
compression of the WAL archived is controlled by two options:  
- --compression-method with "gzip", "none" or "lz4" as possible value.  
- --compress=N to specify a compression level.  This includes a  
backward-incompatible change where a value of 0 leads to a failure  
instead of no compression enforced.  
  
This commit takes advantage of a4b5754 and 3603f7c to rework the  
compression options of pg_receivewal, as of:  
- The removal of --compression-method.  
- The extenction of --compress to use the same grammar as pg_basebackup,  
with a METHOD:DETAIL format, where a METHOD is "gzip", "none" or "lz4"  
and a DETAIL is a comma-separated list of options, the only keyword  
supported is now "level" to control the compression level.  If only an  
integer is specified as value of this option, "none" is implied on 0  
and "gzip" is implied otherwise.  This brings back --compress to be  
backward-compatible with ~14, while still supporting LZ4.  
  
This has also the advantage of centralizing the set of checks used by  
pg_receivewal to validate its compression options.  
  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Docs: adjust wording about basebackup_to_shell's required_role GUC

commit   : d27323db7c451462387cd284275e1e79c59f7bac    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 12:01:23 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 12:01:23 +1200    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/basebackup-to-shell.sgml

Docs: adjust pg_upgrade syntax to mark -B as optional

commit   : 0f0b76b67a064083c77a25a307592c55ab5f2930    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 11:18:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 11:18:54 +1200    

Click here for diff

This was made optional in 959f6d6a1.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13, where -B was made optional  

M doc/src/sgml/ref/pgupgrade.sgml

Doc: tweak textsearch.sgml for SEO purposes.

commit   : aa36e7dd38d35b81d978ab94cd7a6fd3dc2d23c5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 18:21:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 18:21:04 -0400    

Click here for diff

Google seems to like to return textsearch.html for queries about  
GIN and GiST indexes, even though it's not a primary reference  
for either.  It seems likely that that's because those keywords  
appear in the page title.  Since "GIN and GiST Index Types" is  
not a very apposite title for this material anyway, rename the  
section in hopes of stopping that.  
  
Also provide explicit links to the GIN and GiST chapters, to help  
anyone who finds their way to this page regardless.  
  
Per gripe from Jan Piotrowski.  Back-patch to supported branches.  
(Unfortunately Google is likely to continue returning the 9.1  
version of this page, but improving that situation is a matter  
for the www team.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/textsearch.sgml

Docs: avoid confusing use of the word "synchronized"

commit   : 55ff3563d8fac659147a87ea93ec1464c601107d    
  
author   : David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 09:15:02 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 13 Apr 2022 09:15:02 +1200    

Click here for diff

It's misleading to call the data directory the "synchronized data  
directory" when discussing a crash scenario when using pg_rewind's  
--no-sync option.  Here we just remove the word "synchronized" to avoid  
any possible confusion.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12, where --no-sync was added  

M doc/src/sgml/ref/pg_rewind.sgml

commit   : 7fc0e7de9fb8306e84d1c15211aba4308f694455    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Apr 2022 14:45:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Apr 2022 14:45:23 -0400    

Click here for diff

This reverts commits 0147fc7, 4567596, aa64f23, and 5ecd018.  
There is no longer agreement that introducing this function  
was the right way to address the problem. The consensus now  
seems to favor trying to make a correct value for MaxBackends  
available to mdules executing their _PG_init() functions.  
  
Nathan Bossart  
  
Discussion: http://postgr.es/m/20220323045229.i23skfscdbvrsuxa@jrouhaud  

M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/commands/async.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Remove not-very-useful early checks of __pg_log_level in logging.h.

commit   : 2c9381840fe2d6d1c3179350493fe5fd3dcf90b5    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 13:25:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 13:25:29 -0400    

Click here for diff

Enforce __pg_log_level message filtering centrally in logging.c,  
instead of relying on the calling macros to do it.  This is more  
reliable (e.g. it works correctly for direct calls to pg_log_generic)  
and it saves a percent or so of total code size because we get rid of  
so many duplicate checks of __pg_log_level.  
  
This does mean that argument expressions in a logging macro will be  
evaluated even if we end up not printing anything.  That seems of  
little concern for INFO and higher levels as those messages are printed  
by default, and most of our frontend programs don't even offer a way to  
turn them off.  I left the unlikely() checks in place for DEBUG  
messages, though.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup_utils.h
M src/common/logging.c
M src/include/common/logging.h

Doc: update description of random() function.

commit   : d4f109e4a2c028bcd889cc44d84b10fff7d9186b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 11:36:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 12 Apr 2022 11:36:45 -0400    

Click here for diff

Commit 3804539e4 neglected to update the documentation's claim that  
random() uses a "linear congruential algorithm".  In hopes of avoiding  
the same mistake if someone replaces our PRNG again, just say it's a  
deterministic pseudo-random number generator and leave it at that.  
Anybody who really wants to know can look in the source code.  
  
COMPATIBILITY NOTE FOR RELEASE NOTES: 3804539e4's commit message  
really should have mentioned that the random() sequence after  
setseed(), while still repeatable, will differ from what you got  
in pre-v15 releases.  
  
Noted by Dagfinn Ilmari Mannsåker; wording suggestion by Dean Rasheed.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Use WRITE_ENUM_FIELD for enum field

commit   : e7cc4a6e3dcc39f3643f998aa5da6a6f27f28db5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Apr 2022 16:19:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Apr 2022 16:19:00 +0200    

Click here for diff

M src/backend/nodes/outfuncs.c

Make node output prefix match node structure name

commit   : 51e81794058e78a151368d0b652f3c92602568c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Apr 2022 16:18:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Apr 2022 16:18:01 +0200    

Click here for diff

as done in e58136069687b9cf29c27281e227ac397d72141d  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

adjust_partition_colnos mustn't be called if not needed

commit   : 183c869e1cbf69e7f5408ccb2121d37deec9956e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Apr 2022 15:19:57 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Apr 2022 15:19:57 +0200    

Click here for diff

Add an assert to make this very explicit, as well as a code comment.  
The former should silence Coverity complaining about this.  
  
Introduced by 7103ebb7aae8.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqTTAOzXiYybab+1DQOb3ZUuK99=p_KD+yrRFhcDbd0jg@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix documentation for pg_stat_recovery_prefetch.

commit   : 4533de358dd5f2a8930e3a73bcb49103b37357be    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 12 Apr 2022 21:19:47 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 12 Apr 2022 21:19:47 +1200    

Click here for diff

The table was in the wrong section and using an older type of link, as  
reported by Sirisha, and also using an older table layout, as I noticed  
while trying to figure out how and when it might have got out of sync.  
  
Defect in commit 5dc0418f.  
  
Author: sirisha chamarthi <[email protected]>  
Author: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CAKrAKeVk-LRHMdyT6x_p33eF6dCorM2jed5h_eHdRdv0reSYTA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Fix grammatical errors and typos in logical replication docs.

commit   : aeebb8bf233e7f48a7a6eb6857e7b7c61ef0ef4c    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 12 Apr 2022 14:14:32 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 12 Apr 2022 14:14:32 +0530    

Click here for diff

Author: Justin Pryzby  
Reviewed By: Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml

Remove WalCompressionMethod in favor of pg_compress_algorithm

commit   : 3603f7c6e66afda7c7bf4acdefd4e5b04c5478b3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Apr 2022 17:28:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Apr 2022 17:28:17 +0900    

Click here for diff

The same structure, with the same set of elements (for none, lz4, gzip  
and zstd), exists in compression.h, so let's make use of the centralized  
version instead of duplicating things.  Some of the variables used  
previously for WalCompressionMethod are renamed to stick better with the  
new structure and routine names.  
  
WalCompressionMethod was leading to some confusion in walmethods.c, as  
it was sometimes used to refer to some data unrelated to WAL.  
  
Reported-by: Robert Haas  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Change mechanism to set up source targetlist in MERGE

commit   : ce4f46fdc814eb1b704d81640f6d8f03625d0f53    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 12 Apr 2022 09:29:39 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 12 Apr 2022 09:29:39 +0200    

Click here for diff

We were setting MERGE source subplan's targetlist by expanding the  
individual attributes of the source relation completely, early in the  
parse analysis phase.  This failed to work when the condition of an  
action included a whole-row reference, causing setrefs.c to error out  
with  
  ERROR:  variable not found in subplan target lists  
because at that point there is nothing to resolve the whole-row  
reference with.  We can fix this by having preprocess_targetlist expand  
the source targetlist for Vars required from the source rel by all  
actions.  Moreover, by using this expansion mechanism we can do away  
with the targetlist expansion in transformMergeStmt, which is good  
because then we no longer pull in columns that aren't needed for  
anything.  
  
Add a test case for the problem.  
  
While at it, remove some redundant code in preprocess_targetlist():  
MERGE was doing separately what is already being done for UPDATE/DELETE,  
so we can just rely on the latter and remove the former.  (The handling  
of inherited rels was different for MERGE, but that was a no-longer-  
necessary hack.)  
  
Fix outdated, related comments for fix_join_expr also.  
  
Author: Richard Guo <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Joe Wildish <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/parser/parse_merge.c
M src/test/regress/expected/merge.out
M src/test/regress/expected/with.out
M src/test/regress/sql/merge.sql

Rename backup_compression.{c,h} to compression.{c,h}

commit   : a4b57543acfb52cc7c7e031501002563f536b929    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Apr 2022 13:38:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Apr 2022 13:38:54 +0900    

Click here for diff

Compression option handling (level, algorithm or even workers) can be  
used across several parts of the system and not only base backups.  
Structures, objects and routines are renamed in consequence, to remove  
the concept of base backups from this part of the code making this  
change straight-forward.  
  
pg_receivewal, that has gained support for LZ4 since babbbb5, will make  
use of this infrastructure for its set of compression options, bringing  
more consistency with pg_basebackup.  This cleanup needs to be done  
before releasing a beta of 15.  pg_dump is a potential future target, as  
well, and adding more compression options to it may happen in 16~.  
  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/pg_basebackup.c
M src/common/Makefile
R080 src/common/backup_compression.c src/common/compression.c
D src/include/common/backup_compression.h
A src/include/common/compression.h
M src/include/replication/basebackup_sink.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/typedefs.list

Make XLogRecGetBlockTag() throw error if there's no such block.

commit   : bd037dc928dd126e5623117b2fe7633ec3fa7c40    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 17:43:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 17:43:46 -0400    

Click here for diff

All but a few existing callers assume without checking that this  
function succeeds.  While it probably will, that's a poor excuse for  
not checking.  Let's make it return void and instead throw an error  
if it doesn't find the block reference.  Callers that actually need  
to handle the no-such-block case must now use the underlying function  
XLogRecGetBlockTagExtended.  
  
In addition to being a bit less error-prone, this should also serve  
to suppress some Coverity complaints about XLogRecGetBlockRefInfo.  
  
While at it, clean up some inconsistency about use of the  
XLogRecHasBlockRef macro: make XLogRecGetBlockTagExtended use  
that instead of open-coding the same condition, and avoid calling  
XLogRecHasBlockRef twice in relevant code paths.  (That is,  
calling XLogRecHasBlockRef followed by XLogRecGetBlockTag is now  
deprecated: use XLogRecGetBlockTagExtended instead.)  
  
Patch HEAD only; this doesn't seem to have enough value to consider  
a back-branch API break.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h

Remove comment about historic heap vacuuming issue.

commit   : 9debd123483b970a53ba0e3de51c6234f3044df0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 11 Apr 2022 14:20:46 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 11 Apr 2022 14:20:46 -0700    

Click here for diff

Remove comment block about how heap page vacuuming used to set tuples  
with storage to LP_UNUSED in a rare edge case that can no longer happen  
following commit 8523492d4e.  The comments seem unnecessary now, since  
it's now generally clear that heap vacuuming only applies to LP_DEAD  
items from VACUUM's first heap pass following more recent work from  
commits 12b5ade902 and 4f8d9d1217.  

M src/backend/access/heap/vacuumlazy.c

Remove dead code in do_pg_backup_start().

commit   : 9de692c10176e2af00dc915b122e07bd6903185c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 15:56:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 15:56:01 -0400    

Click here for diff

As of commit 39969e2a1, no caller of do_pg_backup_start() passes NULL  
for labelfile or tblspcmapfile, nor is it plausible that any would  
do so in the future.  Remove the code that coped with that case,  
as (a) it's dead and (b) it causes Coverity to bleat about possibly  
leaked storage.  
  
While here, do some janitorial work on the function's header comment.  

M src/backend/access/transam/xlog.c

Tweak the default behavior of psql's \dconfig.

commit   : 5e70d8b5d18b0a71528dc6f11ade31a9d10e00cb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 15:11:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 15:11:46 -0400    

Click here for diff

\dconfig without an argument originally printed all parameters,  
but it seems more useful to print only those parameters with  
non-default settings.  You can easily get the show-everything  
behavior with "\dconfig *", but that output is unwieldy and  
seems unlikely to be wanted very often.  
  
Per suggestion from Christoph Berg.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/describe.c

Explicitly ignore guaranteed-true result from pgstat_lock_entry().

commit   : 3c702b3ed1519624d50e7a42283b8d481a579f77    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 13:22:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 13:22:37 -0400    

Click here for diff

With nowait passed as false, pgstat_lock_entry() must return true  
so there's no need to check its result.  Coverity seems unconvinced  
of this, so whack it upside the head with a (void) cast.  

M src/backend/utils/activity/pgstat_shmem.c

fgetc() returns int, not char.

commit   : 93fcf2d2095674834e1ddbc6803ec043e3216afa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 13:15:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 13:15:46 -0400    

Click here for diff

This has no practical effect, since this code doesn't actually need to  
distinguish EOF (-1) from \0377; but it silences a Coverity complaint.  

M src/backend/utils/activity/pgstat.c

Doc build fix: remove tab from filelist.sgml.

commit   : 8638c76cc9f47b86bd6500559fbf023a8886d9d6    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 11 Apr 2022 08:41:28 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 11 Apr 2022 08:41:28 -0700    

Click here for diff

Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1K6z=gu-jppU1dtsyr2BC-pzrq3TYe=RfY+w386dfdiFA@mail.gmail.com  

M doc/src/sgml/filelist.sgml

Improve readability of SQL/JSON documentation.

commit   : b46bcf7a4b6f161eae1cee3ed9b6c4a28d04f4d0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 11 Apr 2022 11:48:40 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 11 Apr 2022 11:48:40 -0400    

Click here for diff

Per review from Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Add color support for new frontend detail/hint messages

commit   : c215cc7b61cbe06425c8ea3ac9d49581e6b5c6cd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2022 17:36:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2022 17:36:44 +0200    

Click here for diff

As before, the defaults are similar to gcc's default appearance.  

M doc/src/sgml/color.sgml
M src/common/logging.c

Avoid re-writing files unnecessarily in src/tools/copyright.pl.

commit   : dfd0f2bbc5776f261ef4c8ab128469ef9091dcfe    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 11:20:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Apr 2022 11:20:13 -0400    

Click here for diff

The existing coding resulted in touching every copyright-containing  
file in the tree, even if it was already up to date.  That doesn't  
matter much for the annual run, but it's an annoyance if you try  
to use the script for mop-up at the close of a devel cycle, as  
I just did.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/copyright.pl

docs: Note the recovery_min_apply_delay bloats pg_wal.

commit   : ad385a494f6ad863b38aa7c708f23aaf223438a7    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 11:02:59 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 11:02:59 -0400    

Click here for diff

Those WAL files that we're waiting to apply have to be stored  
somewhere.  
  
Thom Brown  
  
Discussion: http://postgr.es/m/CAA-aLv4SkJRK6GGcd0Axt8kt6_eWMEbtG7f8NJpFh+rNshtdNA@mail.gmail.com  

M doc/src/sgml/config.sgml

Docs: Mention that relpersistence is for sequences now too

commit   : e0064f0ff6dfada2695330c6bc1945fa7ae813be    
  
author   : David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:50:20 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:50:20 +1200    

Click here for diff

Per 344d62fb9.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml

Fix various typos and spelling mistakes in code comments

commit   : b0e5f02ddc836499bdcf093df52e4c342dda5891    
  
author   : David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:49:41 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:49:41 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M contrib/ltree/ltree.h
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/dbcommands.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/parser/parse_expr.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/mmgr/generation.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/utils/sortsupport.h
M src/tools/mark_pgdllimport.pl

Docs: Fix various mistakes and typos

commit   : bba3c35b29d07a27bbf5dd0d7d5e7c7592e02f81    
  
author   : David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:48:48 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 11 Apr 2022 20:48:48 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/pgbench.sgml

commit   : 7597cc3083f8b3607123f71bc6432afc5a655d6e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Apr 2022 16:36:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Apr 2022 16:36:25 +0900    

Click here for diff

0ad8032 and 4e34747 are at the origin of that.  Julien has found the one  
in parse_jsontable.c, while I have spotted the rest.  
  
Author: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/20220411060838.ftnzyvflpwu6f74w@jrouhaud  

M src/backend/parser/parse_jsontable.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_zstd.c

Put new command-line options into alphabetical order in help output

commit   : 0c65177a21a9e23490bee0e50ba61eeb287f7183    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2022 07:39:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 11 Apr 2022 07:39:25 +0200    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pgbench/pgbench.c

doc: Clarify behavior of query planner locking with REINDEX

commit   : 8ac700acffc7b17d88414be47b8dff44fb1ea681    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Apr 2022 09:49:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Apr 2022 09:49:13 +0900    

Click here for diff

The documentation of REINDEX has never mentioned that the query planner  
may take an ACCESS SHARE lock on the indexes depending on the query  
used.  This adds also a note about prepared queries not impacted when  
they do not use the index(es) rebuilt.  
  
Author: Frédéric Yhuel  
Reviewed-by: Guillaume Lelarge, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/reindex.sgml

Doc: fix typos in documentation

commit   : cd959b1b0662c9d57540b31961680c38037ffcd6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sun, 10 Apr 2022 21:42:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sun, 10 Apr 2022 21:42:43 +0200    

Click here for diff

Commits 39969e2a1e4 and 5c279a6d350 accidentally included a typo each  
in the user facing documentation.  

M doc/src/sgml/backup.sgml
M doc/src/sgml/custom-rmgr.sgml

Doc: reformat descriptions of pgbench output formats.

commit   : b6b8824ee771eecb84830903fad50a7f6853639d    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2022 15:31:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Apr 2022 15:31:42 -0400    

Click here for diff

This is mostly driven by trying to get rid of line-too-wide  
warnings in PDF output; but I think converting to a <variablelist>  
makes it more readable anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgbench.sgml

Fix pgperlsyncheck following SSL TAP test refactoring

commit   : c835dcdab622813bb1ccd130458065089f2ccacd    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2022 09:04:24 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2022 09:04:24 -0400    

Click here for diff

Commit 4a7e964fc6 made pgperlsyncheck fail, but apparently nobody  
noticed, although the buildfarm module that does more or less the same  
thing was modified. So fix the in-core test. I will look at unifying the  
two sets of tests so we avoid a future mismatch.  

M src/tools/perlcheck/pgperlsyncheck

Add timestamp and elapsed time decorations to TAP test logs

commit   : 3b0a42e74edfc57c3cef1f3b1a583d4fe5cca846    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2022 08:46:12 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 10 Apr 2022 08:46:12 -0400    

Click here for diff

These apply to traces from Test::More functions such as ok(), is(),  
diag() and note(). Output from other sources (e.g. external programs  
such a initdb) is not affected. The elapsed time is the time since the  
last such trace (or the beginning of the test in the first case). Times  
and timestamps are at millisecond precision.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/SimpleTee.pm

Doc: shorten JSON_SERIALIZE example to avoid a PDF build warning.

commit   : 7b735f8b52ad4ccf742c29dc41e3d049bdffe2fa    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2022 15:09:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Apr 2022 15:09:38 -0400    

Click here for diff

There's no particular reason why this example has to use a  
3-element array rather than 2-element.  Shortening it makes  
the result bytea narrow enough to not cause a margin overrun  
in A4 format.  

M doc/src/sgml/func.sgml

Fix whitespace

commit   : 80c877271a61bd11d6a2ff9a37f1f414a1b082ab    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 16:17:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 16:17:41 +0200    

Click here for diff

M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql
M src/tools/mark_pgdllimport.pl

Add missing serial commas

commit   : 38abc39c81f9d51cff0b4dccebd5bf73327f19e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 16:15:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 16:15:01 +0200    

Click here for diff

M src/backend/commands/publicationcmds.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/publication.out

Add missing source files to nls.mk

commit   : fc5b83bb60a862a4a27372b255405df598455ff1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 15:46:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 9 Apr 2022 15:46:37 +0200    

Click here for diff

M src/bin/pg_basebackup/nls.mk

Silence compiler warnings for unsupported compression methods.

commit   : c0d1c641cbe433d1b6304bc1e3a2d8cd38b9a8e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 18:14:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 18:14:24 -0400    

Click here for diff

wrasse, at least, moans about the lack of any "return" statement  
in these functions.  You'd think pretty much everything would  
know that exit(1) doesn't return, but evidently not.  

M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c

Improve frontend error logging style.

commit   : 9a374b77fb53e4cfbca121e4fa278a7d71bde7c4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 14:55:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 14:55:14 -0400    

Click here for diff

Get rid of the separate "FATAL" log level, as it was applied  
so inconsistently as to be meaningless.  This mostly involves  
s/pg_log_fatal/pg_log_error/g.  
  
Create a macro pg_fatal() to handle the common use-case of  
pg_log_error() immediately followed by exit(1).  Various  
modules had already invented either this or equivalent macros;  
standardize on pg_fatal() and apply it where possible.  
  
Invent the ability to add "detail" and "hint" messages to a  
frontend message, much as we have long had in the backend.  
  
Except where rewording was needed to convert existing coding  
to detail/hint style, I have (mostly) resisted the temptation  
to change existing message wording.  
  
Patch by me.  Design and patch reviewed at various stages by  
Robert Haas, Kyotaro Horiguchi, Peter Eisentraut and  
Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_waldump/nls.mk
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/mainloop.c
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/controldata_utils.c
M src/common/file_utils.c
M src/common/logging.c
M src/common/restricted_token.c
M src/fe_utils/archive.c
M src/fe_utils/connect_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/include/common/logging.h
M src/include/lib/simplehash.h
M src/nls-global.mk

Fix busted .gitignore entry.

commit   : 5c431c7fb327e1abc70b7a197650f8d45fd5bede    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 14:22:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 8 Apr 2022 14:22:47 -0400    

Click here for diff

Typo in commit 2258e76f9.  

M src/bin/pg_waldump/.gitignore

Rename delayChkpt to delayChkptFlags.

commit   : f37015a1617d4e6b4b50a1c789b382d9a654fcd9    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 11:44:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 11:44:17 -0400    

Click here for diff

Before commit 412ad7a55639516f284cd0ef9757d6ae5c7abd43, delayChkpt  
was a Boolean. Now it's an integer. Extensions using it need to be  
appropriately updated, so let's rename the field to make sure that  
a hard compilation failure occurs.  
  
Replacing delayChkpt with delayChkptFlags made a few comments extend  
past 80 characters, so I reflowed them and changed some wording very  
slightly.  
  
The back-branches will need a different change to restore compatibility  
with existing minor releases; this is just for master.  
  
Per suggestion from Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

psql: Fix translation marking

commit   : 891624f0ec3b3d353269b0bfc7bc545333d6b4d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2022 15:07:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2022 15:07:35 +0200    

Click here for diff

Commit 5a2832465fd8984d089e8c44c094e6900d987fcd added  
addFooterToPublicationDesc() as a wrapper around  
printTableAddFooter().  The translation marker _() was moved to the  
body of addFooterToPublicationDesc(), but addFooterToPublicationDesc()  
was not added to GETTEXT_TRIGGERS, so those strings were lost for  
translation.  To fix, add the translation markers to the call sites of  
addFooterToPublicationDesc() and remove the translation marker from  
the body of the function.  This seems easiest since there were only  
two callers and it keeps the API consistent with  
printTableAddFooter().  While we're here, add some const decorations  
to the prototype of addFooterToPublicationDesc() for consistency with  
printTableAddFooter().  

M src/bin/psql/describe.c

Apply PGDLLIMPORT markings broadly.

commit   : 8ec569479fc28ddd634a13dc100b36352ec3a3c2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 08:16:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 08:16:38 -0400    

Click here for diff

Up until now, we've had a policy of only marking certain variables  
in the PostgreSQL header files with PGDLLIMPORT, but now we've  
decided to mark them all. This means that extensions running on  
Windows should no longer operate at a disadvantage as compared to  
extensions running on Linux: if the variable is present in a header  
file, it should be accessible.  
  
Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com  

M src/include/access/gin.h
M src/include/access/parallel.h
M src/include/access/session.h
M src/include/access/tableam.h
M src/include/access/toast_compression.h
M src/include/access/twophase_rmgr.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaddress.h
M src/include/catalog/storage.h
M src/include/commands/async.h
M src/include/commands/tablespace.h
M src/include/commands/user.h
M src/include/commands/vacuum.h
M src/include/common/file_perm.h
M src/include/common/jsonapi.h
M src/include/common/logging.h
M src/include/common/pg_lzcompress.h
M src/include/common/relpath.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/print.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/libpq/auth.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/readfuncs.h
M src/include/optimizer/geqo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/planmain.h
M src/include/parser/parse_expr.h
M src/include/parser/parser.h
M src/include/pg_getopt.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/replication/logicallauncher.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/large_object.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/proc.h
M src/include/storage/s_lock.h
M src/include/storage/sinval.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/tcop/tcopprot.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_type.h
M src/include/utils/array.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/fmgrtab.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/jsonpath.h
M src/include/utils/pg_locale.h
M src/include/utils/pgstat_internal.h
M src/include/utils/plancache.h
M src/include/utils/ps_status.h
M src/include/utils/queryjumble.h
M src/include/utils/relcache.h
M src/include/utils/rls.h
M src/include/utils/snapmgr.h
M src/include/utils/timestamp.h
M src/include/utils/xml.h

Helper script to apply PGDLLIMPORT markings.

commit   : 80900d4690916a30f278d877eb5a7a42b14c3f0a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 08:06:10 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 8 Apr 2022 08:06:10 -0400    

Click here for diff

This script isn't terribly smart and won't necessarily catch every  
case, but it catches many of them and is better than a totally  
manual approach.  
  
Patch by me, reviewed by Andrew Dunstan.  
  
Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com  

A src/tools/mark_pgdllimport.pl

Add JIT counters to pg_stat_statements

commit   : 57d6aea00fcefec3825a5948ce05cf2b4941097b    
  
author   : Magnus Hagander <[email protected]>    
date     : Fri, 8 Apr 2022 13:51:01 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Fri, 8 Apr 2022 13:51:01 +0200    

Click here for diff

This adds cumulative counters for jit operations to pg_stat_statements,  
making it easier to diagnose how JIT is used in an installation.  
  
These changes merge into the 1.10 changes applied in 76cbf7edb6 without  
creating a new version.  
  
Reviewed-By: Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/flat/CABUevEySt4NTYqvWzwyAW_0-jG1bjN-y+tykapAnA0FALOs+Lw@mail.gmail.com  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/pg_stat_statements–1.9–1.10.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/pgstatstatements.sgml

Fix buildfarm failures in pg_walinspect tests.

commit   : dad9ba1c82fd985aa6fb8035ebca1e79c138dde2    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 03:21:12 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 03:21:12 -0700    

Click here for diff

M contrib/pg_walinspect/Makefile
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
A contrib/pg_walinspect/walinspect.conf

Check XLogRecHasBlockRef() before XLogRecHasBlockImage().

commit   : 12aaae5131af343b7cd2fdef05dee82c25d8aaf8    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 02:30:57 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 02:30:57 -0700    

Click here for diff

Trial fix of buildfarm failures on kestrel and tamandua.  

M src/backend/access/transam/xlogstats.c

Fix buildfarm failure from commit 2258e76f90.

commit   : 1562e92c62a3f3a4e5d87895523ff74174029654    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 01:33:58 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 01:33:58 -0700    

Click here for diff

M src/include/access/xlogstats.h

Add contrib/pg_walinspect.

commit   : 2258e76f90bf0254504644df0515cddc0c0a87f9    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 00:02:10 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 8 Apr 2022 00:02:10 -0700    

Click here for diff

Provides similar functionality to pg_waldump, but from a SQL interface  
rather than a separate utility.  
  
Author: Bharath Rupireddy  
Reviewed-by: Greg Stark, Kyotaro Horiguchi, Andres Freund, Ashutosh Sharma, Nitin Jadhav, RKN Sai Krishna  
Discussion: https://postgr.es/m/CALj2ACUGUYXsEQdKhEdsBzhGEyF3xggvLdD8C0VT72TNEfOiog%40mail.gmail.com  

M contrib/Makefile
A contrib/pg_walinspect/.gitignore
A contrib/pg_walinspect/Makefile
A contrib/pg_walinspect/expected/pg_walinspect.out
A contrib/pg_walinspect/pg_walinspect–1.0.sql
A contrib/pg_walinspect/pg_walinspect.c
A contrib/pg_walinspect/pg_walinspect.control
A contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
A doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/Makefile
M src/backend/access/transam/xlogreader.c
A src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/bin/pg_waldump/.gitignore
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
A src/include/access/xlogstats.h
M src/include/access/xlogutils.h

Remove error message hints mentioning configure options

commit   : 708007dced2b05ed9b4f1963e91b2eb67413bd19    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2022 07:41:09 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 8 Apr 2022 07:41:09 +0200    

Click here for diff

These are usually not useful since users will use packaged  
distributions and won't be interested in rebuilding their installation  
from source.  Also, we have only used these kinds of hints for some  
features and in some places, not consistently throughout.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/2552aed7-d0e9-280a-54aa-2dc7073f371d%40enterprisedb.com  

M src/backend/access/common/toast_compression.c
M src/backend/libpq/hba.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/xml.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xmlmap_1.out

pgstat: Update docs to match the shared memory stats reality.

commit   : b3abca68106d518ce5d3c0d9a1e0ec02a647ceda    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 21:35:35 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 21:35:35 -0700    

Click here for diff

This includes removing documentation for stats_temp_directory, adding  
documentation for stats_fetch_consistency, rephrasing references to the stats  
collector and documenting that starting a cleanly shut down standby will not  
remove stats anymore. The latter point might require further wordsmithing, it  
wasn't easy to adjust some of the existing content.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Reviewed-By: "David G. Johnston" <[email protected]>  
Reviewed-By: Lukas Fittl <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/backup.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_dump.sgml

pg_stat_statements: Track I/O timing for temporary file blocks

commit   : 76cbf7edb6385c682facda095050858cac2efae0    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Apr 2022 13:12:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Apr 2022 13:12:07 +0900    

Click here for diff

This commit adds two new columns to pg_stat_statements, called  
temp_blk_read_time and temp_blk_write_time.  Those columns respectively  
show the time spent to read and write temporary file blocks on disk,  
whose tracking has been added in efb0ef9.  This information is  
available when track_io_timing is enabled, like blk_read_time and  
blk_write_time.  
  
pg_stat_statements is updated to version to 1.10 as an effect of the  
newly-added columns.  Tests for the upgrade path 1.9->1.10 are added.  
  
PGSS_FILE_HEADER is bumped for the new stats file format.  
  
Author: Masahiko Sawada  
Reviewed-by: Georgios Kokolatos, Melanie Plageman, Julien Rouhaud,  
Ranier Vilela  
Discussion: https://postgr.es/m/CAD21AoAJgotTeP83p6HiAGDhs_9Fw9pZ2J=_tYTsiO5Ob-V5GQ@mail.gmail.com  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/oldextversions.out
A contrib/pg_stat_statements/pg_stat_statements–1.9–1.10.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M contrib/pg_stat_statements/sql/oldextversions.sql
M doc/src/sgml/pgstatstatements.sgml

Documentation for SQL/JSON features

commit   : a6baa4baddd5f111bc59d8f5ed5cadbb2d91e98d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 7 Apr 2022 23:36:50 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 7 Apr 2022 23:36:50 -0400    

Click here for diff

This documents the features added in commits f79b803dcc, f4fb45d15c,  
33a377608f, 1a36bc9dba, 606948b058, 49082c2cc3, 4e34747c88, and  
fadb48b00e.  
  
I have cleaned up the aggregate section of the submitted docs, but there  
is still a deal of copy editing required. However, I thought it best to  
have some documentation sooner rather than later so testers can have a  
better idea what they are playing with.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Track I/O timing for temporary file blocks in EXPLAIN (BUFFERS)

commit   : efb0ef909f605817da6b77c1f3fef0a24457ec16    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Apr 2022 11:27:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Apr 2022 11:27:21 +0900    

Click here for diff

Previously, the output of EXPLAIN (BUFFERS) option showed only the I/O  
timing spent reading and writing shared and local buffers.  This commit  
adds on top of that the I/O timing for temporary buffers in the output  
of EXPLAIN (for spilled external sorts, hashes, materialization. etc).  
This can be helpful for users in cases where the I/O related to  
temporary buffers is the bottleneck.  
  
Like its cousin, this information is available only when track_io_timing  
is enabled.  Playing the patch, this is showing an extra overhead of up  
to 1% even when using gettimeofday() as implementation for interval  
timings, which is slightly within the usual range noise still that's  
measurable.  
  
Author: Masahiko Sawada  
Reviewed-by: Georgios Kokolatos, Melanie Plageman, Julien Rouhaud,  
Ranier Vilela  
Discussion: https://postgr.es/m/CAD21AoAJgotTeP83p6HiAGDhs_9Fw9pZ2J=_tYTsiO5Ob-V5GQ@mail.gmail.com  

M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/backend/storage/file/buffile.c
M src/include/executor/instrument.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Fix recovery_prefetch docs.

commit   : dafae9707ab7e7079ce1ba22cebda4557d0cbaf3    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 8 Apr 2022 13:28:04 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 8 Apr 2022 13:28:04 +1200    

Click here for diff

Correct a typo and a couple of sentences that weren't updated to reflect  
recent changes to the code.  
  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/20220407125555.GC24419%40telsasoft.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/wal.sgml

pgstat: Hide instability in stats.spec with -DCATCACHE_FORCE_RELEASE.

commit   : d6c0db14836cd843d589372d909c73aab68c7a24    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 18:20:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 18:20:50 -0700    

Click here for diff

With -DCATCACHE_FORCE_RELEASE a few tests failed. Those were trying to test  
behavior in the absence of invalidation processing and  
-DCATCACHE_FORCE_RELEASE obviously adds a lot of invalidation processing. The  
test already tried to handle debug_discard_caches > 0, by disabling it for  
individual tests.  
  
Instead hide potentially problematic function calls in a wrapper function that  
catches the does-not-exist error. The error isn't the actually interesting  
bit, it's whether the stats entry still exist afterwards.  
  
I confirmed that the tests still catches leaked function stats if I nuke the  
protections against that in pgstat_function.c.  
  
Per buildfarm animal prion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec

pgstat: add/extend tests for resetting various kinds of stats.

commit   : 5264add7847871d61d36a5770dac2139d6a7bc80    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 15:17:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 15:17:07 -0700    

Click here for diff

- subscriber stats reset path was untested  
- slot stat sreset path for all slots was untested  
- pg_stat_database.sessions etc was untested  
- pg_stat_reset_shared() was untested, for any kind of shared stats  
- pg_stat_reset() was untested  
  
Author: Melanie Plageman <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/stats.out
M contrib/test_decoding/sql/stats.sql
M src/test/recovery/t/006_logical_decoding.pl
M src/test/regress/expected/stats.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/stats.sql
M src/test/subscription/t/026_stats.pl

Truncate line pointer array during heap pruning.

commit   : 10a8d138235b3b8cfbce8a0145526d9b9a80cc96    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 7 Apr 2022 15:42:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 7 Apr 2022 15:42:12 -0700    

Click here for diff

Reclaim space from the line pointer array when heap pruning leaves  
behind a contiguous group of LP_UNUSED items at the end of the array.  
This happens during subsequent page defragmentation.  Certain kinds of  
heap line pointer bloat are ameliorated by this new optimization.  
  
Follow-up work to commit 3c3b8a4b26, which taught VACUUM to truncate the  
line pointer array in about the same way during VACUUM's second pass  
over the heap.  We now apply line pointer array truncation during both  
the first and the second pass over the heap made by VACUUM.  We can also  
perform line pointer array truncation during opportunistic pruning.  
  
Matthias van de Meent, with small tweaks by me.  
  
Author: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/CAEze2WjgaQc55Y5f5CQd3L=eS5CZcff2Obxp=O6pto8-f0hC4w@mail.gmail.com  
Discussion: https://postgr.es/m/CAEze2Wg36%2B4at2eWJNcYNiW2FJmht34x3YeX54ctUSs7kKoNcA%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/storage/page/bufpage.c

Teach planner and executor about monotonic window funcs

commit   : 9d9c02ccd1aea8e9131d8f4edb21bf1687e40782    
  
author   : David Rowley <[email protected]>    
date     : Fri, 8 Apr 2022 10:34:36 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 8 Apr 2022 10:34:36 +1200    

Click here for diff

Window functions such as row_number() always return a value higher than  
the previously returned value for tuples in any given window partition.  
  
Traditionally queries such as;  
  
SELECT * FROM (  
   SELECT *, row_number() over (order by c) rn  
   FROM t  
) t WHERE rn <= 10;  
  
were executed fairly inefficiently.  Neither the query planner nor the  
executor knew that once rn made it to 11 that nothing further would match  
the outer query's WHERE clause.  It would blindly continue until all  
tuples were exhausted from the subquery.  
  
Here we implement means to make the above execute more efficiently.  
  
This is done by way of adding a pg_proc.prosupport function to various of  
the built-in window functions and adding supporting code to allow the  
support function to inform the planner if the window function is  
monotonically increasing, monotonically decreasing, both or neither.  The  
planner is then able to make use of that information and possibly allow  
the executor to short-circuit execution by way of adding a "run condition"  
to the WindowAgg to allow it to determine if some of its execution work  
can be skipped.  
  
This "run condition" is not like a normal filter.  These run conditions  
are only built using quals comparing values to monotonic window functions.  
For monotonic increasing functions, quals making use of the btree  
operators for <, <= and = can be used (assuming the window function column  
is on the left). You can see here that once such a condition becomes false  
that a monotonic increasing function could never make it subsequently true  
again.  For monotonically decreasing functions the >, >= and = btree  
operators for the given type can be used for run conditions.  
  
The best-case situation for this is when there is a single WindowAgg node  
without a PARTITION BY clause.  Here when the run condition becomes false  
the WindowAgg node can simply return NULL.  No more tuples will ever match  
the run condition.  It's a little more complex when there is a PARTITION  
BY clause.  In this case, we cannot return NULL as we must still process  
other partitions.  To speed this case up we pull tuples from the outer  
plan to check if they're from the same partition and simply discard them  
if they are.  When we find a tuple belonging to another partition we start  
processing as normal again until the run condition becomes false or we run  
out of tuples to process.  
  
When there are multiple WindowAgg nodes to evaluate then this complicates  
the situation.  For intermediate WindowAggs we must ensure we always  
return all tuples to the calling node.  Any filtering done could lead to  
incorrect results in WindowAgg nodes above.  For all intermediate nodes,  
we can still save some work when the run condition becomes false.  We've  
no need to evaluate the WindowFuncs anymore.  Other WindowAgg nodes cannot  
reference the value of these and these tuples will not appear in the final  
result anyway.  The savings here are small in comparison to what can be  
saved in the top-level WingowAgg, but still worthwhile.  
  
Intermediate WindowAgg nodes never filter out tuples, but here we change  
WindowAgg so that the top-level WindowAgg filters out tuples that don't  
match the intermediate WindowAgg node's run condition.  Such filters  
appear in the "Filter" clause in EXPLAIN for the top-level WindowAgg node.  
  
Here we add prosupport functions to allow the above to work for;  
row_number(), rank(), dense_rank(), count(*) and count(expr).  It appears  
technically possible to do the same for min() and max(), however, it seems  
unlikely to be useful enough, so that's not done here.  
  
Bump catversion  
  
Author: David Rowley  
Reviewed-by: Andy Fan, Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvqvp3At8++yF8ij06sdcoo1S_b2YoaT9D4Nf+MObzsrLQ@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/windowfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/supportnodes.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Extend plsample example to include a trigger handler.

commit   : 2f4d0d67994b32320487784afab7ab997d331bb5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2022 18:26:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2022 18:26:13 -0400    

Click here for diff

Mark Wong and Konstantina Skovola, reviewed by Chapman Flack  
  
Discussion: https://postgr.es/m/Yd8Cz22eHi80XS30@workstation-mark-wong  

M src/test/modules/plsample/expected/plsample.out
M src/test/modules/plsample/plsample.c
M src/test/modules/plsample/sql/plsample.sql

Add minimal tests for recovery conflict handling.

commit   : 9f8a050f68dcb38fb0a1ea87e0e5d04df32b56f4    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 12:46:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 12:46:51 -0700    

Click here for diff

Previously none of our tests triggered recovery conflicts. The test is  
primarily motivated by needing tests for recovery conflict stats for shared  
memory based pgstats. But it's also a decent start for recovery conflict  
handling in general.  
  
The only type of recovery conflict not tested yet are rcovery deadlock  
conflicts.  
  
By configuring log_recovery_conflict_waits the test adds some very minimal  
testing for that path as well.  
  
Author: Melanie Plageman <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/test/recovery/t/031_recovery_conflict.pl

pgstat: test stats interactions with physical replication.

commit   : 53b9cd20d4144f5d65c107babe23916aad6c2ef8    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 12:58:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 12:58:51 -0700    

Click here for diff

Tests that standbys:  
- drop stats for objects when the those records are replayed  
- persist stats across graceful restarts  
- discard stats after immediate / crash restarts  
  
Author: Melanie Plageman <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/test/recovery/t/030_stats_cleanup_replica.pl

Revert "Rewrite some RI code to avoid using SPI"

commit   : a90641eac24dfc8889122d88eb7f482cd3db8b39    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 23:42:13 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 23:42:13 +0200    

Click here for diff

This reverts commit 99392cdd78b788295e52b9f4942fa11992fd5ba9.  
We'd rather rewrite ri_triggers.c as a whole rather than piecemeal.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeLockRows.c
M src/backend/utils/adt/ri_triggers.c
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/specs/fk-snapshot.spec

psql: add \dconfig command to show server's configuration parameters.

commit   : 3e707fbb4009e9ac1d0e8b78b7af9f3f03f4cf1a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2022 17:09:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Apr 2022 17:09:44 -0400    

Click here for diff

Plain \dconfig is basically equivalent to SHOW except that you can  
give it a pattern with wildcards, either to match multiple GUCs or  
because you don't exactly remember the name you want.  
  
\dconfig+ adds type, context, and access-privilege information,  
mainly because every other kind of object privilege has a psql command  
to show it, so GUC privileges should too.  (A form of this command was  
in some versions of the patch series leading up to commit a0ffa885e.  
We pulled it out then because of doubts that the design and code were  
up to snuff, but I think subsequent work has resolved that.)  
  
In passing, fix incorrect completion of GUC names in GRANT/REVOKE  
ON PARAMETER: a0ffa885e neglected to use the VERBATIM form of  
COMPLETE_WITH_QUERY, so it misbehaved for custom (qualified) GUC  
names.  
  
Mark Dilger and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/fe_utils/string_utils.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

pgstat: add tests for handling of restarts, including crashes.

commit   : 16acf7f1aaea6c5efc0fa49182c16cd6bfd9f3d3    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 12:07:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 12:07:50 -0700    

Click here for diff

Test that stats are restored during normal restarts, discarded after a crash /  
immediate restart, and that a corrupted stats file leads to stats being reset.  
  
Author: Melanie Plageman <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/test/recovery/t/029_stats_restart.pl

Rewrite some RI code to avoid using SPI

commit   : 99392cdd78b788295e52b9f4942fa11992fd5ba9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 21:04:36 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 21:04:36 +0200    

Click here for diff

Modify the subroutines called by RI trigger functions that want to check  
if a given referenced value exists in the referenced relation to simply  
scan the foreign key constraint's unique index, instead of using SPI to  
execute  
  SELECT 1 FROM referenced_relation WHERE ref_key = $1  
This saves a lot of work, especially when inserting into or updating a  
referencing relation.  
  
This rewrite allows to fix a PK row visibility bug caused by a partition  
descriptor hack which requires ActiveSnapshot to be set to come up with  
the correct set of partitions for the RI query running under REPEATABLE  
READ isolation.  We now set that snapshot indepedently of the snapshot  
to be used by the PK index scan, so the two no longer interfere.  The  
buggy output in src/test/isolation/expected/fk-snapshot.out of the  
relevant test case added by commit 00cb86e75d6d has been corrected.  
(The bug still exists in branch 14, however, but this fix is too  
invasive to backpatch.)  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Corey Huinker <[email protected]>  
Reviewed-by: Li Japin <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqGkfJfYdeq5vHPh6eqPKjSbfpDDY+j-kXYFePQedtSLeg@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeLockRows.c
M src/backend/utils/adt/ri_triggers.c
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/specs/fk-snapshot.spec

Fix test instability introduced in e349c95d3e9 due to async deduplication.

commit   : dbe29b0d2c96f34b3f3222c6fc1710fcff065f18    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 11:54:51 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 11:54:51 -0700    

Click here for diff

The statement emitting notifies tried to make sure page boundaries were  
crossed, but failed to do so reliably due to deduplication.  
  
Reported-By: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec

Add isolation tests for snapshot behavior in ri_triggers.c

commit   : 00cb86e75d6dd13a8bc07f79c2cdbe20d96c2d92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 19:57:29 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 7 Apr 2022 19:57:29 +0200    

Click here for diff

They are to check the behavior of RI_FKey_check() and  
ri_Check_Pk_Match().  A test case whereby RI_FKey_check() queries a  
partitioned PK table under REPEATABLE READ isolation produces wrong  
output due to a bug of the partition-descriptor logic and that is noted  
as such in the comment in the test.  A subsequent commit will fix the  
bug and replace the buggy output by the correct one.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-snapshot.spec

Revert "Logical decoding of sequences"

commit   : 2c7ea57e56ca5f668c32d4266e0a3e45b455bef5    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 7 Apr 2022 18:13:13 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 7 Apr 2022 18:13:13 +0200    

Click here for diff

This reverts a sequence of commits, implementing features related to  
logical decoding and replication of sequences:  
  
 - 0da92dc530c9251735fc70b20cd004d9630a1266  
 - 80901b32913ffa59bf157a4d88284b2b3a7511d9  
 - b779d7d8fdae088d70da5ed9fcd8205035676df3  
 - d5ed9da41d96988d905b49bebb273a9b2d6e2915  
 - a180c2b34de0989269fdb819bff241a249bf5380  
 - 75b1521dae1ff1fde17fda2e30e591f2e5d64b6a  
 - 2d2232933b02d9396113662e44dca5f120d6830e  
 - 002c9dd97a0c874fd1693a570383e2dd38cd40d5  
 - 05843b1aa49df2ecc9b97c693b755bd1b6f856a9  
  
The implementation has issues, mostly due to combining transactional and  
non-transactional behavior of sequences. It's not clear how this could  
be fixed, but it'll require reworking significant part of the patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/Makefile
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/expected/decoding_into_rel.out
M contrib/test_decoding/expected/mxact.out
M contrib/test_decoding/expected/ondisk_startup.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
D contrib/test_decoding/expected/sequence.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/expected/truncate.out
M contrib/test_decoding/specs/mxact.spec
M contrib/test_decoding/specs/ondisk_startup.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M contrib/test_decoding/sql/decoding_into_rel.sql
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
D contrib/test_decoding/sql/sequence.sql
M contrib/test_decoding/sql/slot.sql
M contrib/test_decoding/sql/toast.sql
M contrib/test_decoding/sql/truncate.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/access/rmgrlist.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/commands/sequence.h
M src/include/nodes/parsenodes.h
M src/include/replication/decode.h
M src/include/replication/logicalproto.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
D src/test/subscription/t/030_sequences.pl

doc: Fix man page whitespace issues

commit   : d7ab2a9a3c0a2800ab36bb48d1cc97370067777e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 18:23:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 18:23:28 +0200    

Click here for diff

Whitespace between tags is significant, and in some cases it creates  
extra vertical space in man pages.  The fix is to remove some newlines  
in the markup.  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/drop_procedure.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pgbench.sgml

Fix off-by-one error in pg_waldump, introduced in 5c279a6d350.

commit   : dad97e0502b4a5fc125c83e9092d9673f0e91805    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 09:14:49 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 09:14:49 -0700    

Click here for diff

Per report by Bharath Rupireddy.  
  
Discussion: https://postgr.es/m/CALj2ACX+PWDK2MYjdu8CB1ot7OUSo6kd5-fkkEgduEsTSZjAEw@mail.gmail.com  

M src/bin/pg_waldump/pg_waldump.c

Fix another buildfarm issue from commit 5c279a6d350.

commit   : 957aa4d87a419d18710283cf4f53ba7d3ead6bbe    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 08:40:16 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 08:40:16 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/include/access/xlog_internal.h

Unlogged sequences

commit   : 344d62fb9a978a72cf8347f0369b9ee643fd0b31    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 16:13:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 16:13:23 +0200    

Click here for diff

Add support for unlogged sequences.  Unlike for unlogged tables, this  
is not a performance feature.  It allows sequences associated with  
unlogged tables to be excluded from replication.  
  
A new subcommand ALTER SEQUENCE ... SET LOGGED/UNLOGGED is added.  
  
An identity/serial sequence now automatically gets and follows the  
persistence level (logged/unlogged) of its owning table.  (The  
sequences owned by temporary tables were already temporary through the  
separate mechanism in RangeVarAdjustRelationPersistence().)  But you  
can still change the persistence of an owned sequence separately.  
Also, pg_dump and pg_upgrade preserve the persistence of existing  
sequences.  
  
Discussion: https://www.postgresql.org/message-id/flat/04e12818-2f98-257c-b926-2845d74ed04f%402ndquadrant.com  

M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/commands/sequence.h
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/sequence.out
M src/test/regress/sql/sequence.sql

Fix typo in xlogrecovery.c code comment

commit   : bab588cd5cbbeb43cda6e20c967b43000ea2aa80    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 7 Apr 2022 14:01:28 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 7 Apr 2022 14:01:28 +0200    

Click here for diff

Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACUoPtnReT=yAQMcWLtcCpk7p83xjeA8tiRX8Q0_sjh8kw@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c

Avoid <substeps> element in man pages

commit   : d772b18d44c209ec4a48ba6e1d86c13445318b81    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 13:45:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 13:45:25 +0200    

Click here for diff

The upstream DocBook manpages stylesheet apparently does not handle  
the <substeps> element at all, and so the content comes out  
unformatted, which is not useful.  
  
As a workaround, replace <substeps> with a nested <procedure>, which  
ends up effectively the same in output.  

M doc/src/sgml/ref/pgupgrade.sgml

Include some missing headers.

commit   : 5b186308fbc41d0713fa91426d57a2afe37dd969    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Apr 2022 20:55:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Apr 2022 20:55:16 +1200    

Click here for diff

Per headerscheck on BF animal crake, and Andres.  
  
Discussion: https://postgr.es/m/20220407083630.n62vgwqfy2v6wsrd%40alap3.anarazel.de  

M src/include/access/xlogprefetcher.h

pgstat: add alternate output for stats.spec, for the 2PC disabled case.

commit   : a2f433fa491f709767dbf916203f1c53f39707fe    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:57:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:57:13 -0700    

Click here for diff

It might be worth instead splitting the test up to produce a smaller  
alternative output file. But that's not trivial either, due to the number of  
steps defined. And more than I want to do tonight.  
  
Per buildfarm.  

A src/test/isolation/expected/stats_1.out

Try to silence "-Wmissing-braces" complaints in rmgrdesc.c.

commit   : 6392f2a0968c20ecde4d27b6652703ad931fce92    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:49:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:49:32 -0700    

Click here for diff

Per buildfarm member lapwing.  
  
https://postgr.es/m/[email protected]  

M src/bin/pg_waldump/rmgrdesc.c

Prefetch data referenced by the WAL, take II.

commit   : 5dc0418fab281d017a61a5756240467af982bdfd    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 7 Apr 2022 19:28:40 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 7 Apr 2022 19:28:40 +1200    

Click here for diff

Introduce a new GUC recovery_prefetch.  When enabled, look ahead in the  
WAL and try to initiate asynchronous reading of referenced data blocks  
that are not yet cached in our buffer pool.  For now, this is done with  
posix_fadvise(), which has several caveats.  Since not all OSes have  
that system call, "try" is provided so that it can be enabled where  
available.  Better mechanisms for asynchronous I/O are possible in later  
work.  
  
Set to "try" for now for test coverage.  Default setting to be finalized  
before release.  
  
The GUC wal_decode_buffer_size limits the distance we can look ahead in  
bytes of decoded data.  
  
The existing GUC maintenance_io_concurrency is used to limit the number  
of concurrent I/Os allowed, based on pessimistic heuristics used to  
infer that I/Os have begun and completed.  We'll also not look more than  
maintenance_io_concurrency * 4 block references ahead.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]> (earlier version)  
Reviewed-by: Andres Freund <[email protected]> (earlier version)  
Reviewed-by: Justin Pryzby <[email protected]> (earlier version)  
Tested-by: Tomas Vondra <[email protected]> (earlier version)  
Tested-by: Jakub Wartak <[email protected]> (earlier version)  
Tested-by: Dmitry Dolgov <[email protected]> (earlier version)  
Tested-by: Sait Talha Nisanci <[email protected]> (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/Makefile
M src/backend/access/transam/xlog.c
A src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
A src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Fix warning introduced in 5c279a6d350.

commit   : 9553b4115f1879f66935f42fff0b798ef91866d0    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 00:27:07 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 7 Apr 2022 00:27:07 -0700    

Click here for diff

Change two macros to be static inline functions instead to keep the  
data type consistent. This avoids a "comparison is always true"  
warning that was occurring with -Wtype-limits. In the process, change  
the names to look less like macros.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlogreader.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/rmgrdesc.c
M src/include/access/rmgr.h

pgstat: add tests for transaction behaviour, 2PC, function stats.

commit   : e349c95d3e91754c8c3afc0587d52d44a479c8d2    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    

Click here for diff

Author: Andres Freund <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A src/test/isolation/expected/stats.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/stats.spec
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

pgstat: add pg_stat_have_stats() test helper.

commit   : ad401664b8012cafb64e8fce33fe40356c5bc686    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    

Click here for diff

Will be used by tests committed subsequently.  
  
Bumps catversion (this time for real, the one in 0f96965c658 got lost when  
rebasing over 5c279a6d350).  
  
Author: Melanie Plageman <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_aNxL1WegCa45r=VAViCLnpOU7uNC7bTtGw+=QAPyYivw@mail.gmail.com  

M src/backend/catalog/system_functions.sql
M src/backend/utils/activity/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h

pgstat: add pg_stat_force_next_flush(), use it to simplify tests.

commit   : 0f96965c658147d6d6bad096d2d4a2c9c665f4a9    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

In the stats collector days it was hard to write tests for the stats system,  
because fundamentally delivery of stats messages over UDP was not  
synchronous (nor guaranteed). Now we easily can force pending stats updates to  
be flushed synchronously.  
  
This moves stats.sql into a parallel group, there isn't a reason for it to run  
in isolation anymore. And it may shake out some bugs.  
  
Bumps catversion.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/stats.out
M contrib/test_decoding/sql/stats.sql
M src/backend/utils/activity/pgstat.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/brin.out
M src/test/regress/expected/stats.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/brin.sql
M src/test/regress/sql/stats.sql

pgstat: fix small bug in pgstat_drop_relation().

commit   : 5e07d3d6bdbff998eb68c131ecd10c448b026e47    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

Just after committing 5891c7a8ed8, a test running with debug_discard_caches=1  
failed locally...  
  
pgstat_drop_relation() neither checked pgstat_should_count_relation() nor  
called pgstat_prep_relation_pending(). With debug_discard_caches=1  
rel->pgstat_info wasn't set up, leading pg_stat_get_xact_tuples_inserted()  
spuriously still returning > 0 while in the transaction dropping the table.  

M src/backend/utils/activity/pgstat_relation.c

pgstat: prevent fix pgstat_reinit_entry() from zeroing out lwlock.

commit   : 81ae9e65887476b4c55aaad276a8010a459a41ce    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

Zeroing out an lwlock in a normal build turns out to not trigger any alarms,  
if nobody can use the lwlock at that moment (as the case here). But with  
--disable-spinlocks --disable-atomics, the sema field needs to be initialized.  
  
We probably should make sure that this fails on more common configurations as  
well...  
  
Per buildfarm animal rorqual  

M src/backend/utils/activity/pgstat_shmem.c

Fix compilation with WAL_DEBUG.

commit   : 3536b851adb275e2f49a80030111e84abc0736ba    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:24:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 23:24:00 -0700    

Click here for diff

Broke with 5c279a6d350. But looks like it had been half-broken since  
70e81861fad, because 'rmid' didn't refer to the current record's rmid anymore,  
but to rmid from "Initialize resource managers" - a constant.  

M src/backend/access/transam/xlogrecovery.c

Custom WAL Resource Managers.

commit   : 5c279a6d350205cc98f91fb8e1d3e4442a6b25d1    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 6 Apr 2022 22:26:43 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 6 Apr 2022 22:26:43 -0700    

Click here for diff

Allow extensions to specify a new custom resource manager (rmgr),  
which allows specialized WAL. This is meant to be used by a Table  
Access Method or Index Access Method.  
  
Prior to this commit, only Generic WAL was available, which offers  
support for recovery and physical replication but not logical  
replication.  
  
Reviewed-by: Julien Rouhaud, Bharath Rupireddy, Andres Freund  
Discussion: https://postgr.es/m/ed1fb2e22d15d3563ae0eb610f7b61bb15999c0a.camel%40j-davis.com  

M doc/src/sgml/config.sgml
A doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/generic-wal.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/decode.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/rmgrdesc.c
M src/bin/pg_waldump/rmgrdesc.h
M src/include/access/rmgr.h
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/miscadmin.h
M src/include/utils/guc.h

Update config.guess and config.sub

commit   : a8cfb0c1a964ebbe830c5138d389b0d2627ec298    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 07:32:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Apr 2022 07:32:43 +0200    

Click here for diff

M config/config.guess
M config/config.sub

Add single-item cache when looking at topmost XID of a subtrans XID

commit   : 06f5295af673df795e8e70e28c43d61c2817b6df    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Apr 2022 14:34:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Apr 2022 14:34:37 +0900    

Click here for diff

This change affects SubTransGetTopmostTransaction(), used to find the  
topmost transaction ID of a given transaction ID.  The cache is able to  
store one value, so as we can save the backend from unnecessary lookups  
at pg_subtrans/ on repetitive calls of this routine.  There is a similar  
practice in transam.c, for example.  
  
Author: Simon Riggs  
Reviewed-by: Andrey Borodin, Julien Rouhaud  
Discussion: https://postgr.es/m/CANbhV-G8Co=yq4v4BkW7MJDqVt68K_8A48nAZ_+8UQS7LrwLEQ@mail.gmail.com  

M src/backend/access/transam/subtrans.c

pgstat: move pgstat.c to utils/activity.

commit   : fbfe6910eca0d6a61cbcdd27cdd5a8d9de6477fa    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Now that pgstat is not related to postmaster anymore, src/backend/postmaster  
is not a well fitting directory.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/Makefile
M src/backend/utils/activity/Makefile
R099 src/backend/postmaster/pgstat.c src/backend/utils/activity/pgstat.c

pgstat: rename STATS_COLLECTOR GUC group to STATS_CUMULATIVE.

commit   : 1db4e5a4eeec0c5e240628923daf0e0a666f8c04    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc_tables.h

pgstat: remove stats_temp_directory.

commit   : 6f0cf87872ab2fd4a81249ca9d6299b9b1a52277    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

With stats now being stored in shared memory, the GUC isn't needed  
anymore. However, the pg_stat_tmp directory and PG_STAT_TMP_DIR define are  
kept, as pg_stat_statements (and some out-of-core extensions) store data in  
it.  
  
Docs will be updated in a subsequent commit, together with the other pending  
docs updates due to shared memory stats.  
  
Author: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_rewind/filemap.c
M src/include/pgstat.h
M src/test/perl/PostgreSQL/Test/Cluster.pm

pgstat: store statistics in shared memory.

commit   : 5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Previously the statistics collector received statistics updates via UDP and  
shared statistics data by writing them out to temporary files regularly. These  
files can reach tens of megabytes and are written out up to twice a  
second. This has repeatedly prevented us from adding additional useful  
statistics.  
  
Now statistics are stored in shared memory. Statistics for variable-numbered  
objects are stored in a dshash hashtable (backed by dynamic shared  
memory). Fixed-numbered stats are stored in plain shared memory.  
  
The header for pgstat.c contains an overview of the architecture.  
  
The stats collector is not needed anymore, remove it.  
  
By utilizing the transactional statistics drop infrastructure introduced in a  
prior commit statistics entries cannot "leak" anymore. Previously leaked  
statistics were dropped by pgstat_vacuum_stat(), called from [auto-]vacuum. On  
systems with many small relations pgstat_vacuum_stat() could be quite  
expensive.  
  
Now that replicas drop statistics entries for dropped objects, it is not  
necessary anymore to reset stats when starting from a cleanly shut down  
replica.  
  
Subsequent commits will perform some further code cleanup, adapt docs and add  
tests.  
  
Bumps PGSTAT_FILE_FORMAT_ID.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Reviewed-By: "David G. Johnston" <[email protected]>  
Reviewed-By: Tomas Vondra <[email protected]> (in a much earlier version)  
Reviewed-By: Arthur Zakirov <[email protected]> (in a much earlier version)  
Reviewed-By: Antonin Houska <[email protected]> (in a much earlier version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
A src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/miscadmin.h
M src/include/pgstat.h
M src/include/storage/lwlock.h
M src/include/utils/pgstat_internal.h
M src/include/utils/rel.h
M src/include/utils/timeout.h
M src/include/utils/wait_event.h
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
M src/tools/pgindent/typedefs.list
M src/tools/valgrind.supp

pgstat: normalize function naming.

commit   : be902e26510788c70a874ea54bad753b723d018f    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Most of pgstat uses pgstat_<verb>_<subject>() or just <verb>_<subject>(). But  
not all (some introduced fairly recently by me). Rename ones that aren't  
intentionally following a different scheme (e.g. AtEOXact_*).  

M src/backend/access/common/relation.c
M src/backend/access/transam/slru.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h

Reorder subskiplsn in pg_subscription to avoid alignment issues.

commit   : 79b716cfb7a1be2a61ebb4418099db1258f35e30    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 7 Apr 2022 09:39:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 7 Apr 2022 09:39:25 +0530    

Click here for diff

The column 'subskiplsn' uses TYPALIGN_DOUBLE (which has 4 bytes alignment  
on AIX) for storage. But the C Struct (Form_pg_subscription) has 8-byte  
alignment for this field, so retrieving it from storage causes an  
unaligned read.  
  
To fix this, we rearranged the 'subskiplsn' column in the catalog so that  
it naturally comes at an 8-byte boundary.  
  
We have fixed a similar problem in commit f3b421da5f. This patch adds a  
test to avoid a similar mistake in the future.  
  
Reported-by: Noah Misch  
Diagnosed-by: Noah Misch, Masahiko Sawada, Amit Kapila  
Author: Masahiko Sawada  
Reviewed-by: Noah Misch, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
	    https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/test_setup.out
M src/test/regress/regress.c
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/test_setup.sql

pgstat: revise replication slot API in preparation for shared memory stats.

commit   : e41aed674f35c63380175bb0e2dfa8dccfb2204d    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 18:26:17 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 18:26:17 -0700    

Click here for diff

Previously the pgstat <-> replication slots API was done with on the basis of  
names. However, the upcoming move to storing stats in shared memory makes it  
more convenient to use a integer as key.  
  
Change the replication slot functions to take the slot rather than the slot  
name, and expose ReplicationSlotIndex() to compute the index of an replication  
slot. Special handling will be required for restarts, as the index is not  
stable across restarts. For now pgstat internally still uses names.  
  
Rename pgstat_report_replslot_{create,drop}() to  
pgstat_{create,drop}_replslot() to match the functions for other kinds of  
stats.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/utils/activity/pgstat_replslot.c
M src/include/pgstat.h
M src/include/replication/slot.h

pgstat: scaffolding for transactional stats creation / drop.

commit   : 8b1dccd37c71ed2ff016294d8f9053a32b02b19e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 18:22:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 18:22:22 -0700    

Click here for diff

One problematic part of the current statistics collector design is that there  
is no reliable way of getting rid of statistics entries. Because of that  
pgstat_vacuum_stat() (called by [auto-]vacuum) matches all stats for the  
current database with the catalog contents and tries to drop now-superfluous  
entries. That's quite expensive. What's worse, it doesn't work on physical  
replicas, despite physical replicas collection statistics entries.  
  
This commit introduces infrastructure to create / drop statistics entries  
transactionally, together with the underlying catalog objects (functions,  
relations, subscriptions). pgstat_xact.c maintains a list of stats entries  
created / dropped transactionally in the current transaction. To ensure the  
removal of statistics entries is durable dropped statistics entries are  
included in commit / abort (and prepare) records, which also ensures that  
stats entries are dropped on standbys.  
  
Statistics entries created separately from creating the underlying catalog  
object (e.g. when stats were previously lost due to an immediate restart)  
are *not* WAL logged. However that can only happen outside of the transaction  
creating the catalog object, so it does not lead to "leaked" statistics  
entries.  
  
For this to work, functions creating / dropping functions / relations /  
subscriptions need to call into pgstat. For subscriptions this was already  
done when dropping subscriptions, via pgstat_report_subscription_drop() (now  
renamed to pgstat_drop_subscription()).  
  
This commit does not actually drop stats yet, it just provides the  
infrastructure. It is however a largely independent piece of infrastructure,  
so committing it separately makes sense.  
  
Bumps XLOG_PAGE_MAGIC.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_xact.c
M src/include/access/xact.h
M src/include/access/xlog_internal.h
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

pgstat: prepare APIs used by pgstatfuncs for shared memory stats.

commit   : 8fb580a35ce358063dfdd10991d017498283c767    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    

Click here for diff

With the introduction of PgStat_Kind PgStat_Single_Reset_Type,  
PgStat_Shared_Reset_Target don't make sense anymore. Replace them with  
PgStat_Kind.  
  
Instead of having dedicated reset functions for different kinds of stats, use  
two generic helper routines (one to reset all stats of a kind, one to reset  
one stats entry).  
  
A number of reset functions were named pgstat_reset_*_counter(), despite  
affecting multiple counters. The generic helper routines get rid of  
pgstat_reset_single_counter(), pgstat_reset_subscription_counter().  
  
Rename pgstat_reset_slru_counter(), pgstat_reset_replslot_counter() to  
pgstat_reset_slru(), pgstat_reset_replslot() respectively, and have them only  
deal with a single SLRU/slot. Resetting all SLRUs/slots goes through the  
generic pgstat_reset_of_kind().  
  
Previously pg_stat_reset_replication_slot() used SearchNamedReplicationSlot()  
to check if a slot exists. API wise it seems better to move that to  
pgstat_replslot.c.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

pgstat: introduce PgStat_Kind enum.

commit   : 997afad89d12f314555600feee8189d753e105d1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    

Click here for diff

Will be used by following commits to generalize stats infrastructure. Kept  
separate to allow commits stand reasonably on their own.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Add option --config-file to pg_rewind

commit   : 0d5c387573be5c40bf18b7b8983f406637dff42f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Apr 2022 08:51:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Apr 2022 08:51:49 +0900    

Click here for diff

This option is useful to do a rewind with the server configuration file  
(aka postgresql.conf) located outside the data directory, which is  
something that some Linux distributions and some HA tools like to rely  
on.  As a result, this can simplify the logic around a rewind by  
avoiding the copy of such files before running pg_rewind.  
  
This option affects pg_rewind when it internally starts the target  
cluster with some "postgres" commands, adding -c config_file=FILE to the  
command strings generated, when:  
- retrieving a restore_command using a "postgres -C" command for  
-c/--restore-target-wal.  
- forcing crash recovery once to get the cluster into a clean shutdown  
state.  
  
Author: Gunnar "Nick" Bluth  
Reviewed-by: Michael Banck, Alexander Kukushkin, Michael Paquier,  
Alexander Alekseev  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/RewindTest.pm

Use ISB as a spin-delay instruction on ARM64.

commit   : a82a5eee314df52f3183cedc0ecbcac7369243b1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 18:57:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 18:57:57 -0400    

Click here for diff

This seems beneficial on high-core-count machines, and not harmful  
on lesser hardware.  However, older ARM32 gear doesn't have this  
instruction, so restrict the patch to ARM64.  
  
Geoffrey Blake  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

pgstat: add pgstat_copy_relation_stats().

commit   : 8ea7963fc741b6f403a544d56ad0ecf78e5237b1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 14:09:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 14:09:18 -0700    

Click here for diff

Until now index_concurrently_swap() directly modified pgstat internal  
datastructures. That will break with the introduction of shared memory  
statistics and seems off architecturally.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Author: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/pgstat.h

pgstat: rename some pgstat_send_* functions to pgstat_report_*.

commit   : cc96373cf39bbfb386a40a47b7f0ea8f051f1838    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 14:08:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 14:08:57 -0700    

Click here for diff

Only the pgstat_send_* functions that are called from outside pgstat*.c are  
renamed (the rest will go away). This is done separately from the - quite  
large - shared memory statistics patch to make review easier.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/pgstat.h

Suppress "variable 'pagesaving' set but not used" warning.

commit   : dbafe127bb215f512164669b49f99fcb7ed9d266    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 17:03:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 17:03:35 -0400    

Click here for diff

With asserts disabled, late-model clang notices that this variable  
is incremented but never otherwise read.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/nbtree/nbtdedup.c

pgstat: stats collector references in comments.

commit   : bdbd3d9064f9dbd064253e05f156ec77d4a90d05    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 13:56:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 13:56:06 -0700    

Click here for diff

Soon the stats collector will be no more, with statistics instead getting  
stored in shared memory. There are a lot of references to the stats collector  
in comments. This commit replaces most of these references with "cumulative  
statistics system", with the remaining ones getting replaced as part of  
subsequent commits.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/t/001_repl_stats.pl
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/dbcommands.c
M src/backend/commands/matview.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/basebackup.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/error/elog.c
M src/include/pgstat.h
M src/include/utils/backend_status.h
M src/include/utils/pgstat_internal.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

pgstat: move transactional code into pgstat_xact.c.

commit   : ab62a642d52c95c0c62e927ba1bf3cfa279b744b    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 13:23:47 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 13:23:47 -0700    

Click here for diff

The transactional integration code is largely independent from the rest of  
pgstat.c. Subsequent commits will add more related code.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/Makefile
A src/backend/utils/activity/pgstat_xact.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h

pgstat: move pgstat_report_autovac() to pgstat_database.c.

commit   : c3e9b07936f70388c6f5341b68d6a04d40e07b86    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 12:41:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 12:41:29 -0700    

Click here for diff

I got the location wrong in 13619598f10. The name did make it sound like it  
belonged in pgstat_relation.c...  

M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/pgstat.h

dsm: allow use in single user mode.

commit   : 46a2d2499a647174585fcfe871ddd2d32244a128    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 12:40:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 6 Apr 2022 12:40:04 -0700    

Click here for diff

It might seem pointless to allow use of dsm in single user mode, but otherwise  
subsystems might need dedicated single user mode code paths.  
  
Besides changing the assert, all that's needed is to make some windows code  
assuming the presence of postmaster conditional.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com  

M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c

Forgotten catversion bump for 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a

commit   : e99546f56670491370d7dc63b0693c3aadaa3112    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2022 15:00:07 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2022 15:00:07 -0400    

Click here for diff

M src/include/catalog/catversion.h

Remove exclusive backup mode

commit   : 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a    
  
author   : Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2022 14:41:03 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Wed, 6 Apr 2022 14:41:03 -0400    

Click here for diff

Exclusive-mode backups have been deprecated since 9.6 (when  
non-exclusive backups were introduced) due to the issues  
they can cause should the system crash while one is running and  
generally because non-exclusive provides a much better interface.  
Further, exclusive backup mode wasn't really being tested (nor was most  
of the related code- like being able to log in just to stop an exclusive  
backup and the bits of the state machine related to that) and having to  
possibly deal with an exclusive backup and the backup_label file  
existing during pg_basebackup, pg_rewind, etc, added other complexities  
that we are better off without.  
  
This patch removes the exclusive backup mode, the various special cases  
for dealing with it, and greatly simplifies the online backup code and  
documentation.  
  
Authors: David Steele, Nathan Bossart  
Reviewed-by: Chapman Flack  
Discussion: https://postgr.es/m/[email protected]  
https://postgr.es/m/CAHg+QDfiM+WU61tF6=nPZocMZvHDzCK47Kneyb0ZRULYzV5sKQ@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/runtime.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/system_functions.sql
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/utils/init/postinit.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_rewind/filemap.c
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/010_logical_decoding_timelines.pl

Further improve jsonb_sqljson parallel test

commit   : 14d3f24fa8a21f8a7e66f1fc60253a1e11410bf3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 6 Apr 2022 13:48:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 6 Apr 2022 13:48:26 -0400    

Click here for diff

Instead of using a very large table, use some settings to encourage use  
of parallelism. Also, drop the table so it doesn't upset the recovery  
test.  
  
per suggestion from Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/jsonb_sqljson.sql

Allow granting SET and ALTER SYSTEM privileges on GUC parameters.

commit   : a0ffa885e478f5eeacc4e250e35ce25a4740c487    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 13:24:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Apr 2022 13:24:33 -0400    

Click here for diff

This patch allows "PGC_SUSET" parameters to be set by non-superusers  
if they have been explicitly granted the privilege to do so.  
The privilege to perform ALTER SYSTEM SET/RESET on a specific parameter  
can also be granted.  
Such privileges are cluster-wide, not per database.  They are tracked  
in a new shared catalog, pg_parameter_acl.  
  
Granting and revoking these new privileges works as one would expect.  
One caveat is that PGC_USERSET GUCs are unaffected by the SET privilege  
--- one could wish that those were handled by a revocable grant to  
PUBLIC, but they are not, because we couldn't make it robust enough  
for GUCs defined by extensions.  
  
Mark Dilger, reviewed at various times by Andrew Dunstan, Robert Haas,  
Joshua Brindle, and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/set.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
A src/backend/catalog/pg_parameter_acl.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/acl.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/objectaccess.h
A src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/acl.h
M src/include/utils/guc.h
M src/include/utils/syscache.h
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/expected/guc_privs.out
A src/test/modules/unsafe_tests/sql/guc_privs.sql

Reduce running time of jsonb_sqljson test

commit   : 2ef6f11b0c77ec323c688ddfd98ffabddb72c11d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 6 Apr 2022 10:25:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 6 Apr 2022 10:25:45 -0400    

Click here for diff

The test created a 1m row table in order to test parallel operation of  
JSON_VALUE. However, this was more than were needed for the test, so  
save time by halving it, and also by making the table unlogged.  
Experimentation shows that this size is only a little above the number  
required to generate the expected output.  
  
Per gripe from Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/jsonb_sqljson.sql

Fix unsigned output format in SLRU error reporting

commit   : 01effb130420ba06b3fb441274415bd07c8a87b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 09:15:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 09:15:05 +0200    

Click here for diff

Avoid printing signed values as unsigned.  (No impact in practice  
expected.)  
  
Author: Pavel Borisov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CALT9ZEHN7hWJo6MgJKqoDMGj%3DGOzQU50wTvOYZXDj7x%3DsUK-kw%40mail.gmail.com  

M src/backend/access/transam/slru.c

Change one AssertMacro to Assert

commit   : b604a1c204fce2600730cb60aa78e04e949fa588    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 09:09:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 09:09:14 +0200    

Click here for diff

What surrounds it is no longer a macro (e27f4ee0a701).  

M src/include/access/htup_details.h

Allow asynchronous execution in more cases.

commit   : c2bb02bc2e858ba345b8b33f1f3a54628f719d93    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 6 Apr 2022 15:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 6 Apr 2022 15:45:00 +0900    

Click here for diff

In commit 27e1f1456, create_append_plan() only allowed the subplan  
created from a given subpath to be executed asynchronously when it was  
an async-capable ForeignPath.  To extend coverage, this patch handles  
cases when the given subpath includes some other Path types as well that  
can be omitted in the plan processing, such as a ProjectionPath directly  
atop an async-capable ForeignPath, allowing asynchronous execution in  
partitioned-scan/partitioned-join queries with non-Var tlist expressions  
and more UNION queries.  
  
Andrey Lepikhov and Etsuro Fujita, reviewed by Alexander Pyhalov and  
Zhihong Yu.  
  
Discussion: https://postgr.es/m/659c37a8-3e71-0ff2-394c-f04428c76f08%40postgrespro.ru  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Update Unicode data to CLDR 41

commit   : 376dc437de40bd17e99a37f72f88627a16d7f200    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 08:17:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Apr 2022 08:17:33 +0200    

Click here for diff

No actual changes result.  

M src/Makefile.global.in

Improve comments for row filtering and toast interaction in logical replication.

commit   : 2d09e44d309f64d3571f90f7620c9d924aecd010    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 6 Apr 2022 08:20:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 6 Apr 2022 08:20:40 +0530    

Click here for diff

Reported-by: Antonin Houska  
Author: Amit Kapila  
Reviewed-by: Antonin Houska, Ajin Cherian  
Discussion: https://postgr.es/m/84638.1649152255@antos  

M src/backend/replication/pgoutput/pgoutput.c

Change aggregated log format of pgbench.

commit   : 17a856d08bedeaec77be3f15572e01f553e9613f    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 6 Apr 2022 09:55:58 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 6 Apr 2022 09:55:58 +0900    

Click here for diff

Commit 4a39f87acd changed the aggregated log format. Problem is, now  
the explanatory paragraph for the log line in the document is too  
long. Also the log format included more optional columns, and it's  
harder to parse the log lines.  This commit tries to solve the  
problems.  
  
- There's no optional log columns anymore. If a column is not  
  meaningful with provided pgbench option, it will be presented as 0.  
  
- Reorder the log columns so that it's easier to parse them.  
  
- Adjust explanatory paragraph for the log line in the doc.  
  
Discussion: https://postgr.es/m/flat/202203280757.3tu4ovs3petm%40alvherre.pgsql  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Remove race condition in 022_crash_temp_files.pl test.

commit   : e37ad5fa4df2319e26a7e779607130feae1a5029    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Apr 2022 20:44:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Apr 2022 20:44:01 -0400    

Click here for diff

It's possible for the query that "waits for restart" to complete a  
successful iteration before the postmaster has noticed its SIGKILL'd  
child and begun the restart cycle.  (This is a bit hard to believe  
perhaps, but it's been seen at least twice in the buildfarm, mainly  
on ancient platforms that likely have quirky schedulers.)  
  
To provide a more secure interlock, wait for the other session  
we're using to report that it's been forcibly shut down.  
  
Patch by me, based on a suggestion from Andres Freund.  
Back-patch to v14 where this test case came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/022_crash_temp_files.pl

Fix compilerwarning in logging size_t

commit   : 75edb919613ee835e7680e40137e494c7856bcf9    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Apr 2022 22:16:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Apr 2022 22:16:45 +0200    

Click here for diff

The pg_fatal log which included filesizes were using UINT64_FORMAT for  
the size_t variables, which failed on 32 bit buildfarm animals. Change  
to using plain int instead, which is in line with how digestControlFile  
is doing it already.  
  
Per buildfarm animals florican and lapwing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/local_source.c

PLAN clauses for JSON_TABLE

commit   : fadb48b00e02ccfd152baa80942de30205ab3c4f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 5 Apr 2022 14:09:04 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 5 Apr 2022 14:09:04 -0400    

Click here for diff

These clauses allow the user to specify how data from nested paths are  
joined, allowing considerable freedom in shaping the tabular output of  
JSON_TABLE.  
  
PLAN DEFAULT allows the user to specify the global strategies when  
dealing with sibling or child nested paths. The is often sufficient to  
achieve the necessary goal, and is considerably simpler than the full  
PLAN clause, which allows the user to specify the strategy to be used  
for each named nested path.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/jsonb_sqljson.sql
M src/tools/pgindent/typedefs.list

Have VACUUM warn on relfrozenxid "in the future".

commit   : e83ebfe6d767dafcefe00bc5f11392a3d6976c1b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 5 Apr 2022 09:44:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 5 Apr 2022 09:44:52 -0700    

Click here for diff

Commits 74cf7d46 and a61daa14 fixed pg_upgrade bugs involving oversights  
in how relfrozenxid or relminmxid are carried forward or initialized.  
Corruption caused by bugs of this nature was ameliorated by commit  
78db307bb2, which taught VACUUM to always overwrite existing invalid  
relfrozenxid or relminmxid values that are apparently "in the future".  
  
Extend that work now by showing a warning in the event of overwriting  
either relfrozenxid or relminmxid due to an existing value that is "in  
the future".  There is probably a decent chance that the sanity checks  
added by commit 699bf7d05c will raise an error before VACUUM reaches  
this point, but we shouldn't rely on that.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzmRZEzeGvLv8yDW0AbFmSvJjTziORqjVUrf74mL4GL0Ww@mail.gmail.com  

M src/backend/commands/vacuum.c

pg_rewind: Fetch small files according to new size.

commit   : 16915126746e2d8597a92197a346fea0756f8e3e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Apr 2022 14:45:31 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 5 Apr 2022 14:45:31 +0200    

Click here for diff

There's a race condition if a file changes in the source system  
after we have collected the file list. If the file becomes larger,  
we only fetched up to its original size. That can easily result in  
a truncated file.  That's not a problem for relation files, files  
in pg_xact, etc. because any actions on them will be replayed from  
the WAL.  However, configuration files are affected.  
  
This commit mitigates the race condition by fetching small files in  
whole, even if they have grown.  A test is added in which an extra  
file copied is concurrently grown with the output of pg_rewind thus  
guaranteeing it to have changed in size during the operation.  This  
is not a full fix: we still believe the original file size for files  
larger than 1 MB.  That should be enough for configuration files,  
and doing more than that would require big changes to the chunking  
logic in libpq_source.c.  
  
This mitigates the race condition if the file is modified between  
the original scan of files and copying the file, but there's still  
a race condition if a file is changed while it's being copied.  
That's a much smaller window, though, and pg_basebackup has the  
same issue.  
  
This race can be seen with pg_auto_failover, which frequently uses  
ALTER SYSTEM, which updates postgresql.auto.conf.  Often, pg_rewind  
will fail, because the postgresql.auto.conf file changed concurrently  
and a partial version of it was copied to the target.  The partial  
file would fail to parse, preventing the server from starting up.  
  
Author: Heikki Linnakangas  
Reviewed-by: Cary Huang  
Discussion: https://postgr.es/m/f67feb24-5833-88cb-1020-19a4a2b83ac7%40iki.fi  

M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/rewind_source.h
A src/bin/pg_rewind/t/009_growing_files.pl

Extend TAP tests of pg_dump to test for compression with gzip

commit   : 98fe74218d97becb2a53581304c96091409fd929    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 5 Apr 2022 19:10:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 5 Apr 2022 19:10:10 +0900    

Click here for diff

The test logic is extended with two new concepts:  
- Addition of a compression command called compress_cmd, executed  
between restore_cmd and dump_cmd to control the contents of the dumps.  
In the case of this commit, this is used to compress or decompress  
elements of a dump to test new code paths.  
- Addition of a new flag called compile_option, to check if a set of  
tests can be executed depending on the ./configure options used in a  
given build.  
  
The tests introduced here are for gzip, but they are designed so as they  
can easily be extended for new compression methods.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

M src/bin/pg_dump/Makefile
M src/bin/pg_dump/t/002_pg_dump.pl

Refactor and cleanup runtime partition prune code a little

commit   : 297daa9d43539fbf5fbb3c3a2cca190d0e3da471    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2022 11:46:48 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 5 Apr 2022 11:46:48 +0200    

Click here for diff

* Move the execution pruning initialization steps that are common  
between both ExecInitAppend() and ExecInitMergeAppend() into a new  
function ExecInitPartitionPruning() defined in execPartition.c.  
Those steps include creation of a PartitionPruneState to be used for  
all instances of pruning and determining the minimal set of child  
subplans that need to be initialized by performing initial pruning if  
needed, and finally adjusting the subplan_map arrays in the  
PartitionPruneState to reflect the new set of subplans remaining  
after initial pruning if it was indeed performed.  
ExecCreatePartitionPruneState() is no longer exported out of  
execPartition.c and has been renamed to CreatePartitionPruneState()  
as a local sub-routine of ExecInitPartitionPruning().  
  
* Likewise, ExecFindInitialMatchingSubPlans() that was in charge of  
performing initial pruning no longer needs to be exported.  In fact,  
since it would now have the same body as the more generally named  
ExecFindMatchingSubPlans(), except differing in the value of  
initial_prune passed to the common subroutine  
find_matching_subplans_recurse(), it seems better to remove it and add  
an initial_prune argument to ExecFindMatchingSubPlans().  
  
* Add an ExprContext field to PartitionPruneContext to remove the  
implicit assumption in the runtime pruning code that the ExprContext to  
use to compute pruning expressions that need one can always rely on the  
PlanState providing it.  A future patch will allow runtime pruning (at  
least the initial pruning steps) to be performed without the  
corresponding PlanState yet having been created, so this will help.  
  
Author: Amit Langote <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqEYCpEqh2LMDOp9mT+4-QoVe8HgFMKBjntEMCTZLpcCCA@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/partitioning/partprune.h

Update some tests in 013_crash_restart.pl.

commit   : 7a43a1fc52d0fefdcb008f2fc460ab46f242da69    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2022 22:10:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2022 22:10:06 -0400    

Click here for diff

The expected backend message after SIGQUIT changed in commit  
7e784d1dc, but we missed updating this test case.  Also, experience  
shows that we might sometimes get "could not send data to server"  
instead of either of the libpq messages the test is looking for.  
  
Per report from Mark Dilger.  Back-patch to v14 where the  
backend message changed.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

dshash: revise sequential scan support.

commit   : 909eebf27b9e6aaa78fb3338f7d8fbc7fa174247    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 14:32:52 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 14:32:52 -0700    

Click here for diff

The previous coding of dshash_seq_next(), on the first call, accessed  
status->hash_table->size_log2 without holding a partition lock and without  
guaranteeing that ensure_valid_bucket_pointers() had ever been called.  
  
That oversight turns out to not have immediately visible effects, because  
bucket 0 is always in partition 0, and ensure_valid_bucket_pointers() was  
called after acquiring the partition lock.  However,  
PARTITION_FOR_BUCKET_INDEX() with a size_log2 of 0 ends up triggering formally  
undefined behaviour.  
  
Simplify by accessing partition 0, without using PARTITION_FOR_BUCKET_INDEX().  
  
While at it, remove dshash_get_current(), there is no convincing use  
case. Also polish a few comments.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com  

M src/backend/lib/dshash.c
M src/include/lib/dshash.h

pgstat: remove some superflous comments from pgstat.h.

commit   : 55e566fc4bc866d73541a3b28be5454bf8d666b0    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 14:23:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 14:23:02 -0700    

Click here for diff

These would all need to be rephrased when moving to shared memory stats, but  
since they don't provide actual information right now, remove them instead.  
  
The comments for PgStat_Msg* are left in, because they will all be removed as  
part of the shared memory stats patch.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/pgstat.h

pgstat: consistent function comment formatting.

commit   : edadf8098f4b2ca50bcc449f8857d0cc960b3c90    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 12:14:34 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 4 Apr 2022 12:14:34 -0700    

Click here for diff

There was a wild mishmash of function comment formatting in pgstat, making it  
hard to know what to use for any new function and hard to extend existing  
comments (particularly due to randomly different forms of indentation).  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c

JSON_TABLE

commit   : 4e34747c88a03ede6e9d731727815e37273d4bc9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 Apr 2022 15:36:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 Apr 2022 15:36:03 -0400    

Click here for diff

This feature allows jsonb data to be treated as a table and thus used in  
a FROM clause like other tabular data. Data can be selected from the  
jsonb using jsonpath expressions, and hoisted out of nested structures  
in the jsonb to form multiple rows, more or less like an outer join.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu (whose  
name I previously misspelled), Himanshu Upadhyaya, Daniel Gustafsson,  
Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
A src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/utils/jsonpath.h
M src/test/regress/expected/json_sqljson.out
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/json_sqljson.sql
M src/test/regress/sql/jsonb_sqljson.sql
M src/tools/pgindent/typedefs.list

vacuumlazy.c: Further consolidate resource allocation.

commit   : c42a6fc41dc22b42e5417224440c02893996afb4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 4 Apr 2022 11:53:33 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 4 Apr 2022 11:53:33 -0700    

Click here for diff

Move remaining VACUUM resource allocation and deallocation code from  
lazy_scan_heap() to its caller, heap_vacuum_rel().  This finishes off  
work started by commit 73f6ec3d.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk3fNBa_S3Ngi+16GQiyJ=AmUu3oUY99syMDTMRxitfyQ@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

psql: Show all query results by default

commit   : 7844c9918a43b494adde3575891d217a37062378    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Apr 2022 14:57:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Apr 2022 14:57:17 +0200    

Click here for diff

Previously, psql printed only the last result if a command string  
returned multiple result sets.  Now it prints all of them.  The  
previous behavior can be obtained by setting the psql variable  
SHOW_ALL_RESULTS to off.  
  
This is a significantly enhanced version of  
3a5130672296ed4e682403a77a9a3ad3d21cef75 (that was later reverted).  
There is also much more test coverage for various psql features now.  
  
Author: Fabien COELHO <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: "Iwata, Aya" <[email protected]> (earlier version)  
Reviewed-by: Daniel Verite <[email protected]> (earlier version)  
Reviewed-by: Kyotaro Horiguchi <[email protected]> (earlier version)  
Reviewed-by: vignesh C <[email protected]> (earlier version)  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/tab-complete.c
M src/test/regress/expected/copyselect.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/transactions.out
M src/test/regress/sql/copyselect.sql
M src/test/regress/sql/psql.sql
M src/test/regress/sql/transactions.sql

Disable synchronize_seqscans in 027_stream_regress.pl.

commit   : cbf4177f2ca0b9bbfdb78a6ab51e3876e9ff6eac    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2022 12:38:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Apr 2022 12:38:51 -0400    

Click here for diff

This script runs the core regression tests with quite a small value of  
shared_buffers, making it prone to breakage due to synchronize_seqscans  
kicking in where the tests don't expect that.  Disable that feature to  
stabilize the tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/027_stream_regress.pl

Avoid freeing objects during json aggregate finalization

commit   : 4eb9798879680dcc0e3ebb301cf6f925dfa69422    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 4 Apr 2022 10:12:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 4 Apr 2022 10:12:30 -0400    

Click here for diff

Commit f4fb45d15c tried to free memory during aggregate finalization.  
This cause issues, particularly when used as a window function, so stop  
doing that.  
  
Per complaint by Jaime Casanova and diagnosis by Andres Freund  
  
Discussion: https://postgr.es/m/YkfeMNYRCGhySKyg@ahch-to  

M src/backend/utils/adt/json.c

pg_basebackup: Fix code that thinks about LZ4 buffer size.

commit   : afb529e6772b4e2b065644a2204697eeaf6c9a96    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 4 Apr 2022 10:36:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 4 Apr 2022 10:36:23 -0400    

Click here for diff

Before this patch, there was some code that tried to make sure that the  
buffer was always big enough at the start, and then asserted that it  
didn't need to be enlarged later. However, the code to make sure it was  
big enough at the start doesn't actually work, and therefore it was  
possible to fail an assertion and crash later.  
  
Remove the code that tries to make sure the buffer is always big enough  
at the start in favor of enlarging the buffer as we go along whenever  
that is necessary.  
  
The mistake probably happened because, on the server side, we do  
actually need to guarantee that the buffer is big enough at the start  
to avoid subsequent resizings. However, in that case, the calling  
code makes promises about how much data it will provide at once, but  
here, that's not the case.  
  
Report by Justin Pryzby. Analysis by me. Patch by Dipesh Pandit.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/bbstreamer_lz4.c

Use Generation memory contexts to store tuples in sorts

commit   : 40af10b571bdabbab06839d090083c9f9c2091d2    
  
author   : David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 22:52:35 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 22:52:35 +1200    

Click here for diff

The general usage pattern when we store tuples in tuplesort.c is that  
we store a series of tuples one by one then either perform a sort or spill  
them to disk.  In the common case, there is no pfreeing of already stored  
tuples.  For the common case since we do not individually pfree tuples, we  
have very little need for aset.c memory allocation behavior which  
maintains freelists and always rounds allocation sizes up to the next  
power of 2 size.  
  
Here we conditionally use generation.c contexts for storing tuples in  
tuplesort.c when the sort will never be bounded.  Unfortunately, the  
memory context to store tuples is already created by the time any calls  
would be made to tuplesort_set_bound(), so here we add a new sort option  
that allows callers to specify if they're going to need a bounded sort or  
not.  We'll use a standard aset.c allocator when this sort option is not  
set.  
  
Extension authors must ensure that the TUPLESORT_ALLOWBOUNDED flag is  
used when calling tuplesort_begin_* for any sorts that make a call to  
tuplesort_set_bound().  
  
Author: David Rowley  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf++8JJ0paw+03dk+W25tQEcNQ@mail.gmail.com  

M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeSort.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Adjust tuplesort API to have bitwise option flags

commit   : 77bae396df3f6f883f58f1877b7c08eb3ebb6b63    
  
author   : David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 22:24:59 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 22:24:59 +1200    

Click here for diff

This replaces the bool flag for randomAccess.  An upcoming patch requires  
adding another option, so instead of breaking the API for that, then  
breaking it again one day if we add more options, let's just break it  
once.  Any boolean options we add in the future will just make use of an  
unused bit in the flags.  
  
Any extensions making use of tuplesorts will need to update their code  
to pass TUPLESORT_RANDOMACCESS instead of true for randomAccess.  
TUPLESORT_NONE can be used for a set of empty options.  
  
Author: David Rowley  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf%2B%2B8JJ0paw%2B03dk%2BW25tQEcNQ%40mail.gmail.com  

M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/catalog/index.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeSort.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Improve the generation memory allocator

commit   : 1b0d9aa4f728edfdff64c3a13fc52bb95f7fb860    
  
author   : David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 20:53:13 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 4 Apr 2022 20:53:13 +1200    

Click here for diff

Here we make a series of improvements to the generation memory  
allocator, namely:  
  
1. Allow generation contexts to have a minimum, initial and maximum block  
sizes. The standard allocator allows this already but when the generation  
context was added, it only allowed fixed-sized blocks.  The problem with  
fixed-sized blocks is that it's difficult to choose how large to make the  
blocks.  If the chosen size is too small then we'd end up with a large  
number of blocks and a large number of malloc calls. If the block size is  
made too large, then memory is wasted.  
  
2. Add support for "keeper" blocks.  This is a special block that is  
allocated along with the context itself but is never freed.  Instead,  
when the last chunk in the keeper block is freed, we simply mark the block  
as empty to allow new allocations to make use of it.  
  
3. Add facility to "recycle" newly empty blocks instead of freeing them  
and having to later malloc an entire new block again.  We do this by  
recording a single GenerationBlock which has become empty of any chunks.  
When we run out of space in the current block, we check to see if there is  
a "freeblock" and use that if it contains enough space for the allocation.  
  
Author: David Rowley, Tomas Vondra  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/gist/gistvacuum.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/mmgr/generation.c
M src/include/utils/memutils.h

Fix tuplesort optimization for CLUSTER-on-expression.

commit   : cc58eecc5d75a9329a6d49a25a6499aea7ee6fd6    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 4 Apr 2022 10:52:02 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 4 Apr 2022 10:52:02 +1200    

Click here for diff

When dispatching sort operations to specialized variants, commit  
69749243 failed to handle the case where CLUSTER-sort decides not to  
initialize datum1 and isnull1.  Fix by hoisting that decision up a level  
and advertising whether datum1 can be relied on, in the Tuplesortstate  
object.  
  
Per reports from UBsan and Valgrind build farm animals, while running  
the cluster.sql test.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAFBsxsF1TeK5Fic0M%2BTSJXzbKsY6aBqJGNj6ptURuB09ZF6k_w%40mail.gmail.com  

M src/backend/utils/sort/tuplesort.c

Fix portability issues in datetime parsing.

commit   : 591e088dd5b357796e136c13dfcdb1f06fd7a3c2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2022 17:04:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Apr 2022 17:04:21 -0400    

Click here for diff

datetime.c's parsing logic has assumed that strtod() will accept  
a string that looks like ".", which it does in glibc, but not on  
some less-common platforms such as AIX.  The result of this was  
that datetime fields like "123." would be accepted on some platforms  
but not others; which is a sufficiently odd case that it's not that  
surprising we've heard no field complaints.  But commit e39f99046  
extended that assumption to new places, and happened to add a test  
case that exposed the platform dependency.  Remove this dependency  
by special-casing situations without any digits after the decimal  
point.  
  
(Again, this is in part a pre-existing bug but I don't feel a  
compulsion to back-patch.)  
  
Also, rearrange e39f99046's changes in formatting.c to avoid a  
Coverity complaint that we were copying an uninitialized field.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Generalize how VACUUM skips all-frozen pages.

commit   : f3c15cbe5065f8c4fb902af8f810a8061a802417    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 3 Apr 2022 13:35:43 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 3 Apr 2022 13:35:43 -0700    

Click here for diff

Non-aggressive VACUUMs were at a gratuitous disadvantage (relative to  
aggressive VACUUMs) around advancing relfrozenxid and relminmxid before  
now.  The issue only came up when concurrent activity unset some heap  
page's visibility map bit right as VACUUM was considering if the page  
should get counted in frozenskipped_pages.  The non-aggressive case  
would recheck the all-frozen bit at this point.  The aggressive case  
reasoned that the page (a skippable page) must have at least been  
all-frozen in the recent past, so skipping it won't make relfrozenxid  
advancement unsafe (which is never okay for aggressive VACUUMs).  
  
The recheck created a window for some other backend to confuse matters  
for VACUUM.  If the page's VM bit turned out to be unset, VACUUM would  
conclude that the page was _never_ all-frozen.  frozenskipped_pages was  
not incremented, and yet VACUUM couldn't back out of skipping at this  
late stage (it couldn't choose to scan the page instead).  This made it  
unsafe to advance relfrozenxid later on.  
  
Consistently avoid the issue by generalizing how we skip frozen pages  
during aggressive VACUUMs: take the same approach when skipping any  
skippable page range during aggressive and non-aggressive VACUUMs alike.  
The new approach makes ranges (not individual pages) the fundamental  
unit of skipping using the visibility map.  frozenskipped_pages is  
replaced with a boolean flag that represents whether some skippable  
range with one or more all-visible pages was actually skipped.  
  
It is safe for VACUUM to treat a page as all-frozen provided it at least  
had its all-frozen bit set after the OldestXmin cutoff was established.  
VACUUM is only required to scan pages that might have XIDs < OldestXmin  
(unfrozen XIDs) to be able to safely advance relfrozenxid.  Tuples  
concurrently inserted on "skipped" pages can be thought of as equivalent  
to tuples concurrently inserted on a block >= rel_pages.  
  
It's possible that the issue this commit fixes hardly ever came up in  
practice.  But we only had to be unlucky once to lose out on advancing  
relfrozenxid -- a single affected heap page was enough to throw VACUUM  
off.  That seems like something to avoid on general principle.  This is  
similar to an issue fixed by commit 44fa8488, which taught vacuumlazy.c  
to not give up on non-aggressive relfrozenxid advancement just because a  
cleanup lock wasn't immediately available on some heap page.  
  
Skipping an all-visible range is now explicitly structured as a choice  
made by non-aggressive VACUUMs, by weighing known costs (scanning extra  
skippable pages to freeze their tuples early) against known benefits  
(advancing relfrozenxid early).  This works in essentially the same way  
as it always has (don't skip ranges < SKIP_PAGES_THRESHOLD).  We could  
do much better here in the future by considering other relevant factors.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzn6bGJGfOy3zSTJicKLw99PHJeSOQBOViKjSCinaxUKDQ@mail.gmail.com  
Discussion: https://postgr.es/m/CA%2BTgmoZiSOY6H7aadw5ZZGm7zYmfDzL6nwmL5V7GL4HgJgLF_w%40mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Set relfrozenxid to oldest extant XID seen by VACUUM.

commit   : 0b018fabaaba77e39539ce7eb71e34a90ceb0825    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 3 Apr 2022 09:57:21 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 3 Apr 2022 09:57:21 -0700    

Click here for diff

When VACUUM set relfrozenxid before now, it set it to whatever value was  
used to determine which tuples to freeze -- the FreezeLimit cutoff.  
This approach was very naive.  The relfrozenxid invariant only requires  
that new relfrozenxid values be <= the oldest extant XID remaining in  
the table (at the point that the VACUUM operation ends), which in  
general might be much more recent than FreezeLimit.  
  
VACUUM now carefully tracks the oldest remaining XID/MultiXactId as it  
goes (the oldest remaining values _after_ lazy_scan_prune processing).  
The final values are set as the table's new relfrozenxid and new  
relminmxid in pg_class at the end of each VACUUM.  The oldest XID might  
come from a tuple's xmin, xmax, or xvac fields.  It might even come from  
one of the table's remaining MultiXacts.  
  
Final relfrozenxid values must still be >= FreezeLimit in an aggressive  
VACUUM (FreezeLimit still acts as a lower bound on the final value that  
aggressive VACUUM can set relfrozenxid to).  Since standard VACUUMs  
still make no guarantees about advancing relfrozenxid, they might as  
well set relfrozenxid to a value from well before FreezeLimit when the  
opportunity presents itself.  In general standard VACUUMs may now set  
relfrozenxid to any value > the original relfrozenxid and <= OldestXmin.  
  
Credit for the general idea of using the oldest extant XID to set  
pg_class.relfrozenxid at the end of VACUUM goes to Andres Freund.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkymFbz6D_vL+jmqSn_5q1wsFvFrE+37yLgL_Rkfd6Gzg@mail.gmail.com  

M doc/src/sgml/maintenance.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/commands/vacuum.h
A src/test/isolation/expected/vacuum-no-cleanup-lock.out
D src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-no-cleanup-lock.spec
D src/test/isolation/specs/vacuum-reltuples.spec

Doc: Add relfrozenxid Tip to XID wraparound section.

commit   : 05023a237c059c840380817abf079a9282a227b7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 13:34:57 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 13:34:57 -0700    

Click here for diff

VACUUM VERBOSE and autovacuum log reports were taught to report the  
details of how VACUUM advanced relfrozenxid (and relminmxid) by commit  
872770fd.  Highlight this by adding a "Tip" to the documentation, next  
to related discussion of age(relfrozenxid) monitoring.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk0C1O-MKkOrj4YAfsGRru2=cA2VQpqM-9R1HNuG3nFaQ@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

Fix overflow hazards in interval input and output conversions.

commit   : e39f9904671082c5ad3a2c5acbdbd028fa93bf35    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2022 16:12:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2022 16:12:26 -0400    

Click here for diff

DecodeInterval (interval input) was careless about integer-overflow  
hazards, allowing bogus results to be obtained for sufficiently  
large input values.  Also, since it initially converted the input  
to a "struct tm", it was impossible to produce the full range of  
representable interval values.  
  
Meanwhile, EncodeInterval (interval output) and a few other  
functions could suffer failures if asked to process sufficiently  
large interval values, because they also relied on being able to  
represent an interval in "struct tm" which is not designed to  
handle that.  
  
Fix all this stuff by introducing new struct types that are more  
fit for purpose.  
  
While this is clearly a bug fix, it's also an API break for any  
code that's calling these functions directly.  So back-patching  
doesn't seem wise, especially in view of the lack of field  
complaints.  
  
Joe Koshakow, editorialized a bit by me  
  
Discussion: https://postgr.es/m/CAAvxfHff0JLYHwyBrtMx_=6wr=k2Xp+D+-X3vEhHjJYMj+mQcg@mail.gmail.com  

M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/datatype/timestamp.h
M src/include/pgtime.h
M src/include/utils/datetime.h
M src/include/utils/timestamp.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Doc: Clarify the role of aggressive VACUUMs.

commit   : f7e4d5c64fb3977e3a773e7213472be1b59dab2f    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 12:29:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 12:29:35 -0700    

Click here for diff

Adjust the documentation's coverage of aggressive VACUUMs to make it  
clearer that aggressive vacuuming isn't always strictly necessary.  It's  
possible for non-aggressive VACUUMs to advance relfrozenxid/relminmxid  
without fail, given the right workload conditions.  
  
While this has always been true, it matters more with recent and pending  
improvements to VACUUM.  These improvements make non-aggressive  
vacuuming more likely to advance relfrozenxid/relminmxid in practice.  
While this is an unrelated improvement to the docs, formally speaking,  
it still doesn't seem worth backpatching.  So don't backpatch.  

M doc/src/sgml/maintenance.sgml

Add a couple more tests for interval input decoding.

commit   : 1b208ebaf14e668a24c78ee42cf805431cd0f591    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2022 13:49:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Apr 2022 13:49:39 -0400    

Click here for diff

Cover some cases that would have been broken by a proposed patch,  
but we failed to notice for lack of test coverage.  I'm pushing  
this separately mainly to memorialize that it *is* our historical  
behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

vacuumlazy.c: Clean up variable declarations.

commit   : 14bf1e831356770cc61a5f43b9b816f0c0583f2b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 10:33:21 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 10:33:21 -0700    

Click here for diff

Move some of the heap_vacuum_rel() instrumentation related variables to  
the scope where they're actually needed.  Also reorder some of the  
variable declarations at the start of heap_vacuum_rel() so that related  
variables appear together.  

M src/backend/access/heap/vacuumlazy.c

Use has_privs_for_roles for predefined role checks: round 2

commit   : 9752436f049430428464e22dcf837e9c6fa4e513    
  
author   : Joe Conway <[email protected]>    
date     : Sat, 2 Apr 2022 13:24:38 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Sat, 2 Apr 2022 13:24:38 -0400    

Click here for diff

Similar to commit 6198420ad, replace is_member_of_role with  
has_privs_for_role for predefined role access checks in recently  
committed basebackup code. In passing fix a double-word error  
in a nearby comment.  
  
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup_server.c

Allow CLUSTER on partitioned tables

commit   : cfdd03f45e6afc632fbe70519250ec19167d6765    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 2 Apr 2022 19:08:34 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 2 Apr 2022 19:08:34 +0200    

Click here for diff

This is essentially the same as applying VACUUM FULL to a partitioned  
table, which has been supported since commit 3c3bb99330aa (March 2017).  
While there's no great use case in applying CLUSTER to partitioned  
tables, we don't have any strong reason not to allow it either.  
  
For now, partitioned indexes cannot be marked clustered, so an index  
must always be specified.  
  
While at it, rename some variables that were RangeVars during the  
development that led to 8bc717cb8878 but never made it that way to the  
source tree; there's no need to perpetuate names that have always been  
more confusing than helpful.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-by: Matthias van de Meent <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/cluster.sgml
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/bin/psql/tab-complete.c
M src/include/commands/cluster.h
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Doc: Remove MultiXact wraparound section link.

commit   : b7c485fb93726cb04b858442d73043b56e603711    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 09:49:08 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 Apr 2022 09:49:08 -0700    

Click here for diff

Remove circular "25.1.5.1. Multixacts And Wraparound" link that  
references the section that the link itself appears in.  An explanation  
of MultiXactId age appears only a few sentences before the link, so  
there's no question that the link is superfluous at best.  
  
Oversight in commit d5409295.  
  
Author: Peter Geoghegan <[email protected]>  
Backpatch: 14-  

M doc/src/sgml/maintenance.sgml

Remove excess semicolon in MERGE docs

commit   : 0af504733c6e9198067705822e7527dc4e60b4f6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 2 Apr 2022 17:16:32 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 2 Apr 2022 17:16:32 +0200    

Click here for diff

Author: Euler Taveira <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/merge.sgml

Use ORDER BY in catalog results in SQL/JSON tests

commit   : c6dc6a0124fa130e1c083a870156c32ab4cf0ae2    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 2 Apr 2022 10:00:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 2 Apr 2022 10:00:10 -0400    

Click here for diff

The buildfarm has revealed some instability in results from catalog  
queries in tests from commit 1a36bc9dba8. Cure this by adding ORDER BY  
to such queries.  

M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/jsonb_sqljson.sql

Specialize tuplesort routines for different kinds of abbreviated keys

commit   : 6974924347c908335607a4a2f252213d58e21b7c    
  
author   : John Naylor <[email protected]>    
date     : Sat, 2 Apr 2022 15:22:25 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sat, 2 Apr 2022 15:22:25 +0700    

Click here for diff

Previously, the specialized tuplesort routine inlined handling for  
reverse-sort and NULLs-ordering but called the datum comparator via a  
pointer in the SortSupport struct parameter. Testing has showed that we  
can get a useful performance gain by specializing datum comparison for  
the different representations of abbreviated keys -- signed and unsigned  
64-bit integers and signed 32-bit integers. Almost all abbreviatable data  
types will benefit -- the only exception for now is numeric, since the  
datum comparison is more complex. The performance gain depends on data  
type and input distribution, but often falls in the range of 10-20% faster.  
  
Thomas Munro  
  
Reviewed by Peter Geoghegan, review and performance testing by me  
  
Discussion:  
https://www.postgresql.org/message-id/CA%2BhUKGKKYttZZk-JMRQSVak%3DCXSJ5fiwtirFf%3Dn%3DPAbumvn1Ww%40mail.gmail.com  

M src/backend/access/gist/gistproc.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

Remove obsolete comment

commit   : db086de5abe5d87b07cddd030092b1f81f99c5ea    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 2 Apr 2022 07:27:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 2 Apr 2022 07:27:26 +0200    

Click here for diff

accidentally left behind by 4cb658af70027c3544fb843d77b2e84028762747  

M src/include/utils/rel.h

Make upgradecheck a no-op in MSVC's vcregress.pl

commit   : d2a2ce4184b0038adb1d6d292f12685056e2ab7a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Apr 2022 12:06:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Apr 2022 12:06:11 +0900    

Click here for diff

322becb has changed upgradecheck to use the TAP tests, discarding  
pg_upgrade's tests in bincheck.  However, this is proving to be a bad  
idea for the Windows buildfarm clients that use MSVC when TAP tests are  
disabled as this causes a hard failure at the pg_upgrade step.  
  
This commit disables upgradecheck, moving the execution of the tests of  
pg_upgrade to bincheck, as per an initial suggestion from Andres  
Freund, so as the buildfarm is able to live happily with those changes.  
  
While on it, remove the routine that was used by upgradecheck to  
create databases whose names are generated with a range of ASCII  
characters as it is not used since 322becb.  upgradecheck is removed  
from the CI script for Windows, as bincheck takes care of that now.  
  
Per report from buildfarm member hamerkop (MSVC 2017 without a TAP  
setup).  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml
M doc/src/sgml/install-windows.sgml
M src/tools/msvc/vcregress.pl

pageinspect: Use better macros to get special page area for GIN and GiST

commit   : d43085d12e825ede628bafee1e5e6e0e3a3d5e67    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Apr 2022 11:27:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Apr 2022 11:27:20 +0900    

Click here for diff

These five code paths are the last ones that made use of  
PageGetSpecialPointer() to get the special area of such pages, while  
those index AMs have already macros to do this job.  
  
Noticed while reviewing the use PageGetSpecialPointer() in the whole  
tree, in relation to the recent commit d16773c.  

M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c

libpq: Fix pkg-config without OpenSSL

commit   : 465ab24296c27502c81c8c197725cba728b9b057    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 17:12:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 17:12:56 +0200    

Click here for diff

Do not add OpenSSL dependencies to libpq pkg-config file if OpenSSL is  
not enabled.  Oversight in beff361bc1edc24ee5f8b2073a1e5e4c92ea66eb.  
  
Author: Fabrice Fontaine <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20220331163759.32665-1-fontaine.fabrice%40gmail.com  

M src/interfaces/libpq/Makefile

Set minimum required version of zstd as 1.4.0.

commit   : 479b69a4a551465614042bba00694001273d702f    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2022 11:05:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Apr 2022 11:05:52 -0400    

Click here for diff

It emerges that our new zstd code depends on features that were not  
present (or at least not enabled by default) in zstd before 1.4.0.  
That's already four years old, so there's little reason to try to  
make our code work with something older.  Instead make configure  
check that zstd is at least 1.4.0, and document this requirement.  
  
Justin Pryzby (doc changes by me)  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/installation.sgml

libpq: Allow IP address SANs in server certificates

commit   : c1932e542863f0f646f005b3492452acc57c7e66    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 15:41:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 15:41:44 +0200    

Click here for diff

The current implementation supports exactly one IP address in a server  
certificate's Common Name, which is brittle (the strings must match  
exactly).  This patch adds support for IPv4 and IPv6 addresses in a  
server's Subject Alternative Names.  
  
Per discussion on-list:  
  
- If the client's expected host is an IP address, we allow fallback to  
  the Subject Common Name if an iPAddress SAN is not present, even if  
  a dNSName is present.  This matches the behavior of NSS, in  
  violation of the relevant RFCs.  
  
- We also, counter-intuitively, match IP addresses embedded in dNSName  
  SANs.  From inspection this appears to have been the behavior since  
  the SAN matching feature was introduced in acd08d76.  
  
- Unlike NSS, we don't map IPv4 to IPv6 addresses, or vice-versa.  
  
Author: Jacob Champion <[email protected]>  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M configure
M configure.ac
M doc/src/sgml/libpq.sgml
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
A src/test/ssl/conf/server-cn-and-ip-alt-names.config
A src/test/ssl/conf/server-ip-alt-names.config
A src/test/ssl/conf/server-ip-cn-and-alt-names.config
A src/test/ssl/conf/server-ip-cn-and-dns-alt-names.config
A src/test/ssl/ssl/server-cn-and-ip-alt-names.crt
A src/test/ssl/ssl/server-cn-and-ip-alt-names.key
A src/test/ssl/ssl/server-ip-alt-names.crt
A src/test/ssl/ssl/server-ip-alt-names.key
A src/test/ssl/ssl/server-ip-cn-and-alt-names.crt
A src/test/ssl/ssl/server-ip-cn-and-alt-names.key
A src/test/ssl/ssl/server-ip-cn-and-dns-alt-names.crt
A src/test/ssl/ssl/server-ip-cn-and-dns-alt-names.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/Solution.pm

docs: Changing column type doesn't always require an index rebuild.

commit   : fa25bebb827a8cc4d62f15d564b0093f40b9d44d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 1 Apr 2022 08:48:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 1 Apr 2022 08:48:44 -0400    

Click here for diff

James Coleman and Robert Haas, reviewed by Matthias van de Meent.  
  
Discussion: https://postgr.es/m/CAAaqYe90Ea3RG=A7H-ONvTcx549-oQhp07BrHErwM=AyH2ximg@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml

Add SSL tests for IP addresses in certificates

commit   : af9e180495507a2b01f1bc31b7ea5125b8385903    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 14:06:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 14:06:23 +0200    

Click here for diff

This tests some scenarios that already work.  A subsequent patch will  
introduce more functionality.  
  
Author: Jacob Champion <[email protected]>  
Co-authored-by: Kyotaro Horiguchi <[email protected]>  
Co-authored-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

A src/test/ssl/conf/server-ip-cn-only.config
A src/test/ssl/conf/server-ip-in-dnsname.config
A src/test/ssl/ssl/server-ip-cn-only.crt
A src/test/ssl/ssl/server-ip-cn-only.key
A src/test/ssl/ssl/server-ip-in-dnsname.crt
A src/test/ssl/ssl/server-ip-in-dnsname.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl

psql: Refactor ProcessResult()

commit   : 5519d5affdfae4f5ea4b5faca65348cc14c5d279    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 13:00:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 1 Apr 2022 13:00:43 +0200    

Click here for diff

Separate HandleCopyResult() from ProcessResult() in preparation for a  
subsequent patch.  
  
Author: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M src/bin/psql/common.c

Add macros in hash and btree AMs to get the special area of their pages

commit   : d16773cdc86210493a2874cb0cf93f3883fcda73    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 13:24:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 13:24:50 +0900    

Click here for diff

This makes the code more consistent with SpGiST, GiST and GIN, that  
already use this style, and the idea is to make easier the introduction  
of more sanity checks for each of these AM-specific macros.  BRIN uses a  
different set of macros to get a page's type and flags, so it has no  
need for something similar.  
  
Author: Matthias van de Meent  
Discussion: https://postgr.es/m/CAEze2WjE3+tGO9Fs9+iZMU+z6mMZKo54W1Zt98WKqbEUHbHOBg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/hash.h
M src/include/access/nbtree.h

Improve handling and logging of TAP tests for pg_upgrade

commit   : 73db8f4d17ed4efb7709f1cafd5b1dd0285b0842    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 12:45:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 12:45:40 +0900    

Click here for diff

This commit includes a set of improvements to help with the debugging of  
failures in these new TAP tests:  
- Instead of a plain diff command to compare the dumps generated, use  
File::Compare::compare for the same effect.  diff is still used to  
provide more context in the event of an error.  
- Log the contents of regression.diffs if the pg_regress command fails.  
- Unify the format of the logs generated, getting inspiration from the  
style used in 027_stream_regress.pl.  
  
wrasse is the only buildfarm member that has reported a failure until  
now after the introduction of 322becb, complaining that the dumps  
generated do not match, and I am lacking information to understand what  
is going in this environment.  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Switch the regression tests of pg_upgrade to use TAP tests

commit   : 322becb6085cb92d3708635eea61b45776bf27b6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 10:13:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Apr 2022 10:13:50 +0900    

Click here for diff

This simplifies a lot of code in the tests of pg_upgrade without  
sacrificing its coverage:  
- Removal of test.sh used for builds with make, that has accumulated  
over the years tweaks for problems that are solved in a duplicated way  
by the centralized TAP framework (initialization of the various  
environment variables PG*, port selection).  
- Removal of the code in MSVC to test pg_upgrade.  This was roughly a  
duplicate of test.sh adapted for Windows, with an extra footprint of  
a pg_regress command and all the assumptions behind it.  
  
Support for upgrades with older versions is changed, not removed.  
test.sh was able to set up the regression database on the old instance  
by launching itself the pg_regress command and a dependency to the  
source tree of thd old cluster, with tweaks on the command arguments to  
adapt across the versions used.  This created a backward-compatibility  
dependency with older pg_regress commands, and recent changes like  
d1029bb have made that much more complicated.  
  
Instead, this commit allows tests with older major versions by  
specifying a path to a SQL dump (taken with pg_dumpall from the old  
cluster's installation) that will be loaded into the old instance to  
upgrade instead of running pg_regress, through an optional environment  
variable called $olddump.  This requires a second variable called  
$oldinstall to point to the base path of the installation of the old  
cluster.  This method is more in line with the buildfarm client that  
uses a set of static dumps to set up an old instance, so hopefully we  
will be able to reuse what is introduced in this commit there.  The last  
step of the tests that checks for differences between the two dumps  
taken still needs to be improved as it can fail, requiring a manual  
lookup at the dumps.  This is not different from the old way of testing  
where things could fail at the last step.  
  
Support for EXTRA_REGRESS_OPTS is kept.  vcregress.pl in the MSVC  
scripts still handles the test of pg_upgrade with its upgradecheck, and  
bincheck is changed to skip pg_upgrade.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan, Andres Freund, Rachel Heaton, Tom Lane,  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/TESTING
A src/bin/pg_upgrade/t/001_basic.pl
A src/bin/pg_upgrade/t/002_pg_upgrade.pl
D src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

Keep plpgsql.h C++-clean.

commit   : fb691bbb4c8d729e6701f708edbb003b73efb16b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 18:29:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 18:29:10 -0400    

Click here for diff

I forgot that "typeid" is a C++ keyword.  Per buildfarm.  

M src/pl/plpgsql/src/plpgsql.h

Expose a few more PL/pgSQL functions to debugger plugins.

commit   : 53ef6c40f1e7ff6c9ad9a221cd9999dd147ec3a2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 17:05:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 17:05:47 -0400    

Click here for diff

Add exec_assign_value, exec_eval_datum, and exec_cast_value  
to the set of functions a PL/pgSQL debugger plugin can  
conveniently call.  This allows more convenient manipulation  
of the values of PL/pgSQL function variables.  
  
Pavel Stehule, reviewed by Aleksander Alekseev and myself  
  
Discussion: https://postgr.es/m/CAFj8pRD+dBPU0T-KrkP7ef6QNPDEsjYCejEsBe07NDq8TybOkA@mail.gmail.com  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Fix comments with "a expression"

commit   : 9f91344223aad903ff70301f40183691a89f6cd4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 15:27:09 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 15:27:09 -0400    

Click here for diff

M src/backend/optimizer/path/equivclass.c
M src/backend/parser/parse_expr.c

RETURNING clause for JSON() and JSON_SCALAR()

commit   : 49082c2cc3d8167cca70cfe697afb064710828ca    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 5 Mar 2022 08:07:15 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 5 Mar 2022 08:07:15 -0500    

Click here for diff

This patch is extracted from a larger patch that allowed setting the  
default returned value from these functions to json or jsonb. That had  
problems, but this piece of it is fine. For these functions only json or  
jsonb can be specified in the RETURNING clause.  
  
Extracted from an original patch from Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

initdb: When running CREATE DATABASE, use STRATEGY = WAL_COPY.

commit   : ad43a413c4f7f5d024a5b2f51e00d280a22f1874    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 31 Mar 2022 15:15:11 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 31 Mar 2022 15:15:11 -0400    

Click here for diff

Dilip Kumar, reviewed by Andres Freund and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c

Fix postgres_fdw to check shippability of sort clauses properly.

commit   : f3dd9fe1dd9254680591aa8d9891b90b8d735b2a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 14:29:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 14:29:24 -0400    

Click here for diff

postgres_fdw would push ORDER BY clauses to the remote side without  
verifying that the sort operator is safe to ship.  Moreover, it failed  
to print a suitable USING clause if the sort operator isn't default  
for the sort expression's type.  The net result of this is that the  
remote sort might not have anywhere near the semantics we expect,  
which'd be disastrous for locally-performed merge joins in particular.  
  
We addressed similar issues in the context of ORDER BY within an  
aggregate function call in commit 7012b132d, but failed to notice  
that query-level ORDER BY was broken.  Thus, much of the necessary  
logic already existed, but it requires refactoring to be usable  
in both cases.  
  
Back-patch to all supported branches.  In HEAD only, remove the  
core code's copy of find_em_expr_for_rel, which is no longer used  
and really should never have been pushed into equivclass.c in the  
first place.  
  
Ronan Dunklau, per report from David Rowley;  
reviews by David Rowley, Ranier Vilela, and myself  
  
Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/equivclass.c
M src/include/optimizer/paths.h

Print information about type of test and subdirectory before running tests.

commit   : 28bdfa2adfc6afe4121614b500bfcb27b7c6b94c    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 31 Mar 2022 11:18:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 31 Mar 2022 11:18:25 -0700    

Click here for diff

When testing check-world it's hard to know what the test the test failure  
output belongs to. The tap test output is especially problematic, partially  
due to our practice of reusing test names like 001_basic.pl.  
  
This isn't a real issue on the buildfarm, which invokes tests separately, but  
locally and for CI it's quite annoying.  
  
To fix, the test target provisos in Makefile.global.in now output  
  echo "+++ (regress|isolation|tap) [install-]check in $(subdir) +++"  
before running the tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in

Remove use of perl parent module in Cluster.pm

commit   : d5f43a1a10f688e2437ffb7d454d0a2d57308bff    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 14:10:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 14:10:47 -0400    

Click here for diff

Commit fb16d2c658 used the old but not quite old enough parent module,  
which dates to perl version 5.10.1 as a core module. We still have a  
dinosaur or two running older versions of perl, so rather than require  
an upgrade in those we simply do in place what parent.pm's import()  
would have done for us.  
  
Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

In basebackup_to_shell tests, properly set up pg_hba.conf.

commit   : fea1cc49e4abca7eeb9bb9dd02d7d78abbd8d045    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 31 Mar 2022 14:06:17 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 31 Mar 2022 14:06:17 -0400    

Click here for diff

Discussion: http://postgr.es/m/[email protected]  

M contrib/basebackup_to_shell/t/001_basic.pl

psql: Refactor SendQuery()

commit   : 8910a25fef3dc4aa7e10cfcebdc784650a4d256b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Mar 2022 19:57:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Mar 2022 19:57:21 +0200    

Click here for diff

This breaks out the fetch-it-all-and-print case in SendQuery() into a  
separate function.  This makes the code more similar to the other  
cases \gdesc and run query with FETCH_COUNT, and makes SendQuery()  
itself a bit smaller.  
  
Extracted from a larger patch with more changes in this area to  
follow.  
  
Author: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M src/bin/psql/common.c

Add missing newline in one libpq error message.

commit   : 878e64d0f8f6865943046ce88e597a5657e304c2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 11:24:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 31 Mar 2022 11:24:26 -0400    

Click here for diff

Oversight in commit a59c79564.  Back-patch, as that was.  
Noted by Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-secure-openssl.c

psql: Add tests for \errverbose

commit   : d3ab618290543017402b3bec9d36dde881becb18    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 31 Mar 2022 16:09:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 31 Mar 2022 16:09:44 +0200    

Click here for diff

This is another piece of functionality that happens while a user query  
is being sent and which did not have any test coverage.  

M src/bin/psql/t/001_basic.pl

Fix comment typo in PotsgreSQL::Test::Cluster module

commit   : ddee016b342cddcfb97325afac0a65c502932e5f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 08:34:39 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 31 Mar 2022 08:34:39 -0400    

Click here for diff

Per Dagfinn Ilmari Mannsåker  

M src/test/perl/PostgreSQL/Test/Cluster.pm

doc: Fix typo in ANALYZE documentation

commit   : 4e31c46e1e7b7d3a34909ec872c4446711e86e7d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 31 Mar 2022 12:03:33 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 31 Mar 2022 12:03:33 +0200    

Click here for diff

Commit 61fa6ca79b3 accidentally wrote constrast instead of contrast.  
  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/analyze.sgml

Add diagnostic output on error in pump_until

commit   : 2beb4acff1e83fef6766a5a7d5bbd952444a0b36    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 31 Mar 2022 11:16:16 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 31 Mar 2022 11:16:16 +0200    

Click here for diff

When pump_until was moved to Utils.pm in commit 6da65a3f9 the diag  
calls were removed, this puts them back.  
  
Per request from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Utils.pm

Raise a WARNING for missing publications.

commit   : 8f2e2bbf145384784bad07a96d461c6bbd91f597    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 31 Mar 2022 08:24:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 31 Mar 2022 08:24:19 +0530    

Click here for diff

When we create or alter a subscription to add publications raise a warning  
for non-existent publications. We don't want to give an error here because  
it is possible that users can later create the missing publications.  
  
Author: Vignesh C  
Reviewed-by: Bharath Rupireddy, Japin Li, Dilip Kumar, Euler Taveira, Ashutosh Sharma, Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm0f4YujGW+q-Di0CbZpnQKFFrXntikaQQKuEmGG0=Zw=Q@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/007_ddl.pl

Clean up some dead code in pg_dump with tar format and gzip compression

commit   : 8ac4c25a05d1e491a51d5390aaae405600e8e466    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 31 Mar 2022 10:34:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 31 Mar 2022 10:34:10 +0900    

Click here for diff

Compression with gzip has never been supported in the tar format of  
pg_dump since this code has been introduced in c3e18804, as the use of  
buffered I/O in gzdopen() changes the file positioning that tar  
requires.  The original idea behind the use of compression with the tar  
mode is to be able to include compressed data files (named %u.dat.gz)  
and blob files (blob_%u.dat.gz) in the tarball generated by the dump,  
with toc.dat, that tracks down if compression is used in the dump,  
always uncompressed.  
  
Note that this commit removes the dump part of the code as well as the  
restore part, removing any dependency to zlib in pg_backup_tar.c.  There  
could be an argument behind keeping around the restore part, but this  
would require one to change the internals of a tarball previously dumped  
so as data and blob files are compressed with toc.dat itself changed to  
track down if compression is enabled.  However, the argument about  
gzdopen() still holds in the read case with pg_restore.  
  
Removing this code simplifies future additions related to compression in  
pg_dump.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

M src/bin/pg_dump/pg_backup_tar.c

Add .gitignore for basebackup_to_shell.

commit   : f8e0d900afed933d8f5d3f189fdb141924a8e518    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2022 19:59:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Mar 2022 19:59:33 -0400    

Click here for diff

Nathan Bossart  
  
Discussion: https://postgr.es/m/20220330223531.GA134543@nathanxps13  

A contrib/basebackup_to_shell/.gitignore

Optimize order of GROUP BY keys

commit   : db0d67db2401eb6238ccc04c6407a4fd4f985832    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 31 Mar 2022 00:09:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 31 Mar 2022 00:09:11 +0200    

Click here for diff

When evaluating a query with a multi-column GROUP BY clause using sort,  
the cost may be heavily dependent on the order in which the keys are  
compared when building the groups. Grouping does not imply any ordering,  
so we're allowed to compare the keys in arbitrary order, and a Hash Agg  
leverages this. But for Group Agg, we simply compared keys in the order  
as specified in the query. This commit explores alternative ordering of  
the keys, trying to find a cheaper one.  
  
In principle, we might generate grouping paths for all permutations of  
the keys, and leave the rest to the optimizer. But that might get very  
expensive, so we try to pick only a couple interesting orderings based  
on both local and global information.  
  
When planning the grouping path, we explore statistics (number of  
distinct values, cost of the comparison function) for the keys and  
reorder them to minimize comparison costs. Intuitively, it may be better  
to perform more expensive comparisons (for complex data types etc.)  
last, because maybe the cheaper comparisons will be enough. Similarly,  
the higher the cardinality of a key, the lower the probability we’ll  
need to compare more keys. The patch generates and costs various  
orderings, picking the cheapest ones.  
  
The ordering of group keys may interact with other parts of the query,  
some of which may not be known while planning the grouping. E.g. there  
may be an explicit ORDER BY clause, or some other ordering-dependent  
operation, higher up in the query, and using the same ordering may allow  
using either incremental sort or even eliminate the sort entirely.  
  
The patch generates orderings and picks those minimizing the comparison  
cost (for various pathkeys), and then adds orderings that might be  
useful for operations higher up in the plan (ORDER BY, etc.). Finally,  
it always keeps the ordering specified in the query, on the assumption  
the user might have additional insights.  
  
This introduces a new GUC enable_group_by_reordering, so that the  
optimization may be disabled if needed.  
  
The original patch was proposed by Teodor Sigaev, and later improved and  
reworked by Dmitry Dolgov. Reviews by a number of people, including me,  
Andrey Lepikhov, Claudio Freire, Ibrar Ahmed and Zhihong Yu.  
  
Author: Dmitry Dolgov, Teodor Sigaev, Tomas Vondra  
Reviewed-by: Tomas Vondra, Andrey Lepikhov, Claudio Freire, Ibrar Ahmed, Zhihong Yu  
Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru  
Discussion: https://postgr.es/m/CA%2Bq6zcW_4o2NC0zutLkOJPsFt80megSpX_dVRo6GK9PC-Jx_Ag%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/expected/union.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/incremental_sort.sql

SQL JSON functions

commit   : 606948b058dc16bce494270eea577011a602810e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:15:13 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:15:13 -0500    

Click here for diff

This Patch introduces three SQL standard JSON functions:  
  
JSON() (incorrectly mentioned in my commit message for f4fb45d15c)  
JSON_SCALAR()  
JSON_SERIALIZE()  
  
JSON() produces json values from text, bytea, json or jsonb values, and  
has facilitites for handling duplicate keys.  
JSON_SCALAR() produces a json value from any scalar sql value, including  
json and jsonb.  
JSON_SERIALIZE() produces text or bytea from input which containis or  
represents json or jsonb;  
  
For the most part these functions don't add any significant new  
capabilities, but they will be of use to users wanting standard  
compliant JSON handling.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/keywords/sql2016-02-reserved.txt
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix possible NULL-pointer-deference in backup_compression.c.

commit   : 8e053dc6dfbee4ae412e98ad73cfd4662d7453ac    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 15:53:08 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 15:53:08 -0400    

Click here for diff

Per Coverity and Tom Lane. Reviewed by Tom Lane and Justin Pryzby.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/common/backup_compression.c

basebackup_to_shell: Add TAP test.

commit   : 027fa0fd72619a56d9d8877eedcb514331b63fa4    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 15:47:02 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 15:47:02 -0400    

Click here for diff

Per gripe from Andres Freund. Thanks to Andres Freund, Thomas  
Munro, and Andrew Dunstan for advice on how to make this test  
work even on Windows.  
  
Discussion: https://postgr.es/m/CA+Tgmoat+zbzzZQJ7poXyUwiqxQxTaUid=auB4FejZ15VvDh4Q@mail.gmail.com  

M contrib/basebackup_to_shell/Makefile
A contrib/basebackup_to_shell/t/001_basic.pl

Document basebackup_to_shell.required_role.

commit   : 26a0c025e233c3d4333f071bde4ac970ba1ec643    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 10:06:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 10:06:07 -0400    

Click here for diff

Omission noted by Joe Conway.  
  
Discussion: https://postgr.es/m/CA+Tgmoat+zbzzZQJ7poXyUwiqxQxTaUid=auB4FejZ15VvDh4Q@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/basebackup-to-shell.sgml

Add range_agg with multirange inputs

commit   : 7ae1619bc5b1794938c7387a766b8cae34e38d8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 20:12:53 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 20:12:53 +0200    

Click here for diff

range_agg for normal ranges already existed.  A lot of code can be  
shared.  
  
Author: Paul Jungwirth <[email protected]>  
Reviewed-by: Chapman Flack <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/multirangetypes.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/multirangetypes.sql

ci: enable zstd where available.

commit   : ff50baec65bba1a839322ba8bcb3efcd08f40621    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 30 Mar 2022 09:33:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 30 Mar 2022 09:33:28 -0700    

Click here for diff

Since zstd is now used in a bunch of places, enable it in CI. The windows  
image unfortunately doesn't yet contain zstd, so it's not enabled there.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Change some internal error messages to elogs

commit   : f453d684ecf9f6cd872d4bb43fe385c2c56126bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:48:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:48:56 +0200    

Click here for diff

Author: Paul Jungwirth <[email protected]>  
Reviewed-by: Chapman Flack <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c

Make PostgreSQL::Test::Cluster compatible with all live branches

commit   : fb16d2c6588446b00534d90958e6dc312ae52a2f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 30 Mar 2022 11:07:05 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 30 Mar 2022 11:07:05 -0400    

Click here for diff

We do this via a subclass for any branch older than the minimum known  
to be compatible with the main package (currently release 12).  
  
This should be useful for constructing cross-version tests.  
  
In theory this could be extended back any number of versions, with  
varying degrees of compatibility.  
  
Reviewed by Michael Paquier and Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Additional tests for range_intersect_agg(anymultirange)

commit   : cd7ea75e4b1b0c44476bef4f00075b9a4b07733e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:23:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:23:13 +0200    

Click here for diff

Author: Paul Jungwirth <[email protected]>  
Reviewed-by: Chapman Flack <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

doc: Document range_intersect_agg(anymultirange)

commit   : b21c4cf95103fae63aeb534f8ee37fbf90a1f907    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:08:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 17:08:24 +0200    

Click here for diff

It already existed but was not mentioned in the documentation.  (Only  
the anyrange variant was listed.)  
  
Author: Paul Jungwirth <[email protected]>  
Reviewed-by: Chapman Flack <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/func.sgml

Allow parallel zstd compression when taking a base backup.

commit   : 51c0d186d99a18e6aae53003f5138f20991e15a6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 09:35:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 09:35:14 -0400    

Click here for diff

libzstd allows transparent parallel compression just by setting  
an option when creating the compression context, so permit that  
for both client and server-side backup compression. To use this,  
use something like pg_basebackup --compress WHERE-zstd:workers=N  
where WHERE is "client" or "server" and N is an integer.  
  
When compression is performed on the server side, this will spawn  
threads inside the PostgreSQL backend. While there is almost no  
PostgreSQL server code which is thread-safe, the threads here are used  
internally by libzstd and touch only data structures controlled by  
libzstd.  
  
Patch by me, based in part on earlier work by Dipesh Pandit  
and Jeevan Ladhe. Reviewed by Justin Pryzby.  
  
Discussion: http://postgr.es/m/CA+Tgmobj6u-nWF-j=FemygUhobhryLxf9h-wJN7W-2rSsseHNA@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/common/backup_compression.c
M src/include/common/backup_compression.h

Simplify a needlessly-complicated regular expression.

commit   : c6863b85829149e2241faafa161b6c5af1f06cb9    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 09:02:44 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 30 Mar 2022 09:02:44 -0400    

Click here for diff

Dilip Kumar  
  
Discussion: https://postgr.es/m/CAFiTN-uV_u1LgBN_CAiGyfgPXp+bfBUVqG5mZ24Nqc8e_Yb0HQ@mail.gmail.com  

M src/bin/scripts/t/020_createdb.pl

doc: Clarify when SSL actually means TLS

commit   : 860ea46ba7be69c46c37a96983e1ddca9d630c2e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 30 Mar 2022 13:07:30 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 30 Mar 2022 13:07:30 +0200    

Click here for diff

SSL has become the de facto term to mean an end-to-end encrypted channel  
regardless of protocol used, even though the SSL protocol is deprecated.  
Clarify what we mean with SSL in our documentation, especially for new  
users who might be looking for TLS.  
  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml

Fix typo in comment.

commit   : f505bec711f602c6bd08a88e8ad894b611e7e8a1    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 30 Mar 2022 19:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 30 Mar 2022 19:00:00 +0900    

Click here for diff

M src/backend/commands/copyfrom.c

Add header matching mode to COPY FROM

commit   : 072132f04e55c1c3b0f1a582318da78de7334379    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 08:56:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Mar 2022 08:56:58 +0200    

Click here for diff

COPY FROM supports the HEADER option to silently discard the header  
line from a CSV or text file.  It is possible to load by mistake a  
file that matches the expected format, for example, if two text  
columns have been swapped, resulting in garbage in the database.  
  
This adds a new option value HEADER MATCH that checks the column names  
in the header line against the actual column names and errors out if  
they do not match.  
  
Author: Rémi Lapeyre <[email protected]>  
Reviewed-by: Daniel Verite <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAF1-J-0PtCWMeLtswwGV2M70U26n4g33gpe1rcKQqe6wVQDrFA@mail.gmail.com  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copy.h
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

Add TAP test in pg_dump with --format=tar and --compress

commit   : edcedcc2c7bb8390858bbccda9637318598f2473    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Mar 2022 13:34:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Mar 2022 13:34:01 +0900    

Click here for diff

This combination of options has never been supported, and it has never  
been checked in the regression tests.  When building the code without  
zlib support, pg_dump is allowed to run and it generates a warning to  
inform that any contents are dumped as uncompressed.  The tests added by  
this commit check both behaviors.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

M src/bin/pg_dump/t/001_basic.pl

Skip empty transactions for logical replication.

commit   : d5a9d86d8ffcadc52ff3729cd00fbd83bc38643c    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Mar 2022 07:41:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Mar 2022 07:41:05 +0530    

Click here for diff

The current logical replication behavior is to send every transaction to  
subscriber even if the transaction is empty. This can happen because  
transaction doesn't contain changes from the selected publications or all  
the changes got filtered. It is a waste of CPU cycles and network  
bandwidth to build/transmit these empty transactions.  
  
This patch addresses the above problem by postponing the BEGIN message  
until the first change is sent. While processing a COMMIT message, if  
there was no other change for that transaction, do not send the COMMIT  
message. This allows us to skip sending BEGIN/COMMIT messages for empty  
transactions.  
  
When skipping empty transactions in synchronous replication mode, we send  
a keepalive message to avoid delaying such transactions.  
  
Author: Ajin Cherian, Hou Zhijie, Euler Taveira  
Reviewed-by: Peter Smith, Takamichi Osumi, Shi Yu, Masahiko Sawada, Greg Nancarrow, Vignesh C, Amit Kapila  
Discussion: https://postgr.es/m/CAMkU=1yohp9-dv48FLoSPrMqYEyyS5ZWkaZGD41RJr10xiNo_Q@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/include/replication/logical.h
M src/include/replication/output_plugin.h
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/020_messages.pl
M src/tools/pgindent/typedefs.list

Make PostgreSQL::Test::Cluster::run_log() return a useful value.

commit   : ad4f2c47de440cdd5d58cf9ffea09afa0da04d6c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 16:29:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 16:29:49 -0400    

Click here for diff

Curently, some TAP test that directly call the underlying function  
PostgreSQL::Test::Utils::run_log() care about the return value, but  
none of those that call it via PostgreSQL::Test::Cluster::run_log() care.  
However, I'd like to add a test that will care, so adjust this function  
to return whatever it gets back from the underlying function, just as  
we do for a number of other functions in this module.  
  
Discussion: http://postgr.es/m/CA+Tgmobj6u-nWF-j=FemygUhobhryLxf9h-wJN7W-2rSsseHNA@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm

SQL/JSON query functions

commit   : 1a36bc9dba8eae90963a586d37b6457b32b2fed4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:11:14 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:11:14 -0500    

Click here for diff

This introduces the SQL/JSON functions for querying JSON data using  
jsonpath expressions. The functions are:  
  
JSON_EXISTS()  
JSON_QUERY()  
JSON_VALUE()  
  
All of these functions only operate on jsonb. The workaround for now is  
to cast the argument to jsonb.  
  
JSON_EXISTS() tests if the jsonpath expression applied to the jsonb  
value yields any values. JSON_VALUE() must return a single value, and an  
error occurs if it tries to return multiple values. JSON_QUERY() must  
return a json object or array, and there are various WRAPPER options for  
handling scalar or multi-value results. Both these functions have  
options for handling EMPTY and ERROR conditions.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/formatting.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
A src/test/regress/expected/json_sqljson.out
A src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/json_sqljson.sql
A src/test/regress/sql/jsonb_sqljson.sql

In 020_createdb.pl, change order of command-line arguments.

commit   : 3d067c53b26dfeb95da0d75a65614b4d7b45c317    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 13:48:39 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 13:48:39 -0400    

Click here for diff

Linux thinks that something like "createdb foo -S bar" is perfectly  
fine, but Windows wants the options to precede any bare arguments, so  
we must write "createdb -S bar foo" for portability.  
  
Per reports from CI, the buildfarm, and Andres.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/scripts/t/020_createdb.pl

Add new block-by-block strategy for CREATE DATABASE.

commit   : 9c08aea6a3090a396be334cc58c511edab05776a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 11:31:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 11:31:43 -0400    

Click here for diff

Because this strategy logs changes on a block-by-block basis, it  
avoids the need to checkpoint before and after the operation.  
However, because it logs each changed block individually, it might  
generate a lot of extra write-ahead logging if the template database  
is large. Therefore, the older strategy remains available via a new  
STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy  
option to createdb.  
  
Somewhat controversially, this patch assembles the list of relations  
to be copied to the new database by reading the pg_class relation of  
the template database. Cross-database access like this isn't normally  
possible, but it can be made to work here because there can't be any  
connections to the database being copied, nor can it contain any  
in-doubt transactions. Even so, we have to use lower-level interfaces  
than normal, since the table scan and relcache interfaces will not  
work for a database to which we're not connected. The advantage of  
this approach is that we do not need to rely on the filesystem to  
determine what ought to be copied, but instead on PostgreSQL's own  
knowledge of the database structure. This avoids, for example,  
copying stray files that happen to be located in the source database  
directory.  
  
Dilip Kumar, with a fairly large number of cosmetic changes by me.  
Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor,  
Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian,  
Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro  
Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.  
  
Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com  

M contrib/bloom/blinsert.c
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/heap.c
M src/backend/catalog/storage.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablecmds.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl
M src/include/catalog/storage.h
M src/include/commands/dbcommands_xlog.h
M src/include/storage/bufmgr.h
M src/include/storage/lmgr.h
M src/include/utils/relmapper.h
M src/include/utils/wait_event.h
M src/tools/pgindent/typedefs.list

Revert "Fix replay of create database records on standby"

commit   : bf902c13930c268388644100663f2998868b6e85    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Mar 2022 15:36:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Mar 2022 15:36:21 +0200    

Click here for diff

This reverts commit 49d9cfc68bf4.  The approach taken by this patch has  
problems, so we'll come up with a radically different fix.  
  
Discussion: https://postgr.es/m/CA+TgmoYcUPL+WOJL2ZzhH=zmrhj0iOQ=iCFM0SuYqBbqZEamEg@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/include/access/xlogutils.h
D src/test/recovery/t/029_replay_tsp_drops.pl
M src/tools/pgindent/typedefs.list

Explain why the startup process can't cause a shortage of sinval slots.

commit   : edea649afbcedd431802a5255cd153538e43ee1d    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 09:24:24 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 29 Mar 2022 09:24:24 -0400    

Click here for diff

Bharath Rupireddy, reviewed by Fujii Masao and Yura Sokolov.  
Lightly edited by me.  
  
Discussion: http://postgr.es/m/CALj2ACU=3_frMkDp9UUeuZoAMjaK1y0Z_q5RFNbGvwi8NM==AA@mail.gmail.com  

M src/backend/storage/ipc/sinvaladt.c

doc: Make UPDATE FROM examples consistent

commit   : 3785d8e98b741749d09f1cfe119ec04961ed07b2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Mar 2022 14:53:20 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Mar 2022 14:53:20 +0200    

Click here for diff

The original first half of the example used an employees table and an  
accounts.sales_person foreign key column, while the second half (added  
in commit 8f889b1083f) used a salesmen table and accounts.sales_id  
for the foreign key.  This makes everything use the original names.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/update.sgml

Enable SSL library detection via PQsslAttribute()

commit   : ebc8b7d4416d8e0dfb7c05132ef6182fd3daf885    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Mar 2022 14:02:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 29 Mar 2022 14:02:45 +0200    

Click here for diff

Currently, libpq client code must have a connection handle  
before it can query the "library" SSL attribute.  This poses  
problems if the client needs to know what SSL library is in  
use before constructing a connection string.  
  
Allow PQsslAttribute(NULL, "library") to return the library  
in use -- currently, just "OpenSSL" or NULL. The new behavior  
is announced with the LIBPQ_HAS_SSL_LIBRARY_DETECTION feature  
macro, allowing clients to differentiate between a libpq that  
was compiled without SSL support and a libpq that's just too  
old to tell.  
  
Author: Jacob Champion <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
A src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile
A src/interfaces/libpq/test/testclient.c

psql: Add test for psql behavior on server crash

commit   : 8cd7627c7b19c5a1bb235e7ad91b53856b101e65    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Mar 2022 08:58:54 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Mar 2022 08:58:54 +0200    

Click here for diff

Author: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M src/bin/psql/t/001_basic.pl

Avoid instabilities with the regression tests of pg_freespacemap

commit   : c14a9eeec4797358922f8696d76716501b86c57d    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 13:52:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 13:52:49 +0900    

Click here for diff

It was possible to run those tests with installcheck, but they are  
actually unstable as concurrent autovacuum jobs could prevent the  
truncation of the filespace map to happen (aka the scan of pg_database  
when building the list of relations to clean), an assumption we rely on  
when checking that the FSM of the relation gets truncated during a  
manual vacuum after deleting all the relation's data.  
  
This commit adds a NO_INSTALLCHECK to disallow installcheck, and  
introduces the use of a custom configuration file with autovacuum  
disabled.  
  
It happens that we already do that in the recovery test  
008_fsm_truncation, for example.  
  
Reported-by: Tom Lane, via buildfarm member skink  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_freespacemap/Makefile
A contrib/pg_freespacemap/pg_freespacemap.conf

Add system view pg_ident_file_mappings

commit   : a2c84990bea7beadb599d02328190e2a763dcb86    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 10:15:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 10:15:48 +0900    

Click here for diff

This view is similar to pg_hba_file_rules view, except that it is  
associated with the parsing of pg_ident.conf.  Similarly to its cousin,  
this view is useful to check via SQL if changes planned in pg_ident.conf  
would work upon reload or restart, or to diagnose a previous failure.  
  
Bumps catalog version.  
  
Author: Julien Rouhaud  
Reviewed-by: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/hba.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Modify query on pg_hba_file_rules to check for errors in regression tests

commit   : 091a971bb59ca9751f32a4aa5aee969c5a915754    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 09:06:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Mar 2022 09:06:51 +0900    

Click here for diff

The regression tests include a query to check the execution path of  
pg_hba_file_rules, but it has never checked that a given cluster has  
correct contents in pg_hba.conf.  This commit extends the query of  
pg_hba_file_rules to report any errors if anything bad is found.  For  
EXEC_BACKEND builds, any connection attempt would fail when loading  
pg_hba.conf if any incorrect content is found when parsed, so a failure  
would be detected before even running this query.  However, this can  
become handy for clusters where pg_hba.conf can be reloaded, where new  
connection attempts are not subject to a fresh loading of pg_hba.conf.  
  
Author: Julien Rouhaud, based on an idea from me  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

IS JSON predicate

commit   : 33a377608fc29cdd1f6b63be561eab0aee5c81f0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:02:53 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:02:53 -0500    

Click here for diff

This patch intrdocuces the SQL standard IS JSON predicate. It operates  
on text and bytea values representing JSON as well as on the json and  
jsonb types. Each test has an IS and IS NOT variant. The tests are:  
  
IS JSON [VALUE]  
IS JSON ARRAY  
IS JSON OBJECT  
IS JSON SCALAR  
IS JSON  WITH | WITHOUT UNIQUE KEYS  
  
These are mostly self-explanatory, but note that IS JSON WITHOUT UNIQUE  
KEYS is true whenever IS JSON is true, and IS JSON WITH UNIQUE KEYS is  
true whenever IS JSON is true except it IS JSON OBJECT is true and there  
are duplicate keys (which is never the case when applied to jsonb values).  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonfuncs.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Use has_privs_for_roles for predefined role checks

commit   : 6198420ad8a72e37f4fe4964616b17e0fd33b808    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 28 Mar 2022 15:10:04 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 28 Mar 2022 15:10:04 -0400    

Click here for diff

Generally if a role is granted membership to another role with NOINHERIT  
they must use SET ROLE to access the privileges of that role, however  
with predefined roles the membership and privilege is conflated. Fix that  
by replacing is_member_of_role with has_privs_for_role for predefined  
roles. Patch does not remove is_member_of_role from acl.h, but it does  
add a warning not to use that function for privilege checking. Not  
backpatched based on hackers list discussion.  
  
Author: Joshua Brindle  
Reviewed-by: Stephen Frost, Nathan Bossart, Joe Conway  
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com  

M contrib/adminpack/adminpack.c
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgrowlocks/pgrowlocks.c
M doc/src/sgml/adminpack.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgvisibility.sgml
M src/backend/commands/copy.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/test/modules/unsafe_tests/expected/rolenames.out

Remove the ability of a role to administer itself.

commit   : 79de9842ab03259325ee4055fb0a7ebd2e4372ff    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2022 13:38:13 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2022 13:38:13 -0400    

Click here for diff

Commit f9fd1764615ed5d85fab703b0ffb0c323fe7dfd5 effectively gave  
every role ADMIN OPTION on itself. However, this appears to be  
something that happened accidentally as a result of refactoring  
work rather than an intentional decision. Almost a decade later,  
it was discovered that this was a security vulnerability. As a  
result, commit fea164a72a7bfd50d77ba5fb418d357f8f2bb7d0 restricted  
this implicit ADMIN OPTION privilege to be exercisable only when  
the role being administered is the same as the session user and  
when no security-restricted operation is in progress. That  
commit also documented the existence of this implicit privilege  
for what seems to be the first time.  
  
The effect of the privilege is to allow a login role to grant  
the privileges of that role, and optionally ADMIN OPTION on it,  
to some other role. That's an unusual thing to do, because generally  
membership is granted in roles used as groups, rather than roles  
used as users. Therefore, it does not seem likely that removing  
the privilege will break things for many PostgreSQL users.  
  
However, it will make it easier to reason about the permissions  
system. This is the only case where a user who has not been given any  
special permission (superuser, or ADMIN OPTION on some role) can  
modify role membership, so removing it makes things more consistent.  
For example, if a superuser sets up role A and B and grants A to B  
but no other privileges to anyone, she can now be sure that no one  
else will be able to revoke that grant. Without this change, that  
would have been true only if A was a non-login role.  
  
Patch by me. Reviewed by Tom Lane and Stephen Frost.  
  
Discussion: http://postgr.es/m/CA+Tgmoawdt03kbA+dNyBcNWJpRxu0f4X=69Y3+DkXXZqmwMDLg@mail.gmail.com  

M doc/src/sgml/ref/grant.sgml
M src/backend/commands/user.c
M src/backend/utils/adt/acl.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix a few goofs in new backup compression code.

commit   : 61762426e6edbe87100dd5a4f107e8c06a11ec02    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2022 12:19:05 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 28 Mar 2022 12:19:05 -0400    

Click here for diff

When we try to set the zstd compression level either on the client  
or on the server, check for errors.  
  
For any algorithm, on the client side, don't try to set the compression  
level unless the user specified one. This was visibly broken for  
zstd, which managed to set -1 rather than 0 in this case, but tidy  
up the code for the other methods, too.  
  
On the client side, if we fail to create a ZSTD_CCtx, exit after  
reporting the error. Otherwise we'll dereference a null pointer.  
  
Patch by me, reviewed by Dipesh Pandit.  
  
Discussion: http://postgr.es/m/CA+TgmoZK3zLQUCGi1h4XZw4jHiAWtcACc+GsdJR1_Mc19jUjXA@mail.gmail.com  

M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c

Add public ruleutils.c entry point to deparse a Query.

commit   : d22646922d66012705e0e2948cfb5b4a07092a29    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2022 11:19:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Mar 2022 11:19:29 -0400    

Click here for diff

This has no in-core callers but will be wanted by extensions.  
It's just a thin wrapper around get_query_def, so it adds little code.  
  
Also, fix get_from_clause_item() to force insertion of an alias  
for a SUBQUERY RTE item.  This is irrelevant to existing uses because  
RTE_SUBQUERY items made by the parser always have aliases already.  
However, if one tried to use pg_get_querydef() to inspect a post-rewrite  
Query, it could be an issue.  In any case, get_from_clause_item already  
contained logic to force alias insertion for VALUES items, so the lack  
of the same for SUBQUERY is a pretty clear oversight.  
  
In passing, replace duplicated code for selection of pretty-print  
options with a common macro.  
  
Julien Rouhaud, reviewed by Pavel Stehule, Gilles Darold, and myself  
  
Discussion: https://postgr.es/m/20210627041138.zklczwmu3ms4ufnk@nol  

M src/backend/utils/adt/ruleutils.c
M src/include/utils/ruleutils.h

Fix role names in merge.sql regress file

commit   : 386ca0abf4107721a363f1c152cd026041b609ea    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2022 17:10:36 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2022 17:10:36 +0200    

Click here for diff

These names need to be prefixed with "regress_".  Per buildfarm.  

M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Add support for MERGE SQL command

commit   : 7103ebb7aae8ab8076b7e85f335ceb8fe799097c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2022 16:45:58 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 28 Mar 2022 16:45:58 +0200    

Click here for diff

MERGE performs actions that modify rows in the target table using a  
source table or query. MERGE provides a single SQL statement that can  
conditionally INSERT/UPDATE/DELETE rows -- a task that would otherwise  
require multiple PL statements.  For example,  
  
MERGE INTO target AS t  
USING source AS s  
ON t.tid = s.sid  
WHEN MATCHED AND t.balance > s.delta THEN  
  UPDATE SET balance = t.balance - s.delta  
WHEN MATCHED THEN  
  DELETE  
WHEN NOT MATCHED AND s.delta > 0 THEN  
  INSERT VALUES (s.sid, s.delta)  
WHEN NOT MATCHED THEN  
  DO NOTHING;  
  
MERGE works with regular tables, partitioned tables and inheritance  
hierarchies, including column and row security enforcement, as well as  
support for row and statement triggers and transition tables therein.  
  
MERGE is optimized for OLTP and is parameterizable, though also useful  
for large scale ETL/ELT. MERGE is not intended to be used in preference  
to existing single SQL commands for INSERT, UPDATE or DELETE since there  
is some overhead.  MERGE can be used from PL/pgSQL.  
  
MERGE does not support targetting updatable views or foreign tables, and  
RETURNING clauses are not allowed either.  These limitations are likely  
fixable with sufficient effort.  Rewrite rules are also not supported,  
but it's not clear that we'd want to support them.  
  
Author: Pavan Deolasee <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Simon Riggs <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Andres Freund <[email protected]> (earlier versions)  
Reviewed-by: Peter Geoghegan <[email protected]> (earlier versions)  
Reviewed-by: Robert Haas <[email protected]> (earlier versions)  
Reviewed-by: Japin Li <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
A doc/src/sgml/ref/merge.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/trigger.c
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
A src/backend/parser/parse_merge.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/tab-complete.c
M src/include/commands/trigger.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/prep.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
A src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/tcop/cmdtaglist.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
A src/test/isolation/expected/merge-delete.out
A src/test/isolation/expected/merge-insert-update.out
A src/test/isolation/expected/merge-match-recheck.out
A src/test/isolation/expected/merge-update.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/merge-delete.spec
A src/test/isolation/specs/merge-insert-update.spec
A src/test/isolation/specs/merge-match-recheck.spec
A src/test/isolation/specs/merge-update.spec
M src/test/regress/expected/identity.out
A src/test/regress/expected/merge.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/with.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/identity.sql
A src/test/regress/sql/merge.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/with.sql
M src/tools/pgindent/typedefs.list

Preparatory test cleanup

commit   : ae63017bdb316b16a9f201b10f1221598111d6c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Mar 2022 15:22:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Mar 2022 15:22:34 +0200    

Click here for diff

Add a little bit of explanation, clarity, and space.  Extraced from a  
larger patch so that the changes from that patch would be easier to  
identify.  
  
Discussion: https://www.postgresql.org/message-id/flat/04e12818-2f98-257c-b926-2845d74ed04f%402ndquadrant.com  

M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Document autoanalyze limitations for partitioned tables

commit   : 61fa6ca79b3c566f44831a33bb226f7358ed4511    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 28 Mar 2022 14:27:36 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 28 Mar 2022 14:27:36 +0200    

Click here for diff

When dealing with partitioned tables, counters for partitioned tables  
are not updated when modifying child tables. This means autoanalyze may  
not update optimizer statistics for the parent relations, which can  
result in poor plans for some queries.  
  
It's worth documenting this limitation, so that people are aware of it  
and can take steps to mitigate it (e.g. by setting up a script executing  
ANALYZE regularly).  
  
Backpatch to v10. Older branches are affected too, of couse, but we no  
longer maintain those.  
  
Author: Justin Pryzby  
Reviewed-by: Zhihong Yu, Tomas Vondra  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/analyze.sgml

Make JSON path numeric literals more correct

commit   : e26114c817b610424010cfbe91a743f591246ff1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 28 Mar 2022 10:41:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 28 Mar 2022 10:41:43 +0200    

Click here for diff

Per ECMAScript standard (ECMA-262, referenced by SQL standard), the  
syntax forms  
  
.1  
1.  
  
should be allowed for decimal numeric literals, but the existing  
implementation rejected them.  
  
Also, by the same standard, reject trailing junk after numeric  
literals.  
  
Note that the ECMAScript standard for numeric literals is in respects  
like these slightly different from the JSON standard, which might be  
the original cause for this discrepancy.  
  
A change is that this kind of syntax is now rejected:  
  
    1.type()  
  
This needs to be written as  
  
    (1).type()  
  
This is correct; normal JavaScript also does not accept this syntax.  
  
We also need to fix up the jsonpath output function for this case.  We  
put parentheses around numeric items if they are followed by another  
path item.  
  
Reviewed-by: Nikita Glukhov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonpath.sql

Don't fail for > 1 walsenders in 019_replslot_limit, add debug messages.

commit   : 91c0570a791180aa3ff01d70eb16ed6c0d8283a3    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 22:29:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 22:29:19 -0700    

Click here for diff

So far the first of the retries introduced in f28bf667f60 resolves the  
issue. But I (Andres) am still suspicious that the start of the failures might  
indicate a problem.  
  
To reduce noise, stop reporting a failure if a retry resolves the problem. To  
allow figuring out what causes the slow slot drop, add a few more debug  
messages to ReplicationSlotDropPtr.  
  
See also commit afdeff10526, fe0972ee5e6 and f28bf667f60.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/test/recovery/t/019_replslot_limit.pl

Mark pg_stat_get_subscription_stats() strict.

commit   : da4b56662f2cda3ef97847307aaec8e8f66ffb15    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 21:47:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 21:47:26 -0700    

Click here for diff

It accidentally was marked as non-strict. As it was introduced only in HEAD,  
we can just fix the catalog.  
  
Bumps catversion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix NULL input behaviour of pg_stat_get_replication_slot().

commit   : 43a7dc96eb363f87286494223861301361ce766c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 21:39:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 27 Mar 2022 21:39:43 -0700    

Click here for diff

pg_stat_get_replication_slot() accidentally was marked as non-strict, crashing  
when called with NULL input. As it's already released, introduce an explicit  
NULL check in 14, fix the catalog in HEAD.  
  
Bumps catversion in HEAD.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where replication slot stats were introduced  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix pg_waldump docs.

commit   : 8af36427d4cc783a9efe8781889ea0936f1d48dd    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 28 Mar 2022 16:21:12 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 28 Mar 2022 16:21:12 +1300    

Click here for diff

Before 52b5568, the recently added -l option was short for --relation.  
We changed it to -R, but we forgot to update one place in the  
documentation.  
  
Author: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/MEYP282MB1669435CFBE57CBBA5116C66B61D9%40MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/pg_waldump.sgml

waldump: fix use-after-free in search_directory().

commit   : 264d284929e0d5a419821f94f16f766b5497c87a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 16:38:43 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 16:38:43 -0700    

Click here for diff

After closedir() dirent->d_name is not valid anymore. As there alerady are a  
few places relying on the limited lifetime of pg_waldump, do so here as well,  
and just pg_strdup() the string.  
  
The bug was introduced in fc49e24fa69a.  
  
Found by UBSan, run locally.  
  
Backpatch: 11-, like fc49e24fa69 itself.  

M src/bin/pg_waldump/pg_waldump.c

Fix up compiler warnings/errors from f4fb45d15.

commit   : cc7401d5ca498a84d9b47fd2e01cebd8e830e558    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 18:32:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 18:32:40 -0400    

Click here for diff

Per early buildfarm returns.  

M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c

SQL/JSON constructors

commit   : f4fb45d15c59d7add2e1b81a9d477d0119a9691a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:02:10 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:02:10 -0500    

Click here for diff

This patch introduces the SQL/JSON standard constructors for JSON:  
  
JSON()  
JSON_ARRAY()  
JSON_ARRAYAGG()  
JSON_OBJECT()  
JSON_OBJECTAGG()  
  
For the most part these functions provide facilities that mimic  
existing json/jsonb functions. However, they also offer some useful  
additional functionality. In addition to text input, the JSON() function  
accepts bytea input, which it will decode and constuct a json value from.  
The other functions provide useful options for handling duplicate keys  
and null values.  
  
This series of patches will be followed by a consolidated documentation  
patch.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/test/regress/expected/opr_sanity.out
A src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/opr_sanity.sql
A src/test/regress/sql/sqljson.sql

Common SQL/JSON clauses

commit   : f79b803dcc98d707450e158db3638dc67ff8380b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:00:49 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:00:49 -0500    

Click here for diff

This introduces some of the building blocks used by the SQL/JSON  
constructor and query functions. Specifically, it provides node  
executor and grammar support for the FORMAT JSON [ENCODING foo]  
clause, and values decorated with it, and for the RETURNING clause.  
  
The following SQL/JSON patches will leverage these.  
  
Nikita Glukhov (who probably deserves an award for perseverance).  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h

Remove more unused module imports from TAP tests

commit   : b64c3bd62ea7064a1a36fbd921e8955fa76faa3e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sun, 27 Mar 2022 22:26:40 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sun, 27 Mar 2022 22:26:40 +0200    

Click here for diff

This is a follow-up to commit 7dac61402 which removed a set of unused  
modules from the TAP test.  
  
The Config references in the pg_ctl and pg_rewind tests were removed  
in commit 1c6d46293.  Fcntl ':mode' and File::stat in the pg_ctl test  
were added in c37b3d08c which was probably a leftover from an earlier  
version of the patch, as the function using these was added to another  
module in that commit.  
  
The Config reference in the ldap test was added in ee56c3b21 which in  
turn use $^O instead of interrogating Config.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/test/ldap/t/001_auth.pl

Remove useless variable.

commit   : c2d81ee902b96e6218e832eea184dbbfbc3af7d7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 15:05:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 15:05:22 -0400    

Click here for diff

flatten_join_alias_vars_mutator counted attnums, but didn't  
do anything with the count (no doubt it did at one time).  
  
Noted by buildfarm member seawasp.  

M src/backend/optimizer/util/var.c

Avoid using large pass-by-value struct arguments in pgbench.

commit   : 641a9b716789628a4e7403ecef1b82cc4a9552b0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 14:38:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 14:38:05 -0400    

Click here for diff

In the wake of commit 4a39f87ac, which noticeably increased the  
size of struct StatsData and thereby ParsedScript, Coverity started  
to complain that ParsedScript was unreasonably large to be passing  
by value.  The two places that do this are only used during setup,  
so they're not really dragging down benchmark measurements --- but  
gratuitous inefficiency is not a good look in a benchmarking program.  
Convert to use pointers instead.  

M src/bin/pgbench/pgbench.c

Fix breakage of get_ps_display() in the PS_USE_NONE case.

commit   : 0fb6954aa5012fc0c41af364fb328f90e648f6b7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 12:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 27 Mar 2022 12:57:46 -0400    

Click here for diff

Commit 8c6d30f21 caused this function to fail to set *displen  
in the PS_USE_NONE code path.  If the variable's previous value  
had been negative, that'd lead to a memory clobber at some call  
sites.  We'd managed not to notice due to very thin test coverage  
of such configurations, but this appears to explain buildfarm member  
lorikeet's recent struggles.  
  
Credit to Andrew Dunstan for spotting the problem.  Back-patch  
to v13 where the bug was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/ps_status.c

Fix comment in execParallel.c

commit   : 411b91360f2711e36782b68cd0c9bc6de44d3384    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 27 Mar 2022 18:22:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 27 Mar 2022 18:22:22 +0900    

Click here for diff

0f61727 has made this comment incorrect.  
  
Author: Julien Rouhaud  
Reviewed-by: Matthias van de Meent  
Discussion: https://postgr.es/m/20220326160117.qtp5nkuku6cvhcby@jrouhaud  

M src/backend/executor/execParallel.c

pageinspect: Add more sanity checks to prevent out-of-bound reads

commit   : 291e517a4dc93b4137b0da8d46350f9300183f05    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 27 Mar 2022 17:53:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 27 Mar 2022 17:53:40 +0900    

Click here for diff

A couple of code paths use the special area on the page passed by the  
function caller, expecting to find some data in it.  However, feeding  
an incorrect page can lead to out-of-bound reads when trying to access  
the page special area (like a heap page that has no special area,  
leading PageGetSpecialPointer() to grab a pointer outside the allocated  
page).  
  
The functions used for hash and btree indexes have some protection  
already against that, while some other functions using a relation OID  
as argument would make sure that the access method involved is correct,  
but functions taking in input a raw page without knowing the relation  
the page is attached to would run into problems.  
  
This commit improves the set of checks used in the code paths of BRIN,  
btree (including one check if a leaf page is found with a non-zero  
level), GIN and GiST to verify that the page given in input has a  
special area size that fits with each access method, which is done  
though PageGetSpecialSize(), becore calling PageGetSpecialPointer().  
  
The scope of the checks done is limited to work with pages that one  
would pass after getting a block with get_raw_page(), as it is possible  
to craft byteas that could bypass existing code paths.  Having too many  
checks would also impact the usability of pageinspect, as the existing  
code is very useful to look at the content details in a corrupted page,  
so the focus is really to avoid out-of-bound reads as this is never a  
good thing even with functions whose execution is limited to  
superusers.  
  
The safest approach could be to rework the functions so as these fetch a  
block using a relation OID and a block number, but there are also cases  
where using a raw page is useful.  
  
Tests are added to cover all the code paths that needed such checks, and  
an error message for hash indexes is reworded to fit better with what  
this commit adds.  
  
Reported-By: Alexander Lakhin  
Author: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/expected/gin.out
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/sql/brin.sql
M contrib/pageinspect/sql/btree.sql
M contrib/pageinspect/sql/gin.sql
M contrib/pageinspect/sql/gist.sql
M contrib/pageinspect/sql/hash.sql

Wait for subscription to sync in t/031_column_list.sql

commit   : 404f49338fef32150f930ddfa8ae0411b5e35121    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 27 Mar 2022 00:11:38 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 27 Mar 2022 00:11:38 +0100    

Click here for diff

One of the TAP tests added in 923def9a53 did not wait after creating a  
subscription, and wait_for_catchup is not sufficient for this. So if the  
tablesync workers happen do not complete quickly enough, the test won't  
see the expected results.  
  
This probably explains intermittent failures on a couple buildfarm  
animals (komodoensis, petalura and snapper).  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/031_column_list.pl

SSL TAP test backend library independence refactoring

commit   : 4a7e964fc67a541b6ea1b72729ad3f8e632d003c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Sat, 26 Mar 2022 22:00:39 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Sat, 26 Mar 2022 22:00:39 +0100    

Click here for diff

The SSL TAP tests were tightly coupled to the OpenSSL implementation,  
making it hard to add support for additional SSL/TLS backends.  This  
refactoring makes the test avoid depending on specific implementations  
  
The SSLServer Perl module is renamed SSL::Server, which in turn use  
SSL::Backend::X where X is the backend pointed to by with_ssl.  Each  
backend will implement its own module responsible for setting up keys,  
certs and to resolve sslkey values to their implementation specific  
value (file paths or vault nicknames etc). Further, switch_server_cert  
now takes a set of named parameters rather than a fixed set which used  
defaults. The modules also come with POD documentation.  
  
There are a few testcases which still use OpenSSL specifics, but it's  
not entirely clear how to abstract those until we have another library  
implemented.  
  
Original patch by me, with lots of rework by Andrew Dunstan to turn it  
into better Perl.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
A src/test/ssl/t/SSL/Backend/OpenSSL.pm
A src/test/ssl/t/SSL/Server.pm
D src/test/ssl/t/SSLServer.pm

Suppress compiler warning in relptr_store().

commit   : e07d4ddc55fdcf82082950b3eb0cd8f728284c9d    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2022 14:29:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2022 14:29:29 -0400    

Click here for diff

clang 13 with -Wextra warns that "performing pointer subtraction with  
a null pointer has undefined behavior" in the places where freepage.c  
tries to set a relptr variable to constant NULL.  This appears to be  
a compiler bug, but it's unlikely to get fixed instantly.  Fortunately,  
we can work around it by introducing an inline support function, which  
seems like a good change anyway because it removes the macro's existing  
double-evaluation hazard.  
  
Backpatch to v10 where this code was introduced.  
  
Patch by me, based on an idea of Andres Freund's.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/utils/relptr.h

Move prattrs to the pg_publication_rel section in docs

commit   : 41b00f8e601fcf82aab2fc5ad0214a67f4829431    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 26 Mar 2022 19:06:10 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 26 Mar 2022 19:06:10 +0100    

Click here for diff

Commit 923def9a53 documented the prattrs to the pg_publication_namespace  
catalog, probably due to a rebase mistake. Move it to the section for  
the pg_publication_rel catalog.  
  
Author: Noriyoshi Shinoda  
Discussion: https://postgr.es/m/PH7PR84MB18850A74D275F39762059E6CEE1B9@PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

Suppress compiler warning in pub_collist_to_bitmapset().

commit   : 979cd655c13c3ea5d7df1db84ef9c9c85c0ea6b3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2022 11:53:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 26 Mar 2022 11:53:37 -0400    

Click here for diff

A fair percentage of the buildfarm doesn't recognize that oldcxt  
won't be used uninitialized; silence those warnings by initializing it.  
  
While here, upgrade the function's thoroughly inadequate header comment.  
  
Oversight in 923def9a5, per buildfarm.  

M src/backend/catalog/pg_publication.c

Allow specifying column lists for logical replication

commit   : 923def9a533a7d986acfb524139d8b9e5466d0a5    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 26 Mar 2022 00:45:21 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 26 Mar 2022 00:45:21 +0100    

Click here for diff

This allows specifying an optional column list when adding a table to  
logical replication. The column list may be specified after the table  
name, enclosed in parentheses. Columns not included in this list are not  
sent to the subscriber, allowing the schema on the subscriber to be a  
subset of the publisher schema.  
  
For UPDATE/DELETE publications, the column list needs to cover all  
REPLICA IDENTITY columns. For INSERT publications, the column list is  
arbitrary and may omit some REPLICA IDENTITY columns. Furthermore, if  
the table uses REPLICA IDENTITY FULL, column list is not allowed.  
  
The column list can contain only simple column references. Complex  
expressions, function calls etc. are not allowed. This restriction could  
be relaxed in the future.  
  
During the initial table synchronization, only columns included in the  
column list are copied to the subscriber. If the subscription has  
several publications, containing the same table with different column  
lists, columns specified in any of the lists will be copied.  
  
This means all columns are replicated if the table has no column list  
at all (which is treated as column list with all columns), or when of  
the publications is defined as FOR ALL TABLES (possibly IN SCHEMA that  
matches the schema of the table).  
  
For partitioned tables, publish_via_partition_root determines whether  
the column list for the root or the leaf relation will be used. If the  
parameter is 'false' (the default), the list defined for the leaf  
relation is used. Otherwise, the column list for the root partition  
will be used.  
  
Psql commands \dRp+ and \d <table-name> now display any column lists.  
  
Author: Tomas Vondra, Alvaro Herrera, Rahila Syed  
Reviewed-by: Peter Eisentraut, Alvaro Herrera, Vignesh C, Ibrar Ahmed,  
Amit Kapila, Hou zj, Peter Smith, Wang wei, Tang, Shi yu  
Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/commands/publicationcmds.h
M src/include/nodes/parsenodes.h
M src/include/replication/logicalproto.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
A src/test/subscription/t/031_column_list.pl

Minor improvements in sequence decoding code and docs

commit   : 05843b1aa49df2ecc9b97c693b755bd1b6f856a9    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 20:12:50 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 20:12:50 +0100    

Click here for diff

A couple minor comment improvements and code cleanups, based on  
post-commit feedback to the sequence decoding patch.  
  
Author: Amit Kapila, vignesh C  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/replication/pgoutput/pgoutput.c

Harden TAP tests that intentionally corrupt page checksums.

commit   : 174877f1e344812f620fd8891af97104d5dfca13    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2022 14:23:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Mar 2022 14:23:26 -0400    

Click here for diff

The previous method for doing that was to write zeroes into a  
predetermined set of page locations.  However, there's a roughly  
1-in-64K chance that the existing checksum will match by chance,  
and yesterday several buildfarm animals started to reproducibly  
see that, resulting in test failures because no checksum mismatch  
was reported.  
  
Since the checksum includes the page LSN, test success depends on  
the length of the installation's WAL history, which is affected by  
(at least) the initial catalog contents, the set of locales installed  
on the system, and the length of the pathname of the test directory.  
Sooner or later we were going to hit a chance match, and today is  
that day.  
  
Harden these tests by specifically inverting the checksum field and  
leaving all else alone, thereby guaranteeing that the checksum is  
incorrect.  
  
In passing, fix places that were using seek() to set up for syswrite(),  
a combination that the Perl docs very explicitly warn against.  We've  
probably escaped problems because no regular buffered I/O is done on  
these filehandles; but if it ever breaks, we wouldn't deserve or get  
much sympathy.  
  
Although we've only seen problems in HEAD, now that we recognize the  
environmental dependencies it seems like it might be just a matter  
of time until someone manages to hit this in back-branch testing.  
Hence, back-patch to v11 where we started doing this kind of test.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/001_verify_heapam.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Handle sequences in preprocess_pubobj_list

commit   : 002c9dd97a0c874fd1693a570383e2dd38cd40d5    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 14:29:56 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 14:29:56 +0100    

Click here for diff

Commit 75b1521dae added support for logical replication of sequences,  
including grammar changes, but it did not update preprocess_pubobj_list  
accordingly. This can cause segfaults with "continuations", i.e. when  
command specifies a list of objects:  
  
  CREATE PUBLICATION p FOR SEQUENCE s1, s2;  
  
Reported by Amit Kapila, patch by me.  
  
Reported-by: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1JxDNKGBSNTyN-Xj2JRjzFo+ziSqJbjH==vuO0YF_CQrg@mail.gmail.com  

M src/backend/parser/gram.y
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Update tab-completion for CREATE PUBLICATION with sequences

commit   : 2d2232933b02d9396113662e44dca5f120d6830e    
  
author   : Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 13:24:14 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Fri, 25 Mar 2022 13:24:14 +0100    

Click here for diff

Commit 75b1521dae added support for sequences to built-in replication,  
but the tab-completion was updated only for ALTER PUBLICATION, not for  
CREATE PUBLICATION.  
  
Report and patch by Masahiko Sawada.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoDtKpdJcHOLjfPQ7TmpFqNB5__%3DQ_g1e8OBRrwT5LP-%3Dg%40mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix replay of create database records on standby

commit   : 49d9cfc68bf4e0d32a948fe72d5a0ef7f464944e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 25 Mar 2022 13:16:21 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 25 Mar 2022 13:16:21 +0100    

Click here for diff

Crash recovery on standby may encounter missing directories when  
replaying create database WAL records.  Prior to this patch, the standby  
would fail to recover in such a case.  However, the directories could be  
legitimately missing.  Consider a sequence of WAL records as follows:  
  
    CREATE DATABASE  
    DROP DATABASE  
    DROP TABLESPACE  
  
If, after replaying the last WAL record and removing the tablespace  
directory, the standby crashes and has to replay the create database  
record again, the crash recovery must be able to move on.  
  
This patch adds a mechanism similar to invalid-page tracking, to keep a  
tally of missing directories during crash recovery.  If all the missing  
directory references are matched with corresponding drop records at the  
end of crash recovery, the standby can safely continue following the  
primary.  
  
Backpatch to 13, at least for now.  The bug is older, but fixing it in  
older branches requires more careful study of the interactions with  
commit e6d8069522c8, which appeared in 13.  
  
A new TAP test file is added to verify the condition.  However, because  
it depends on commit d6d317dbf615, it can only be added to branch  
master.  I (Álvaro) manually verified that the code behaves as expected  
in branch 14.  It's a bit nervous-making to leave the code uncovered by  
tests in older branches, but leaving the bug unfixed is even worse.  
Also, the main reason this fix took so long is precisely that we  
couldn't agree on a good strategy to approach testing for the bug, so  
perhaps this is the best we can do.  
  
Diagnosed-by: Paul Guo <[email protected]>  
Author: Paul Guo <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Author: Asim R Praveen <[email protected]>  
Discussion: https://postgr.es/m/CAEET0ZGx9AvioViLf7nbR_8tH9-=27DN5xWJ2P9-ROH16e4JUA@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/include/access/xlogutils.h
A src/test/recovery/t/029_replay_tsp_drops.pl
M src/tools/pgindent/typedefs.list

Make update-unicode target work in vpath builds

commit   : c64fb698d076b297b350f667719ba5d58551a7f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Mar 2022 09:47:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Mar 2022 09:47:50 +0100    

Click here for diff

Author: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/unaccent/Makefile
M src/common/unicode/Makefile

Refactor DLSUFFIX handling

commit   : 23119d51a14c046dae35ae5e6ad9e35982d044fd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 25 Mar 2022 08:44:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 25 Mar 2022 08:44:31 +0100    

Click here for diff

Move DLSUFFIX from makefiles into header files for all platforms.  
Move the DLSUFFIX assignment from src/makefiles/ to src/templates/,  
have configure read it, and then substitute it into Makefile.global  
and pg_config.h.  This avoids the need for all makefile rules that  
need it to locally set CPPFLAGS.  It also resolves an inconsistent  
setup between the two Windows build systems.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M config/python.m4
M configure
M configure.ac
M src/Makefile.global.in
M src/backend/jit/Makefile
M src/backend/utils/fmgr/Makefile
M src/backend/utils/fmgr/dfmgr.c
M src/bin/pg_upgrade/Makefile
M src/include/pg_config.h.in
M src/include/port/win32_port.h
M src/interfaces/ecpg/test/Makefile
M src/makefiles/Makefile.aix
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.darwin
M src/makefiles/Makefile.freebsd
M src/makefiles/Makefile.hpux
M src/makefiles/Makefile.linux
M src/makefiles/Makefile.netbsd
M src/makefiles/Makefile.openbsd
M src/makefiles/Makefile.solaris
M src/makefiles/Makefile.win32
M src/template/cygwin
M src/template/hpux
M src/template/win32
M src/test/regress/GNUmakefile
M src/tools/msvc/Solution.pm

postgres_fdw: Minor cleanup for pgfdw_abort_cleanup().

commit   : 56566835039ac5eed70f188518cef1a7ea0971b2    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 25 Mar 2022 15:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 25 Mar 2022 15:30:00 +0900    

Click here for diff

Commit 85c696112 introduced this function to deduplicate code in the  
transaction callback functions, but the SQL command passed as an  
argument to it was useless when it returned before aborting a remote  
transaction using the command.  Modify pgfdw_abort_cleanup() so that it  
constructs the command when/if necessary, as before, removing the  
argument from it.  Also update comments in pgfdw_abort_cleanup() and one  
of the calling functions.  
  
Etsuro Fujita, reviewed by David Zhang.  
  
Discussion: https://postgr.es/m/CAPmGK158hrd%3DZfXmgkmNFHivgh18e4oE2Gz151C2Q4OBDjZ08A%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Fix typos in standby.c

commit   : ad8759bea06d2a0cac033f5ba551011663d9e716    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 25 Mar 2022 14:11:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 25 Mar 2022 14:11:18 +0900    

Click here for diff

xl_running_xacts exists, not xl_xact_running_xacts.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB57160D8B01097FFB5C175065941A9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/storage/ipc/standby.c

Remove some useless free calls.

commit   : 3e67a5cac6a50139bd29b96ab97496dbc1543d92    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 25 Mar 2022 07:37:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 25 Mar 2022 07:37:06 +0530    

Click here for diff

These were introduced in recent commit 52e4f0cd47. We were trying to free  
some transient space consumption and that too was not entirely correct and  
complete. We don't need this partial freeing of memory as it will be  
allocated just once for a query and will be freed at the end of the query.  
  
Author: Zhihong Yu  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CALNJ-vQORfQ=vicbKA_RmeGZGzm1y3WsEcZqXWi7qjN43Cz_vg@mail.gmail.com  

M src/backend/commands/publicationcmds.c

Second attempt to fix pgbench TAP test.

commit   : 0f79caa3c61e643e6285524f3148a35fb61ddcf3    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Fri, 25 Mar 2022 10:11:19 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Fri, 25 Mar 2022 10:11:19 +0900    

Click here for diff

Bildfarm member prairiedog reported a pgbench TAP test failure after  
commit: 4a39f87acd6e681e5ded1239391d8a92645b43d6. This is the second  
attempt to fix it. It seems older version of Perl does not accept  
"\gN". Replace it with plain old "\N" because actually "\gN" is not  
necessary here.  
  
Author: Tatsuo Ishii  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane, Yugo Nagata  
Discussion: https://postgr.es/m/2775989.1648060014%40sss.pgh.pa.us  

M src/bin/pgbench/t/001_pgbench_with_server.pl

Improve command line options for pg_waldump.

commit   : 52b5568432963b721698a2df1f37a0795b9611dc    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 25 Mar 2022 13:44:10 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 25 Mar 2022 13:44:10 +1300    

Click here for diff

Follow-up improvements for commit 127aea2a based on discussion:  
  
* use fork name for --fork, not number  
* use -R, -B as short switches for --relation, --block  
* re-alphabetize the list of switches (code, --help and docs)  
  
Suggested-by: Peter Eisentraut <[email protected]> (fork name part)  
Reviewed-by: David Christensen <[email protected]>  
Reviewed-by: Japin Li <[email protected]>  
Discussion: https://postgr.es/m/3a4c2e93-7976-2320-fc0a-32097fe148a7%40enterprisedb.com  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Add retries for further investigation of 019_replslot_limit.pl failures.

commit   : f28bf667f602f6ff36c219eb40c5f61de4440ae5    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 24 Mar 2022 17:12:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 24 Mar 2022 17:12:09 -0700    

Click here for diff

Tom noticed evidence in the buildfarm suggesting the failures might just be  
really slow process exits. To investigate further, instead of giving up after  
seeing multiple walsender pids once, retry. For now continue to report test  
failure if a retry succeeds.  
  
See also commit afdeff10526 and fe0972ee5e6.  
  
Per suggestion from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

List offending databases in pg_upgrade datallowconn check

commit   : 26ebb0e28032283f99bf985fb47ea3d19fbaf91a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Mar 2022 22:41:40 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Mar 2022 22:41:40 +0100    

Click here for diff

The check for datallowconn being properly set on all databases in the  
old cluster errored out on the first instance, rather than report the  
set of problematic databases.  This adds reporting to a textfile like  
how many other checks are performed.  While there, also add a comment  
to the function as per how other checks are commented.  
  
This check won't catch if template1 isn't allowing connections, since  
that's used for connecting in the first place.  That error remains as  
it is today:  
  
connection to server on socket ".." failed: FATAL:  database "template1" is not currently accepting connections  
  
Author: Jeevan Ladhe <[email protected]>  
Reviewed-by: Suraj Kharage <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/CAOgcT0McABqF_iFFQuuRf9is+gmYMsmUu_SWNikyr=2VGyP9Jw@mail.gmail.com  

M src/bin/pg_upgrade/check.c

Fix pg_statio_all_tables view for multiple TOAST indexes.

commit   : ce95c543763b6fade641a67fa0c70649d8527243    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 16:33:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 16:33:13 -0400    

Click here for diff

A TOAST table can normally have only one index, but there are corner  
cases where it has more; for example, transiently during REINDEX  
CONCURRENTLY.  In such a case, the pg_statio_all_tables view produced  
multiple rows for the owning table, one per TOAST index.  Refactor the  
view to avoid that, instead summing the stats across all the indexes,  
as we do for regular table indexes.  
  
While this has been wrong for a long time, back-patching seems unwise  
due to the difficulty of putting a system view change into back  
branches.  
  
Andrei Zubkov, tweaked a bit by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out

Remove unused module imports from TAP tests

commit   : 7dac61402e34c6d41d5d11cdc4c6a55f91e24026    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Mar 2022 20:51:40 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Mar 2022 20:51:40 +0100    

Click here for diff

The Config and Cwd modules were no longer used, but remained imported,  
in a number of tests.  Remove to keep the imports to the actually used  
modules.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl

Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

commit   : 412ad7a55639516f284cd0ef9757d6ae5c7abd43    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2022 14:32:06 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 24 Mar 2022 14:32:06 -0400    

Click here for diff

If TRUNCATE causes some buffers to be invalidated and thus the  
checkpoint does not flush them, TRUNCATE must also ensure that the  
corresponding files are truncated on disk. Otherwise, a replay  
from the checkpoint might find that the buffers exist but have  
the wrong contents, which may cause replay to fail.  
  
Report by Teja Mupparti. Patch by Kyotaro Horiguchi, per a design  
suggestion from Heikki Linnakangas, with some changes to the  
comments by me. Review of this and a prior patch that approached  
the issue differently by Heikki Linnakangas, Andres Freund, Álvaro  
Herrera, Masahiko Sawada, and Tom Lane.  
  
Discussion: http://postgr.es/m/BYAPR06MB6373BF50B469CA393C614257ABF00@BYAPR06MB6373.namprd06.prod.outlook.com  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h
M src/include/storage/procarray.h

Wrap inline function definitions in #ifndef FRONTEND

commit   : 86459b3296803cfa4d3e53c0fc8763412c71b6d0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Mar 2022 19:30:06 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Mar 2022 19:30:06 +0100    

Click here for diff

This should fix failures under certain compilers (a well known  
limitation).  My oversight in e27f4ee0a701.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/htup_details.h

Add decoding of sequences to built-in replication

commit   : 75b1521dae1ff1fde17fda2e30e591f2e5d64b6a    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 24 Mar 2022 18:20:21 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 24 Mar 2022 18:20:21 +0100    

Click here for diff

This commit adds support for decoding of sequences to the built-in  
replication (the infrastructure was added by commit 0da92dc530).  
  
The syntax and behavior mostly mimics handling of tables, i.e. a  
publication may be defined as FOR ALL SEQUENCES (replicating all  
sequences in a database), FOR ALL SEQUENCES IN SCHEMA (replicating  
all sequences in a particular schema) or individual sequences.  
  
To publish sequence modifications, the publication has to include  
'sequence' action. The protocol is extended with a new message,  
describing sequence increments.  
  
A new system view pg_publication_sequences lists all the sequences  
added to a publication, both directly and indirectly. Various psql  
commands (\d and \dRp) are improved to also display publications  
including a given sequence, or sequences included in a publication.  
  
Author: Tomas Vondra, Cary Huang  
Reviewed-by: Peter Eisentraut, Amit Kapila, Hannu Krosing, Andres  
             Freund, Petr Jelinek  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/commands/sequence.h
M src/include/nodes/parsenodes.h
M src/include/replication/logicalproto.h
M src/include/replication/pgoutput.h
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
A src/test/subscription/t/030_sequences.pl

Doc: add some documentation about serialization failure handling.

commit   : 0adb3dc68bfb9a347ff2c7fe63200419bb649265    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 13:34:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 13:34:27 -0400    

Click here for diff

We weren't very explicit about when to retry such errors.  
  
Simon Riggs  
  
Discussion: https://postgr.es/m/CANbhV-E+u+Z4VBNyJ6GzeO1fd2wP_5S+f6+kmxnN+ALQE6iG9Q@mail.gmail.com  

M doc/src/sgml/mvcc.sgml

Change fastgetattr and heap_getattr to inline functions

commit   : e27f4ee0a701854daf16ac1d044f20d28a17053e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 24 Mar 2022 18:02:27 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 24 Mar 2022 18:02:27 +0100    

Click here for diff

They were macros previously, but recent callsite additions made Coverity  
complain about one of the assertions being always true.  This change  
could have been made a long time ago, but the Coverity complain broke  
the inertia.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Japin Li <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/include/access/htup_details.h

Invent recursive_worktable_factor GUC to replace hard-wired constant.

commit   : 0bd7af082ace135581bb13a6bd2d88e68c66a3e0    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 11:47:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 24 Mar 2022 11:47:41 -0400    

Click here for diff

Up to now, the planner estimated the size of a recursive query's  
worktable as 10 times the size of the non-recursive term.  It's hard  
to see how to do significantly better than that automatically, but  
we can give users control over the multiplier to allow tuning for  
specific use-cases.  The default behavior remains the same.  
  
Simon Riggs  
  
Discussion: https://postgr.es/m/CANbhV-EuaLm4H3g0+BSTYHEGxJj3Kht0R+rJ8vT57Dejnh=_nA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/optimizer/cost.h
M src/include/optimizer/optimizer.h

Remove unnecessary translator comment

commit   : a47651447f01562dac2e007db03733e750d45b6b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 24 Mar 2022 14:06:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 24 Mar 2022 14:06:08 +0100    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/CALj2ACUfJKTmK5v%3DvF%2BH2iLkqM9Yvjsp6iXaCqAks6gDpzZh6g%40mail.gmail.com  

M src/backend/catalog/dependency.c

doc: Improve postgres command for shared_memory_size_in_huge_pages

commit   : bbd4951b73ec5ba4356133140da19cf378a796fd    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 20:56:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 20:56:31 +0900    

Click here for diff

The command used in the documentation to retrieve the value of the  
runtime-computed GUC shared_memory_size_in_huge_pages would also show to  
the user all the log messages generated by the postmaster before and  
after printing the wanted value.  This can be confusing, as the wanted  
result could be masked with a lot of noise.  
  
One way to avoid those log messages is to use something like "-c  
log_min_messages=fatal" in the command (my idea, but that's not common  
knowledge).  Rather than mentioning this option, suffix the command with  
a redirection of stderr to /dev/null, which is the stream location where  
the logs show up.  This is enough to show only the GUC value to the  
user when copy-pasting the command.  
  
Reported-by: Magnus Hagander  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20220314173417.GA1020555@nathanxps13  

M doc/src/sgml/runtime.sgml

Add additional filtering options to pg_waldump.

commit   : 127aea2a65cd89c1c28357c6db199683e219491e    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 24 Mar 2022 20:58:20 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 24 Mar 2022 20:58:20 +1300    

Click here for diff

Allow filtering by RelFileNode, BlockNumber, ForkNum and FPW.  
  
Author: David Christensen <[email protected]>  
Reviewed-by: Japin Li <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Cary Huang <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/lzzgmgm6e5.fsf%40veeddrois.attlocal.net  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Fix pgbench TAP test.

commit   : ac9c5dc5d4cc15e396b59ca66df25969e51a2a00    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 24 Mar 2022 13:32:59 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 24 Mar 2022 13:32:59 +0900    

Click here for diff

Bildfarm member prairiedog reported a pgbench TAP test failure after  
commit: 4a39f87acd6e681e5ded1239391d8a92645b43d6. This commit attempts  
to fix some copy&paste errors introduced in the previous commit.  
  
Author: Yugo Nagata  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/2775989.1648060014%40sss.pgh.pa.us  

M src/bin/pgbench/t/001_pgbench_with_server.pl

commit   : d4781d8873f8c3fc8b0957cc03ce91627576cf36    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 12:42:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 12:42:30 +0900    

Click here for diff

hba.c is growing big, and more contents are planned for it.  In order to  
prepare for this future work, this commit moves all the code related to  
the system function processing the contents of pg_hba.conf,  
pg_hba_file_rules() to a new file called hbafuncs.c, which will be used  
as the location for the SQL portion of the authentication file parsing.  
While on it, HbaToken, the structure holding a string token lexed from a  
configuration file related to authentication, is renamed to a more  
generic AuthToken, as it gets used not only for pg_hba.conf, but also  
for pg_ident.conf.  TokenizedLine is now named TokenizedAuthLine.  
  
The size of hba.c is reduced by ~12%.  
  
Author: Julien Rouhaud  
Reviewed-by: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M src/backend/libpq/hba.c
M src/backend/utils/adt/Makefile
A src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h
M src/tools/pgindent/typedefs.list

Add some basic regression tests for pg_freespacemap

commit   : a1bc4d3590b1f620485c3ec5290dc628e62476f8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 09:36:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Mar 2022 09:36:30 +0900    

Click here for diff

The number of relation pages is tricky to get right in a portable way,  
particularly across 32b and 64b builds, but checking after the existence  
of the FSM and if there is any space available space should be stable  
enough with a minimal number of tuples involved.  This commit introduces  
checks on a table with some btree, BRIN and hash indexes, as a first  
attempt.  
  
Author: Dong Wook Lee, Fabrízio de Royes Mello, Michael Paquier  
Discussion: https://postgr.es/m/CAAcByaJ5KW3bd7fJr=jPEyK8M_UzXJFHHBVuOcBe+JHD8txRyQ@mail.gmail.com  

A contrib/pg_freespacemap/.gitignore
M contrib/pg_freespacemap/Makefile
A contrib/pg_freespacemap/expected/pg_freespacemap.out
A contrib/pg_freespacemap/sql/pg_freespacemap.sql

Don't try to translate NULL in GetConfigOptionByNum().

commit   : 3ac7d024122f26d828907f15d088dcd67d2eb4f1    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 13:05:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 13:05:59 -0700    

Click here for diff

Noticed via -fsanitize=undefined. Introduced when a few columns in  
GetConfigOptionByNum() / pg_settings started to be translated in 72be8c29a /  
PG 12.  
  
Backpatch to all affected branches, for the same reasons as 46ab07ffda9.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-  

M src/backend/utils/misc/guc.c

Don't call fwrite() with len == 0 when writing out relcache init file.

commit   : 1c6bb380e5aba195204a9c6d0b4713bd1b3dec9c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 13:05:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 13:05:25 -0700    

Click here for diff

Noticed via -fsanitize=undefined.  
  
Backpatch to all branches, for the same reasons as 46ab07ffda9.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

M src/backend/utils/cache/relcache.c

configure: check for dlsym instead of dlopen.

commit   : e71c76fcab8d00defe9a7a608facdd9663f7bcbf    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 12:43:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 12:43:14 -0700    

Click here for diff

When building with sanitizers the sanitizer library provides dlopen, but not  
dlsym(), making configure think that -ldl isn't needed. Just checking for  
dlsym() ought to suffice, hard to see dlsym() being provided without dlopen()  
also being provided.  
  
Backpatch to all branches, for the same reasons as 46ab07ffda9.  
  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

M configure
M configure.ac

Clean test_rls_hooks module

commit   : c97e4bdcb142effc452d33b81f31e0b3ac990b71    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 15:11:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 15:11:45 -0400    

Click here for diff

This module isn't an extension and doesn't need to be preloaded.  
Adjust the Makefile and remove the extraneous .control and .conf  
files accordingly.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_rls_hooks/Makefile
D src/test/modules/test_rls_hooks/rls_hooks.conf
D src/test/modules/test_rls_hooks/test_rls_hooks.control

ci: test headerscheck, cpluspluscheck as part of CompilerWarnings task.

commit   : 81b9f23c9c83813f14d20cf6993d94fdd44c0991    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 11:33:01 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 23 Mar 2022 11:33:01 -0700    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

pg_upgrade: Upgrade an Assert to a real 'if' test

commit   : 3e1c942a4e2f06e9b0196180eb8fd1383e6d788e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 19:23:51 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 19:23:51 +0100    

Click here for diff

It seems possible for the condition being tested to be true in  
production, and nobody would never know (except when some data  
eventually becomes corrupt?).  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m//[email protected]  

M src/bin/pg_rewind/parsexlog.c

pg_basebackup: Try to fix some failures on Windows.

commit   : 591767150f5f91ccc3614e71977c47ce7a68786b    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 13:25:26 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 13:25:26 -0400    

Click here for diff

Commit ffd53659c46a54a6978bcb8c4424c1e157a2c0f1 messed up the  
mechanism that was being used to pass parameters to LogStreamerMain()  
on Windows. It worked on Linux because only Windows was using threads.  
Repair by moving the additional parameters added by that commit into  
the 'logstreamer_param' struct.  
  
Along the way, fix a compiler warning on builds without HAVE_LIBZ.  
  
Discussion: http://postgr.es/m/CA+TgmoY5=AmWOtMj3v+cySP2rR=Bt6EGyF_joAq4CfczMddKtw@mail.gmail.com  

M src/backend/replication/basebackup_gzip.c
M src/bin/pg_basebackup/pg_basebackup.c

Fix "missing continuation record" after standby promotion

commit   : 9d92582abf918215d27659d45a4c9e78bda50aff    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 18:22:10 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 18:22:10 +0100    

Click here for diff

Invalidate abortedRecPtr and missingContrecPtr after a missing  
continuation record is successfully skipped on a standby. This fixes a  
PANIC caused when a recently promoted standby attempts to write an  
OVERWRITE_RECORD with an LSN of the previously read aborted record.  
  
Backpatch to 10 (all stable versions).  
  
Author: Sami Imseih <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/t/026_overwrite_contrecord.pl

test_decoding: Add comments about delaying BEGIN/PREPARE

commit   : dfdb2f3bf5c6ff4014de142a7b82b205224e01d3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 16:17:00 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 23 Mar 2022 16:17:00 +0100    

Click here for diff

It is not immediately obvious why we return early in these functions;  
these comments should make it so.  
  
Reviewed-by: Tomas Vondra <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/test_decoding.c

In get_bc_algorithm_name, add a dummy return statement.

commit   : 68d8f9bfb2f467c306d81b4f1cee1a5a0e5ede37    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 11:37:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 11:37:12 -0400    

Click here for diff

This code shouldn't be reached, but having it here might avoid a  
compiler warning.  
  
Per CI complaint from Andres Freund.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/common/backup_compression.c

Force NO_LOCALE / UTF8 for test_oat_hooks tests

commit   : 7c51b7f7cc0860ab9a5784fce7a44142e4eb5463    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 11:13:33 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 11:13:33 -0400    

Click here for diff

This will fix cases like fairywren that have been having issues.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/Makefile

Use approved style for listing OBJS in test_oat_hooks Makefile

commit   : fc15396dc6821e15c883b8101be45ee6298a4d77    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 10:42:25 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 23 Mar 2022 10:42:25 -0400    

Click here for diff

M src/test/modules/test_oat_hooks/Makefile

Unbreak the build.

commit   : 607e75e8f0f84544feb879b747da1d40fed71499    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 10:22:54 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 10:22:54 -0400    

Click here for diff

Commit ffd53659c46a54a6978bcb8c4424c1e157a2c0f1 broke the build for  
anyone not compiling with LZ4 and ZSTD enabled. Woops.  

M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_zstd.c

Replace BASE_BACKUP COMPRESSION_LEVEL option with COMPRESSION_DETAIL.

commit   : ffd53659c46a54a6978bcb8c4424c1e157a2c0f1    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 09:19:14 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 23 Mar 2022 09:19:14 -0400    

Click here for diff

There are more compression parameters that can be specified than just  
an integer compression level, so rename the new COMPRESSION_LEVEL  
option to COMPRESSION_DETAIL before it gets released. Introduce a  
flexible syntax for that option to allow arbitrary options to be  
specified without needing to adjust the main replication grammar,  
and common code to parse it that is shared between the client and  
the server.  
  
This commit doesn't actually add any new compression parameters,  
so the only user-visible change is that you can now type something  
like pg_basebackup --compress gzip:level=5 instead of writing just  
pg_basebackup --compress gzip:5. However, it should make it easy to  
add new options. If for example gzip starts offering fries, we can  
support pg_basebackup --compress gzip:level=5,fries=true for the  
benefit of users who want fries with that.  
  
Along the way, this fixes a few things in pg_basebackup so that the  
pg_basebackup can be used with a server-side compression algorithm  
that pg_basebackup itself does not understand. For example,  
pg_basebackup --compress server-lz4 could still succeed even if  
only the server and not the client has LZ4 support, provided that  
the other options to pg_basebackup don't require the client to  
decompress the archive.  
  
Patch by me. Reviewed by Justin Pryzby and Dagfinn Ilmari Mannsåker.  
  
Discussion: http://postgr.es/m/CA+TgmoYvpetyRAbbg1M8b3-iHsaN4nsgmWPjOENu5-doHuJ7fA@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/common/Makefile
A src/common/backup_compression.c
A src/include/common/backup_compression.h
M src/include/replication/basebackup_sink.h
M src/tools/msvc/Mkvcbuild.pm

Allow pgbench to retry in some cases.

commit   : 4a39f87acd6e681e5ded1239391d8a92645b43d6    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 23 Mar 2022 18:52:37 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 23 Mar 2022 18:52:37 +0900    

Click here for diff

When serialization or deadlock errors are reported by backend, allow  
to retry and continue the benchmarking. For this purpose new options  
"--max-tries", "--failures-detailed" and "--verbose-errors" are added.  
  
Transactions with serialization errors or deadlock errors will be  
repeated after rollbacks until they complete successfully or reach the  
maximum number of tries (specified by the --max-tries option), or the  
maximum time of tries (specified by the --latency-limit option).  
These options can be specified at the same time. It is not possible to  
use an unlimited number of tries (--max-tries=0) without the  
--latency-limit option or the --time option. By default the option  
--max-tries is set to 1, which means transactions with  
serialization/deadlock errors are not retried. If the last try fails,  
this transaction will be reported as failed, and the client variables  
will be set as they were before the first run of this transaction.  
  
Statistics on retries and failures are printed in the progress,  
transaction / aggregation logs and in the end with other results (all  
and for each script). Also retries and failures are printed  
per-command with average latency by using option  
(--report-per-command, -r).  
  
Option --failures-detailed prints group failures by basic types  
(serialization failures / deadlock failures).  
  
Option --verbose-errors prints distinct reports on errors and failures  
(errors without retrying) by type with detailed information like which  
limit for retries was violated and how far it was exceeded for the  
serialization/deadlock failures.  
  
Patch originally written by Marina Polyakova then Yugo Nagata  
inherited the discussion and heavily modified the patch to make it  
commitable.  
  
Authors: Yugo Nagata, Marina Polyakova  
Reviewed-by: Fabien Coelho, Tatsuo Ishii, Alvaro Herrera, Kevin Grittner, Andres Freund, Arthur Zakirov, Alexander Korotkov, Teodor Sigaev, Ildus Kurbangaliev  
Discussion: https://postgr.es/m/flat/72a0d590d6ba06f242d75c2e641820ec%40postgrespro.ru  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/fe_utils/conditional.c
M src/include/fe_utils/conditional.h

Try to stabilize vacuum test.

commit   : 383f222119f54e3904aae768b1ca23d03f56a042    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 23 Mar 2022 14:31:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 23 Mar 2022 14:31:18 +1300    

Click here for diff

As commits b700f96c and 3414099c did for the reloptions test, make  
sure VACUUM can always truncate the table as expected.  
  
Back-patch to 12, where vacuum_truncate arrived.  
  
Discussion: https://postgr.es/m/CAD21AoCNoWjYkdEtr%2BVDoF9v__V905AedKZ9iF%3DArgCtrbxZqw%40mail.gmail.com  

M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Temporarily disable installcheck for test_oat_hooks module

commit   : 5b29a9f772974e5863238b3f88b2f38c62b2a48f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 20:18:30 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 20:18:30 -0400    

Click here for diff

Buildfarm members are encountering errors when the test is run under  
various locales/encodings. As the buildfarm only does this for  
installchecks, disable them for now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/Makefile

Revert "Common SQL/JSON clauses"

commit   : 1460fc5942591fdb6bee0bc8342019ede31ff3b6    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 19:55:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 19:55:15 -0400    

Click here for diff

This reverts commit 865fe4d5df560a6f5353da652018ff876978ad2d.  
  
This has caused issues with a significant number of buildfarm members  

M src/backend/executor/execExpr.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h

Add missing xlogdefs.h include to pg_subscription.h.

commit   : 3707e437c73920492cab0dd17432be6e89bafd76    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 16:46:24 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 16:46:24 -0700    

Click here for diff

Missed in 208c5d65bbd.  
  
The missing include causes headerscheck to fail. Per buildfarm member crake.  

M src/include/catalog/pg_subscription.h

Common SQL/JSON clauses

commit   : 865fe4d5df560a6f5353da652018ff876978ad2d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:00:49 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Mar 2022 13:00:49 -0500    

Click here for diff

This introduces some of the building blocks used by the SQL/JSON  
constructor and query functions. Specifically, it provides node  
executor and grammar support for the FORMAT JSON [ENCODING foo]  
clause, and values decorated with it, and for the RETURNING clause.  
  
The following SQL/JSON patches will leverage these.  
  
Nikita Glukhov (who probably deserves an award for perseverance).  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup. Erik Rijkers, Zihong Yu and  
Himanshu Upadhyaya.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h

Tidy up Object Access hooks tests

commit   : a3b071bbe050252b35c589a7f1a2ee2f7ee3e9d4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 16:18:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 16:18:06 -0400    

Click here for diff

per gripelet from Tom Lane.  

M src/test/modules/test_oat_hooks/Makefile
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
M src/test/modules/test_oat_hooks/test_oat_hooks.c

Fix new Object Access hooks test

commit   : f0206d99520ebdb751469ad53ff62bbff817ab3d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 13:27:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 13:27:26 -0400    

Click here for diff

Commit 90efa2f556 caused some issues with EXEC_BACKEND builds and with  
force_parallel_mode = regress setups. For the first issue we no longer  
test if the module has been preloaded, and in fact we don't preload it,  
but simply LOAD it in the test script. For the second issue we suppress  
error messages emanating from parallel workers.  
  
Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_oat_hooks/Makefile
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
M src/test/modules/test_oat_hooks/test_oat_hooks.c
D src/test/modules/test_oat_hooks/test_oat_hooks.conf

Add missing dependency of pg_dumpall to WIN32RES.

commit   : 097786fbbb58897fec12ed9bfff3940c77b5867b    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 08:22:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 08:22:02 -0700    

Click here for diff

When cross-building to windows, or building with mingw on windows, the build  
could fail with  
  x86_64-w64-mingw32-gcc: error: win32ver.o: No such file or director  
because pg_dumpall didn't depend on WIN32RES, but it's recipe references  
it. The build nevertheless succeeded most of the time, due to  
pg_dump/pg_restore having the required dependency, causing win32ver.o to be  
built.  
  
Reported-By: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGJeekpUPWW6yCVdf9=oBAcCp86RrBivo4Y4cwazAzGPng@mail.gmail.com  
Backpatch: 10-, omission present on all live branches  

M src/bin/pg_dump/Makefile

pgstat: fix function name in comment.

commit   : ce8c978295a55912dc81f9fbcd4f9f6d35379224    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 08:15:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Mar 2022 08:15:40 -0700    

Click here for diff

Introduced in 3fa17d37716.  

M src/backend/postmaster/pgstat.c

Add a test module for Object Access hooks

commit   : 90efa2f5565d28054c30c18f6a2f17f94fdff91e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 10:27:00 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 10:27:00 -0400    

Click here for diff

This includes tests of both the newly added name type object access  
hooks and the older Oid type hooks, and provides a useful example  
of how to use the hooks.  
  
Mark Dilger, based on some code from Joshua Brindle.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/test_oat_hooks/.gitignore
A src/test/modules/test_oat_hooks/Makefile
A src/test/modules/test_oat_hooks/README
A src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
A src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
A src/test/modules/test_oat_hooks/test_oat_hooks.c
A src/test/modules/test_oat_hooks/test_oat_hooks.conf

Add String object access hooks

commit   : d11e84ea466b4e3855d7bd5142fb68f51c273567    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 09:06:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 22 Mar 2022 09:06:15 -0400    

Click here for diff

This caters for cases where the access is to an object identified by  
name rather than Oid.  
  
The first user of these is the GUC access controls  
  
Joshua Brindle and Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/objectaccess.c
M src/backend/utils/misc/guc.c
M src/include/catalog/objectaccess.h
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h

Revert "graceful shutdown" changes for Windows.

commit   : 29992a6a509b256efc4ac560a1586b51a64b2637    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2022 10:19:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 22 Mar 2022 10:19:15 -0400    

Click here for diff

This reverts commits 6051857fc and ed52c3707 in HEAD (they were already  
reverted in the back branches).  Further testing has shown that while  
those changes do fix some things, they also break others; in particular,  
it looks like walreceivers fail to detect walsender-initiated connection  
close reliably if the walsender shuts down this way.  A proper fix for  
this seems possible but won't be done in time for v15.  
  
Discussion: https://postgr.es/m/CA+hUKG+OeoETZQ=Qw5Ub5h3tmwQhBmDA=nuNO3KG=zWfUypFAw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+hUKGKkp2XkvSe9nG+bsgkXVKCdTeGSa_TR0Qx1jafc_oqCVA@mail.gmail.com  

M src/backend/libpq/pqcomm.c

Add support for security invoker views.

commit   : 7faa5fc84bf46ea6c543993cffb8be64dff60d25    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 22 Mar 2022 10:28:10 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 22 Mar 2022 10:28:10 +0000    

Click here for diff

A security invoker view checks permissions for accessing its  
underlying base relations using the privileges of the user of the  
view, rather than the privileges of the view owner. Additionally, if  
any of the base relations are tables with RLS enabled, the policies of  
the user of the view are applied, rather than those of the view owner.  
  
This allows views to be defined without giving away additional  
privileges on the underlying base relations, and matches a similar  
feature available in other database systems.  
  
It also allows views to operate more naturally with RLS, without  
affecting the assignments of policies to users.  
  
Christoph Heiss, with some additional hacking by me. Reviewed by  
Laurenz Albe and Wolfgang Walther.  
  
Discussion: https://postgr.es/m/b66dd6d6-ad3e-c6f2-8b90-47be773da240%40cybertec.at  

M doc/src/sgml/ref/alter_view.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/lock.sgml
M doc/src/sgml/rules.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/lockcmds.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/cache/relcache.c
M src/include/utils/rel.h
M src/test/regress/expected/create_view.out
M src/test/regress/expected/lock.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/lock.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/updatable_views.sql

pgcrypto: Remove internal padding implementation

commit   : f5576a21b0778f275d7418f6f7a44d9400ee90aa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Mar 2022 08:51:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Mar 2022 08:51:05 +0100    

Click here for diff

Use the padding provided by OpenSSL instead of doing it ourselves.  
The internal implementation was once applicable to the non-OpenSSL  
code paths, but those have since been removed.  The padding algorithm  
is still the same.  
  
The OpenSSL padding implementation is stricter than the previous  
internal one: Bad padding during decryption is now an error, and  
encryption without padding now requires the input size to be a  
multiple of the block size, otherwise it is also an error.  
Previously, these cases silently proceeded, in spite of the  
documentation saying otherwise.  
  
Add some test cases about this, too.  (The test cases are in  
rijndael.sql, but they apply to all encryption algorithms.)  
  
Reviewed-by: Jacob Champion <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ba94c26b-0c58-c97e-7a44-f44e08b4cca2%40enterprisedb.com  

M contrib/pgcrypto/expected/rijndael.out
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgp-cfb.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
M contrib/pgcrypto/sql/rijndael.sql

Fix failures in SSL tests caused by out-of-tree keys and certificates

commit   : 9ca234bae79358a24de2a8dc1ec8024656ca66a4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 22 Mar 2022 13:20:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 22 Mar 2022 13:20:31 +0900    

Click here for diff

This issue is environment-sensitive, where the SSL tests could fail in  
various way by feeding on defaults provided by sslcert, sslkey,  
sslrootkey, sslrootcert, sslcrl and sslcrldir coming from a local setup,  
as of ~/.postgresql/ by default.  Horiguchi-san has reported two  
failures, but more advanced testing from me (aka inclusion of garbage  
SSL configuration in ~/.postgresql/ for all the configuration  
parameters) has showed dozens of failures that can be triggered in the  
whole test suite.  
  
History has showed that we are not good when it comes to address such  
issues, fixing them locally like in dd87799, and such problems keep  
appearing.  This commit strengthens the entire test suite to put an end  
to this set of problems by embedding invalid default values in all the  
connection strings used in the tests.  The invalid values are prefixed  
in each connection string, relying on the follow-up values passed in the  
connection string to enforce any invalid value previously set.  Note  
that two tests related to CRLs are required to fail with certain pre-set  
configurations, but we can rely on enforcing an empty value instead  
after the invalid set of values.  
  
Reported-by: Kyotaro Horiguchi  
Reviewed-by: Andrew Dunstan, Daniel Gustafsson, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
backpatch-through: 10  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/003_sslinfo.pl

Add ALTER SUBSCRIPTION ... SKIP.

commit   : 208c5d65bbd60e33e272964578cb74182ac726a8    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 22 Mar 2022 07:11:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 22 Mar 2022 07:11:19 +0530    

Click here for diff

This feature allows skipping the transaction on subscriber nodes.  
  
If incoming change violates any constraint, logical replication stops  
until it's resolved. Currently, users need to either manually resolve the  
conflict by updating a subscriber-side database or by using function  
pg_replication_origin_advance() to skip the conflicting transaction. This  
commit introduces a simpler way to skip the conflicting transactions.  
  
The user can specify LSN by ALTER SUBSCRIPTION ... SKIP (lsn = XXX),  
which allows the apply worker to skip the transaction finished at  
specified LSN. The apply worker skips all data modification changes within  
the transaction.  
  
Author: Masahiko Sawada  
Reviewed-by: Takamichi Osumi, Hou Zhijie, Peter Eisentraut, Amit Kapila, Shi Yu, Vignesh C, Greg Nancarrow, Haiying Tang, Euler Taveira  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/parser/gram.y
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
D src/test/subscription/t/029_disable_on_error.pl
A src/test/subscription/t/029_on_error.pl

pgstat: reorder pgstat.[ch] contents.

commit   : 315ae75e9b6da72456eaa44e55ace9ab1b95ef74    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 16:16:42 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 16:16:42 -0700    

Click here for diff

Now that 13619598f10 has split pgstat up into multiple files it isn't quite as  
hard to come up with a sensible order for pgstat.[ch]. Inconsistent naming  
makes it still not quite right looking, but that's work for another commit.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Fix assorted missing logic for GroupingFunc nodes.

commit   : 2591ee8ec44d8cbc8e1226550337a64c684746e4    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 17:44:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 17:44:29 -0400    

Click here for diff

The planner needs to treat GroupingFunc like Aggref for many purposes,  
in particular with respect to processing of the argument expressions,  
which are not to be evaluated at runtime.  A few places hadn't gotten  
that memo, notably including subselect.c's processing of outer-level  
aggregates.  This resulted in assertion failures or wrong plans for  
cases in which a GROUPING() construct references an outer aggregation  
level.  
  
Also fix missing special cases for GroupingFunc in cost_qual_eval  
(resulting in wrong cost estimates for GROUPING(), although it's  
not clear that that would affect plan shapes in practice) and in  
ruleutils.c (resulting in excess parentheses in pretty-print mode).  
  
Per bug #17088 from Yaoguang Chen.  Back-patch to all supported  
branches.  
  
Richard Guo, Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/subselect.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

pgstat: split different types of stats into separate files.

commit   : 13619598f1080d7923454634a2570ca1bc0f2fec    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 12:02:25 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Mar 2022 12:02:25 -0700    

Click here for diff

pgstat.c is very long, and it's hard to find an order that makes sense and is  
likely to be maintained over time. Splitting the different pieces into  
separate files makes that a lot easier.  
  
With a few exceptions, this commit just moves code around. Those exceptions  
are:  
- adding file headers for new files  
- removing 'static' from functions  
- adapting pgstat_assert_is_up() to work across TUs  
- minor comment adjustments  
git diff --color-moved=dimmed-zebra is very helpful separating code movement  
from code changes.  
  
The next commit in this series will reorder pgstat.[ch] contents to be a bit  
more coherent.  
  
Earlier revisions of this patch had "global" statistics (archiver, bgwriter,  
checkpointer, replication slots, SLRU, WAL) in one file, because each seemed  
small enough. However later commits will increase their size and their  
aggregate size is not insubstantial. It also just seems easier to split each  
type of statistic into its own file.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/Makefile
A src/backend/utils/activity/pgstat_archiver.c
A src/backend/utils/activity/pgstat_bgwriter.c
A src/backend/utils/activity/pgstat_checkpointer.c
A src/backend/utils/activity/pgstat_database.c
A src/backend/utils/activity/pgstat_function.c
A src/backend/utils/activity/pgstat_relation.c
A src/backend/utils/activity/pgstat_replslot.c
A src/backend/utils/activity/pgstat_slru.c
A src/backend/utils/activity/pgstat_subscription.c
A src/backend/utils/activity/pgstat_wal.c
A src/include/utils/pgstat_internal.h

Fix bogus dependency handling for GENERATED expressions.

commit   : cb02fcb4c95bae08adaca1202c2081cfc81a28b5    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 14:58:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 14:58:49 -0400    

Click here for diff

For GENERATED columns, we record all dependencies of the generation  
expression as AUTO dependencies of the column itself.  This means  
that the generated column is silently dropped if any dependency  
is removed, even if CASCADE wasn't specified.  This is at least  
a POLA violation, but I think it's actually based on a misreading  
of the standard.  The standard does say that you can't drop a  
dependent GENERATED column in RESTRICT mode; but that's buried down  
in a subparagraph, on a different page from some pseudocode that  
makes it look like an AUTO drop is being suggested.  
  
Change this to be more like the way that we handle regular default  
expressions, ie record the dependencies as NORMAL dependencies of  
the pg_attrdef entry.  Also, make the pg_attrdef entry's dependency  
on the column itself be INTERNAL not AUTO.  That has two effects:  
  
* the column will go away, not just lose its default, if any  
dependency of the expression is dropped with CASCADE.  So we  
don't need any special mechanism to make that happen.  
  
* it provides an additional cross-check preventing someone from  
dropping the default expression without dropping the column.  
  
catversion bump because of change in the contents of pg_depend  
(which also requires a change in one information_schema view).  
  
Per bug #17439 from Kevin Humphreys.  Although this is a longstanding  
bug, it seems impractical to back-patch because of the need for  
catalog contents changes.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/information_schema.sql
M src/backend/catalog/pg_attrdef.c
M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump_sort.c
M src/include/catalog/catversion.h
M src/test/regress/expected/generated.out
M src/test/regress/sql/generated.sql

Move pg_attrdef manipulation code into new file catalog/pg_attrdef.c.

commit   : 17f3bc09284e1b529cdf524bbba709af6493f30c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 14:38:23 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 14:38:23 -0400    

Click here for diff

This is a pure refactoring commit: there isn't (I hope) any functional  
change.  
  
StoreAttrDefault and RemoveAttrDefault[ById] are moved from heap.c,  
reducing the size of that overly-large file by about 300 lines.  
I took the opportunity to trim unused #includes from heap.c, too.  
  
Two new functions for translating between a pg_attrdef OID and the  
relid/attnum of the owning column are created by extracting ad-hoc  
code from objectaddress.c.  This already removes one copy of said  
code, and a follow-on bug fix will create more callers.  
  
The only other function directly manipulating pg_attrdef is  
AttrDefaultFetch.  I judged it was better to leave that in relcache.c,  
since it shares special concerns about recursion and error handling  
with the rest of that module.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/Makefile
M src/backend/catalog/heap.c
M src/backend/catalog/objectaddress.c
A src/backend/catalog/pg_attrdef.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/include/catalog/pg_attrdef.h

Fix risk of deadlock failure while dropping a partitioned index.

commit   : 7b6ec86532c2ca585d671239bba867fe380448ed    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 12:22:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 12:22:13 -0400    

Click here for diff

DROP INDEX needs to lock the index's table before the index itself,  
else it will deadlock against ordinary queries that acquire the  
relation locks in that order.  This is correctly mechanized for  
plain indexes by RangeVarCallbackForDropRelation; but in the case of  
a partitioned index, we neglected to lock the child tables in advance  
of locking the child indexes.  We can fix that by traversing the  
inheritance tree and acquiring the needed locks in RemoveRelations,  
after we have acquired our locks on the parent partitioned table and  
index.  
  
While at it, do some refactoring to eliminate confusion between  
the actual and expected relkind in RangeVarCallbackForDropRelation.  
We can save a couple of syscache lookups too, by having that function  
pass back info that RemoveRelations will need.  
  
Back-patch to v11 where partitioned indexes were added.  
  
Jimmy Yih, Gaurab Dey, Tom Lane  
  
Discussion: https://postgr.es/m/BYAPR05MB645402330042E17D91A70C12BD5F9@BYAPR05MB6454.namprd05.prod.outlook.com  

M src/backend/commands/tablecmds.c
A src/test/isolation/expected/partition-drop-index-locking.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-drop-index-locking.spec

Remove workarounds for avoiding [U]INT64_FORMAT in translatable strings.

commit   : 1f8bc448680bf93a974cb5f52d496514ff67720c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 11:11:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Mar 2022 11:11:55 -0400    

Click here for diff

Further code simplification along the same lines as d914eb347  
and earlier patches.  
  
Aleksander Alekseev, Japin Li  
  
Discussion: https://postgr.es/m/CAJ7c6TMSKi3Xs8h5MP38XOnQQpBLazJvVxVfPn++roitDJcR7g@mail.gmail.com  

M src/backend/access/brin/brin.c
M src/backend/commands/copyfrom.c
M src/backend/commands/sequence.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_checksums/pg_checksums.c

Fix typo in file identification

commit   : c540d3715731e0e50259011ee62ea4c0c042b1b1    
  
author   : Magnus Hagander <[email protected]>    
date     : Mon, 21 Mar 2022 12:33:29 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Mon, 21 Mar 2022 12:33:29 +0200    

Click here for diff

Clearly a simple copy/paste mistake when the file was created.  

M src/backend/replication/basebackup_target.c

pgstat: separate "xact level" handling out of relation specific functions.

commit   : d4ba8b51c76300f06cc23f4d8a41d9f7210c4866    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    

Click here for diff

This is in preparation of a later commit moving relation stats handling into  
its own file.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

pgstat: rename pgstat_initstats() to pgstat_relation_init().

commit   : bff258a2732e3f8cf94010345c4ad37f8f9b5899    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    

Click here for diff

The old name was overly generic. An upcoming commit moves relation stats  
handling into its own file, making pgstat_initstats() look even more out of  
place.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/relation.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

pgstat: introduce pgstat_relation_should_count().

commit   : 8363102009d8ee64255ad4948183f9d159eb8f4b    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Mar 2022 19:12:09 -0700    

Click here for diff

A later commit will make the check more complicated than the  
current (rel)->pgstat_info != NULL. It also just seems nicer to have a central  
copy of the logic, even while still simple.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Blind fix for uninitialized memory bug in ba9a7e392171

commit   : 2d655a08d532feed356222a8b1e427561dc7a883    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 20 Mar 2022 22:10:24 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 20 Mar 2022 22:10:24 +0100    

Click here for diff

Valgrind animal skink shows a crash in this new code.  I couldn't  
reproduce the problem locally, but going by blind code inspection,  
initializing insert_destrel should be sufficient to fix the problem.  

M src/backend/executor/nodeModifyTable.c

Log regression.diffs in 027_stream_regress.pl.

commit   : a096813b6f583621db4119b6ab1be4ffc26f859d    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 21 Mar 2022 09:31:22 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 21 Mar 2022 09:31:22 +1300    

Click here for diff

To help diagnose the reasons for a regression test failure inside this  
TAP test, dump the contents of regression.diffs to the log.  While the  
CI scripts show it automatically, the build farm client does not.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLsrWbiCcMxBLRBAP6Z%3DykFRHWzdmP9YKujSKoSnEJECQ%40mail.gmail.com  

M src/test/recovery/t/027_stream_regress.pl

psql: handle tab completion of timezone names after "SET TIMEZONE TO".

commit   : 7fa3db367986160dee2b2b0bbfb61e1a51d486fd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2022 16:06:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2022 16:06:41 -0400    

Click here for diff

Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c

Enforce foreign key correctly during cross-partition updates

commit   : ba9a7e392171c83eb3332a757279e7088487f9a2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 20 Mar 2022 18:43:40 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 20 Mar 2022 18:43:40 +0100    

Click here for diff

When an update on a partitioned table referenced in foreign key  
constraints causes a row to move from one partition to another,  
the fact that the move is implemented as a delete followed by an insert  
on the target partition causes the foreign key triggers to have  
surprising behavior.  For example, a given foreign key's delete trigger  
which implements the ON DELETE CASCADE clause of that key will delete  
any referencing rows when triggered for that internal DELETE, although  
it should not, because the referenced row is simply being moved from one  
partition of the referenced root partitioned table into another, not  
being deleted from it.  
  
This commit teaches trigger.c to skip queuing such delete trigger events  
on the leaf partitions in favor of an UPDATE event fired on the root  
target relation.  Doing so is sensible because both the old and the new  
tuple "logically" belong to the root relation.  
  
The after trigger event queuing interface now allows passing the source  
and the target partitions of a particular cross-partition update when  
registering the update event for the root partitioned table.  Along with  
the two ctids of the old and the new tuple, the after trigger event now  
also stores the OIDs of those partitions. The tuples fetched from the  
source and the target partitions are converted into the root table  
format, if necessary, before they are passed to the trigger function.  
  
The implementation currently has a limitation that only the foreign keys  
pointing into the query's target relation are considered, not those of  
its sub-partitioned partitions.  That seems like a reasonable  
limitation, because it sounds rare to have distinct foreign keys  
pointing to sub-partitioned partitions instead of to the root table.  
  
This misbehavior stems from commit f56f8f8da6af (which added support for  
foreign keys to reference partitioned tables) not paying sufficient  
attention to commit 2f178441044b (which had introduced cross-partition  
updates a year earlier).  Even though the former commit goes back to  
Postgres 12, we're not backpatching this fix at this time for fear of  
destabilizing things too much, and because there are a few ABI breaks in  
it that we'd have to work around in older branches.  It also depends on  
commit f4566345cf40, which had its own share of backpatchability issues  
as well.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reported-by: Eduard Català <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqFvkBCmfwkQX_yBqv2Wz8ugUGiBDxum8=WvVbfU1TXaNg@mail.gmail.com  
Discussion: https://postgr.es/m/CAL54xNZsLwEM1XCk5yW9EqaRzsZYHuWsHQkA2L5MOSKXAwviCQ@mail.gmail.com  

M doc/src/sgml/ref/update.sgml
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/utils/adt/ri_triggers.c
M src/include/commands/trigger.h
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Doc: fix our example systemd script.

commit   : 3f513ac7935db86f72511aac24fa6b52ed29bfe7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2022 12:39:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Mar 2022 12:39:40 -0400    

Click here for diff

The example used "TimeoutSec=0", but systemd's documented way to get  
the desired effect is "TimeoutSec=infinity".  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/runtime.sgml

Fix global ICU collations for ICU < 54

commit   : 3a671e1f7cb8b29ad77b08f891b8f22621f490a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 20 Mar 2022 10:21:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 20 Mar 2022 10:21:45 +0100    

Click here for diff

createdb() didn't check for collation attributes validity, which has  
to be done explicitly on ICU < 54.  It also forgot to close the ICU collator  
opened during the check which leaks some memory.  
  
To fix both, add a new check_icu_locale() that does all the appropriate  
verification and close the ICU collator.  
  
initdb also had some partial check for ICU < 54.  To have consistent error  
reporting across major ICU versions, and get rid of the need to include ucol.h,  
remove the partial check there.  The backend will report an error if needed  
during the post-boostrap iniitialization phase.  
  
Author: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/20220319041459.qqqiqh335sga5ezj@jrouhaud  

M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/Makefile
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/include/utils/pg_locale.h
M src/test/icu/t/010_database.pl

Add a few recent and not so recent revs to git-blame-ignore-revs.

commit   : 3c0c5cc5e65906bad6abe6bb8c2d9f6669870f33    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 12:37:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 12:37:28 -0700    

Click here for diff

M .git-blame-ignore-revs

pgstat: split out WAL handling from pgstat_{initialize,report_stat}.

commit   : 78f9506b380f0cd3eb2229e2a49040ee00f102bb    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:35:37 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:35:37 -0700    

Click here for diff

A later commit will move the handling of the different kinds of stats into  
separate files.  By splitting out WAL handling in this commit that later move  
will just move code around without other changes.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

pgstat: split relation, database handling out of pgstat_report_stat().

commit   : 89c546c2948904a2c811ccb26d92fb54edaf7821    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    

Click here for diff

pgstat_report_stat() handles several types of stats, yet relation stats have  
so far been handled directly in pgstat_report_stat().  
  
A later commit will move the handling of the different kinds of stats into  
separate files.  By splitting out relation handling in this commit that later  
move will just move code around without other changes.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

pgstat: run pgindent on pgstat.c/h.

commit   : a3a75b982b5bb6fba95ad8b3d48e70439dcd2329    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    

Click here for diff

Upcoming commits will touch a lot of the pgstats code. Reindenting separately  
makes it easier to keep the code in a well-formatted shape each step.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

ci: windows: Use CIRRUS_ESCAPING_PROCESSES, revert 770011e3f39.

commit   : 50b1e8c51b3c779bdfce5cd61bf4bbc80fd48377    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Mar 2022 11:32:18 -0700    

Click here for diff

cirrus-ci now defaults to killing processes still running at the end of a  
script. Unfortunately we start postgres in the background, which seems  
nontrivial to fix. Previously we worked around that in 770011e3f39 by using an  
older agent version, but now that CIRRUS_ESCAPING_PROCESSES we should use that.  
  
This reverts commit 770011e3f39f21f2095d3a044b72460c4efac345 "ci: windows:  
Work around cirrus-ci bug causing test failures.  
  
Discussion: https://postgr.es/m/CA+hUKGKx7k14n2nAALSvv6M_AB6oHasNBA65X6Dvo8hwfi9y0A@mail.gmail.com  

M .cirrus.yml

Fix an outdated and grammatically wrong comment

commit   : a1fc50672c4b410f6a75db1efe807efeaccf571c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2022 19:31:38 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 19 Mar 2022 19:31:38 +0100    

Click here for diff

Authored by Amit Langote and myself independently  
Discussion: https://postgr.es/m/CA+HiwqGCjcH0gG-=tM7hhP7TEDmzrHMHJbPGSHtHgFmx9mnFkg@mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Improve handling of SET ACCESS METHOD for ALTER MATERIALIZED VIEW

commit   : eb8399cf1f3dd8ad02633e3bb84e2289d2debb44    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 19:13:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 19:13:52 +0900    

Click here for diff

b048326 has added support for SET ACCESS METHOD in ALTER TABLE, but it  
has missed a few things for materialized views:  
- No documentation for this clause on the ALTER MATERIALIZED VIEW page.  
- psql tab completion missing.  
- No regression tests.  
  
This commit closes the gap on all the points listed above.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_materialized_view.sgml
M src/bin/psql/tab-complete.c
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

Add regression tests for ALTER MATERIALIZED VIEW with tablespaces

commit   : ade2159bcdc18939d4e9b1773d12fe06cfcd201d    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 17:28:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 17:28:50 +0900    

Click here for diff

The clauses SET TABLESPACE and ALL IN TABLESPACE are supported in ALTER  
MATERIALIZED VIEW for a long time, and they behave mostly like ALTER  
TABLE by reusing the same code paths, but there were zero tests for  
them.  This commit closes the gap with new tests in tablespace.sql.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/tablespace.out
M src/test/regress/sql/tablespace.sql

doc: Mention SET TABLESPACE clause for ALTER MATERIALIZED VIEW

commit   : 9616da3ddbc14de43c34676f92aa061dad8caefb    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 16:37:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Mar 2022 16:37:31 +0900    

Click here for diff

This command flavor is supported, but there was nothing in the  
documentation about it.  
  
Author: Yugo Nagata  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/ref/alter_materialized_view.sgml

Silence -Wmaybe-uninitialized compiler warning in dbcommands.c.

commit   : 97bddda61b9ae1a33116c8596c48d9dc095597a5    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 18:48:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 18:48:03 -0700    

Click here for diff

Introduced in f2553d43060e. See also 3f6b3be39ca9, which did so for nearby  
variables.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c

Close race condition in slot_creation_error.spec.

commit   : e186f56f9c6ead4ef65848ae6c499f9949b12625    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 18 Mar 2022 18:18:00 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 18 Mar 2022 18:18:00 -0700    

Click here for diff

Use the pattern from detach-partition-concurrently-3.spec.  Per  
buildfarm member wrasse.  
  
Reviewed by Kyotaro Horiguchi and Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot_creation_error.out
M contrib/test_decoding/specs/slot_creation_error.spec

ci: compile with -Og where applicable.

commit   : 4a288a37f9b7bfd13c4f5cd8b545ac856f975813    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 15:42:33 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 15:42:33 -0700    

Click here for diff

To improve performance of check-world, and improve debugging, without  
significantly slower builds (they're cached anyway).  
  
This makes freebsd check-world run in 8.5 minutes rather than 15 minutes.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: include hints how to install OS packages.

commit   : 225fb558cd42fe05b5ac55b7586cc1d16fd2f0ea    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 15:42:02 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 18 Mar 2022 15:42:02 -0700    

Click here for diff

This is useful for patches during development, but once a feature is merged,  
new libraries should be added to the OS image files, rather than installed  
during every CI run forever into the future.  
  
Author: Justin Pryzby <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Fix incorrect xmlschema output for types timetz and timestamptz.

commit   : 068739fb4f345c8c922d72f2c8e15e9c0a75056d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 16:01:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 16:01:42 -0400    

Click here for diff

The output of table_to_xmlschema() and allied functions includes  
a regex describing valid values for these types ... but the regex  
was itself invalid, as it failed to escape a literal "+" sign.  
  
Report and fix by Renan Soares Lopes.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xmlmap.out
M src/test/regress/expected/xmlmap_1.out
M src/test/regress/sql/xmlmap.sql

Specify database encoding in new ICU test.

commit   : 0d3aaadd324e0566820c863d4617eb4fc949d220    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:26:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:26:04 -0400    

Click here for diff

Otherwise, the database encoding varies depending on the user's  
environment, and so the test might fail depending on whether ICU  
likes the encoding.  In particular, the test fails completely  
if the prevailing locale is C.  

M src/test/icu/t/010_database.pl

Doc: remove bogus instruction to install contrib/hstore.

commit   : 9eaef6f8ea951320eae0c0083b07d901fe9bd3e5    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:21:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:21:47 -0400    

Click here for diff

This test suite does not use hstore.  Looks like this text  
was copied-and-pasted from src/test/subscription/README.  

M src/test/icu/README

Remove workarounds for avoiding [U]INT64_FORMAT in translatable strings.

commit   : d914eb347fcd7554a7afda5efaa709582f64f660    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:10:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Mar 2022 13:10:04 -0400    

Click here for diff

Update pg_backup_tar.c along the same lines as 62aa2bb29 and  
other previous cleanup: we can now rely on %lld or %llu as long  
as we explicitly cast to long long or unsigned long long.  
  
Japin Li  
  
Discussion: https://postgr.es/m/MEYP282MB16694F7CC1B119B4ECDD8CBEB6139@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/bin/pg_dump/pg_backup_tar.c

Add circular WAL decoding buffer, take II.

commit   : 3f1ce973467a0d285961bf2f99b11d06e264e2c1    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 18 Mar 2022 17:45:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 18 Mar 2022 17:45:04 +1300    

Click here for diff

Teach xlogreader.c to decode the WAL into a circular buffer.  This will  
support optimizations based on looking ahead, to follow in a later  
commit.  
  
 * XLogReadRecord() works as before, decoding records one by one, and  
   allowing them to be examined via the traditional XLogRecGetXXX()  
   macros and certain traditional members like xlogreader->ReadRecPtr.  
  
 * An alternative new interface XLogReadAhead()/XLogNextRecord() is  
   added that returns pointers to DecodedXLogRecord objects so that it's  
   now possible to look ahead in the WAL stream while replaying.  
  
 * In order to be able to use the new interface effectively while  
   streaming data, support is added for the page_read() callback to  
   respond to a new nonblocking mode with XLREAD_WOULDBLOCK instead of  
   waiting for more data to arrive.  
  
No direct user of the new interface is included in this commit, though  
XLogReadRecord() uses it internally.  Existing code doesn't need to  
change, except in a few places where it was accessing reader internals  
directly and now needs to go through accessor macros.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Andres Freund <[email protected]> (earlier versions)  
Discussion: https://postgr.es/m/CA+hUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq=AovOddfHpA@mail.gmail.com  

M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/decode.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h
M src/tools/pgindent/typedefs.list

doc: Remove mention to in-place tablespaces for pg_tablespace_location()

commit   : 7a7cd84893e02e79d4b5e2d72b4ae327b031b217    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Mar 2022 10:46:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Mar 2022 10:46:36 +0900    

Click here for diff

This paragraph has been added in the documentation by f6f0db4, but after  
more discussion we found that this just makes things more confusing,  
adding some cross-references between a general feature and something  
only aimed at being used by developers.  The original documentation is  
not wrong either, and this commit brings back this part of the docs to  
the same state as before f6f0db4.  
  
Per discussion with Kyotaro Horiguchi and Thomas Munro.  
  
Discussion: https://postgr.es/m/CA+hUKGL2uaRKu=3+bMBpejHh4k7wqzWC05aiasTsSsHGRCWa8g@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix header inclusion order in pg_receivewal.c

commit   : f512efb2d50ab78e7610f0e3801925f22ebec611    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 18 Mar 2022 10:38:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 18 Mar 2022 10:38:16 +0900    

Click here for diff

lz4frame.h was getting declared after the headers specific to Postgres,  
but it needs to be included between postgres_fe.h and the internal  
headers.  
  
Issue introduced by babbbb5.  
  
Reported-by: Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_receivewal.c

Declare aarch64 has single copy atomicity for 8 byte values.

commit   : b2397aae23982b77de29d3a55b263a03852d0714    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 18 Mar 2022 13:40:26 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 18 Mar 2022 13:40:26 +1300    

Click here for diff

Architecture Reference Manual for ARMv8 B2.2.1 [1]  
  
For explicit memory effects generated from an Exception level the  
following rules apply:  
- A read that is generated by a load instruction that loads a single  
general-purpose register and is aligned to the size of the read in the  
instruction is single-copy atomic.  
- A write that is generated by a store instruction that stores a single  
general-purpose register and is aligned to the size of the write in the  
instruction is single-copy atomic.  
  
[1] https://documentation-service.arm.com/static/61fbe8f4fa8173727a1b734e  
https://developer.arm.com/documentation/ddi0487/latest  
  
Author: Yura Sokolov <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Alexander Korotkov <[email protected]>  
Discussion: https://postgr.es/m/f7f3f0febe27862711f924a7b0f39e065e547f4b.camel%40postgrespro.ru  
Discussion: https://postgr.es/m/CA%2BhUKGKyJf7kwYkqDgzTE26Ra1m9nvM%3Deds2RSSu7WSL-r2wKw%40mail.gmail.com  

M src/include/port/atomics/arch-arm.h

Don't bother to attach column name lists to RowExprs of named types.

commit   : d7b5c071dd6af2b81a7042dc60295061c7230cdc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2022 18:25:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2022 18:25:44 -0400    

Click here for diff

If a RowExpr is marked as returning a named composite type, we aren't  
going to consult its colnames list; we'll use the attribute names  
shown for the type in pg_attribute.  Hence, skip storing that list,  
to save a few nanoseconds when copying the expression tree around.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/var.c
M src/backend/rewrite/rewriteManip.c
M src/include/nodes/primnodes.h

Revert applying column aliases to the output of whole-row Vars.

commit   : ec62cb0aac5ba31a82339606009ddbd7eb00e2ac    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2022 18:18:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Mar 2022 18:18:05 -0400    

Click here for diff

In commit bf7ca1587, I had the bright idea that we could make the  
result of a whole-row Var (that is, foo.*) track any column aliases  
that had been applied to the FROM entry the Var refers to.  However,  
that's not terribly logically consistent, because now the output of  
the Var is no longer of the named composite type that the Var claims  
to emit.  bf7ca1587 tried to handle that by changing the output  
tuple values to be labeled with a blessed RECORD type, but that's  
really pretty disastrous: we can wind up storing such tuples onto  
disk, whereupon they're not readable by other sessions.  
  
The only practical fix I can see is to give up on what bf7ca1587  
tried to do, and say that the column names of tuples produced by  
a whole-row Var are always those of the underlying named composite  
type, query aliases or no.  While this introduces some inconsistencies,  
it removes others, so it's not that awful in the abstract.  What *is*  
kind of awful is to make such a behavioral change in a back-patched  
bug fix.  But corrupt data is worse, so back-patched it will be.  
  
(A workaround available to anyone who's unhappy about this is to  
introduce an extra level of sub-SELECT, so that the whole-row Var is  
referring to the sub-SELECT's output and not to a named table type.  
Then the Var is of type RECORD to begin with and there's no issue.)  
  
Per report from Miles Delahunty.  The faulty commit dates to 9.5,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execTuples.c
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/rowtypes.sql

Refactor code for reading and writing relation map files.

commit   : 39f0c4bd670c3482f4def87a31108c175da0a8d3    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2022 13:21:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Mar 2022 13:21:07 -0400    

Click here for diff

Restructure things so that the functions which update the global  
variables shared_map and local_map are separate from the functions  
which just read and write relation map files without touching any  
global variables.  
  
In the new structure of things, write_relmap_file() writes a relmap  
file but no longer performs global variable updates. A symmetric  
function read_relmap_file() that just reads a file without changing  
any global variables is added, and load_relmap_file(), which does  
change the global variables, uses it as a subroutine.  
  
Because write_relmap_file() no longer updates shared_map and  
local_map, that logic is moved to perform_relmap_update(). However,  
no similar logic is added to relmap_redo() even though it also calls  
write_relmap_file(). That's because recovery must not rely on the  
contents of the relation map, and therefore there is no need to  
initialize it. In fact, doing so seems like a mistake, because we  
might then manage to rely on the in-memory map where we shouldn't.  
  
Patch by me, based on earlier work by Dilip Kumar. Reviewed by  
Ashutosh Sharma.  
  
Discussion: http://postgr.es/m/CA+TgmobQLgrt4AXsc0ru7aFFkzv=9fS-Q_yO69=k9WY67RCctg@mail.gmail.com  

M src/backend/utils/cache/relmapper.c

Fix row filters with multiple publications

commit   : 5a079662256e381fde699c4fbbed6c2504a6d30a    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 17 Mar 2022 17:03:45 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 17 Mar 2022 17:03:45 +0100    

Click here for diff

When publishing changes through a artition root, we should use the row  
filter for the top-most ancestor. The relation may be added to multiple  
publications, using different ancestors, and 52e4f0cd47 handled this  
incorrectly. With c91f71b9dc we find the correct top-most ancestor, but  
the code tried to fetch the row filter from all publications, including  
those using a different ancestor etc. No row filter can be found for  
such publications, which was treated as replicating all rows.  
  
Similarly to c91f71b9dc, this seems to be a rare issue in practice. It  
requires multiple publications including the same partitioned relation,  
through different ancestors.  
  
Fixed by only passing publications containing the top-most ancestor to  
pgoutput_row_filter_init(), so that treating a missing row filter as  
replicating all rows is correct.  
  
Report and fix by me, test case by Hou zj. Reviews and improvements by  
Amit Kapila.  
  
Author: Tomas Vondra, Hou zj, Amit Kapila  
Reviewed-by: Amit Kapila, Hou zj  
Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com  

M src/backend/replication/pgoutput/pgoutput.c
M src/test/subscription/t/028_row_filter.pl

doc: Add documentation for new field pg_database.daticulocale

commit   : a9b7e92084cdea1bd397ec26c3233206932f29c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Mar 2022 14:12:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Mar 2022 14:12:03 +0100    

Click here for diff

forgotten in f2553d43060edb210b36c63187d52a632448e1d2  
  
Author: Shinoda, Noriyoshi (PN Japan FSIP) <[email protected]>  

M doc/src/sgml/catalogs.sgml

Split ExecUpdate and ExecDelete into reusable pieces

commit   : 25e777cf8e547d7423d2e1e9da71f98b9414d59e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2022 11:47:04 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 17 Mar 2022 11:47:04 +0100    

Click here for diff

Create subroutines ExecUpdatePrologue / ExecUpdateAct /  
ExecUpdateEpilogue, and similar for ExecDelete.  
  
Introduce a new struct to be used internally in nodeModifyTable.c,  
dubbed ModifyTableContext, which contains all context information needed  
to perform these operations, as well as ExecInsert and others.  
  
This allows using a different schedule and a different way of evaluating  
the results of these operations, which can be exploited by a later  
commit introducing support for MERGE.  It also makes ExecUpdate and  
ExecDelete proper shorter and (hopefully) simpler.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Amit Langote <[email protected]>  
Reviewed-by: Japin Li <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c
M src/tools/pgindent/typedefs.list

Add option to use ICU as global locale provider

commit   : f2553d43060edb210b36c63187d52a632448e1d2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 17 Mar 2022 11:11:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 17 Mar 2022 11:11:21 +0100    

Click here for diff

This adds the option to use ICU as the default locale provider for  
either the whole cluster or a database.  New options for initdb,  
createdb, and CREATE DATABASE are used to select this.  
  
Since some (legacy) code still uses the libc locale facilities  
directly, we still need to set the libc global locale settings even if  
ICU is otherwise selected.  So pg_database now has three  
locale-related fields: the existing datcollate and datctype, which are  
always set, and a new daticulocale, which is only set if ICU is  
selected.  A similar change is made in pg_collation for consistency,  
but in that case, only the libc-related fields or the ICU-related  
field is set, never both.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5e756dd6-0e91-d778-96fd-b1bcb06c161a%402ndquadrant.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M doc/src/sgml/ref/initdb.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/bin/initdb/Makefile
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/Makefile
M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/utils/pg_locale.h
M src/test/Makefile
A src/test/icu/.gitignore
A src/test/icu/Makefile
A src/test/icu/README
A src/test/icu/t/010_database.pl
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Fix pg_tablespace_location() with in-place tablespaces

commit   : f6f0db4d62400ff88f523dcc4d7e25f9506bc0d8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 17 Mar 2022 11:25:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 17 Mar 2022 11:25:02 +0900    

Click here for diff

Using this system function with an in-place tablespace (created when  
allow_in_place_tablespaces is enabled by specifying an empty string as  
location) caused a failure when using readlink(), as the tablespace is,  
in this case, not a symbolic link in pg_tblspc/ but a directory.  
  
Rather than getting a failure, the commit changes  
pg_tablespace_location() so as a relative path to the data directory is  
returned for in-place tablespaces, to make a difference between  
tablespaces created when allow_in_place_tablespaces is enabled or not.  
Getting a path rather than an empty string that would match the CREATE  
TABLESPACE command in this case is more useful for tests that would like  
to rely on this function.  
  
While on it, a regression test is added for this case.  This is simple  
to add in the main regression test suite thanks to regexp_replace() to  
mask the part of the tablespace location dependent on its OID.  
  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi, Thomas Munro  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/misc.c
M src/test/regress/expected/tablespace.out
M src/test/regress/sql/tablespace.sql

Fix publish_as_relid with multiple publications

commit   : c91f71b9dc91ef95e1d50d6d782f477258374fc6    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 16 Mar 2022 16:42:47 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 16 Mar 2022 16:42:47 +0100    

Click here for diff

Commit 83fd4532a7 allowed publishing of changes via ancestors, for  
publications defined with publish_via_partition_root. But the way  
the ancestor was determined in get_rel_sync_entry() was incorrect,  
simply updating the same variable. So with multiple publications,  
replicating different ancestors, the outcome depended on the order  
of publications in the list - the value from the last loop was used,  
even if it wasn't the top-most ancestor.  
  
This is a probably rare situation, as in most cases publications do  
not overlap, so each partition has exactly one candidate ancestor  
to replicate as and there's no ambiguity.  
  
Fixed by tracking the "ancestor level" for each publication, and  
picking the top-most ancestor. Adds a test case, verifying the  
correct ancestor is used for publishing the changes and that this  
does not depend on order of publications in the list.  
  
Older releases have another bug in this loop - once all actions are  
replicated, the loop is terminated, on the assumption that inspecting  
additional publications is unecessary. But that misses the fact that  
those additional applications may replicate different ancestors.  
  
Fixed by removal of this break condition. We might still terminate the  
loop in some cases (e.g. when replicating all actions and the ancestor  
is the partition root).  
  
Backpatch to 13, where publish_via_partition_root was introduced.  
  
Initial report and fix by me, test added by Hou zj. Reviews and  
improvements by Amit Kapila.  
  
Author: Tomas Vondra, Hou zj, Amit Kapila  
Reviewed-by: Amit Kapila, Hou zj  
Discussion: https://postgr.es/m/d26d24dd-2fab-3c48-0162-2b7f84a9c893%40enterprisedb.com  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/catalog/pg_publication.h
M src/test/subscription/t/013_partition.pl

Suppress compiler warnings.

commit   : d0083c1d2a21f2e5c8f341891cca4fad5a616758    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2022 09:26:48 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 16 Mar 2022 09:26:48 -0400    

Click here for diff

Michael Paquier  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/replication/basebackup_target.c

doc: Ensure intermediate path creation with mkdir

commit   : 3ac577b912fb869f8c472c66f9bd60db833a103a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Mar 2022 11:38:29 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 16 Mar 2022 11:38:29 +0100    

Click here for diff

The mkdir command in the Installation from Source Short Version docs  
didn't use the -p intermediate path creation parameter which likely  
would cause the command to fail.  At the time of writing, -p wasn't  
universally available but it can now be relied upon existing. The -p  
parameter is defined by POSIX, at least since posix-2004.  
  
Reported-by: Daniel Westermann <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/ZR0P278MB0920263E7F2D546A33E50079D20E9@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/installation.sgml

Fix default signature length for gist_ltree_ops

commit   : 7e74aafc4335e743199c6c68ca9dd539053db9e5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 16 Mar 2022 11:41:18 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 16 Mar 2022 11:41:18 +0300    

Click here for diff

911e702077 implemented operator class parameters including the signature length  
in ltree.  Previously, the signature length for gist_ltree_ops was 8.  Because  
of bug 911e702077 the default signature length for gist_ltree_ops became 28 for  
ltree 1.1 (where options method is NOT provided) and 8 for ltree 1.2 (where  
options method is provided).  This commit changes the default signature length  
for ltree 1.1 to 8.  
  
Existing gist_ltree_ops indexes might be corrupted in various scenarios.  
Thus, we have to recommend reindexing all the gist_ltree_ops indexes after  
the upgrade.  
  
Reported-by: Victor Yegorov  
Reviewed-by: Tomas Vondra, Tom Lane, Andres Freund, Nikita Glukhov  
Reviewed-by: Andrew Dunstan  
Author: Tomas Vondra, Alexander Korotkov  
Discussion: https://postgr.es/m/17406-71e02820ae79bb40%40postgresql.org  
Discussion: https://postgr.es/m/d80e0a55-6c3e-5b26-53e3-3c4f973f737c%40enterprisedb.com  

M contrib/ltree/ltree.h
M contrib/ltree/ltree_gist.c

Fix race between DROP TABLESPACE and checkpointing.

commit   : 46d9bfb0a68f7b145199711d2fb5d37561c4a130    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 17:20:24 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 17:20:24 +1300    

Click here for diff

Commands like ALTER TABLE SET TABLESPACE may leave files for the next  
checkpoint to clean up.  If such files are not removed by the time DROP  
TABLESPACE is called, we request a checkpoint so that they are deleted.  
However, there is presently a window before checkpoint start where new  
unlink requests won't be scheduled until the following checkpoint.  This  
means that the checkpoint forced by DROP TABLESPACE might not remove the  
files we expect it to remove, and the following ERROR will be emitted:  
  
	ERROR:  tablespace "mytblspc" is not empty  
  
To fix, add a call to AbsorbSyncRequests() just before advancing the  
unlink cycle counter.  This ensures that any unlink requests forwarded  
prior to checkpoint start (i.e., when ckpt_started is incremented) will  
be processed by the current checkpoint.  Since AbsorbSyncRequests()  
performs memory allocations, it cannot be called within a critical  
section, so we also need to move SyncPreCheckpoint() to before  
CreateCheckPoint()'s critical section.  
  
This is an old bug, so back-patch to all supported versions.  
  
Author: Nathan Bossart <[email protected]>  
Reported-by: Nathan Bossart <[email protected]>  
Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220215235845.GA2665318%40nathanxps13  

M src/backend/access/transam/xlog.c
M src/backend/storage/sync/sync.c

pageinspect: Fix memory context allocation of page in brin_revmap_data()

commit   : 4477dcb207c23f808737a5059157a085212f55e9    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Mar 2022 12:29:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Mar 2022 12:29:39 +0900    

Click here for diff

This caused the function to fail, as the aligned copy of the raw page  
given by the function caller was not saved in the correct memory  
context, which needs to be multi_call_memory_ctx in this case.  
  
Issue introduced by 076f4d9.  
  
Per buildfarm members sifika, mylodon and longfin.  I have reproduced  
that locally with macos.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M contrib/pageinspect/brinfuncs.c

Fix documentation typo in commit 5e6368b4.

commit   : 501c66c81b755583fa516c88e1cc7c760dc88bd5    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 15:53:28 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 15:53:28 +1300    

Click here for diff

Back-patch to 14.  

M doc/src/sgml/monitoring.sgml

Fix waiting in RegisterSyncRequest().

commit   : 3390ef1b7be28eac24dd95af23a4a287e6e7b1a4    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 15:35:16 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 15:35:16 +1300    

Click here for diff

If we run out of space in the checkpointer sync request queue (which is  
hopefully rare on real systems, but common with very small buffer pool),  
we wait for it to drain.  While waiting, we should report that as a wait  
event so that users know what is going on, and also handle postmaster  
death, since otherwise the loop might never terminate if the  
checkpointer has exited.  
  
Back-patch to 12.  Although the problem exists in earlier releases too,  
the code is structured differently before 12 so I haven't gone any  
further for now, in the absence of field complaints.  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/sync/sync.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

pageinspect: Fix handling of page sizes and AM types

commit   : 076f4d9539e9687d68ada32353c0c16d9bfa3cfb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Mar 2022 11:19:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Mar 2022 11:19:39 +0900    

Click here for diff

This commit fixes a set of issues related to the use of the SQL  
functions in this module when the caller is able to pass down raw page  
data as input argument:  
- The page size check was fuzzy in a couple of places, sometimes  
looking after only a sub-range, but what we are looking for is an exact  
match on BLCKSZ.  After considering a few options here, I have settled  
down to do a generalization of get_page_from_raw().  Most of the SQL  
functions already used that, and this is not strictly required if not  
accessing an 8-byte-wide value from a raw page, but this feels safer in  
the long run for alignment-picky environment, particularly if a code  
path begins to access such values.  This also reduces the number of  
strings that need to be translated.  
- The BRIN function brin_page_items() uses a Relation but it did not  
check the access method of the opened index, potentially leading to  
crashes.  All the other functions in need of a Relation already did  
that.  
- Some code paths could fail on elog(), but we should to use ereport()  
for failures that can be triggered by the user.  
  
Tests are added to stress all the cases that are fixed as of this  
commit, with some junk raw pages (\set VERBOSITY ensures that this works  
across all page sizes) and unexpected index types when functions open  
relations.  
  
Author: Michael Paquier, Justin Prysby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/expected/gin.out
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/brin.sql
M contrib/pageinspect/sql/btree.sql
M contrib/pageinspect/sql/gin.sql
M contrib/pageinspect/sql/gist.sql
M contrib/pageinspect/sql/hash.sql
M contrib/pageinspect/sql/page.sql

Wake up for latches in CheckpointWriteDelay().

commit   : 5e6368b42ee6d4b59e085301ca7b0e50f37a897b    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 13:37:58 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 13:37:58 +1300    

Click here for diff

The checkpointer shouldn't ignore its latch.  Other backends may be  
waiting for it to drain the request queue.  Hopefully real systems don't  
have a full queue often, but the condition is reached easily when  
shared_buffers is small.  
  
This involves defining a new wait event, which will appear in the  
pg_stat_activity view often due to spread checkpoints.  
  
Back-patch only to 14.  Even though the problem exists in earlier  
branches too, it's hard to hit there.  In 14 we stopped using signal  
handlers for latches on Linux, *BSD and macOS, which were previously  
hiding this problem by interrupting the sleep (though not reliably, as  
the signal could arrive before the sleep begins; precisely the problem  
latches address).  
  
Reported-by: Andres Freund <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/20220226213942.nb7uvb2pamyu26dj%40alap3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/checkpointer.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

Silence LLVM 14 API deprecation warnings.

commit   : a56e7b66010f330782243de9e25ac2a6596be0e1    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 10:30:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 16 Mar 2022 10:30:55 +1300    

Click here for diff

We are going to need to handle the upcoming opaque pointer API  
changes[1], possibly in time for LLVM 15, but in the meantime let's  
silence the warnings produced by LLVM 14.  
  
[1] https://llvm.org/docs/OpaquePointers.html  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2Bp%3DfaBQR2PSAqWoWa%2B_tJdKPT0wjZPQe7XcDEttUCgdQ%40mail.gmail.com  

M src/backend/jit/llvm/Makefile

Remove accidentally-committed file.

commit   : 8ef1fa3ee05d7acfe3f69d28daabec33db84d870    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:41:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:41:36 -0400    

Click here for diff

D src/backend/replication/Makefile.orig

Add 'basebackup_to_shell' contrib module.

commit   : c6306db24bd913375f99494e38ab315befe44e11    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:24:23 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:24:23 -0400    

Click here for diff

As a demonstration of the sort of thing that can be done by adding a  
custom backup target, this defines a 'shell' target which executes a  
command defined by the system administrator. The command is executed  
once for each tar archive generate by the backup and once for the  
backup manifest, if any. Each time the command is executed, it  
receives the contents of th file for which it is executed via standard  
input.  
  
The configured command can use %f to refer to the name of the archive  
(e.g. base.tar, $TABLESPACE_OID.tar, backup_manifest) and %d to refer  
to the target detail (pg_basebackup --target shell:DETAIL). A target  
detail is required if %d appears in the configured command and  
forbidden if it does not.  
  
Patch by me, reviewed by Abhijit Menon-Sen.  
  
Discussion: http://postgr.es/m/CA+TgmoaqvdT-u3nt+_kkZ7bgDAyqDB0i-+XOMmr5JN2Rd37hxw@mail.gmail.com  

M contrib/Makefile
A contrib/basebackup_to_shell/Makefile
A contrib/basebackup_to_shell/basebackup_to_shell.c
A doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml

Allow extensions to add new backup targets.

commit   : e4ba69f3f4a1b997aa493cc02e563a91c0f35b87    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:22:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:22:04 -0400    

Click here for diff

Commit 3500ccc39b0dadd1068a03938e4b8ff562587ccc allowed for base backup  
targets, meaning that we could do something with the backup other than  
send it to the client, but all of those targets had to be baked in to  
the core code. This commit makes it possible for extensions to define  
additional backup targets.  
  
Patch by me, reviewed by Abhijit Menon-Sen.  
  
Discussion: http://postgr.es/m/CA+TgmoaqvdT-u3nt+_kkZ7bgDAyqDB0i-+XOMmr5JN2Rd37hxw@mail.gmail.com  

M src/backend/replication/Makefile
A src/backend/replication/Makefile.orig
M src/backend/replication/basebackup.c
A src/backend/replication/basebackup_target.c
A src/include/replication/basebackup_target.h

Change HAVE_LIBLZ4 and HAVE_LIBZSTD tests to USE_LZ4 and USE_ZSTD.

commit   : 75eae090876f4d47bf6a1e1016627b75da612307    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:06:25 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 15 Mar 2022 13:06:25 -0400    

Click here for diff

These tests were added recently, but older code tests USE_LZ4 rathr  
than HAVE_LIBLZ4, so let's follow the established precedent. It  
also seems more consistent with the intent of the configure tests,  
since I think that the USE_* symbols are intended to correspond to  
what the user requested, and the HAVE_* symbols to what configure  
found while probing.  
  
Discussion: http://postgr.es/m/CA+Tgmoap+hTD2-QNPJLH4tffeFE8MX5+xkbFKMU3FKBy=ZSNKA@mail.gmail.com  

M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl

Fix compiler warning introduced in commit 705e20f855.

commit   : 695f459f1713303ba33b76eeb866c6501dff6380    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 15 Mar 2022 08:11:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 15 Mar 2022 08:11:17 +0530    

Click here for diff

Reported-by: Nathan Bossart  
Author: Nathan Bossart  
Reviewed-by: Osumi Takamichi  
Discussion : https://postgr.es/m/20220314230424.GA1085716@nathanxps13  

M src/backend/replication/logical/worker.c

Fix collection of typos in the code and the documentation

commit   : 6bdf1a1400d3fb8c87e020be943942dcab7e75e2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 15 Mar 2022 11:29:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 15 Mar 2022 11:29:23 +0900    

Click here for diff

Some words were duplicated while other places were grammatically  
incorrect, including one variable name in the code.  
  
Author: Otto Kekalainen, Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M config/pkg.m4
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/sql/gist.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/access/heap/pruneheap.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/index.c
M src/backend/commands/explain.c
M src/backend/main/main.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/basebackup_sink.c
M src/backend/utils/adt/tsrank.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pgbench/pgbench.c
M src/include/libpq/sasl.h
M src/interfaces/libpq/t/001_uri.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/expected/create_function_sql.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/sql/create_function_sql.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/object_address.sql
M src/test/subscription/t/001_rep_changes.pl

Add more regression tests for pg_ls_dir()

commit   : ff8b37ba801073b4506f670317141785bab9f4d8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 15 Mar 2022 10:52:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 15 Mar 2022 10:52:19 +0900    

Click here for diff

This system function was being triggered once in the main regression  
test suite to check its SRF configuration, and more in other test  
modules but nothing checked the behavior of the options missing_ok and  
include_dot_dirs.  This commit adds some tests for both options, to  
avoid mistakes if this code is manipulated in the future.  
  
Extracted from a larger patch by the same author, with a few tweaks by  
me.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Fix pg_basebackup with in-place tablespaces.

commit   : c6f2f01611d4f2c412e92eb7893f76fa590818e8    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 15 Mar 2022 13:38:41 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 15 Mar 2022 13:38:41 +1300    

Click here for diff

Previously, pg_basebackup from a cluster that contained an 'in-place'  
tablespace, as introduced by commit 7170f215, would produce a harmless  
warning on Unix and fail completely on Windows.  
  
Reported-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/20220304.165449.1200020258723305904.horikyota.ntt%40gmail.com  

M src/backend/access/transam/xlog.c

Support "of", "tzh", and "tzm" format codes.

commit   : 9dde82899cdf48bd7b2f3d83e4f724ac9ae02c79    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2022 16:46:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 14 Mar 2022 16:46:46 -0400    

Click here for diff

The upper case versions "OF", "TZH", and "TZM" are already supported,  
and all other format codes that are supported in upper case are also  
supported in lower case, so we should support these as well for  
consistency.  
  
Nitin Jadhav, with a tiny cosmetic change by me. Reviewed by Suraj  
Kharage and David Zhang.  
  
Discussion: http://postgr.es/m/CAMm1aWZ-oZyKd75+8D=VJ0sAoSwtdXWLP-MAWD4D8R1Dgandzw@mail.gmail.com  

M src/backend/utils/adt/formatting.c
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamptz.sql

Optionally disable subscriptions on error.

commit   : 705e20f8550c0e8e47c0b6b20b5f5ffd6ffd9e33    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 14 Mar 2022 09:32:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 14 Mar 2022 09:32:40 +0530    

Click here for diff

Logical replication apply workers for a subscription can easily get stuck  
in an infinite loop of attempting to apply a change, triggering an error  
(such as a constraint violation), exiting with the error written to the  
subscription server log, and restarting.  
  
To partially remedy the situation, this patch adds a new subscription  
option named 'disable_on_error'. To be consistent with old behavior, this  
option defaults to false. When true, both the tablesync worker and apply  
worker catch any errors thrown and disable the subscription in order to  
break the loop. The error is still also written in the logs.  
  
Once the subscription is disabled, users can either manually resolve the  
conflict/error or skip the conflicting transaction by using  
pg_replication_origin_advance() function. After resolving the conflict,  
users need to enable the subscription to allow apply process to proceed.  
  
Author: Osumi Takamichi and Mark Dilger  
Reviewed-by: Greg Nancarrow, Vignesh C, Amit Kapila, Wang wei, Tang Haiying, Peter Smith, Masahiko Sawada, Shi Yu  
Discussion : https://postgr.es/m/DB35438F-9356-4841-89A0-412709EBD3AB%40enterprisedb.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
A src/test/subscription/t/029_disable_on_error.pl

Fix bogus tab-completion queries.

commit   : 369398ed886dc13956654777467536625e6fc7ee    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2022 19:52:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Mar 2022 19:52:48 -0400    

Click here for diff

My (tgl's) thinko in commit 02b8048ba: I forgot that the first  
argument of COMPLETE_WITH_QUERY_PLUS is a format string, and  
hence failed to double a literal %.  These two places seem to  
be the only ones that are wrong, though.  
  
Vignesh C  
  
Discussion: https://postgr.es/m/CALDaNm0hBO+tZqBWhBjTVxyET1GWANq5K9XpQ07atSxnFXbG7w@mail.gmail.com  

M src/bin/psql/tab-complete.c

VACUUM VERBOSE: tweak scanned_pages logic.

commit   : 6e20f4600a420961817ce743be454080745f84d1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 13 Mar 2022 13:07:49 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 13 Mar 2022 13:07:49 -0700    

Click here for diff

Commit 872770fd6c taught VACUUM VERBOSE and autovacuum logging to  
display the total number of pages scanned by VACUUM.  This information  
was also displayed as a percentage of rel_pages in parenthesis, which  
makes it easy to spot trends over time and across tables.  
  
The instrumentation displayed "0 scanned (0.00% of total)" for totally  
empty tables.  Tweak the instrumentation: have it show "0 scanned  
(100.00% of total)" for empty tables instead.  This approach is clearer  
and more consistent.  

M src/backend/access/heap/vacuumlazy.c

Force track_io_timing off in explain.sql to avoid failures when enabled.

commit   : 7e12256b478b89518ff410f29192af21de37d070    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2022 14:21:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2022 14:21:40 -0800    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Set synchronous_commit=on in test_setup.sql.

commit   : 02fea8fdda6531f34305b445f92f5b62241329b3    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2022 14:04:50 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Mar 2022 14:04:50 -0800    

Click here for diff

Starting in cc50080a82 create_index test fails when run with  
synchronous_commit=off. synchronous_commit=off delays when hint bits may be  
set. Some plans change depending on the number of all-visible pages, which in  
turn can be influenced by the delayed hint bits.  
  
Force synchronous_commit to `on` in test_setup.sql. Not very satisfying, but  
there's no obvious alternative.  
  
Reported-By: Aleksander Alekseev <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAJ7c6TPJNof1Q+vJsy3QebgbPgXdu2ErPvYkBdhD6_Ckv5EZRg@mail.gmail.com  

M src/test/regress/expected/test_setup.out
M src/test/regress/sql/test_setup.sql

vacuumlazy.c: Standardize rel_pages terminology.

commit   : e370f100f05d77eec258fb430009c16c0e315065    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 12 Mar 2022 13:20:45 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 12 Mar 2022 13:20:45 -0800    

Click here for diff

VACUUM's rel_pages field indicates the size of the target heap rel just  
after the table_relation_vacuum() operation began.  There are specific  
expectations around how rel_pages can be related to other nearby state.  
In particular, the range of rel_pages must contain every tuple in the  
relation whose tuple headers might contain an XID < OldestXmin.  
  
Consistently refer to the field as rel_pages to make this clearer and  
more discoverable.  
  
This is follow-up work to commit 73f6ec3d from earlier today.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/vacuumlazy.c

vacuumlazy.c: document vistest and OldestXmin.

commit   : 73f6ec3d3c8d5786c54373e71a096e5acf78e7ca    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 12 Mar 2022 12:52:38 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 12 Mar 2022 12:52:38 -0800    

Click here for diff

Explain the relationship between vacuumlazy.c's vistest and OldestXmin  
cutoffs.  These closely related cutoffs are different in subtle but  
important ways.  Also document a closely related rule: we must establish  
rel_pages _after_ OldestXmin to ensure that no XID < OldestXmin can be  
missed by lazy_scan_heap().  
  
It's easier to explain these issues by initializing everything together,  
so consolidate initialization of vacrel state.  Now almost every vacrel  
field is initialized by heap_vacuum_rel().  The only remaining exception  
is the dead_items array, which is still managed by lazy_scan_heap() due  
to interactions with how we initialize parallel VACUUM.  
  
Also move the process that updates pg_class entries for each index into  
heap_vacuum_rel(), and adjust related assertions.  All pg_class updates  
now take place after lazy_scan_heap() returns, which seems clearer.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAH2-WznYsUxVT156rCQ+q=YD4S4=1M37hWvvHLz-H1pwSM8-Ew@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Normalize heap_prepare_freeze_tuple argument name.

commit   : 5b68f75e12831cd5b7d8058320c0ca29bbe76067    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 11 Mar 2022 19:30:21 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 11 Mar 2022 19:30:21 -0800    

Click here for diff

We called the argument totally_frozen in its function prototype as well  
as in code comments, even though totally_frozen_p was used in the  
function definition.  Standardize on totally_frozen.  

M src/backend/access/heap/heapam.c

Bump XLOG_PAGE_MAGIC due to the addition of wal_compression=zstd

commit   : 8e375ea4a0e95dd0d74f11c439cce4498bf80bd7    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 12 Mar 2022 09:39:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 12 Mar 2022 09:39:13 +0900    

Click here for diff

While on it, fix a thinko in the docs, introduced by the same commit.  
  
Oversights in e953732.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/include/access/xlog_internal.h

Add API of sorts for transition table handling in trigger.c

commit   : 3a46a45f6f009785b46188ed862afbccfb4cf56a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 11 Mar 2022 20:40:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 11 Mar 2022 20:40:03 -0300    

Click here for diff

Preparatory patch for further additions in this area, particularly to  
allow MERGE to have separate transition tables for each action.  
  
Author: Pavan Deolasee <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CABOikdNj+8HEJ5D8tu56mrPkjHVRrBb2_cdKWwpiYNcjXgDw8g@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

Restore the previous semantics of get_constraint_index().

commit   : 641f3dffcdf1c7378cfb94c98b6642793181d6db    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2022 13:47:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Mar 2022 13:47:26 -0500    

Click here for diff

Commit 8b069ef5d changed this function to look at pg_constraint.conindid  
rather than searching pg_depend.  That was a good performance improvement,  
but it failed to preserve the exact semantics.  The old code would only  
return an index that was "owned by" (internally dependent on) the  
specified constraint, whereas the new code will also return indexes that  
are just referenced by foreign key constraints.  This confuses ALTER  
TABLE, which was implicitly expecting the previous semantics, into  
failing with errors like  
    ERROR:  relation 146621 has multiple clustered indexes  
or  
    ERROR:  "pk_attbl" is not an index for table "atref"  
  
We can fix this without reverting the performance improvement by adding  
a contype check in get_constraint_index().  Another way could be to  
make ALTER TABLE check it, but I'm worried that extension code could  
also have subtle dependencies on the old semantics.  
  
Tom Lane and Japin Li, per bug #17409 from Holly Roberts.  
Back-patch to v14 where the error crept in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/lsyscache.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

pg_basebackup: Clean up some bogus file extension tests.

commit   : d6f1cdeb9a9ea227f87a2156e3a1ed94706b2193    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2022 12:35:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2022 12:35:13 -0500    

Click here for diff

Justin Pryzby  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

pg_basebackup: Avoid unclean failure with server-compression and -D -.

commit   : b2de45f9200d9adcac50015521574696dc464ccd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2022 12:22:02 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Mar 2022 12:22:02 -0500    

Click here for diff

Fail with a suitable error message instead. We can't inject the backup  
manifest into the output tarfile without decompressing it, and if  
we did that, we'd have to recompress the tarfile afterwards to produce  
the result the user is expecting. While we have enough infrastructure  
in pg_basebackup now to accomplish that whole series of steps without  
much additional code, it seems like excessively surprising behavior.  
The user probably did not select server-side compression with the idea  
that the client was going to end up decompressing it and then  
recompressing.  
  
Report from Justin Pryzby. Fix by me.  
  
Discussion: http://postgr.es/m/CA+Tgmob6Rnjz-Qv32h3yJn8nnUkLhrtQDAS4y5AtsgtorAFHRA@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

DefineCollation() code cleanup

commit   : e94bb1473eb36e19c200476cebc3750cf6a978e7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 11 Mar 2022 08:27:24 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 11 Mar 2022 08:27:24 +0100    

Click here for diff

Reorganize the code in DefineCollation() so that the parts using the  
FROM clause and the parts not doing so are more cleanly separated.  No  
functionality change intended.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/collationcmds.c

doc: Standardize capitalization of term "hot standby"/"Hot Standby"

commit   : 9198e6399664c34985236b7a88a8efae96be633b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 15:16:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 15:16:21 +0900    

Click here for diff

"Hot Standby" was capitalized in a couple of places in the docs, as the  
style primarily used when it was introduced, but this has not been much  
respected across the years.  Per discussion, it is more natural for the  
reader to use "hot standby" (aka lower-case only) when in the middle of  
a sentence, and "Hot standby" (aka capitalized) in a title.  This commit  
adjusts all the places in the docs to be consistent with this choice,  
rather than applying one style or the other midway.  
  
Author: Daniel Westermann  
Reviewed-by: Kyotaro Horiguchi, Aleksander Alekseev, Robert Treat  
Discussion: https://postgr.es/m/GVAP278MB093160025A779A1A5788D0EAD2039@GVAP278MB0931.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/protocol.sgml

Add support for zstd with compression of full-page writes in WAL

commit   : e9537321a74a2b062c8f7a452314b4570913f780    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 12:18:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 12:18:53 +0900    

Click here for diff

wal_compression gains a new value, "zstd", to allow the compression of  
full-page images using the compression method of the same name.  
  
Compression is done using the default level recommended by the library,  
as of ZSTD_CLEVEL_DEFAULT = 3.  Some benchmarking has shown that it  
could make sense to use a level lower for the FPI compression, like 1 or  
2, as the compression rate did not change much with a bit less CPU  
consumed, but any tests done would only cover few scenarios so it is  
hard to come to a clear conclusion.  Anyway, there is no reason to not  
use the default level instead, which is the level recommended by the  
library so it should be fine for most cases.  
  
zstd outclasses easily pglz, and is better than LZ4 where one wants to  
have more compression at the cost of extra CPU but both are good enough  
in their own scenarios, so the choice between one or the other of these  
comes to a study of the workload patterns and the schema involved,  
mainly.  
  
This commit relies heavily on 4035cd5, that reshaped the code creating  
and restoring full-page writes to be aware of the compression type,  
making this integration straight-forward.  
  
This patch borrows some early work from Andrey Borodin, though the patch  
got a complete rewrite.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/installation.sgml
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlogrecord.h

Fix header inclusion order in xloginsert.c with lz4.h

commit   : 0071fc71277e51723eeb4856eeeb5d25600a429a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 10:59:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 11 Mar 2022 10:59:47 +0900    

Click here for diff

Per project policy, all system and library headers need to be declared  
in the backend code after "postgres.h" and before the internal headers,  
but 4035cd5 broke this policy when adding support for LZ4 in  
wal_compression.  
  
Noticed while reviewing the patch to add support for zstd in this area.  
This only impacts HEAD, so there is no need for a back-patch.  

M src/backend/access/transam/xloginsert.c

dshash: Add sequential scan support.

commit   : 352d297dc74feb0bf0dcb255cc0dfaaed2b96c1e    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 10 Mar 2022 12:54:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 10 Mar 2022 12:54:54 -0800    

Click here for diff

Add ability to scan all entries sequentially to dshash. The interface is  
similar but a bit different both from that of dynahash and simple dshash  
search functions. The most significant differences is that dshash's interfac  
always needs a call to dshash_seq_term when scan ends. Another is  
locking. Dshash holds partition lock when returning an entry,  
dshash_seq_next() also holds lock when returning an entry but callers  
shouldn't release it, since the lock is essential to continue a scan. The  
seqscan interface allows entry deletion while a scan is in progress using  
dshash_delete_current().  
  
Reviewed-By: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  

M src/backend/lib/dshash.c
M src/include/lib/dshash.h
M src/tools/pgindent/typedefs.list

Re-update Unicode data to CLDR 39

commit   : adb5c28adc59415b54c087507dd84c71368c289c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Mar 2022 14:09:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Mar 2022 14:09:21 +0100    

Click here for diff

Apparently, the previous update  
(2e0e0666790e48cec716d4947f89d067ef53490c) must have used a stale  
input file and missed a few additions that were added shortly before  
the CLDR release.  Update this now so that the next update really only  
changes things new in that version.  

M contrib/unaccent/unaccent.rules

ldap tests: Add paths for openbsd.

commit   : 45fb0de4dc65f43a037fe7c90f360ae0596d9328    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2022 09:46:21 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2022 09:46:21 -0800    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/test/ldap/t/001_auth.pl

ldap tests: Don't run on unsupported operating systems.

commit   : ee56c3b21629277cf7f2e6398e7dd4e40c11df3c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2022 09:31:02 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 9 Mar 2022 09:31:02 -0800    

Click here for diff

The tests currently fail on unsupported operating systems, rather than getting  
skipped. The ony reason this doesn't cause problems is that the tests aren't  
run by default.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ldap/t/001_auth.pl

Fix double declaration for check_ok() in pg_upgrade.h

commit   : 2cfde3c2371860aa6c05f84c3fbec9c400ab6b1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 12:12:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 12:12:20 +0100    

Click here for diff

Author: Pavel Borisov <[email protected]>  

M src/bin/pg_upgrade/pg_upgrade.h

Add parse_analyze_withcb()

commit   : df4c3cbd8f4f619785c735669150e3a1df9cf7ca    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:56:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:56:44 +0100    

Click here for diff

This extracts code from pg_analyze_and_rewrite_withcb() into a  
separate function that mirrors the existing  
parse_analyze_fixedparams() and parse_analyze_varparams().  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/analyze.c
M src/backend/tcop/postgres.c
M src/include/parser/analyze.h

pycodestyle (PEP 8) cleanup in Python scripts

commit   : ddf590b8115212ea061f9428f20f4c36d8e25e62    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:51:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:51:41 +0100    

Click here for diff

These are mainly whitespace changes.  I didn't fix "E501 line too  
long", which would require more significant surgery.  

M contrib/unaccent/generate_unaccent_rules.py
M src/test/locale/sort-test.py

unaccent: Remove Python 2 support from Python script

commit   : e80a7a1f3d65e34fff73166d42abe0e2d5f91add    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:39:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 9 Mar 2022 10:39:17 +0100    

Click here for diff

This is a maintainer-only script, but since we're removing Python 2  
support elsewhere, we might as well clean this one up as well.  

M contrib/unaccent/generate_unaccent_rules.py

doc: Add ALTER/DROP ROUTINE to the event trigger matrix

commit   : e3df32bbc38bc4a20092ea18b482b81119fa72dd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Mar 2022 14:59:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Mar 2022 14:59:08 +0900    

Click here for diff

ALTER ROUTINE triggers the events ddl_command_start and ddl_command_end,  
and DROP ROUTINE triggers sql_drop, ddl_command_start and  
ddl_command_end, but this was not mention on the matrix table.  
  
Reported-by: Leslie Lemaire  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M doc/src/sgml/event-trigger.sgml

doc: Improve references to term "FSM" in pageinspect and pgfreespacemap

commit   : 7687ca996e558d95e68d2d0d70fed22a6317ba78    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Mar 2022 10:43:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Mar 2022 10:43:25 +0900    

Click here for diff

Author: Dong Wook Lee  
Reviewed-by: Laurenz Albe  
Discussion: https://postgr.es/m/CAAcBya+=F=HaHxJ7tGjAM1r=A=+bDbimpsex8Vqrb4GjqFDYsQ@mail.gmail.com  

M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/storage.sgml

plpython: Restore alternative output for plpython_error test.

commit   : 43e7787dd3387a7455fc4d9c353addb79a50ebe5    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2022 10:31:06 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2022 10:31:06 -0800    

Click here for diff

In db23464715f I removed the alternative output for plpython_error. Wrongly  
so, because the output changed in Python 3.5, not Python 3.  

M src/pl/plpython/expected/plpython_error.out
A src/pl/plpython/expected/plpython_error_5.out

Stabilize test_decoding touching with sequences

commit   : a180c2b34de0989269fdb819bff241a249bf5380    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 8 Mar 2022 18:54:37 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 8 Mar 2022 18:54:37 +0100    

Click here for diff

Some of the test_decoding regression tests are unstable due to modifying  
a sequence. The first increment of a sequence after a checkpoint is  
always logged (and thus decoded), which makes the output unpredictable.  
The runs are usually much shorter than a checkpoint internal, so these  
failures are rare, but we've seen a couple of them on animals that are  
either slow or are running with valgrind/clobber cache/...  
  
Fixed by skipping sequence decoding in most tests, with the exception of  
the test aimed at testing decoding of sequences.  
  
Reported-by: Amita Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
M contrib/test_decoding/sql/slot.sql

plpython: add missing plpython.h include to plpy_plpymodule.h

commit   : 54c72eb5e5e63f99f68c054900424724b0570b20    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2022 09:47:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 8 Mar 2022 09:47:34 -0800    

Click here for diff

The include was missing before 9b7e24a2cb3, but starting with that commit the  
missing include causes cpluspluscheck to fail because the use of  
PyMODINIT_FUNC isn't incidentally protected by an ifdef anymore.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/plpy_plpymodule.h

Fix LZ4 tests for remaining buffer space.

commit   : 1d4be6be65ab18aa3b240d9bc912ebece255c53b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2022 10:05:55 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Mar 2022 10:05:55 -0500    

Click here for diff

We should flush the buffer when the remaining space is less than  
the maximum amount that we might need, not when it is less than or  
equal to the maximum amount we might need.  
  
Jeevan Ladhe, per an observation from me.  
  
Discussion: http://postgr.es/m/CANm22CgVMa85O1akgs+DOPE8NSrT1zbz5_vYfS83_r+6nCivLQ@mail.gmail.com  

M src/backend/replication/basebackup_lz4.c
M src/bin/pg_basebackup/bbstreamer_lz4.c

Add support for zstd base backup compression.

commit   : 7cf085f077df8dd9b80cf1f5964b5b8c142be496    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 7 Mar 2022 15:08:45 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 7 Mar 2022 15:08:45 -0500    

Click here for diff

Both client-side compression and server-side compression are now  
supported for zstd. In addition, a backup compressed by the server  
using zstd can now be decompressed by the client in order to  
accommodate the use of -Fp.  
  
Jeevan Ladhe, with some edits by me.  
  
Discussion: http://postgr.es/m/CA+Tgmobyzfbz=gyze2_LL1ZumZunmaEKbHQxjrFkOR7APZGu-g@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/Makefile
M src/backend/replication/basebackup.c
A src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
A src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_verifybackup/Makefile
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/include/replication/basebackup_sink.h
M src/tools/msvc/Mkvcbuild.pm

Improve comment in execReplication.c

commit   : c28839c8326155f25161ed42f23890c997e0b4a4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Mar 2022 14:29:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Mar 2022 14:29:03 +0900    

Click here for diff

Author: Peter Smith  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAHut+PuRVf3ghNTg8EV5XOQu6unGSZma0ahsRoz-haaOFZe-1A@mail.gmail.com  

M src/backend/executor/execReplication.c

Add the additional information to the logical replication worker errcontext.

commit   : d3e8368c4b6e5110d8b3d12859850aeaae08dffb    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 8 Mar 2022 08:08:32 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 8 Mar 2022 08:08:32 +0530    

Click here for diff

This commits adds both the finish LSN (commit_lsn in case transaction got  
committed, prepare_lsn in case of a prepared transaction, etc.) and  
replication origin name to the existing error context message.  
  
This will help users in specifying the origin name and transaction finish  
LSN to pg_replication_origin_advance() SQL function to skip a particular  
transaction.  
  
Author: Masahiko Sawada  
Reviewed-by: Takamichi Osumi, Euler Taveira, and Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoBarBf2oTF71ig2g_o=3Z_Dt6_sOpMQma1kFgbnA5OZ_w@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/replication/logical/worker.c

plpython: Adjust docs after removal of Python 2 support.

commit   : 4228cabb72bb57e1df4c9d92613f1fcd4baadd5a    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:30:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:30:57 -0800    

Click here for diff

Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/hstore.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_transform.sgml
M doc/src/sgml/ref/drop_transform.sgml

commit   : 9b7e24a2cb37fb52af13219f625cd719e364a346    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:30:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:30:28 -0800    

Click here for diff

Since 19252e8ec93 we reject Python 2 during build configuration. Now that the  
dust on the buildfarm has settled, remove Python 2 specific code, including  
the "Python 2/3 porting layer".  
  
The code to detect conflicts between plpython using Python 2 and 3 is not  
removed, in case somebody creates an out-of-tree version adding back support  
for Python 2.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/pl/plpython/plpy_cursorobject.c
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_planobject.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_plpymodule.h
M src/pl/plpython/plpy_resultobject.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_util.c
M src/pl/plpython/plpy_util.h
M src/pl/plpython/plpython.h

plpython: Remove regression test infrastructure for Python 2.

commit   : db23464715f4792298c639153dda7bfd9ad9d602    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:19:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:19:56 -0800    

Click here for diff

Since 19252e8ec93 we reject Python 2 during build configuration. Now that the  
dust on the buildfarm has settled, remove regression testing infrastructure  
dealing with differing output between Python 2 / 3.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plpython/.gitignore
M contrib/hstore_plpython/Makefile
M contrib/hstore_plpython/expected/hstore_plpython.out
M contrib/hstore_plpython/sql/hstore_plpython.sql
M contrib/jsonb_plpython/.gitignore
M contrib/jsonb_plpython/Makefile
M contrib/jsonb_plpython/expected/jsonb_plpython.out
M contrib/jsonb_plpython/sql/jsonb_plpython.sql
M contrib/ltree_plpython/.gitignore
M contrib/ltree_plpython/Makefile
M contrib/ltree_plpython/expected/ltree_plpython.out
M contrib/ltree_plpython/sql/ltree_plpython.sql
M src/pl/plpython/.gitignore
M src/pl/plpython/Makefile
M src/pl/plpython/expected/plpython_call.out
M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/expected/plpython_do.out
M src/pl/plpython/expected/plpython_drop.out
M src/pl/plpython/expected/plpython_ereport.out
M src/pl/plpython/expected/plpython_error.out
D src/pl/plpython/expected/plpython_error_5.out
M src/pl/plpython/expected/plpython_global.out
M src/pl/plpython/expected/plpython_import.out
M src/pl/plpython/expected/plpython_newline.out
M src/pl/plpython/expected/plpython_params.out
M src/pl/plpython/expected/plpython_quote.out
M src/pl/plpython/expected/plpython_record.out
M src/pl/plpython/expected/plpython_setof.out
M src/pl/plpython/expected/plpython_spi.out
M src/pl/plpython/expected/plpython_subtransaction.out
M src/pl/plpython/expected/plpython_test.out
M src/pl/plpython/expected/plpython_transaction.out
M src/pl/plpython/expected/plpython_trigger.out
M src/pl/plpython/expected/plpython_types.out
D src/pl/plpython/expected/plpython_types_3.out
M src/pl/plpython/expected/plpython_unicode.out
M src/pl/plpython/expected/plpython_void.out
D src/pl/plpython/regress-python3-mangle.mk
M src/pl/plpython/sql/plpython_call.sql
M src/pl/plpython/sql/plpython_composite.sql
M src/pl/plpython/sql/plpython_do.sql
M src/pl/plpython/sql/plpython_drop.sql
M src/pl/plpython/sql/plpython_ereport.sql
M src/pl/plpython/sql/plpython_error.sql
M src/pl/plpython/sql/plpython_global.sql
M src/pl/plpython/sql/plpython_import.sql
M src/pl/plpython/sql/plpython_newline.sql
M src/pl/plpython/sql/plpython_params.sql
M src/pl/plpython/sql/plpython_quote.sql
M src/pl/plpython/sql/plpython_record.sql
M src/pl/plpython/sql/plpython_setof.sql
M src/pl/plpython/sql/plpython_spi.sql
M src/pl/plpython/sql/plpython_subtransaction.sql
M src/pl/plpython/sql/plpython_test.sql
M src/pl/plpython/sql/plpython_transaction.sql
M src/pl/plpython/sql/plpython_trigger.sql
M src/pl/plpython/sql/plpython_types.sql
M src/pl/plpython/sql/plpython_unicode.sql
M src/pl/plpython/sql/plpython_void.sql
M src/tools/msvc/vcregress.pl

plpython: Remove plpythonu, plpython2u and associated transform extensions.

commit   : 76a29adee749f41e277459cbf2e47a2ff7777f31    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:19:56 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 7 Mar 2022 18:19:56 -0800    

Click here for diff

Since 19252e8ec93 we reject Python 2 during build configuration. Now that the  
dust on the buildfarm has settled, remove extension variants specific to  
Python 2.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/hstore_plpython/Makefile
D contrib/hstore_plpython/hstore_plpython2u–1.0.sql
D contrib/hstore_plpython/hstore_plpython2u.control
D contrib/hstore_plpython/hstore_plpythonu–1.0.sql
D contrib/hstore_plpython/hstore_plpythonu.control
M contrib/jsonb_plpython/Makefile
D contrib/jsonb_plpython/jsonb_plpython2u–1.0.sql
D contrib/jsonb_plpython/jsonb_plpython2u.control
D contrib/jsonb_plpython/jsonb_plpythonu–1.0.sql
D contrib/jsonb_plpython/jsonb_plpythonu.control
M contrib/ltree_plpython/Makefile
D contrib/ltree_plpython/ltree_plpython2u–1.0.sql
D contrib/ltree_plpython/ltree_plpython2u.control
D contrib/ltree_plpython/ltree_plpythonu–1.0.sql
D contrib/ltree_plpython/ltree_plpythonu.control
D src/pl/plpython/plpython2u–1.0.sql
D src/pl/plpython/plpython2u.control
D src/pl/plpython/plpythonu–1.0.sql
D src/pl/plpython/plpythonu.control

Simplify SRFs using materialize mode in contrib/ modules

commit   : 5b81703787bfc1e6072c8e37125eba0c5598b807    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Mar 2022 10:12:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Mar 2022 10:12:22 +0900    

Click here for diff

9e98583 introduced a helper to centralize building their needed state  
(tuplestore, tuple descriptors, etc.), checking for any errors.  This  
commit updates all places of contrib/ that can be switched to use  
SetSingleFuncCall() as a drop-in replacement, resulting in the removal  
of a lot of boilerplate code in all the modules updated by this commit.  
  
Per analysis, some places remain as they are:  
- pg_logdir_ls() in adminpack/ uses historically TYPEFUNC_RECORD as  
return type, and I suspect that changing it may cause issues at run-time  
with some of its past versions, down to 1.0.  
- dblink/ uses a wrapper function doing exactly the work of  
SetSingleFuncCall().  Here the switch should be possible, but rather  
invasive so it does not seem the extra backpatch maintenance cost.  
- tablefunc/, similarly, uses multiple helper functions with portions of  
SetSingleFuncCall() spread across the code paths of this module.  
  
Author: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_bvDPJoL9mH6eYwvBpPtTGQwbDzfJbCM-OjkSZDu5yTPg@mail.gmail.com  

M contrib/amcheck/verify_heapam.c
M contrib/dblink/dblink.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/postgres_fdw/connection.c
M contrib/xml2/xpath.c

Call ReorderBufferProcessXid from sequence_decode

commit   : d5ed9da41d96988d905b49bebb273a9b2d6e2915    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 7 Mar 2022 20:53:16 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 7 Mar 2022 20:53:16 +0100    

Click here for diff

Commit 0da92dc530c added sequence_decode() implementing logical decoding  
of sequences, but it failed to call ReorderBufferProcessXid() as it  
should. So add the missing call.  
  
Reported-by: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1KGn6cQqJEsubOOENwQOANsExiV2sKL52r4U10J8NJEMQ%40mail.gmail.com  

M src/backend/replication/logical/decode.c

Add pg_analyze_and_rewrite_varparams()

commit   : 25751f54b8e02a8fff62e9dbdbc9f2efbb4e8dc1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 14:49:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 14:49:37 +0100    

Click here for diff

This new function extracts common code from PrepareQuery() and  
exec_parse_message().  It is then exactly analogous to the existing  
pg_analyze_and_rewrite_fixedparams() and  
pg_analyze_and_rewrite_withcb().  
  
To unify these two code paths, this makes PrepareQuery() now subject  
to log_parser_stats.  Also, both paths now invoke  
TRACE_POSTGRESQL_QUERY_REWRITE_START().  PrepareQuery() no longer  
checks whether a utility statement was specified.  The grammar doesn't  
allow that anyway, and exec_parse_message() supports it, so  
restricting it doesn't seem necessary.  
  
This also adds QueryEnvironment support to the *varparams functions,  
for consistency with its cousins, even though it is not used right  
now.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/prepare.c
M src/backend/parser/analyze.c
M src/backend/tcop/postgres.c
M src/include/parser/analyze.h
M src/include/tcop/tcopprot.h

Make the errcontext message in logical replication worker translation friendly.

commit   : 5e0e99a80b2f41c8e9ed0f4071892d9e797a12be    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 7 Mar 2022 08:33:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 7 Mar 2022 08:33:58 +0530    

Click here for diff

Previously, the message for logical replication worker errcontext is  
incrementally built, which was not translation friendly.  Instead, we use  
complete sentences with if-else branches.  
  
We also remove the commit timestamp from the context message since it's  
not important information and made the message long.  
  
Author: Masahiko Sawada  
Reviewed-by: Takamichi Osumi, and Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoBarBf2oTF71ig2g_o=3Z_Dt6_sOpMQma1kFgbnA5OZ_w@mail.gmail.com  

M src/backend/replication/logical/worker.c

Create routine able to set single-call SRFs for Materialize mode

commit   : 9e98583898c347e007958c8a09911be2ea4acfb9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 7 Mar 2022 10:26:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 7 Mar 2022 10:26:29 +0900    

Click here for diff

Set-returning functions that use the Materialize mode, creating a  
tuplestore to include all the tuples returned in a set rather than doing  
so in multiple calls, use roughly the same set of steps to prepare  
ReturnSetInfo for this job:  
- Check if ReturnSetInfo supports returning a tuplestore and if the  
materialize mode is enabled.  
- Create a tuplestore for all the tuples part of the returned set in the  
per-query memory context, stored in ReturnSetInfo->setResult.  
- Build a tuple descriptor mostly from get_call_result_type(), then  
stored in ReturnSetInfo->setDesc.  Note that there are some cases where  
the SRF's tuple descriptor has to be the one specified by the function  
caller.  
  
This refactoring is done so as there are (well, should be) no behavior  
changes in any of the in-core functions refactored, and the centralized  
function that checks and sets up the function's ReturnSetInfo can be  
controlled with a set of bits32 options.  Two of them prove to be  
necessary now:  
- SRF_SINGLE_USE_EXPECTED to use expectedDesc as tuple descriptor, as  
expected by the function's caller.  
- SRF_SINGLE_BLESS to validate the tuple descriptor for the SRF.  
  
The same initialization pattern is simplified in 28 places per my  
count as of src/backend/, shaving up to ~900 lines of code.  These  
mostly come from the removal of the per-query initializations and the  
sanity checks now grouped in a single location.  There are more  
locations that could be simplified in contrib/, that are left for a  
follow-up cleanup.  
  
fcc2817, 07daca5 and d61a361 have prepared the areas of the code related  
to this change, to ease this refactoring.  
  
Author: Melanie Plageman, Michael Paquier  
Reviewed-by: Álvaro Herrera, Justin Pryzby  
Discussion: https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com  

M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/prepare.c
M src/backend/foreign/foreign.c
M src/backend/libpq/hba.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/shmem.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/README
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/mmgr/portalmem.c
M src/include/funcapi.h

ci: windows: Work around cirrus-ci bug causing test failures.

commit   : 770011e3f39f21f2095d3a044b72460c4efac345    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 4 Mar 2022 21:58:57 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 4 Mar 2022 21:58:57 -0800    

Click here for diff

Will be reverted once fixed on cirrus's side.  
  
See also https://github.com/cirruslabs/cirrus-ci-agent/issues/218  
  
Discussion: https://postgr.es/m/CA+hUKGKx7k14n2nAALSvv6M_AB6oHasNBA65X6Dvo8hwfi9y0A@mail.gmail.com  

M .cirrus.yml

Use PG_TEST_TIMEOUT_DEFAULT for pg_regress suite non-elapsing timeouts.

commit   : 766075105c21442418359221e0a0da43040b273c    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 4 Mar 2022 18:53:13 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 4 Mar 2022 18:53:13 -0800    

Click here for diff

Currently, only contrib/test_decoding has this property.  Use \getenv to  
load the timeout value.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/twophase.out
M contrib/test_decoding/sql/twophase.sql
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Introduce PG_TEST_TIMEOUT_DEFAULT for TAP suite non-elapsing timeouts.

commit   : f2698ea02ca8a56f38935d2b300ac54936712558    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 4 Mar 2022 18:53:13 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 4 Mar 2022 18:53:13 -0800    

Click here for diff

Slow hosts may avoid load-induced, spurious failures by setting  
environment variable PG_TEST_TIMEOUT_DEFAULT to some number of seconds  
greater than 180.  Developers may see faster failures by setting that  
environment variable to some lesser number of seconds.  In tests, write  
$PostgreSQL::Test::Utils::timeout_default wherever the convention has  
been to write 180.  This change raises the default for some briefer  
timeouts.  Back-patch to v10 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/README
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/subscription/t/015_stream.pl

Fix pg_regress to print the correct postmaster address on Windows.

commit   : 9240589798e02705dbe3e86549d064988c0f47d2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2022 13:23:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 4 Mar 2022 13:23:58 -0500    

Click here for diff

pg_regress reported "Unix socket" as the default location whenever  
HAVE_UNIX_SOCKETS is defined.  However, that's not been accurate  
on Windows since 8f3ec75de.  Update this logic to match what libpq  
actually does now.  
  
This is just cosmetic, but still it's potentially misleading.  
Back-patch to v13 where 8f3ec75de came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c
M src/test/regress/pg_regress.c

Parse/analyze function renaming

commit   : 791b1b71da35d9d4264f72a87e4078b85a2fcfb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 14:49:37 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 14:49:37 +0100    

Click here for diff

There are three parallel ways to call parse/analyze: with fixed  
parameters, with variable parameters, and by supplying your own parser  
callback.  Some of the involved functions were confusingly named and  
made this API structure more confusing.  This patch renames some  
functions to make this clearer:  
  
parse_analyze() -> parse_analyze_fixedparams()  
pg_analyze_and_rewrite() -> pg_analyze_and_rewrite_fixedparams()  
  
(Otherwise one might think this variant doesn't accept parameters, but  
in fact all three ways accept parameters.)  
  
pg_analyze_and_rewrite_params() -> pg_analyze_and_rewrite_withcb()  
  
(Before, and also when considering pg_analyze_and_rewrite(), one might  
think this is the only way to pass parameters.  Moreover, the parser  
callback doesn't necessarily need to parse only parameters, it's just  
one of the things it could do.)  
  
parse_fixed_parameters() -> setup_parse_fixed_parameters()  
parse_variable_parameters() -> setup_parse_variable_parameters()  
  
(These functions don't actually do any parsing, they just set up  
callbacks to use during parsing later.)  
  
This patch also adds some const decorations to the fixed-parameters  
API, so the distinction from the variable-parameters API is more  
clear.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/pg_proc.c
M src/backend/commands/copyto.c
M src/backend/commands/extension.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/view.c
M src/backend/executor/functions.c
M src/backend/executor/spi.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/postgres.c
M src/backend/utils/cache/plancache.c
M src/include/parser/analyze.h
M src/include/parser/parse_param.h
M src/include/tcop/tcopprot.h

psql: Make SSL info display more compact

commit   : d816f366bc427cacba29c1e4b1696afa620e73a7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 08:47:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 4 Mar 2022 08:47:30 +0100    

Click here for diff

Remove the bits display, since that can be derived from the cipher  
suite.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/aee28ee7-0ab3-c2e2-5bed-109feb0c089b%40enterprisedb.com  

M src/bin/psql/command.c

Add some additional tests for row filters in logical replication.

commit   : ceb57afd3ce177e897cb4c5b44aa683fc0036782    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 4 Mar 2022 07:54:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 4 Mar 2022 07:54:12 +0530    

Click here for diff

Commit 52e4f0cd47 didn't add tests for pg_dump support, so add a few tests  
for it. Additionally, verify that catalogs are updated after few  
ALTER PUBLICATION commands that modify row filters by using \d.  
  
Reported-by: Tomas Vondra  
Author: Shi yu, based on initial by Tomas Vondra  
Reviewed-by: Euler Taveira and Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Tighten overflow checks in tidin().

commit   : f7ea240aa7491b6ed2985bb50888bd432f3341df    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 20:03:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 20:03:47 -0500    

Click here for diff

This code seems to have been written on the assumption that  
"unsigned long" is 32 bits; or at any rate it ignored the  
possibility of conversion overflow.  Rewrite, borrowing some  
logic from oidin().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/tid.c
M src/test/regress/expected/tid.out
M src/test/regress/sql/tid.sql

doc: Fix description of pg_stop_backup()

commit   : b3c8aae00850384b1cec5311eb1864e2f5e80a44    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 4 Mar 2022 09:51:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 4 Mar 2022 09:51:12 +0900    

Click here for diff

The function was still documented as returning a set of records,  
something not true as of 62ce0c7.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Remove some pointless code in block.h.

commit   : 8134fe4ad80a1f9673770126ed7c45045b8ef467    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 19:15:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 19:15:38 -0500    

Click here for diff

There's no visible point in casting the result of a comparison to  
bool, because it already is that, at least on C99 compilers.  
  
I see no point in these assertions that a pointer we're about to  
dereference isn't null, either.  If it is, the resulting SIGSEGV  
will notify us of the problem just fine.  
  
Noted while reviewing Zhihong Yu's patch.  This is basically  
cosmetic, so no need for back-patch.  
  
Discussion: https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com  

M src/include/storage/block.h

Fix bogus casting in BlockIdGetBlockNumber().

commit   : 0fbdfaf79d0bbfe1ede9d8ca2d85b2c9a8513082    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 19:03:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 19:03:17 -0500    

Click here for diff

This macro cast the result to BlockNumber after shifting, not before,  
which is the wrong thing.  Per the C spec, the uint16 fields would  
promote to int not unsigned int, so that (for 32-bit int) the shift  
potentially shifts a nonzero bit into the sign position.  I doubt  
there are any production systems where this would actually end with  
the wrong answer, but it is undefined behavior per the C spec, and  
clang's -fsanitize=undefined option reputedly warns about it on some  
platforms.  (I can't reproduce that right now, but the code is  
undeniably wrong per spec.)  It's easy to fix by casting to  
BlockNumber (uint32) in the proper places.  
  
It's been wrong for ages, so back-patch to all supported branches.  
  
Report and patch by Zhihong Yu (cosmetic tweaking by me)  
  
Discussion: https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com  

M src/include/storage/block.h

Clean up assorted failures under clang's -fsanitize=undefined checks.

commit   : 46ab07ffda9d6c8e63360ded2d4568aa160a7700    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 18:13:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 3 Mar 2022 18:13:24 -0500    

Click here for diff

Most of these are cases where we could call memcpy() or other libc  
functions with a NULL pointer and a zero count, which is forbidden  
by POSIX even though every production version of libc allows it.  
We've fixed such things before in a piecemeal way, but apparently  
never made an effort to try to get them all.  I don't claim that  
this patch does so either, but it gets every failure I observe in  
check-world, using clang 12.0.1 on current RHEL8.  
  
numeric.c has a different issue that the sanitizer doesn't like:  
"ln(-1.0)" will compute log10(0) and then try to assign the  
resulting -Inf to an integer variable.  We don't actually use the  
result in such a case, so there's no live bug.  
  
Back-patch to all supported branches, with the idea that we might  
start running a buildfarm member that tests this case.  This includes  
back-patching c1132aae3 (Check the size in COPY_POINTER_FIELD),  
which previously silenced some of these issues in copyfuncs.c.  
  
Discussion: https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com  

M contrib/pgcrypto/px.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/xact.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/time/snapmgr.c
M src/fe_utils/print.c

Fix catalog data of pg_stop_backup(), labelled v2

commit   : 62ce0c758d5d66092efbca7d037233e2ca9bdc78    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 3 Mar 2022 10:51:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 3 Mar 2022 10:51:57 +0900    

Click here for diff

This function has been incorrectly marked as a set-returning function  
with prorows (estimated number of rows) set to 1 since its creation in  
7117685, that introduced non-exclusive backups.  There is no need for  
that as the function is designed to return only one tuple.  
  
This commit fixes the catalog definition of pg_stop_backup_v2() so as it  
is not marked as proretset anymore, with prorows set to 0.  This  
simplifies its internals by removing one tuplestore (used for one single  
record anyway) and by removing all the checks related to a set-returning  
function.  
  
Issue found during my quest to simplify some of the logic used in  
in-core system functions.  
  
Bump catalog version.  
  
Reviewed-by: Aleksander Alekseev, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_functions.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Doc: update libpq.sgml for root-owned SSL private keys.

commit   : 50f03473ed8132a43bf5c10764fb5b9eda71ac16    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2022 11:29:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Mar 2022 11:29:11 -0500    

Click here for diff

My oversight in a59c79564.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml

Add id's to various elements in protocol.sgml

commit   : e58791c6ad317fddcb7f54d19f6a8a4c43fecf7b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Mar 2022 10:30:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Mar 2022 10:30:41 +0100    

Click here for diff

For easier direct linking.  
  
Author: Brar Piening <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml

Fix typo in pgbench messages.

commit   : 506035b0b8323126823849483cee833e1de75330    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Wed, 2 Mar 2022 08:28:12 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Wed, 2 Mar 2022 08:28:12 +0900    

Click here for diff

Author: KAWAMOTO Masaya  
Reviewed-by: Fabien COELHO  
Discussion: https://postgr.es/m/20220224115622.41e671e3449ebd8c270e9103%40sraoss.co.jp  

M src/bin/pgbench/pgbench.c

Fix check for PGHOST[ADDR] in pg_upgrade with Windows and temporary paths

commit   : dc57366c583685c4b2901f2ba69943f596b974ec    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 2 Mar 2022 07:37:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 2 Mar 2022 07:37:07 +0900    

Click here for diff

The checks currently done at the startup of pg_upgrade on PGHOST and  
PGHOSTADDR to avoid any attempts to access to an external cluster fail  
setting those parameters to Windows paths or even temporary paths  
prefixed by an '@', as it only considers as a valid path strings  
beginning with a slash.  
  
As mentioned by Andres, is_unixsock_path() is designed to detect such  
cases, so, like any other code paths dealing with the same problem (psql  
and libpq), use it rather than assuming that all valid paths are  
prefixed with just a slash.  
  
This issue has been found while testing the TAP tests of pg_upgrade  
through the CI on Windows.  This is a bug, but nobody has complained  
about it since pg_upgrade exists so no backpatch is done, at least for  
now.  
  
Analyzed-by: Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/YeYj4DU5qY/[email protected]  

M src/bin/pg_upgrade/server.c

psql: Additional tests

commit   : 9028cce426ba6e08ee5ef8fcaedb2445e6c08c75    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 1 Mar 2022 11:21:20 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 1 Mar 2022 11:21:20 +0100    

Click here for diff

Add a few TAP tests for things that happen while a user query is being  
sent:  
  
- \timing  
- client encoding handling  
- notifications  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/t/001_basic.pl

Rework internal command generation of pg_rewind

commit   : a33e17f210547226ada52d2b8af851c3553bb4fa    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 1 Mar 2022 12:52:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 1 Mar 2022 12:52:25 +0900    

Click here for diff

pg_rewind generates and executes internally up to two commands to work  
on the target cluster, depending on the options given by its caller:  
- postgres -C to retrieve the value of restore_command, when using  
-c/--restore-target-wal.  
- postgres --single to enforce recovery once and get the target cluster  
in a clean shutdown state.  
  
Both commands have been applying incorrect quoting rules, which could  
lead to failures when for example using a target data directory with  
unexpected characters like CRLFs.  Those commands are now generated with  
PQExpBuffer, making use of string_utils.h to quote those commands as  
they should.  We may extend those commands in the future with more  
options, so this makes any upcoming additions easier.  
  
This is arguably a bug fix, but nobody has complained about the existing  
code being a problem either, so no backpatch is done.  
  
Extracted from a larger patch by the same author.  
  
Author: Gunnar "Nick" Bluth  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c

Reconsider pg_stat_subscription_workers view.

commit   : 7a85073290856554416353a89799a4c04d09b74b    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 1 Mar 2022 06:17:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 1 Mar 2022 06:17:52 +0530    

Click here for diff

It was decided (refer to the Discussion link below) that the stats  
collector is not an appropriate place to store the error information of  
subscription workers.  
  
This patch changes the pg_stat_subscription_workers view (introduced by  
commit 8d74fc96db) so that it stores only statistics counters:  
apply_error_count and sync_error_count, and has one entry for  
each subscription. The removed error information such as error-XID and  
the error message would be stored in another way in the future which is  
more reliable and persistent.  
  
After removing these error details, there is no longer any relation  
information, so the subscription statistics are now a cluster-wide  
statistics.  
  
The patch also changes the view name to pg_stat_subscription_stats since  
the word "worker" is an implementation detail that we use one worker for  
one tablesync and one apply.  
  
Author: Masahiko Sawada, based on suggestions by Andres Freund  
Reviewed-by: Peter Smith, Haiying Tang, Takamichi Osumi, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
A src/test/subscription/t/026_stats.pl
D src/test/subscription/t/026_worker_stats.pl
M src/tools/pgindent/typedefs.list

Handle integer overflow in interval justification functions.

commit   : 54bd1e43ca56e323aef309dc2dc0e1391825ce68    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 15:36:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 15:36:54 -0500    

Click here for diff

justify_interval, justify_hours, and justify_days didn't check for  
overflow when promoting hours to days or days to months; but that's  
possible when the upper field's value is already large.  Detect and  
report any such overflow.  
  
Also, we can avoid unnecessary overflow in some cases in justify_interval  
by pre-justifying the days field.  (Thanks to Nathan Bossart for this  
idea.)  
  
Joe Koshakow  
  
Discussion: https://postgr.es/m/CAAvxfHeNqsJ2xYFbPUf_8nNQUiJqkag04NW6aBQQ0dbZsxfWHA@mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Allow root-owned SSL private keys in libpq, not only the backend.

commit   : a59c79564bdc209a5bc7b02d706f0d7352eb82fa    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 14:12:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 14:12:52 -0500    

Click here for diff

This change makes libpq apply the same private-key-file ownership  
and permissions checks that we have used in the backend since commit  
9a83564c5.  Namely, that the private key can be owned by either the  
current user or root (with different file permissions allowed in the  
two cases).  This allows system-wide management of key files, which  
is just as sensible on the client side as the server, particularly  
when the client is itself some application daemon.  
  
Sync the comments about this between libpq and the backend, too.  
  
David Steele  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-common.c
M src/interfaces/libpq/fe-secure-openssl.c

Don't use static storage for SaveTransactionCharacteristics().

commit   : 12d768e70497afc5a57acf73c251316997b5175a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 12:54:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 12:54:12 -0500    

Click here for diff

This is pretty queasy-making on general principles, and the more so  
once you notice that CommitTransactionCommand() is actually stomping  
on the values saved by _SPI_commit().  It's okay as long as the  
active values didn't change during HoldPinnedPortals(); but that's  
a larger assumption than I think we want to make, especially since  
the fix is so simple.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/executor/spi.c
M src/include/access/xact.h

Fix SPI's handling of errors during transaction commit.

commit   : 2e517818f4af4abe93bf56442469944544f10d4b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 12:45:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 12:45:36 -0500    

Click here for diff

SPI_commit previously left it up to the caller to recover from any error  
occurring during commit.  Since that's complicated and requires use of  
low-level xact.c facilities, it's not too surprising that no caller got  
it right.  Let's move the responsibility for cleanup into spi.c.  Doing  
that requires redefining SPI_commit as starting a new transaction, so  
that it becomes equivalent to SPI_commit_and_chain except that you get  
default transaction characteristics instead of preserving the prior  
transaction's characteristics.  We can make this pretty transparent  
API-wise by redefining SPI_start_transaction() as a no-op.  Callers  
that expect to do something in between might be surprised, but  
available evidence is that no callers do so.  
  
Having made that API redefinition, we can fix this mess by having  
SPI_commit[_and_chain] trap errors and start a new, clean transaction  
before re-throwing the error.  Likewise for SPI_rollback[_and_chain].  
Some cleanup is also needed in AtEOXact_SPI, which was nowhere near  
smart enough to deal with SPI contexts nested inside a committing  
context.  
  
While plperl and pltcl need no changes beyond removing their now-useless  
SPI_start_transaction() calls, plpython needs some more work because it  
hadn't gotten the memo about catching commit/rollback errors in the  
first place.  Such an error resulted in longjmp'ing out of the Python  
interpreter, which leaks Python stack entries at present and is reported  
to crash Python 3.11 altogether.  Add the missing logic to catch such  
errors and convert them into Python exceptions.  
  
We are probably going to have to back-patch this once Python 3.11 ships,  
but it's a sufficiently basic change that I'm a bit nervous about doing  
so immediately.  Let's let it bake awhile in HEAD first.  
  
Peter Eisentraut and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/backend/tcop/postgres.c
M src/backend/utils/mmgr/portalmem.c
M src/include/executor/spi.h
M src/pl/plperl/expected/plperl_transaction.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_transaction.sql
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpython/expected/plpython_transaction.out
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_spi.h
M src/pl/plpython/sql/plpython_transaction.sql
M src/pl/tcl/expected/pltcl_transaction.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_transaction.sql

Adjust interaction of libpq pipeline mode with errorMessage resets.

commit   : b15f254466aefbabcbed001929f6e09db59fd158    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 11:31:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Feb 2022 11:31:30 -0500    

Click here for diff

Since commit ffa2e4670, libpq resets conn->errorMessage only when  
starting a new query.  However, the later introduction of pipelining  
requires a further refinement: the "start of query" isn't necessarily  
when it's submitted to PQsendQueryStart.  If we clear at that point  
then we risk dropping text for an error that the application has not  
noticed yet.  Instead, when queuing a query while a previous query is  
still in flight, leave errorMessage alone; reset it when we begin  
to process the next query in pqPipelineProcessQueue.  
  
Perhaps this should be back-patched to v14 where ffa2e4670 came in.  
However I'm uncertain about whether it interacts with 618c16707.  
In the absence of user complaints, leave v14 alone.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-exec.c

Improve some psql test code

commit   : fbee60f6a4ff2561f5a5af23959a29967f53fbde    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Feb 2022 13:42:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Feb 2022 13:42:38 +0100    

Click here for diff

Split psql_like() into two functions psql_like() and psql_fails_like()  
and make them mirror the existing command_like() and  
command_fails_like() more closely.  In particular, follow the  
universal convention that the test name is the last argument.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/t/001_basic.pl

pg_stat_statements: Remove unnecessary call to GetUserId()

commit   : 667726fbe50f21d7d3ce5d5c5949a45c2496b60f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 28 Feb 2022 10:53:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 28 Feb 2022 10:53:56 +0900    

Click here for diff

The same is done a couple of lines above, so there is no need for the  
same, extra, call.  
  
Author: Dong Wook Lee  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAAcBya+szDd1Y6dJU4_dbH_Ye3=G=8O1oQGG01kv3Tpie7wELQ@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c

Optimise numeric division for one and two base-NBASE digit divisors.

commit   : d1b307eef2818fe24760cc2c168d7d65d59775a8    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 11:12:30 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 11:12:30 +0000    

Click here for diff

Formerly div_var() had "fast path" short division code that was  
significantly faster when the divisor was just one base-NBASE digit,  
but otherwise used long division.  
  
This commit adds a new function div_var_int() that divides by an  
arbitrary 32-bit integer, using the fast short division algorithm, and  
updates both div_var() and div_var_fast() to use it for one and two  
digit divisors. In the case of div_var(), this is slightly faster in  
the one-digit case, because it avoids some digit array copying, and is  
much faster in the two-digit case where it replaces long division. For  
div_var_fast(), it is much faster in both cases because the main  
div_var_fast() algorithm is optimised for larger inputs.  
  
Additionally, optimise exp() and ln() by using div_var_int(), allowing  
a NumericVar to be replaced by an int in a couple of places, most  
notably in the Taylor series code. This produces a significant speedup  
of exp(), ln() and the numeric_big regression test.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCVwsBi-ND-t82Cuuh1=8ee6jdOpzsmGN+CUZB6yjLg9jw@mail.gmail.com  

M src/backend/utils/adt/numeric.c

Simplify the inner loop of numeric division in div_var().

commit   : d996d648f333b04ae3da3c5853120f6f37601fb2    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 10:41:12 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 10:41:12 +0000    

Click here for diff

In the standard numeric division algorithm, the inner loop multiplies  
the divisor by the next quotient digit and subtracts that from the  
working dividend. As suggested by the original code comment, the  
separate "carry" and "borrow" variables (from the multiplication and  
subtraction steps respectively) can be folded together into a single  
variable. Doing so significantly improves performance, as well as  
simplifying the code.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCVwsBi-ND-t82Cuuh1=8ee6jdOpzsmGN+CUZB6yjLg9jw@mail.gmail.com  

M src/backend/utils/adt/numeric.c

Apply auto-vectorization to the inner loop of div_var_fast().

commit   : e3d41d08a17549fdc60a8b9450c0511c11d666d7    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 10:15:46 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 27 Feb 2022 10:15:46 +0000    

Click here for diff

This loop is basically the same as the inner loop of mul_var(), which  
was auto-vectorized in commit 8870917623, but the compiler will only  
consider auto-vectorizing the div_var_fast() loop if the assignment  
target div[qi + i] is replaced by div_qi[i], where div_qi = &div[qi].  
  
Additionally, since the compiler doesn't know that qdigit is  
guaranteed to fit in a 16-bit NumericDigit, cast it to NumericDigit  
before multiplying to make the resulting auto-vectorized code more  
efficient (avoiding unnecessary multiplication of the high 16 bits).  
  
While at it, per suggestion from Tom Lane, change var1digit in  
mul_var() to be a NumericDigit rather than an int for the same  
reason. This actually makes no difference with modern gcc, but it  
might help other compilers generate more efficient assembly.  
  
Dean Rasheed, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCVwsBi-ND-t82Cuuh1=8ee6jdOpzsmGN+CUZB6yjLg9jw@mail.gmail.com  

M src/backend/utils/adt/numeric.c

Run tap tests in src/interfaces/libpq.

commit   : 6b04abdfc5e0653542ac5d586e639185a8c61a39    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:51:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:51:47 -0800    

Click here for diff

To be able to run binaries in the test/ directory, prove_[install]check need  
to be executable in a single shell invocation, so that test/ can be added to  
PATH.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile

Convert src/interfaces/libpq/test to a tap test.

commit   : ac25173cdbc40b310a7e72d9557c45a699f1f7b3    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:51:47 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:51:47 -0800    

Click here for diff

The old form of the test needed a bunch of custom infrastructure. These days  
tap tests provide the necessary infrastructure to do better.  
  
We discussed whether to move this test to src/test/modules, alongside  
libpq_pipeline, but concluded that the opposite direction would be  
better. libpq_pipeline will be moved at a later date, once the buildfarm and  
msvc build infrastructure is ready for it.  
  
The invocation of the tap test will be added in the next commit. It involves  
just enough buildsystem changes to be worth commiting separately. Can't happen  
the other way round because prove errors out when invoked without tests.  
  
Discussion: https://postgr.es/m/[email protected]  

A src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile
D src/interfaces/libpq/test/README
D src/interfaces/libpq/test/expected.out
D src/interfaces/libpq/test/regress.in
D src/interfaces/libpq/test/regress.pl

Fix use of wrong variable in pg_receivewal's get_destination_dir().

commit   : 1155d8b8d52ed8705fd8386eaa64fb05c04170c6    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:43:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:43:54 -0800    

Click here for diff

The global variable wrongly used is always the one passed to  
get_destination_dir(), so there currently are no negative consequences.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACUT0C2LQwhyLXTQdj8T9SxZa5j7cmu-UOz0cZ8_D5edjg@mail.gmail.com  

M src/bin/pg_basebackup/pg_receivewal.c

Fix warning on mingw due to pid_t width, introduced in fe0972ee5e6.

commit   : d33aeefd9b7c8c76f584432717dc944505565e52    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:06:24 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 26 Feb 2022 16:06:24 -0800    

Click here for diff

M src/backend/replication/slot.c

Fix typo in logicalfuncs.c.

commit   : a89850a57e0557bd3faab32398eb2d9536f6e2a4    
  
author   : Amit Kapila <[email protected]>    
date     : Sat, 26 Feb 2022 10:38:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Sat, 26 Feb 2022 10:38:37 +0530    

Click here for diff

Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACX1mVtw8LWEnZgnpPdk2bPFR1xX2ZN+8GfXCffyip_9=Q@mail.gmail.com  

M src/backend/replication/logical/logicalfuncs.c

Add further debug info to help debug 019_replslot_limit.pl failures.

commit   : fe0972ee5e6f8a663c5cf3f24ef98987c503da95    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 25 Feb 2022 16:58:48 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 25 Feb 2022 16:58:48 -0800    

Click here for diff

See also afdeff10526. Failures after that commit provided a few more hints,  
but not yet enough to understand what's going on.  
  
In 019_replslot_limit.pl shut down nodes with fast instead of immediate mode  
if we observe the failure mode. That should tell us whether the failures we're  
observing are just a timing issue under high load. PGCTLTIMEOUT should prevent  
buildfarm animals from hanging endlessly.  
  
Also adds a bit more logging to replication slot drop and ShutdownPostgres().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/init/postinit.c
M src/include/storage/lwlock.h
M src/test/recovery/t/019_replslot_limit.pl

Disallow execution of SPI functions during plperl function compilation.

commit   : 638300fef541fb9393caa1ee8821a639816301d1    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 25 Feb 2022 17:40:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 25 Feb 2022 17:40:21 -0500    

Click here for diff

Perl can be convinced to execute user-defined code during compilation  
of a plperl function (or at least a plperlu function).  That's not  
such a big problem as long as the activity is confined within the  
Perl interpreter, and it's not clear we could do anything about that  
anyway.  However, if such code tries to use plperl's SPI functions,  
we have a bigger problem.  In the first place, those functions are  
likely to crash because current_call_data->prodesc isn't set up yet.  
In the second place, because it isn't set up, we lack critical info  
such as whether the function is supposed to be read-only.  And in  
the third place, this path allows code execution during function  
validation, which is strongly discouraged because of the potential  
for security exploits.  Hence, reject execution of the SPI functions  
until compilation is finished.  
  
While here, add check_spi_usage_allowed() calls to various functions  
that hadn't gotten the memo about checking that.  I think that perhaps  
plperl_sv_to_literal may have been intentionally omitted on the grounds  
that it was safe at the time; but if so, the addition of transforms  
functionality changed that.  The others are more recently added and  
seem to be flat-out oversights.  
  
Per report from Mark Murawski.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/plperl.c

pg_waldump: Fix error message for WAL files smaller than XLOG_BLCKSZ.

commit   : cd83cb953606b94966981056e79dbb6c48751055    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 25 Feb 2022 10:30:05 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 25 Feb 2022 10:30:05 -0800    

Click here for diff

When opening a WAL file smaller than XLOG_BLCKSZ (e.g. 0 bytes long) while  
determining the wal_segment_size, pg_waldump checked errno, despite errno not  
being set by the short read. Resulting in a bogus error message.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, the bug was introducedin fc49e24fa  

M src/bin/pg_waldump/pg_waldump.c

vacuumlazy.c: Remove obsolete num_tuples field.

commit   : 73c61a50a1555007001d29844dcdb10b4f982a73    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 24 Feb 2022 19:01:54 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 24 Feb 2022 19:01:54 -0800    

Click here for diff

Commit 49c9d9fc unified VACUUM VERBOSE and autovacuum logging.  It  
neglected to remove an old vacrel field that was only used by the old  
VACUUM VERBOSE, so remove it now.  
  
The previous num_tuples approach doesn't seem to have any real advantage  
over the approach VACUUM VERBOSE takes now (also the approach used by  
the autovacuum logging code), which is to show new_rel_tuples.  
new_rel_tuples is the possibly-estimated total number of tuples left in  
the table, whereas num_tuples meant the number of tuples encountered  
during the VACUUM operation, after pruning, without regard for tuples  
from pages skipped via the visibility map.  
  
In passing, reorder a related vacrel field for consistency.  

M src/backend/access/heap/vacuumlazy.c

Fix few values in pg_proc for pg_stat_get_replication_slot.

commit   : 22eb12cfff3e842bb35427e1ec819d64daabd5a1    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 25 Feb 2022 07:51:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 25 Feb 2022 07:51:21 +0530    

Click here for diff

The function pg_stat_get_replication_slot() is not a SRF but marked  
incorrectly in the pg_proc.  
  
Reported-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Remove unnecessary heap_tuple_needs_freeze argument.

commit   : cf879d3069a3f025824b4a3fa3086137b34bad48    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 24 Feb 2022 18:31:07 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 24 Feb 2022 18:31:07 -0800    

Click here for diff

The buffer argument hasn't been used since the function was first added  
by commit bbb6e559c4.  The sibling heap_prepare_freeze_tuple function  
doesn't have such an argument either.  Remove it.  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Guard against reallocation failure in pg_regress

commit   : 31d8d4740ffb21c9898a21b5018c31e92af6935d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Feb 2022 20:58:18 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 24 Feb 2022 20:58:18 +0100    

Click here for diff

realloc() will return NULL on a failed reallocation, so the destination  
pointer must be inspected to avoid null pointer dereference.  Further,  
assigning the return value to the source pointer leak the allocation in  
the case of reallocation failure.  Fix by using pg_realloc instead which  
has full error handling.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Fix data loss on crash after sorted GiST index build.

commit   : 6c46e8a5dfc9f49e673d76fc6ae097b81d7740ef    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Feb 2022 16:15:12 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 24 Feb 2022 16:15:12 +0200    

Click here for diff

If a checkpoint happens during sorted GiST index build, and the system  
crashes after the checkpoint and after the index build has finished,  
the data written to the index before the checkpoint started could be  
lost. The checkpoint won't fsync it, and it won't be replayed at crash  
recovery either. Fix by calling smgrimmedsync() after the index build,  
just like in B-tree index build.  
  
Backpatch to v14 where the sorted GiST index build was introduced.  
  
Reported-by: Melanie Plageman  
Discussion: https://www.postgresql.org/message-id/CAAKRu_ZJJynimxKj5xYBSziL62-iEtPE+fx-B=JzR=jUtP92mw@mail.gmail.com  

M src/backend/access/gist/gistbuild.c

commit   : e77216fcb021bb19d83b348db084adfe8d918118    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Feb 2022 16:54:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Feb 2022 16:54:59 +0900    

Click here for diff

This makes more consistent the SRF-related checks in the area of  
PL/pgSQL, PL/Perl, PL/Tcl, pageinspect and some of the JSON worker  
functions, making it easier to grep for the same error patterns through  
the code, reducing a bit the translation work.  
  
It is worth noting that each_worker_jsonb()/each_worker() in jsonfuncs.c  
and pageinspect's brin_page_items() were doing a check on expectedDesc  
that is not required as they fetch their tuple descriptor directly from  
get_call_result_type().  This looks like a set of copy-paste errors that  
have spread over the years.  
  
This commit is a continuation of the changes begun in 07daca5, for any  
remaining code paths on sight.  Like fcc2817, this makes the code more  
consistent, easing the integration of a larger patch that will refactor  
the way tuplestores are created and checked in a good portion of the  
set-returning functions present in core.  
  
I have worked my way through the changes of this patch by myself, and  
Ranier has proposed the same changes in a different thread in parallel,  
though there were some inconsistencies related in expectedDesc in what  
was proposed by him.  
  
Author: Michael Paquier, Ranier Vilela  
Discussion: https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com  
Discussion: https://postgr.es/m/CAEudQApm=AFuJjEHLBjBcJbxcw4pBMwg2sHwXyCXYcbBOj3hpg@mail.gmail.com  

M contrib/pageinspect/brinfuncs.c
M src/backend/utils/adt/jsonfuncs.c
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/tcl/pltcl.c

Clean up and simplify code in a couple of set-returning functions

commit   : fcc28178c6943d7df72b484a87fdb7e06d0c1079    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 24 Feb 2022 16:11:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 24 Feb 2022 16:11:34 +0900    

Click here for diff

The following set-returning functions have their logic simplified, to be  
more consistent with other in-core areas:  
- pg_prepared_statement()'s tuple descriptor is now created with  
get_call_result_type() instead of being created from scratch, saving  
from some duplication with pg_proc.dat.  
- show_all_file_settings(), similarly, now uses get_call_result_type()  
to build its tuple descriptor instead of creating it from scratch.  
- pg_options_to_table() made use of a static routine called only once.  
This commit removes this internal routine to make the function easier to  
follow.  
- pg_config() was using a unique logic style, doing checks on the tuple  
descriptor passed down in expectedDesc, but it has no need to do so.  
This switches the function to use a tuplestore with a tuple descriptor  
retrieved from get_call_result_type(), instead.  
  
This simplifies an upcoming patch aimed at refactoring the way  
tuplestores are created and checked in set-returning functions, this  
change making sense as its own independent cleanup by shaving some  
code.  
  
Author: Melanie Plageman, Michael Paquier  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com  

M src/backend/commands/prepare.c
M src/backend/foreign/foreign.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/mmgr/portalmem.c

postgres_fdw: Add support for parallel commit.

commit   : 04e706d4238f98a98e1c0b1a02db9d4280b96f04    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 24 Feb 2022 14:30:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 24 Feb 2022 14:30:00 +0900    

Click here for diff

postgres_fdw commits remote (sub)transactions opened on remote server(s)  
in a local (sub)transaction one by one when the local (sub)transaction  
commits.  This patch allows it to commit the remote (sub)transactions in  
parallel to improve performance.  This is enabled by the server option  
"parallel_commit".  The default is false.  
  
Etsuro Fujita, reviewed by Fujii Masao and David Zhang.  
  
Discussion: http://postgr.es/m/CAPmGK17dAZCXvwnfpr1eTfknTGdt%3DhYTV9405Gt5SqPOX8K84w%40mail.gmail.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Fix one of the tests introduced in commit 52e4f0cd47.

commit   : cfb4e209ec15d4a0c44efa98b2788be806a43a92    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 24 Feb 2022 08:54:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 24 Feb 2022 08:54:39 +0530    

Click here for diff

In the Publisher-Subscriber setup, after performing a DML operation on the  
publisher, we need to wait for it to be replayed on the subscriber before  
querying the same data on the subscriber. One of the tests missed the wait  
step.  
  
As per buildfarm.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pv=e9Qd1TSYo8Og6x6Abfz3b9_htwinLp4ENPgV45DACQ@mail.gmail.com  

M src/test/subscription/t/028_row_filter.pl

Re-allow underscore as first character of custom GUC names.

commit   : bd74c4037c4ee268db46e983bcc0f1e0a9f7ab72    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 23 Feb 2022 11:10:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 23 Feb 2022 11:10:46 -0500    

Click here for diff

Commit 3db826bd5 intended that valid_custom_variable_name's  
rules for valid identifiers match those of scan.l.  However,  
I (tgl) had some kind of brain fade and put "_" in the wrong  
list.  
  
Fix by Japin Li, per bug #17415 from Daniel Polski.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c

Quick exit on log stream child exit in pg_basebackup

commit   : 0475a97f744d2fea3676b2e69405d20358eac07a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:24:43 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:24:43 +0100    

Click here for diff

If the log streaming child process (thread on Windows) dies during  
backup then the whole backup will be aborted at the end of the  
backup.  Instead, trap ungraceful termination of the log streaming  
child and exit early.  This also adds a TAP test for simulating this  
by terminating the responsible backend.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/VI1PR83MB0189818B82C19059CB62E26199A89@VI1PR83MB0189.EURPRD83.prod.outlook.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Remove duplicated word in comment

commit   : c7d7e1203958952e0ef67d336c58f1e7094e7634    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:23:50 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:23:50 +0100    

Click here for diff

Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/013_crash_restart.pl

Add function to pump IPC process until string match

commit   : 6da65a3f9a9deae4fdcc768c612b0c8f52759f75    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:22:16 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 14:22:16 +0100    

Click here for diff

Refactor the recovery tests to not carry a local duplicated copy of  
the pump_until function which pumps a process until a defined string  
is seen on a stream. This reduces duplication, and is in preparation  
for another patch which will also use this functionality.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/022_crash_temp_files.pl

Use test functions in pg_rewind test module

commit   : 91d3580535238abf93c67a6d3dce64f0e8c3cc6d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 11:22:46 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 11:22:46 +0100    

Click here for diff

Commit 61081e75c introduced pg_rewind along with the test suite, which  
ensured that subroutines didn't incur more than one test to plan.  Now  
that we no longer explicitly plan tests (since 549ec201d),  we can use  
the usual Test::More functions.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/t/RewindTest.pm

Fix statenames in mergejoin comments

commit   : 2313a3ee22eb3c63a987b496df64c67443763a5a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 10:54:03 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 23 Feb 2022 10:54:03 +0100    

Click here for diff

The names in the comments were on a few states not consistent with  
the documented state.  
  
Author: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/CALNJ-vQVthfQXVqmrHR8BKHtC4fMGbhM1xbvJNJAPexTq_dH=w@mail.gmail.com  

M src/backend/executor/nodeMergejoin.c

Add temporary debug info to help debug 019_replslot_limit.pl failures.

commit   : afdeff10526e29e3fc63b18c08100458780489d9    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 22 Feb 2022 18:02:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 22 Feb 2022 18:02:34 -0800    

Click here for diff

I have not been able to reproduce the occasional failures of  
019_replslot_limit.pl we are seeing in the buildfarm and not for lack of  
trying. The additional logging and increased log level will hopefully help.  
  
Will be reverted once the cause is identified.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/test/recovery/t/019_replslot_limit.pl

Put typtype letters back into consistent order

commit   : 9467321649efc1fec28603d4ba35d03202c4ead1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 22 Feb 2022 10:08:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 22 Feb 2022 10:08:11 +0100    

Click here for diff

M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Allow specifying row filters for logical replication of tables.

commit   : 52e4f0cd472d39d07732b99559989ea3b615be78    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 22 Feb 2022 07:54:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 22 Feb 2022 07:54:12 +0530    

Click here for diff

This feature adds row filtering for publication tables. When a publication  
is defined or modified, an optional WHERE clause can be specified. Rows  
that don't satisfy this WHERE clause will be filtered out. This allows a  
set of tables to be partially replicated. The row filter is per table. A  
new row filter can be added simply by specifying a WHERE clause after the  
table name. The WHERE clause must be enclosed by parentheses.  
  
The row filter WHERE clause for a table added to a publication that  
publishes UPDATE and/or DELETE operations must contain only columns that  
are covered by REPLICA IDENTITY. The row filter WHERE clause for a table  
added to a publication that publishes INSERT can use any column. If the  
row filter evaluates to NULL, it is regarded as "false". The WHERE clause  
only allows simple expressions that don't have user-defined functions,  
user-defined operators, user-defined types, user-defined collations,  
non-immutable built-in functions, or references to system columns. These  
restrictions could be addressed in the future.  
  
If you choose to do the initial table synchronization, only data that  
satisfies the row filters is copied to the subscriber. If the subscription  
has several publications in which a table has been published with  
different WHERE clauses, rows that satisfy ANY of the expressions will be  
copied. If a subscriber is a pre-15 version, the initial table  
synchronization won't use row filters even if they are defined in the  
publisher.  
  
The row filters are applied before publishing the changes. If the  
subscription has several publications in which the same table has been  
published with different filters (for the same publish operation), those  
expressions get OR'ed together so that rows satisfying any of the  
expressions will be replicated.  
  
This means all the other filters become redundant if (a) one of the  
publications have no filter at all, (b) one of the publications was  
created using FOR ALL TABLES, (c) one of the publications was created  
using FOR ALL TABLES IN SCHEMA and the table belongs to that same schema.  
  
If your publication contains a partitioned table, the publication  
parameter publish_via_partition_root determines if it uses the partition's  
row filter (if the parameter is false, the default) or the root  
partitioned table's row filter.  
  
Psql commands \dRp+ and \d <table-name> will display any row filters.  
  
Author: Hou Zhijie, Euler Taveira, Peter Smith, Ajin Cherian  
Reviewed-by: Greg Nancarrow, Haiying Tang, Amit Kapila, Tomas Vondra, Dilip Kumar, Vignesh C, Alvaro Herrera, Andres Freund, Wei Wang  
Discussion: https://www.postgresql.org/message-id/flat/CAHE3wggb715X%2BmK_DitLXF25B%3DjE6xyNCH4YOwM860JR7HarGQ%40mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/commands/publicationcmds.h
M src/include/nodes/parsenodes.h
M src/include/replication/logicalproto.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
A src/test/subscription/t/028_row_filter.pl
M src/tools/pgindent/typedefs.list

Add compute_query_id = regress

commit   : ebf6c5249b7db525e59563fb149642665c88f747    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 22 Feb 2022 10:22:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 22 Feb 2022 10:22:15 +0900    

Click here for diff

"regress" is a new mode added to compute_query_id aimed at facilitating  
regression testing when a module computing query IDs is loaded into the  
backend, like pg_stat_statements.  It works the same way as "auto",  
meaning that query IDs are computed if a module enables it, except that  
query IDs are hidden in EXPLAIN outputs to ensure regression output  
stability.  
  
Like any GUCs of the kind (force_parallel_mode, etc.), this new  
configuration can be added to an instance's postgresql.conf, or just  
passed down with PGOPTIONS at command level.  compute_query_id uses an  
enum for its set of option values, meaning that this addition ensures  
ABI compatibility.  
  
Using this new configuration mode allows installcheck-world to pass when  
running the tests on an instance with pg_stat_statements enabled,  
stabilizing the test output while checking the paths doing query ID  
computations.  
  
Reported-by: Anton Melnikov  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/YgHlxgc/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/config.sgml
M src/backend/commands/explain.c
M src/backend/utils/misc/guc.c
M src/include/utils/queryjumble.h

Disallow setting bogus GUCs within an extension's reserved namespace.

commit   : 88103567cb8fa5be46dc9fac3e3b8774951a2be7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 21 Feb 2022 14:10:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 21 Feb 2022 14:10:15 -0500    

Click here for diff

Commit 75d22069e tried to throw a warning for setting a custom GUC whose  
prefix belongs to a previously-loaded extension, if there is no such GUC  
defined by the extension.  But that caused unstable behavior with  
parallel workers, because workers don't necessarily load extensions and  
GUCs in the same order their leader did.  To make that work safely, we  
have to completely disallow the case.  We now actually remove any such  
GUCs at the time of initial extension load, and then throw an error not  
just a warning if you try to add one later.  While this might create a  
compatibility issue for a few people, the improvement in error-detection  
capability seems worth it; it's hard to believe that there's any good  
use-case for choosing such GUC names.  
  
This also un-reverts 5609cc01c (Rename EmitWarningsOnPlaceholders() to  
MarkGUCPrefixReserved()), since that function's old name is now even  
more of a misnomer.  
  
Florin Irion and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/basic_archive/basic_archive.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/option.c
M contrib/sepgsql/hooks.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/tcl/pltcl.c
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Assert in init_toast_snapshot() that some snapshot registered or active.

commit   : 2776922201f751e3202a713b61d97fe4e44a8440    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 19 Feb 2022 12:42:37 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 19 Feb 2022 12:42:37 -0800    

Click here for diff

Commit <FIXME> fixed the bug that RemoveTempRelationsCallback() did not  
push/register a snapshot. That only went unnoticed because often a valid  
catalog snapshot exists and is returned by GetOldestSnapshot(). But due to  
invalidation processing that is not reliable.  
  
Thus assert in init_toast_snapshot() that there is a registered or active  
snapshot, using the new HaveRegisteredOrActiveSnapshot().  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/common/toast_internals.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Fix temporary object cleanup failing due to toast access without snapshot.

commit   : 7c38ef2a5d6cf6d8dc3834399d7a1c364d64ce64    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Feb 2022 08:57:34 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Feb 2022 08:57:34 -0800    

Click here for diff

When cleaning up temporary objects during process exit the cleanup could fail  
with:  
  FATAL: cannot fetch toast data without an active snapshot  
  
The bug is caused by RemoveTempRelationsCallback() not setting up a  
snapshot. If an object with toasted catalog data needs to be cleaned up,  
init_toast_snapshot() could fail with the above error.  
  
Most of the time however the the problem is masked due to cached catalog  
snapshots being returned by GetOldestSnapshot(). But dropping an object can  
cause catalog invalidations to be emitted. If no further catalog accesses are  
necessary between the invalidation processing and the next toast datum  
deletion, the bug becomes visible.  
  
It's easy to miss this bug because it typically happens after clients  
disconnect and the FATAL error just ends up in the log.  
  
Luckily temporary table cleanup at the next use of the same temporary schema  
or during DISCARD ALL does not have the same problem.  
  
Fix the bug by pushing a snapshot in RemoveTempRelationsCallback(). Also add  
isolation tests for temporary object cleanup, including objects with toasted  
catalog data.  
  
A future HEAD only commit will add an assertion trying to make this more  
visible.  
  
Reported-By: Miles Delahunty  
Author: Andres Freund  
Discussion: https://postgr.es/m/CAOFAq3BU5Mf2TTvu8D9n_ZOoFAeQswuzk7yziAb7xuw_qyw5gw@mail.gmail.com  
Backpatch: 10-  

M src/backend/catalog/namespace.c
A src/test/isolation/expected/temp-schema-cleanup.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/temp-schema-cleanup.spec

pg_upgrade: Don't print progress status when output is not a tty.

commit   : 27b02e070fd1b6622b10937d9346b65ffacbc351    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 21 Feb 2022 08:34:59 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 21 Feb 2022 08:34:59 -0800    

Click here for diff

Until this change pg_upgrade with output redirected to a file / pipe would end  
up printing all files in the cluster. This has made check-world output  
exceedingly verbose.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Reviewed-By: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGKjrV61ZVJ8OSag+3rKRmCZXPc03bDyWMqhXg3rdZ=fOw@mail.gmail.com  

M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/util.c

pgcrypto: Remove unused error code

commit   : 3f649663a49d5bb815858d90a271bb532c58fd0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 10:55:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 10:55:03 +0100    

Click here for diff

PXE_DEV_READ_ERROR hasn't been used since random device support was  
removed from pgcrypto (fe0a0b5993dfe24e4b3bcf52fa64ff41a444b8f1).  

M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h

pgcrypto: Remove unused error code

commit   : abe81ee08468e63f94b91e484f47c867bcc706d3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 10:28:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 10:28:43 +0100    

Click here for diff

PXE_MCRYPT_INTERNAL was apparently never used even when it was added.  

M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h

Fix possible null pointer reference

commit   : 5c868c92caa864d223006c095d623b8086754c6f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 09:42:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 21 Feb 2022 09:42:46 +0100    

Click here for diff

Per Coverity.  Introduced in 37851a8b83d3d57ca48736093b10aa5f3bc0c177.  

M src/backend/utils/init/postinit.c

doc: Mention environment variable ZSTD in the TAP tests for MSVC

commit   : bf4ed12b58205d8527053d53c8f473074e191b8d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 21 Feb 2022 09:55:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 21 Feb 2022 09:55:55 +0900    

Click here for diff

6c417bb has added the build infrastructure to support ZSTD, but forgot  
to update this section of the docs to mention the variable ZSTD, as per  
the change done in vcregress.pl.  
  
While on it, reword this section of the docs to describe what happens in  
the default case, as per a suggestion from Robert Haas.  
  
Discussion: https://postgr.es/m/YhCL0fKnDv/[email protected]  

M doc/src/sgml/install-windows.sgml

Fix meaning-changing typo introduced in fa0e03c15a9f.

commit   : fbabdf8f9a55894f7cd8f0fa86c9a4ef55576296    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 20 Feb 2022 13:51:36 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 20 Feb 2022 13:51:36 -0800    

Click here for diff

M src/backend/utils/init/postinit.c

Reset conn->errorReported when PQrequestCancel sets errorMessage.

commit   : 83a7637e2c5be27a0788b920501dde284b3fca33    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 20 Feb 2022 15:02:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 20 Feb 2022 15:02:41 -0500    

Click here for diff

Oversight in commit 618c16707.  This is mainly neatnik-ism, since  
if PQrequestCancel is used per its API contract, we should perform  
pqClearConnErrorState before reaching any place that would consult  
errorReported.  But still, it seems like a bad idea to potentially  
leave errorReported pointing past errorMessage.len.  

M src/interfaces/libpq/fe-connect.c

Remove most msys special processing in TAP tests

commit   : 1c6d4629394d1b696b4e47ab4c501752e8c974e7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 20 Feb 2022 11:47:56 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 20 Feb 2022 11:47:56 -0500    

Click here for diff

Following migration of Windows buildfarm members running TAP tests to  
use of ucrt64 perl for those tests, special processing for msys perl is  
no longer necessary and so is removed.  
  
Backpatch to release 10  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/cp_history_files

Remove PostgreSQL::Test::Utils::perl2host completely

commit   : 95d981338b241ce1d1b2346cfe2df509bb7243ca    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Feb 2022 17:00:03 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Feb 2022 17:00:03 -0500    

Click here for diff

Commit f1ac4a74de disabled this processing, and as nothing has broken (as  
expected) here we proceed to remove the routine and adjust all the call  
sites.  
  
Backpatch to release 10  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Ensure the right perl is used for TAP tests on msys

commit   : cf12541f2bd5fd34425ecbb99f056a30ca5b7cae    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 18 Feb 2022 16:59:30 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 18 Feb 2022 16:59:30 -0500    

Click here for diff

In particular, perl with $Config{osname} = msys should only be used if  
the build target is msys (which is currently buildable but not usable).  
For builds targeted at native Windows, perl from the ucrt64 toolchain is  
suitable.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/check_modules.pl
M configure
M configure.ac

Fix uninitialized variable.

commit   : 69639e2b5c12c6f1eafa9db1a6b7d16e6471ac61    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 20 Feb 2022 18:33:09 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 20 Feb 2022 18:33:09 +0200    

Click here for diff

I'm very surprised the compiler didn't warn about it. But Coverity and  
Valgrind did.  

M src/backend/access/transam/xlog.c

Use bitwise rotate functions in more places

commit   : 4b35408f1ed59dd590f683ae0f015bbaf3b84d3d    
  
author   : John Naylor <[email protected]>    
date     : Sun, 20 Feb 2022 13:22:08 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 20 Feb 2022 13:22:08 +0700    

Click here for diff

There were a number of places in the code that used bespoke bit-twiddling  
expressions to do bitwise rotation. While we've had pg_rotate_right32()  
for a while now, we hadn't gotten around to standardizing on that. Do so  
now. Since many potential call sites look more natural with the "left"  
equivalent, add that function too.  
  
Reviewed by Tom Lane and Yugo Nagata  
  
Discussion:  
https://www.postgresql.org/message-id/CAFBsxsH7c1LC0CGZ0ADCBXLHU5-%3DKNXx-r7tHYPAW51b2HK4Qw%40mail.gmail.com  

M src/backend/executor/execGrouping.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeMemoize.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/cache/catcache.c
M src/common/hashfn.c
M src/include/port/pg_bitutils.h

doc: Simplify description of --with-lz4

commit   : d7a978601d4e469f1a8f19122c049bb25fd7f096    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Feb 2022 15:06:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Feb 2022 15:06:53 +0900    

Click here for diff

LZ4 is used in much more areas of the system now than just WAL and table  
data.  This commit simplifies the installation documentation of Windows  
and *nix by removing any details of the areas extended when building  
with LZ4.  
  
Author: Jeevan Ladhe  
Discussion: https://postgr.es/m/CANm22Cgny8AF76pitomXp603NagwKXbA4dyN2Fac4yHPebqdqg@mail.gmail.com  

M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml

Fix inconsistencies in SRF checks of pg_config() and string_to_table()

commit   : 07daca53bfcad59618a9c6fad304e380cc9d2bc1    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 19 Feb 2022 14:58:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 19 Feb 2022 14:58:51 +0900    

Click here for diff

The execution paths of those functions have been using a set of checks  
inconsistent with any other SRF function:  
- string_to_table() missed a check on expectedDesc, the tuple descriptor  
expected by the caller, that should never be NULL.  Introduced in  
66f1630.  
- pg_config() should check for a ReturnSetInfo, and expectedDesc cannot  
be NULL.  Its error messages were also inconsistent.  Introduced in  
a5c43b8.  
  
Extracted from a larger patch by the same author, in preparation for a  
larger patch set aimed at refactoring the way tuplestores are created  
and checked in SRF functions.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com  

M src/backend/utils/adt/varlena.c
M src/backend/utils/misc/pg_config.c

Rearrange libpq's error reporting to avoid duplicated error text.

commit   : 618c16707a6d6e8f5c83ede2092975e4670201ad    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 15:35:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 15:35:15 -0500    

Click here for diff

Since commit ffa2e4670, libpq accumulates text in conn->errorMessage  
across a whole query cycle.  In some situations, we may report more  
than one error event within a cycle: the easiest case to reach is  
where we report a FATAL error message from the server, and then a  
bit later we detect loss of connection.  Since, historically, each  
error PGresult bears the entire content of conn->errorMessage,  
this results in duplication of the FATAL message in any output that  
concatenates the contents of the PGresults.  
  
Accumulation in errorMessage still seems like a good idea, especially  
in view of the number of places that did ad-hoc error concatenation  
before ffa2e4670.  So to fix this, let's track how much of  
conn->errorMessage has been read out into error PGresults, and only  
include new text in later PGresults.  The tricky part of that is  
to be sure that we never discard an error PGresult once made (else  
we'd risk dropping some text, a problem much worse than duplication).  
While libpq formerly did that in some code paths, a little bit of  
rearrangement lets us postpone making an error PGresult at all until  
we are about to return it.  
  
A side benefit of that postponement is that it now becomes practical  
to return a dummy static PGresult in cases where we hit out-of-memory  
while trying to manufacture an error PGresult.  This eliminates the  
admittedly-very-rare case where we'd return NULL from PQgetResult,  
indicating successful query completion, even though what actually  
happened was an OOM failure.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot_creation_error.out
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

Add support for building with ZSTD.

commit   : 6c417bbcc8ff98875234ca269979fc7defde58e5    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 18 Feb 2022 13:40:31 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 18 Feb 2022 13:40:31 -0500    

Click here for diff

This commit doesn't actually add anything that uses ZSTD; that will be  
done separately. It just puts the basic infrastructure into place.  
  
Jeevan Ladhe, Robert Haas, and Michael Paquier. Reviewed by Justin  
Pryzby and Andres Freund.  
  
Discussion: http://postgr.es/m/CA+TgmoatQKGd+8SjcV+bzvw4XaoEwminHjU83yG12+NXtQzTTQ@mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/Makefile.global.in
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm
M src/tools/msvc/config_default.pl
M src/tools/msvc/vcregress.pl

Don't let libpq PGEVT_CONNRESET callbacks break a PGconn.

commit   : 2e372869aa38a9d6e4552c192da4454b17e01e38    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 11:43:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 11:43:04 -0500    

Click here for diff

As currently implemented, failure of a PGEVT_CONNRESET callback  
forces the PGconn into the CONNECTION_BAD state (without closing  
the socket, which is inconsistent with other failure paths), and  
prevents later callbacks from being called.  This seems highly  
questionable, and indeed is questioned by comments in the source.  
  
Instead, let's just ignore the result value of PGEVT_CONNRESET  
calls.  Like the preceding commit, this converts event callbacks  
into "pure observers" that cannot affect libpq's processing logic.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c

Don't let libpq "event" procs break the state of PGresult objects.

commit   : ce1e7a2f716919652c280937087b24937677f8b3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 11:37:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 18 Feb 2022 11:37:27 -0500    

Click here for diff

As currently implemented, failure of a PGEVT_RESULTCREATE callback  
causes the PGresult to be converted to an error result.  This is  
intellectually inconsistent (shouldn't a failing callback likewise  
prevent creation of the error result? what about side-effects on the  
behavior seen by other event procs? why does PQfireResultCreateEvents  
act differently from PQgetResult?), but more importantly it destroys  
any promises we might wish to make about the behavior of libpq in  
nontrivial operating modes, such as pipeline mode.  For example,  
it's not possible to promise that PGRES_PIPELINE_SYNC results will  
be returned if an event callback fails on those.  With this  
definition, expecting applications to behave sanely in the face of  
possibly-failing callbacks seems like a very big lift.  
  
Hence, redefine the result of a callback failure as being simply  
that that event procedure won't be called any more for this PGresult  
(which was true already).  Event procedures can still signal failure  
back to the application through out-of-band mechanisms, for example  
via their passthrough arguments.  
  
Similarly, don't let failure of a PGEVT_RESULTCOPY callback prevent  
PQcopyResult from succeeding.  That definition allowed a misbehaving  
event proc to break single-row mode (our sole internal use of  
PQcopyResult), and it probably had equally deleterious effects for  
outside uses.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-events.c

Suppress warning about stack_base_ptr with late-model GCC.

commit   : de447bb8e6fbbad19f964a2d7f04c9ccc1d06903    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2022 22:45:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2022 22:45:34 -0500    

Click here for diff

GCC 12 complains that set_stack_base is storing the address of  
a local variable in a long-lived pointer.  This is an entirely  
reasonable warning (indeed, it just helped us find a bug);  
but that behavior is intentional here.  We can work around it  
by using __builtin_frame_address(0) instead of a specific local  
variable; that produces an address a dozen or so bytes different,  
in my testing, but we don't care about such a small difference.  
Maybe someday a compiler lacking that function will start to issue  
a similar warning, but we'll worry about that when it happens.  
  
Patch by me, per a suggestion from Andres Freund.  Back-patch to  
v12, which is as far back as the patch will go without some pain.  
(Recently-established project policy would permit a back-patch as  
far as 9.2, but I'm disinclined to expend the work until GCC 12  
is much more widespread.)  
  
Discussion: https://postgr.es/m/[email protected]  

M config/c-compiler.m4
M configure
M configure.ac
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/miscinit.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix comment in CheckIndexCompatible().

commit   : f927a6ec3ef710ad2bd7d9c63f524b7a22d7e664    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 18 Feb 2022 12:19:10 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 18 Feb 2022 12:19:10 +0900    

Click here for diff

Commit 5f173040 removed the parameter "heapRelation" from  
CheckIndexCompatible(), but forgot to remove the mention of it  
from the comment. This commit removes that unnecessary mention.  
  
Also this commit adds the missing mention of the parameter "oldId"  
in the comment.  
  
Author: Yugo Nagata  
Reviewed-by: Nathan Bossart, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/indexcmds.c

postgres_fdw: Make postgres_fdw.application_name support more escape sequences.

commit   : 94c49d53402240ad7ddbcae9049ff2840a54b9c6    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 18 Feb 2022 11:38:12 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 18 Feb 2022 11:38:12 +0900    

Click here for diff

Commit 6e0cb3dec1 allowed postgres_fdw.application_name to include  
escape sequences %a (application name), %d (database name), %u (user name)  
and %p (pid). In addition to them, this commit makes it support  
the escape sequences for session ID (%c) and cluster name (%C).  
These are helpful to investigate where each remote transactions came from.  
  
Author: Fujii Masao  
Reviewed-by: Ryohei Takahashi, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml
M src/include/utils/guc.h

Fix a comment in worker.c.

commit   : c476f380e296bab57fecada1ea96c86d575bf160    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 18 Feb 2022 07:44:24 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 18 Feb 2022 07:44:24 +0530    

Click here for diff

The comment incorrectly states that worker gets killed during  
ALTER SUBSCRIPTION ... DISABLE. Remove that part of the comment.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoCbEN==oH7BhP3U6WPHg3zgH6sDOeKhJjy4W2dx-qoVCw@mail.gmail.com  

M src/backend/replication/logical/worker.c

Avoid dangling-pointer usage in pg_basebackup progress reports.

commit   : 62cb7427d1e491faf8612a82c2e3711a8cd65422    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2022 15:03:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 17 Feb 2022 15:03:40 -0500    

Click here for diff

Ill-considered refactoring in 23a1c6578 led to progress_filename  
sometimes pointing to data that had gone out of scope.  The most  
bulletproof fix is to hang onto a copy of whatever's passed in.  
Compared to the work spent elsewhere per file, that's not very  
expensive, plus we can skip it except in verbose logging mode.  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

Add missing binary-upgrade guard.

commit   : 138c51b72168e7b57c9edb4e9935274d3abf6bed    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 17 Feb 2022 10:53:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 17 Feb 2022 10:53:51 -0500    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged for  
pg_dumpall to preserve tablespace OIDs, but it should only do that  
in binary upgrade mode, not all the time.  
  
Reported by Christoph Berg.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dumpall.c

Disable perl2host() processing in TAP tests

commit   : f1ac4a74dee5ac0c89612fe2ac6e48082edbec23    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 17 Feb 2022 09:59:59 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 17 Feb 2022 09:59:59 -0500    

Click here for diff

This is a preliminary step towards removing it altogether, but this lets  
us double check that nothing breaks in the buildfarm before we do.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Utils.pm

plpython: Reject Python 2 during build configuration.

commit   : 19252e8ec938bf07897c1519f367d0467a39242c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 16 Feb 2022 22:47:35 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 16 Feb 2022 22:47:35 -0800    

Click here for diff

Python 2.7 went EOL 2020-01-01 and the support for Python 2 requires a fair  
bit of infrastructure. Therefore we are removing Python 2 support in plpython.  
  
This patch just rejects Python 2 during configure / mkvcbuild.pl. Future  
commits will remove the code and infrastructure for Python 2 support and  
adjust more of the documentation. This way we can see the buildfarm state  
after the removal sooner and we can be sure that failures are due to  
desupporting Python 2, rather than caused by infrastructure cleanup.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/tools/msvc/Mkvcbuild.pm

Increase hash_mem_multiplier default to 2.0.

commit   : 8f388f6f554b113f25a53fe3237238d2c58ed1eb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 16 Feb 2022 18:41:52 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 16 Feb 2022 18:41:52 -0800    

Click here for diff

Double the default setting for hash_mem_multiplier, from 1.0 to 2.0.  
This setting makes hash-based executor nodes use twice the usual  
work_mem limit.  
  
The PostgreSQL 15 release notes should have a compatibility note about  
this change.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzndc_ROk6CY-bC6p9O53q974Y0Ey4WX8jcPbuTZYM4Q3A@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/join_hash.out
M src/test/regress/expected/memoize.out
M src/test/regress/sql/groupingsets.sql
M src/test/regress/sql/join_hash.sql
M src/test/regress/sql/memoize.sql

Avoid VACUUM reltuples distortion.

commit   : 74388a1ac36d2f0206c5477eeddc636d7947a5a4    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 16 Feb 2022 17:15:50 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 16 Feb 2022 17:15:50 -0800    

Click here for diff

Add a heuristic that avoids distortion in the pg_class.reltuples  
estimates used by VACUUM.  Without the heuristic, successive manually  
run VACUUM commands (run against a table that is never modified after  
initial bulk loading) will scan the same page in each VACUUM operation.  
Eventually pg_class.reltuples may reach the point where one single heap  
page is accidentally considered highly representative of the entire  
table.  This is likely to be completely wrong, since the last heap page  
typically has fewer tuples than average for the table.  
  
It's not obvious that this was a problem prior to commit 44fa8488, which  
made vacuumlazy.c consistently scan the last heap page (even when it is  
all-visible in the visibility map).  It seems possible that there were  
more subtle variants of the same problem that went unnoticed for quite  
some time, though.  Commit 44fa8488 simplified certain aspects of when  
and how relation truncation was considered, but it did not introduce the  
"scan the last page" behavior.  Essentially the same behavior was  
introduced much earlier, in commit e8429082.  It was conditioned on  
whether or not truncation looked promising towards the end of the  
initial heap pass by VACUUM until recently, which was at least somewhat  
protective.  That doesn't seem like something that we should be relying  
on, though.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkNKORurux459M64mR63Aw4Jq7MBRVcX=CvALqN3A88WA@mail.gmail.com  

M src/backend/commands/vacuum.c

Remove all traces of tuplestore_donestoring() in the C code

commit   : d61a361d1aef1231db61162d99b635b89c73169d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 17 Feb 2022 09:52:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 17 Feb 2022 09:52:02 +0900    

Click here for diff

This routine is a no-op since dd04e95 from 2003, with a macro kept  
around for compatibility purposes.  This has led to the same code  
patterns being copy-pasted around for no effect, sometimes in confusing  
ways like in pg_logical_slot_get_changes_guts() from logical.c where the  
code was actually incorrect.  
  
This issue has been discussed on two different threads recently, so  
rather than living with this legacy, remove any uses of this routine in  
the C code to simplify things.  The compatibility macro is kept to avoid  
breaking any out-of-core modules that depend on it.  
  
Reported-by: Tatsuhito Kasahara, Justin Pryzby  
Author: Tatsuhito Kasahara  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAP0=ZVJeeYfAeRfmzqAF2Lumdiv4S4FewyBnZd4DPTrsSQKJKw@mail.gmail.com  

M contrib/dblink/dblink.c
M contrib/pageinspect/brinfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/connection.c
M contrib/tablefunc/tablefunc.c
M contrib/xml2/xpath.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/commands/event_trigger.c
M src/backend/commands/extension.c
M src/backend/commands/prepare.c
M src/backend/foreign/foreign.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/shmem.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/mmgr/portalmem.c
M src/include/utils/tuplestore.h

Fix bogus log message when starting from a cleanly shut down state.

commit   : 46208923446651a58c49115d17b4de6da4934c71    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 23:15:08 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 23:15:08 +0200    

Click here for diff

In commit 70e81861fa to split xlog.c, I moved the startup code that  
updates the state in the control file and prints out the "database  
system was not properly shut down" message to the log, but I  
accidentally removed the "if (InRecovery)" check around it. As a  
result, that message was printed even if the system was cleanly shut  
down, also during 'initdb'.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/xlogrecovery.c

Add missing TYPEALIGN macros

commit   : 01ad1c953032ea2b88893d6a2f50fb4a8fea2873    
  
author   : John Naylor <[email protected]>    
date     : Wed, 16 Feb 2022 19:33:28 +0700    
  
committer: John Naylor <[email protected]>    
date     : Wed, 16 Feb 2022 19:33:28 +0700    

Click here for diff

A couple call sites still had hard-coded characters.  
  
Amul Sul  
  
Discussion: https://www.postgresql.org/message-id/CAAJ_b94Y35MWB3PJoCbc_O-_Q4%2B-9DHKhWtAwboEyx8wm4mqcA%40mail.gmail.com  

M src/backend/commands/typecmds.c

Fix read beyond buffer bug introduced by the split xlog.c patch.

commit   : 9ed87a78e0377728588e5c8688202195694581aa    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 12:01:32 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 12:01:32 +0200    

Click here for diff

FinishWalRecovery() copied the valid part of the last WAL block into a  
palloc'd buffer, and the code in StartupXLOG() copied it to the WAL  
buffer. But the memcpy in StartupXLOG() copied a full 8kB block, not  
just the valid part, i.e. it copied from beyond the end of the buffer.  
The invalid part was cleared immediately afterwards, so as long as the  
memory was allocated and didn't segfault, it didn't do any harm, but  
it can definitely segfault.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/xlog.c

Reject trailing junk after numeric literals

commit   : 2549f0661bd28571d7200d6f82f752a7ee5d47e1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 16 Feb 2022 10:32:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 16 Feb 2022 10:32:36 +0100    

Click here for diff

After this, the PostgreSQL lexers no longer accept numeric literals  
with trailing non-digits, such as 123abc, which would be scanned as  
two tokens: 123 and abc.  This is undocumented and surprising, and it  
might also interfere with some extended numeric literal syntax being  
contemplated for the future.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/numerology.out
M src/test/regress/sql/numerology.sql

Split xlog.c into xlog.c and xlogrecovery.c.

commit   : 70e81861fadd9112fa2d425c762e163910a4ee52    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:30:38 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:30:38 +0200    

Click here for diff

This moves the functions related to performing WAL recovery into the new  
xlogrecovery.c source file, leaving xlog.c responsible for maintaining  
the WAL buffers, coordinating the startup and switch from recovery to  
normal operations, and other miscellaneous stuff that have always been in  
xlog.c.  
  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Robert Haas  
Discussion: https://www.postgresql.org/message-id/a31f27b4-a31d-f976-6217-2b03be646ffa%40iki.fi  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/transam/Makefile
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
A src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/sync/sync.c
M src/backend/utils/misc/guc.c
M src/include/access/xlog.h
A src/include/access/xlogrecovery.h
M src/tools/pgindent/typedefs.list

Move code around in StartupXLOG().

commit   : be1c00ab13a7c2c9299d60cb5a9d285c40e2506c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:44 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:44 +0200    

Click here for diff

This is in preparation for the next commit, which will split off  
recovery-related code from xlog.c into a new source file. This is the  
order that things will happen with the next commit, and the point of  
this commit is to make these ordering changes more explicit, while the  
next commit mechanically moves the source code to the new file. To aid  
review, I added "BEGIN/END function" comments to mark which blocks of  
code are moved to which functions in the next commit. They will be gone  
in the next commit.  
  
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Robert Haas  
Discussion: https://www.postgresql.org/message-id/a31f27b4-a31d-f976-6217-2b03be646ffa%40iki.fi  

M src/backend/access/transam/xlog.c

Refactor setting XLP_FIRST_IS_OVERWRITE_CONTRECORD.

commit   : b3a5d01c051b2a6579dc13af93a3dc3bebe8d051    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:41 +0200    

Click here for diff

Set it directly in CreateOverwriteContrecordRecord(). That way,  
AdvanceXLInsertBuffer() doesn't need the missingContrecPtr global  
variable. This is in preparation for splitting xlog.c into multiple  
files.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/a462d79c-cb5a-47cc-e9ac-616b5003965f%40iki.fi  

M src/backend/access/transam/xlog.c

Run pgindent on xlog.c.

commit   : d231be00cbf29bf24e5b4fc79e587982bbc00ebb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 09:22:34 +0200    

Click here for diff

To tidy up after some recent refactorings in xlog.c. These would be  
fixed by the pgindent run we do at the end of the development cycle,  
but I want to clean these up now as I'm about to do some more big  
refactorings on xlog.c.  

M src/backend/access/transam/xlog.c

Doc: Update documentation for modifying postgres_fdw foreign tables.

commit   : 27d195a57849fbcfb2ef455d40e1901b5002b505    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 16 Feb 2022 15:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 16 Feb 2022 15:15:00 +0900    

Click here for diff

Document that they can be modified using COPY as well.  
  
Back-patch to v11 where commit 3d956d956 added support for COPY in  
postgres_fdw.  

M doc/src/sgml/postgres-fdw.sgml

Add TAP test to automate the equivalent of check_guc, take two

commit   : 7265dbffad7feac6ea9d373828583b5d3d152e07    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 16 Feb 2022 10:25:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 16 Feb 2022 10:25:12 +0900    

Click here for diff

src/backend/utils/misc/check_guc is a script that cross-checks the  
consistency of the GUCs with postgresql.conf.sample, making sure that  
its format is in line with what guc.c has.  It has never been run  
automatically, and has rotten over the years, creating a lot of false  
positives as per a report from Justin Pryzby.  
  
d10e41d has introduced a SQL function to publish the most relevant flags  
associated to a GUC, with tests added in the main regression test suite  
to make sure that we avoid most of the inconsistencies in the GUC  
settings, based on recent reports, but there was nothing able to  
cross-check postgresql.conf.sample with the contents of guc.c.  
  
This commit adds a TAP test that covers the remaining gap.  It emulates  
the most relevant checks that check_guc did, so as any format mistakes  
are detected in postgresql.conf.sample at development stage, with the  
following checks:  
- Check that parameters marked as NOT_IN_SAMPLE are not in the sample  
file.  
- Check that there are no dead entries in postgresql.conf.sample for  
parameters not marked as NOT_IN_SAMPLE.  
- Check that no parameters are missing from the sample file if listed in  
guc.c without NOT_IN_SAMPLE.  
  
The idea of building a list of the GUCs by parsing the sample file comes  
from Justin, and he wrote the regex used in the patch to find all the  
GUCs (this same formatting rule basically applies for the last 20~ years  
or so).  In order to test this patch, I have played with manual  
modifications of postgresql.conf.sample and guc.c, making sure that we  
detect problems with the GUC rules and the sample file format.  
  
The test is located in src/test/modules/test_misc, which is the best  
location I could think about for such sanity checks, rather than the  
main regression test suite (src/test/regress) to avoid a new type of  
dependency with the source tree.  
  
The first attempt of this patch was b0a55f4, where the location of  
postgresql.conf.sample was retrieved using pg_config --sharedir.  This  
has proven to be an issue for distributions that patch pg_config to  
enforce the installation paths at some wanted location (like Debian),  
that may not exist when the test is run, hence causing a failure.  
Instead of that, as per a suggestion from Andres Freund, rely on the  
fact that the test is always executed from its directory in the source  
tree and use a relative path to find the sample file.  This works for  
the CI, VPATH builds and on Windows, and tests like the recovery one  
added in f47ed79 rely on that already.  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

A src/test/modules/test_misc/t/003_check_guc.pl

Fix race condition in 028_pitr_timelines.pl test, add note to docs.

commit   : 853c6400bf5defda139dc36387ce761398011799    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 01:37:48 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 16 Feb 2022 01:37:48 +0200    

Click here for diff

The 028_pitr_timelines.pl test would sometimes hang, waiting for a WAL  
segment that was just filled up to be archived. It was because the  
test used 'pg_stat_archiver.last_archived_wal' to check if a file was  
archived, but the order that WAL files are archived when a standby is  
promoted is not fully deterministic, and 'last_archived_wal' tracks  
the last segment that was archived, not the highest-numbered WAL  
segment. Because of that, if the archiver archived segment 3, and then  
2, 'last_archived_wal' say 2, and the test query would think that 3  
has not been archived yet.  
  
Normally, WAL files are marked ready for archival in order, and the  
archiver process will process them in order, so that issue doesn't  
arise.  We have used the same query on 'last_archived_wal' in a few  
other tests with no problem. But when a standby is promoted, things  
are a bit chaotic. After promotion, the server will try to archive all  
the WAL segments from the old timeline that are in pg_wal, as well as  
the history file and any new WAL segments on the new timeline. The  
end-of-recovery checkpoint will create the .ready files for all the  
WAL files on the old timeline, but at the same time, the new timeline  
is opened up for business. A file from the new timeline can therefore  
be archived before the files from the old timeline have been marked as  
ready for archival.  
  
It turns out that we don't really need to wait for the archival in  
this particular test, because the standby server is about to be  
stopped, and stopping a server will wait for the end-of-recovery  
checkpoint and all WAL archivals to finish, anyway. So we can just  
remove it from the test.  
  
Add a note to the docs on 'pg_stat_archiver' view that files can be  
archived out of order.  
  
Reviewed-by: Tom Lane  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/test/recovery/t/028_pitr_timelines.pl

Update "don't truncate with failsafe" rationale.

commit   : 988ffc30637ce2b7c4ff984513f4695372602ce2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 15 Feb 2022 15:16:19 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 15 Feb 2022 15:16:19 -0800    

Click here for diff

There is a very good (though non-obvious) reason to avoid relation  
truncation during a VACUUM that has triggered the failsafe mechanism,  
which was missed before now.  Update related comments, so this isn't  
forgotten.  
  
Reported-By: John Naylor <[email protected]>  
Discussion: https://postgr.es/m/CAFBsxsFiMPxQ-dHZ8tOgktn=+ffeJT3+GinZ4zdOGbmAnCYadA@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Ensure that length argument of memcmp() isn't seen as negative.

commit   : 3b0ee7f583dc347c4aecb57d35830d2f99956e5c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 17:28:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 17:28:17 -0500    

Click here for diff

I think this will shut up a weird warning from buildfarm member  
serinus.  Perhaps it'd be better to change tsCompareString's  
length arguments to unsigned, but that seems more invasive  
than is justified.  
  
Part of a general push to remove off-the-beaten-track warnings  
where we can easily do so.  

M src/backend/utils/adt/tsvector_op.c

Ensure that the argument of shmdt(2) is declared "void *".

commit   : 4c1a1a347a47df7c17b0fd212436ccbb896c47ca    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 17:17:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 17:17:25 -0500    

Click here for diff

Our gcc-on-Solaris buildfarm members emit "incompatible pointer type"  
warnings in places where it's not.  This is a bit odd, since AFAICT  
Solaris follows the POSIX spec in declaring shmdt's argument as  
"const void *", and you'd think any pointer argument would satisfy that.  
But whatever.  Part of a general push to remove off-the-beaten-track  
warnings where we can easily do so.  

M src/backend/port/sysv_shmem.c

docs: Work around bug in the docbook xsl stylesheets.

commit   : 1f6e0ce3beb45f23e4774148bd654d915be8d611    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 15 Feb 2022 13:44:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 15 Feb 2022 13:44:22 -0800    

Click here for diff

docbook-xsl's index generation stylesheet (autoidx.xsl) has a small bug: It  
doesn't include xlink in exclude-result-prefixes. Normally just leads to a a  
single xmlns:xlink in the <div> containing the index, but because our  
customization emits that, xmlns:xlink intead gets added to every element  
output by autoidx.xsl below the <div>, totalling around 100kB.  
  
Adding the spurious xmlns:xlink to the <div> ourselves isn't great, but avoids  
the duplication.  
  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/20220213201618.qz6p6noon3wagr3f%40alap3.anarazel.de  

M doc/src/sgml/stylesheet-html-common.xsl

Reject change of output-column collation in CREATE OR REPLACE VIEW.

commit   : 2523928b285b06242e0c669fadfc76d73bafdd66    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 12:57:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 15 Feb 2022 12:57:44 -0500    

Click here for diff

checkViewTupleDesc() didn't get the memo that it should verify  
same attcollation along with same type/typmod.  (A quick scan  
did not find other similar oversights.)  
  
Per bug #17404 from Pierre-Aurélien Georges.  On another day  
I might've back-patched this, but today I'm feeling paranoid  
about unnecessary behavioral changes in back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/view.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Ensure that STDERR is empty in connect_ok tests

commit   : 4d373e05286daff05d7fd0f6e4ab7ff4e5304d81    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 15 Feb 2022 11:35:17 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 15 Feb 2022 11:35:17 +0100    

Click here for diff

Connections performed via connect_ok() in TAP tests should not write  
anything to STDERR.  
  
Author: Jacob Champion <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Fix XML namespace declarations

commit   : 6538be9e1e412224c69f447d2b08342ba47ce9f1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Feb 2022 10:58:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Feb 2022 10:58:28 +0100    

Click here for diff

The XSL stylesheets used a mix of incorrect or outdated namespace  
declarations for XHTML, probably based on ancient advice and examples.  
Clean all this up.  
  
Besides improving correctness (although probably no impact in  
practice, other than possible validation failures), this removes a  
bunch of useless namespace declarations in the HTML output.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20220213201618.qz6p6noon3wagr3f%40alap3.anarazel.de  

M doc/src/sgml/stylesheet-hh.xsl
M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet-html-nochunk.xsl
M doc/src/sgml/stylesheet-text.xsl
M doc/src/sgml/stylesheet.xsl

Add more logging to new 028_pitr_timelines.pl test.

commit   : 3279cef0727a0fd285f3f1f459a7094acff9f629    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 15 Feb 2022 11:55:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 15 Feb 2022 11:55:52 +0200    

Click here for diff

The test has failed a couple of times on buildfarm member 'hoverfly'. It  
gets stuck waiting for the standby to archive 000000020000000000000003  
WAL segment. I don't understand why, but with DEBUG1, we will get messages  
in the log whenever a segment is archived, which hopefully will give a  
clue the next time it happens.  

M src/test/recovery/t/028_pitr_timelines.pl

Remove IS_AF_UNIX macro

commit   : 797129e5910144a2a937b88e145874a15b83578a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 15 Feb 2022 10:03:52 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 15 Feb 2022 10:03:52 +0100    

Click here for diff

The AF_UNIX macro was being used unprotected by HAVE_UNIX_SOCKETS,  
apparently since 2008.  So the redirection through IS_AF_UNIX() is  
apparently no longer necessary.  (More generally, all supported  
platforms are now HAVE_UNIX_SOCKETS, but even if there were a new  
platform in the future, it seems plausible that it would define the  
AF_UNIX symbol even without kernel support.)  So remove the  
IS_AF_UNIX() macro and make the code a bit more consistent.  
  
Discussion: https://www.postgresql.org/message-id/flat/f2d26815-9832-e333-d52d-72fbc0ade896%40enterprisedb.com  

M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/include/common/ip.h
M src/interfaces/libpq/fe-connect.c

Spell "startup process" with lower case in the documentation

commit   : a59135a81aa781d126c48a516179e43dbb0d428a    
  
author   : John Naylor <[email protected]>    
date     : Tue, 15 Feb 2022 14:30:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 15 Feb 2022 14:30:57 +0700    

Click here for diff

Most uses were already lower case, so this just makes all user-visible  
spellings consistent.  
  
Bharath Rupireddy  
  
The proposed patch also had analagous changes for the code comments,  
but I decided that wasn't worth the churn.  
  
Discussion:  
https://www.postgresql.org/message-id/flat/CALj2ACW7%2Bv_0QBPoWB%3DqKr67JKC019Htm%3DX8sKewS17bOquefg%40mail.gmail.com  

M doc/src/sgml/high-availability.sgml

Add test case for trailing junk after numeric literals

commit   : 13d129333ee2cc936350cd257af4d0367a6099ac    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    

Click here for diff

PostgreSQL currently accepts numeric literals with trailing  
non-digits, such as 123abc where the abc is treated as the next token.  
This may be a bit surprising.  This commit adds test cases for this;  
subsequent commits intend to change this behavior.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/regress/expected/numerology.out
M src/test/regress/sql/numerology.sql

Remove pg_atoi()

commit   : 73508475d69e90f98ebd9b7e1a5933a26a49c5e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    

Click here for diff

The last caller was int2vectorin(), and having such a general function  
for one user didn't seem useful, so just put the required parts inline  
and remove the function.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/int.c
M src/backend/utils/adt/numutils.c
M src/include/utils/builtins.h

Add isolation test for errors during logical slot creation.

commit   : 278cdea6b9d2993d1a819fbb28262236a72f6d02    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Feb 2022 21:52:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Feb 2022 21:52:55 -0800    

Click here for diff

I didn't include this test in 2f6501fa3c5, because I was not sure the error  
messages for the terminated connection is stable across platforms. But it  
sounds like it is, and if not, we'd want to do something about the instability  
anyway...  
  
Discussion: https://postgr.es/m/CAD21AoDAeEpAbZEyYJsPZJUmSPaRicVSBObaL7sPaofnKz+9zg@mail.gmail.com  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/slot_creation_error.out
A contrib/test_decoding/specs/slot_creation_error.spec

Remove command checks in tests of pg_basebackup and pg_receivewal

commit   : a4e1deb42b378650aaa2bcb3897caad9fe895957    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 15 Feb 2022 13:41:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 15 Feb 2022 13:41:40 +0900    

Click here for diff

The TAP tests of those commands have been checking if commands of "gzip"  
and "lz4" existed by launching them with an extra --version.  Based on  
the buildfarm, this is not required for "gzip" as the command always  
exists.  Since 1d084fb, "lz4" has a ./configure check doing the same  
thing.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Fix thinko with subdirectories generated by pg_upgrade for internal files

commit   : a008496300110d1b5ab7cb29b67ac043a6999bdb    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 15 Feb 2022 11:46:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 15 Feb 2022 11:46:55 +0900    

Click here for diff

38bfae3 has mixed the "dump/" and "log/" subdirectories generated in  
"pg_upgrade_output.d/", causing the internal dump files to be generated  
in "log/" and the log files to be in "dump/", but the opposite should be  
done.  This was not directly an issue for pg_upgrade runs, as the  
internal dump files were still picked up at the location of their  
creation, but the newest version of the buildfarm client would have  
reported the dump files instead of the log files on failures of  
pg_upgrade.  
  
Issue spotted while testing the TAP tests of pg_upgrade.  

M src/bin/pg_upgrade/pg_upgrade.c

Move replication slot release to before_shmem_exit().

commit   : 2f6501fa3c54bbe4568e3bcccd9a60d26a46b5ee    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 14 Feb 2022 16:44:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 14 Feb 2022 16:44:28 -0800    

Click here for diff

Previously, replication slots were released in ProcKill() on error, resulting  
in reporting replication slot drop of ephemeral slots after the stats  
subsystem was already shut down.  
  
To fix this problem, move replication slot release to a before_shmem_exit()  
hook that is called before the stats collector shuts down. There wasn't really  
a good reason for the slot handling to be in ProcKill() anyway.  
  
Patch by Masahiko Sawada, with very minor polishing by me.  
  
I, Andres, wrote a test for dropping slots during process exit, but there may  
be some OS dependent issues around the number of times FATAL error messages  
are displayed due to a still debated libpq issue. So that test will be  
committed separately / later.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoDAeEpAbZEyYJsPZJUmSPaRicVSBObaL7sPaofnKz+9zg@mail.gmail.com  

M src/backend/replication/slot.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/replication/slot.h

Remove one use of pg_atoi()

commit   : b45fa793406d6007a787c586c1960b1ffc2ef2fb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    

Click here for diff

There was no real need to use this here instead of a simpler API.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/jsonpath_gram.y

Move scanint8() to numutils.c

commit   : cfc7191dfea330dd7a71e940d59de78129bb6175    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 21:29:45 +0100    

Click here for diff

Move scanint8() to numutils.c and rename to pg_strtoint64().  We  
already have a "16" and "32" version of that, and the code inside the  
functions was aligned, so this move makes all three versions  
consistent.  The API is also changed to no longer provide the errorOK  
case.  Users that need the error checking can use strtoi64().  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/parse_node.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numutils.c
M src/bin/pgbench/pgbench.c
M src/include/utils/builtins.h
D src/include/utils/int8.h

Suppress integer-overflow compiler warning for inconsistent sun_len.

commit   : 291ec6e45ebe1a87f930a250ad3c6672472b9b19    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Feb 2022 11:25:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Feb 2022 11:25:46 -0500    

Click here for diff

On AIX 7.1, struct sockaddr_un is declared to be 1025 bytes long,  
but the sun_len field that should hold the length is only a byte.  
Clamp the value we try to store to ensure it will fit in the field.  
  
(This coding might need adjustment if there are any machines out  
there where sun_len is as wide as size_t; but a preliminary survey  
suggests there's not, so let's keep it simple.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/common/ip.c

Delete contrib/xml2's legacy implementation of xml_is_well_formed().

commit   : fd2abeb7c2b285d0575eeb743744e3dca4f66323    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 14 Feb 2022 10:56:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 14 Feb 2022 10:56:19 -0500    

Click here for diff

This function is unreferenced in modern usage; it was superseded in 9.1  
by a core function of the same name.  It has been left in place in the C  
code only so that pre-9.1 SQL definitions of the contrib/xml2 functions  
would continue to work.  Eleven years seems like enough time for people  
to have updated to the extension-style version of the xml2 module, so  
let's drop this.  
  
We did this once before, in 20540710e, and then reverted it because  
the intended change of PGDLLEXPORT markings didn't happen.  This  
time the reason is to suppress link-time duplicate-symbol warnings  
on AIX.  That's not worth a lot perhaps, but the value of keeping  
this function has surely dropped to about zero by now.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c

Add test case for an archive recovery corner case.

commit   : 50e5bc582a4371a88218078a2c651d901bf87d96    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Feb 2022 11:33:57 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 14 Feb 2022 11:33:57 +0200    

Click here for diff

While I was working on a patch to refactor things around xlog.c, I mixed  
up EndOfLogTLI and replayTLI at the end of recovery. As a result, if you  
recovered to a point with a lower-numbered timeline in a WAL segment  
that has a higher TLI in the filename, the end-of-recovery WAL record  
was created with invalid PrevTimeLineId. I noticed that while  
self-reviewing, but no tests failed. So add a test to cover that corner  
case.  
  
Thanks to Amul Sul who also submitted a test case for the same corner  
case, although this patch is different from that.  
  
Reviewed-by: Amul Sul, Michael Paquier  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Discussion: https://www.postgresql.org/message-id/CAAJ_b94Vjt5cXGza_1MkjLQWciNdEemsmiWuQj0d%3DM7JfjAa1g%40mail.gmail.com  

A src/test/recovery/t/028_pitr_timelines.pl

Add missing node support functions

commit   : 1383d52faa47190460b4dde63b69c944f2860b72    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 09:11:13 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 09:11:13 +0100    

Click here for diff

forgotten in 37851a8b83d3d57ca48736093b10aa5f3bc0c177  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

Database-level collation version tracking

commit   : 37851a8b83d3d57ca48736093b10aa5f3bc0c177    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 08:09:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 14 Feb 2022 08:09:04 +0100    

Click here for diff

This adds to database objects the same version tracking that collation  
objects have.  There is a new pg_database column datcollversion that  
stores the version, a new function  
pg_database_collation_actual_version() to get the version from the  
operating system, and a new subcommand ALTER DATABASE ... REFRESH  
COLLATION VERSION.  
  
This was not originally added together with pg_collation.collversion,  
since originally version tracking was only supported for ICU, and ICU  
on a database-level is not currently supported.  But we now have  
version tracking for glibc (since PG13), FreeBSD (since PG14), and  
Windows (since PG13), so this is useful to have now.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f0ff3190-29a3-5b39-a179-fa32eee57db6%40enterprisedb.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/create_database.sgml
M src/backend/commands/dbcommands.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_proc.dat
M src/include/commands/dbcommands.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/collate.linux.utf8.sql

Improve correlation names in sanity tests

commit   : 9898c5e03c40c133a9a01d8b2b36cb7c990b30d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 13 Feb 2022 21:07:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 13 Feb 2022 21:07:25 +0100    

Click here for diff

Some of the queries in the "sanity" tests in the regression test suite  
(opr_sanity, type_sanity) are very confusing.  One main stumbling  
block is that for some probably ancient reason many of the older  
queries are written with correlation names p1, p2, etc. independent of  
the name of the catalog. This one is a good example:  
  
SELECT p1.oid, p1.oprname, p2.oid, p2.proname  
FROM pg_operator AS p1, pg_proc AS p2          <-- HERE  
WHERE p1.oprcode = p2.oid AND  
    p1.oprkind = 'l' AND  
    (p2.pronargs != 1  
     OR NOT binary_coercible(p2.prorettype, p1.oprresult)  
     OR NOT binary_coercible(p1.oprright, p2.proargtypes[0])  
     OR p1.oprleft != 0);  
  
This is better written as  
  
SELECT o1.oid, o1.oprname, p1.oid, p1.proname  
FROM pg_operator AS o1, pg_proc AS p1  
WHERE o1.oprcode = p1.oid AND  
    o1.oprkind = 'l' AND  
    (p1.pronargs != 1  
     OR NOT binary_coercible(p1.prorettype, o1.oprresult)  
     OR NOT binary_coercible(o1.oprright, p1.proargtypes[0])  
     OR o1.oprleft != 0);  
  
This patch cleans up all the queries in this manner.  
  
(As in the above case, I kept the digits like o1 and p1 even in cases  
where only one of each letter is used in a query.  This is mainly to  
keep the style consistent.)  
  
Discussion: https://www.postgresql.org/message-id/flat/c538308b-319c-8784-e250-1284d12d5411%40enterprisedb.com  

M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/opr_sanity.sql
M src/test/regress/sql/type_sanity.sql

Use WL_SOCKET_CLOSED for client_connection_check_interval.

commit   : cba5b994c990bba8df9b8bb75f25ca40aef6b68b    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 16:29:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 16:29:44 +1300    

Click here for diff

Previously we used poll() directly to check for a POLLRDHUP event.  
Instead, use the WaitEventSet API to poll the socket for  
WL_SOCKET_CLOSED, which knows how to detect this condition on many more  
operating systems.  
  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Maksim Milyutin <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/77def86b27e41f0efcba411460e929ae%40postgrespro.ru  

M doc/src/sgml/config.sgml
M src/backend/libpq/pqcomm.c
M src/backend/utils/misc/guc.c
M src/include/libpq/libpq.h

Add WL_SOCKET_CLOSED for socket shutdown events.

commit   : 50e570a59e7f86bb41f029a66b781fc79b8d50f1    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 16:29:28 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 16:29:28 +1300    

Click here for diff

Provide a way for WaitEventSet to report that the remote peer has shut  
down its socket, independently of whether there is any buffered data  
remaining to be read.  This works only on systems where the kernel  
exposes that information, namely:  
  
* WAIT_USE_POLL builds using POLLRDHUP, if available  
* WAIT_USE_EPOLL builds using EPOLLRDHUP  
* WAIT_USE_KQUEUE builds using EV_EOF  
  
Reviewed-by: Zhihong Yu <[email protected]>  
Reviewed-by: Maksim Milyutin <[email protected]>  
Discussion: https://postgr.es/m/77def86b27e41f0efcba411460e929ae%40postgrespro.ru  

M src/backend/storage/ipc/latch.c
M src/include/storage/latch.h

WAL log unchanged toasted replica identity key attributes.

commit   : 5e01001ffb386aa6683fb65b918359f486625eb1    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 14 Feb 2022 08:55:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 14 Feb 2022 08:55:58 +0530    

Click here for diff

Currently, during UPDATE, the unchanged replica identity key attributes  
are not logged separately because they are getting logged as part of the  
new tuple. But if they are stored externally then the untoasted values are  
not getting logged as part of the new tuple and logical replication won't  
be able to replicate such UPDATEs. So we need to log such attributes as  
part of the old_key_tuple during UPDATE.  
  
Reported-by: Haiying Tang  
Author: Dilip Kumar and Amit Kapila  
Reviewed-by: Alvaro Herrera, Haiying Tang, Andres Freund  
Backpatch-through: 10  
Discussion: https://postgr.es/m/OS0PR01MB611342D0A92D4F4BF26C0F47FB229@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M contrib/test_decoding/expected/toast.out
M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/heap/heapam.c

Track LLVM 15 changes.

commit   : 0052fb489008a68d0f3e0445f52e1ab3166632a4    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 15:51:43 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 15:51:43 +1300    

Click here for diff

This isn't an API change, it's just a missing #include that we got away  
with before.  Per buildfarm animal seawasp.  

M src/backend/jit/llvm/llvmjit_inline.cpp

Correct Makefile dependencies for catalog scripts

commit   : b19a7e392a6ac2aa72f3556e6090bf010b858785    
  
author   : John Naylor <[email protected]>    
date     : Mon, 14 Feb 2022 09:03:46 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 14 Feb 2022 09:03:46 +0700    

Click here for diff

At some point, Gen_fmgrtab.pl stopped needing the value of defined symbols  
from access/transam.h, while genbki.pl starting doing so. The Makefiles  
didn't get the memo, so update the relevant dependencies.  

M src/backend/catalog/Makefile
M src/backend/utils/Makefile

Add ./configure check for "lz4" command

commit   : 1d084fba1bd144538dfea22c322f1c148c821148    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Feb 2022 10:40:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Feb 2022 10:40:34 +0900    

Click here for diff

Some environments may compile with --with-lz4 while the command "lz4"  
goes missing, causing two failures in the TAP tests of pg_verifybackup  
(008_untar.pl and 010_client_untar.pl) as the code assumed that the  
command always existed with a hardcoded value in src/Makefile.global.  
Rather than this method, this adds a ./configure check based on  
PGAC_PATH_PROGS() to find automatically the command and get an absolute  
path to it.  
  
Both tests need to be adjusted for the case where the command does not  
exist, actually, as Makefile.global would set now LZ4 to an empty value  
in this case.  The TAP tests of pg_receivewal already do that.  
  
Per report from buildfarm member copperhead, as an effect of dab2984.  
The origin of the failure is actually babbbb5 that did not centralize  
the check for the existence of a "lz4" command at ./configure to shave a  
few cycles.  Note that one just needs to tweak an environment to move  
"lz4" out of the way to reproduce the problem, which is what I did to  
test this change.  
  
Per discussion with Robert Haas, Tom Lane, Andres Freund and myself.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/Makefile.global.in
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl

Fix memory leak in IndexScan node with reordering

commit   : 3f74daa8dfc634132ff7270212c57da5e316b001    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 14 Feb 2022 03:26:55 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 14 Feb 2022 03:26:55 +0300    

Click here for diff

Fix ExecReScanIndexScan() to free the referenced tuples while emptying the  
priority queue.  Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/CAHqSB9gECMENBQmpbv5rvmT3HTaORmMK3Ukg73DsX5H7EJV7jw%40mail.gmail.com  
Author: Aliaksandr Kalenik  
Reviewed-by: Tom Lane, Alexander Korotkov  
Backpatch-through: 10  

M src/backend/executor/nodeIndexscan.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Make origin data initialization consistent other fields in 2PC header

commit   : c963e84fb8c8ec75bfdbe6a7a0857ccd1378baa0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 14 Feb 2022 09:30:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 14 Feb 2022 09:30:35 +0900    

Click here for diff

As of 1eb6d65, the origin data is optionally stored in a 2PC file  
header, with the data filled in EndPrepare() even in the default case  
where there is no origin data to add.  This was inconsistent with all  
the other fields of TwoPhaseFileHeader which are initialized in  
StartPrepare(), so move the initialization of origin_lsn and  
origin_timestamp there instead.  The effect of missing the  
initialization at this early stage is only cosmetic based on the current  
logic of the code, but could have led to issues in the long-term, and it  
is more consistent done this way.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAooECJ+gU_RZB-yhioPOV94R4ucoHAf68PiJhLpgpVpBw@mail.gmail.com  

M src/backend/access/transam/twophase.c

Fix misuse of "const" qualifier.

commit   : 994d76707a254da6d03e389fa46141371a99e4e1    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Feb 2022 19:11:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Feb 2022 19:11:21 -0500    

Click here for diff

"const foo *" is quite different from "foo * const".  
This code was evidently trying to avoid casting away  
const from the arguments, but entirely failed to do so.  
  
Per study of some buildfarm warnings from anole  
(which unfortunately are mostly ignorable, since it  
seems not to understand "restrict" very well).  
I'm surprised though that nothing else has complained.  

M src/backend/partitioning/partbounds.c

Remove REGRESS_OUTPUTDIR environment variable.

commit   : 7e6124ca7d81f4767a44bae487226bc8b003ec31    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 12:52:57 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 14 Feb 2022 12:52:57 +1300    

Click here for diff

Andres Freund points out that the tmp_check path is already available as  
perl variable PostgreSQL::Test::Utils::tmp_check, so we can drop the new  
environment variable introduced by commit f47ed79cc.  
  
Discussion: https://postgr.es/m/20220213052955.dh7lheehit7bsemf%40alap3.anarazel.de  

M src/test/recovery/Makefile
M src/test/recovery/t/027_stream_regress.pl
M src/tools/msvc/vcregress.pl

Silence minor compiler warnings.

commit   : 302612a6c74fb16f26d094ff47e9c59cf412740c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 13 Feb 2022 13:06:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 13 Feb 2022 13:06:55 -0500    

Click here for diff

Depending on compiler version and optimization level, we might  
get a complaint that lazy_scan_heap's "freespace" is used  
uninitialized.  
  
Compilers not aware that ereport(ERROR) doesn't return complained  
about bbsink_lz4_new().  
  
Assigning "-1" to a uint64 value has unportable results; fortunately,  
the value of xlogreadsegno is unimportant when xlogreadfd is -1.  
(It looks to me like there is no need for xlogreadsegno to be static  
in the first place, but I didn't venture to change that.)  

M src/backend/access/heap/vacuumlazy.c
M src/backend/replication/basebackup_lz4.c
M src/bin/pg_rewind/parsexlog.c

ci: fix copy-paste mistake in 16eb8231d1b.

commit   : f79c94f39df092dfe3371257140ec76bba40bfb6    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 19:38:06 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 19:38:06 -0800    

Click here for diff

Reported-By: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: macos: align sysinfo_script to other tasks.

commit   : 0a156058aa49f7d60628efdba1787524bc3f2940    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 15:50:53 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 15:50:53 -0800    

Click here for diff

Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: Only use one artifact instruction for logs.

commit   : 16eb8231d1b53d7eade7530cc5cd58c8409a3993    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 15:29:08 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 15:29:08 -0800    

Click here for diff

Having the different types of logs in artifacts instruction makes it quicker  
to navigate between them. Either that didn't use to be possible, or I just did  
it wrong. I saw that / how it works in a patch by Justin Pryzby.  
  
Also remove a few unnecessary uses of **, suggested by Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: s/CCACHE_SIZE/CCACHE_MAXSIZE/.

commit   : 79b79dd57a9672903951aa0d879500818b32e2eb    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 14:44:16 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 12 Feb 2022 14:44:16 -0800    

Click here for diff

The wrong environment variable was used in one place.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Fix skip-empty-xacts with sequences in test_decoding

commit   : b779d7d8fdae088d70da5ed9fcd8205035676df3    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 12 Feb 2022 23:50:42 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 12 Feb 2022 23:50:42 +0100    

Click here for diff

Regression tests need to use skip-empty-xacts = false, because there  
might be accidental concurrent activity (like autovacuum), particularly  
on slow machines. The tests added by 80901b3291 failed to do that in a  
couple places, triggering occasional failures on buildfarm.  
  
Fixing the tests however uncovered a bug in the code, because sequence  
callbacks did not handle skip-empty-xacts properly. For trasactional  
increments we need to check/update the xact_wrote_changes flag, and emit  
the BEGIN if it's the first change in the transaction.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20220212220413.b25amklo7t4xb7ni%40alap3.anarazel.de  

M contrib/test_decoding/expected/sequence.out
M contrib/test_decoding/sql/sequence.sql
M contrib/test_decoding/test_decoding.c

Move libpq's write_failed mechanism down to pqsecure_raw_write().

commit   : faa189c932d51945b2285e277128b0f26b96afdd    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Feb 2022 14:00:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Feb 2022 14:00:09 -0500    

Click here for diff

Commit 1f39a1c06 implemented write-failure postponement in pqSendSome,  
which is above SSL/GSS processing.  However, we've now seen failures  
indicating that (some versions of?) OpenSSL have a tendency to report  
write failures prematurely too.  Hence, move the primary responsibility  
for postponing write failures down to pqsecure_raw_write(), below  
SSL/GSS processing.  pqSendSome now sets write_failed only in corner  
cases where we'd lost the connection already.  
  
A side-effect of this change is that errors detected in the SSL/GSS  
layer itself will be reported immediately (as if they were read  
errors) rather than being postponed like write errors.  That's  
reverting an effect of 1f39a1c06, and I think it's fine: if there's  
not a socket-level error, it's hard to be sure whether an OpenSSL  
error ought to be considered a read or write failure anyway.  
  
Another important point is that write-failure postponement is now  
effective during connection setup.  OpenSSL's misbehavior of this  
sort occurs during SSL_connect(), so that's a change we want.  
  
Per bug #17391 from Nazir Bilal Yavuz.  Possibly this should be  
back-patched, but I think it prudent to let it age awhile in HEAD  
first.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-secure.c

Fix thinko in PQisBusy().

commit   : 335fa5a26029d8040ebf332fda3f900cc9da23f2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 12 Feb 2022 13:23:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 12 Feb 2022 13:23:20 -0500    

Click here for diff

In commit 1f39a1c06 I made PQisBusy consider conn->write_failed, but  
that is now looking like complete brain fade.  In the first place, the  
logic is quite wrong: it ought to be like "and not" rather than "or".  
This meant that once we'd gotten into a write_failed state, PQisBusy  
would always return true, probably causing the calling application to  
iterate its loop until PQconsumeInput returns a hard failure thanks  
to connection loss.  That's not what we want: the intended behavior  
is to return an error PGresult, which the application probably has  
much cleaner support for.  
  
But in the second place, checking write_failed here seems like the  
wrong thing anyway.  The idea of the write_failed mechanism is to  
postpone handling of a write failure until we've read all we can from  
the server; so that flag should not interfere with input-processing  
behavior.  (Compare 7247e243a.)  What we *should* check for is  
status = CONNECTION_BAD, ie, socket already closed.  (Most places that  
close the socket don't touch asyncStatus, but they do reset status.)  
This primarily ensures that if PQisBusy() returns true then there is  
an open socket, which is assumed by several call sites in our own  
code, and probably other applications too.  
  
While at it, fix a nearby thinko in libpq's my_sock_write: we should  
only consult errno for res < 0, not res == 0.  This is harmless since  
pqsecure_raw_write would force errno to zero in such a case, but it  
still could confuse readers.  
  
Noted by Andres Freund.  Backpatch to v12 where 1f39a1c06 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-secure-openssl.c

Revert "Add TAP test to automate the equivalent of check_guc"

commit   : 52377bb81a2c0427d357bba71e7149de02d016ce    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 12 Feb 2022 12:53:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 12 Feb 2022 12:53:59 +0900    

Click here for diff

This reverts commit b0a55f4, to remove for now the TAP test that did the  
equivalent of check_guc.  The test has been using pg_config --sharedir  
to find the location of postgresql.conf.sample.  While the buildfarm and  
normal build environments rather liked that, this proves to be an issue  
for Debian where pg_config is patched to not be relocatable, causing the  
test to fail.  
  
Rather than relying on pg_config, we'd better find the sample file based  
on its location from the source directory.  However, this is also an  
issue as a TAP test only offers the build directory as of TESTDIR in the  
environment context, so this would fail with VPATH builds.  Perhaps the  
source path could be provided additionally when running the TAP tests.  
Or perhaps we may be able to get away by just switching to a SQL  
approach, by using PG_ABS_SRCDIR but this is going to require some extra  
loops to get the sample file from the correct path in src/backend/.  In  
any case, this needs more thoughts, so just revert the test case until  
something better is done about this relocation problem.  
  
Reported-by: Christopher Berg  
Discussion: https://postgr.es/m/[email protected]  

D src/test/modules/test_misc/t/003_check_guc.pl

Consolidate VACUUM xid cutoff logic.

commit   : efa4a9462a072b4cd6459058df274dd23022d0e2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 18:26:15 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 18:26:15 -0800    

Click here for diff

Push the logic for determining whether or not a VACUUM operation will be  
aggressive down into vacuum_set_xid_limits().  This makes the function's  
signature significantly simpler, and seems clearer overall.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkymFbz6D_vL+jmqSn_5q1wsFvFrE+37yLgL_Rkfd6Gzg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Add VACUUM instrumentation for scanned pages, relfrozenxid.

commit   : 872770fd6ccf12596b9e26234df9a37cae083af2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 16:48:40 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 16:48:40 -0800    

Click here for diff

Report on scanned pages within VACUUM VERBOSE and autovacuum logging.  
These are pages that were physically examined during the VACUUM  
operation.  Note that this can include a small number of pages that were  
marked all-visible in the visibility map by some earlier VACUUM  
operation.  VACUUM won't skip all-visible pages that aren't part of a  
range of all-visible pages that's at least 32 blocks in length (partly  
to avoid missing out on opportunities to advance relfrozenxid during  
non-aggressive VACUUMs).  
  
Commit 44fa8488 simplified the definition of scanned pages.  It became  
the complement of the pages (of those pages from rel_pages) that were  
skipped using the visibility map.  And so scanned pages precisely  
indicates how effective the visibility map was at saving work.  (Before  
now we displayed the number of pages skipped via the visibility map when  
happened to be frozen pages, but not when they were merely all-visible,  
which was less useful to users.)  
  
Rename the user-visible OldestXmin output field to "removal cutoff", and  
show some supplementary information: how far behind the cutoff is  
(number of XIDs behind) by the time the VACUUM operation finished.  This  
will help users to figure out what's _not_ working in extreme cases  
where VACUUM is fundamentally unable to remove dead tuples or freeze  
older tuples (e.g., due to a leaked replication slot).  Also report when  
relfrozenxid is advanced by VACUUM in output that immediately follows  
"removal cutoff".  This structure is intended to highlight the  
relationship between the new relfrozenxid value for the table, and the  
VACUUM operation's removal cutoff.  
  
Finally, add instrumentation of "missed dead tuples", and the number of  
pages that had at least one such tuple.  These are fully DEAD (not just  
RECENTLY_DEAD) tuples with storage that could not be pruned due to  
failure to acquire a cleanup lock on a heap page.  This is a replacement  
for the "skipped due to pin" instrumentation removed by commit 44fa8488.  
It shows more details than before for pages where failing to get a  
cleanup lock actually resulted in VACUUM missing out on useful work, but  
usually shows nothing at all instead (the mere fact that we couldn't get  
a cleanup lock is usually of no consequence whatsoever now).  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wznp=c=Opj8Z7RMR3G=ec3_JfGYMN_YvmCEjoPCHzWbx0g@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Add decoding of sequences to test_decoding

commit   : 80901b32913ffa59bf157a4d88284b2b3a7511d9    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 12 Feb 2022 00:46:07 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 12 Feb 2022 00:46:07 +0100    

Click here for diff

Commit 0da92dc530 improved the logical decoding infrastructure to handle  
sequences, and did various changes to related parts (WAL logging etc.).  
But it did not include any implementation of the new callbacks added to  
OutputPluginCallbacks.  
  
This extends test_decoding with two callbacks to decode sequences. The  
decoding of sequences may be disabled using 'include-sequences', a new  
option of the output plugin.  
  
Author: Tomas Vondra, Cary Huang  
Reviewed-by: Peter Eisentraut, Hannu Krosing, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/Makefile
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/expected/decoding_into_rel.out
M contrib/test_decoding/expected/mxact.out
M contrib/test_decoding/expected/ondisk_startup.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
A contrib/test_decoding/expected/sequence.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/expected/truncate.out
M contrib/test_decoding/specs/mxact.spec
M contrib/test_decoding/specs/ondisk_startup.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M contrib/test_decoding/sql/decoding_into_rel.sql
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
A contrib/test_decoding/sql/sequence.sql
M contrib/test_decoding/sql/slot.sql
M contrib/test_decoding/sql/toast.sql
M contrib/test_decoding/sql/truncate.sql
M contrib/test_decoding/test_decoding.c

Simplify lazy_scan_heap's handling of scanned pages.

commit   : 44fa84881fff4529d68e2437a58ad2c906af5805    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 14:32:17 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 11 Feb 2022 14:32:17 -0800    

Click here for diff

Redefine a scanned page as any heap page that actually gets pinned by  
VACUUM's first pass over the heap, regardless of whether or not the page  
was cleanup locked.  Although it's fundamentally impossible to prune a  
heap page without a cleanup lock (since we cannot safely defragment the  
page), we can do just about everything else.  The only notable further  
exception is freezing tuples, though even that is arguably a consequence  
of not being able to prune (not a separate issue).  
  
VACUUM now does as much of the same processing as possible for pages  
that could not be cleanup locked.  Any failure to do specific required  
processing is treated as a special case exception, which will be rare in  
practice.  We now collect any preexisting LP_DEAD items (left behind by  
earlier opportunistic pruning) in the dead_items array for these heap  
pages, and count their tuples in the usual way.  Steps used to decide if  
we'll attempt relation truncation are performed in the usual way for  
no-cleanup-lock scanned pages, too.  
  
Although eliminating these special cases is intrinsically useful, it's  
even more useful as an enabler of further simplifications.  The only  
essential difference between aggressive and non-aggressive is that only  
aggressive is _guaranteed_ to be able to advance relfrozenxid up to  
FreezeLimit.  Advancing relfrozenxid is always useful, but before now  
non-aggressive VACUUMs threw away the opportunity to do so whenever a  
cleanup lock could not be acquired on any page, no matter what the  
details were.  This was very pessimistic.  
  
It isn't actually necessary to "behave aggressively" to maintain the  
ability to advance relfrozenxid when a cleanup lock isn't immediately  
available (most of the time).  The non-aggressive case will now make  
sure that it isn't safe to advance relfrozenxid (without waiting) using  
only a share lock.  It will usually notice that there are no tuples that  
need to be frozen anyway, just like in the aggressive case -- and so it  
no longer wastes an opportunity to advance relfrozenxid over nothing.  
(The non-aggressive case still won't wait for a cleanup lock when there  
really are tuples on the page that need to be frozen, since that really  
would amount to "behaving aggressively".)  
  
VACUUM currently has a tendency to set heap pages to all-visible in the  
visibility map before it freezes all of the tuples on the page.  Only a  
subsequent aggressive VACUUM will visit these pages to freeze their  
tuples, usually only when the tuple XIDs are much older than the  
vacuum_freeze_min_age GUC (FreezeLimit cutoff) is supposed to allow.  
And so non-aggressive VACUUMs are still far less likely to be able to  
advance relfrozenxid in practice, even with the enhancements from this  
commit.  This remaining issue will be addressed by future work that  
overhauls the criteria for freezing tuples.  Once that's in place,  
almost every VACUUM operation will be able to advance relfrozenxid in  
practice.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Reviewed-By: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wznp=c=Opj8Z7RMR3G=ec3_JfGYMN_YvmCEjoPCHzWbx0g@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/specs/vacuum-reltuples.spec

Fix DROP {DATABASE,TABLESPACE} on Windows.

commit   : 4eb2176318d0561846c1f9fb3c68bede799d640f    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 12 Feb 2022 10:21:23 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 12 Feb 2022 10:21:23 +1300    

Click here for diff

Previously, it was possible for DROP DATABASE, DROP TABLESPACE and ALTER  
DATABASE SET TABLESPACE to fail because other backends still had file  
handles open for dropped tables.  Windows won't allow a directory  
containing unlinked-but-still-open files to be unlinked.  Tackle this  
problem by forcing all backends to close all smgr fds.  No change for  
Unix systems, which don't suffer from the problem, but the new code path  
can be tested by Unix-based developers by defining  
USE_BARRIER_SMGRRELEASE explicitly.  
  
It's possible that PROCSIGNAL_BARRIER_SMGRRELEASE will have more  
bug-fixing applications soon (under discussion).  Note that this is the  
first user of the ProcSignalBarrier mechanism from commit 16a4e4aec.  It  
could in principle be back-patched as far as 14, but since field  
complaints are rare and ProcSignalBarrier hasn't been battle-tested,  
that seems like a bad idea.  Fix in master only, where these failures  
have started to show up in automated testing due to new tests.  
  
Suggested-by: Andres Freund <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKGLdemy2gBm80kz20GTe6hNVwoErE8KwcJk6-U56oStjtg@mail.gmail.com  

M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/pg_config_manual.h
M src/include/storage/md.h
M src/include/storage/procsignal.h
M src/include/storage/smgr.h

Don't use_physical_tlist for an IOS with non-returnable columns.

commit   : e5691cc9170bcd6c684715c2755d919c5a16fea2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 11 Feb 2022 15:23:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 11 Feb 2022 15:23:52 -0500    

Click here for diff

createplan.c tries to save a runtime projection step by specifying  
a scan plan node's output as being exactly the table's columns, or  
index's columns in the case of an index-only scan, if there is not a  
reason to do otherwise.  This logic did not previously pay attention  
to whether an index's columns are returnable.  That worked, sort of  
accidentally, until commit 9a3ddeb51 taught setrefs.c to reject plans  
that try to read a non-returnable column.  I have no desire to loosen  
setrefs.c's new check, so instead adjust use_physical_tlist() to not  
try to optimize this way when there are non-returnable column(s).  
  
Per report from Ryan Kelly.  Like the previous patch, back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/CAHUie24ddN+pDNw7fkhNrjrwAX=fXXfGZZEHhRuofV_N_ftaSg@mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

Replace Test::More plans with done_testing

commit   : 549ec201d6132b7c7ee11ee90a4e02119259ba5b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 11 Feb 2022 20:54:44 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 11 Feb 2022 20:54:44 +0100    

Click here for diff

Rather than doing manual book keeping to plan the number of tests to run  
in each TAP suite, conclude each run with done_testing() summing up the  
the number of tests that ran. This removes the need for maintaning and  
updating the plan count at the expense of an accurate count of remaining  
during the test suite runtime.  
  
This patch has been discussed a number of times, often in the context of  
other patches which updates tests, so a larger number of discussions can  
be found in the archives.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/bloom/t/001_wal.pl
M contrib/oid2name/t/001_basic.pl
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/vacuumlo/t/001_basic.pl
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/README
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_worker_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/100_bugs.pl

pg_basebackup: Allow client-side LZ4 (de)compression.

commit   : 751b8d23b788580bbff7463e3959f9a92a95b28a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Feb 2022 09:41:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Feb 2022 09:41:42 -0500    

Click here for diff

LZ4 compression can now be performed on the client using  
pg_basebackup -Ft --compress client-lz4, and LZ4 decompression of  
a backup compressed on the server can be performed on the client  
using pg_basebackup -Fp --compress server-lz4.  
  
Dipesh Pandit, reviewed and tested by Jeevan Ladhe and Tushar Ahuja,  
with a few corrections - and some documentation - by me.  
  
Discussion: http://postgr.es/m/CAN1g5_FeDmiA9D8wdG2W6Lkq5CpubxOAqTmd2et9hsinTJtsMQ@mail.gmail.com  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
A src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_verifybackup/t/009_extract.pl
A src/bin/pg_verifybackup/t/010_client_untar.pl
M src/tools/msvc/Mkvcbuild.pm

Add suport for server-side LZ4 base backup compression.

commit   : dab298471ff2f91f33bc25bfb73e435d3ab02148    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 11 Feb 2022 08:29:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 11 Feb 2022 08:29:38 -0500    

Click here for diff

LZ4 compression can be a lot faster than gzip compression, so users  
may prefer it even if the compression ratio is not as good. We will  
want pg_basebackup to support LZ4 compression and decompression on the  
client side as well, and there is a pending patch for that, but it's  
by a different author, so I am committing this part separately for  
that reason.  
  
Jeevan Ladhe, reviewed by Tushar Ahuja and by me.  
  
Discussion: http://postgr.es/m/CANm22Cg9cArXEaYgHVZhCnzPLfqXCZLAzjwTq7Fc0quXRPfbxA@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/Makefile
M src/backend/replication/basebackup.c
A src/backend/replication/basebackup_lz4.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_verifybackup/Makefile
M src/bin/pg_verifybackup/t/008_untar.pl
M src/include/replication/basebackup_sink.h

Make pg_ctl stop/restart/promote recheck postmaster aliveness.

commit   : a745b936507f57334e2c0108dcea5965848e3e35    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Feb 2022 16:49:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Feb 2022 16:49:39 -0500    

Click here for diff

"pg_ctl stop/restart" checked that the postmaster PID is valid just  
once, as a side-effect of sending the stop signal, and then would  
wait-till-timeout for the postmaster.pid file to go away.  This  
neglects the case wherein the postmaster dies uncleanly after we  
signal it.  Similarly, once "pg_ctl promote" has sent the signal,  
it'd wait for the corresponding on-disk state change to occur  
even if the postmaster dies.  
  
I'm not sure how we've managed not to notice this problem, but it  
seems to explain slow execution of the 017_shm.pl test script on AIX  
since commit 4fdbf9af5, which added a speculative "pg_ctl stop" with  
the idea of making real sure that the postmaster isn't there.  In the  
test steps that kill-9 and then restart the postmaster, it's possible  
to get past the initial signal attempt before kill() stops working  
for the doomed postmaster.  If that happens, pg_ctl waited till  
PGCTLTIMEOUT before giving up ... and the buildfarm's AIX members  
have that set very high.  
  
To fix, include a "kill(pid, 0)" test (similar to what  
postmaster_is_alive uses) in these wait loops, so that we'll  
give up immediately if the postmaster PID disappears.  
  
While here, I chose to refactor those loops out of where they were.  
do_stop() and do_restart() can perfectly well share one copy of the  
wait-for-stop loop, and it seems desirable to put a similar function  
beside that for wait-for-promote.  
  
Back-patch to all supported versions, since pg_ctl's wait logic  
is substantially identical in all, and we're seeing the slow test  
behavior in all branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Use gendef instead of pexports for building windows .def files

commit   : ea09a75e1efe42318abfb8ece90ce70037201f59    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 10 Feb 2022 13:44:05 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 10 Feb 2022 13:44:05 -0500    

Click here for diff

Modern msys systems lack pexports but have gendef instead, so use that.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to release 9.4 to enable building with perl on older branches.  
Before that pexports is not used for plperl.  

M src/pl/plperl/GNUmakefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile

Logical decoding of sequences

commit   : 0da92dc530c9251735fc70b20cd004d9630a1266    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 10 Feb 2022 18:43:28 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 10 Feb 2022 18:43:28 +0100    

Click here for diff

This extends the logical decoding to also decode sequence increments.  
We differentiate between sequences created in the current (in-progress)  
transaction, and sequences created earlier. This mixed behavior is  
necessary because while sequences are not transactional (increments are  
not subject to ROLLBACK), relfilenode changes are. So we do this:  
  
* Changes for sequences created in the same top-level transaction are  
  treated as transactional, i.e. just like any other change from that  
  transaction, and discarded in case of a rollback.  
  
* Changes for sequences created earlier are applied immediately, as if  
  performed outside any transaction. This applies also after ALTER  
  SEQUENCE, which may create a new relfilenode.  
  
Moreover, if we ever get support for DDL replication, the sequence  
won't exist until the transaction gets applied.  
  
Sequences created in the current transaction are tracked in a simple  
hash table, identified by a relfilenode. That means a sequence may  
already exist, but if a transaction does ALTER SEQUENCE then the  
increments for the new relfilenode will be treated as transactional.  
  
For each relfilenode we track the XID of (sub)transaction that created  
it, which is needed for cleanup at transaction end. We don't need to  
check the XID to decide if an increment is transactional - if we find a  
match in the hash table, it has to be the same transaction.  
  
This requires two minor changes to WAL-logging. Firstly, we need to  
ensure the sequence record has a valid XID - until now the the increment  
might have XID 0 if it was the first change in a subxact. But the  
sequence might have been created in the same top-level transaction. So  
we ensure the XID is assigned when WAL-logging increments.  
  
The other change is addition of "created" flag, marking increments for  
newly created relfilenodes. This makes it easier to maintain the hash  
table of sequences that need transactional handling.  
Note: This is needed because of subxacts. A XID 0 might still have the  
sequence created in a different subxact of the same top-level xact.  
  
This does not include any changes to test_decoding and/or the built-in  
replication - those will be committed in separate patches.  
  
A patch adding decoding of sequences was originally submitted by Cary  
Huang. This commit reworks various important aspects (e.g. the WAL  
logging and transactional/non-transactional handling). However, the  
original patch and reviews were very useful.  
  
Author: Tomas Vondra, Cary Huang  
Reviewed-by: Peter Eisentraut, Hannu Krosing, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logicaldecoding.sgml
M src/backend/commands/sequence.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/access/rmgrlist.h
M src/include/commands/sequence.h
M src/include/replication/decode.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h

Remove server support for the previous base backup protocol.

commit   : 0d4513b6138650355fcc981a9f34ff57b8d69db4    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 11:17:21 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 11:17:21 -0500    

Click here for diff

Commit cc333f32336f5146b75190f57ef587dff225f565 added a new COPY  
sub-protocol for taking base backups, but retained support for the  
previous protocol. For the same reasons articulated in the message  
for commit 9cd28c2e5f11dfeef64a14035b82e70acead65fd, remove support  
for the previous protocol from the server.  
  
Discussion: http://postgr.es/m/CA+TgmoazKcKUWtqVa0xZqSzbKgTH+X-aw4V7GyLD68EpDLMh8A@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_copy.c
M src/include/replication/basebackup_sink.h

Make timeout.c more robust against missed timer interrupts.

commit   : d37776e451e3481d7364137a0b159102bb05992a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 10 Feb 2022 11:52:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 10 Feb 2022 11:52:20 -0500    

Click here for diff

Commit 09cf1d522 taught schedule_alarm() to not do anything if  
the next requested event is after when we expect the next interrupt  
to fire.  However, if somehow an interrupt gets lost, we'll continue  
to not do anything indefinitely, even after the "next interrupt" time  
is obviously in the past.  Thus, one missed interrupt can break  
timeout scheduling for the life of the session.  Michael Harris  
reported a scenario where a bug in a user-defined function caused this  
to happen, so you don't even need to assume kernel bugs exist to think  
this is worth fixing.  We can make things more robust at little cost  
by detecting the case where signal_due_at is before "now" and forcing  
a new setitimer call to occur.  This isn't a completely bulletproof  
fix of course; but in our typical usage pattern where we frequently set  
timeouts and clear them before they are reached, the interrupt will  
get re-enabled after at most one timeout interval, which with a little  
luck will be before we really need it.  
  
While here, let's mark signal_due_at as volatile, since the signal  
handler can both examine and set it.  I'm not sure there's any  
actual risk given that signal_pending is already volatile, but  
it's surely questionable.  
  
Backpatch to v14 where this logic came in.  
  
Michael Harris and Tom Lane  
  
Discussion: https://postgr.es/m/CADofcAWbMrvgwSMqO4iG_iD3E2v8ZUrC-_crB41my=VMM02-CA@mail.gmail.com  

M src/backend/utils/misc/timeout.c

Remove server support for old BASE_BACKUP command syntax.

commit   : 9cd28c2e5f11dfeef64a14035b82e70acead65fd    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 10:53:59 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 10:53:59 -0500    

Click here for diff

Commit 0ba281cb4bf9f5f65529dfa4c8282abb734dd454 added a new syntax  
for the BASE_BACKUP command, with extensible options, but maintained  
support for the legacy syntax. This isn't important for PostgreSQL,  
where pg_basebackup works with older server versions but not newer  
ones, but it could in theory matter for out-of-core users of the  
replication protocol.  
  
Discussion on pgsql-hackers, however, suggests that no one is aware  
of any out-of-core use of the BASE_BACKUP command, and the consensus  
is in favor of removing support for the old syntax to simplify the  
code, so do that.  
  
Discussion: http://postgr.es/m/CA+TgmoazKcKUWtqVa0xZqSzbKgTH+X-aw4V7GyLD68EpDLMh8A@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l

Set SNI ClientHello extension to localhost in tests

commit   : 6d503d2a47324c15c5b4274bf4dd016064143754    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 10 Feb 2022 14:23:36 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 10 Feb 2022 14:23:36 +0100    

Click here for diff

The connection strings in the SSL client tests were using the host  
set up from Cluster.pm which is a temporary pathname. When SNI is  
enabled we pass the host to OpenSSL in order to set the server name  
indication ClientHello extension via SSL_set_tlsext_host_name.  
  
OpenSSL doesn't validate the hostname apart from checking the max  
length, but LibreSSL checks for RFC 5890 conformance which results  
in errors during testing as the pathname from Cluster.pm is not a  
valid hostname.  
  
Fix by setting the host explicitly to localhost, as that's closer  
to the intent of the test.  
  
Backpatch through 14 where SNI support came in.  
  
Reported-by: Nazir Bilal Yavuz <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Remove unnecessary resetPQExpBuffer call

commit   : 4c5c41b4d985c39a0aba5b637f61216206f18d33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 12:23:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 12:23:40 +0100    

Click here for diff

Oversight in e2c52beecdea152ca680a22ef35c6a7da55aa30f.  
  
Author: Julien Rouhaud <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20220209025007.eogz2aivcnvw46ym%40jrouhaud  

M src/bin/pg_dump/pg_dump.c

psql: Rename results to result when only a single one is meant

commit   : b9a3139397ff284cebc92fb008862ab902261883    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 12:03:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 12:03:35 +0100    

Click here for diff

This makes the naming more consistent with the libpq API and the rest  
of the code, and makes actually supporting multiple result sets in the  
future less confusing.  
  
Discussion: https://www.postgresql.org/message-id/flat/db72fb98-9b43-d776-7247-6ed38f28e7c6%40enterprisedb.com  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/tab-complete.c
M src/bin/psql/variables.c

Update comment

commit   : f5744f1d1e3588b4c782bcad44e8da9c056eb67f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 09:16:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 10 Feb 2022 09:16:17 +0100    

Click here for diff

Update a comment that assumed that libc collations don't support  
versioning.  Also improve an adjacent error message a bit.  

M src/backend/utils/adt/pg_locale.c

Add min() and max() aggregates for xid8.

commit   : 400fc6b6487ddf16aa82c9d76e5cfbe64d94f660    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 10 Feb 2022 12:33:41 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 10 Feb 2022 12:33:41 +0900    

Click here for diff

Bump catalog version.  
  
Author: Ken Kato  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/xid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/xid.out
M src/test/regress/sql/xid.sql

Use Test::Builder::todo_start(), replacing $::TODO.

commit   : adbd00f7a59bcfbcd6907858499c94a27c6680ed    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 9 Feb 2022 18:16:59 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 9 Feb 2022 18:16:59 -0800    

Click here for diff

Some pre-2017 Test::More versions need perfect $Test::Builder::Level  
maintenance to find the variable.  Buildfarm member snapper reported an  
overall failure that the file intended to hide via the TODO construct.  
That trouble was reachable in v11 and v10.  For later branches, this  
serves as defense in depth.  Back-patch to v10 (all supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/003_cic_2pc.pl
M src/test/recovery/t/027_stream_regress.pl

Fix typo in multixact.c

commit   : 0147fc7c8c92ee22910f40b1740425f43382bc95    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Feb 2022 10:45:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Feb 2022 10:45:14 +0900    

Click here for diff

Introduced in aa64f23.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20220209175338.GB1627503@nathanxps13  

M src/backend/access/transam/multixact.c

Reduce more the number of calls to GetMaxBackends()

commit   : 4567596316d186c6e61c72df013797266fcac2f7    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 10 Feb 2022 10:27:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 10 Feb 2022 10:27:29 +0900    

Click here for diff

Some of the code paths changed by aa64f23 can reduce the number of times  
GetMaxBackends() is called.  The performance gain is marginal, but most  
of the code changed by this commit already did that.  Hence, let's be  
clean and apply the same rule everywhere, for consistency.  
  
Some of the code paths, like in deadlock.c, involve only assertions.  
These are left unchanged.  
  
Reviewed-by: Nathan Bossart, Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/async.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/adt/lockfuncs.c

Further tweaks for psql's new tab-completion logic.

commit   : f0cd9097cfac435ec18ab2595c81f13a14736758    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2022 17:06:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2022 17:06:21 -0500    

Click here for diff

The behavior I proposed, of matching case only when only keywords  
are available to complete, turns out to be too cute.  It adds about  
as many problems as it removes.  Simplify down to ilmari's original  
proposal of just always matching case when completing a keyword.  
  
Also, I noticed while testing this that we've pessimized the behavior  
for qualified GUC names: the code is insisting that they be  
double-quoted, which was not the case before.  Fix that by treating  
GUC names as verbatim matches instead of possibly-schema-qualified  
names.  (While it's tempting to try to split qualified GUC names  
so that we *could* treat them with the schema-qualified-name code  
path, that really isn't going to work in light of guc.c's willingness  
to allow more than two name components.)  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c

Test honestly for <sys/signalfd.h>.

commit   : c5f5b4dd4b5ccecd193550530ff483f16f95746b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2022 14:24:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 9 Feb 2022 14:24:54 -0500    

Click here for diff

Commit 6a2a70a02 supposed that any platform having <sys/epoll.h>  
would also have <sys/signalfd.h>.  It turns out there are still a  
few people using platforms where that's not so, so we'd better make  
a separate configure probe for it.  But since it took this long to  
notice, I'm content with the decision to not have a separate code  
path for epoll-only machines; we'll just fall back to using poll()  
for these stragglers.  
  
Per gripe from Gabriela Serventi.  Back-patch to v14 where this  
code came in.  
  
Discussion: https://postgr.es/m/CAHOHWE-JjJDfcYuLAAEO7Jk07atFAU47z8TzHzg71gbC0aMy=g@mail.gmail.com  

M configure
M configure.ac
M src/backend/storage/ipc/latch.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix typo in archive modules docs

commit   : f48385c1327f1eaef134ad41b382041a79c5200a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 9 Feb 2022 15:36:46 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 9 Feb 2022 15:36:46 +0100    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/archive-modules.sgml

Free temporary memory when reading TOC

commit   : 1a29217a00a34162ca0ffac336d83f28132330a6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 9 Feb 2022 14:12:55 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 9 Feb 2022 14:12:55 +0100    

Click here for diff

ReadStr returns allocated memory which the caller is responsible for  
freeing when done with the string. This commit ensures that memory is  
freed in one case which used ReadStr in a conditional. While the leak  
might not be too concerning, this makes the code consistent across all  
ReadStr callsites in ReadToc. Due to the lack of complaints of issues  
in production from this, no backpatch is performed at this point.  
  
Author: Bharath Rupireddy, Georgios Kokolatos  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/oZwKiUxFsVaetG2xOJp7Hwao8F1AKIdfFDQLNJrnwoaxmjyB-45r_aYmhgXHKLcMI3GT24m9L6HafSi2ns7WFxXe0mw2_tIJpD-Z3vb_eyI=@pm.me  

M src/bin/pg_dump/pg_backup_archiver.c

Retire src/backend/utils/misc/check_guc

commit   : cf29a11ef6467fbb4b246d2086f7eecb1cfa42db    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Feb 2022 12:10:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Feb 2022 12:10:31 +0900    

Click here for diff

This script has existed for a long time, and attempting to run it today  
causes a lot of false positives as an effect of GUCs added in the last  
couple of years.  An equivalent, automatically-run and cross-platform  
solution is available in the TAP test introduced in b0a55f4.  So, let it  
go.  
  
Discussion: https://postgr.es/m/[email protected]  

D src/backend/utils/misc/check_guc

Add TAP test to automate the equivalent of check_guc

commit   : b0a55f4d4ad58e4bc152f8c1696b4af46525e3f1    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 9 Feb 2022 10:15:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 9 Feb 2022 10:15:26 +0900    

Click here for diff

src/backend/utils/misc/check_guc is a script that cross-checks the  
consistency of the GUCs with postgresql.conf.sample, making sure that  
its format is in line with what guc.c has.  It has never been run  
automatically, and has rotten over the years, creating a lot of false  
positives as per a report from Justin Pryzby.  
  
d10e41d has introduced a SQL function to publish the most relevant flags  
associated to a GUC, with tests added in the main regression test suite  
to make sure that we avoid most of the inconsistencies in the GUC  
settings, based on recent reports, but there was nothing able to  
cross-check postgresql.conf.sample with the contents of guc.c.  
  
This commit adds a TAP test that covers the remaining gap.  It emulates  
the most relevant checks that check_guc does, so as any format mistakes  
are detected in postgresql.conf.sample at development stage, with the  
following checks:  
- Check that parameters marked as NOT_IN_SAMPLE are not in the sample  
file.  
- Check that there are no dead entries in postgresql.conf.sample for  
parameters not marked as NOT_IN_SAMPLE.  
- Check that no parameters are missing from the sample file if listed in  
guc.c without NOT_IN_SAMPLE.  
  
The idea of building a list of the GUCs by parsing the sample file comes  
from Justin, and he wrote the regex used in the patch to find all the  
GUCs (this same formatting rule basically applies for the last 20~ years  
or so).  In order to test this patch, I have played with manual  
modifications of postgresql.conf.sample and guc.c, making sure that we  
detect problems with the GUC rules and the sample file format.  
  
The test is located in src/test/modules/test_misc, which is the best  
location I could think about for such sanity checks.  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

A src/test/modules/test_misc/t/003_check_guc.pl

Remove ppport.h's broken re-implementation of eval_pv().

commit   : d5c2a91e54cd083429dbb89113addf56bdac6a48    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 19:25:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 19:25:56 -0500    

Click here for diff

Recent versions of Devel::PPPort try to redefine eval_pv() to  
dodge a bug in pre-5.31 Perl versions.  Unfortunately the redefinition  
fails on compilers that don't support statements nested within  
expressions.  However, we aren't actually interested in this bug fix,  
since we always call eval_pv() with croak_on_error = FALSE.  
So, until there's an upstream fix for this breakage, just comment  
out the macro to revert to the older behavior.  
  
Per report from Wei Sun, as well as previous buildfarm failure  
on pademelon (which I'd unfortunately not looked at carefully  
enough to understand the cause).  Back-patch to all supported  
versions, since we're using the same ppport.h in all.  
  
Discussion: https://postgr.es/m/[email protected]  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=pademelon&dt=2022-02-02%2001%3A22%3A58  

M src/pl/plperl/ppport.h

Remove MaxBackends variable in favor of GetMaxBackends() function.

commit   : aa64f23b02924724eafbd9eadbf26d85df30a12b    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 15:52:40 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 8 Feb 2022 15:52:40 -0500    

Click here for diff

Previously, it was really easy to write code that accessed MaxBackends  
before we'd actually initialized it, especially when coding up an  
extension. To make this less error-prune, introduce a new function  
GetMaxBackends() which should be used to obtain the correct value.  
This will ERROR if called too early. Demote the global variable to  
a file-level static, so that nobody can peak at it directly.  
  
Nathan Bossart. Idea by Andres Freund. Review by Greg Sabino Mullane,  
by Michael Paquier (who had doubts about the approach), and by me.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/commands/async.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Rename create_function_N test scripts for clarity.

commit   : 2da896182ce11240774af6c4d769777f90a09536    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 15:40:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 15:40:08 -0500    

Click here for diff

Rename create_function_0 to create_function_c, and create_function_3  
to create_function_sql, to establish their charters more clearly.  
This should also reduce confusion versus our underscore-digit  
convention for naming variant expected-files.  
  
I separated this from the previous commit on the premise that keeping  
the renaming distinct might make "git blame" tracking easier.  
  
Discussion: https://postgr.es/m/[email protected]  

R098 src/test/regress/expected/create_function_0.out src/test/regress/expected/create_function_c.out
R099 src/test/regress/expected/create_function_3.out src/test/regress/expected/create_function_sql.out
M src/test/regress/parallel_schedule
R098 src/test/regress/sql/create_function_0.sql src/test/regress/sql/create_function_c.sql
R099 src/test/regress/sql/create_function_3.sql src/test/regress/sql/create_function_sql.sql

Rearrange core regression tests to reduce cross-script dependencies.

commit   : cc50080a828dd4791b43539f5a0f976e535d147c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 15:30:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 8 Feb 2022 15:30:38 -0500    

Click here for diff

The idea behind this patch is to make it possible to run individual  
test scripts without running the entire core test suite.  Making all  
the scripts completely independent would involve a massive rewrite,  
and would probably be worse for coverage of things like concurrent DDL.  
So this patch just does what seems practical with limited changes.  
  
The net effect is that any test script can be run after running  
limited earlier dependencies:  
* all scripts depend on test_setup  
* many scripts depend on create_index  
* other dependencies are few in number, and are documented in  
  the parallel_schedule file.  
  
To accomplish this, I chose a small number of commonly-used tables  
and moved their creation and filling into test_setup.  Later scripts  
are expected not to modify these tables' data contents, for fear of  
affecting other scripts' results.  Also, our former habit of declaring  
all C functions in one place is now gone in favor of declaring them  
where they're used, if that's just one script, or in test_setup if  
necessary.  
  
There's more that could be done to remove some of the remaining  
inter-script dependencies, but significantly more-invasive changes  
would be needed, and at least for now it doesn't seem worth it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/aggregates.out
M src/test/regress/expected/alter_generic.out
M src/test/regress/expected/arrays.out
M src/test/regress/expected/btree_index.out
M src/test/regress/expected/char.out
M src/test/regress/expected/char_1.out
M src/test/regress/expected/char_2.out
M src/test/regress/expected/conversion.out
M src/test/regress/expected/copy.out
M src/test/regress/expected/create_function_0.out
D src/test/regress/expected/create_function_1.out
D src/test/regress/expected/create_function_2.out
M src/test/regress/expected/create_function_3.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_misc.out
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_type.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/errors.out
M src/test/regress/expected/expressions.out
M src/test/regress/expected/float8.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/hash_index.out
M src/test/regress/expected/horology.out
M src/test/regress/expected/indirect_toast.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/int2.out
M src/test/regress/expected/int4.out
M src/test/regress/expected/int8.out
M src/test/regress/expected/join.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/lock.out
M src/test/regress/expected/misc.out
M src/test/regress/expected/misc_functions.out
M src/test/regress/expected/point.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/select.out
M src/test/regress/expected/select_distinct.out
M src/test/regress/expected/select_distinct_on.out
M src/test/regress/expected/select_into.out
M src/test/regress/expected/test_setup.out
M src/test/regress/expected/text.out
M src/test/regress/expected/transactions.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/tsearch.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/expected/varchar.out
M src/test/regress/expected/varchar_1.out
M src/test/regress/expected/varchar_2.out
M src/test/regress/expected/with.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/alter_generic.sql
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/btree_index.sql
M src/test/regress/sql/char.sql
M src/test/regress/sql/conversion.sql
M src/test/regress/sql/copy.sql
M src/test/regress/sql/create_function_0.sql
D src/test/regress/sql/create_function_1.sql
D src/test/regress/sql/create_function_2.sql
M src/test/regress/sql/create_function_3.sql
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_misc.sql
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/create_type.sql
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/errors.sql
M src/test/regress/sql/expressions.sql
M src/test/regress/sql/float8.sql
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/geometry.sql
M src/test/regress/sql/hash_index.sql
M src/test/regress/sql/horology.sql
M src/test/regress/sql/indirect_toast.sql
M src/test/regress/sql/insert.sql
M src/test/regress/sql/int2.sql
M src/test/regress/sql/int4.sql
M src/test/regress/sql/int8.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/jsonb.sql
M src/test/regress/sql/lock.sql
M src/test/regress/sql/misc.sql
M src/test/regress/sql/misc_functions.sql
M src/test/regress/sql/point.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/select.sql
M src/test/regress/sql/select_distinct.sql
M src/test/regress/sql/select_distinct_on.sql
M src/test/regress/sql/select_into.sql
M src/test/regress/sql/test_setup.sql
M src/test/regress/sql/text.sql
M src/test/regress/sql/transactions.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/tsearch.sql
M src/test/regress/sql/type_sanity.sql
M src/test/regress/sql/varchar.sql
M src/test/regress/sql/with.sql

Add PostgreSQL::Test::Cluster::config_data()

commit   : ba15f16107bea8a93edc505f3013cd7df4ac90fc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 8 Feb 2022 10:35:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 8 Feb 2022 10:35:27 +0900    

Click here for diff

This is useful to grab some configuration information from a node  
already set up, and I personally found two cases for it: pg_upgrade and  
a test to emulate check_guc.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Reduce non-leaf keys overlap in GiST indexes produced by a sorted build

commit   : f1ea98a7975e15cefdb446385880a2f55224ee7d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 7 Feb 2022 23:20:42 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 7 Feb 2022 23:20:42 +0300    

Click here for diff

The GiST sorted build currently chooses split points according to the only page  
space utilization.  That may lead to higher non-leaf keys overlap and, in turn,  
slower search query answers.  
  
This commit makes the sorted build use the opclass's picksplit method.  Once  
four pages at the level are accumulated, the picksplit method is applied until  
each split partition fits the page.  Some of our split algorithms could show  
significant performance degradation while processing 4-times more data at once.  
But those opclasses haven't received the sorted build support and shouldn't  
receive it before their split algorithms are improved.  
  
Discussion: https://postgr.es/m/CAHqSB9jqtS94e9%3D0vxqQX5dxQA89N95UKyz-%3DA7Y%2B_YJt%2BVW5A%40mail.gmail.com  
Author: Aliaksandr Kalenik, Sergei Shoulbakov, Andrey Borodin  
Reviewed-by: Björn Harrtell, Darafei Praliaskouski, Andres Freund  
Reviewed-by: Alexander Korotkov  

M contrib/pageinspect/expected/gist.out
M src/backend/access/gist/README
M src/backend/access/gist/gistbuild.c
M src/tools/pgindent/typedefs.list

Add (void) cast in front of rmtree() call at the end of pg_upgrade

commit   : 42a9e88bf6a809e6023c9d50f58cc6b9446f229d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 7 Feb 2022 14:19:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 7 Feb 2022 14:19:52 +0900    

Click here for diff

Most calls of rmtree() report an error, and the code coming from 38bfae3  
has introduced one caller where this is not done.  The previous behavior  
was to not fail hard if any log file generated is not properly unlinked  
when cleaning up the contents generated once the upgrade has completed,  
so add a cast to (void) to indicate the intention behind this new code.  
  
Per gripe from Coverity.  

M src/bin/pg_upgrade/pg_upgrade.c

pg_upgrade: Move all the files generated internally to a subdirectory

commit   : 38bfae36526636ef55daf7cf2a3282403587cb5b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 6 Feb 2022 12:27:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 6 Feb 2022 12:27:29 +0900    

Click here for diff

Historically, the location of any files generated by pg_upgrade, as of  
the per-database logs and internal dumps, has been the current working  
directory, leaving all those files behind when using --retain or on a  
failure.  
  
Putting all those contents in a targeted subdirectory makes the whole  
easier to debug, and simplifies the code in charge of cleaning up the  
logs.  Note that another reason is that this facilitates the move of  
pg_upgrade to TAP with a fixed location for all the logs to grab if the  
test fails repeatedly.  
  
Initially, we thought about being able to specify the output directory  
with a new option, but we have settled on using a subdirectory located  
at the root of the new cluster's data folder, "pg_upgrade_output.d",  
instead, as at the end the new data directory is the location of all the  
data generated by pg_upgrade.  There is a take with group permissions  
here though: if the new data folder has been initialized with this  
option, we need to create all the files and paths with the correct  
permissions or a base backup taken after a pg_upgrade --retain would  
fail, meaning that GetDataDirectoryCreatePerm() has to be called before  
creating the log paths, before a couple of sanity checks on the clusters  
and before getting the socket directory for the cluster's host settings.  
The idea of the new location is based on a suggestion from Peter  
Eisentraut.  
  
Also thanks to Andrew Dunstan, Peter Eisentraut, Daniel Gustafsson, Tom  
Lane and Bruce Momjian for the discussion (in alphabetical order).  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/.gitignore
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c

Doc: be clearer that foreign-table partitions need user-added constraints.

commit   : cbadfc1f8aa76e5a46a20354d533d6c2171668d3    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Feb 2022 12:55:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Feb 2022 12:55:44 -0500    

Click here for diff

A very well-informed user might deduce this from what we said already,  
but I'd bet against it.  Lay it out explicitly.  
  
While here, rewrite the comment about tuple routing to be more  
intelligible to an average SQL user.  
  
Per bug #17395 from Alexander Lakhin.  Back-patch to v11.  (The text  
in this area is different in v10 and I'm not sufficiently excited  
about this point to adapt the patch.)  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_foreign_table.sgml

Test, don't just Assert, that mergejoin's inputs are in order.

commit   : 5e26aa641e8a4fbd0a56f79119b0d8f62dbd4ddc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 5 Feb 2022 11:59:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 5 Feb 2022 11:59:29 -0500    

Click here for diff

There are two Asserts in nodeMergejoin.c that are reachable if  
the input data is not in the expected order.  This seems way too  
fragile.  Alexander Lakhin reported a case where the assertions  
could be triggered with misconfigured foreign-table partitions,  
and bitter experience with unstable operating system collation  
definitions suggests another easy route to hitting them.  Neither  
Assert is in a place where we can't afford one more test-and-branch,  
so replace 'em with plain test-and-elog logic.  
  
Per bug #17395.  While the reported symptom is relatively recent,  
collation changes could happen anytime, so back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeMergejoin.c

Improve worst-case performance of text_position_get_match_pos()

commit   : b31e3f561365136b48d63e8561f32b697df16d1d    
  
author   : John Naylor <[email protected]>    
date     : Fri, 17 Dec 2021 12:27:21 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 17 Dec 2021 12:27:21 -0400    

Click here for diff

This function converts a byte position to a character position after  
a successful string match. Rather than calling pg_mblen() in a loop,  
use pg_mbstrlen_with_len() since the latter can inline its own call to  
pg_mblen(). When the string match is at the end of the haystack text, this  
change results in 10-20% performance improvement, depending on platform and  
typical character length in bytes. This also simplifies the code a little.  
  
Specializing for UTF-8 could result in further improvement, but the  
performance gain was not found to be reliable between platforms. The modest  
gain in this commit is stable between platforms and usable by all server  
encodings.  
  
Discussion:  
https://www.postgresql.org/message-id/CAFBsxsH1Yutrmu+6LLHKK8iXY+vG--Do6zN+2900spHXQNNQKQ@mail.gmail.com  

M src/backend/utils/adt/varlena.c

Track LLVM 14 API changes, up to 2022-01-30.

commit   : 807fee1a39de6bb8184082012e643951abb9ad1d    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 4 Feb 2022 16:16:10 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 4 Feb 2022 16:16:10 +1300    

Click here for diff

Tested with LLVM 11, LLVM 13 and LLVM's main branch at commit  
8d8fce87bbd5.  There are still some deprecation warnings that will need  
to be sorted out, but this may be enough to turn "seawasp" green again.  
  
Like commit e6a76002, done on master only for now.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2B3Ac3He9_SpJcxeiiVknbcES1tbZEkH9sRBdJFGj8K5Q%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit_error.cpp

Improve invalidation handling in pgoutput.c.

commit   : 7f481b8d3884445b3839e402bf6d156e458ffeb6    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 4 Feb 2022 07:30:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 4 Feb 2022 07:30:40 +0530    

Click here for diff

Fix the following issues in pgoutput.c:  
  
* rel_sync_cache_relation_cb does the wrong thing when called for a cache  
flush (i.e., relid == 0). Instead of invalidating all RelationSyncCache  
entries as it should, it does nothing.  
  
* When rel_sync_cache_relation_cb does invalidate an entry, it immediately  
zaps the entry->map structure, even though that might still be in use. We  
instead just mark the entry as invalid and rebuild it at a later safe  
point.  
  
* Similarly, rel_sync_cache_publication_cb is way too eager to reset the  
pubactions flags, which would likely lead to failing to transmit changes  
that we should transmit. In this case also, we just mark the entry as  
invalid and rebuild it at a later safe point.  
  
Author: Tom Lane  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/pgoutput/pgoutput.c

In basic_archive tests, insist on wal_level='replica'.

commit   : 00c360a89c1ab5ced2b07e2f531998fa6842f194    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Feb 2022 16:40:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Feb 2022 16:40:32 -0500    

Click here for diff

That's normally the default, but buildfarm member thorntail has  
other ideas.  
  
Nathan Bossart  
  
Discussion: http://postgr.es/m/20220203212539.GA1082940@nathanxps13  

M contrib/basic_archive/basic_archive.conf

Allow archiving via loadable modules.

commit   : 5ef1eefd76f404ddc59b885d50340e602b70f05f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 3 Feb 2022 13:57:27 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 3 Feb 2022 13:57:27 -0500    

Click here for diff

Running a shell command for each file to be archived has a lot of  
overhead and may not offer as much error checking as you want, or the  
exact semantics that you want. So, offer the option to call a loadable  
module for each file to be archived, rather than running a shell command.  
  
Also, add a 'basic_archive' contrib module as an example implementation  
that archives to a local directory.  
  
Nathan Bossart, with a little bit of kibitzing by me.  
  
Discussion: http://postgr.es/m/20220202224433.GA1036711@nathanxps13  

M contrib/Makefile
A contrib/basic_archive/.gitignore
A contrib/basic_archive/Makefile
A contrib/basic_archive/basic_archive.c
A contrib/basic_archive/basic_archive.conf
A contrib/basic_archive/expected/basic_archive.out
A contrib/basic_archive/sql/basic_archive.sql
A doc/src/sgml/archive-modules.sgml
M doc/src/sgml/backup.sgml
A doc/src/sgml/basic-archive.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/shell_archive.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
M src/include/postmaster/pgarch.h

Fix compiler warning in non-assert builds, introduced in f862d57057f.

commit   : 7c1aead6cbe7dcc6c216715fed7a1fb60684c5dc    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 3 Feb 2022 10:44:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 3 Feb 2022 10:44:26 -0800    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, like f862d57057f  

M src/backend/executor/nodeForeignscan.c

Authorize new user in pg_basebackup tests

commit   : c1838b6f7a736aabca3482732490fd3ff3532fd3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 3 Feb 2022 12:13:11 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 3 Feb 2022 12:13:11 -0500    

Click here for diff

Commit 8e2b6d45a0 added a new unprivileged user for testing  
pg_basebackup, but omitted to add them to the cluster's authorized  
logins, breaking Windows  tests run without using Unix sockets.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Add UNIQUE null treatment option

commit   : 94aa7cc5f707712f592885995a28e018c7c80488    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 3 Feb 2022 11:29:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 3 Feb 2022 11:29:54 +0100    

Click here for diff

The SQL standard has been ambiguous about whether null values in  
unique constraints should be considered equal or not.  Different  
implementations have different behaviors.  In the SQL:202x draft, this  
has been formalized by making this implementation-defined and adding  
an option on unique constraint definitions UNIQUE [ NULLS [NOT]  
DISTINCT ] to choose a behavior explicitly.  
  
This patch adds this option to PostgreSQL.  The default behavior  
remains UNIQUE NULLS DISTINCT.  Making this happen in the btree code  
is pretty easy; most of the patch is just to carry the flag around to  
all the places that need it.  
  
The CREATE UNIQUE INDEX syntax extension is not from the standard,  
it's my own invention.  
  
I named all the internal flags, catalog columns, etc. in the negative  
("nulls not distinct") so that the default PostgreSQL behavior is the  
default if the flag is false.  
  
Reviewed-by: Maxim Orlov <[email protected]>  
Reviewed-by: Pavel Borisov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/catalog/index.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_features.txt
M src/backend/catalog/toasting.c
M src/backend/commands/indexcmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/sort/tuplesort.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_index.h
M src/include/nodes/execnodes.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/utils/tuplesort.h
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_index.out
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_index.sql

Further fix for EvalPlanQual with mix of local and foreign partitions.

commit   : f862d57057fdc73e663fe09d8948ed06b1b71dd7    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 3 Feb 2022 15:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 3 Feb 2022 15:15:00 +0900    

Click here for diff

We assume that direct-modify ForeignScan nodes cannot be re-evaluated  
during EvalPlanQual processing, but the rework for inherited  
UPDATE/DELETE in commit 86dc90056 changed things, without considering  
that, so that such ForeignScan nodes get called as part of the  
EvalPlanQual subtree during EvalPlanQual processing in the case of an  
inherited UPDATE/DELETE where the inheritance set contains foreign  
target relations.  To avoid re-evaluating such ForeignScan nodes during  
EvalPlanQual processing, commit c3928b467 modified nodeForeignscan.c,  
but the assumption made there that ExecForeignScan() should never be  
called for such ForeignScan nodes during EvalPlanQual processing turned  
out to be wrong in some cases, leading to a segmentation fault or a  
"cannot re-evaluate a Foreign Update or Delete during EvalPlanQual"  
error.  
  
Fix by modifying nodeForeignscan.c further to avoid re-evaluating such  
ForeignScan nodes even in ExecForeignScan()/ExecReScanForeignScan()  
during EvalPlanQual processing.  Since this makes non-reachable the  
test-and-elog added to ForeignNext() by commit c3928b467 that produced  
the aforesaid error, convert the test-and-elog to an Assert.  
  
Per bug #17355 from Alexander Lakhin.  Back-patch to v14 where both  
commits came in.  
  
Patch by me, reviewed and tested by Alexander Lakhin and Amit Langote.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeForeignscan.c

Remove configure's check for rl_completion_append_character.

commit   : 4b0e37faaf5ffe1552a07438323341c6394890da    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Feb 2022 23:01:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Feb 2022 23:01:56 -0500    

Click here for diff

The comment for PGAC_READLINE_VARIABLES says "Readline versions < 2.1  
don't have rl_completion_append_character".  It seems certain that such  
versions are extinct in the wild, though; for sure there are none in the  
buildfarm.  Libedit has had this variable for at least twenty years too.  
Also, tab-complete.c's behavior without it is quite unfriendly, since  
we'll emit a space even when completion fails; but we've had no  
complaints about that.  
  
Therefore, let's assume this variable is always there, and drop the  
configure check to save a few build cycles.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/programs.m4
M configure
M src/bin/psql/tab-complete.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

doc: clarify syntax notation, particularly parentheses

commit   : 9d179d9c23b9d4cc1a4ffa02e4de79114de064d7    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 2 Feb 2022 21:53:52 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 2 Feb 2022 21:53:52 -0500    

Click here for diff

Also move TCL syntax to the PL/tcl section.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/notation.sgml
M doc/src/sgml/pltcl.sgml

windows: Improve crash / assert / exception handling.

commit   : f3feff825940972c0dcf1173f0a6a4ff43f8d382    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 2 Feb 2022 18:33:25 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 2 Feb 2022 18:33:25 -0800    

Click here for diff

startup_hacks() called SetErrorMode() with the SEM_NOGPFAULTERRORBOX argument  
to prevent GUI popups on error. While that likely was sufficient at some  
point, there are other sources of error popups.  
  
At the same time SEM_NOGPFAULTERRORBOX unfortunately also prevents  
"just-in-time debuggers" from working reliably, i.e. the ability to attach to  
a process on crash. This prevents collecting crash dumps as part of CI.  
  
The error popups are particularly problematic when they occur during automated  
testing, as they can cause the tests to hang, waiting for a button to be  
clicked.  
  
This commit improves the error handling setup in startup_hacks() to address  
those problems. SEM_NOGPFAULTERRORBOX is not used anymore, instead various  
other APIs are used to disable popups and to redirect output to stderr where  
possible.  
  
While this improves the situation for postgres.exe, it doesn't address similar  
issues in all the other executables. There currently is no codepath that's  
called early on for all frontend programs.  
  
I've tested that this prevents GUI popups and allows JIT debugging in case of  
crashes due to:  
- abort()  
- assert()  
- C runtime errors  
- unhandled exceptions  
both in debug and non-debug mode, on Win10 with MSVC 2019 and with MinGW.  
  
Now that crash reports are generated on windows, collect them in windows CI.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml
M src/backend/main/main.c

ci: windows: run tests under timeout.

commit   : 6dcc18526673ec6cfa2fa286d2039ae85fb8eb9e    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 2 Feb 2022 17:31:54 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 2 Feb 2022 17:31:54 -0800    

Click here for diff

On windows ci/cfbot currently regularly hangs / times out. Presumably this is due  
to the issues discussed in  
https://postgr.es/m/CA%2BhUKG%2BG5DUNJfdE-qusq5pcj6omYTuWmmFuxCvs%3Dq1jNjkKKA%40mail.gmail.com  
which lead to reverting 75674c7ec1b everywhere but master.  
  
But it's hard to tell - because the entire test task times out, we don't get  
to see debugging information.  
  
This commit adds a timeout (using git's timeout binary) to all vcregress  
invocations, which should address the problem for now. It might also be a good  
idea to add timeouts to the other operating systems at a later time.  
  
The diff is a bit larger than one might think necessary: Yaml doesn't like % -  
from the windows command variable syntax - at the start of an unquoted  
string...  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Improve psql tab-completion tests.

commit   : d33a81203e95d31e62157c4ae0e00e2198841208    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 2 Feb 2022 16:08:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 2 Feb 2022 16:08:59 -0500    

Click here for diff

Fix up recently-added test cases in 010_tab_completion.pl  
so that they pass with the rather seriously broken libedit  
found in Debian 10 (Buster).  
  
Also, add a few more test cases to improve code coverage.  
The total line coverage still looks pretty awful, because  
we exercise only a few paths of the giant if-else chain in  
psql_completion().  However, this now covers almost all of  
the code that isn't in one of those if-blocks.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl

Fix server crash bug in 'server' backup target.

commit   : 8e2b6d45a033287da7c8f63062129ea02d86d831    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 2 Feb 2022 13:50:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 2 Feb 2022 13:50:33 -0500    

Click here for diff

When this code executed as superuser it appeared to work because no  
system catalog lookups happened, but otherwise it crashes because there  
is no transaction environment. Fix that.  
  
Report and code change by me. Test case by Dagfinn Ilmari Mannsåker.  
  
Discussion: http://postgr.es/m/CA+TgmobiKLXne-2AVzYyWRiO8=rChBQ=7ywoxp=2SmcFw=oDDw@mail.gmail.com  

M src/backend/replication/basebackup_server.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Some cleanup for change of collate and ctype fields to type text

commit   : 87669de72c2249e6aec84b8c27fdc3ffb7284e13    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Feb 2022 11:58:55 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Feb 2022 11:58:55 +0100    

Click here for diff

Some cleanup for commit 54637508f87bd5f07fb9406bac6b08240283be3b:  
Reformat pg_database.dat to reflect the new field order.  Also update  
the corresponding example in bki.sgml.  Reorder the way the fields are  
filled in dbcommands.c to correspond to the new order.  

M doc/src/sgml/bki.sgml
M src/backend/commands/dbcommands.c
M src/include/catalog/pg_database.dat

doc: Fix mistake in PL/Python documentation

commit   : cb2bab14fff5b4e1c065b8546323f1a9fefc9611    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 2 Feb 2022 09:14:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 2 Feb 2022 09:14:26 +0100    

Click here for diff

Small thinko introduced by 94aceed317730953476bec490ce0148b2af3c383  
  
Reported-by: [email protected]  

M doc/src/sgml/plpython.sgml

Fix recovery conflict in 027_stream_regress.pl.

commit   : 4d7c3e34475a750d0529f5912deedc9b1a1eedd8    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 2 Feb 2022 16:11:00 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 2 Feb 2022 16:11:00 +1300    

Click here for diff

To avoid "ERROR:  canceling statement due to conflict with recovery",  
as seen on a couple of slower build farm animals, crank  
max_standby_streaming_delay right up.  
  
In passing, adjust a configuration option that accidentally used a  
non-standard format (not a problem, but needlessly inconsistent).  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGK65xVqNgsSPyrr2LEwtfUN%3DGfEuQ868hTC-mu0bFG42A%40mail.gmail.com  

M src/test/recovery/t/027_stream_regress.pl

Treat case of tab-completion keywords a bit more carefully.

commit   : 020258fbd30d37ddd03d0ec68264d1544f8d2838    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Feb 2022 17:05:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Feb 2022 17:05:09 -0500    

Click here for diff

When completing keywords that are offered alongside names obtained  
from a query, preserve the user's choice of keyword case.  This  
would have been messy to do before 02b8048ba, but now it's fairly  
simple.  A complication is that we want keywords to be shown in  
upper case in any tab-completion menus that include both keywords  
and non-keywords, so we can't switch their case until enough has  
been typed that only keyword(s) remain to be chosen.  
  
Also, adjust some places where 02b8048ba thoughtlessly held over  
a previous choice to display keywords in lower case.  (I think  
I got confused as to whether those words were keywords or variable  
names, but they're the former.)  
  
Dagfinn Ilmari Mannsåker and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c

Doc: modernize documentation for lo_create()/lo_creat().

commit   : a5a9d77b8b4ea636ca5f8ae115c00a031c94c56c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 1 Feb 2022 10:57:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 1 Feb 2022 10:57:26 -0500    

Click here for diff

At this point lo_creat() is a legacy function with little if any  
real use-case, so describing it first doesn't make much sense.  
Describe lo_create() first, and then explain lo_creat() as a  
backwards-compatibility alternative.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/lobj.sgml

Fix missing undefine in sort_template.h

commit   : 0526f2f4c38cb50d3e2a6e0aa5d51354158df6e3    
  
author   : John Naylor <[email protected]>    
date     : Mon, 31 Jan 2022 14:53:34 -0500    
  
committer: John Naylor <[email protected]>    
date     : Mon, 31 Jan 2022 14:53:34 -0500    

Click here for diff

All parameter macros are supposed to be undefined at the end of the  
header. ST_CHECK_FOR_INTERRUPTS was forgotten, so could affect later  
inclusions.  
  
Thomas Munro  
  
The patch set of which this is a part is discussed in  
https://www.postgresql.org/message-id/CA%2BhUKGLPommgNw-SVwUGkw1YmTDwmJ5vSKO0kFnZfbRHtNFW5w%40mail.gmail.com  

M src/include/lib/sort_template.h

Simplify coding around path_contains_parent_reference().

commit   : b426bd48ee3f5a6890038421f81df7ed919d73dc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Jan 2022 13:53:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Jan 2022 13:53:38 -0500    

Click here for diff

Given the existing stipulation that path_contains_parent_reference()  
must only be invoked on canonicalized paths, we can simplify things  
in the wake of commit c10f830c5.  It is now only possible to see  
".." at the start of a relative path.  That means we can simplify  
path_contains_parent_reference() itself quite a bit, and it makes  
the two existing outside call sites dead code, since they'd already  
checked that the path is absolute.  
  
We could now fold path_contains_parent_reference() into its only  
remaining caller path_is_relative_and_below_cwd().  But it seems  
better to leave it as a separately callable function, in case any  
extensions are using it.  
  
Also document the pre-existing requirement for  
path_is_relative_and_below_cwd's input to be likewise canonicalized.  
  
Shenhao Wang and Tom Lane  
  
Discussion: https://postgr.es/m/OSBPR01MB4214FA221FFE046F11F2AD74F2D49@OSBPR01MB4214.jpnprd01.prod.outlook.com  

M contrib/adminpack/adminpack.c
M src/backend/utils/adt/genfile.c
M src/port/path.c

Make canonicalize_path() more canonical.

commit   : c10f830c511f0ba3e6f4c9d99f444d39e30440c8    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 31 Jan 2022 12:05:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 31 Jan 2022 12:05:37 -0500    

Click here for diff

Teach canonicalize_path() how to strip all unnecessary uses of "."  
and "..", replacing the previous ad-hoc code that got rid of only  
some such cases.  In particular, we can always remove all such  
uses from absolute paths.  
  
The proximate reason to do this is that Windows rejects paths  
involving ".." in some cases (in particular, you can't put one in a  
symlink), so we ought to be sure we don't use ".." unnecessarily.  
Moreover, it seems like good cleanup on general principles.  
  
There is other path-munging code that could be simplified now, but  
we'll leave that for followup work.  
  
It is tempting to call this a bug fix and back-patch it.  On the other  
hand, the misbehavior can only be reached if a highly privileged user  
does something dubious, so it's not unreasonable to say "so don't do  
that".  And this patch could result in unexpected behavioral changes,  
in case anybody was expecting uses of ".." to stay put.  So at least  
for now, just put it in HEAD.  
  
Shenhao Wang, editorialized a bit by me  
  
Discussion: https://postgr.es/m/OSBPR01MB4214FA221FFE046F11F2AD74F2D49@OSBPR01MB4214.jpnprd01.prod.outlook.com  

M contrib/adminpack/expected/adminpack.out
M src/port/path.c
M src/test/regress/expected/create_function_1.out
M src/test/regress/expected/misc_functions.out
M src/test/regress/regress.c
M src/test/regress/sql/create_function_1.sql
M src/test/regress/sql/misc_functions.sql

plperl: windows: Use Perl_setlocale on 5.28+, fixing compile failure.

commit   : c89f409749c35bf18fab8e025a34645dd925390c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 30 Jan 2022 14:29:04 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 30 Jan 2022 14:29:04 -0800    

Click here for diff

For older versions we need our own copy of perl's setlocale(), because it was  
not exposed (why we need the setlocale in the first place is explained in  
plperl_init_interp) . The copy stopped working in 5.28, as some of the used  
macros are not public anymore.  But Perl_setlocale is available in 5.28, so  
use that.  
  
Author: Victor Wagner <[email protected]>  
Reviewed-By: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: all versions  

M src/pl/plperl/plperl.c

Introduce pg_settings_get_flags() to find flags associated to a GUC

commit   : d10e41d4238e7dcd23968230939c0c59cbcb41c2    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 31 Jan 2022 08:56:41 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 31 Jan 2022 08:56:41 +0900    

Click here for diff

The most meaningful flags are shown, which are the ones useful for the  
user and for automating and extending the set of tests supported  
currently by check_guc.  
  
This script may actually be removed in the future, but we are not  
completely sure yet if and how we want to support the remaining sanity  
checks performed there, that are now integrated in the main regression  
test suite as of this commit.  
  
Thanks also to Peter Eisentraut and Kyotaro Horiguchi for the  
discussion.  
  
Bump catalog version.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/misc/guc.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

psql: improve tab-complete's handling of variant SQL names.

commit   : 02b8048ba5dc36238f3e7c3c58c5946220298d71    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jan 2022 13:33:23 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jan 2022 13:33:23 -0500    

Click here for diff

This patch improves tab completion's ability to deal with  
valid variant spellings of SQL identifiers.  Notably:  
  
* Unquoted upper-case identifiers are now downcased as the backend  
would do, allowing them to be completed correctly.  
  
* Tab completion can now match identifiers that are quoted even  
though they don't need to be; for example "f<TAB> now completes  
to "foo" if that's the only available name.  Previously, only  
names that require quotes would be offered.  
  
* Schema-qualified identifiers are now supported where SQL syntax  
allows it; many lesser-used completion rules neglected this.  
  
* Completion operations that refer back to some previously-typed  
name (for example, to complete names of columns belonging to a  
previously-mentioned table) now allow variant spellings of the  
previous name too.  
  
In addition, performance of tab completion queries has been  
improved for databases containing many objects, although  
you'd only be likely to notice with a heavily-loaded server.  
  
Authors of future tab-completion patches should note that this  
commit changes many details about how tab completion queries  
must be written:  
  
* Tab completion queries now deal in raw object names; do not  
use quote_ident().  
  
* The name-matching restriction in a query must now be written  
as "outputcol LIKE '%s'", not "substring(outputcol,1,%d)='%s'".  
  
* The SchemaQuery mechanism has been extended so that it can  
handle queries that refer back to a previous name.  Most completion  
queries that do that should be converted to SchemaQuery form.  
Only consider using a literal query if the previous name can  
never be schema-qualified.  Don't use a literal query if the  
name-to-be-completed can validly be schema-qualified, either.  
  
* Use set_completion_reference() to specify which word is the previous  
name to consider, for either a SchemaQuery or a literal query.  
  
* If you want to offer some keywords in addition to a query result  
(for example, offer COLUMN in addition to column names after  
"ALTER TABLE t RENAME"), do not use the old hack of tacking the  
keywords on with UNION.  Instead use the new QUERY_PLUS macros  
to write such keywords separately from the query proper.  The  
"addon" macro arguments that used to be used for this purpose  
are gone.  
  
* If your query returns something that's not a SQL identifier  
(such as an attribute number or enum label), use the new  
QUERY_VERBATIM macros to prevent the result from incorrectly  
getting double-quoted.  You may still need to use quote_literal  
in such a query, too.  
  
Tom Lane and Haiying Tang  
  
Discussion: https://postgr.es/m/a63cbd45e3884cf9b3961c2a6a95dcb7@G08CNEXMBPEKD05.g08.fujitsu.local  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c

Remove xloginsert.h from xlog.h

commit   : b3d7d6e462fce56ec68ca8dd5424f36f630c60f6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 30 Jan 2022 12:25:24 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 30 Jan 2022 12:25:24 -0300    

Click here for diff

xlog.h is directly and indirectly #included in a lot of places.  With  
this change, xloginsert.h is no longer unnecessarily included in the  
large number of them that don't need it.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACVe-W+WM5P44N7eG9C2_FmaeM8Dq5aCnD3fHt0Ba=WR6w@mail.gmail.com  

M contrib/pg_surgery/heap_surgery.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/transam/commit_ts.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/utils/cache/inval.c
M src/backend/utils/init/postinit.c
M src/include/access/xlog.h

Fix failure to validate the result of select_common_type().

commit   : 8e2e0f75869e47b3a429b1251b00b3d6d5861028    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 29 Jan 2022 11:41:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 29 Jan 2022 11:41:12 -0500    

Click here for diff

Although select_common_type() has a failure-return convention, an  
apparent successful return just provides a type OID that *might* work  
as a common supertype; we've not validated that the required casts  
actually exist.  In the mainstream use-cases that doesn't matter,  
because we'll proceed to invoke coerce_to_common_type() on each input,  
which will fail appropriately if the proposed common type doesn't  
actually work.  However, a few callers didn't read the (nonexistent)  
fine print, and thought that if they got back a nonzero OID then the  
coercions were sure to work.  
  
This affects in particular the recently-added "anycompatible"  
polymorphic types; we might think that a function/operator using  
such types matches cases it really doesn't.  A likely end result  
of that is unexpected "ambiguous operator" errors, as for example  
in bug #17387 from James Inform.  Another, much older, case is that  
the parser might try to transform an "x IN (list)" construct to  
a ScalarArrayOpExpr even when the list elements don't actually have  
a common supertype.  
  
It doesn't seem desirable to add more checking to select_common_type  
itself, as that'd just slow down the mainstream use-cases.  Instead,  
write a separate function verify_common_type that performs the  
missing checks, and add a call to that where necessary.  Likewise add  
verify_common_type_from_oids to go with select_common_type_from_oids.  
  
Back-patch to v13 where the "anycompatible" types came in.  (The  
symptom complained of in bug #17387 doesn't appear till v14, but  
that's just because we didn't get around to converting || to use  
anycompatible till then.)  In principle the "x IN (list)" fix could  
go back all the way, but I'm not currently convinced that it makes  
much difference in real-world cases, so I won't bother for now.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/include/parser/parse_coerce.h
M src/test/regress/expected/arrays.out
M src/test/regress/expected/expressions.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/expressions.sql

Fix comments about bgworker registration before MaxBackends initialization

commit   : 5ecd0183fb6afa4a07aad71ea0e08c70f64a42a9    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 29 Jan 2022 10:47:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 29 Jan 2022 10:47:36 +0900    

Click here for diff

Since 6bc8ef0b, InitializeMaxBackends() has used max_worker_processes  
instead of adapting MaxBackends to the number of background workers  
registered by modules loaded in shared_preload_libraries (at this time,  
bgworkers were only static, but gained dynamic capabilities as a matter  
of supporting parallel queries meaning that a control cap was  
necessary).  
  
Some comments referred to the past registration logic, making them  
confusing and incorrect, so fix these.  
  
Some of the out-of-core modules that could be loaded in this path  
sometimes like to manipulate dynamically some of the resource-related  
GUCs for their own needs, this commit adds a note about that.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/20220127181815.GA551692@nathanxps13  

M src/backend/postmaster/postmaster.c
M src/backend/utils/init/postinit.c

vacuumlazy.c: Rename state field for consistency.

commit   : bf42fcace5c510b3579469913ae4cbb2517861d5    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 28 Jan 2022 17:41:09 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 28 Jan 2022 17:41:09 -0800    

Click here for diff

Rename pages_removed to removed_pages, for consistency with nearby  
vacrel fields.  

M src/backend/access/heap/vacuumlazy.c

Fix incorrect memory context switch in COPY TO execution

commit   : dc084d7c730c93541a386851de9c62bd0e9a0c92    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 29 Jan 2022 10:22:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 29 Jan 2022 10:22:42 +0900    

Click here for diff

c532d15 has split the logic of COPY commands into multiple files, one  
change being to move the internals of BeginCopy() to BeginCopyTo().  
Originally the code was written so as we'd switch back-and-forth between  
the current execution memory context and the dedicated memory context  
for the COPY command, and this refactoring has introduced an extra  
switch to the current memory context from the COPY context once  
BeginCopyTo() is done with the past logic coming from BeginCopy().  
  
The code was correctly doing the analyze, rewrite and planning phases in  
the COPY context, but it was not assigning "copy_file" (FILE* used when  
copying to a source file) and "filename" in the COPY context, making the  
COPY status data inconsistent.  
  
Author: Bharath Rupireddy  
Reviewed-by: Japin Li  
Discussion: https://postgr.es/m/CALj2ACWvVa69foi9jhHFY=2BuHxAoYboyE+vXQTARwxZcJnVrQ@mail.gmail.com  
Backpatch-through: 14  

M src/backend/commands/copyto.c

Add bbstreamer_gzip.c to Mkvcbuild.pm.

commit   : 0d72d6b341f0d11674c7efb269f2d824c983c35d    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 16:15:58 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 16:15:58 -0500    

Click here for diff

Also add a note to src/bin/pg_basebackup/Makefile to try to reduce  
the chances of future mistakes of this type.  
  
Per bowerbird.  

M src/bin/pg_basebackup/Makefile
M src/tools/msvc/Mkvcbuild.pm

Tab-complete ALTER PUBLICATION ADD TABLE with list of tables

commit   : 95787e849b9c3cb047751400c8bc49a8bf0f4133    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 28 Jan 2022 17:08:40 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 28 Jan 2022 17:08:40 -0300    

Click here for diff

This has been posted as part of the column-list feature for logical  
replication since [1], but it's not really related to that.  
  
[1] https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Remove superfluous variable.

commit   : 82331ed4dd60ce1f8db67e189f793f27cd1aac96    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 14:13:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 14:13:54 -0500    

Click here for diff

Jeevan Ladhe  
  
Discussion: http://postgr.es/m/CAOgcT0PJpOiafsmZfGZRLGK1WUqZwYdjFWRwgZTVDQHCCwO-EQ@mail.gmail.com  

M src/bin/pg_verifybackup/t/008_untar.pl

Move the code to archive files via the shell to a separate file.

commit   : aeb4cc9ea07a63ecb4a230513620ceee855a839a    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 13:29:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 13:29:32 -0500    

Click here for diff

This is preparatory work for allowing more extensibility in this area.  
  
Nathan Bossart  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/postmaster/Makefile
M src/backend/postmaster/pgarch.c
A src/backend/postmaster/shell_archive.c
M src/include/postmaster/pgarch.h

Adjust server-side backup to depend on pg_write_server_files.

commit   : 7f6772317b4a4f9d30c25d1853571fca6d834f0c    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 12:26:33 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 12:26:33 -0500    

Click here for diff

I had made it depend on superuser, but that seems clearly inferior.  
Also document the permissions requirement in the straming replication  
protocol section of the documentation, rather than only in the  
section having to do with pg_basebackup.  
  
Idea and patch from Dagfinn Ilmari Mannsåker.  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup_server.c

pg_basebackup: Cleaner handling when compression is multiply specified.

commit   : 51891d5a95605c4e98324731b386345d89c5a71e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 11:40:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 11:40:53 -0500    

Click here for diff

Tushar Ahuja discovered that if you use both --compress and --gzip,  
or --compress multiple times, the last instance of one of these  
options doesn't in all cases overwrite the compression level set by  
an earlier option. That's not a serious bug, but it also has nothing  
to recommend it. Repair.  
  
Discussion: http://postgr.es/m/CA+TgmoZfP=rsZB_9vDGfhuNgSu_M_09UWu8SjvsP65y_1pQFCg@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Fix mistakes in commit d45099425eb19e420433c9d81d354fe585f4dbd6.

commit   : da505eafca81bc81c34f729521a42a093408cb92    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 09:02:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 09:02:18 -0500    

Click here for diff

I intended to include a change to the "skip" count in the test  
case, but it didn't get folded into the commit. Do that now,  
so that non-zlib builds don't break.  
  
The new file bbstreamer_gzip.c needs <unistd.h> to avoid  
complaints about dup() not having a prototype, as per buildfarm  
returns.  

M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_verifybackup/t/009_extract.pl

Allow server-side compression to be used with -Fp.

commit   : d45099425eb19e420433c9d81d354fe585f4dbd6    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 08:41:25 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jan 2022 08:41:25 -0500    

Click here for diff

If you have a low-bandwidth connection between the client and the  
server, it's reasonable to want to compress on the server side but  
then decompress and extract the backup on the client side. This  
commit allows you do to do just that.  
  
Dipesh Pandit, with minor and mostly cosmetic changes by me.  
  
Discussion: http://postgr.es/m/CAN1g5_HiSh8ajUMd4ePtGyCXo89iKZTzaNyzP_qv1eJbi4YHXA@mail.gmail.com  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_file.c
A src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/pg_basebackup.c
A src/bin/pg_verifybackup/t/009_extract.pl

Add HEADER support to COPY text format

commit   : 43f33dc018a4b77ced78a0a6df8ed5d450cfe5f4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 09:22:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 09:22:53 +0100    

Click here for diff

The COPY CSV format supports the HEADER option to output a header  
line.  This patch adds the same option to the default text format.  On  
input, the HEADER option causes the first line to be skipped, same as  
with CSV.  
  
Author: Rémi Lapeyre <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAF1-J-0PtCWMeLtswwGV2M70U26n4g33gpe1rcKQqe6wVQDrFA@mail.gmail.com  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/include/commands/copy.h
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

Add some const decorations

commit   : 5553cbd4fe3eb177b3266ca4a7e80159323608c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 09:13:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 09:13:11 +0100    

Click here for diff

M src/backend/commands/copyto.c

doc: Update ALTER COLLATION wording

commit   : 9a50f2e51cf89889a08922b74dbe68486f20b760    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 08:21:36 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 28 Jan 2022 08:21:36 +0100    

Click here for diff

The original text on refreshing collation versions was written  
specifically for ICU, and then information for other providers was  
incrementally tacked on at the end.  Reword this to be a bit more  
general and less reflective of how it was added.  

M doc/src/sgml/ref/alter_collation.sgml

Fix typo in comment.

commit   : eabcfd99ed27e5d21fee91fc7007678589081f58    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 28 Jan 2022 15:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 28 Jan 2022 15:45:00 +0900    

Click here for diff

M src/backend/executor/nodeForeignscan.c

Prevent memory context logging from sending log message to connected client.

commit   : 108505d763d12bc2d9d21697f57c331963aa12d1    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 28 Jan 2022 11:24:42 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 28 Jan 2022 11:24:42 +0900    

Click here for diff

When pg_log_backend_memory_contexts() is executed, the target backend  
should use LOG_SERVER_ONLY to log its memory contexts, to prevent them  
from being sent to its connected client regardless of client_min_messages.  
But previously the backend unexpectedly used LOG to log the message  
"logging memory contexts of PID %d" and it could be sent to the client.  
This is a bug in memory context logging.  
  
To fix the bug, this commit changes that message so that it's logged with  
LOG_SERVER_ONLY.  
  
Back-patch to v14 where pg_log_backend_memory_contexts() was added.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy, Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/mcxt.c

Specify --host in 027_stream_regress.pl's pg_regress invocation.

commit   : 7340aceed72b522bfcbba70520b4c2435c35d2ba    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 27 Jan 2022 14:38:44 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 27 Jan 2022 14:38:44 -0800    

Click here for diff

The invocation of pg_regress in 027_stream_regress.pl didn't specify the  
host. It ends up working on most systems because of connection  
defaults. However, on windows it makes the test very slow unless  
PG_TEST_USE_UNIX_SOCKETS is used.  
  
The problem is that windows resolves "localhost" to ::0, 127.0.0.1, the server  
started only listens on 127.0.0.1.  On windows refused TCP connections are  
internally retried a few times, with back-off between tries, taking at least 2  
seconds.  
  
Noticed while investigating a complaint about the test's slow speed by Andrew  
Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/027_stream_regress.pl

Avoid referencing Z_DEFAULT_COMPRESSION outside HAVE_LIBZ.

commit   : 8ee940843dfed6623b0a0d0b15080aa469116ce0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 15:11:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 15:11:19 -0500    

Click here for diff

Because that's bad.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c

pg_basebackup: Add a dummy return to bbsink_gzip_new().

commit   : 71cbbbbe80a43b1a89ce6eab56c780394425dc38    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 14:20:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 14:20:18 -0500    

Click here for diff

Apparently, this is needed to avoid warnings on MVCC.  
  
David Rowley  
  
Discussion: http://postgr.es/m/CAApHDvosHkgyo_PZs7CSB4Kgs2ey4FdmFpcK0N_QOci9DJ=wnw@mail.gmail.com  

M src/backend/replication/basebackup_gzip.c

Fix ordering of XIDs in ProcArrayApplyRecoveryInfo

commit   : f192e1bdf3b247167207ae42f6bef81a7ce5e93b    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 27 Jan 2022 17:53:53 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 27 Jan 2022 17:53:53 +0100    

Click here for diff

Commit 8431e296ea reworked ProcArrayApplyRecoveryInfo to sort XIDs  
before adding them to KnownAssignedXids. But the XIDs are sorted using  
xidComparator, which compares the XIDs simply as uint32 values, not  
logically. KnownAssignedXidsAdd() however expects XIDs in logical order,  
and calls TransactionIdFollowsOrEquals() to enforce that. If there are  
XIDs for which the two orderings disagree, an error is raised and the  
recovery fails/restarts.  
  
Hitting this issue is fairly easy - you just need two transactions, one  
started before the 4B limit (e.g. XID 4294967290), the other sometime  
after it (e.g. XID 1000). Logically (4294967290 <= 1000) but when  
compared using xidComparator we try to add them in the opposite order.  
Which makes KnownAssignedXidsAdd() fail with an error like this:  
  
  ERROR: out-of-order XID insertion in KnownAssignedXids  
  
This only happens during replica startup, while processing RUNNING_XACTS  
records to build the snapshot. Once we reach STANDBY_SNAPSHOT_READY, we  
skip these records. So this does not affect already running replicas,  
but if you restart (or create) a replica while there are transactions  
with XIDs for which the two orderings disagree, you may hit this.  
  
Long-running transactions and frequent replica restarts increase the  
likelihood of hitting this issue. Once the replica gets into this state,  
it can't be started (even if the old transactions are terminated).  
  
Fixed by sorting the XIDs logically - this is fine because we're dealing  
with normal XIDs (because it's XIDs assigned to backends) and from the  
same wraparound epoch (otherwise the backends could not be running at  
the same time on the primary node). So there are no problems with the  
triangle inequality, which is why xidComparator compares raw values.  
  
Investigation and root cause analysis by Abhijit Menon-Sen. Patch by me.  
  
This issue is present in all releases since 9.4, however releases up to  
9.6 are EOL already so backpatch to 10 only.  
  
Reviewed-by: Abhijit Menon-Sen  
Reviewed-by: Alvaro Herrera  
Backpatch-through: 10  
Discussion: https://postgr.es/m/36b8a501-5d73-277c-4972-f58a4dce088a%40enterprisedb.com  

M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/xid.c
M src/include/utils/builtins.h

Remove some trailing whitespace in documentation files

commit   : c9cfc861fc871014f9f2fce477c8182fa13fc120    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 18:28:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 18:28:21 +0100    

Click here for diff

M doc/src/sgml/hash.sgml
M doc/src/sgml/ref/alter_collation.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/pg_checksums.sgml

pg_basebackup: Fix a couple of recently-introduced bugs.

commit   : dabf63bc9a5b71f61c2c8712c85d33fdc06efa8c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 09:46:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 27 Jan 2022 09:46:17 -0500    

Click here for diff

The server expects the compression level to be between 1 and 9, but  
Z_DEFAULT_COMPRESSION is -1, so we must not try to send that value  
to the server.  
  
Because pg_basebackup's -R option is implemented on the client side,  
it can't be used in combination with a backup target. Error out if  
someone tries that, instead of silently ignoring the option.  
  
Both issues were reported by Tushar Ahuja; patch by me.  
  
Discussion: http://postgr.es/m/CA+TgmoaMwgdx8HxBjF8hmbohVvPL_0H5LqNrSq0uU+7BKp_Q2A@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Improve msys2 detection for TAP tests

commit   : acea505186e65dff33db69517d36a02c7b4f0283    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 27 Jan 2022 08:17:42 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 27 Jan 2022 08:17:42 -0500    

Click here for diff

Perl instances on some msys toolchains (e.g. UCRT64) have their  
configured osname set to 'MSWin32' rather than 'msys'.  The test for  
the msys2 platform is adjusted accordingly.  
  
Backpatch to release 14.  

M src/test/perl/PostgreSQL/Test/Utils.pm

psql: Add tab completion for ALTER COLLATION / REFRESH VERSION

commit   : fefce9ef987ea00cd963f679223fdb9d381b9ec5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 09:23:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 09:23:50 +0100    

Click here for diff

This was forgotten when this command form was added  
(eccfef81e1f73ee41f1d8bfe4fa4e80576945048).  

M src/bin/psql/tab-complete.c

Change collate and ctype fields to type text

commit   : 54637508f87bd5f07fb9406bac6b08240283be3b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 08:44:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 27 Jan 2022 08:44:31 +0100    

Click here for diff

This changes the data type of the catalog fields datcollate, datctype,  
collcollate, and collctype from name to text.  There wasn't ever a  
really good reason for them to be of type name; presumably this was  
just carried over from when they were fixed-size fields in pg_control,  
first into the corresponding pg_database fields, and then to  
pg_collation.  The values are not identifiers or object names, and we  
don't ever look them up that way.  
  
Changing to type text saves space in the typical case, since locale  
names are typically only a few bytes long.  But it is also possible  
that an ICU locale name with several customization options appended  
could be longer than 63 bytes, so this also enables that case, which  
was previously probably broken.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_collation.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.h
M src/include/utils/pg_locale.h

postgres_fdw: Fix handling of a pending asynchronous request in postgresReScanForeignScan().

commit   : 9e283fc85d66f6e4d355c6996e863afb026866d4    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 27 Jan 2022 16:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 27 Jan 2022 16:15:00 +0900    

Click here for diff

Commit 27e1f1456 failed to process a pending asynchronous request made  
for a given ForeignScan node in postgresReScanForeignScan() (if any) in  
cases where we would only reset the next_tuple counter in that function,  
contradicting the assumption that there should be no pending  
asynchronous requests that have been made for async-capable subplans for  
the parent Append node after ReScan.  This led to an assert failure in  
an assert-enabled build.  I think this would also lead to mis-rewinding  
the cursor in that function in the case where we have already fetched  
one batch for the ForeignScan node and the asynchronous request has been  
made for the second batch, because even in that case we would just reset  
the counter when called from that function, so we would fail to execute  
MOVE BACKWARD ALL.  
  
To fix, modify that function to process the asynchronous request before  
restarting the scan.  
  
While at it, add a comment to a function to match other places.  
  
Per bug #17344 from Alexander Lakhin.  Back-patch to v14 where the  
aforesaid commit came in.  
  
Patch by me.  Test case by Alexander Lakhin, adjusted by me.  Reviewed  
and tested by Alexander Lakhin and Dmitry Dolgov.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

On sparc64+ext4, suppress test failures from known WAL read failure.

commit   : ce6d79368efa8a553490b5b5962bc529d7de54cb    
  
author   : Noah Misch <[email protected]>    
date     : Wed, 26 Jan 2022 18:06:19 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Wed, 26 Jan 2022 18:06:19 -0800    

Click here for diff

Buildfarm members kittiwake, tadarida and snapper began to fail  
frequently when commits 3cd9c3b921977272e6650a5efbeade4203c4bca2 and  
f47ed79cc8a0cfa154dc7f01faaf59822552363f added tests of concurrency, but  
the problem was reachable before those commits.  Back-patch to v10 (all  
supported versions).  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/003_cic_2pc.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/recovery/t/027_stream_regress.pl

Fix pg_hba_file_rules for authentication method cert

commit   : 2dbb7b9b2279d064f66ce9008869fd0e2b794534    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 26 Jan 2022 09:52:41 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 26 Jan 2022 09:52:41 +0100    

Click here for diff

For authentication method cert, clientcert=verify-full is implied. But  
the pg_hba_file_rules entry would incorrectly show clientcert=verify-ca.  
  
Per bug #17354  
  
Reported-By: Feike Steenbergen  
Reviewed-By: Jonathan Katz  
Backpatch-through: 12  

M src/backend/libpq/hba.c

Replace use of deprecated Python module distutils.sysconfig, take 2.

commit   : bd233bdd8dd95ea127a921998847724c44295736    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Jan 2022 18:52:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Jan 2022 18:52:44 -0500    

Click here for diff

With Python 3.10, configure spits out warnings about the module  
distutils.sysconfig being deprecated and scheduled for removal in  
Python 3.12.  Change the uses in configure to use the module sysconfig  
instead.  The logic stays largely the same, although we have to  
rely on INCLUDEPY instead of the deprecated get_python_inc function.  
  
Note that sysconfig exists since Python 2.7, so this moves the minimum  
required version up from Python 2.6.  Also, sysconfig didn't exist in  
Python 3.1, so the minimum 3.x version is now 3.2.  
  
We should consider back-patching this if it gives no further trouble,  
as the no-longer-supported versions are old enough to probably not  
be interesting to anyone.  
  
Peter Eisentraut, Tom Lane, Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Revert "Temporarily add some information about python include paths to configure."

commit   : e2217706619520fc70cb4fb41abf7535956e7bef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Jan 2022 18:35:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Jan 2022 18:35:30 -0500    

Click here for diff

This reverts commit f032f63e727c1ab07603b3d1cd88d50f850d5738.  
We don't need it anymore.  

M config/python.m4
M configure

commit   : e1f860f13459e186479319aa9f65ef184277805f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 25 Jan 2022 14:54:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 25 Jan 2022 14:54:35 -0500    

Click here for diff

Commit 0ad8032910d5eb8efd32867c45b6a25c85e60f50 failed to update  
the pg_basebackup documentation to mention that "client-" or  
"server-" can now be prepended to the compression method name. Fix  
it there, and also in the --help output that you get from running  
the binary.  
  
Also in the documentation, there's an old issue that the arguments to  
--checkpoint shouldn't be marked as parameters, because "fast" and  
"spread" are literal strings. Fix that too.  
  
Dagfinn Ilmari Mannsåker, partly as per a report from  
Shinoda Noriyoshi.  
  
Discussion: http://postgr.es/m/PH7PR84MB1885C1CF433057807551172BEE5F9@PH7PR84MB1885.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c

Consider parallel awareness when removing single-child Appends

commit   : f9a74c1498d25098606fc5c4621216d38a1cc57d    
  
author   : David Rowley <[email protected]>    
date     : Tue, 25 Jan 2022 21:10:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 25 Jan 2022 21:10:03 +1300    

Click here for diff

8edd0e794 added some code to remove Append and MergeAppend nodes when they  
contained a single child node.  As it turned out, this was unsafe to do  
when the Append/MergeAppend was parallel_aware and the child node was not.  
Removing the Append/MergeAppend, in this case, could lead to the child plan  
being called multiple times by parallel workers when it was unsafe to do  
so.  
  
Here we fix this by just not removing the Append/MergeAppend when the  
parallel_aware flag of the parent and child node don't match.  
  
Reported-by: Yura Sokolov  
Bug: #17335  
Discussion: https://postgr.es/m/b59605fecb20ba9ea94e70ab60098c237c870628.camel%40postgrespro.ru  
Backpatch-through: 12, where 8edd0e794 was first introduced  

M src/backend/optimizer/plan/setrefs.c

commit   : 741bd3293389d451adb91190f84914a59142214f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Jan 2022 13:37:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Jan 2022 13:37:19 +0900    

Click here for diff

WAL replay would cause a hard crash if the timeline expected by a  
XLOG_END_OF_RECOVERY, a XLOG_CHECKPOINT_ONLINE, or a  
XLOG_CHECKPOINT_SHUTDOWN record is not the same as the timeline being  
replayed, using the same error message for all three of them.  This  
commit changes those error messages to use different wordings, adapted  
to each record type, which is useful when it comes to the debugging of  
an issue in this area.  
  
Author: Amul Sul  
Reviewed-by: Nathan Bossart, Robert Haas  
Discussion: https://postgr.es/m/CAAJ_b97i1ZerYC_xW6o_AiDSW5n+sGi8k91Yc8KS8bKWKxjqwQ@mail.gmail.com  

M src/backend/access/transam/xlog.c

Fix various typos, grammar and code style in comments and docs

commit   : 410aa248e5a883fde4832999cc9b23c7ace0f2ff    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 25 Jan 2022 09:40:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 25 Jan 2022 09:40:04 +0900    

Click here for diff

This fixes a set of issues that have accumulated over the past months  
(or years) in various code areas.  Most fixes are related to some recent  
additions, as of the development of v15.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/select_into.sgml
M src/backend/access/gin/ginget.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/inherit.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/sync/sync.c
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/wait_event.c
M src/bin/psql/describe.c
M src/include/replication/pgoutput.h
M src/include/utils/dynahash.h
M src/pl/plperl/plperl.c
M src/port/pgcheckdir.c
M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql
M src/tools/msvc/vcregress.pl

Unbreak pg_verifybackup/t/008_untar.pl on msys

commit   : c817a072aae8441a11d6a0336953ecd69dc548ba    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 16:32:16 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 16:32:16 -0500    

Click here for diff

Commit 0ad8032910 contains the same pattern fixed in commit 4f0bcc7350.  
Apply the same fix.  

M src/bin/pg_verifybackup/t/008_untar.pl

Add tests of the CREATEROLE attribute

commit   : e9d4001ec592bcc9a3332547cb1b0211e8794f38    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 15:25:27 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 15:25:27 -0500    

Click here for diff

The current regression tests do not contain much testing of CREATEROLE.  
This patch, extracted from a larger patch set to modify how that  
feature works, remedies that omission.  
  
Author: Mark Dilger  
  
Discussion: https://postgr.es/m/[email protected]  

A src/test/regress/expected/create_role.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/create_role.sql

Fix limitations on what SQL commands can be issued to a walsender.

commit   : 6aa5186146f15f8b78749b52caee1eabb3a1aa92    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jan 2022 15:33:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jan 2022 15:33:34 -0500    

Click here for diff

In logical replication mode, a WalSender is supposed to be able  
to execute any regular SQL command, as well as the special  
replication commands.  Poor design of the replication-command  
parser caused it to fail in various cases, notably:  
  
* semicolons embedded in a command, or multiple SQL commands  
sent in a single message;  
  
* dollar-quoted literals containing odd numbers of single  
or double quote marks;  
  
* commands starting with a comment.  
  
The basic problem here is that we're trying to run repl_scanner.l  
across the entire input string even when it's not a replication  
command.  Since repl_scanner.l does not understand all of the  
token types known to the core lexer, this is doomed to have  
failure modes.  
  
We certainly don't want to make repl_scanner.l as big as scan.l,  
so instead rejigger stuff so that we only lex the first token of  
a non-replication command.  That will usually look like an IDENT  
to repl_scanner.l, though a comment would end up getting reported  
as a '-' or '/' single-character token.  If the token is a replication  
command keyword, we push it back and proceed normally with repl_gram.y  
parsing.  Otherwise, we can drop out of exec_replication_command()  
without examining the rest of the string.  
  
(It's still theoretically possible for repl_scanner.l to fail on  
the first token; but that could only happen if it's an unterminated  
single- or double-quoted string, in which case you'd have gotten  
largely the same error from the core lexer too.)  
  
In this way, repl_gram.y isn't involved at all in handling general  
SQL commands, so we can get rid of the SQLCmd node type.  (In  
the back branches, we can't remove it because renumbering enum  
NodeTag would be an ABI break; so just leave it sit there unused.)  
  
I failed to resist the temptation to clean up some other sloppy  
coding in repl_scanner.l while at it.  The only externally-visible  
behavior change from that is it now accepts \r and \f as whitespace,  
same as the core lexer.  
  
Per bug #17379 from Greg Rychlewski.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/include/nodes/nodes.h
M src/include/nodes/replnodes.h
M src/include/replication/walsender_private.h

Server-side gzip compression.

commit   : 0ad8032910d5eb8efd32867c45b6a25c85e60f50    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Jan 2022 15:13:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Jan 2022 15:13:18 -0500    

Click here for diff

pg_basebackup's --compression option now lets you write either  
"client-gzip" or "server-gzip" instead of just "gzip" to specify  
where the compression should be performed. If you write simply  
"gzip" it's taken to mean "client-gzip" unless you also use  
--target, in which case it is interpreted to mean "server-gzip",  
because that's the only thing that makes any sense in that case.  
  
To make this work, the BASE_BACKUP command now takes new  
COMPRESSION and COMPRESSION_LEVEL options.  
  
At present, pg_basebackup cannot decompress .gz files, so  
server-side compression will cause a failure if (1) -Ft is not  
used or (2) -R is used or (3) -D- is used without --no-manifest.  
  
Along the way, I removed the information message added by commit  
5c649fe153367cdab278738ee4aebbfd158e0546 which occurred if you  
specified no compression level and told you that the default level  
had been used instead. That seemed like more output than most  
people would want.  
  
Also along the way, this adds a check to the server for  
unrecognized base backup options. This repairs a bug introduced  
by commit 0ba281cb4bf9f5f65529dfa4c8282abb734dd454.  
  
This commit also adds some new test cases for pg_verifybackup.  
They take a server-side backup with and without compression, and  
then extract the backup if we have the OS facilities available  
to do so, and then run pg_verifybackup on the extracted  
directory. That is a good test of the functionality added by  
this commit and also improves test coverage for the backup target  
patch (commit 3500ccc39b0dadd1068a03938e4b8ff562587ccc) and for  
pg_verifybackup itself.  
  
Patch by me, with a bug fix by Jeevan Ladhe.  The patch set of which  
this is a part has also had review and/or testing from Tushar Ahuja,  
Suraj Kharage, Dipesh Pandit, and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+Tgmoa-ST7fMLsVJduOB7Eub=2WjfpHS+QxHVEpUoinf4bOSg@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/Makefile
M src/backend/replication/Makefile
M src/backend/replication/basebackup.c
A src/backend/replication/basebackup_gzip.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_verifybackup/Makefile
A src/bin/pg_verifybackup/t/008_untar.pl
M src/include/replication/basebackup_sink.h

pg_upgrade: Preserve database OIDs.

commit   : aa01051418f10afbdfa781b8dc109615ca785ff9    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 24 Jan 2022 14:23:15 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 24 Jan 2022 14:23:15 -0500    

Click here for diff

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 arranged to preserve  
relfilenodes and tablespace OIDs. For similar reasons, also arrange  
to preserve database OIDs.  
  
One problem is that, up until now, the OIDs assigned to the template0  
and postgres databases have not been fixed. This could be a problem  
when upgrading, because pg_upgrade might try to migrate a database  
from the old cluster to the new cluster while keeping the OID and find  
a different database with that OID, resulting in a failure. If it finds  
a database with the same name and the same OID that's OK: it will be  
dropped and recreated. But the same OID and a different name is a  
problem.  
  
To prevent that, fix the OIDs for postgres and template0 to specific  
values less than 16384. To avoid running afoul of this rule, these  
values should not be changed in future releases. It's not a problem  
that these OIDs aren't fixed in existing releases, because the OIDs  
that we're assigning here weren't used for either of these databases  
in any previous release. Thus, there's no chance that an upgrade of  
a cluster from any previous release will collide with the OIDs we're  
assigning here. And going forward, the OIDs will always be fixed, so  
the only potential collision is with a system database having the  
same name and the same OID, which is OK.  
  
This patch lets users assign a specific OID to a database as well,  
provided however that it can't be less than 16384. I (rhaas) thought  
it might be better not to expose this capability to users, but the  
consensus was otherwise, so the syntax is documented. Letting users  
assign OIDs below 16384 would not be OK, though, because a  
user-created database with a low-numbered OID might collide with a  
system-created database in a future release. We therefore prohibit  
that.  
  
Shruthi KC, based on an earlier patch from Antonin Houska, reviewed  
and with some adjustments by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYgTwYcUmB=e8+hRHOFA0kkS6Kde85+UNdon6q7bt1niQ@mail.gmail.com  
Discussion: http://postgr.es/m/CAASxf_Mnwm1Dh2vd5FAhVX6S1nwNSZUB1z12VddYtM++H2+p7w@mail.gmail.com  

M doc/src/sgml/ref/create_database.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/IMPLEMENTATION
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/psql/tab-complete.c
M src/include/access/transam.h
M src/include/catalog/unused_oids

Unbreak pg_basebackup/t/010_pg_basebackup.pl on msys

commit   : 4f0bcc735038e96404fae59aa16ef9beaf6bb0aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 14:03:46 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 24 Jan 2022 14:03:46 -0500    

Click here for diff

Once again we ran foul of the rather baroque msys2 path translation  
rules. The cure as in many cases is to do the translation ourselves.  
  
Discussion: https://postgr.es/m/CA+TgmoZU+1yj8TZ8PZrPHxPmr6Wz84V2RfZnsd5HnZugYtqZng@mail.gmail.com  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Remember to reset yy_start state when firing up repl_scanner.l.

commit   : 3c06ec6d1412a6ebf05ee0566b5c05969f0b541f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 24 Jan 2022 12:09:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 24 Jan 2022 12:09:46 -0500    

Click here for diff

Without this, we get odd behavior when the previous cycle of  
lexing exited in a non-default exclusive state.  Every other  
copy of this code is aware that it has to do BEGIN(INITIAL),  
but repl_scanner.l did not get that memo.  
  
The real-world impact of this is probably limited, since most  
replication clients would abandon their connection after getting  
a syntax error.  Still, it's a bug.  
  
This mistake is old, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/repl_scanner.l

Temporarily add some information about python include paths to configure.

commit   : f032f63e727c1ab07603b3d1cd88d50f850d5738    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Jan 2022 23:30:40 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Jan 2022 23:30:40 -0800    

Click here for diff

We're still (see e0e567a1067, e0e567a1067) working on replacing use of the  
deprecated distutils. This commit just makes configure print out the results  
of different ways of determining the include path. Hopefully this will help us  
to find a way to transition away from distutils without turning the buildfarm  
red for prolonged amounts of time.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure

pg_basebackup: Skip a few more fsyncs if --no-sync is specified.

commit   : 9c86d9337eb0b9fdf7a8ce19d6044cc7ca0086fb    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 23 Jan 2022 13:59:23 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 23 Jan 2022 13:59:23 -0800    

Click here for diff

This is mostly interesting for running the regression tests on machines with  
slow / overloaded IO.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/walmethods.c

pg_dump: avoid useless query in binary_upgrade_set_type_oids_by_type_oid

commit   : ac7df108cf32e11e4bd120898ed09bd58fa5b62c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 13:54:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 13:54:24 -0500    

Click here for diff

Commit 6df7a9698 wrote appendPQExpBuffer where it should have  
written printfPQExpBuffer.  This resulted in re-issuing the  
previous query along with the desired one, which very accidentally  
had no negative consequences except for some wasted cycles.  
  
Back-patch to v14 where that came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Clean up recent Coverity complaints.

commit   : 353708e1fb2d8b1a34f6da2c25d4bb6633cf4493    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 12:51:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 12:51:38 -0500    

Click here for diff

Commit 5c649fe15 introduced a memory leak into pg_basebackup's  
parse_compress_options.  (I simplified nearby code while at it.)  
  
Commit 9a974cbcb introduced a memory leak into pg_dump's  
binary_upgrade_set_pg_class_oids.  
  
Coverity also complained about a call of SnapBuildProcessChange that  
ignored the result, unlike every other call of that function.  This  
is evidently intentional, so add a (void) cast to indicate that.  
(It's also old, dating to b89e15105; I suppose the reason it showed  
up now is 7a5f6b474's recent rearrangement of nearby code.)  

M src/backend/replication/logical/decode.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/pg_dump.c

Suppress variable-set-but-not-used warning from clang 13.

commit   : dc43fc9b3aa3e0fa9c84faddad6d301813580f88    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 11:09:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 23 Jan 2022 11:09:00 -0500    

Click here for diff

In the normal configuration where GEQO_DEBUG isn't defined,  
recent clang versions have started to complain that geqo_main.c  
accumulates the edge_failures count but never does anything  
with it.  As a minimal back-patchable fix, insert a void cast  
to silence this warning.  (I'd speculated about ripping out the  
GEQO_DEBUG logic altogether, but I don't think we'd wish to  
back-patch that.)  
  
Per recently-established project policy, this is a candidate  
for back-patching into out-of-support branches: it suppresses  
an annoying compiler warning but changes no behavior.  Hence,  
back-patch all the way to 9.2.  
  
Discussion: https://postgr.es/m/CA+hUKGLTSZQwES8VNPmWO9AO0wSeLt36OCPDAZTccT1h7Q7kTQ@mail.gmail.com  

M src/backend/optimizer/geqo/geqo_main.c

Correct type of front_pathkey to PathKey

commit   : 7b65862e2280eafca00566ee44af2c1bbb143e9d    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 23 Jan 2022 03:36:55 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 23 Jan 2022 03:36:55 +0100    

Click here for diff

In sort_inner_and_outer we iterate a list of PathKey elements, but the  
variable is declared as (List *). This mistake is benign, because we  
only pass the pointer to lcons() and never dereference it.  
  
This exists since ~2004, but it's confusing. So fix and backpatch to all  
supported branches.  
  
Backpatch-through: 10  
Discussion: https://postgr.es/m/bf3a6ea1-a7d8-7211-0669-189d5c169374%40enterprisedb.com  

M src/backend/optimizer/path/joinpath.c

Check syscache result in AlterStatistics

commit   : 6d554e3fcd6fb8be2dbcbd3521e2947ed7a552cb    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 23 Jan 2022 02:49:41 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 23 Jan 2022 02:49:41 +0100    

Click here for diff

The syscache lookup may return NULL even for valid OID, for example due  
to a concurrent DROP STATISTICS, so a HeapTupleIsValid is necessary.  
Without it, it may fail with a segfault.  
  
Reported by Alexander Lakhin, patch by me. Backpatch to 13, where ALTER  
STATISTICS ... SET STATISTICS was introduced.  
  
Backpatch-through: 13  
Discussion: https://postgr.es/m/17372-bf3b6e947e35ae77%40postgresql.org  

M src/backend/commands/statscmds.c

Remove useless inline marker.

commit   : 62e28097cebf99533bd0badd6f3c6ce9db9f1497    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 17:11:33 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 17:11:33 -0500    

Click here for diff

Putting "inline" on a function that's not used anywhere in its  
own file is useless unless the linker is doing global optimization,  
a method we don't generally enable.  Moreover, it draws warnings  
from some buildfarm members (curculio at least).  
  
Looks like this was sloppiness in cc8b25712, which moved the  
function from somewhere else where the inline marker was  
more appropriate.  

M src/backend/commands/vacuum.c

Doc: add cross-references between array_to_string and string_to_array.

commit   : 4f02cbcb6839553c595efa3a2eb1c2a09557ef79    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 15:44:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 15:44:51 -0500    

Click here for diff

These functions aren't exact inverses, but they're closely related;  
yet we document them in two different sections.  Add cross-ref  
<link>s to improve that situation.  
  
While here, move the strpos and substr entries to re-alphabetize  
Table 9.10.  Also, drop an ancient compatibility note about  
string_to_array, which wasn't even on the right page, so probably  
few people ever saw it.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX.

commit   : d8fbbb925bdb8ca1c8eb8572192f4ee199f4d276    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 13:32:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 22 Jan 2022 13:32:40 -0500    

Click here for diff

Previously, unless we had to add a NOT NULL constraint to the column,  
this command resulted in updating only the index's relcache entry.  
That's problematic when replication behavior is being driven off the  
existence of a primary key: other sessions (and ours too for that  
matter) failed to recalculate their opinion of whether the table can  
be replicated.  Add a relcache invalidation to fix it.  
  
This has been broken since pg_class.relhaspkey was removed in v11.  
Before that, updating the table's relhaspkey value sufficed to cause  
a cache flush.  Hence, backpatch to v11.  
  
Report and patch by Hou Zhijie  
  
Discussion: https://postgr.es/m/OS0PR01MB5716EBE01F112C62F8F9B786947B9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/catalog/index.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Fix race condition in gettext() initialization in libpq and ecpglib.

commit   : 1f655fdc39352c813a83a0a0f1e932af9ef2b6de    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 21 Jan 2022 15:36:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 21 Jan 2022 15:36:12 -0500    

Click here for diff

In libpq and ecpglib, multiple threads can concurrently enter the  
initialization logic for message localization.  Since we set the  
its-done flag before actually doing the work, it'd be possible  
for some threads to reach gettext() before anyone has called  
bindtextdomain().  Barring bugs in libintl itself, this would not  
result in anything worse than failure to localize some early  
messages.  Nonetheless, it's a bug, and an easy one to fix.  
  
Noted while investigating bug #17299 from Clemens Zeidler  
(much thanks to Liam Bowen for followup investigation on that).  
It currently appears that that actually *is* a bug in libintl itself,  
but that doesn't let us off the hook for this bit.  
  
Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAE7q7Eit4Eq2=bxce=Fm8HAStECjaXUE=WBQc-sDDcgJQ7s7eg@mail.gmail.com  

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/libpq/fe-misc.c

fsync pg_logical/mappings in CheckPointLogicalRewriteHeap().

commit   : 1fabec7d7c389181424fa7881632a415584ca7b7    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 21 Jan 2022 11:22:55 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 21 Jan 2022 11:22:55 -0800    

Click here for diff

While individual logical rewrite files were synced to disk, the directory was  
not. On some filesystems that could lead to loosing directory entries after a  
crash.  
  
Reported-By: Tom Lane <[email protected]>  
Author: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-  

M src/backend/access/heap/rewriteheap.c

postgres_fdw: Fix subabort cleanup of connections used in asynchronous execution.

commit   : 6c07f9ebce1579612c4ed9076159f9e942e50f9d    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 21 Jan 2022 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 21 Jan 2022 17:45:00 +0900    

Click here for diff

Commit 27e1f1456 resets the per-connection states of connections used to  
scan foreign tables asynchronously during abort cleanup at main  
transaction end, but it failed to do so during subabort cleanup at  
subtransaction end, leading to a segmentation fault when re-executing an  
asynchronous-foreign-table-scan query in a transaction that was  
cancelled in a subtransaction of it.  
  
Fix by modifying pgfdw_abort_cleanup() to reset the per-connection state  
of a given connection also when called for subabort cleanup.  Also,  
modify that function to do the reset in both the abort-cleanup and  
subabort-cleanup cases if necessary, to save cycles, and improve a  
comment on it a little bit.  
  
Back-patch to v14 where the aforesaid commit came in.  
  
Reviewed by Alexander Pyhalov  
  
Discussion: https://postgr.es/m/CAPmGK14cCV-JA7kNsyt2EUTKvZ4xkr2LNRthi1U1C3cqfGppAw@mail.gmail.com  

M contrib/postgres_fdw/connection.c

Fix one-off bug causing missing commit timestamps for subtransactions

commit   : 237d1f317240b60b3fff698f4e9b184d1db83a6e    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Jan 2022 14:54:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Jan 2022 14:54:04 +0900    

Click here for diff

The logic in charge of writing commit timestamps (enabled with  
track_commit_timestamp) for subtransactions had a one-bug bug,  
where it would be possible that commit timestamps go missing for the  
last subtransaction committed.  
  
While on it, simplify a bit the iteration logic in the loop writing the  
commit timestamps, as per suggestions from Kyotaro Horiguchi and Tom  
Lane, so as some variable initializations are not part of the loop  
itself.  
  
Issue introduced in 73c986a.  
  
Analyzed-by: Alex Kingsborough  
Author: Alex Kingsborough, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/backend/access/transam/commit_ts.c

Add new simple TAP test for tablespaces, attempt II.

commit   : cfe7bd17e4fa987c9ba14add48ea58a41c45ccdb    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 21 Jan 2022 15:12:32 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 21 Jan 2022 15:12:32 +1300    

Click here for diff

See commit message for d1511fe1b040853f6e10d353e56b42bb96ae239d.  This  
new version attempts to fix path translation problem on MSYS/Windows.  
  
Discussion: https://postgr.es/m/20220117055326.GD756210%40rfd.leadboat.com  

A src/test/modules/test_misc/t/002_tablespace.pl

Extend the options of pg_basebackup to control compression

commit   : 5c649fe153367cdab278738ee4aebbfd158e0546    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 21 Jan 2022 11:08:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 21 Jan 2022 11:08:43 +0900    

Click here for diff

The option --compress is extended to accept a compression method and an  
optional compression level, as of the grammar METHOD[:LEVEL].  The  
methods currently support are "none" and "gzip", for client-side  
compression.  Any of those methods use only an integer value for the  
compression level, but any method implemented in the future could use  
more specific keywords if necessary.  
  
This commit keeps the logic backward-compatible.  Hence, the following  
compatibility rules apply for the new format of the option --compress:  
* -z/--gzip is a synonym of --compress=gzip.  
* --compress=NUM implies:  
** --compress=none if NUM = 0.  
** --compress=gzip:NUM if NUM > 0.  
  
Note that there are also plans to extend more this grammar with  
server-side compression.  
  
Reviewed-by: Robert Haas, Magnus Hagander, Álvaro Herrera, David  
G. Johnston, Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_basebackup.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Revert "Make configure prefer python3 to plain python."

commit   : 512fc2dd790e3e7c35b3af8cd7586aeb25248c6e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jan 2022 17:32:21 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jan 2022 17:32:21 -0500    

Click here for diff

This reverts commit f201da39edcd6ac1ab9a3edf3e20e2a73bbbe69e.  
The buildfarm is not ready for python3, evidently, so we'll  
give the owners some more time to get set up.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Tighten TAP tests' tracking of postmaster state some more.

commit   : 4fdbf9af5184d033f07010a1ab573fb329e7b8cd    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jan 2022 17:28:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jan 2022 17:28:07 -0500    

Click here for diff

Commits 6c4a8903b et al. had a couple of deficiencies:  
  
* The logic I added to Cluster::start to see if a PID file is present  
could be fooled by a stale PID file left over from a previous  
postmaster.  To fix, if we're not sure whether we expect to find a  
running postmaster or not, validate the PID using "kill 0".  
  
* 017_shm.pl has a loop in which it just issues repeated Cluster::start  
calls; this will fail if some invocation fails but leaves self->_pid  
set.  Per buildfarm results, the above fix is not enough to make this  
safe: we might have "validated" a PID for a postmaster that exits  
immediately after we look.  Hence, match each failed start call with  
a stop call that will get us back to the self->_pid == undef state.  
Add a fail_ok option to Cluster::stop to make this work.  
  
Discussion: https://postgr.es/m/CA+hUKGKV6fOHvfiPt8=dOKzvswjAyLoFoJF1iQXMNpi7+hD1JQ@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/017_shm.pl

Support base backup targets.

commit   : 3500ccc39b0dadd1068a03938e4b8ff562587ccc    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Nov 2021 15:20:50 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Nov 2021 15:20:50 -0500    

Click here for diff

pg_basebackup now has a --target=TARGET[:DETAIL] option. If specfied,  
it is sent to the server as the value of the TARGET option to the  
BASE_BACKUP command. If DETAIL is included, it is sent as the value of  
the new TARGET_DETAIL option to the BASE_BACKUP command.  If the  
target is anything other than 'client', pg_basebackup assumes that it  
will now be the server's job to write the backup in a location somehow  
defined by the target, and that it therefore needs to write nothing  
locally. However, the server will still send messages to the client  
for progress reporting purposes.  
  
On the server side, we now support two additional types of backup  
targets.  There is a 'blackhole' target, which just throws away the  
backup data without doing anything at all with it. Naturally, this  
should only be used for testing and debugging purposes, since you will  
not actually have a backup when it finishes running. More usefully,  
there is also a 'server' target, so you can now use something like  
'pg_basebackup -Xnone -t server:/SOME/PATH' to write a backup to some  
location on the server. We can extend this to more types of targets  
in the future, and might even want to create an extensibility  
mechanism for adding new target types.  
  
Since WAL fetching is handled with separate client-side logic, it's  
not part of this mechanism; thus, backups with non-default targets  
must use -Xnone or -Xfetch.  
  
Patch by me, with a bug fix by Jeevan Ladhe.  The patch set of which  
this is a part has also had review and/or testing from Tushar Ahuja,  
Suraj Kharage, Dipesh Pandit, and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmoaYZbz0=Yk797aOJwkGJC-LK3iXn+wzzMx7KdwNpZhS5g@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/Makefile
M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_copy.c
A src/backend/replication/basebackup_server.c
M src/backend/utils/activity/wait_event.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/include/replication/basebackup_sink.h
M src/include/utils/wait_event.h

Allow clean.bat to be run from anywhere

commit   : f80900be06f784a6bda705800305c550e05d6edf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 20 Jan 2022 10:13:18 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 20 Jan 2022 10:13:18 -0500    

Click here for diff

This was omitted from c3879a7b4c which modified the other msvc .bat  
files.  
  
Per request from Juan José Santamaría Flecha  
  
Discussion: https://postgr.es/m/CAC+AXB0_fxYGbQoaYjCA8um7TTbOVP4L9aXnVmHwK8WzaT4gdA@mail.gmail.com  
  
Backpatch to all live branches.  

M src/tools/msvc/clean.bat

Remove 'datlastsysoid'.

commit   : ab4fd4f868edb4a59302db52857f4fe7c8d81f42    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 20 Jan 2022 08:56:54 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 20 Jan 2022 08:56:54 -0500    

Click here for diff

It hasn't been used for anything for a long time. Up until recently,  
we still queried it when dumping very old servers, but since  
commit 30e7c175b81d53c0f60f6ad12d1913a6d7d77008, there's no longer any  
code at all that cares about it.  
  
Discussion: http://postgr.es/m/CA+Tgmoa14=BRq0WEd0eevjEMn9EkghDB1FZEkBw7+UAb7tF49A@mail.gmail.com  

M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ecpg.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h

Try to stabilize reloptions test, again.

commit   : b700f96cffd91efbe93827d22c76b8f069809450    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 20 Jan 2022 22:11:48 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 20 Jan 2022 22:11:48 +1300    

Click here for diff

Since the test requires reproducible behavior from VACUUM, and since  
DISABLE_PAGE_SKIPPING doesn't actually disable all forms of page  
skipping, let's use a temporary table to avoid contention.  
  
Back-patch to 12, like commit 3414099c.  
  
Discussion: https://postgr.es/m/20220120052404.sonrhq3f3qgplpzj%40alap3.anarazel.de  

M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql

Call pg_newlocale_from_collation() also with default collation

commit   : b99ccd2cb2178b62b613edaf427fda8deace5bbf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jan 2022 09:38:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jan 2022 09:38:05 +0100    

Click here for diff

Previously, callers of pg_newlocale_from_collation() did not call it  
if the collation was DEFAULT_COLLATION_OID and instead proceeded with  
a pg_locale_t of 0.  Instead, now we call it anyway and have it return  
0 if the default collation was passed.  It already did this, so we  
just have to adjust the callers.  This simplifies all the call sites  
and also makes future enhancements easier.  
  
After discussion and testing, the previous comment in pg_locale.c  
about avoiding this for performance reasons may have been mistaken  
since it was testing a very different patch version way back when.  
  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/hash/hashfunc.c
M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c

doc: Mention the level of locks taken on objects in COMMENT

commit   : b2a76bb7d0550fbfdc028e5bda4853d05444398a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 20 Jan 2022 16:54:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 20 Jan 2022 16:54:47 +0900    

Click here for diff

This information was nowhere to be found.  This adds one note on the  
page of COMMENT, and one note in the section dedicated to explicit  
locking, both telling that a SHARE UPDATE EXCLUSIVE lock is taken on the  
object commented.  
  
Author: Nikolai Berkoff  
Reviewed-by: Laurenz Albe  
Discussion: https://postgr.es/m/_0HDHIGcCdCsUyXn22QwI2FEuNR6Fs71rtgGX6hfyBlUh5rrnE2qMmvIFu9EY4Pijr2gUmJEAXCjuNU2Oxku9TryLp9CdHllpsCfN3gD0-Y=@pm.me  
Backpatch-through: 10  

M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/comment.sgml

Make logical decoding a part of the rmgr.

commit   : 7a5f6b47488d824b1ea1326be4337e2c32325ff2    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 19 Jan 2022 14:58:04 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 19 Jan 2022 14:58:04 -0800    

Click here for diff

Add a new rmgr method, rm_decode, and use that rather than a switch  
statement.  
  
In preparation for rmgr extensibility.  
  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/ed1fb2e22d15d3563ae0eb610f7b61bb15999c0a.camel%40j-davis.com  
Discussion: https://postgr.es/m/20220118095332.6xtlcjoyxobv6cbk@jrouhaud  

M src/backend/access/transam/rmgr.c
M src/backend/replication/logical/decode.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/rmgrdesc.c
M src/include/access/rmgr.h
M src/include/access/rmgrlist.h
M src/include/access/xlog_internal.h
M src/include/replication/decode.h

interval_out() must be marked STABLE, not IMMUTABLE.

commit   : a3d6264bbce0ff7002be35a907b73b01e2e37f45    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 17:17:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 17:17:55 -0500    

Click here for diff

Its results vary depending on the IntervalStyle GUC, so it cannot  
be considered immutable.  
  
This is an extremely ancient bug.  AFAICT it was a sloppy mistake  
in 6f58115dd, which marked it "cacheable" alongside marking several  
other interval functions that way.  At the time, interval_out()  
depended on DateStyle not IntervalStyle, but it was still wrong.  
  
Back-patching this change doesn't look very practical, so I won't.  
Aside from the usual difficulties of getting catalog changes  
applied to existing databases, people might have indexes,  
generated columns, etc that depend on interval-to-text casts  
being considered immutable.  (This'd not really give them any  
problem as long as they never change IntervalStyle.)  They  
wouldn't appreciate us breaking such usage in minor releases.  
  
Per bug #17371 from Marcus Gartner.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

TAP tests: check for postmaster.pid anyway when "pg_ctl start" fails.

commit   : 6c4a8903b93fa5ee088a282b2e8b79ad6571a853    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 16:29:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 16:29:09 -0500    

Click here for diff

"pg_ctl start" might start a new postmaster and then return failure  
anyway, for example if PGCTLTIMEOUT is exceeded.  If there is a  
postmaster there, it's still incumbent on us to shut it down at  
script end, so check for the PID file even though we are about  
to fail.  
  
This has been broken all along, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Make configure prefer python3 to plain python.

commit   : f201da39edcd6ac1ab9a3edf3e20e2a73bbbe69e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 15:38:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 15:38:58 -0500    

Click here for diff

This avoids possibly selecting Python 2.x on systems that have  
both Python 2 and Python 3.  We used to feel that what "python"  
links to is a user choice that we should honor.  However, we're  
about to cease support for Python 2, so users will no longer have  
any choice of that sort.  This small change is being made ahead  
of the big Python-2-ectomy so that we can see how much of the  
buildfarm is not yet prepared for that.  Systems with only  
Python 2 will continue to build that way, for now.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Don't enable fsync in src/test/recovery/t/008_fsm_truncation.pl.

commit   : a7f4171071bbcdec79e8afa4cad1bc6951b098cc    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 12:36:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 12:36:49 -0500    

Click here for diff

In adverse circumstances, the fsync calls cause this test to run for  
quite a long time (multiple minutes) and even suffer timeout failures.  
This seems to date from before we made an effort to disable fsync in  
all our test cases; there's not a lot of point in using it if there's  
not a plan to force an O/S crash during the test.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/008_fsm_truncation.pl

Remove redundant memory context switches in BeginCopyFrom().

commit   : 89f059bdf52cc9a86b890d42ceed92237123479e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 12:31:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 19 Jan 2022 12:31:15 -0500    

Click here for diff

This is probably a leftover from code refactoring.  
  
Japin Li  
  
Discussion: https://postgr.es/m/MEYP282MB16693DDABDFEC7949AC31857B6599@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/commands/copyfrom.c

Dynamically find correct installation docs in Makefile.

commit   : c330b75d9ccecd7ae3cc9716629a48b22235c509    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 19 Jan 2022 14:48:25 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 19 Jan 2022 14:48:25 +0100    

Click here for diff

The base Makefile will output help to the user when invoking make in  
an unconfigured tree, the help was however always referring to a file  
which may not be present as it's only in tarballs.  Dynamically check  
for the presence of the INSTALL file and fall back on README.git when  
it's not available (which is the case of Git checkouts).  
  
Reported-by: Tim McNamara <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M Makefile

Fix alignment problem with bbsink_copystream buffer.

commit   : 0f47e833bf6d96c1a2c5173c8e0f6c6cc30f9592    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 19 Jan 2022 08:07:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 19 Jan 2022 08:07:16 -0500    

Click here for diff

bbsink_copystream wants to store a type byte just before the buffer,  
but basebackup.c wants the buffer to be aligned so that it can call  
PageIsNew() and PageGetLSN() on it. Therefore, instead of inserting  
1 extra byte before the buffer, insert MAXIMUM_ALIGNOF extra bytes  
and only use the last one.  
  
On most machines this doesn't cause any problem (except perhaps for  
performance) but some buildfarm machines with -fsanitize=alignment  
dump core.  
  
Discussion: http://postgr.es/m/CA+TgmoYx5=1A2K9JYV-9zdhyokU4KKTyNQ9q7CiXrX=YBBMWVw@mail.gmail.com  

M src/backend/replication/basebackup_copy.c

doc: Fix description of pg_replication_origin_oid() in error case

commit   : 44129c04323e7252f9a4064278ab049966dc4499    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 19 Jan 2022 10:37:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 19 Jan 2022 10:37:40 +0900    

Click here for diff

This function returns NULL if the replication origin given in input  
argument does not exist, contrary to what the docs described  
previously.  
  
Author: Ian Barwick  
Discussion: https://postgr.es/m/CAB8KJ=htJjBL=103URqjOxV2mqb4rjphDpMeKdyKq_QXt6h05w@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/func.sgml

Make PQcancel use the PGconn's tcp_user_timeout and keepalives settings.

commit   : 5987feb70b5bbb1fc4e64d433f490df08d91dd45    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 18 Jan 2022 14:02:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 18 Jan 2022 14:02:43 -0500    

Click here for diff

If connectivity to the server has been lost or become flaky, the  
user might well try to send a query cancel.  It's highly annoying  
if PQcancel hangs up in such a case, but that's exactly what's likely  
to happen.  To ameliorate this problem, apply the PGconn's  
tcp_user_timeout and keepalives settings to the TCP connection used  
to send the cancel.  This should be safe on Unix machines, since POSIX  
specifies that setsockopt() is async-signal-safe.  We are guessing  
that WSAIoctl(SIO_KEEPALIVE_VALS) is similarly safe on Windows.  
(Note that at least in psql and our other frontend programs, there's  
no safety issue involved anyway, since we run PQcancel in its own  
thread rather than in a signal handler.)  
  
Most of the value here comes from the expectation that tcp_user_timeout  
will be applied as a connection timeout.  That appears to happen on  
Linux, even though its tcp(7) man page claims differently.  The  
keepalive options probably won't help much, but as long as we can  
apply them for not much code, we might as well.  
  
Jelte Fennema, reviewed by Fujii Masao and myself  
  
Discussion: https://postgr.es/m/AM5PR83MB017870DE81FC84D5E21E9D1EF7AA9@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

Modify pg_basebackup to use a new COPY subprotocol for base backups.

commit   : cc333f32336f5146b75190f57ef587dff225f565    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 18 Jan 2022 13:47:26 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 18 Jan 2022 13:47:26 -0500    

Click here for diff

In the new approach, all files across all tablespaces are sent in a  
single COPY OUT operation. The CopyData messages are no longer raw  
archive content; rather, each message is prefixed with a type byte  
that describes its purpose, e.g. 'n' signifies the start of a new  
archive and 'd' signifies archive or manifest data. This protocol  
is significantly more extensible than the old approach, since we can  
later create more message types, though not without concern for  
backward compatibility.  
  
The new protocol sends a few things to the client that the old one  
did not. First, it sends the name of each archive explicitly, instead  
of letting the client compute it. This is intended to make it easier  
to write future patches that might send archives in a format other  
that tar (e.g. cpio, pax, tar.gz). Second, it sends explicit progress  
messages rather than allowing the client to assume that progress is  
defined by the number of bytes received. This will help with future  
features where the server compresses the data, or sends it someplace  
directly rather than transmitting it to the client.  
  
The old protocol is still supported for compatibility with previous  
releases. The new protocol is selected by means of a new  
TARGET option to the BASE_BACKUP command. Currently, the  
only supported target is 'client'. Support for additional  
targets will be added in a later commit.  
  
Patch by me. The patch set of which this is a part has had review  
and/or testing from Jeevan Ladhe, Tushar Ahuja, Suraj Kharage,  
Dipesh Pandit, and Mark Dilger.  
  
Discussion: http://postgr.es/m/CA+TgmoaYZbz0=Yk797aOJwkGJC-LK3iXn+wzzMx7KdwNpZhS5g@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_copy.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/include/replication/basebackup_sink.h

Try to stabilize the reloptions test.

commit   : 3414099c338bf619c00dd82d96f29a9668a3bf07    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 19 Jan 2022 07:03:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 19 Jan 2022 07:03:01 +1300    

Click here for diff

Where we test vacuum_truncate's effects, sometimes this is failing to  
truncate as expected on the build farm.  That could be explained by page  
skipping, so disable it explicitly, with the theory that commit fe246d1c  
didn't go far enough.  
  
Back-patch to 12, where the vacuum_truncate tests were added.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLT2UL5_JhmBzUgkdyKfc%3D5J-gJSQJLysMs4rqLUKLAzw%40mail.gmail.com  

M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql

Revert "Replace use of deprecated Python module distutils.sysconfig"

commit   : dda42ff8e60541e9eb5ac21b79af32d914f408a8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 17:42:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 17:42:29 +0100    

Click here for diff

This reverts commit e0e567a106726f6709601ee7cffe73eb6da8084e.  
  
On various platforms, the new approach using the sysconfig module  
reported incorrect values for the include directory, and so any  
Python-related compilations failed.  Revert for now and revisit later.  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Fix thinko in psql test

commit   : d14315084366584bffdca1e014cd44ee81408ceb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 16:53:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 16:53:41 +0100    

Click here for diff

The tests added by 14d755b00037ce04b9e24504f4b540d9e731c29e added a  
test case for psql's \set ECHO errors.  After the test, it then reset  
this to \set ECHO none, which is the default.  But the regression  
tests are actually run under \set ECHO all (psql -a), so that would  
have been the correct way to restore the previous state.  Otherwise,  
test cases added after that point would not have their input lines  
displayed.  This was never the intention, so fix this now.  

M src/test/regress/sql/psql.sql

Replace use of deprecated Python module distutils.sysconfig

commit   : e0e567a106726f6709601ee7cffe73eb6da8084e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 06:35:04 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jan 2022 06:35:04 +0100    

Click here for diff

With Python 3.10, configure spits out warnings about the module  
distutils.sysconfig being deprecated and scheduled for removal in  
Python 3.12.  Change the uses in configure to use the module sysconfig  
instead.  The logic stays the same.  
  
Note that sysconfig exists since Python 2.7, so this moves the minimum  
required version up from Python 2.6.  
  
Discussion: https://www.postgresql.org/message-id/flat/c74add3c-09c4-a9dd-1a03-a846e5b2fc52%40enterprisedb.com  

M config/python.m4
M configure
M doc/src/sgml/installation.sgml

Improve code clarity in epilogue of UTF-8 verification fast path

commit   : d3f45323bbe734bff1f778bb819ce95b718d73ed    
  
author   : John Naylor <[email protected]>    
date     : Mon, 17 Jan 2022 22:53:50 -0500    
  
committer: John Naylor <[email protected]>    
date     : Mon, 17 Jan 2022 22:53:50 -0500    

Click here for diff

The previous coding was correct, but the style and commentary were a bit  
vague about which operations had to happen, in what circumstances, and  
in what order. Rearrange so that the epilogue does nothing in the DFA END  
state. That allows turning some conditional statements in the backtracking  
logic into asserts. With that, we can be more explicit about needing  
to backtrack at least one byte in non-END states to ensure checking the  
current byte sequence in the slow path. No change to the regression tests,  
since they should be able catch deficiencies here already.  
  
In passing, improve the comments around DFA states where the first  
continuation byte has a restricted range.  

M src/common/wchar.c

Fix psql \d's query for identifying parent triggers.

commit   : 9007d4ea774edd815efeb0e0ef954127841beb2f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 21:18:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 21:18:49 -0500    

Click here for diff

The original coding (from c33869cc3) failed with "more than one row  
returned by a subquery used as an expression" if there were unrelated  
triggers of the same tgname on parent partitioned tables.  (That's  
possible because statement-level triggers don't get inherited.)  Fix  
by applying LIMIT 1 after sorting the candidates by inheritance level.  
  
Also, wrap the subquery in a CASE so that we don't have to execute it at  
all when the trigger is visibly non-inherited.  Aside from saving some  
cycles, this avoids the need for a confusing and undocumented NULLIF().  
  
While here, tweak the format of the emitted query to look a bit  
nicer for "psql -E", and add some explanation of this subquery,  
because it badly needs it.  
  
Report and patch by Justin Pryzby (with some editing by me).  
Back-patch to v13 where the faulty code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

tests: Consistently use pg_basebackup -cfast --no-sync to accelerate tests.

commit   : 839f9636b374d67952fdb2b048f055393bc5a8f4    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Jan 2022 15:40:00 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Jan 2022 15:40:00 -0800    

Click here for diff

Most tests invoking pg_basebackup themselves did not yet use -cfast, which  
makes pg_basebackup take considerably longer. The only reason this didn't  
cause the tests to take many minutes is that spread checkpoints only throttle  
when writing out a buffer and there aren't that many dirty buffers in the  
tests...  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl

heap pruning: Only call BufferGetBlockNumber() once.

commit   : c702d656a28386cf5f642206b495c66775afc4ea    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Jan 2022 15:31:28 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Jan 2022 15:31:28 -0800    

Click here for diff

BufferGetBlockNumber() is not that cheap and obviously cannot change during  
one heap_prune_page(), so only call it once. We might be able to do better and  
pass the block number from the caller, but that'd be a larger change...  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/pruneheap.c

Move 027_stream_regress.pl's output to tmp_check.

commit   : 35b2803cf29a39b1adaf55b8b376b965837e9c50    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 18 Jan 2022 07:17:37 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 18 Jan 2022 07:17:37 +1300    

Click here for diff

Cleanup for commit f47ed79c.  
  
Discussion: https://postgr.es/m/CA%2BhUKGKU%3DtiZoE7vp7qYFQNPdBd2pHoaOwkPMDg9YWk1h%3DFtmQ%40mail.gmail.com  

M src/test/recovery/Makefile
M src/tools/msvc/vcregress.pl

pg_upgrade: Preserve relfilenodes and tablespace OIDs.

commit   : 9a974cbcba005256a19991203583a94b4f9a21a9    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 17 Jan 2022 13:32:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 17 Jan 2022 13:32:44 -0500    

Click here for diff

Currently, database OIDs, relfilenodes, and tablespace OIDs can all  
change when a cluster is upgraded using pg_upgrade. It seems better  
to preserve them, because (1) it makes troubleshooting pg_upgrade  
easier, since you don't have to do a lot of work to match up files  
in the old and new clusters, (2) it allows 'rsync' to save bandwidth  
when used to re-sync a cluster after an upgrade, and (3) if we ever  
encrypt or sign blocks, we would likely want to use a nonce that  
depends on these values.  
  
This patch only arranges to preserve relfilenodes and tablespace  
OIDs. The task of preserving database OIDs is left for another patch,  
since it involves some complexities that don't exist in these cases.  
  
Database OIDs have a similar issue, but there are some tricky points  
in that case that do not apply to these cases, so that problem is left  
for another patch.  
  
Shruthi KC, based on an earlier patch from Antonin Houska, reviewed  
and with some adjustments by me.  
  
Discussion: http://postgr.es/m/CA+TgmoYgTwYcUmB=e8+hRHOFA0kkS6Kde85+UNdon6q7bt1niQ@mail.gmail.com  

M src/backend/bootstrap/bootparse.y
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/tablespace.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_proc.dat
M src/test/modules/spgist_name_ops/expected/spgist_name_ops.out

Avoid calling gettext() in signal handlers.

commit   : 2131c049d338fcc41612b24b91eabe27163c3c61    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 13:30:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 13:30:04 -0500    

Click here for diff

It seems highly unlikely that gettext() can be relied on to be  
async-signal-safe.  psql used to understand that, but someone got  
it wrong long ago in the src/bin/scripts/ version of handle_sigint,  
and then the bad idea was perpetuated when those two versions were  
unified into src/fe_utils/cancel.c.  
  
I'm unsure why there have not been field complaints about this  
... maybe gettext() is signal-safe once it's translated at least  
one message?  But we have no business assuming any such thing.  
  
In cancel.c (v13 and up), I preserved our ability to localize  
"Cancel request sent" messages by invoking gettext() before  
the signal handler is set up.  In earlier branches I just made  
src/bin/scripts/ not localize those messages, as psql did then.  
  
(Just for extra unsafety, the src/bin/scripts/ version was  
invoking fprintf() from a signal handler.  Sigh.)  
  
Noted while fixing signal-safety issues in PQcancel() itself.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/fe_utils/cancel.c

Avoid calling strerror[_r] in PQcancel().

commit   : f3f467b8f69b673fb73d15bf5ccd3a2027403d7b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 12:52:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jan 2022 12:52:44 -0500    

Click here for diff

PQcancel() is supposed to be safe to call from a signal handler,  
and indeed psql uses it that way.  All of the library functions  
it uses are specified to be async-signal-safe by POSIX ...  
except for strerror.  Neither plain strerror nor strerror_r  
are considered safe.  When this code was written, back in the  
dark ages, we probably figured "oh, strerror will just index  
into a constant array of strings" ... but in any locale except C,  
that's unlikely to be true.  Probably the reason we've not heard  
complaints is that (a) this error-handling code is unlikely to be  
reached in normal use, and (b) in many scenarios, localized error  
strings would already have been loaded, after which maybe it's  
safe to call strerror here.  Still, this is clearly unacceptable.  
  
The best we can do without relying on strerror is to print the  
decimal value of errno, so make it do that instead.  (This is  
probably not much loss of user-friendliness, given that it is  
hard to get a failure here.)  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c

Fix for new Boolean node

commit   : cf925936ecc031355cd56fbd392ec3180517a110    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jan 2022 13:59:46 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jan 2022 13:59:46 +0100    

Click here for diff

The token in nodeTokenType() is actually the whole rest of the string,  
so we need to take into account the length to do the correct  
comparison.  
  
Without this, postgres_fdw tests fail under  
-DWRITE_READ_PARSE_PLAN_TREES.  

M src/backend/nodes/read.c

Add Boolean node

commit   : 941460fcf731a32e6a90691508d5cfa3d1f8eeaf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    

Click here for diff

Before, SQL-level boolean constants were represented by a string with  
a cast, and internal Boolean values in DDL commands were usually  
represented by Integer nodes.  This takes the place of both of these  
uses, making the intent clearer and having some amount of type safety.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/define.c
M src/backend/commands/functioncmds.c
M src/backend/commands/sequence.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/user.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/value.c
M src/backend/parser/gram.y
M src/backend/parser/parse_node.c
M src/backend/replication/repl_gram.y
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/value.h
M src/test/isolation/expected/ri-trigger.out
M src/test/regress/expected/create_function_3.out

Fix typo in pg_dumpall.c

commit   : ca86a63d207aca1f52ff13a1ce13854681d1bbf9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 16:03:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 16:03:12 +0900    

Click here for diff

Oversight in 2158628.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dumpall.c

Add support for --no-table-access-method in pg_{dump,dumpall,restore}

commit   : 2158628864cfbc03c838834a46c193bde5807361    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 14:51:46 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 14:51:46 +0900    

Click here for diff

The logic is similar to default_tablespace in some ways, so as no SET  
queries on default_table_access_method are generated before dumping or  
restoring an object (table or materialized view support table AMs) when  
specifying this new option.  
  
This option is useful to enforce the use of a default access method even  
if some tables included in a dump use an AM different than the system's  
default.  
  
There are already two cases in the TAP tests of pg_dump with a table and  
a materialized view that use a non-default table AM, and these are  
extended that the new option does not generate SET clauses on  
default_table_access_method.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/002_pg_dump.pl

Test replay of regression tests, attempt II.

commit   : f47ed79cc8a0cfa154dc7f01faaf59822552363f    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 17 Jan 2022 16:34:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 17 Jan 2022 16:34:55 +1300    

Click here for diff

See commit message for 123828a7fa563025d0ceee10cf1b2a253cd05319.  The  
only change this time is the order of the arguments passed to  
pg_regress.  The previously version broke in the build farm environment  
due to the contents of EXTRA_REGRESS_OPTS (see also commit 8cade04c  
which had to do something similar).  
  
Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com  

M doc/src/sgml/regress.sgml
M src/test/recovery/Makefile
A src/test/recovery/t/027_stream_regress.pl
M src/tools/msvc/vcregress.pl

Consistently use the function name CreateCheckPoint in code and comments.

commit   : 4c004dd520fcf262ba7a3f2b1f80a8aa6b56c8d0    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 17 Jan 2022 07:50:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 17 Jan 2022 07:50:00 +0530    

Click here for diff

Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVZmKsvDjtd45+9oTcnjUJtC4LF2BYK8TpWT1f=NjJX3w@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c

Introduce log_destination=jsonlog

commit   : dc686681e0799b12c40f44f85fc5bfd7fed4e57f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 10:16:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jan 2022 10:16:53 +0900    

Click here for diff

"jsonlog" is a new value that can be added to log_destination to provide  
logs in the JSON format, with its output written to a file, making it  
the third type of destination of this kind, after "stderr" and  
"csvlog".  The format is convenient to feed logs to other applications.  
There is also a plugin external to core that provided this feature using  
the hook in elog.c, but this had to overwrite the output of "stderr" to  
work, so being able to do both at the same time was not possible.  The  
files generated by this log format are suffixed with ".json", and use  
the same rotation policies as the other two formats depending on the  
backend configuration.  
  
This takes advantage of the refactoring work done previously in ac7c807,  
bed6ed3, 8b76f89 and 2d77d83 for the backend parts, and 72b76f7 for the  
TAP tests, making the addition of any new file-based format rather  
straight-forward.  
  
The documentation is updated to list all the keys and the values that  
can exist in this new format.  pg_current_logfile() also required a  
refresh for the new option.  
  
Author: Sehrope Sarkuni, Michael Paquier  
Reviewed-by: Nathan Bossart, Justin Pryzby  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M src/backend/postmaster/syslogger.c
M src/backend/utils/adt/misc.c
M src/backend/utils/error/Makefile
M src/backend/utils/error/elog.c
A src/backend/utils/error/jsonlog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_ctl/t/004_logrotate.pl
M src/include/postmaster/syslogger.h
M src/include/utils/elog.h

Teach hash_ok_operator() that record_eq is only sometimes hashable.

commit   : 6478896675660402171c97d6307e6e1519250025    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 16:39:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 16:39:26 -0500    

Click here for diff

The need for this was foreseen long ago, but when record_eq  
actually became hashable (in commit 01e658fa7), we missed updating  
this spot.  
  
Per bug #17363 from Elvis Pranskevichus.  Back-patch to v14 where  
the faulty commit came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Fix psql's tab-completion of enum label values.

commit   : fe75517443b7c38f5251d007d06321655ce6c0b6    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 14:59:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 14:59:20 -0500    

Click here for diff

Since enum labels have to be single-quoted, this part of the  
tab completion machinery got side-swiped by commit cd69ec66c.  
A side-effect of that commit is that (at least with some versions  
of Readline) the text string passed for completion will omit the  
leading quote mark of the enum label literal.  Libedit still acts  
the same as before, though, so adapt COMPLETE_WITH_ENUM_VALUE so  
that it can cope with either convention.  
  
Also, when we fail to find any valid completion, set  
rl_completion_suppress_quote = 1.  Otherwise readline will  
go ahead and append a closing quote, which is unwanted.  
  
Per report from Peter Eisentraut.  Back-patch to v13 where  
cd69ec66c came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.c

Clean up TAP tests' usage of wait_for_catchup().

commit   : ed48e3582e8447cb9969c366e46c82a56b7608cd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 13:29:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 16 Jan 2022 13:29:02 -0500    

Click here for diff

By default, wait_for_catchup() waits for the replication connection  
to reach the primary's write LSN.  That's fine, but in an apparent  
attempt to save one query round-trip, it was coded so that we  
executed pg_current_wal_lsn() again during each probe query.  
Thus, we presented the standby with a moving target to be reached.  
(While the test script itself couldn't be causing the write LSN  
to advance while it's blocked in wait_for_catchup(), it's plenty  
plausible that background activity such as autovacuum is emitting  
more WAL.)  That could make the test take longer than necessary,  
and potentially it could mask bugs by allowing the standby to process  
more WAL than a strict interpretation of the test scenario allows.  
So, change wait_for_catchup() to do it "by the book", explicitly  
collecting the write LSN to wait for at the outset.  
  
Also, various call sites were instructing wait_for_catchup() to  
wait for the standby to reach the primary's insert LSN rather than  
its write LSN.  This also seems like a bad idea.  While in most  
test scenarios those are the same, if they are different then the  
inserted-but-not-yet-written WAL is not presently available to the  
standby.  The test isn't doing anything to make it become so, so  
again we have the potential for unwanted test delay, perhaps even  
a test timeout.  (Again, background activity would be needed to  
make this more than a hypothetical problem.)  Hence, change the  
callers where necessary so that the wait target is always the  
primary's write LSN.  
  
While at it, simplify callers by making use of wait_for_catchup's  
default arguments wherever possible (the preceding change makes  
this possible in more places than it was before).  And rewrite  
wait_for_catchup's documentation a bit.  
  
Patch by me; thanks to Julien Rouhaud for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl

Add stxdinherit flag to pg_statistic_ext_data

commit   : 269b532aef55a579ae02a3e8e8df14101570dfd9    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 16 Jan 2022 13:37:56 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 16 Jan 2022 13:37:56 +0100    

Click here for diff

Add pg_statistic_ext_data.stxdinherit flag, so that for each extended  
statistics definition we can store two versions of data - one for the  
relation alone, one for the whole inheritance tree. This is analogous to  
pg_statistic.stainherit, but we failed to include such flag in catalogs  
for extended statistics, and we had to work around it (see commits  
859b3003de, 36c4bc6e72 and 20b9fa308e).  
  
This changes the relationship between the two catalogs storing extended  
statistics objects (pg_statistic_ext and pg_statistic_ext_data). Until  
now, there was a simple 1:1 mapping - for each definition there was one  
pg_statistic_ext_data row, and this row was inserted while creating the  
statistics (and then updated during ANALYZE). With the stxdinherit flag,  
we don't know how many rows there will be (child relations may be added  
after the statistics object is defined), so there may be up to two rows.  
  
We could make CREATE STATISTICS to always create both rows, but that  
seems wasteful - without partitioning we only need stxdinherit=false  
rows, and declaratively partitioned tables need only stxdinherit=true.  
So we no longer initialize pg_statistic_ext_data in CREATE STATISTICS,  
and instead make that a responsibility of ANALYZE. Which is what we do  
for regular statistics too.  
  
Patch by me, with extensive improvements and fixes by Justin Pryzby.  
  
Author: Tomas Vondra, Justin Pryzby  
Reviewed-by: Tomas Vondra, Justin Pryzby  
Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/analyze.c
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/syscache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/commands/defrem.h
M src/include/nodes/pathnodes.h
M src/include/statistics/statistics.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

commit   : e701bdd2f042829402d96589cb16ae218967af73    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 16 Jan 2022 21:19:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 16 Jan 2022 21:19:30 +0900    

Click here for diff

Subscription test 027_nosuperuser.pl has been introduced in a2ab9c0,  
after the notices got refreshed to 2022 in 27b77ec.  

M src/test/subscription/t/027_nosuperuser.pl

Remove standby_schedule and associated test files.

commit   : 4483b2cf29bfe8091b721756928ccbe31c5c8e14    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Jan 2022 15:54:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Jan 2022 15:54:10 -0500    

Click here for diff

Since this test schedule is not run by default, it's next door to  
unused.  Moreover, its test coverage is very thin, and what there is  
is just about entirely superseded by the src/test/recovery tests.  
Let's drop it instead of carrying obsolete tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/regress.sgml
M src/test/regress/GNUmakefile
D src/test/regress/expected/hs_standby_allowed.out
D src/test/regress/expected/hs_standby_check.out
D src/test/regress/expected/hs_standby_disallowed.out
D src/test/regress/expected/hs_standby_functions.out
D src/test/regress/sql/hs_primary_extremes.sql
D src/test/regress/sql/hs_primary_setup.sql
D src/test/regress/sql/hs_standby_allowed.sql
D src/test/regress/sql/hs_standby_check.sql
D src/test/regress/sql/hs_standby_disallowed.sql
D src/test/regress/sql/hs_standby_functions.sql
D src/test/regress/standby_schedule

Add simple test for physical replication of sequences.

commit   : 46cf109089e8b0eeb3370c0f482b0aaf0becaae0    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 15 Jan 2022 15:47:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 15 Jan 2022 15:47:00 -0500    

Click here for diff

AFAICS we had no coverage of this point except in the seldom-used,  
slated-for-removal standby_schedule test suite.  Sequence updates  
are enough different from regular table updates that it seems worth  
covering them explicitly in src/test/recovery.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/001_stream_rep.pl

Build inherited extended stats on partitioned tables

commit   : 20b9fa308ebf7d4a26ac53804fce1c30f781d60c    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 15 Jan 2022 18:17:20 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 15 Jan 2022 18:17:20 +0100    

Click here for diff

Commit 859b3003de disabled building of extended stats for inheritance  
trees, to prevent updating the same catalog row twice. While that  
resolved the issue, it also means there are no extended stats for  
declaratively partitioned tables, because there are no data in the  
non-leaf relations.  
  
That also means declaratively partitioned tables were not affected by  
the issue 859b3003de addressed, which means this is a regression  
affecting queries that calculate estimates for the whole inheritance  
tree as a whole (which includes e.g. GROUP BY queries).  
  
But because partitioned tables are empty, we can invert the condition  
and build statistics only for the case with inheritance, without losing  
anything. And we can consider them when calculating estimates.  
  
It may be necessary to run ANALYZE on partitioned tables, to collect  
proper statistics. For declarative partitioning there should no prior  
statistics, and it might take time before autoanalyze is triggered. For  
tables partitioned by inheritance the statistics may include data from  
child relations (if built 859b3003de), contradicting the current code.  
  
Report and patch by Justin Pryzby, minor fixes and cleanup by me.  
Backpatch all the way back to PostgreSQL 10, where extended statistics  
were introduced (same as 859b3003de).  
  
Author: Justin Pryzby  
Reported-by: Justin Pryzby  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com  

M src/backend/commands/analyze.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Add tab-completion for CREATE FOREIGN TABLE.

commit   : 74527c3e022d3ace648340b79a6ddec3419f6732    
  
author   : Fujii Masao <[email protected]>    
date     : Sat, 15 Jan 2022 11:22:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Sat, 15 Jan 2022 11:22:24 +0900    

Click here for diff

Unlike CREATE TABLE, CREATE FOREIGN TABLE is not allowed inside  
CREATE SCHEMA, so Matches() is used instead of TailMatches() for  
the tab-completion.  
  
Author: Tang <[email protected]>  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/OS0PR01MB61137E96E0551278782D11CDFB519@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c

Ignore extended statistics for inheritance trees

commit   : 36c4bc6e725fe3e9b5a6cc7f1f83010534f18e4b    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 15 Jan 2022 02:15:23 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 15 Jan 2022 02:15:23 +0100    

Click here for diff

Since commit 859b3003de we only build extended statistics for individual  
relations, ignoring the child relations. This resolved the issue with  
updating catalog tuple twice, but we still tried to use the statistics  
when calculating estimates for the whole inheritance tree. When the  
relations contain very distinct data, it may produce bogus estimates.  
  
This is roughly the same issue 427c6b5b9 addressed ~15 years ago, and we  
fix it the same way - by ignoring extended statistics when calculating  
estimates for the inheritance tree as a whole. We still consider  
extended statistics when calculating estimates for individual child  
relations, of course.  
  
This may result in plan changes due to different estimates, but if the  
old statistics were not describing the inheritance tree particularly  
well it's quite likely the new plans is actually better.  
  
Report and patch by Justin Pryzby, minor fixes and cleanup by me.  
Backpatch all the way back to PostgreSQL 10, where extended statistics  
were introduced (same as 859b3003de).  
  
Author: Justin Pryzby  
Reported-by: Justin Pryzby  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20210923212624.GI831%40telsasoft.com  

M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Unify VACUUM VERBOSE and autovacuum logging.

commit   : 49c9d9fcfa9ae3403617b1a292f2425374219131    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 14 Jan 2022 16:50:34 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 14 Jan 2022 16:50:34 -0800    

Click here for diff

The log_autovacuum_min_duration instrumentation used its own dedicated  
code for logging, which was not reused by VACUUM VERBOSE.  This was  
highly duplicative, and sometimes led to each code path using slightly  
different accounting for essentially the same information.  
  
Clean things up by making VACUUM VERBOSE reuse the same instrumentation  
code.  This code restructuring changes the structure of the VACUUM  
VERBOSE output itself, but that seems like an overall improvement.  The  
most noticeable change in VACUUM VERBOSE output is that it no longer  
outputs a distinct message per index per round of index vacuuming.  Most  
of the same information (about each index) is now shown in its new  
per-operation summary message.  This is far more legible.  
  
A few details are no longer displayed by VACUUM VERBOSE, but that's no  
real loss in practice, especially in the common case where we don't need  
multiple index scans/rounds of vacuuming.  This super fine-grained  
information is still available via DEBUG2 messages, which might still be  
useful in debugging scenarios.  
  
VACUUM VERBOSE now shows new instrumentation, which is typically very  
useful: all of the log_autovacuum_min_duration instrumentation that it  
missed out on before now.  This includes information about WAL overhead,  
buffers hit/missed/dirtied information, and I/O timing information.  
  
VACUUM VERBOSE still retains a few INFO messages of its own.  This is  
limited to output concerning the progress of heap rel truncation, as  
well as some basic information about parallel workers.  These details  
are still potentially quite useful.  They aren't a good fit for the log  
output, which must summarize the whole operation.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Masahiko Sawada <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzmW4Me7_qR4X4ka7pxP-jGmn7=Npma_-Z-9Y1eD0MQRLw@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/include/commands/vacuum.h

Revert "Add new simple TAP test for tablespaces."

commit   : 0c53a6658e47217ad3dd416a5543fc87c3ecfd58    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 15 Jan 2022 02:16:07 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 15 Jan 2022 02:16:07 +1300    

Click here for diff

This reverts commit d1511fe1b040853f6e10d353e56b42bb96ae239d.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BGBC-6QhOKt6Y7ccrXSjbRHB7Di295%3D0rAGhE7a7hSrQ%40mail.gmail.com  

D src/test/modules/test_misc/t/002_tablespace.pl

Revert "Test replay of regression tests."

commit   : dccee0f2b72648b8b3c42883a7d99210eb813f30    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 15 Jan 2022 00:38:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 15 Jan 2022 00:38:44 +1300    

Click here for diff

This reverts commit 123828a7fa563025d0ceee10cf1b2a253cd05319.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BGBC-6QhOKt6Y7ccrXSjbRHB7Di295%3D0rAGhE7a7hSrQ%40mail.gmail.com  

M doc/src/sgml/regress.sgml
M src/test/recovery/Makefile
D src/test/recovery/t/027_stream_regress.pl
M src/tools/msvc/vcregress.pl

Test replay of regression tests.

commit   : 123828a7fa563025d0ceee10cf1b2a253cd05319    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:39:18 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:39:18 +1300    

Click here for diff

Add a new TAP test under src/test/recovery to run the standard  
regression tests while a streaming replica replays the WAL.  This  
provides a basic workout for WAL decoding and redo code, and compares  
the replicated result.  
  
Optionally, enable (expensive) wal_consistency_checking if listed in  
the env variable PG_TEST_EXTRA.  
  
Reviewed-by: 綱川 貴之 (Takayuki Tsunakawa) <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Anastasia Lubennikova <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com  

M doc/src/sgml/regress.sgml
M src/test/recovery/Makefile
A src/test/recovery/t/027_stream_regress.pl
M src/tools/msvc/vcregress.pl

Add new simple TAP test for tablespaces.

commit   : d1511fe1b040853f6e10d353e56b42bb96ae239d    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:29:59 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:29:59 +1300    

Click here for diff

The tablespace tests in the main regression tests have been changed to  
use "in-place" tablespaces, so that they work when streamed to a replica  
on the same host.  Add a new TAP test that exercises tablespaces with  
absolute paths, for coverage.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com  

A src/test/modules/test_misc/t/002_tablespace.pl

Use in-place tablespaces in regression test.

commit   : d6d317dbf6154b3d33fb53e1c3433f039b5d4d74    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:29:17 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:29:17 +1300    

Click here for diff

Remove the machinery from pg_regress that manages the testtablespace  
directory.  Instead, use "in-place" tablespaces, because they work  
correctly when there is a streaming replica running on the same host.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com  

M src/test/regress/GNUmakefile
M src/test/regress/expected/tablespace.out
M src/test/regress/pg_regress.c
M src/test/regress/sql/tablespace.sql
M src/tools/msvc/vcregress.pl

Allow "in place" tablespaces.

commit   : 7170f2159fb21b62c263acd458d781e2f3c3f8bb    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:27:44 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 14 Jan 2022 21:27:44 +1300    

Click here for diff

Provide a developer-only GUC allow_in_place_tablespaces, disabled by  
default.  When enabled, tablespaces can be created with an empty  
LOCATION string, meaning that they should be created as a directory  
directly beneath pg_tblspc.  This can be used for new testing scenarios,  
in a follow-up patch.  Not intended for end-user usage, since it might  
confuse backup tools that expect symlinks.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKpRWQ9SxdxxDmTBCJoR0YnFpMBe7kyzY8SUQk%2BHeskxg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/commands/tablespace.c
M src/backend/utils/misc/guc.c
M src/include/commands/tablespace.h

Rename value node fields

commit   : c4cc2850f4d16092c2b7b39964c097260935a72c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    

Click here for diff

For the formerly-Value node types, rename the "val" field to a name  
specific to the node type, namely "ival", "fval", "sval", and "bsval".  
This makes some code clearer and catches mixups better.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/define.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/value.c
M src/backend/parser/gram.y
M src/backend/parser/parse_node.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/oid.c
M src/backend/utils/misc/guc.c
M src/include/nodes/value.h

Refactor AlterRole()

commit   : 93415a3b5ac8d8a2951ca0db887d8a173b8630a0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 14 Jan 2022 10:46:49 +0100    

Click here for diff

Get rid of the three-valued logic for the Boolean variables to track  
whether the value was been specified and what the new value should be.  
Instead, we can use the "dfoo" variables to determine whether the  
value was specified and should be applied.  This was already done in  
some cases, so this makes this more uniform and removes one layer of  
indirection.  
  
Reviewed-by: Pavel Stehule <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/user.c

Assert redirect pointers are sensible after heap_page_prune().

commit   : bb42bfb5ccb5f138a8b7ad3549cfb05c0cc5187b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 22 Nov 2021 09:52:45 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 22 Nov 2021 09:52:45 -0800    

Click here for diff

Corruption of redirect item pointers often only becomes visible well after  
being corrupted, as e.g. bug #17255 shows: In the original reproducer,  
gigabyte of WAL were between the source of the corruption and the corruption  
becoming visible.  
  
To make it easier to find / prevent such bugs, verify whether redirect  
pointers are sensible at the end of heap_page_prune_execute(). 5cd7eb1f1c32  
introduced related assertions while modifying the page, but they can't easily  
detect marking the target of an existing redirect as unused. Sometimes the  
corruption will be detected later, but that's harder to diagnose.  
  
Author: Andres Freund <andres@[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/pruneheap.c

Fix possible HOT corruption when RECENTLY_DEAD changes to DEAD while pruning.

commit   : 18b87b201f73a1ffb1a2cf941789610e0da6e621    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 10 Dec 2021 20:12:26 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 10 Dec 2021 20:12:26 -0800    

Click here for diff

Since dc7420c2c92 the horizon used for pruning is determined "lazily". A more  
accurate horizon is built on-demand, rather than in GetSnapshotData(). If a  
horizon computation is triggered between two HeapTupleSatisfiesVacuum() calls  
for the same tuple, the result can change from RECENTLY_DEAD to DEAD.  
  
heap_page_prune() can process the same tid multiple times (once following an  
update chain, once "directly"). When the result of HeapTupleSatisfiesVacuum()  
of a tuple changes from RECENTLY_DEAD during the first access, to DEAD in the  
second, the "tuple is DEAD and doesn't chain to anything else" path in  
heap_prune_chain() can end up marking the target of a LP_REDIRECT ItemId  
unused.  
  
Initially not easily visible,  
Once the target of a LP_REDIRECT ItemId is marked unused, a new tuple version  
can reuse it. At that point the corruption may become visible, as index  
entries pointing to the "original" redirect item, now point to a unrelated  
tuple.  
  
To fix, compute HTSV for all tuples on a page only once. This fixes the entire  
class of problems of HTSV changing inside heap_page_prune(). However,  
visibility changes can obviously still occur between HTSV checks inside  
heap_page_prune() and outside (e.g. in lazy_scan_prune()).  
  
The computation of HTSV is now done in bulk, in heap_page_prune(), rather than  
on-demand in heap_prune_chain(). Besides being a bit simpler, it also is  
faster: Memory accesses can happen sequentially, rather than in the order of  
HOT chains.  
  
There are other causes of HeapTupleSatisfiesVacuum() results changing between  
two visibility checks for the same tuple, even before dc7420c2c92. E.g.  
HEAPTUPLE_INSERT_IN_PROGRESS can change to HEAPTUPLE_DEAD when a transaction  
aborts between the two checks. None of the these other visibility status  
changes are known to cause corruption, but heap_page_prune()'s approach makes  
it hard to be confident.  
  
A patch implementing a more fundamental redesign of heap_page_prune(), which  
fixes this bug and simplifies pruning substantially, has been proposed by  
Peter Geoghegan in  
https://postgr.es/m/CAH2-WzmNk6V6tqzuuabxoxM8HJRaWU6h12toaS-bqYcLiht16A@mail.gmail.com  
  
However, that redesign is larger change than desirable for backpatching. As  
the new design still benefits from the batched visibility determination  
introduced in this commit, it makes sense to commit this narrower fix to 14  
and master, and then commit Peter's improvement in master.  
  
The precise sequence required to trigger the bug is complicated and hard to do  
exercise in an isolation test (until we have wait points). Due to that the  
isolation test initially posted at  
https://postgr.es/m/20211119003623.d3jusiytzjqwb62p%40alap3.anarazel.de  
and updated in  
https://postgr.es/m/20211122175914.ayk6gg6nvdwuhrzb%40alap3.anarazel.de  
isn't committable.  
  
A followup commit will introduce additional assertions, to detect problems  
like this more easily.  
  
Bug: #17255  
Reported-By: Alexander Lakhin <[email protected]>  
Debugged-By: Andres Freund <[email protected]>  
Debugged-By: Peter Geoghegan <[email protected]>  
Author: Andres Freund <andres@[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, the oldest branch containing dc7420c2c92  

M src/backend/access/heap/pruneheap.c

Fix ruleutils.c's dumping of whole-row Vars in more contexts.

commit   : 43c2175121c829c8591fc5117b725f1f22bfb670    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jan 2022 17:49:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jan 2022 17:49:25 -0500    

Click here for diff

Commit 7745bc352 intended to ensure that whole-row Vars would be  
printed with "::type" decoration in all contexts where plain  
"var.*" notation would result in star-expansion, notably in  
ROW() and VALUES() constructs.  However, it missed the case of  
INSERT with a single-row VALUES, as reported by Timur Khanjanov.  
  
Nosing around ruleutils.c, I found a second oversight: the  
code for RowCompareExpr generates ROW() notation without benefit  
of an actual RowExpr, and naturally it wasn't in sync :-(.  
(The code for FieldStore also does this, but we don't expect that  
to generate strictly parsable SQL anyway, so I left it alone.)  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

ci: windows: run initdb with --no-sync.

commit   : dfc0cb3940cd4d1f19fcf6c7545dc6cc01c6c92c    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Jan 2022 10:56:41 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Jan 2022 10:56:41 -0800    

Click here for diff

Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

ci: windows: enable build summary to make it easier to spot warnings / errors.

commit   : 8a1ce5e54f6d144e4f8e19af7c767b026ee0c956    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 13 Jan 2022 10:26:22 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 13 Jan 2022 10:26:22 -0800    

Click here for diff

The build summary was disabled unintentionally by setting the build verbosity  
lower.  
  
While at it, also add ForceNoAlign to prevent msbuild from introducing  
linebreaks in the middle of filenames etc - they make it harder to copy  
output.  
  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.yml

Improve error handling of HMAC computations

commit   : 5513dc6a304d8bda114004a3b906cc6fde5d6274    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Jan 2022 16:17:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Jan 2022 16:17:21 +0900    

Click here for diff

This is similar to b69aba7, except that this completes the work for  
HMAC with a new routine called pg_hmac_error() that would provide more  
context about the type of error that happened during a HMAC computation:  
- The fallback HMAC implementation in hmac.c relies on cryptohashes, so  
in some code paths it is necessary to return back the error generated by  
cryptohashes.  
- For the OpenSSL implementation (hmac_openssl.c), the logic is very  
similar to cryptohash_openssl.c, where the error context comes from  
OpenSSL if one of its internal routines failed, with different error  
codes if something internal to hmac_openssl.c failed or was incorrect.  
  
Any in-core code paths that use the centralized HMAC interface are  
related to SCRAM, for errors that are unlikely going to happen, with  
only SHA-256.  It would be possible to see errors when computing some  
HMACs with MD5 for example and OpenSSL FIPS enabled, and this commit  
would help in reporting the correct errors but nothing in core uses  
that.  So, at the end, no backpatch to v14 is done, at least for now.  
  
Errors in SCRAM related to the computation of the server key, stored  
key, etc. need to pass down the potential error context string across  
more layers of their respective call stacks for the frontend and the  
backend, so each surrounding routine is adapted for this purpose.  
  
Reviewed-by: Sergey Shinderuk  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth-scram.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/scram-common.c
M src/include/common/hmac.h
M src/include/common/scram-common.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/tools/pgindent/typedefs.list

doc: Add "(process)" to the term "WAL receiver" in glossary.

commit   : 379a28b56a927f7608892138d08f4d24e6cf0620    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 13 Jan 2022 12:17:33 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 13 Jan 2022 12:17:33 +0900    

Click here for diff

This commit changes the term "WAL receiver" to "WAL receiver (process)"  
in the glossary, so that users can easily understand WAL receiver is  
obviously a process.  
  
Author: Fujii Masao  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

Fix incorrect comments in hmac.c and hmac_openssl.c

commit   : 87f29f4fcc4e53fe0331e338437edda1f1927530    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 13 Jan 2022 09:43:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 13 Jan 2022 09:43:36 +0900    

Click here for diff

Both files referred to pg_hmac_ctx->data, which, I guess, comes from the  
early versions of the patch that has resulted in commit e6bdfd9.  
  
Author: Sergey Shinderuk  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/common/hmac.c
M src/common/hmac_openssl.c

Fix memory leak in indexUnchanged hint mechanism.

commit   : db6736c93cb844d245b726e7a262f2cdcd34612e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jan 2022 15:41:04 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jan 2022 15:41:04 -0800    

Click here for diff

Commit 9dc718bd added a "logically unchanged by UPDATE" hinting  
mechanism, which is currently used within nbtree indexes only (see  
commit d168b666).  This mechanism determined whether or not the incoming  
item is a logically unchanged duplicate (a duplicate needed only for  
MVCC versioning purposes) once per row updated per non-HOT update.  This  
approach led to memory leaks which were noticeable with an UPDATE  
statement that updated sufficiently many rows, at least on tables that  
happen to have an expression index.  
  
On HEAD, fix the issue by adding a cache to the executor's per-index  
IndexInfo struct.  
  
Take a different approach on Postgres 14 to avoid an ABI break: simply  
pass down the hint to all indexes unconditionally with non-HOT UPDATEs.  
This is deemed acceptable because the hint is currently interpreted  
within btinsert() as "perform a bottom-up index deletion pass if and  
when the only alternative is splitting the leaf page -- prefer to delete  
any LP_DEAD-set items first".  nbtree must always treat the hint as a  
noisy signal about what might work, as a strategy of last resort, with  
costs imposed on non-HOT updaters.  (The same thing might not be true  
within another index AM that applies the hint, which is why the original  
behavior is preserved on HEAD.)  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Klaudie Willis <[email protected]>  
Diagnosed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where the hinting mechanism was added.  

M src/backend/catalog/toasting.c
M src/backend/executor/execIndexing.c
M src/backend/nodes/makefuncs.c
M src/include/nodes/execnodes.h

vacuumlazy.c: fix "garbage tuples" reference.

commit   : e9b873f667681232469007d755d0c163a63ea978    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jan 2022 14:13:35 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jan 2022 14:13:35 -0800    

Click here for diff

Another minor oversight in commit 4f8d9d12.  

M src/backend/access/heap/vacuumlazy.c

Consider fractional paths in generate_orderedappend_paths

commit   : 6b94e7a6da2f1c6df1a42efe64251f32a444d174    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 12 Jan 2022 19:59:30 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 12 Jan 2022 19:59:30 +0100    

Click here for diff

When building append paths, we've been looking only at startup and total  
costs for the paths. When building fractional paths that may eliminate  
the cheapest one, because it may be dominated by two separate paths (one  
for startup, one for total cost).  
  
This extends generate_orderedappend_paths() to also consider which paths  
have lowest fractional cost. Currently we only consider paths matching  
pathkeys - in the future this may be improved by also considering paths  
that are only partially sorted, with an incremental sort on top.  
  
Original report of an issue by Arne Roland, patch by me (based on a  
suggestion by Tom Lane).  
  
Reviewed-by: Arne Roland, Zhihong Yu  
Discussion: https://postgr.es/m/e8f9ec90-546d-e948-acce-0525f3e92773%40enterprisedb.com  
Discussion: https://postgr.es/m/1581042da8044e71ada2d6e3a51bf7bb%40index.de  

M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql

Add index on pg_publication_rel.prpubid

commit   : 025b920a3d45fed441a0a58fdcdf05b321b1eead    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jan 2022 16:23:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 12 Jan 2022 16:23:42 -0300    

Click here for diff

This should have been added for the benefit of GetPublicationRelations;  
let's add it now.  
  
I couldn't measure a performance difference in the TAP tests, but that  
may be because the tests use very few publications.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_publication.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_publication_rel.h

Include permissive/enforcing state in sepgsql log messages.

commit   : 134d9746364425e437a6d8eb1e2de0f3c59bfd2b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 12 Jan 2022 14:23:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 12 Jan 2022 14:23:13 -0500    

Click here for diff

SELinux itself does this (at least in modern releases), and it  
seems like a good idea to reduce confusion.  
  
Dave Page  
  
Discussion: https://postgr.es/m/CA+OCxowsQoLEYc=jN7OtNvOdX0Jg5L7nMYt++=k0X78HGq-sXg@mail.gmail.com  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/sepgsql/expected/label.out
M contrib/sepgsql/expected/misc.out
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c

ecpg: Catch zero-length Unicode identifiers correctly

commit   : a18b6d2dc288dfa6e7905ede1d4462edd6a8af47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jan 2022 10:39:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jan 2022 10:39:57 +0100    

Click here for diff

The previous code to detect a zero-length identifier when using  
Unicode identifiers such as  
  
exec sql select u&"";  
  
did not work.  This fixes that.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/82fafa79-331c-9d65-e51b-8b5d1b2383fc%40enterprisedb.com  

M src/interfaces/ecpg/preproc/pgc.l

Move any code specific to log_destination=csvlog to its own file

commit   : bed6ed3de9b3e62d8c6ee034513d04d769091927    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 15:03:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 15:03:48 +0900    

Click here for diff

The recent refactoring done in ac7c807 makes this move possible and  
simple, as this just moves some code around.  This reduces the size of  
elog.c by 7%.  
  
Author: Michael Paquier, Sehrope Sarkuni  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  
  
simply moves the routines related to csvlog into their own file  

M src/backend/utils/error/Makefile
A src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c

Refactor set of routines specific to elog.c

commit   : ac7c80758a7ad6369aefce7406f08c689144ec4b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 14:16:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 14:16:59 +0900    

Click here for diff

This refactors the following routines and facilities coming from  
elog.c, to ease their use across multiple log destinations:  
- Start timestamp, including its reset, to store when a process has been  
started.  
- The log timestamp, associated to an entry (the same timestamp is used  
when logging across multiple destinations).  
- Routine deciding if a query can be logged or not.  
- The backend type names, depending on the process that logs any  
information (postmaster, bgworker name or just GetBackendTypeDesc() with  
a regular backend).  
- Write of logs using the logging piped protocol, with the log collector  
enabled.  
- Error severity converted to a string.  
  
These refactored routines will be used for some follow-up changes  
to move all the csvlog logic into its own file and to potentially add  
JSON as log destination, reducing the overall size of elog.c as the end  
result.  
  
Author: Michael Paquier, Sehrope Sarkuni  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M src/backend/utils/error/elog.c
M src/include/utils/elog.h

commit   : 9a3d8e1886670ca3532687c5336d97965a79a084    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 12:39:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 12 Jan 2022 12:39:36 +0900    

Click here for diff

One of the comments introduced in b69aba7 was worded a bit weirdly, so  
improve it.  
  
Reported-by: Sergey Shinderuk  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/common/cryptohash.c
M src/common/cryptohash_openssl.c

Add missing include guard to win32ntdll.h.

commit   : af9e6331aeba149c93052c3549140082a85a3cf9    
  
author   : Thomas Munro <[email protected]>    
date     : Wed, 12 Jan 2022 10:11:50 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Wed, 12 Jan 2022 10:11:50 +1300    

Click here for diff

Oversight in commit e2f0f8ed.  Also add this file to the exclusion lists  
in headerscheck and cpluscpluscheck, because Unix systems don't have a  
header it includes.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/2760528.1641929756%40sss.pgh.pa.us  

M src/include/port/win32ntdll.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Improve error message for missing extension.

commit   : 6f6943fc94ada145c0af5f62f719abad73825e5b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 14:22:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 14:22:00 -0500    

Click here for diff

If we get ENOENT while trying to read an extension control file,  
report that as a missing extension (with a HINT to install it)  
rather than as a filesystem access problem.  The message wording  
was extensively bikeshedded in hopes of pointing people to the  
idea that they need to do a software installation before they  
can install the extension into the current database.  
  
Nathan Bossart, with review/wording suggestions from Daniel  
Gustafsson, Chapman Flack, and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c

Clean up messy API for src/port/thread.c.

commit   : 98e93a1fc93e9b54eb477d870ec744e9e1669f34    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 13:46:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 13:46:12 -0500    

Click here for diff

The point of this patch is to reduce inclusion spam by not needing  
to #include <netdb.h> or <pwd.h> in port.h (which is read by every  
compile in our tree).  To do that, we must remove port.h's  
declarations of pqGetpwuid and pqGethostbyname.  
  
pqGethostbyname is only used, and is only ever likely to be used,  
in src/port/getaddrinfo.c --- which isn't even built on most  
platforms, making pqGethostbyname dead code for most people.  
Hence, deal with that by just moving it into getaddrinfo.c.  
  
To clean up pqGetpwuid, invent a couple of simple wrapper  
functions with less-messy APIs.  This allows removing some  
duplicate error-handling code, too.  
  
In passing, remove thread.c from the MSVC build, since it  
contains nothing we use on Windows.  
  
Noted while working on 376ce3e40.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth.c
M src/bin/psql/common.c
M src/include/port.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/port/Makefile
M src/port/getaddrinfo.c
M src/port/path.c
M src/port/thread.c
M src/tools/msvc/Mkvcbuild.pm

Improve warning message in pg_signal_backend()

commit   : 7fa945b857cc1b2964799411f1633468826861ff    
  
author   : John Naylor <[email protected]>    
date     : Tue, 7 Dec 2021 22:31:47 +0000    
  
committer: John Naylor <[email protected]>    
date     : Tue, 7 Dec 2021 22:31:47 +0000    

Click here for diff

Previously, invoking pg_terminate_backend() or pg_cancel_backend()  
with the postmaster PID produced a "PID XXXX is not a PostgresSQL  
server process" warning, which does not make sense. Change to  
"backend process" to make the message more exact.  
  
Nathan Bossart, based on an idea from Bharath Rupireddy with  
input from Tom Lane and Euler Taveira  
  
Discussion: https://www.postgresql.org/message-id/flat/CALj2ACW7Rr-R7mBcBQiXWPp=JV5chajjTdudLiF5YcpW-BmHhg@mail.gmail.com  

M src/backend/storage/ipc/signalfuncs.c

Clean up error message reported after \password encryption failure.

commit   : 9cb5518b7ff69ab3bbc422313c69d54696fe8472    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 12:03:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jan 2022 12:03:06 -0500    

Click here for diff

Experimenting with FIPS mode enabled, I saw  
  
regression=# \password joe  
Enter new password for user "joe":  
Enter it again:  
could not encrypt password: disabled for FIPS  
out of memory  
  
because PQencryptPasswordConn was still of the opinion that "out of  
memory" is always appropriate to print.  
  
Minor oversight in b69aba745.  Like that one, back-patch to v14.  

M src/interfaces/libpq/fe-auth.c

Enhance pg_log_backend_memory_contexts() for auxiliary processes.

commit   : 790fbda902093c71ae47bff1414799cd716abb80    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 11 Jan 2022 23:19:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 11 Jan 2022 23:19:59 +0900    

Click here for diff

Previously pg_log_backend_memory_contexts() could request to  
log the memory contexts of backends, but not of auxiliary processes  
such as checkpointer. This commit enhances the function so that  
it can also send the request to auxiliary processes. It's useful to  
look at the memory contexts of those processes for debugging purpose  
and better understanding of the memory usage pattern of them.  
  
Note that pg_log_backend_memory_contexts() cannot send the request  
to logger or statistics collector. Because this logging request  
mechanism is based on shared memory but those processes aren't  
connected to that.  
  
Author: Bharath Rupireddy  
Reviewed-by: Vignesh C, Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/CALj2ACU1nBzpacOK2q=a65S_4+Oaz_rLTsU1Ri0gf7YUmnmhfQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/utils/adt/mcxtfuncs.c
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Update docs of logical replication for commit 8d74fc96db.

commit   : 85c61ba8920ba73500e1518c63795982ee455d14    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Jan 2022 12:01:48 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Jan 2022 12:01:48 +0530    

Click here for diff

After commit 8d74fc96db, the details of logical replication conflicts can  
be found in pg_stat_subscription_workers view.  
  
Author: Masahiko Sawada  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoC+zm5tGN8x88AJZYcX0g_eiEuu5XdrksNmSeR3Xzwjfg@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml

Fix typo in rewriteheap.c.

commit   : dbfa1022e4b63e71c4313f4d61a20ff97f2fb134    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Jan 2022 10:50:18 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Jan 2022 10:50:18 +0530    

Click here for diff

Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACW7SvfFW8r2uKH6oQm1kNpt8aQMG61kSBPK0S2PHhFbMw@mail.gmail.com  

M src/backend/access/heap/rewriteheap.c

Improve error handling of cryptohash computations

commit   : b69aba74578adf58f48de0f21dceddc2d9f1c4b1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 11 Jan 2022 09:55:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 11 Jan 2022 09:55:16 +0900    

Click here for diff

The existing cryptohash facility was causing problems in some code paths  
related to MD5 (frontend and backend) that relied on the fact that the  
only type of error that could happen would be an OOM, as the MD5  
implementation used in PostgreSQL ~13 (the in-core implementation is  
used when compiling with or without OpenSSL in those older versions),  
could fail only under this circumstance.  
  
The new cryptohash facilities can fail for reasons other than OOMs, like  
attempting MD5 when FIPS is enabled (upstream OpenSSL allows that up to  
1.0.2, Fedora and Photon patch OpenSSL 1.1.1 to allow that), so this  
would cause incorrect reports to show up.  
  
This commit extends the cryptohash APIs so as callers of those routines  
can fetch more context when an error happens, by using a new routine  
called pg_cryptohash_error().  The error states are stored within each  
implementation's internal context data, so as it is possible to extend  
the logic depending on what's suited for an implementation.  The default  
implementation requires few error states, but OpenSSL could report  
various issues depending on its internal state so more is needed in  
cryptohash_openssl.c, and the code is shaped so as we are always able to  
grab the necessary information.  
  
The core code is changed to adapt to the new error routine, painting  
more "const" across the call stack where the static errors are stored,  
particularly in authentication code paths on variables that provide  
log details.  This way, any future changes would warn if attempting to  
free these strings.  The MD5 authentication code was also a bit blurry  
about the handling of "logdetail" (LOG sent to the postmaster), so  
improve the comments related that, while on it.  
  
The origin of the problem is 87ae969, that introduced the centralized  
cryptohash facility.  Extra changes are done for pgcrypto in v14 for the  
non-OpenSSL code path to cope with the improvements done by this  
commit.  
  
Reported-by: Michael Mühlbeyer  
Author: Michael Paquier  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M contrib/passwordcheck/passwordcheck.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/commands/user.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/crypt.c
M src/backend/replication/backup_manifest.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/md5_common.c
M src/include/common/cryptohash.h
M src/include/common/md5.h
M src/include/libpq/crypt.h
M src/include/libpq/sasl.h
M src/interfaces/libpq/fe-auth.c
M src/tools/pgindent/typedefs.list

Doc: fix bogus example about ambiguous timestamps.

commit   : 9ef2c655558bb1ec20c4f87850d9322420e35acb    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 10 Jan 2022 11:46:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 10 Jan 2022 11:46:16 -0500    

Click here for diff

I had a brain fade in commit d32899157, and used 2:30AM as the  
example timestamp for both spring-forward and fall-back cases.  
But it's not actually ambiguous at all in the fall-back case,  
because that transition is from 2AM to 1AM under USA rules.  
Fix the example to use 1:30AM, which *is* ambiguous.  
  
Noted while answering a question from Aleksander Alekseev.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datetime.sgml

Avoid warning about uninitialized value in MSVC python3 tests

commit   : 90657b42bfd592d906989023886ff2875ff2ae95    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 10 Jan 2022 10:08:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 10 Jan 2022 10:08:44 -0500    

Click here for diff

Juan José Santamaría Flecha  
  
Backpatch to all live branches  

M src/tools/msvc/vcregress.pl

Make EXEC_BACKEND more convenient on Linux and FreeBSD.

commit   : f3e78069db7f7a753ebfe1010b810e47e0d2aa9a    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 10 Jan 2022 23:54:11 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 10 Jan 2022 23:54:11 +1300    

Click here for diff

Try to disable ASLR when building in EXEC_BACKEND mode, to avoid random  
memory mapping failures while testing.  For developer use only, no  
effect on regular builds.  
  
Suggested-by: Andres Freund <[email protected]>  
Tested-by: Bossart, Nathan <[email protected]>  
Discussion: https://postgr.es/m/20210806032944.m4tz7j2w47mant26%40alap3.anarazel.de  

M configure
M configure.ac
M src/bin/pg_ctl/pg_ctl.c
M src/common/exec.c
M src/include/pg_config.h.in
M src/include/port.h
M src/test/regress/pg_regress.c
M src/tools/msvc/Solution.pm

Rename functions to avoid future conflicts

commit   : ee419607381dd9a8031f2bc226c742a3289b7f33    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jan 2022 09:37:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 10 Jan 2022 09:37:43 +0100    

Click here for diff

Rename range_serialize/range_deserialize to  
brin_range_serialize/brin_range_deserialize, since there are already  
public range_serialize/range_deserialize in rangetypes.h.  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA+renyX0ipvY6A_jUOHeB1q9mL4bEYfAZ5FBB7G7jUo5bykjrA@mail.gmail.com  

M src/backend/access/brin/brin_minmax_multi.c

Prefer $HOME when looking up the current user's home directory.

commit   : 376ce3e404b75d267089c4bc6dc7c18d0b38728b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Jan 2022 19:19:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Jan 2022 19:19:02 -0500    

Click here for diff

When we need to identify the home directory on non-Windows, first  
consult getenv("HOME").  If that's empty or unset, fall back  
on our previous method of checking the <pwd.h> database.  
  
Preferring $HOME allows the user to intentionally point at some  
other directory, and it seems to be in line with the behavior of  
most other utilities.  However, we shouldn't rely on it completely,  
as $HOME is likely to be unset when running as a daemon.  
  
Anders Kaseorg  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c
M src/interfaces/libpq/fe-connect.c
M src/port/path.c

Make pg_get_expr() more bulletproof.

commit   : 6867f963e319934cbdafeb4bd5beaea5797c7be2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 9 Jan 2022 12:43:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 9 Jan 2022 12:43:09 -0500    

Click here for diff

Since this function is defined to accept pg_node_tree values, it could  
get applied to any nodetree that can appear in a cataloged pg_node_tree  
column.  Some such cases can't be supported --- for example, its API  
doesn't allow providing referents for more than one relation --- but  
we should try to throw a user-facing error rather than an internal  
error when encountering such a case.  
  
In support of this, extend expression_tree_walker/mutator to be sure  
they'll work on any such node tree (which basically means adding  
support for relpartbound node types).  That allows us to run pull_varnos  
and check for the case of multiple relations before we start processing  
the tree.  The alternative of changing the low-level error thrown for an  
out-of-range varno isn't appealing, because that could mask actual bugs  
in other usages of ruleutils.  
  
Per report from Justin Pryzby.  This is basically cosmetic, so no  
back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/util/var.c
M src/backend/utils/adt/ruleutils.c

More cleanup of a2ab9c06ea.

commit   : 96a6f11c06252b046ca9a6ee1f581a2f5d599301    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 8 Jan 2022 13:40:23 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 8 Jan 2022 13:40:23 -0800    

Click here for diff

Require SELECT privileges when performing UPDATE or DELETE, to be  
consistent with the way a normal UPDATE or DELETE command works.  
  
Simplify subscription test it so that it runs faster. Also, wait for  
initial table sync to complete to avoid intermittent failures.  
  
Minor doc fixup.  
  
Discussion: https://postgr.es/m/CAA4eK1L3-qAtLO4sNGaNhzcyRi_Ufmh2YPPnUjkROBK0tN%3Dx%3Dg%40mail.gmail.com  
Discussion: https://postgr.es/m/1514479.1641664638%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logical-replication.sgml
M src/backend/replication/logical/worker.c
M src/test/subscription/t/027_nosuperuser.pl

Fix results of index-only scans on btree_gist char(N) indexes.

commit   : 54b1cb7eb784a66680ee18f84e2c4e86fad59e82    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 8 Jan 2022 14:54:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 8 Jan 2022 14:54:39 -0500    

Click here for diff

If contrib/btree_gist is used to make a GIST index on a char(N)  
(bpchar) column, and that column is retrieved via an index-only  
scan, what came out had all trailing spaces removed.  Since  
that doesn't happen in any other kind of table scan, this is  
clearly a bug.  The cause is that gbt_bpchar_compress() strips  
trailing spaces (using rtrim1) before a new index entry is made.  
That was probably a good idea when this code was first written,  
but since we invented index-only scans, it's not so good.  
  
One answer could be to mark this opclass as incapable of index-only  
scans.  But to do so, we'd need an extension module version bump,  
followed by manual action by DBAs to install the updated version  
of btree_gist.  And it's not really a desirable place to end up,  
anyway.  
  
Instead, let's fix the code by removing the unwanted space-stripping  
action and adjusting the opclass's comparison logic to ignore  
trailing spaces as bpchar normally does.  This will not hinder  
cases that work today, since index searches with this logic will  
act the same whether trailing spaces are stored or not.  It will  
not by itself fix the problem of getting space-stripped results  
from index-only scans, of course.  Users who care about that can  
REINDEX affected indexes after installing this update, to immediately  
replace all improperly-truncated index entries.  Otherwise, it can  
be expected that the index's behavior will change incrementally as  
old entries are replaced by new ones.  
  
Per report from Alexander Lakhin.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/btree_text.c
M contrib/btree_gist/expected/char.out
M contrib/btree_gist/expected/char_1.out

Fix pgperlcritic complaint, per buildfarm.

commit   : f1e90859cef3f48f45578390acf63c6f7fd61697    
  
author   : Jeff Davis <[email protected]>    
date     : Sat, 8 Jan 2022 09:17:02 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Sat, 8 Jan 2022 09:17:02 -0800    

Click here for diff

Author: Michael Paquier  
Discussion: https://postgr.es/m/YdlYfS/l%2BPQA0ehs%40paquier.xyz  

M src/test/subscription/t/027_nosuperuser.pl

Fix issues with describe queries of extended statistics in psql

commit   : fe594abf7c22d721de322c7fd55b5b6a844bcda5    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 8 Jan 2022 16:44:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 8 Jan 2022 16:44:45 +0900    

Click here for diff

This addresses some problems in the describe queries used for extended  
statistics:  
- Two schema qualifications for the text type were missing for \dX.  
- The list of extended statistics listed for a table through \d was  
ordered based on the object OIDs, but it is more consistent with the  
other commands to order by namespace and then by object name.  
- A couple of aliases were not used in \d.  These are removed.  
  
This is similar to commits 1f092a3 and 07f8a9e.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/bin/psql/describe.c

Respect permissions within logical replication.

commit   : a2ab9c06ea15fbcb2bfde570986a06b37f52bcca    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 7 Jan 2022 17:38:20 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 7 Jan 2022 17:38:20 -0800    

Click here for diff

Prevent logical replication workers from performing insert, update,  
delete, truncate, or copy commands on tables unless the subscription  
owner has permission to do so.  
  
Prevent subscription owners from circumventing row-level security by  
forbidding replication into tables with row-level security policies  
which the subscription owner is subject to, without regard to whether  
the policy would ordinarily allow the INSERT, UPDATE, DELETE or  
TRUNCATE which is being replicated.  This seems sufficient for now, as  
superusers, roles with bypassrls, and target table owners should still  
be able to replicate despite RLS policies.  We can revisit the  
question of applying row-level security policies on a per-row basis if  
this restriction proves too severe in practice.  
  
Author: Mark Dilger  
Reviewed-by: Jeff Davis, Andrew Dunstan, Ronan Dunklau  
Discussion: https://postgr.es/m/9DFC88D3-1300-4DE8-ACBC-4CEF84399A53%40enterprisedb.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/test/perl/PostgreSQL/Test/Cluster.pm
A src/test/subscription/t/027_nosuperuser.pl

Fix thinko coming from 000f3adf

commit   : d0d62262d34154965511cfda6b98609d27752d5a    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 8 Jan 2022 09:12:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 8 Jan 2022 09:12:21 +0900    

Click here for diff

pg_basebackup.c relies on the compression level to not be 0 to decide if  
compression should be used, but 000f3adf missed the fact that the  
default compression (Z_DEFAULT_COMPRESSION) is -1, which would be used  
if specifying --gzip without --compress.  
  
While on it, add some coverage for --gzip, as this is rather easy to  
miss.  
  
Reported-by: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl

commit   : 27b77ecf9f4d5be211900eda54d8155ada50d696    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 7 Jan 2022 19:04:57 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 7 Jan 2022 19:04:57 -0500    

Click here for diff

Backpatch-through: 10  

M COPYRIGHT
M configure
M configure.ac
M contrib/adminpack/adminpack.c
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/bloom/t/001_wal.pl
M contrib/dblink/dblink.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/hstore/hstore_subs.c
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/oid2name/t/001_basic.pl
M contrib/old_snapshot/time_mapping.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/uavc.c
M contrib/tablefunc/tablefunc.c
M contrib/tablefunc/tablefunc.h
M contrib/tcn/tcn.c
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/syncscan.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogutils.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/lib/binaryheap.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/nodes.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/port/atomics.c
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/tas/sunstudio_sparc.s
M src/backend/port/tas/sunstudio_x86.s
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/basebackup_progress.c
M src/backend/replication/basebackup_sink.c
M src/backend/replication/basebackup_throttle.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmqueue.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/lmgr/spin.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_dummy_probes.pl.prolog
M src/backend/utils/Gen_dummy_probes.sed
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenodemap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/probes.d
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/Makefile
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_config/Makefile
M src/bin/pg_config/pg_config.c
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/rewind_source.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pg_verifybackup/parse_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/pgevent/Makefile
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/tab-complete.c
M src/bin/psql/tab-complete.h
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/common/archive.c
M src/common/base64.c
M src/common/checksum_helper.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/encnames.c
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/hashfn.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/ip.c
M src/common/jsonapi.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/md5_common.c
M src/common/md5_int.h
M src/common/pg_get_line.c
M src/common/pg_lzcompress.c
M src/common/pg_prng.c
M src/common/pgfnames.c
M src/common/protocol_openssl.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha1.c
M src/common/sha1_int.h
M src/common/sha2.c
M src/common/sha2_int.h
M src/common/sprompt.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_combining_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/common/wchar.c
M src/fe_utils/Makefile
M src/fe_utils/archive.c
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/connect_utils.c
M src/fe_utils/mbprint.c
M src/fe_utils/option_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/syncscan.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/timeline.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogarchive.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/proclang.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/variable.h
M src/include/commands/view.h
M src/include/common/archive.h
M src/include/common/base64.h
M src/include/common/checksum_helper.h
M src/include/common/config_info.h
M src/include/common/connect.h
M src/include/common/controldata_utils.h
M src/include/common/cryptohash.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/hashfn.h
M src/include/common/hmac.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/jsonapi.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/openssl.h
M src/include/common/pg_prng.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha1.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execAsync.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMemoize.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidrangescan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/archive.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect_utils.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/option_utils.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/query_utils.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getaddrinfo.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/sort_template.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/sasl.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/gramparse.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/arch-ia64.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-acc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic-sunpro.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/pg_iovec.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/backup_manifest.h
M src/include/replication/basebackup.h
M src/include/replication/basebackup_sink.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSearchCycle.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/rusagestub.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/storage/backendid.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/fileset.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/ipc.h
M src/include/storage/item.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/md.h
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procsignal.h
M src/include/storage/reinit.h
M src/include/storage/relfilenode.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/tcop/cmdtag.h
M src/include/tcop/cmdtaglist.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/dynahash.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/int8.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/old_snapshot.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/queryjumble.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenodemap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/resowner_private.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/wait_event.h
M src/include/utils/xid8.h
M src/include/utils/xml.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/fe-trace.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/test/regress.pl
M src/interfaces/libpq/test/uri-regress.c
M src/interfaces/libpq/win32.c
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/plpython.h
M src/pl/tcl/generate-pltclerrcodes.pl
M src/port/bsearch_arg.c
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/dlopen.c
M src/port/explicit_bzero.c
M src/port/fls.c
M src/port/getaddrinfo.c
M src/port/getpeereid.c
M src/port/getrusage.c
M src/port/kill.c
M src/port/link.c
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pread.c
M src/port/preadv.c
M src/port/pthread_barrier_wait.c
M src/port/pwrite.c
M src/port/pwritev.c
M src/port/quotes.c
M src/port/setenv.c
M src/port/snprintf.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/thread.c
M src/port/unsetenv.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32ntdll.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32stat.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/Makefile
M src/test/ldap/t/001_auth.pl
M src/test/locale/sort-test.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/plsample/plsample.c
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/perl/Makefile
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/recovery/Makefile
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/regress/GNUmakefile
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSLServer.pm
M src/test/subscription/Makefile
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_worker_stats.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/fix-old-flex-code.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/ifaddrs/Makefile
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/build.pl
M src/tools/msvc/config_default.pl
M src/tools/msvc/dummylib/Win32.pm
M src/tools/msvc/dummylib/Win32/Registry.pm
M src/tools/msvc/dummylib/Win32API/File.pm
M src/tools/msvc/gendef.pl
M src/tools/msvc/install.pl
M src/tools/msvc/mkvcbuild.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/pgflex.pl
M src/tools/msvc/vcregress.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/testint128.c
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Allow MSVC .bat wrappers to be called from anywhere

commit   : c3879a7b4c87344d804483234a7278a68e8248d9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 7 Jan 2022 16:07:45 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 7 Jan 2022 16:07:45 -0500    

Click here for diff

Instead of using a hardcoded or default path to the perl file the .bat  
file is a wrapper for, we use a path that means the file is found in  
the same directory as the .bat file.  
  
Patch by Anton Voloshin, slightly tweaked by me.  
  
Backpatch to all live branches  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/build.bat
M src/tools/msvc/install.bat
M src/tools/msvc/pgbison.bat
M src/tools/msvc/pgflex.bat
M src/tools/msvc/vcregress.bat

Skip install/test of pgcrypto on MSVC when not built with openssl

commit   : 825d95e8a8b266110d3d7eaa38a8f4abcf146a1a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 7 Jan 2022 15:48:53 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 7 Jan 2022 15:48:53 -0500    

Click here for diff

Commit db7d1a7b05 missed a couple of places that needed adjustment now  
we are not building pgcrypto when openssl is not configured, causing  
contrib installcheck to fail in such a case.  

M src/tools/msvc/Install.pm
M src/tools/msvc/vcregress.pl

Fix comment in fe-connect.c about PQping and pg_ctl

commit   : fb0745fa0d706d1519d6e55e93d1dcae27e12e4d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 16:05:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 16:05:31 +0900    

Click here for diff

Since f13ea95f, pg_ctl does not use PQping(), but one comment did not  
get the call.  
  
Author: Euler Taveira  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c

postgres_fdw: Add regression test for postgres_fdw.application_name GUC.

commit   : 353aa01687b5dd582debdfe63871498cd522cbbd    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 7 Jan 2022 15:31:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 7 Jan 2022 15:31:56 +0900    

Click here for diff

Commit 449ab63505 added postgres_fdw.application_name GUC that specifies  
a value for application_name configuration parameter used when postgres_fdw  
establishes a connection to a foreign server. Also commit 6e0cb3dec1  
allowed it to include escape sequences. Both commits added the regression  
tests for the GUC, but those tests were reverted by commits 98dbef90eb and  
5e64ad3697 because they were unstable and caused some buildfarm members  
to report the failure.  
  
This is the third try to add the regression test for  
postgres_fdw.application_name GUC.  
  
One of issues to make the test unstable was to have used  
postgres_fdw_disconnect_all() to close the existing remote connections.  
The test expected that the remote connection and its corresponding backend  
at the remote server disappeared just after postgres_fdw_disconnect_all()  
was executed, but it could take a bit time for them to disappear.  
To make sure that they exit, this commit makes the test use  
pg_terminate_backend() with the timeout at the remote server, instead.  
If the timeout is set to greater than zero, this function waits until  
they are actually terminated (or until the given time has passed).  
  
Another issue was that the test didn't take into consideration the case  
where postgres_fdw.application_name containing some escape sequences was  
converted to the string larger than NAMEDATALEN. In this case it was  
truncated to less than NAMEDATALEN when it's passed to the remote server,  
but the test expected wrongly that full string of application_name was  
always viewable. This commit changes the test so that it can handle that case.  
  
Author: Fujii Masao  
Reviewed-by: Masahiko Sawada, Hayato Kuroda, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Add TAP tests for pg_basebackup with compression

commit   : 50e144193c779f3da3b4836fa00cf1ce64953543    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 14:13:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 14:13:35 +0900    

Click here for diff

pg_basebackup is able to use gzip to compress the contents of backups  
with the tar format, but there were no tests for that.  This adds a  
minimalistic set of tests to check the contents of such base backups,  
including sanity checks on the contents generated with gzip commands.  
The tests are skipped if Postgres is compiled --without-zlib, and the  
checks based on the gzip command are skipped if nothing can be found,  
following the same model as the existing tests for pg_receivewal.  
  
Reviewed-by: Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Refactor tar method of walmethods.c to rely on the compression method

commit   : 000f3adfdc4336df83777eba86ce48f36cb6c6e9    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 13:48:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jan 2022 13:48:59 +0900    

Click here for diff

Since d62bcc8, the directory method of walmethods.c uses the compression  
method to determine which code path to take.  The tar method, used by  
pg_basebackup --format=t, was inconsistent regarding that, as it relied  
on the compression level to check if no compression or gzip should be  
used.  This commit makes the code more consistent as a whole in this  
file, making the tar logic use a compression method rather than  
assigning COMPRESSION_NONE that would be ignored.  
  
The options of pg_basebackup are planned to be reworked but we are not  
sure yet of the shape they should have as this has some dependency with  
the integration of the server-side compression for base backups, so this  
is left out for the moment.  This change has as benefit to make easier  
the future integration of new compression methods for the tar method of  
walmethods.c, for the client-side compression.  
  
Reviewed-by: Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/walmethods.c

Prevent altering partitioned table's rowtype, if it's used elsewhere.

commit   : 7ead9925ff94cfc9c3237672b7d19d5cc1b27ef5    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Jan 2022 16:46:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Jan 2022 16:46:46 -0500    

Click here for diff

We disallow altering a column datatype within a regular table,  
if the table's rowtype is used as a column type elsewhere,  
because we lack code to go around and rewrite the other tables.  
This restriction should apply to partitioned tables as well, but it  
was not checked because ATRewriteTables and ATPrepAlterColumnType  
were not on the same page about who should do it for which relkinds.  
  
Per bug #17351 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Extend psql's \lo_list/\dl to be able to print large objects' ACLs.

commit   : 328dfbdabd22e321bfe1f0547be71faca99a11e9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Jan 2022 13:09:05 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Jan 2022 13:09:05 -0500    

Click here for diff

The ACL is printed when you add + to the command, similarly to  
various other psql backslash commands.  
  
Along the way, move the code for this into describe.c,  
where it is a better fit (and can share some code).  
  
Pavel Luzanov, reviewed by Georgios Kokolatos  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/test/regress/expected/largeobject.out
M src/test/regress/expected/largeobject_1.out
M src/test/regress/sql/largeobject.sql

commit   : ee5822361dabf03300a24f60d57a968a654e1d46    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jan 2022 11:41:09 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jan 2022 11:41:09 +0900    

Click here for diff

The link used in the documentation is dead, and the only options to have  
an access to this part of the SQL specification are not free.  Like any  
other books referred, just remove the link to keep some neutrality but  
keep its reference.  
  
Reported-by: Erik Rijkers  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/biblio.sgml

On second thought, remove regex.linux.utf8 regression test altogether.

commit   : 987db509ed35ad287c50a7eac381535830f03a29    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 18:18:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 18:18:44 -0500    

Click here for diff

The code-coverage report says that this test doesn't increase  
coverage by one single line, which I now realize is because  
I made src/test/modules/test_regex/sql/test_regex_utf8.sql  
to cover all the code that this would.  So really it's pointless  
and we should just drop it.  

D src/test/regress/expected/regex.linux.utf8.out
D src/test/regress/expected/regex.linux.utf8_1.out
M src/test/regress/parallel_schedule
D src/test/regress/sql/regex.linux.utf8.sql

Enable routine running of regex.linux.utf8 regression test.

commit   : 72a3ebf235b52fdb715214027026f66a0ad7da4d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 17:31:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 17:31:54 -0500    

Click here for diff

Up to now this has just sat there as a test you could invoke via  
EXTRA_TESTS, which of course nobody does.  I'm feeling encouraged  
because c2e8bd275 hasn't yet broke anything, so let's try making this  
run with a suitable guard condition (similar to collate.linux.utf8).  

M src/test/regress/expected/regex.linux.utf8.out
A src/test/regress/expected/regex.linux.utf8_1.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/regex.linux.utf8.sql

Create foreign key triggers in partitioned tables too

commit   : f4566345cf40b068368cb5617e61318da60676ec    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 5 Jan 2022 19:00:13 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 5 Jan 2022 19:00:13 -0300    

Click here for diff

While user-defined triggers defined on a partitioned table have  
a catalog definition for both it and its partitions, internal  
triggers used by foreign keys defined on partitioned tables only  
have a catalog definition for its partitions.  This commit fixes  
that so that partitioned tables get the foreign key triggers too,  
just like user-defined triggers.  Moreover, like user-defined  
triggers, partitions' internal triggers will now also have their  
tgparentid set appropriately.  This is to allow subsequent commit(s)  
to make the foreign key related events to be fired in some cases  
using the parent table triggers instead of those of partitions'.  
  
This also changes what tgisinternal means in some cases.  Currently,  
it means either that the trigger is an internal implementation object  
of a foreign key constraint, or a "child" trigger on a partition  
cloned from the trigger on the parent.  This commit changes it to  
only mean the former to avoid confusion.  As for the latter, it can  
be told by tgparentid being nonzero, which is now true both for user-  
defined and foreign key's internal triggers.  
  
Author: Amit Langote <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Reviewed-by: Arne Roland <[email protected]>  
Discussion: https://postgr.es/m/CA+HiwqG7LQSK+n8Bki8tWv7piHD=PnZro2y6ysU2-28JS6cfgQ@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/commands/trigger.h
M src/test/regress/expected/triggers.out

Enable routine running of citext's UTF8-specific test cases.

commit   : c2e8bd27519f47ff56987b30eb34a01969b9a9e8    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 13:30:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 5 Jan 2022 13:30:07 -0500    

Click here for diff

These test cases have been commented out since citext was invented,  
because at the time we had no nice way to deal with tests that  
have restrictions such as requiring UTF8 encoding.  But now we do  
have a convention for that, ie put them into a separate test file  
with an early-exit path.  So let's enable these tests to run when  
their prerequisites are satisfied.  
  
(We may have to tighten the prerequisites beyond the "encoding = UTF8  
and locale != C" checks made here.  But let's put it on the buildfarm  
and see what blows up.)  
  
Dag Lem  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/Makefile
M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
A contrib/citext/expected/citext_utf8.out
A contrib/citext/expected/citext_utf8_1.out
M contrib/citext/sql/citext.sql
A contrib/citext/sql/citext_utf8.sql

Reduce relcache access in WAL sender streaming logical changes

commit   : 6ce16088bfed97f982f66a9dc17b8364df289e4d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Jan 2022 10:27:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Jan 2022 10:27:07 +0900    

Click here for diff

get_rel_sync_entry(), which is called each time a change needs to be  
logically replicated, is a rather hot code path in the WAL sender  
sending logical changes.  This code path was doing a relcache access on  
relkind and relpartition for each logical change, but we only need to  
know this information when building or re-building the cached  
information for a relation.  
  
Some measurements prove that this is noticeable in perf profiles,  
particularly when attempting to replicate changes from relations that  
are not published as these cause less overhead in the WAL sender,  
delaying further the replication of changes for relations that are  
published.  
  
Issue introduced in 83fd453.  
  
Author: Hou Zhijie  
Reviewed-by: Kyotaro Horiguchi, Euler Taveira  
Discussion: https://postgr.es/m/OS0PR01MB5716E863AA9E591C1F010F7A947D9@OS0PR01MB5716.jpnprd01.prod.outlook.com  
Backpatch-through: 13  

M src/backend/replication/pgoutput/pgoutput.c

Remove redundant initialization of BrinMemTuple.

commit   : 913a03ec29abcb6c20e5941e5f3ac0578619cd3e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Jan 2022 16:52:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Jan 2022 16:52:51 -0500    

Click here for diff

brin_new_memtuple already did this, so there's no need  
for initialize_brin_buildstate to do it again.  
  
Richard Guo, reviewed by Bharath Rupireddy  
  
Discussion: https://postgr.es/m/CAMbWs4-kYYpKNOdiWtsCZ3jbkFFj4nhOVH22JH7dsrMYX=aGjg@mail.gmail.com  

M src/backend/access/brin/brin.c

Fix silly mistake in Assert

commit   : 67a8cb5cbfffa9f104a5965a2152e5256dd2be2c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jan 2022 13:21:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jan 2022 13:21:23 -0300    

Click here for diff

M src/backend/access/heap/heapam.c

Allow special SKIP LOCKED condition in Assert()

commit   : f66885bec0df509ee9b604a83c17dbd7eb9959b1    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jan 2022 13:01:05 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 4 Jan 2022 13:01:05 -0300    

Click here for diff

Under concurrency, it is possible for two sessions to be merrily locking  
and releasing a tuple and marking it again as HEAP_XMAX_INVALID all the  
while a third session attempts to lock it, miserably fails at it, and  
then contemplates life, the universe and everything only to eventually  
fail an assertion that said bit is not set.  Before SKIP LOCKED that was  
indeed a reasonable expectation, but alas! commit df630b0dd5ea falsified  
it.  
  
This bug is as old as time itself, and even older, if you think time  
begins with the oldest supported branch.  Therefore, backpatch to all  
supported branches.  
  
Author: Simon Riggs <[email protected]>  
Discussion: https://postgr.es/m/CANbhV-FeEwMnN8yuMyss7if1ZKjOKfjcgqB26n8pqu1e=q0ebg@mail.gmail.com  

M src/backend/access/heap/heapam.c

pg_dump: Refactor dumpDatabase()

commit   : 56a3e848c74730cde15278266b757f4262948763    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jan 2022 16:19:48 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 4 Jan 2022 16:19:48 +0100    

Click here for diff

Rearrange the version-dependent pieces in the new more modular style.  

M src/bin/pg_dump/pg_dump.c

Tab completion: don't offer valid constraints in VALIDATE CONSTRAINT.

commit   : dfe67c0e85a5a613f802f78641ccc1c48845076e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 18:14:01 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 18:14:01 -0500    

Click here for diff

Improve psql so that "ALTER TABLE foo VALIDATE CONSTRAINT <TAB>"  
only offers not-convalidated entries.  While it's not formally  
wrong to offer validated ones, there's not much point either,  
and it can save some typing if we incorporate this knowledge.  
  
David Fetter, reviewed by Aleksander Alekseev  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Handle mixed returnable and non-returnable columns better in IOS.

commit   : 8a2e323f208557acbfdc911516e84ec017f5a6ca    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 16:12:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 16:12:11 -0500    

Click here for diff

We can revert the code changes of commit b5febc1d1 now, because  
commit 9a3ddeb51 installed a real solution for the difficulty  
that b5febc1d1 just dodged, namely that the planner might pick  
the wrong one of several index columns nominally containing the  
same value.  It only matters which one we pick if we pick one  
that's not returnable, and that mistake is now foreclosed.  
  
Although both of the aforementioned commits were back-patched,  
I don't feel a need to take any risk by back-patching this one.  
The cases that it improves are very corner-ish.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gist/expected/inet.out
M contrib/btree_gist/sql/inet.sql
M src/backend/optimizer/path/indxpath.c

Fix index-only scan plans, take 2.

commit   : 9a3ddeb519e8d91b670fa923619b212a9670389c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 15:42:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 15:42:27 -0500    

Click here for diff

Commit 4ace45677 failed to fix the problem fully, because the  
same issue of attempting to fetch a non-returnable index column  
can occur when rechecking the indexqual after using a lossy index  
operator.  Moreover, it broke EXPLAIN for such indexquals (which  
indicates a gap in our test cases :-().  
  
Revert the code changes of 4ace45677 in favor of adding a new field  
to struct IndexOnlyScan, containing a version of the indexqual that  
can be executed against the index-returned tuple without using any  
non-returnable columns.  (The restrictions imposed by check_index_only  
guarantee this is possible, although we may have to recompute indexed  
expressions.)  Support construction of that during setrefs.c  
processing by marking IndexOnlyScan.indextlist entries as resjunk  
if they can't be returned, rather than removing them entirely.  
(We could alternatively require setrefs.c to look up the IndexOptInfo  
again, but abusing resjunk this way seems like a reasonably safe way  
to avoid needing to do that.)  
  
This solution isn't great from an API-stability standpoint: if there  
are any extensions out there that build IndexOnlyScan structs directly,  
they'll be broken in the next minor releases.  However, only a very  
invasive extension would be likely to do such a thing.  There's no  
change in the Path representation, so typical planner extensions  
shouldn't have a problem.  
  
As before, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

commit   : 4b160492b9b8345747dfcad468eb89e9ccc0a876    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 14:05:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 14:05:03 -0500    

Click here for diff

Adjust the error texts used for unrecognized/unsupported datetime  
units so that there are just two strings to translate, not two  
per datatype.  Along the way, follow our usual error message style  
of not double-quoting type names, and instead making sure that we  
say the name is a type.  Fix a couple of places in date.c that  
were using the wrong one of "unrecognized" and "unsupported".  
  
Nikhil Benesch, with a bit more editing by me  
  
Discussion: https://postgr.es/m/CAPWqQZTURGixmbMH2_Z3ZtWGA0ANjUb9bwtkkxSxSfDeFHuM6Q@mail.gmail.com  

M src/backend/utils/adt/date.c
M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/date.out
M src/test/regress/expected/interval.out
M src/test/regress/expected/time.out
M src/test/regress/expected/timetz.out

Use MaxLockMode symbol in more places.

commit   : ba2bc4a7bace6db6657b4e550b11137e31e2f8dc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 12:24:44 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 3 Jan 2022 12:24:44 -0500    

Click here for diff

As long as we have this macro, it makes sense to use it in  
the LockMethodData structures.  
  
Julien Rouhaud  
  
Discussion: https://postgr.es/m/20220103064722.ewdv4evlez5m7mdn@jrouhaud  

M src/backend/storage/lmgr/lock.c
M src/include/storage/lockdefs.h

Avoid using DefElemAction in AlterPublicationStmt

commit   : 9623d8999603dff84e7cb85caca2af82c5f67c8b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 3 Jan 2022 10:48:48 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 3 Jan 2022 10:48:48 -0300    

Click here for diff

Create a new enum type for it.  This allows to add new values for future  
functionality without disrupting unrelated uses of DefElem.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h

pg_stat_statements: Remove obsolete comment

commit   : 234ba62769990fcce52003b1b3f4fe2c521bb622    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 3 Jan 2022 17:34:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 3 Jan 2022 17:34:45 +0900    

Click here for diff

Since 4f0b096, pgss_store() does nothing if compute_query_id is disabled  
or if no other module computed a query identifier, but the top comment  
of this function did not reflect that.  This behavior is already  
documented in its own code path, and this just removes the inconsistent  
comment.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M contrib/pg_stat_statements/pg_stat_statements.c

Fix typo

commit   : 69872d0bbe64fcd67c4fb4c61e5c7bf6a3443a47    
  
author   : Magnus Hagander <[email protected]>    
date     : Sun, 2 Jan 2022 17:03:32 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Sun, 2 Jan 2022 17:03:32 +0100    

Click here for diff

Reported-By: Eric Mutta  
Backpatch-through: 10  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/high-availability.sgml

Fix index-only scan plans when not all index columns can be returned.

commit   : 4ace456776524839ef3279ab0bad8a2c9f6cc2a7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 1 Jan 2022 16:12:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 1 Jan 2022 16:12:03 -0500    

Click here for diff

If an index has both returnable and non-returnable columns, and one of  
the non-returnable columns is an expression using a Var that is in a  
returnable column, then a query returning that expression could result  
in an index-only scan plan that attempts to read the non-returnable  
column, instead of recomputing the expression from the returnable  
column as intended.  
  
To fix, redefine the "indextlist" list of an IndexOnlyScan plan node  
as containing null Consts in place of any non-returnable columns.  
This solves the problem by preventing setrefs.c from falsely matching  
to such entries.  The executor is happy since it only cares about the  
exposed types of the entries, and ruleutils.c doesn't care because a  
correct plan won't reference those entries.  I considered some other  
ways to prevent setrefs.c from doing the wrong thing, but this way  
seems good since (a) it allows a very localized fix, (b) it makes  
the indextlist structure more compact in many cases, and (c) the  
indextlist is now a more faithful representation of what the index AM  
will actually produce, viz. nulls for any non-returnable columns.  
  
This is easier to hit since we introduced included columns, but it's  
possible to construct failing examples without that, as per the  
added regression test.  Hence, back-patch to all supported branches.  
  
Per bug #17350 from Louis Jachiet.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/createplan.c
M src/include/nodes/plannodes.h
M src/test/regress/expected/gist.out
M src/test/regress/sql/gist.sql

pg_dump: avoid unsafe function calls in getPolicies().

commit   : 3e6e86abca0138abd7265306beb6346dc2d9e221    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Dec 2021 12:47:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Dec 2021 12:47:57 -0500    

Click here for diff

getPolicies() had the same disease I fixed in other places in  
commit e3fcbbd62, i.e., it was calling pg_get_expr() for  
expressions on tables that we don't necessarily have lock on.  
To fix, restrict the query to only collect interesting rows,  
rather than doing the filtering on the client side.  
  
Like the previous patch, apply to HEAD only for now.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

pg_dump: minor performance improvements from eliminating sub-SELECTs.

commit   : d5e8930f50e31d836d84b353b9dadedd5007bb70    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 31 Dec 2021 11:39:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 31 Dec 2021 11:39:26 -0500    

Click here for diff

Get rid of the "username_subquery" mechanism in favor of doing  
local lookups of role names from role OIDs.  The PG backend isn't  
terribly smart about scalar SubLinks in SELECT output lists,  
so this offers a small performance improvement, at least in  
installations with more than a couple of users.  In any case  
the old method didn't make for particularly readable SQL code.  
  
While at it, I removed the various custom warning messages about  
failing to find an object's owner, in favor of just fatal'ing  
in the local lookup function.  AFAIK there is no reason any  
longer to treat that as anything but a catalog-corruption case,  
and certainly no reason to make translators deal with a dozen  
different messages where one would do.  (If it turns out that  
fatal() is indeed a bad idea, we can back off to issuing  
pg_log_warning() and returning an empty string, resulting in  
the same behavior as before, except more consistent.)  
  
Also drop an entirely unnecessary sub-SELECT to check on the  
pg_depend status of a sequence relation: we already have a  
LEFT JOIN to fetch the row of interest in the FROM clause.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

ci: Add continuous integration for github repositories via cirrus-ci.

commit   : 93d97349461347d952e8cebdf62f5aa84b4bd20a    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 30 Dec 2021 18:59:20 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 30 Dec 2021 18:59:20 -0800    

Click here for diff

Currently FreeBSD, Linux, macOS and Windows (Visual Studio) are tested.  
  
The main goal of this integration is to make it easier to test in-development  
patches across multiple platforms. This includes improving the testing done  
automatically by cfbot [1] for commitfest entries.  It is *not* the goal to  
supersede the buildfarm.  
  
cirrus-ci [2] was chosen because it was already in use for cfbot, allows using  
full VMs, has good OS coverage and allows accessing the full test results  
without authentication (like a github account).  It might be worth adding  
support for further CI providers, particularly ones supporting other git  
forges, in the future.  
  
To keep CI times tolerable, most platforms use pre-generated images. Some  
platforms use containers, others use full VMs.  
  
For instructions on how to enable the CI integration in a repository and  
further details, see src/tools/ci/README  
  
[1] http://cfbot.cputube.org/  
[2] https://cirrus-ci.org/  
  
Author: Andres Freund <[email protected]>  
Author: Thomas Munro <[email protected]>  
Author: Melanie Plageman <[email protected]>  
Reviewed-By: Melanie Plageman <[email protected]>  
Reviewed-By: Justin Pryzby <[email protected]>  
Reviewed-By: Thomas Munro <[email protected]>  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

A .cirrus.yml
A src/tools/ci/README
A src/tools/ci/cores_backtrace.sh
A src/tools/ci/gcp_freebsd_repartition.sh
A src/tools/ci/pg_ci_base.conf
A src/tools/ci/windows_build_config.pl

pg_dump: make dumpPublication et al. less unlike sibling functions.

commit   : 5e65df64d631257ce60016bec0aca43f042b1d33    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Dec 2021 19:40:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Dec 2021 19:40:37 -0500    

Click here for diff

dumpPublication, dumpPublicationNamespace, dumpPublicationTable, and  
dumpSubscription failed to check dataOnly.  This is just a latent bug,  
because pg_backup_archiver.c would filter out the ArchiveEntry later;  
but they're wasting cycles in data-only dumps, and the omission might  
become a live bug someday.  In any case, it's not good to have some  
dumpFoo functions do this and some not.  
  
On the same reasoning, make dumpPublicationNamespace follow the  
same pattern as every other dumpFoo function for checking the  
DUMP_COMPONENT_DEFINITION flag.  (Since 5209c0ba0, we wouldn't  
even get here if that flag isn't set, so checking it is just  
pro forma right now.  But it might not be so forever.)  
  
Since this is just cosmetic and/or future-proofing, no need for  
back-patch.  

M src/bin/pg_dump/pg_dump.c

commit   : c9105dd3660f4a801e6f87a1ed68189bd30576bf    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Dec 2021 19:24:26 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Dec 2021 19:24:26 -0300    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/publication.out

Minor cleanup/optimization in pg_dump.

commit   : c7cf73eb7b9e7911748ebe117a7219f21e504121    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Dec 2021 14:29:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Dec 2021 14:29:32 -0500    

Click here for diff

In the wake of commits 05649b88c and 5209c0ba0, findComments() and  
findSecLabels() no longer use their "Archive *fout" arguments,  
so get rid of those.  
  
While doing that, I noticed that there's no very good reason why  
dumpCompositeTypeColComments() should be doing its own query to fetch  
the column names of the composite type, when the calling function has  
just fetched the same data.  Tweak it to use that query result.  This  
probably doesn't save a lot for most people, because since 5209c0ba0  
we won't get into this code at all unless the composite type has at  
least one comment.  Nonetheless, it's a wasted query.  

M src/bin/pg_dump/pg_dump.c

Revert b2a459edf "Fix GRANTED BY support in REVOKE ROLE statements"

commit   : e68570e388f08c2e36ce7d2a9564941b89db6549    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Dec 2021 13:23:47 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 30 Dec 2021 13:23:47 +0100    

Click here for diff

The reverted commit attempted to fix SQL specification compliance for  
the cases which 6aaaa76bb left.  This however broke existing behavior  
which takes precedence over spec compliance so revert. The introduced  
tests are left after the revert since the codepath isn't well covered.  
Per bug report 17346. Backpatch down to 14 where it was introduced.  
  
Reported-by: Andrew Bille <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/test/regress/expected/privileges.out

Fix overly generic name in with.sql test.

commit   : 8112bcf0cc602e00e95eab6c4bdc0eb73b5b547d    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 30 Dec 2021 16:09:53 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 30 Dec 2021 16:09:53 +1300    

Click here for diff

Avoid the name "test".  In the 10 branch, this could clash with  
alter_table.sql, as seen in the build farm.  That other instance was  
already renamed in later branches by commit 2cf8c7aa, but it's good to  
future-proof the name here too.  
  
Back-patch to 10.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJf4RAXUyAYVUcQawcptX%3DnhEco3SYpuPK5cCbA-F1eLA%40mail.gmail.com  

M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Fix issues in pgarch's new directory-scanning logic.

commit   : 1fb17b1903414676bd371068739549cd2966fe87    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 29 Dec 2021 17:02:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 29 Dec 2021 17:02:50 -0500    

Click here for diff

The arch_filenames[] array elements were one byte too small, so that  
a maximum-length filename would get corrupted if another entry  
were made after it.  (Noted by Thomas Munro, fix by Nathan Bossart.)  
  
Move these arrays into a palloc'd struct, so that we aren't wasting  
a few kilobytes of static data in each non-archiver process.  
  
Add a binaryheap_reset() call to make it plain that we start the  
directory scan with an empty heap.  I don't think there's any live  
bug of that sort, but it seems fragile, and this is very cheap  
insurance.  
  
Cleanup for commit beb4e9ba1, so no back-patch needed.  
  
Discussion: https://postgr.es/m/CA+hUKGLHAjHuKuwtzsW7uMJF4BVPcQRL-UMZG_HM-g0y7yLkUg@mail.gmail.com  

M src/backend/postmaster/pgarch.c

Fix incorrect format placeholders

commit   : 113fa3945f8969346d6a87b9a56d54afa3d34687    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Dec 2021 10:08:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Dec 2021 10:08:41 +0100    

Click here for diff

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/bin/pg_waldump/pg_waldump.c

Revert changes about warnings/errors for placeholders.

commit   : cab5b9ab2c066ba904f13de2681872dcda31e207    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 16:01:10 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 16:01:10 -0500    

Click here for diff

Revert commits 5609cc01c, 2ed8a8cc5, and 75d22069e until we have  
a less broken idea of how this should work in parallel workers.  
Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/option.c
M contrib/sepgsql/hooks.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/tcl/pltcl.c
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Rename EmitWarningsOnPlaceholders() to MarkGUCPrefixReserved().

commit   : 5609cc01c69b80f8788771dc6f5696a459469119    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 14:39:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 14:39:08 -0500    

Click here for diff

This seems like a clearer name for what it does now.  
  
Provide a compatibility macro so that extensions don't have to convert  
to the new name right away.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/auto_explain/auto_explain.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/option.c
M contrib/sepgsql/hooks.c
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_handler.c
M src/pl/tcl/pltcl.c
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/worker_spi/worker_spi.c

Rethink handling of settings with a prefix reserved by an extension.

commit   : 2ed8a8cc5b634d33ea07d681c6b02213da07f792    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 14:35:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Dec 2021 14:35:50 -0500    

Click here for diff

Commit 75d22069e made SET print a warning if you tried to set an  
unrecognized parameter within namespace previously reserved by an  
extension.  It seems better for that to be an outright error though,  
for the same reason that we don't let you set unrecognized unqualified  
parameter names.  In any case, the preceding implementation was  
inefficient and erroneous.  Perform the check in a more appropriate  
spot, and be more careful about prefix-match cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Fix incorrect field count in pg_control_checkpoint()

commit   : 86d9888d2ead04a1a139bbaef9d7f4648022fe4b    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 26 Dec 2021 17:41:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 26 Dec 2021 17:41:59 +0900    

Click here for diff

18 columns are generated in this function, but we had enough space for  
19 of them.  Introduced by 4b0d28d.  
  
Author: Bharath Rupireddy  
Reviewed-by: Justin Pryzby, Euler Taveira  
Discussion: https://postgr.es/m/CALj2ACVQ=hAs=sT0n4xriimqRrrgECySfg_tSqA+26Rb_yfs2A@mail.gmail.com  

M src/backend/utils/misc/pg_controldata.c

postgres_fdw: Revert unstable tests for postgres_fdw.application_name.

commit   : 5e64ad369771b66bb3e916aade735defce6e65a1    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 24 Dec 2021 17:39:59 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 24 Dec 2021 17:39:59 +0900    

Click here for diff

Commit 6e0cb3dec1 added the tests that check that escape sequences in  
postgres_fdw.application_name setting are replaced with status information  
expectedly. But they were unstable and caused some buildfarm  
members to report the failure. This commit reverts those unstable tests.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

postgres_fdw: Allow postgres_fdw.application_name to include escape sequences.

commit   : 6e0cb3dec10e460288d68a128e3d79d16a230cdb    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 24 Dec 2021 16:55:11 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 24 Dec 2021 16:55:11 +0900    

Click here for diff

application_name that used when postgres_fdw establishes a connection to  
a foreign server can be specified in either or both a connection parameter  
of a server object and GUC postgres_fdw.application_name. This commit  
allows those parameters to include escape sequences that begins with  
% character. Then postgres_fdw replaces those escape sequences with  
status information. For example, %d and %u are replaced with user name  
and database name in local server, respectively. This feature enables us  
to add information more easily to track remote transactions or queries,  
into application_name of a remote connection.  
  
Author: Hayato Kuroda  
Reviewed-by: Kyotaro Horiguchi, Masahiro Ikeda, Hou Zhijie, Fujii Masao  
Discussion: https://postgr.es/m/TYAPR01MB5866FAE71C66547C64616584F5EB9@TYAPR01MB5866.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/TYCPR01MB5870D1E8B949DAF6D3B84E02F5F29@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Fix compilation error introduced by commit 8e1fae1938.

commit   : 94226d4506e66d6e7cbf4b391f1e7393c1962841    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 23 Dec 2021 12:44:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 23 Dec 2021 12:44:45 +0530    

Click here for diff

Author: Masahiko Sawada  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/vacuumparallel.c

Move parallel vacuum code to vacuumparallel.c.

commit   : 8e1fae193864527c931a704bd7908e4fbc983f5c    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 23 Dec 2021 11:42:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 23 Dec 2021 11:42:52 +0530    

Click here for diff

This commit moves parallel vacuum related code to a new file  
commands/vacuumparallel.c so that any table AM supporting indexes can  
utilize parallel vacuum in order to call index AM callbacks (ambulkdelete  
and amvacuumcleanup) with parallel workers.  
  
Another reason for this refactoring is that the parallel vacuum isn't  
specific to heap so it doesn't make sense to keep this code in  
heap/vacuumlazy.c.  
  
Author: Masahiko Sawada, based on suggestion from Andres Freund  
Reviewed-by: Hou Zhijie, Amit Kapila, Haiying Tang  
Discussion: https://www.postgresql.org/message-id/20211030212101.ae3qcouatwmy7tbr%40alap3.anarazel.de  

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/parallel.c
M src/backend/commands/Makefile
M src/backend/commands/vacuum.c
A src/backend/commands/vacuumparallel.c
M src/include/access/heapam.h
M src/include/commands/vacuum.h
M src/tools/pgindent/typedefs.list

doc: clarify when expression indexes evaluate their expressions

commit   : e2e1bbde46a3509c3b7e830196f4314242925247    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 Dec 2021 16:29:16 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 Dec 2021 16:29:16 -0500    

Click here for diff

Only non-HOT updates evaluate the index expression.  
  
Reported-by: Chris Lowder  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/indices.sgml

Remove unused include

commit   : 4965f75484aea9d273b11ad4957f57d8dc1ed4b0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 15:04:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 15:04:42 +0100    

Click here for diff

"utils/builtins.h" was used for pg_strtouint64(), added by  
cff440d368690f94fbda1a475277e90ea2263843, removed by  
3c6f8c011f85df7b35c32f4ccaac5c86c9064a4a.  

M src/backend/nodes/readfuncs.c

Remove unused include

commit   : 2f4fd1a73ba59247d4413f33d6178bbcbcfab60f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 15:02:57 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 15:02:57 +0100    

Click here for diff

"fmgr.h" was used for load_external_function(), added by  
a05dc4d7fd57d4ae084c1f0801973e5c1a1aa26e, removed by  
f9143d102ffd0947ca904c62b1d3d6fd587e0c80.  

M src/backend/nodes/readfuncs.c

Fix incorrect format placeholders

commit   : dfaa346c7c00ff8a3fd8ea436a7d5be7527e67cb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 08:34:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 08:34:10 +0100    

Click here for diff

M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c

Correct comment and some documentation about REPLICA_IDENTITY_INDEX

commit   : fc95d35b9429096ec4d028d79dcf1fb8b5d4b16e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Dec 2021 16:37:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Dec 2021 16:37:58 +0900    

Click here for diff

catalog/pg_class.h was stating that REPLICA_IDENTITY_INDEX with a  
dropped index is equivalent to REPLICA_IDENTITY_DEFAULT.  The code tells  
a different story, as it is equivalent to REPLICA_IDENTITY_NOTHING.  
  
The behavior exists since the introduction of replica identities, and  
fe7fd4e even added tests for this case but I somewhat forgot to fix this  
comment.  
  
While on it, this commit reorganizes the documentation about replica  
identities on the ALTER TABLE page, and a note is added about the case  
of dropped indexes with REPLICA_IDENTITY_INDEX.  
  
Author: Michael Paquier, Wei Wang  
Reviewed-by: Euler Taveira  
Discussion: https://postgr.es/m/OS3PR01MB6275464AD0A681A0793F56879E759@OS3PR01MB6275.jpnprd01.prod.outlook.com  
Backpatch-through: 10  

M doc/src/sgml/ref/alter_table.sgml
M src/include/catalog/pg_class.h

Fix typo in code comment

commit   : 962951be3ce319052df014e0d23b6e7626df587f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 07:52:18 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Dec 2021 07:52:18 +0100    

Click here for diff

Reported-by: Kevin Zheng <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/17341-d913ddb626c5c08c%40postgresql.org  

M src/backend/storage/freespace/freespace.c

Remove assertion for ALTER TABLE .. DETACH PARTITION CONCURRENTLY

commit   : 2e577c94466fde77d24cd44dc47059cf9cf392a4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Dec 2021 15:38:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Dec 2021 15:38:00 +0900    

Click here for diff

One code path related to this flavor of ALTER TABLE was checking that  
the relation to detach has to be a normal table or a partitioned table,  
which would fail if using the command with a different relation kind.  
  
Views, sequences and materialized views cannot be part of a partition  
tree, so these would cause the command to fail anyway, but the assertion  
was triggered.  Foreign tables can be part of a partition tree, and  
again the assertion would have failed.  The simplest solution is just to  
remove this assertion, so as we get the same failure as the  
non-concurrent code path.  
  
While on it, add a regression test in postgres_fdw for the concurrent  
partition detach of a foreign table, as per a suggestion from Alexander  
Lakhin.  
  
Issue introduced in 71f4c8c.  
  
Reported-by: Alexander Lakhin  
Author: Michael Paquier, Alexander Lakhin  
Reviewed-by: Peter Eisentraut, Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/commands/tablecmds.c

Move index vacuum routines to vacuum.c.

commit   : cc8b25712b5ed8809048c7e209882bb0981214d6    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Dec 2021 07:55:14 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Dec 2021 07:55:14 +0530    

Click here for diff

An upcoming patch moves parallel vacuum code out of vacuumlazy.c. This  
code restructuring will allow both lazy vacuum and parallel vacuum to use  
index vacuum functions.  
  
Author: Masahiko Sawada  
Reviewed-by: Hou Zhijie, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/20211030212101.ae3qcouatwmy7tbr%40alap3.anarazel.de  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h
M src/tools/pgindent/typedefs.list

Add help & tab-complete support for psql's \getenv.

commit   : 0f2abd05441f524a67bc58ef5f0cc32054f7fb66    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Dec 2021 16:18:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Dec 2021 16:18:41 -0500    

Click here for diff

I forgot about these details in 33d3eeadb :-(.  
Noted by Christoph Berg.  
  
Discussion: https://postgr.es/m/YcI8i/[email protected]  

M src/bin/psql/help.c
M src/bin/psql/tab-complete.c

Add missing EmitWarningsOnPlaceholders() calls.

commit   : 1fada5d81e6769ded832a4ca62ee9371bac3fb9f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Dec 2021 12:12:24 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Dec 2021 12:12:24 -0500    

Click here for diff

Extensions that define any custom GUCs should call  
EmitWarningsOnPlaceholders after doing so, to help catch misspellings.  
Many of our contrib modules hadn't gotten the memo on that, though.  
  
Also add such calls to src/test/modules extensions that have GUCs.  
While these aren't really user-facing, they should illustrate good  
practice not faulty practice.  
  
Shinya Kato  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/auth_delay/auth_delay.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/option.c
M contrib/sepgsql/hooks.c
M src/backend/utils/misc/guc.c
M src/pl/tcl/pltcl.c
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/worker_spi/worker_spi.c

commit   : 0e6e7f0806b2080cb31f33ff992ec2e4e35fa6f1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 16:49:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 16:49:13 -0500    

Click here for diff

There's no longer any reason to fire up a separate psql run  
to create these functions.  (Some refactoring in the main  
regression tests is also called for, but that will take  
more thought.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/Makefile
M contrib/dblink/expected/dblink.out
D contrib/dblink/expected/paths.out
M contrib/dblink/sql/dblink.sql
D contrib/dblink/sql/paths.sql

Remove dynamic translation of regression test scripts, step 2.

commit   : dc9c3b0ff21465fa89d71eecf5e6cc956d647eca    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 14:15:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 14:15:52 -0500    

Click here for diff

"git mv" all the input/*.source and output/*.source files into  
the corresponding sql/ and expected/ directories.  Then remove  
the pg_regress and Makefile infrastructure associated with  
dynamic translation.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/Makefile
D contrib/dblink/expected/.gitignore
R100 contrib/dblink/output/paths.source contrib/dblink/expected/paths.out
D contrib/dblink/sql/.gitignore
R100 contrib/dblink/input/paths.source contrib/dblink/sql/paths.sql
M contrib/file_fdw/Makefile
D contrib/file_fdw/expected/.gitignore
R100 contrib/file_fdw/output/file_fdw.source contrib/file_fdw/expected/file_fdw.out
D contrib/file_fdw/sql/.gitignore
R100 contrib/file_fdw/input/file_fdw.source contrib/file_fdw/sql/file_fdw.sql
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/pl/plpgsql/src/Makefile
D src/pl/plpgsql/src/expected/.gitignore
R100 src/pl/plpgsql/src/output/plpgsql_copy.source src/pl/plpgsql/src/expected/plpgsql_copy.out
D src/pl/plpgsql/src/sql/.gitignore
R100 src/pl/plpgsql/src/input/plpgsql_copy.source src/pl/plpgsql/src/sql/plpgsql_copy.sql
M src/test/regress/GNUmakefile
D src/test/regress/expected/.gitignore
R100 src/test/regress/output/constraints.source src/test/regress/expected/constraints.out
R100 src/test/regress/output/copy.source src/test/regress/expected/copy.out
R100 src/test/regress/output/create_function_0.source src/test/regress/expected/create_function_0.out
R100 src/test/regress/output/create_function_1.source src/test/regress/expected/create_function_1.out
R100 src/test/regress/output/create_function_2.source src/test/regress/expected/create_function_2.out
R100 src/test/regress/output/largeobject.source src/test/regress/expected/largeobject.out
R100 src/test/regress/output/largeobject_1.source src/test/regress/expected/largeobject_1.out
R100 src/test/regress/output/misc.source src/test/regress/expected/misc.out
R100 src/test/regress/output/tablespace.source src/test/regress/expected/tablespace.out
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
D src/test/regress/sql/.gitignore
R100 src/test/regress/input/constraints.source src/test/regress/sql/constraints.sql
R100 src/test/regress/input/copy.source src/test/regress/sql/copy.sql
R100 src/test/regress/input/create_function_0.source src/test/regress/sql/create_function_0.sql
R100 src/test/regress/input/create_function_1.source src/test/regress/sql/create_function_1.sql
R100 src/test/regress/input/create_function_2.source src/test/regress/sql/create_function_2.sql
R100 src/test/regress/input/largeobject.source src/test/regress/sql/largeobject.sql
R100 src/test/regress/input/misc.source src/test/regress/sql/misc.sql
R100 src/test/regress/input/tablespace.source src/test/regress/sql/tablespace.sql

Remove dynamic translation of regression test scripts, step 1.

commit   : d1029bb5a26cb84b116b0dee4dde312291359f2a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 14:06:15 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 14:06:15 -0500    

Click here for diff

pg_regress has long had provisions for dynamically substituting path  
names into regression test scripts and result files, but use of that  
feature has always been a serious pain in the neck, mainly because  
updating the result files requires tedious manual editing.  Let's  
get rid of that in favor of passing down the paths in environment  
variables.  
  
In addition to being easier to maintain, this way is capable of  
dealing with path names that require escaping at runtime, for example  
paths containing single-quote marks.  (There are other stumbling  
blocks in the way of actually building in a path that looks like  
that, but removing this one seems like a good thing to do.)  The key  
coding rule that makes that possible is to concatenate pieces of a  
dynamically-variable string using psql's \set command, and then use  
the :'variable' notation to quote and escape the string for the next  
level of interpretation.  
  
In hopes of making this change more transparent to "git blame",  
I've split it into two steps.  This commit adds the necessary  
pg_regress.c support and changes all the *.source files in-place  
so that they no longer require any dynamic translation.  The next  
commit will just "git mv" them into the regular sql/ and expected/  
directories.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/input/paths.source
M contrib/dblink/output/paths.source
M contrib/file_fdw/input/file_fdw.source
M contrib/file_fdw/output/file_fdw.source
M src/pl/plpgsql/src/input/plpgsql_copy.source
M src/pl/plpgsql/src/output/plpgsql_copy.source
M src/test/regress/input/constraints.source
M src/test/regress/input/copy.source
M src/test/regress/input/create_function_0.source
M src/test/regress/input/create_function_1.source
M src/test/regress/input/create_function_2.source
M src/test/regress/input/largeobject.source
M src/test/regress/input/misc.source
M src/test/regress/input/tablespace.source
M src/test/regress/output/constraints.source
M src/test/regress/output/copy.source
M src/test/regress/output/create_function_0.source
M src/test/regress/output/create_function_1.source
M src/test/regress/output/create_function_2.source
M src/test/regress/output/largeobject.source
M src/test/regress/output/largeobject_1.source
M src/test/regress/output/misc.source
M src/test/regress/output/tablespace.source
M src/test/regress/pg_regress.c

Add a \getenv command to psql.

commit   : 33d3eeadb21d2268104840cfef6bc2226ddfc680    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 13:17:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Dec 2021 13:17:58 -0500    

Click here for diff

\getenv fetches the value of an environment variable into a psql  
variable.  This is the inverse of the \setenv command that was added  
over ten years ago.  We'd not seen a compelling use-case for \getenv  
at the time, but upcoming regression test refactoring provides a  
sufficient reason to add it now.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Add fast path for validating UTF-8 text

commit   : 911588a3f816d875261d8f7d89e2517978831cd5    
  
author   : John Naylor <[email protected]>    
date     : Tue, 19 Oct 2021 16:43:14 -0400    
  
committer: John Naylor <[email protected]>    
date     : Tue, 19 Oct 2021 16:43:14 -0400    

Click here for diff

Our previous validator used a traditional algorithm that performed  
comparison and branching one byte at a time. It's useful in that  
we always know exactly how many bytes we have validated, but that  
precision comes at a cost. Input validation can show up prominently  
in profiles of COPY FROM, and future improvements to COPY FROM such  
as parallelism or faster line parsing will put more pressure on input  
validation. Hence, add fast paths for both ASCII and multibyte UTF-8:  
  
Use bitwise operations to check 16 bytes at a time for ASCII. If  
that fails, use a "shift-based" DFA on those bytes to handle the  
general case, including multibyte. These paths are relatively free  
of branches and thus robust against all kinds of byte patterns. With  
these algorithms, UTF-8 validation is several times faster, depending  
on platform and the input byte distribution.  
  
The previous coding in pg_utf8_verifystr() is retained for short  
strings and for when the fast path returns an error.  
  
Review, performance testing, and additional hacking by: Heikki  
Linakangas, Vladimir Sitnikov, Amit Khandekar, Thomas Munro, and  
Greg Stark  
  
Discussion:  
https://www.postgresql.org/message-id/CAFBsxsEV_SzH%2BOLyCiyon%3DiwggSyMh_eF6A3LU2tiWf3Cy2ZQg%40mail.gmail.com  

M src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/test/regress/expected/conversion.out
M src/test/regress/sql/conversion.sql

pg_dump: Refactor getIndexes()

commit   : e2c52beecdea152ca680a22ef35c6a7da55aa30f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Dec 2021 11:08:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Dec 2021 11:08:05 +0100    

Click here for diff

Rearrange the version-dependent pieces in the new more modular style.  
  
Discussion: https://www.postgresql.org/message-id/flat/67a28a3f-7b79-a5a9-fcc7-947b170e66f0%40enterprisedb.com  

M src/bin/pg_dump/pg_dump.c

doc: More documentation on regular expressions and SQL standard

commit   : 222b697ec077047024a96392a2f5cb9b1803ccf7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 Dec 2021 10:12:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 Dec 2021 10:12:25 +0100    

Click here for diff

Reviewed-by: Gilles Darold <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt

Remove some more dead code in pg_dump.

commit   : b1c169caf0678a82cf26b5656e01399f6153456b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Dec 2021 17:18:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Dec 2021 17:18:34 -0500    

Click here for diff

Coverity complained that parts of dumpFunc() and buildACLCommands()  
were now unreachable, as indeed they are.  Remove 'em.  
  
In passing, make dumpFunc's handling of protrftypes less gratuitously  
different from other fields.  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c

Fix typo in TAP tests of pg_receivewal

commit   : 22592e10b41a95f841642fa16127521989177bbc    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Dec 2021 16:30:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Dec 2021 16:30:01 +0900    

Click here for diff

Introduced in d62bcc8, noticed while hacking in the area.  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Add option -N/--no-sync to pg_upgrade

commit   : 3d5ffccb6df323f528cf870c26d0d0517ffe3eaa    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Dec 2021 16:18:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Dec 2021 16:18:45 +0900    

Click here for diff

This is an option consistent with what the other tools of src/bin/  
(pg_checksums, pg_dump, pg_rewind and pg_basebackup) provide which is  
useful for leveraging the I/O effort when testing things.  This is not  
to be used in a production environment.  
  
All the regression tests of pg_upgrade are updated to use this new  
option.  This happens to cut at most a couple of seconds in environments  
constrained on I/O, by avoiding a flush of data folder for the new  
cluster upgraded.  
  
Author: Michael Paquier  
Reviewed-by: Peter Eisentraut  
Discussion: https://postgr.es/m/YbrhzuBmBxS/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

Fix the public schema's permissions in a separate test script.

commit   : 944dc45d1b633c4d612cdff9f15153ed609eaa35    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Dec 2021 16:22:26 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Dec 2021 16:22:26 -0500    

Click here for diff

In the wake of commit b073c3ccd, it's necessary to grant create  
permissions on the public schema to PUBLIC to get many of the  
core regression test scripts to pass.  That commit did so via the  
quick-n-dirty expedient of adding the GRANT to the tablespace test,  
which runs first.  This is problematic for single-machine  
replication testing, though.  The least painful way to run the  
regression tests on such a setup is to skip the tablespace test,  
and that no longer works.  
  
To fix, let's invent a separate "test_setup" script to run first,  
and put the GRANT there.  Revert b073c3ccd's changes to  
the tablespace.source files.  
  
In the future it might be good to try to reduce coupling between  
the various test scripts by having test_setup create widely-used  
objects, with the goal that most of the scripts could run after  
having run only test_setup.  That's going to take some effort,  
so this commit just addresses my immediate pain point.  
  
Discussion: https://postgr.es/m/[email protected]  

A src/test/regress/expected/test_setup.out
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source
M src/test/regress/parallel_schedule
A src/test/regress/sql/test_setup.sql

Simplify the general-purpose 64-bit integer parsing APIs

commit   : 3c6f8c011f85df7b35c32f4ccaac5c86c9064a4a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 Dec 2021 06:05:54 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 Dec 2021 06:05:54 +0100    

Click here for diff

pg_strtouint64() is a wrapper around strtoull/strtoul/_strtoui64, but  
it seems no longer necessary to have this indirection.  
msvc/Solution.pm claims HAVE_STRTOULL, so the "MSVC only" part seems  
unnecessary.  Also, we have code in c.h to substitute alternatives for  
strtoull() if not found, and that would appear to cover all currently  
supported platforms, so having a further fallback in pg_strtouint64()  
seems unnecessary.  
  
Therefore, we could remove pg_strtouint64(), and use strtoull()  
directly in all call sites.  However, it seems useful to keep a  
separate notation for parsing exactly 64-bit integers, matching the  
type definition int64/uint64.  For that, add new macros strtoi64() and  
strtou64() in c.h as thin wrappers around strtol()/strtoul() or  
strtoll()/stroull().  This makes these functions available everywhere  
instead of just in the server code, and it makes the function naming  
notably different from the pg_strtointNN() functions in numutils.c,  
which have a different API.  
  
Discussion: https://www.postgresql.org/message-id/flat/a3df47c9-b1b4-29f2-7e91-427baf8b75a3%40enterprisedb.com  

M src/backend/nodes/readfuncs.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/misc/guc.c
M src/include/c.h
M src/include/utils/builtins.h

Ensure casting to typmod -1 generates a RelabelType.

commit   : 9c356f4b2dd8f8ff49757287e387ab1d023e4449    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 15:36:02 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 15:36:02 -0500    

Click here for diff

Fix the code changed by commit 5c056b0c2 so that we always generate  
RelabelType, not something else, for a cast to unspecified typmod.  
Otherwise planner optimizations might not happen.  
  
It appears we missed this point because the previous experiments were  
done on type numeric: the parser undesirably generates a call on the  
numeric() length-coercion function, but then numeric_support()  
optimizes that down to a RelabelType, so that everything seems fine.  
It misbehaves for types that have a non-optimized length coercion  
function, such as bpchar.  
  
Per report from John Naylor.  Back-patch to all supported branches,  
as the previous patch eventually was.  Unfortunately, that no longer  
includes 9.6 ... we really shouldn't put this type of change into a  
nearly-EOL branch.  
  
Discussion: https://postgr.es/m/CAFBsxsEfbFHEkouc+FSj+3K1sHipLPbEC67L0SAe-9-da8QtYg@mail.gmail.com  

M src/backend/parser/parse_coerce.c
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

Remove psql support for server versions preceding 9.2.

commit   : cf0cab868aa4758b7eec5f9412f2ec74acda7f45    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 14:02:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 14:02:28 -0500    

Click here for diff

Per discussion, we'll limit support for old servers to those branches  
that can still be built easily on modern platforms, which as of now  
is 9.2 and up.  
  
Aside from removing code that is dead per the assumption of  
server >= 9.2, I tweaked the startup warning for unsupported versions  
to complain about too-old servers as well as too-new ones.  The  
warning that "Some psql features might not work" applies precisely  
to both cases.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/describe.c
M src/bin/psql/large_obj.c
M src/bin/psql/tab-complete.c

Clean up some more freshly-dead code in pg_dump and pg_upgrade.

commit   : c49d926833fa6a987e3f9a66027f4a01d7a008be    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 12:01:59 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Dec 2021 12:01:59 -0500    

Click here for diff

I missed a few things in 30e7c175b and e469f0aaf,  
as noted by Justin Pryzby.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/TESTING
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/option.c

doc: Add note about postgres_fdw.application_name.

commit   : 58e2e6eb67fec14c793c74207407e172d7e0291d    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 16 Dec 2021 15:18:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 16 Dec 2021 15:18:30 +0900    

Click here for diff

postgres_fdw.application_name can be any string of any length  
and contain even non-ASCII characters.  However when it's passed  
to and used as application_name in a foreign server, it's truncated  
to less than NAMEDATALEN characters and any characters  
other than printable ASCII ones in it will be replaced with question  
marks. This commit adds these notes into the docs.  
  
Author: Hayato Kuroda  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/TYCPR01MB5870D1E8B949DAF6D3B84E02F5F29@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M doc/src/sgml/postgres-fdw.sgml

Change ProcSendSignal() to take pgprocno.

commit   : a13db0e16404ae532fe037071c7fe2576a1f8890    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 16 Dec 2021 12:40:15 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 16 Dec 2021 12:40:15 +1300    

Click here for diff

Instead of referring to target backends by pid, use pgprocno.  This  
means that we don't have to scan the ProcArray and we can drop some  
special case code for dealing with the startup process.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLYRyDaneEwz5Uya_OgFLMx5BgJfkQSD%3Dq9HmwsfRRb-w%40mail.gmail.com  
Reviewed-by: Soumyadeep Chakraborty <[email protected]>  
Reviewed-by: Ashwin Agrawal <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  

M src/backend/access/transam/xlog.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/buf_internals.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h

Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.

commit   : bbc227e951ecc59a29205be4952a623e7d1dd534    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Dec 2021 18:58:20 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Dec 2021 18:58:20 -0500    

Click here for diff

The API spec for lookup_rowtype_tupdesc previously said you could use  
either ReleaseTupleDesc or DecrTupleDescRefCount.  However, the latter  
choice means the caller must be certain that the returned tupdesc is  
refcounted.  I don't recall right now whether that was always true  
when this spec was written, but it's certainly not always true since  
we introduced shared record typcaches for parallel workers.  That means  
that callers using DecrTupleDescRefCount are dependent on typcache  
behavior details that they probably shouldn't be.  Hence, change the API  
spec to say that you must call ReleaseTupleDesc, and fix the half-dozen  
callers that weren't.  
  
AFAICT this is just future-proofing, there's no live bug here.  
So no back-patch.  
  
Per gripe from Chapman Flack.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/cache/typcache.c

Remove pg_dump's --no-synchronized-snapshots switch.

commit   : 2a712066d0587f65fcecd44e884dc6a09958dbdd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Dec 2021 18:44:47 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Dec 2021 18:44:47 -0500    

Click here for diff

Server versions for which there was a plausible reason to  
use this switch are all out of support now.  Leaving it  
around would accomplish little except to let careless DBAs  
shoot themselves in the foot.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c

pg_checksums: Fix data type

commit   : bf9a55c10729988a3c7ffbe14108e29d90283939    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Dec 2021 10:29:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Dec 2021 10:29:27 +0100    

Click here for diff

Segment numbers should be int, not BlockNumber (see also buffile.c).  
Likely no harm, but better for consistency.  

M src/bin/pg_checksums/pg_checksums.c

Improve parallel vacuum implementation.

commit   : 22bd3cbe0c284758d7174321f5596763095cdd55    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 15 Dec 2021 07:58:19 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 15 Dec 2021 07:58:19 +0530    

Click here for diff

Previously, in parallel vacuum, we allocated shmem area of  
IndexBulkDeleteResult only for indexes where parallel index vacuuming is  
safe and had null-bitmap in shmem area to access them. This logic was too  
complicated with a small benefit of saving only a few bits per indexes.  
  
In this commit, we allocate a dedicated shmem area for the array of  
LVParallelIndStats that includes a parallel-safety flag, the index vacuum  
status, and IndexBulkdeleteResult. There is one array element for every  
index, even those indexes where parallel index vacuuming is unsafe or not  
worthwhile. This commit makes the code clear by removing all  
bitmap-related code.  
  
Also, add the check each index vacuum status after parallel index vacuum  
to make sure that all indexes have been processed.  
  
Finally, rename parallel vacuum functions to parallel_vacuum_* for  
consistency.  
  
Author: Masahiko Sawada, based on suggestions by Andres Freund  
Reviewed-by: Hou Zhijie, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/20211030212101.ae3qcouatwmy7tbr%40alap3.anarazel.de  

M src/backend/access/heap/vacuumlazy.c
M src/tools/pgindent/typedefs.list

Adjust behavior of some env settings for the TAP tests of MSVC

commit   : 7acd01015c4a5edb253ea9468ccb71ef99cabd1a    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Dec 2021 10:39:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Dec 2021 10:39:24 +0900    

Click here for diff

edc2332 has introduced in vcregress.pl some control on the environment  
variables LZ4, TAR and GZIP_PROGRAM to allow any TAP tests to be able  
use those commands.  This makes the settings more consistent with  
src/Makefile.global.in, as the same default gets used for Make and MSVC  
builds.  
  
Each parameter can be changed in buildenv.pl, but as a default gets  
assigned after loading buldenv.pl, it is not possible to unset any of  
these, and using an empty value would not work with "||=" either.  As  
some environments may not have a compatible command in their PATH (tar  
coming from MinGW is an issue, for one), this could break tests without  
an exit path to bypass any failing test.  This commit changes things so  
as the default values for LZ4, TAR and GZIP_PROGRAM are assigned before  
loading buildenv.pl, not after.  This way, we keep the same amount of  
compatibility as a GNU build with the same defaults, and it becomes  
possible to unset any of those values.  
  
While on it, this adds some documentation about those three variables in  
the section dedicated to the TAP tests for MSVC.  
  
Per discussion with Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/vcregress.pl

Remove pg_upgrade support for upgrading from pre-9.2 servers.

commit   : e469f0aaf3c586c8390bd65923f97d4b1683cd9f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 19:17:55 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 19:17:55 -0500    

Click here for diff

Per discussion, we'll limit support for old servers to those branches  
that can still be built easily on modern platforms, which as of now  
is 9.2 and up.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pgupgrade.sgml
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenode.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/test.sh
M src/bin/pg_upgrade/version.c

Remove pg_dump/pg_dumpall support for dumping from pre-9.2 servers.

commit   : 30e7c175b81d53c0f60f6ad12d1913a6d7d77008    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 17:09:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 17:09:07 -0500    

Click here for diff

Per discussion, we'll limit support for old servers to those branches  
that can still be built easily on modern platforms, which as of now  
is 9.2 and up.  Remove over a thousand lines of code dedicated to  
dumping from older server versions.  (As in previous changes of  
this sort, we aren't removing pg_restore's ability to read older  
archive files ... though it's fair to wonder how that might be  
tested nowadays.)  This cleans up some dead code left behind by  
commit 989596152.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c

Improve sift up/down code in binaryheap.c and logtape.c.

commit   : a2ff18e89ff8f29677084bffd1e3de9ca6cd7224    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 13:35:22 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 13:35:22 -0500    

Click here for diff

Borrow the logic that's long been used in tuplesort.c: instead  
of physically swapping the data in two heap entries, keep the  
value that's being sifted up or down in a local variable, and  
just move the other values as necessary.  This makes the code  
shorter as well as faster.  It's not clear that any current  
callers are really time-critical enough to notice, but we  
might as well code heap maintenance the same way everywhere.  
  
Ma Liangzhu and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/lib/binaryheap.c
M src/backend/utils/sort/logtape.c

Fix datatype confusion in logtape.c's right_offset().

commit   : 2de3c1015cb2556af501c630b1768a20f111fe95    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 11:46:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Dec 2021 11:46:36 -0500    

Click here for diff

This could only matter if (a) long is wider than int, and (b) the heap  
of free blocks exceeds UINT_MAX entries, which seems pretty unlikely.  
Still, it's a theoretical bug, so backpatch to v13 where the typo came  
in (in commit c02fdc922).  
  
In passing, also make swap_nodes() use consistent datatypes.  
  
Ma Liangzhu  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/sort/logtape.c

Remove assertion for replication origins in PREPARE TRANSACTION

commit   : ece8c76192fee0b78509688325631ceabca44ff5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Dec 2021 10:58:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Dec 2021 10:58:15 +0900    

Click here for diff

When using replication origins, pg_replication_origin_xact_setup() is an  
optional choice to be able to set a LSN and a timestamp to mark the  
origin, which would be additionally added to WAL for transaction commits  
or aborts (including 2PC transactions).  An assertion in the code path  
of PREPARE TRANSACTION assumed that this data should always be set, so  
it would trigger when using replication origins without setting up an  
origin LSN.  Some tests are added to cover more this kind of scenario.  
  
Oversight in commit 1eb6d65.  
  
Per discussion with Amit Kapila and Masahiko Sawada.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11  

M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/sql/replorigin.sql
M src/backend/access/transam/twophase.c

Remove unimplemented/undocumented geometric functions & operators.

commit   : 189699dd3680d85c74c3886b33d9a9f83301defd    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 18:08:28 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 18:08:28 -0500    

Click here for diff

Nobody has filled in these stubs for upwards of twenty years,  
so it's time to drop the idea that they might get implemented  
any day now.  The associated pg_operator and pg_proc entries  
are just confusing wastes of space.  
  
Per complaint from Anton Voloshin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/geo_ops.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/geometry.out
M src/test/regress/sql/geometry.sql

Doc: de-document unimplemented geometric operators.

commit   : 922b23c13be075595c2abc67736b214cb90f84d9    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 17:49:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 17:49:36 -0500    

Click here for diff

In commit 791090bd7, I made an effort to fill in documentation  
for all geometric operators listed in pg_operator.  However,  
it now appears that at least some of the omissions may have been  
intentional, because some of those operator entries point at  
unimplemented stub functions.  Remove those from the docs again.  
  
(In HEAD, poly_distance stays, because c5c192d7b just added an  
implementation for it.)  
  
Per complaint from Anton Voloshin.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Implement poly_distance().

commit   : c5c192d7bdfa78f19e735610488b1cc5ad6e41cc    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 17:33:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Dec 2021 17:33:32 -0500    

Click here for diff

geo_ops.c contains half a dozen functions that are just stubs throwing  
ERRCODE_FEATURE_NOT_SUPPORTED.  Since it's been like that for more  
than twenty years, there's clearly not a lot of interest in filling in  
the stubs.  However, I'm uncomfortable with deleting poly_distance(),  
since every other geometric type supports a distance-to-another-object-  
of-the-same-type function.  We can easily add this capability by  
cribbing from poly_overlap() and path_distance().  
  
It's possible that the (existing) test case for this will show some  
numeric instability, but hopefully the buildfarm will expose it if so.  
  
In passing, improve the documentation to try to explain why polygons  
are distinct from closed paths in the first place.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/geo_ops.c
M src/test/regress/expected/geometry.out

isolationtester: append session name to application_name.

commit   : 3f323956128ff8589ce4d3a14e8b950837831803    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Dec 2021 12:02:06 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Dec 2021 12:02:06 -0800    

Click here for diff

When writing / debugging an isolation test it sometimes is useful to see which  
session holds what lock etc. To make it easier, both as part of spec files and  
interactively, append the session name to application_name. Since b1907d688  
application_name already contains the test name, this appends the session's  
name to that.  
  
insert-conflict-specconflict did something like this manually, which can now  
be removed.  
  
As we have done lately with other test infrastructure improvements, backpatch  
this change, to make it easier to backpatch tests.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Michael Paquier <[email protected]>  
Reviewed-By: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 10-, to make backpatching of tests easier.  

M src/test/isolation/expected/insert-conflict-specconflict.out
M src/test/isolation/isolationtester.c
M src/test/isolation/specs/insert-conflict-specconflict.spec

Make PG_TEST_USE_UNIX_SOCKETS work for tap tests on windows.

commit   : 45f52709d86ceaaf282a440f6311c51fc526340b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Dec 2021 11:17:41 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Dec 2021 11:17:41 -0800    

Click here for diff

We need to replace windows-style \ path separators with / when putting socket  
directories either in postgresql.conf or libpq connection strings, otherwise  
they are interpreted as escapes.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Remove InitXLOGAccess().

commit   : fa0e03c15a9f67671f0a6e0ec66d5e2ac7119c8a    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Dec 2021 09:58:36 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Dec 2021 09:58:36 -0500    

Click here for diff

It's not great that RecoveryInProgress() calls InitXLOGAccess(),  
because a status inquiry function typically shouldn't have the side  
effect of performing initializations. We could fix that by calling  
InitXLOGAccess() from some other place, but instead, let's remove it  
altogether.  
  
One thing InitXLogAccess() did is initialize wal_segment_size, but it  
doesn't need to do that. In the postmaster, PostmasterMain() calls  
LocalProcessControlFile(), and all child processes will inherit that  
value -- except in EXEC_BACKEND bulds, but then each backend runs  
SubPostmasterMain() which also calls LocalProcessControlFile().  
  
The other thing InitXLOGAccess() did is update RedoRecPtr and  
doPageWrites, but that's not critical, because all code that uses  
them will just retry if it turns out that they've changed. The  
only difference is that most code will now see an initial value that  
is definitely invalid instead of one that might have just been way  
out of date, but that will only happen once per backend lifetime,  
so it shouldn't be a big deal.  
  
Patch by me, reviewed by Nathan Bossart, Michael Paquier, Andres  
Freund, Heikki Linnakangas, and Álvaro Herrera.  
  
Discussion: http://postgr.es/m/CA+TgmoY7b65qRjzHN_tWUk8B4sJqk1vj1d31uepVzmgPnZKeLg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/auxprocess.c
M src/backend/utils/init/postinit.c
M src/include/access/xlog.h

Default to log_checkpoints=on, log_autovacuum_min_duration=10m

commit   : 64da07c41a8c0a680460cdafc79093736332b6cf    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 13 Dec 2021 09:48:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 13 Dec 2021 09:48:04 -0500    

Click here for diff

The idea here is that when a performance problem is known to have  
occurred at a certain point in time, it's a good thing if there is  
some information available from the logs to help figure out what  
might have happened around that time.  
  
This change attracted an above-average amount of dissent, because  
it means that a server with default settings will produce some amount  
of log output even if nothing has gone wrong. However, by my count,  
the mailing list discussion had about twice as many people in favor  
of the change as opposed. The reasons for believing that the extra  
log output is not an issue in practice are: (1) the rate at which  
messages can be generated by this setting is bounded to one every  
few minutes on a properly-configured system and (2) production  
systems tend to have a lot more junk in the log from that due to  
failed connection attempts, ERROR messages generated by application  
activity, and the like.  
  
Bharath Rupireddy, reviewed by Fujii Masao and by me. Many other  
people commented on the thread, but as far as I can see that was  
discussion of the merits of the change rather than review of the  
patch.  
  
Discussion: https://postgr.es/m/CALj2ACX-rW_OeDcp4gqrFUAkf1f50Fnh138dmkd0JkvCNQRKGA@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c

Fix alignment in multirange_get_range() function

commit   : 5cc9c8374093ba0e427b3309e10077708c156b6a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 13 Dec 2021 17:17:33 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 13 Dec 2021 17:17:33 +0300    

Click here for diff

The multirange_get_range() function fails when two boundaries of the same  
range have different alignments.  Fix that by adding proper pointer alignment.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/17300-dced2d01ddeb1f2f%40postgresql.org  
Backpatch-through: 14  

M src/backend/utils/adt/multirangetypes.c
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql

Improve description of some WAL records with transaction commands

commit   : c8b733c4c4b0c5b7aa93553aa5b7f2c1d0bf00bf    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Dec 2021 11:02:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Dec 2021 11:02:47 +0900    

Click here for diff

This commit improves the description of some WAL records for the  
Transaction RMGR:  
- Track remote_apply for a transaction commit.  This GUC is  
user-settable, so this information can be useful for debugging.  
- Add replication origin information for PREPARE TRANSACTION, with the  
origin ID, LSN and timestamp  
- Same as above, for ROLLBACK PREPARED.  
  
This impacts the format of pg_waldump or anything using these  
description routines, so no backpatch is done.  
  
Author: Masahiko Sawada, Michael Paquier  
Discussion: https://postgr.es/m/CAD21AoD2dJfgsdxk4_KciAZMZQoUiCvmV9sDpp8ZuKLtKCNXaA@mail.gmail.com  

M src/backend/access/rmgrdesc/xactdesc.c

Create a new type category for "internal use" types.

commit   : 07eee5a0dc642d26f44d65c4e6263304208e8583    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Dec 2021 14:10:51 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Dec 2021 14:10:51 -0500    

Click here for diff

Historically we've put type "char" into the S (String) typcategory,  
although calling it a string is a stretch considering it can only  
store one byte.  (In our actual usage, it's more like an enum.)  
This choice now seems wrong in view of the special heuristics  
that parse_func.c and parse_coerce.c have for TYPCATEGORY_STRING:  
it's not a great idea for "char" to have those preferential casting  
behaviors.  
  
Worse than that, recent patches inventing special-purpose types  
like pg_node_tree have assigned typcategory S to those types,  
meaning they also get preferential casting treatment that's designed  
on the assumption that they can hold arbitrary text.  
  
To fix, invent a new category TYPCATEGORY_INTERNAL for internal-use  
types, and assign that to all these types.  I used code 'Z' for  
lack of a better idea ('I' was already taken).  
  
This change breaks one query in psql/describe.c, which now needs to  
explicitly cast a catalog "char" column to text before concatenating  
it with an undecorated literal.  Also, a test case in contrib/citext  
now needs an explicit cast to convert citext to "char".  Since the  
point of this change is to not have "char" be a surprisingly-available  
cast target, these breakages seem OK.  
  
Per report from Ian Campbell.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M doc/src/sgml/catalogs.sgml
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h

Move test for BRIN HOT behavior to stats.sql

commit   : fe60b67250a31cd1ac2a4882f12e199e30abd316    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 11 Dec 2021 05:20:15 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 11 Dec 2021 05:20:15 +0100    

Click here for diff

The test added by 5753d4ee32 relies on statistics collector, and so it  
may occasionally fail when the UDP packet gets lost. Some machines may  
be susceptible to this, probably depending on load etc.  
  
Move the test to stats.sql, which is known to already have this issue  
and people know to ignore it.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com  

M src/test/regress/expected/brin.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/stats.sql

Add bool to btree_gist documentation

commit   : 4c6145b514fa62535f8a5029283de3a54d9cfd53    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 11 Dec 2021 04:59:15 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 11 Dec 2021 04:59:15 +0100    

Click here for diff

Commit 57e3c516 added bool opclass to btree_gist, but update the list of  
data types in docs to reflect this change.  
  
Reported-by: Pavel Luzanov  
Discussion: https://postgr.es/m/CAE2gYzyDKJBZngssR84VGZEN=Ux=V9FV23QfPgo+7-yYnKKg4g@mail.gmail.com  

M doc/src/sgml/btree-gist.sgml

Check for STATUS_DELETE_PENDING on Windows.

commit   : e2f0f8ed251d02c1eda79e1ca3cb3db2681e7a86    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 10 Dec 2021 16:13:14 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 10 Dec 2021 16:13:14 +1300    

Click here for diff

1.  Update our open() wrapper to check for NT's STATUS_DELETE_PENDING  
and translate it to Unix-like errors.  This is done with  
RtlGetLastNtStatus(), which is dynamically loaded from ntdll.  A new  
file win32ntdll.c centralizes lookup of NT functions, in case we decide  
to add more in the future.  
  
2.  Remove non-working code that was trying to do something similar for  
stat(), and just reuse the open() wrapper code.  As a side effect,  
stat() also gains resilience against "sharing violation" errors.  
  
3.  Since stat() is used very early in process startup, remove the  
requirement that the Win32 signal event has been created before  
pgwin32_open_handle() is reached.  Instead, teach pg_usleep() to fall  
back to a non-interruptible sleep if reached before the signal event is  
available.  
  
This could be back-patched, but for now it's in master only.  The  
problem has apparently been with us for a long time and generated only a  
few complaints.  Proposed patches trigger it more often, which led to  
this investigation and fix.  
  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Juan José Santamaría Flecha <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJz_pZTF9mckn6XgSv69%2BjGwdgLkxZ6b3NWGLBCVjqUZA%40mail.gmail.com  

M configure
M configure.ac
M src/backend/port/win32/signal.c
M src/include/port.h
A src/include/port/win32ntdll.h
M src/port/open.c
A src/port/win32ntdll.c
M src/port/win32stat.c
M src/tools/msvc/Mkvcbuild.pm

Fix some typos with {a,an}

commit   : 5d08137076fd39694188ec4625013756aab889e1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Dec 2021 15:20:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Dec 2021 15:20:36 +0900    

Click here for diff

One of the changes impacts the documentation, so backpatch.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pu6+c+r3mY24VT7u+H+E_s6vMr5OdRiZ8NT3EOa-E5Lmw@mail.gmail.com  
Backpatch-through: 14  

M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/ecpg.sgml
M src/backend/access/table/toast_helper.c
M src/backend/catalog/pg_depend.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/replication/logical/reorderbuffer.c

Fix double publish of child table's data.

commit   : 5e97905a2c764d4ca36f5c6cccd0ebbf157b9df4    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 9 Dec 2021 08:36:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 9 Dec 2021 08:36:59 +0530    

Click here for diff

We publish the child table's data twice for a publication that has both  
child and parent tables and is published with publish_via_partition_root  
as true. This happens because subscribers will initiate synchronization  
using both parent and child tables, since it gets both as separate tables  
in the initial table list.  
  
Ensure that pg_publication_tables returns only parent tables in such  
cases.  
  
Author: Hou Zhijie  
Reviewed-by: Greg Nancarrow, Amit Langote, Vignesh C, Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/OS0PR01MB57167F45D481F78CDC5986F794B99@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/catalog/pg_publication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
M src/test/subscription/t/013_partition.pl

Standardize cleanup lock terminology.

commit   : bcf60585e6e0e95f0b9e5d64c7a6edca99ec6e86    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 8 Dec 2021 17:24:45 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 8 Dec 2021 17:24:45 -0800    

Click here for diff

The term "super-exclusive lock" is a synonym for "buffer cleanup lock"  
that first appeared in nbtree many years ago.  Standardize things by  
consistently using the term cleanup lock.  This finishes work started by  
commit 276db875.  
  
There is no good reason to have two terms.  But there is a good reason  
to only have one: to avoid confusion around why VACUUM acquires a full  
cleanup lock (not just an ordinary exclusive lock) in index AMs, during  
ambulkdelete calls.  This has nothing to do with protecting the physical  
index data structure itself.  It is needed to implement a locking  
protocol that ensures that TIDs pointing to the heap/table structure  
cannot get marked for recycling by VACUUM before it is safe (which is  
somewhat similar to how VACUUM uses cleanup locks during its first heap  
pass).  Note that it isn't strictly necessary for index AMs to implement  
this locking protocol -- several index AMs use an MVCC snapshot as their  
sole interlock to prevent unsafe TID recycling.  
  
In passing, update the nbtree README.  Cleanly separate discussion of  
the aforementioned index vacuuming locking protocol from discussion of  
the "drop leaf page pin" optimization added by commit 2ed5b87f.  We now  
structure discussion of the latter by describing how individual index  
scans may safely opt out of applying the standard locking protocol (and  
so can avoid blocking progress by VACUUM).  Also document why the  
optimization is not safe to apply during nbtree index-only scans.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzngHgQa92tz6NQihf4nxJwRzCV36yMJO_i8dS+2mgEVKw@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-WzkHPgsBBvGWjz=8PjNhDefy7XRkDKiT5NxMs-n5ZCf2dA@mail.gmail.com  

M src/backend/access/gin/README
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/storage/page/bufpage.c
M src/include/access/heapam_xlog.h

Doc: improve xfunc-c-type-table.

commit   : 6f0e6ab04de5f52e4e0872d3ace2bb6a35e8b0b1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Dec 2021 16:54:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Dec 2021 16:54:31 -0500    

Click here for diff

List types numeric and timestamptz, which don't seem to have ever been  
included here.  Restore bigint, which was no-doubt-accidentally deleted  
in v12.  Fix some errors, or at least obsolete usages (nobody declares  
float arguments as "float8*" anymore, even though they might be that  
under the hood).  Re-alphabetize.  Remove the seeming claim that this  
is a complete list of built-in types.  
  
Per question from Oskar Stenberg.  
  
Discussion: https://postgr.es/m/HE1PR03MB2971DE2527ECE1E99D6C19A8F96E9@HE1PR03MB2971.eurprd03.prod.outlook.com  

M doc/src/sgml/xfunc.sgml

Revert "Check that we have a working tar before trying to use it"

commit   : 745b99c6444f00befae77dc69c7a63529d751daf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 8 Dec 2021 16:45:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 8 Dec 2021 16:45:39 -0500    

Click here for diff

This reverts commit f920f7e799c587228227ec94356c760e3f3d5f2b.  
  
The patch in effect fixed a problem we didn't have and caused another  
instead.  
  
Backpatch to release 14 like original  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Check that we have a working tar before trying to use it

commit   : f920f7e799c587228227ec94356c760e3f3d5f2b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 8 Dec 2021 10:21:35 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 8 Dec 2021 10:21:35 -0500    

Click here for diff

Issue exposed by commit edc2332550 and the buildfarm.  
  
Backpatch to release 14 where this usage started.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

postgres_fdw: Report warning when timeout expires while getting query result.

commit   : 815d61fcd485e8c60dba22988bf5a90fc12df32d    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Dec 2021 23:31:46 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Dec 2021 23:31:46 +0900    

Click here for diff

When aborting remote transaction or sending cancel request to a remote server,  
postgres_fdw calls pgfdw_get_cleanup_result() to wait for the result of  
transaction abort query or cancel request to arrive. It fails to get the result  
if the timeout expires or a connection trouble happens.  
  
Previously postgres_fdw reported no warning message even when the timeout  
expired or a connection trouble happened in pgfdw_get_cleanup_result().  
This could make the troubleshooting harder when such an event occurred.  
  
This commit makes pgfdw_get_cleanup_result() tell its caller what trouble  
(timeout or connection error) occurred, on failure, and also makes its caller  
report the proper warning message based on that information.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c

Allow specifying column list for foreign key ON DELETE SET actions

commit   : d6f96ed94e73052f99a2e545ed17a8b2fdc1fb8a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 11:09:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 11:09:44 +0100    

Click here for diff

Extend the foreign key ON DELETE actions SET NULL and SET DEFAULT by  
allowing the specification of a column list, like  
  
    CREATE TABLE posts (  
        ...  
        FOREIGN KEY (tenant_id, author_id) REFERENCES users ON DELETE SET NULL (author_id)  
    );  
  
If a column list is specified, only those columns are set to  
null/default, instead of all the columns in the foreign-key  
constraint.  
  
This is useful for multitenant or sharded schemas, where the tenant or  
shard ID is included in the primary key of all tables but shouldn't be  
set to null.  
  
Author: Paul Martinez <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CACqFVBZQyMYJV=njbSMxf+rbDHpx=W=B7AEaMKn8dWn9OZJY7w@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_constraint.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix origin timestamp during decoding of ROLLBACK PREPARED operation.

commit   : e464cb7af317e216fef9bfe19a7c4df542817012    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 15:18:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 15:18:56 +0530    

Click here for diff

This happens because we were passing incorrect arguments to  
ReorderBufferFinishPrepared().  
  
Author: Masahiko Sawada  
Reviewed-by: Vignesh C  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CAD21AoBqhUqgDZUhUVnnwKRubPDNJ6m6fJDPgok3E5cWJLL+pA@mail.gmail.com  

M src/backend/replication/logical/decode.c

pgrowlocks: Fix incorrect format placeholders

commit   : 254c63e9eda0b006fb61b9dc23970a6381efd061    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 09:27:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 09:27:15 +0100    

Click here for diff

Transaction IDs should be printed as unsigned, similar to xidout().  

M contrib/pgrowlocks/pgrowlocks.c

Fix changing the ownership of ALL TABLES IN SCHEMA publication.

commit   : 1a2aaeb0db1bccd97140d479c4247127f6cb9378    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 11:31:16 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 11:31:16 +0530    

Click here for diff

Ensure that the new owner of ALL TABLES IN SCHEMA publication must be a  
superuser. The same is already ensured during CREATE PUBLICATION.  
  
Author: Vignesh C  
Reviewed-by: Nathan Bossart, Greg Nancarrow, Michael Paquier, Haiying Tang  
Discussion: https://postgr.es/m/CALDaNm0E5U-RqxFuFrkZrQeG7ae5trGa=xs=iRtPPHULtT4zOw@mail.gmail.com  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/include/catalog/pg_publication.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

De-duplicate the result of pg_publication_tables view.

commit   : a61bff2bf479cfebda18a1655323eec1b19370de    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 11:15:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Dec 2021 11:15:25 +0530    

Click here for diff

We show duplicate values for child tables in publications that have both  
child and parent tables and are published with publish_via_partition_root  
as false which is not what the user would expect.  
  
We decided not to backpatch this as there is no user complaint about this  
and it doesn't seem to be a critical issue.  
  
Author: Hou Zhijie  
Reviewed-by: Bharath Rupireddy, Amit Langote, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716E97F00732B52DC2BBC2594989@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/catalog/pg_publication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

pgcrypto: Remove explicit hex encoding/decoding from tests

commit   : 814e1d9ff7a853b16a544a244bfa92e8388be248    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 06:01:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Dec 2021 06:01:35 +0100    

Click here for diff

This was from before the hex format was available in bytea.  Now we  
can remove the extra explicit encoding/decoding calls and rely on the  
default output format.  
  
Discussion: https://www.postgresql.org/message-id/flat/17dcb4f7-7ac1-e2b6-d5f7-2dfba06cd9ee%40enterprisedb.com  

M contrib/pgcrypto/expected/3des.out
M contrib/pgcrypto/expected/blowfish.out
M contrib/pgcrypto/expected/blowfish_1.out
M contrib/pgcrypto/expected/cast5.out
M contrib/pgcrypto/expected/cast5_1.out
M contrib/pgcrypto/expected/des.out
M contrib/pgcrypto/expected/des_1.out
M contrib/pgcrypto/expected/hmac-md5.out
M contrib/pgcrypto/expected/hmac-sha1.out
M contrib/pgcrypto/expected/init.out
M contrib/pgcrypto/expected/md5.out
M contrib/pgcrypto/expected/pgp-armor.out
M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/expected/pgp-encrypt.out
M contrib/pgcrypto/expected/pgp-pubkey-encrypt.out
M contrib/pgcrypto/expected/rijndael.out
M contrib/pgcrypto/expected/sha1.out
M contrib/pgcrypto/expected/sha2.out
M contrib/pgcrypto/sql/3des.sql
M contrib/pgcrypto/sql/blowfish.sql
M contrib/pgcrypto/sql/cast5.sql
M contrib/pgcrypto/sql/des.sql
M contrib/pgcrypto/sql/hmac-md5.sql
M contrib/pgcrypto/sql/hmac-sha1.sql
M contrib/pgcrypto/sql/init.sql
M contrib/pgcrypto/sql/md5.sql
M contrib/pgcrypto/sql/pgp-armor.sql
M contrib/pgcrypto/sql/pgp-decrypt.sql
M contrib/pgcrypto/sql/pgp-encrypt.sql
M contrib/pgcrypto/sql/pgp-pubkey-encrypt.sql
M contrib/pgcrypto/sql/rijndael.sql
M contrib/pgcrypto/sql/sha1.sql
M contrib/pgcrypto/sql/sha2.sql

Improve parsing of options of CREATE/ALTER SUBSCRIPTION

commit   : 00029deaf65aad47044d9290fe80f2f68601f7ac    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Dec 2021 12:36:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Dec 2021 12:36:31 +0900    

Click here for diff

This simplifies the code so as it is not necessary anymore for the  
caller of parse_subscription_options() to zero SubOpts, holding a  
bitmaps of the provided options as well as the default/parsed option  
values.  This also simplifies some checks related to the options  
supported by a command when checking for incompatibilities.  
  
While on it, the errors generated for unsupported combinations with  
"slot_name = NONE" are reordered.  This may generate a different errors  
compared to the previous major versions, but users have to go through  
all those errors to get a correct command in this case when using  
incorrect values for options "enabled" and "create\slot", so at the end  
the resulting command would remain the same.  
  
Author: Peter Smith  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CAHut+PtXHfLgLHDDJ8ZN5f5Be_37mJoxpEsRg8LNmm4XCr06Rw@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Fix corruption of toast indexes with REINDEX CONCURRENTLY

commit   : f99870dd867331f576a84e37438da86a866559c4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Dec 2021 11:01:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Dec 2021 11:01:08 +0900    

Click here for diff

REINDEX CONCURRENTLY run on a toast index or a toast relation could  
corrupt the target indexes rebuilt, as a backend running in parallel  
that manipulates toast values would directly release the lock on the  
toast relation when its local operation is done, rather than releasing  
the lock once the transaction that manipulated the toast values  
committed.  
  
The fix done here is simple: we now hold a ROW EXCLUSIVE lock on the  
toast relation when saving or deleting a toast value until the  
transaction working on them is committed, so as a concurrent reindex  
happening in parallel would be able to wait for any activity and see any  
new rows inserted (or deleted).  
  
An isolation test is added to check after the case fixed here, which is  
a bit fancy by design as it relies on allow_system_table_mods to rename  
the toast table and its index to fixed names.  This way, it is possible  
to reindex them directly without any dependency on the OID of the  
underlying relation.  Note that this could not use a DO block either, as  
REINDEX CONCURRENTLY cannot be run in a transaction block.  The test is  
backpatched down to 13, where it is possible, thanks to c4a7a39, to use  
allow_system_table_mods in a test suite.  
  
Reported-by: Alexey Ermakov  
Analyzed-by: Andres Freund, Noah Misch  
Author: Michael Paquier  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/access/common/toast_internals.c
A src/test/isolation/expected/reindex-concurrently-toast.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/reindex-concurrently-toast.spec

Enable settings used in TAP tests for MSVC builds

commit   : edc2332550b2343bc9378540e11c8aa71f513a63    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 7 Dec 2021 14:53:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 7 Dec 2021 14:53:39 -0500    

Click here for diff

Certain settings from configuration or the Makefile infrastructure are  
used by the TAP tests, but were not being set up by vcregress.pl. This  
remedies those omissions. This should increase test coverage, especially  
on the buildfarm.  
  
Reviewed by Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches.  

M src/tools/msvc/vcregress.pl

On Windows, also call shutdown() while closing the client socket.

commit   : ed52c3707bcf8858defb0d9de4b55f5c7f18fed7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 7 Dec 2021 13:34:06 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 7 Dec 2021 13:34:06 -0500    

Click here for diff

Further experimentation shows that commit 6051857fc is not sufficient  
when using (some versions of?) OpenSSL.  The reason is obscure, but  
calling shutdown(socket, SD_SEND) improves matters.  
  
Per testing by Andrew Dunstan and Alexander Lakhin.  
Back-patch as before.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pqcomm.c

Update snowball

commit   : bba962f0c052bfab79df79ac5629eac5eab5b842    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 7 Dec 2021 06:26:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 7 Dec 2021 06:26:05 +0100    

Click here for diff

Update to snowball tag v2.2.0.  Minor changes only.  

M src/backend/snowball/README
M src/backend/snowball/libstemmer/stem_ISO_8859_1_basque.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_catalan.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_indonesian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_irish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_swedish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_2_hungarian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_2_romanian.c
M src/backend/snowball/libstemmer/stem_KOI8_R_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_arabic.c
M src/backend/snowball/libstemmer/stem_UTF_8_armenian.c
M src/backend/snowball/libstemmer/stem_UTF_8_basque.c
M src/backend/snowball/libstemmer/stem_UTF_8_catalan.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_dutch.c
M src/backend/snowball/libstemmer/stem_UTF_8_english.c
M src/backend/snowball/libstemmer/stem_UTF_8_finnish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_german.c
M src/backend/snowball/libstemmer/stem_UTF_8_greek.c
M src/backend/snowball/libstemmer/stem_UTF_8_hindi.c
M src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c
M src/backend/snowball/libstemmer/stem_UTF_8_indonesian.c
M src/backend/snowball/libstemmer/stem_UTF_8_irish.c
M src/backend/snowball/libstemmer/stem_UTF_8_italian.c
M src/backend/snowball/libstemmer/stem_UTF_8_lithuanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_nepali.c
M src/backend/snowball/libstemmer/stem_UTF_8_norwegian.c
M src/backend/snowball/libstemmer/stem_UTF_8_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c
M src/backend/snowball/libstemmer/stem_UTF_8_romanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_serbian.c
M src/backend/snowball/libstemmer/stem_UTF_8_spanish.c
M src/backend/snowball/libstemmer/stem_UTF_8_swedish.c
M src/backend/snowball/libstemmer/stem_UTF_8_tamil.c
M src/backend/snowball/libstemmer/stem_UTF_8_turkish.c
M src/backend/snowball/libstemmer/stem_UTF_8_yiddish.c
M src/include/snowball/libstemmer/stem_ISO_8859_1_basque.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_catalan.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_danish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_dutch.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_english.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_finnish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_french.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_german.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_indonesian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_irish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_italian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_norwegian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_portuguese.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_spanish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_swedish.h
M src/include/snowball/libstemmer/stem_ISO_8859_2_hungarian.h
M src/include/snowball/libstemmer/stem_ISO_8859_2_romanian.h
M src/include/snowball/libstemmer/stem_KOI8_R_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_arabic.h
M src/include/snowball/libstemmer/stem_UTF_8_armenian.h
M src/include/snowball/libstemmer/stem_UTF_8_basque.h
M src/include/snowball/libstemmer/stem_UTF_8_catalan.h
M src/include/snowball/libstemmer/stem_UTF_8_danish.h
M src/include/snowball/libstemmer/stem_UTF_8_dutch.h
M src/include/snowball/libstemmer/stem_UTF_8_english.h
M src/include/snowball/libstemmer/stem_UTF_8_finnish.h
M src/include/snowball/libstemmer/stem_UTF_8_french.h
M src/include/snowball/libstemmer/stem_UTF_8_german.h
M src/include/snowball/libstemmer/stem_UTF_8_greek.h
M src/include/snowball/libstemmer/stem_UTF_8_hindi.h
M src/include/snowball/libstemmer/stem_UTF_8_hungarian.h
M src/include/snowball/libstemmer/stem_UTF_8_indonesian.h
M src/include/snowball/libstemmer/stem_UTF_8_irish.h
M src/include/snowball/libstemmer/stem_UTF_8_italian.h
M src/include/snowball/libstemmer/stem_UTF_8_lithuanian.h
M src/include/snowball/libstemmer/stem_UTF_8_nepali.h
M src/include/snowball/libstemmer/stem_UTF_8_norwegian.h
M src/include/snowball/libstemmer/stem_UTF_8_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_portuguese.h
M src/include/snowball/libstemmer/stem_UTF_8_romanian.h
M src/include/snowball/libstemmer/stem_UTF_8_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_serbian.h
M src/include/snowball/libstemmer/stem_UTF_8_spanish.h
M src/include/snowball/libstemmer/stem_UTF_8_swedish.h
M src/include/snowball/libstemmer/stem_UTF_8_tamil.h
M src/include/snowball/libstemmer/stem_UTF_8_turkish.h
M src/include/snowball/libstemmer/stem_UTF_8_yiddish.h

Account for TOAST data while scheduling parallel dumps.

commit   : 65aaed22a849c0763f38f81338a1cad04ffc0e2c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:23:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:23:07 -0500    

Click here for diff

In parallel mode, pg_dump tries to order the table-data-dumping  
jobs with the largest tables first.  However, it was only  
consulting the pg_class.relpages value to determine table size.  
This ignores TOAST data, and so we could make poor scheduling  
decisions in cases where some large tables are mostly TOASTed  
data while others have very little.  To fix, add in the relpages  
value for the TOAST table as well.  
  
This patch also fixes a potential integer-overflow issue that  
could result in poor scheduling on machines where off_t is  
only 32 bits wide.  Such platforms are probably extinct in the  
wild, but we do still nominally support them, so repair.  
  
Per complaint from Hans Buschmann.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Use PREPARE/EXECUTE for repetitive per-object queries in pg_dump.

commit   : be85727a3df743a1f7e93b41dd7ac2b667e8ae04    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:14:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:14:29 -0500    

Click here for diff

For objects such as functions, pg_dump issues the same secondary  
data-collection query against each object to be dumped.  This can't  
readily be refactored to avoid the repetitive queries, but we can  
PREPARE these queries to reduce planning costs.  
  
This patch applies the idea to functions, aggregates, operators, and  
data types.  While it could be carried further, the remaining sorts of  
objects aren't likely to appear in typical databases enough times to  
be worth worrying over.  Moreover, doing the PREPARE is likely to be a  
net loss if there aren't at least some dozens of objects to apply the  
prepared query to.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c

Avoid per-object queries in performance-critical paths in pg_dump.

commit   : 9895961529ef8ff3fc12b39229f9a93e08bca7b7    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:07:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 13:07:31 -0500    

Click here for diff

Instead of issuing a secondary data-collection query against each  
table to be dumped, issue just one query, with a WHERE clause  
restricting it to be applied to only the tables we intend to dump.  
Likewise for indexes, constraints, and triggers.  This greatly  
reduces the number of queries needed to dump a database containing  
many tables.  It might seem that WHERE clauses listing many target  
OIDs could be inefficient, but at least on recent server versions  
this provides a very substantial speedup.  
  
(In principle the same thing could be done with other object types  
such as functions; but that would require significant refactoring  
of pg_dump, so those will be tackled in a different way in a  
following patch.)  
  
The new WHERE clauses depend on the unnest() function, which is  
only present in 8.4 and above.  We could implement them differently  
for older servers, but there is an ongoing discussion that will  
probably result in dropping pg_dump support for servers before 9.2,  
so that seems like it'd be wasted work.  For now, just bump the  
server version check to require >= 8.4, without stopping to remove  
any of the code that's thereby rendered dead.  We'll mop that  
situation up soon.  
  
Patch by me, based on an idea from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c

Postpone calls of unsafe server-side functions in pg_dump.

commit   : e3fcbbd623b9ccc16cdbda374654d91a4727d173    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:49:49 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:49:49 -0500    

Click here for diff

Avoid calling pg_get_partkeydef(), pg_get_expr(relpartbound),  
and regtypeout until we have lock on the relevant tables.  
The existing coding is at serious risk of failure if there  
are any concurrent DROP TABLE commands going on --- including  
drops of other sessions' temp tables.  
  
Arguably this is a bug fix that should be back-patched, but it's  
moderately invasive and we've not had all that many complaints  
about such failures.  Let's just put it in HEAD for now.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Rethink pg_dump's handling of object ACLs.

commit   : 0c9d84427f441602425b0e18be5cfe751d1d8ebe    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:39:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:39:45 -0500    

Click here for diff

Throw away most of the existing logic for this, as it was very  
inefficient thanks to expensive sub-selects executed to collect  
ACL data that we very possibly would have no interest in dumping.  
Reduce the ACL handling in the initial per-object-type queries  
to be just collection of the catalog ACL fields, as it was  
originally.  Fetch pg_init_privs data separately in a single  
scan of that catalog, and do the merging calculations on the  
client side.  Remove the separate code path used for pre-9.6  
source servers; there is no good reason to treat them differently  
from newer servers that happen to have empty pg_init_privs.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h

Refactor pg_dump's tracking of object components to be dumped.

commit   : 5209c0ba0bfd16f23e38f707e487c0626e70564c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:25:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Dec 2021 12:25:48 -0500    

Click here for diff

Split the DumpableObject.dump bitmask field into separate bitmasks  
tracking which components are requested to be dumped (in the  
existing "dump" field) and which components exist for the particular  
object (in the new "components" field).  This gets rid of some  
klugy and easily-broken logic that involved setting bits and later  
clearing them.  More importantly, it restores the originally intended  
behavior that pg_dump's secondary data-gathering queries should not  
be executed for objects we have no interest in dumping.  That  
optimization got broken when the dump flag was turned into a bitmask,  
because irrelevant bits tended to remain set in many cases.  Since  
the "components" field starts from a minimal set of bits and is  
added onto as needed, ANDing it with "dump" provides a reliable  
indicator of what we actually have to dump, without having to  
complicate the logic that manages the request bits.  This makes  
a significant difference in the number of queries needed when,  
for example, there are many functions in extensions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Fix inappropriate uses of PG_GETARG_UINT32()

commit   : e9e63b7022ddd0aaaae7cd439daa234cf9e6a21c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Dec 2021 13:26:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Dec 2021 13:26:50 +0100    

Click here for diff

The chr() function used PG_GETARG_UINT32() even though the argument is  
declared as (signed) integer.  As a result, you can pass negative  
arguments to this function and it internally interprets them as  
positive.  Ultimately ends up being harmless, but it seems wrong, so  
fix this and rearrange the internal error checking a bit to  
accommodate this.  
  
Another case was in the documentation, where example code used  
PG_GETARG_UINT32() with an argument declared as signed integer.  
  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/7e43869b-d412-8f81-30a3-809783edc9a3%40enterprisedb.com  

M doc/src/sgml/xfunc.sgml
M src/backend/utils/adt/oracle_compat.c

Silence perl complaint in ssl test

commit   : d4596a20d046e800644d6027613c6a2cb5a6c35e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 5 Dec 2021 11:50:03 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 5 Dec 2021 11:50:03 -0500    

Click here for diff

Perl's hex() function complains if its argument contains trailing white  
space (or in fact anything other than hex digits), so remove the  
offending text.  

M src/test/ssl/t/001_ssltests.pl

Doc: Fix misleading wording of CRL parameters

commit   : fadac33bb8de1cb9005aed07cdd059ba1fa9c6f8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 3 Dec 2021 14:15:50 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 3 Dec 2021 14:15:50 +0100    

Click here for diff

ssl_crl_file and ssl_crl_dir are both used to for client certificate  
revocation, not server certificates.  The description for the params  
could be easily misread to mean the opposite however,  as evidenced  
by the bugreport leading to this fix.  Similarly, expand sslcrl and  
and sslcrldir to explicitly mention server certificates. While there  
also mention sslcrldir where previously only sslcrl was discussed.  
  
Backpatch down to v10, with the CRL dir fixes down to 14 where they  
were introduced.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CABWY_HCBUCjY1EJHrEGePGEaSZ5b29apgTohCyygtsqe_ySYng@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml

Some RELKIND macro refactoring

commit   : 37b2764593c073ca61c2baebd7d85666e553928b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Dec 2021 13:38:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Dec 2021 13:38:26 +0100    

Click here for diff

Add more macros to group some RELKIND_* macros:  
  
- RELKIND_HAS_PARTITIONS()  
- RELKIND_HAS_TABLESPACE()  
- RELKIND_HAS_TABLE_AM()  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/a574c8f1-9c84-93ad-a9e5-65233d6fc00f%40enterprisedb.com  

M contrib/amcheck/verify_heapam.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/pg_class.h

Fix path delimiters in connection string on Windows

commit   : 49422ad0cc88c91a38522b2a7b222c2f2c939f82    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 3 Dec 2021 11:41:17 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 3 Dec 2021 11:41:17 +0100    

Click here for diff

The temporary path generated in commit c113d8ad5 cannot be passed as-is in  
the connection string on Windows since the path delimiting backslashes will  
be treated as escape characters. Fix by converting backslash to slash as in  
similar path usecases in other tests.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

postgres_fdw: Fix unexpected reporting of empty message.

commit   : 557c39bba925d553c6bb12b5e80d1964d355583b    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 3 Dec 2021 17:35:29 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 3 Dec 2021 17:35:29 +0900    

Click here for diff

pgfdw_report_error() in postgres_fdw gets a message from PGresult or  
PGconn to report an error received from a remote server. Previously  
if it could get a message from neither of them, it reported empty  
message unexpectedly. The cause of this issue was that pgfdw_report_error()  
didn't handle properly the case where no message could be obtained  
and its local variable message_primary was set to '\0'.  
  
This commit improves pgfdw_report_error() so that it reports the message  
"could not obtain ..." when it gets no message and message_primary  
is set to '\0'. This is the same behavior as when message_primary is NULL.  
  
dblink_res_error() in dblink has the same issue, so this commit also  
improves it in the same way.  
  
Back-patch to all supported branches.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c

Improve the description of various GUCs

commit   : 03774f9bb304d49fae3379806115aaa5d1fafea2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 3 Dec 2021 09:39:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 3 Dec 2021 09:39:03 +0900    

Click here for diff

This commit fixes a couple of inconsistencies in the descriptions of  
some GUCs, while making their wording more general regarding the units  
they rely on.  
  
For most of them, this removes the use of terms like "N seconds" or "N  
bytes", which may not apply easily to all the languages these strings  
are translated to (from my own experience, this works in French and  
English, less in Japanese).  
  
Per debate between the authors listed below.  
  
Author: Justin Pryzby, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c

On Windows, close the client socket explicitly during backend shutdown.

commit   : 6051857fc953a62db318329c4ceec5f9668fd42a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Dec 2021 17:14:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Dec 2021 17:14:43 -0500    

Click here for diff

It turns out that this is necessary to keep Winsock from dropping any  
not-yet-sent data, such as an error message explaining the reason for  
process termination.  It's pretty weird that the implicit close done  
by the kernel acts differently from an explicit close, but it's hard  
to argue with experimental results.  
  
Independently submitted by Alexander Lakhin and Lars Kanis (comments  
by me, though).  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/pqcomm.c

Add configure probe for rl_variable_bind().

commit   : a7da41981021575e2359683d994eec6c9d246321    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Dec 2021 13:06:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Dec 2021 13:06:27 -0500    

Click here for diff

Some exceedingly ancient readline libraries lack this function, causing  
commit 3d858af07 to fail.  Per buildfarm (via Michael Paquier).  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/bin/psql/input.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

pg_dump: Add missing relkind case

commit   : a22d6a2cb62c4fc6d7c4b077d8014fd4ffaec426    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 2 Dec 2021 16:46:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 2 Dec 2021 16:46:28 +0100    

Click here for diff

Checking for RELKIND_MATVIEW was forgotten in  
guessConstraintInheritance().  This isn't a live problem, since it is  
checked in flagInhTables() which relkinds can have parents, and those  
entries will have numParents==0 after that.  But after discussion it  
was felt that this place should be kept consistent with  
flagInhTables() and flagInhAttrs().  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/bin/pg_dump/pg_dump.c

pg_waldump: Emit stats summary when interrupted by SIGINT

commit   : f2c52eeba919a1b191f60445001371bd7c53aaa9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Dec 2021 13:52:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Dec 2021 13:52:16 +0900    

Click here for diff

Previously, pg_waldump would not display its statistics summary if it  
got interrupted by SIGINT (or say a simple Ctrl+C).  It gains with this  
commit a signal handler for SIGINT, trapping the signal to exit at the  
earliest convenience to allow a display of the stats summary before  
exiting.  This makes the reports more interactive, similarly to strace  
-c.  
  
This new behavior makes the combination of the options --stats and  
--follow much more useful, so as the user will get a report for any  
invocation of pg_waldump in such a case.  Information about the LSN  
range of the stats computed is added as a header to the report  
displayed.  
  
This implementation comes from a suggestion by Álvaro Herrera and  
myself, following a complaint by the author of this patch about --stats  
and --follow not being useful together originally.  
  
As documented, this is not supported on Windows, though its support  
would be possible by catching the terminal events associated to Ctrl+C,  
for example (this may require a more centralized implementation, as  
other tools could benefit from a common API).  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACUUx3PcK2z9h0_m7vehreZAUbcmOky9WSEpe8TofhV=PQ@mail.gmail.com  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Move into separate file all the SQL queries used in pg_upgrade tests

commit   : 0df9641d39057f431655b92b8a490b89c508a0b3    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Dec 2021 10:31:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Dec 2021 10:31:20 +0900    

Click here for diff

The existing pg_upgrade/test.sh and the buildfarm code have been holding  
the same set of SQL queries when doing cross-version upgrade tests to  
adapt the objects created by the regression tests before the upgrade  
(mostly, incompatible or non-existing objects need to be dropped from  
the origin, perhaps re-created).  
  
This moves all those SQL queries into a new, separate, file with a set  
of \if clauses to handle the version checks depending on the old version  
of the cluster to-be-upgraded.  
  
The long-term plan is to make the buildfarm code re-use this new SQL  
file, so as committers are able to fix any compatibility issues in the  
tests of pg_upgrade with a refresh of the core code, without having to  
poke at the buildfarm client.  Note that this is only able to handle the  
main regression test suite, and that nothing is done yet for contrib  
modules yet (these have more issues like their database names).  
  
A backpatch down to 10 is done, adapting the version checks as this  
script needs to be only backward-compatible, so as it becomes possible  
to clean up a maximum amount of code within the buildfarm client.  
  
Author: Justin Pryzby, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_upgrade/test.sh
A src/bin/pg_upgrade/upgrade_adapt.sql

Avoid leaking memory during large-scale REASSIGN OWNED BY operations.

commit   : babe545caeba4c62feb3030940d93432721eea57    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 13:44:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 13:44:46 -0500    

Click here for diff

The various ALTER OWNER routines tend to leak memory in  
CurrentMemoryContext.  That's not a problem when they're only called  
once per command; but in this usage where we might be touching many  
objects, it can amount to a serious memory leak.  Fix that by running  
each call in a short-lived context.  
  
(DROP OWNED BY likely has a similar issue, except that you'll probably  
run out of lock table space before noticing.  REASSIGN is worth fixing  
since for most non-table object types, it won't take any lock.)  
  
Back-patch to all supported branches.  Unfortunately, in the back  
branches this helps to only a limited extent, since the sinval message  
queue bloats quite a lot in this usage before commit 3aafc030a,  
consuming memory more or less comparable to what's actually leaked.  
Still, it's clearly a leak with a simple fix, so we might as well fix it.  
  
Justin Pryzby, per report from Guillaume Lelarge  
  
Discussion: https://postgr.es/m/CAECtzeW2DAoioEGBRjR=CzHP6TdL=yosGku8qZxfX9hhtrBB0Q@mail.gmail.com  

M src/backend/catalog/pg_shdepend.c

psql: initialize comment-begin setting to a useful value by default.

commit   : 3d858af07ee67efda3778bdd655852afabf4a125    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:24:50 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:24:50 -0500    

Click here for diff

Readline's meta-# command is supposed to insert a comment marker  
at the start of the current line.  However, the default marker is  
"#" which is entirely unhelpful for SQL.  Set it to "-- " instead.  
(This setting can still be overridden in one's ~/.inputrc file,  
so this change won't affect people who have already taken steps  
to make the command useful.)  
  
Discussion: https://postgr.es/m/CAJcOf-cAdMVr7azeYR7nWKsNp7qhORzc84rV6d7m7knG5Hrtsw@mail.gmail.com  

M src/bin/psql/input.c

psql: treat "--" comments between queries as separate history entries.

commit   : c2f654930e9f8119b9ed12caab6192d0aafe5ebd    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:18:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:18:25 -0500    

Click here for diff

If we've not yet collected any non-whitespace, non-comment token for a  
new query, flush the current input line to history before reading  
another line.  This aligns psql's history behavior with the observation  
that lines containing only comments are generally not thought of as  
being part of the next query.  psql's prompting behavior is consistent  
with that view, too, since it won't change the prompt until you  
enter something that's neither whitespace nor a "--" comment.  
  
Greg Nancarrow, simplified a bit by me  
  
Discussion: https://postgr.es/m/CAJcOf-cAdMVr7azeYR7nWKsNp7qhORzc84rV6d7m7knG5Hrtsw@mail.gmail.com  

M src/bin/psql/mainloop.c

psql: include intra-query "--" comments in what's sent to the server.

commit   : 83884682f4df96184549b91869a1cf79dafb4f94    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:06:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Dec 2021 12:06:31 -0500    

Click here for diff

psql's lexer has historically deleted dash-dash (single-line) comments  
from what's collected and sent to the server.  This is inconsistent  
with what it does for slash-star comments, and people have complained  
before that they wish such comments would be captured in the server log.  
Undoing the decision completely seems like too big a behavioral change,  
however.  In particular, comments on lines preceding the start of a  
query are generally not thought of as being part of that query.  
  
What we can do to improve the situation is to capture comments that  
are clearly *within* a query, that is after the first non-whitespace,  
non-comment token but before the query's ending semicolon or backslash  
command.  This is a nearly trivial code change, and it affects only a  
few regression test results.  
  
(It is tempting to try to apply the same rule to slash-star comments.  
But it's hard to see how to do that without getting strange history  
behavior for comments that cross lines, especially if the user then  
starts a new query on the same line as the star-slash.  In view of  
the lack of complaints, let's leave that case alone.)  
  
Discussion: https://postgr.es/m/CAJcOf-cAdMVr7azeYR7nWKsNp7qhORzc84rV6d7m7knG5Hrtsw@mail.gmail.com  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M src/fe_utils/psqlscan.l
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/with.out

Remove unused includes

commit   : 89d1c15d64602b0c27ed87c717f586ddf6cf310d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 12:30:23 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 12:30:23 +0100    

Click here for diff

These haven't been needed for a long time.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/adt/cash.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c

Improve some comments in scanner files

commit   : fb7f70112fd80f13a8f124f51c4992fe290d3836    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 09:10:32 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 09:10:32 +0100    

Click here for diff

Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l

Warning on SET of nonexisting setting with a prefix reserved by an extension

commit   : 75d22069e00d638d08c04e3aba71688f3fb002ed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Dec 2021 15:07:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Dec 2021 15:07:29 +0100    

Click here for diff

An extension can already de facto reserve a GUC prefix using  
EmitWarningsOnPlaceholders().  But this was only checked against  
settings that exist at the time the extension is loaded (or the  
extension chooses to call this).  No diagnostic is given when a SET  
command later uses a nonexisting setting with a custom prefix.  
  
With this change, EmitWarningsOnPlaceholders() saves the prefixes it  
reserves in a list, and SET checks when it finds a "placeholder"  
setting whether it belongs to a reserved prefix and issues a warning  
in that case.  
  
Add a regression test that checks the patch using the "plpgsql"  
registered prefix.  
  
Author: Florin Irion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+HEvJDhWuuTpGTJT9Tgbdzm4QS4EzPAwDBScWK18H2Q=FVJFw@mail.gmail.com  

M src/backend/utils/misc/guc.c
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Fix certificate paths to use perl2host

commit   : c3b34a0ff4a00d00d6ea364c85201e155ca7ef6b    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Dec 2021 14:59:51 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Dec 2021 14:59:51 +0100    

Click here for diff

Commit c113d8ad50 moved the copying of certificates into a temporary path  
for the duration of the tests, instead of using the source tree. This broke  
the tests on msys as the absolute path wasn't adapted for the msys platform.  
Ensure to convert the path with perl2host before copying and passing in the  
connection string.  
  
While there also make certificate copying error handling uniform across all  
the test suites.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Document that tar archives are now properly terminated.

commit   : 81fca310b38e7808dff9c01a26564e8f2db10893    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 1 Dec 2021 08:55:00 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 1 Dec 2021 08:55:00 -0500    

Click here for diff

Commit 5a1007a5088cd6ddf892f7422ea8dbaef362372f changed the server  
behavior, but I didn't notice that the existing behavior was  
documented, and therefore did not update the documentation.  
This commit does that.  
  
I chose to mention that the behavior has changed rather than just  
removing the reference to a deviation from a standard. It seemed  
like that might be helpful to tool authors.  
  
Discussion: http://postgr.es/m/CA+TgmoaYZbz0=Yk797aOJwkGJC-LK3iXn+wzzMx7KdwNpZhS5g@mail.gmail.com  

M doc/src/sgml/protocol.sgml

Remove mention of TimeLineID update from comments

commit   : 018b800245c5d4db30d204fa42fada05a64eb287    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Dec 2021 14:17:24 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 1 Dec 2021 14:17:24 +0100    

Click here for diff

Commit 4a92a1c3d removed the TimeLineID update from RecoveryInProgress,  
update comments accordingly.  
  
Author: Amul Sul <[email protected]>  
Discussion: https://postgr.es/m/CAAJ_b96wyzs8N45jc-kYd-bTE02hRWQieLZRpsUtNbhap7_PuQ@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/checkpointer.c

Fix comment grammar in slotfuncs.c

commit   : 7799d4e3bdd14c90989d829a9b24e73d4ff4d4ad    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Dec 2021 20:28:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Dec 2021 20:28:19 +0900    

Click here for diff

Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACUkrNR2xTak+QaqxoTjPKGn8zXWripv7SR27t+Q5qF1Wg@mail.gmail.com  

M src/backend/replication/slotfuncs.c

doc: Some additional information about when to use referential actions

commit   : 5786fe154b53caef8b226ed863312d3608b32a51    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Dec 2021 11:25:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Dec 2021 11:25:58 +0100    

Click here for diff

M doc/src/sgml/ddl.sgml

Fix regression test failure caused by commit 8d74fc96db.

commit   : 41e66fee051619ab84828814554f73556a958850    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Dec 2021 12:51:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Dec 2021 12:51:37 +0530    

Click here for diff

The tests didn't considered that an error unrelated to apply changes, e.g.  
"replication origin with OID %d is already active ...", could occur on the  
table sync worker before starting to copy changes.  
  
To make the test robust we instead need to check the expected error and  
the source of error which will be either tablesync or apply worker.  
  
In passing remove the harmless option "streaming = off" from Create  
Subscription command as that is anyway the default.  
  
Per buildfarm member sidewinder.  
  
Author: Masahiko Sawada  
Reviewed-by: Hou Zhijie, Vignesh C, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/026_worker_stats.pl

Doc: Add "Attach Partition" limitation during logical replication.

commit   : eb7828f54a44843a64a23d0891d7eb6018c0749e    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Dec 2021 10:07:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Dec 2021 10:07:45 +0530    

Click here for diff

ATTACHing a table into a partition tree whose root is published using a  
publication with publish_via_partition_root set to true does not result in  
the table's existing contents being replicated. This happens because  
subscriber doesn't consider replicating the newly attached partition as  
the root table is already in a 'ready' state.  
  
This behavior was introduced in PG13 (83fd4532a7) where we allowed to  
publish partition changes via ancestors.  
  
We can consider fixing this limitation in the future.  
  
Author: Amit Langote  
Reviewed-by: Hou Zhijie, Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/OS0PR01MB5716E97F00732B52DC2BBC2594989@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_publication.sgml

Improve psql tab completion for various DROP commands

commit   : 9270778f467dad0d78d3b9e435a89a6039322b2f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Dec 2021 10:50:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Dec 2021 10:50:51 +0900    

Click here for diff

The following improvements are done:  
- Handling of RESTRICT/CASCADE for DROP OWNED, matviews and policies.  
- Handling of DROP TRANSFORM  
  
This is a continuation of the work done in 0cd6d3b and f44ceb4.  
  
Author: Ken Kato  
Reviewed-by: Asif Rehman  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Extend the private key stat checking error handling

commit   : 538724fc36e05339ea3734f1b886a67398fce71a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 23:23:57 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 23:23:57 +0100    

Click here for diff

If the stat operation on the private key failed, the code assumed it  
was due to an ENOENT, which may or may not be true. Extend the check  
by printing a different error message on non-ENOENT errors for easier  
debugging.  
  
Per suggestion by Tom Lane due to an issue with the fairywren animal  
in the buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-secure-openssl.c

Cope with cross-compiling when checking for a random-number source.

commit   : b637101644aa84dccc7da4f30bad40452939b57a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 30 Nov 2021 17:18:04 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 30 Nov 2021 17:18:04 -0500    

Click here for diff

Commit 16f96c74d neglected to consider the possibility of cross-compiling,  
causing cross-compiles to fail at the configure stage unless you'd  
selected --with-openssl.  Since we're now more or less assuming that  
/dev/urandom is available everywhere, it seems reasonable to assume  
that the cross-compile target has it too, rather than failing.  
  
Per complaint from Vincas Dargis.  Back-patch to v14 where this came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

vacuumlazy.c: fix remaining "dead tuple" references.

commit   : 4bdfe6855901a4104dbdac2be53d465b626e244d    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 30 Nov 2021 11:40:33 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 30 Nov 2021 11:40:33 -0800    

Click here for diff

Oversight in commit 4f8d9d12.  
  
Reported-By: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoDm38Em0bvRqeQKr4HPvOj65Y8cUgCP4idMk39iaLrxyw@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Ignore BRIN indexes when checking for HOT udpates

commit   : 5753d4ee320b3f6fb2ff734667a1ce1d9d8615a1    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 30 Nov 2021 19:15:14 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 30 Nov 2021 19:15:14 +0100    

Click here for diff

When determining whether an index update may be skipped by using HOT, we  
can ignore attributes indexed only by BRIN indexes. There are no index  
pointers to individual tuples in BRIN, and the page range summary will  
be updated anyway as it relies on visibility info.  
  
This also removes rd_indexattr list, and replaces it with rd_attrsvalid  
flag. The list was not used anywhere, and a simple flag is sufficient.  
  
Patch by Josef Simanek, various fixes and improvements by me.  
  
Author: Josef Simanek  
Reviewed-by: Tomas Vondra, Alvaro Herrera  
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com  

M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/utils/cache/relcache.c
M src/include/access/amapi.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/regress/expected/brin.out
M src/test/regress/sql/brin.sql

Increase size of shared memory for pg_commit_ts

commit   : 4c83e59e01a89b0b19245b8e0317d87ae60226eb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Nov 2021 14:29:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Nov 2021 14:29:31 -0300    

Click here for diff

Like 5364b357fb11 did for pg_commit, change the formula used to  
determine number of pg_commit_ts buffers, which helps performance with  
larger servers.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Noah Misch <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  

M src/backend/access/transam/commit_ts.c

Disable unused-variable warning C4101 in MSVC

commit   : e7122548a3f754060db1767582148b3559fe8d43    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 14:02:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 14:02:37 +0100    

Click here for diff

The C4101 warning for unused variable cannot be individually suppressed  
with PG_USED_FOR_ASSERTS_ONLY, and thus cause false-positive warnings  
for variables which are defined but only read/written in an assertion.  
Until a satisfactory solution for per-variable suppression like how we  
do for gcc and clang, disable the warning.  
  
Discussion: https://postgr.es/m/CAJcOf-c+KniGAp31pn8TC=9a-WHXpkX-3+8-2BkaCsZchhu=8w@mail.gmail.com  

M src/tools/msvc/Project.pm

Remove PF_USED_FOR_ASSERTS_ONLY from variables in general use

commit   : ac0db34e0e5c7ee6f8b5c33c264de3e671fbd4f7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 14:02:14 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 14:02:14 +0100    

Click here for diff

fsstate in process_pending_requests (in postgres_fdw.c) was added in  
8998e3cafa2 as an assertion-only variable,  1ec7fca8592 stated using  
the variable outside of assertions.  
  
rd_index in get_index_column_opclass (in lsyscache.c) was introduced  
in 2a6368343ff, and then promptly used in the fix commit 7e041603904  
shortly thereafter.  
  
This removes the PG_USED_FOR_ASSERTS_ONLY variable decoration from  
the above mentioned variables.  
  
Reviewed-by: Greg Nancarrow <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/utils/cache/lsyscache.c

Use test-specific temp path for keys during SSL test

commit   : c113d8ad50d62bfcc16bbd5ceec91122e0046ede    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:21:27 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:21:27 +0100    

Click here for diff

The SSL and SCRAM TAP test suites both use temporary copies of the  
supplied test keys in order to ensure correct permissions.  These  
were however copied inside the tree using temporary filenames rather  
than a true temporary folder.  Fix by using tmp_check supplied by  
PostgreSQL::Test::Utils. Spotted by Tom Lane during review of the  
nearby sslinfo TAP test patch.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/ssl/.gitignore
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl

Add TAP tests for contrib/sslinfo

commit   : ae81776a23f78babc9707e22f95dea15aa2dbcd2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:19:59 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:19:59 +0100    

Click here for diff

This adds rudimentary coverage of the sslinfo extension into the SSL  
test harness.  The output is validated by comparing with pg_stat_ssl  
to provide some level of test stability should the underlying certs  
be slightly altered.  A new cert is added to provide an extension to  
test against.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/Makefile
M src/test/ssl/README
A src/test/ssl/conf/client_ext.config
A src/test/ssl/ssl/client_ext.crt
A src/test/ssl/ssl/client_ext.key
M src/test/ssl/sslfiles.mk
A src/test/ssl/t/003_sslinfo.pl

Extend configure_test_server_for_ssl to add extensions

commit   : 879fc1a579cc2e2e1dbb79686668b4de2071ab83    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:13:26 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Nov 2021 11:13:26 +0100    

Click here for diff

In order to be able to test extensions with SSL connections, allow  
configure_test_server_for_ssl to create any extensions passed as  
an array. Each extension is created in all the test databases.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/SSLServer.pm

Fix flags of some GUCs and improve some descriptions

commit   : be5455124b0f073ba3924ae2ba302a27b1686230    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 14:38:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 14:38:49 +0900    

Click here for diff

This commit fixes some issues with GUCs:  
- enable_incremental_sort was not marked as GUC_EXPLAIN, causing it to  
not be listed in the output of EXPLAIN (SETTINGS) if using a value  
different than the default, contrary to the other planner-level GUCs.  
- trace_recovery_messages missed GUC_NOT_IN_SAMPLE, like the other  
developer options.  
- ssl_renegotiation_limit should be marked as COMPAT_OPTIONS_PREVIOUS.  
  
While on it, this fixes one incorrect comment related to  
autovacuum_freeze_max_age, and improves the descriptions of some other  
GUCs, recently introduced.  
  
Extracted from a larger patch set by the same author.  
  
Author: Justin Pryzby  
Description: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c

Add a view to show the stats of subscription workers.

commit   : 8d74fc96db5fd547e077bf9bf4c3b67f821d71cd    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 30 Nov 2021 08:54:30 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 30 Nov 2021 08:54:30 +0530    

Click here for diff

This commit adds a new system view pg_stat_subscription_workers, that  
shows information about any errors which occur during the application of  
logical replication changes as well as during performing initial table  
synchronization. The subscription statistics entries are removed when the  
corresponding subscription is removed.  
  
It also adds an SQL function pg_stat_reset_subscription_worker() to reset  
single subscription errors.  
  
The contents of this view can be used by an upcoming patch that skips the  
particular transaction that conflicts with the existing data on the  
subscriber.  
  
This view can be extended in the future to track other xact related  
statistics like the number of xacts committed/aborted for subscription  
workers.  
  
Author: Masahiko Sawada  
Reviewed-by: Greg Nancarrow, Hou Zhijie, Tang Haiying, Vignesh C, Dilip Kumar, Takamichi Osumi, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
A src/test/subscription/t/026_worker_stats.pl
M src/tools/pgindent/typedefs.list

Fix typos

commit   : 98105e53e0ab472b7721a3e8d7b9f1750a635120    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 11:05:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 11:05:15 +0900    

Click here for diff

Author: Lingjie Qiang  
Discussion: https://postgr.es/m/OSAPR01MB71654E773F62AC88DC1FC8CC80669@OSAPR01MB7165.jpnprd01.prod.outlook.com  

M src/backend/storage/lmgr/README
M src/backend/utils/adt/pg_locale.c
M src/include/access/attnum.h

Fix compatibility thinko for fstat() on standard streams in win32stat.c

commit   : 58651d8dd6a56af306a361e2c386db798164c0f1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 09:55:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 30 Nov 2021 09:55:50 +0900    

Click here for diff

GetFinalPathNameByHandleA() cannot be used in compilation environments  
where _WIN32_WINNT < 0x0600, meaning at least Windows XP used by some  
buildfarm members under MinGW that Postgres still needs to support.  
This was reported as a compilation warning by the buildfarm, but this is  
actually worse than the report as the code would have not worked.  
  
Instead, this switches to GetFileInformationByHandle() that is able to  
fail for standard streams and succeed for redirected ones, which is what  
we are looking for herein the code emulating fstat().  We also know that  
it is able to work in all the environments still supported, thanks to  
the existing logic of win32stat.c.  
  
Issue introduced by 10260c7, so backpatch down to 14.  
  
Reported-by: Justin Pryzby, via buildfarm member jacana  
Author: Michael Paquier  
Reviewed-by: Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/win32stat.c

vacuumlazy.c: Rename dead_tuples to dead_items.

commit   : 4f8d9d1217956798e761491d236af576b27f5e12    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 29 Nov 2021 09:58:01 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 29 Nov 2021 09:58:01 -0800    

Click here for diff

Commit 8523492d simplified what it meant for an item to be considered  
"dead" to VACUUM: TIDs collected in memory (in preparation for index  
vacuuming) must always come from LP_DEAD stub line pointers in heap  
pages, found following pruning.  This formalized the idea that index  
vacuuming (and heap vacuuming) are optional processes.  Unlike pruning,  
they can be delayed indefinitely, without any risk of that violating  
fundamental invariants.  For example, leaving LP_DEAD items behind  
clearly won't add to the risk of transaction ID wraparound.  You can't  
have transaction ID wraparound without transaction IDs.  Renaming  
anything that references DEAD tuples (tuples with storage) reinforces  
all this.  
  
Code outside vacuumlazy.c continues to fudge the distinction between  
dead/deleted tuples, and LP_DEAD items.  This is necessary because  
autovacuum scheduling is still mostly driven by "dead items/tuples"  
statistics.  In the future we may find it useful to replace this model  
with something more sophisticated, as a step towards teaching autovacuum  
to perform more frequent vacuuming that targeting individual indexes  
that happen to be more prone to becoming bloated through version churn.  
  
In passing, simplify some function signatures that deal with VACUUM's  
dead_items array.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzktGBg4si6DEdmq3q6SoXSDqNi6MtmB8CmmTmvhsxDTLA@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c

Doc: improve documentation about ORDER BY in matviews.

commit   : 4f33af23e7e3ac30b3cb9480981c3accf401ef01    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 12:13:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 12:13:12 -0500    

Click here for diff

Remove the confusing use of ORDER BY in an example materialized  
view.  It adds nothing to the example, but might encourage  
people to follow bad practice.  Clarify REFRESH MATERIALIZED  
VIEW's note about whether view ordering is retained (it isn't).  
  
Maciek Sakrejda  
  
Discussion: https://postgr.es/m/CAOtHd0D-OvrUU0C=4hX28p4BaSE1XL78BAQ0VcDaLLt8tdUzsg@mail.gmail.com  

M doc/src/sgml/ref/refresh_materialized_view.sgml
M doc/src/sgml/rules.sgml

Simplify declaring variables exported from libpgcommon and libpgport.

commit   : e04a8059a74c125a8af94acdcb7b15b92188470a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 11:00:00 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 11:00:00 -0500    

Click here for diff

This reverts commits c2d1eea9e and 11b500072, as well as similar hacks  
elsewhere, in favor of setting up the PGDLLIMPORT macro so that it can  
just be used unconditionally.  That can work because in frontend code,  
we need no marking in either the defining or consuming files for a  
variable exported from these libraries; and frontend code has no need  
to access variables exported from the core backend, either.  
  
While at it, write some actual documentation about the PGDLLIMPORT  
and PGDLLEXPORT macros.  
  
Patch by me, based on a suggestion from Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/c.h
M src/include/common/keywords.h
M src/include/common/pg_prng.h
M src/include/port/cygwin.h
M src/include/port/pg_bitutils.h
M src/include/port/win32.h

Portability hack for pg_global_prng_state.

commit   : 11b500072e42c214462b973b0b05f1c68992226b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 00:04:45 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Nov 2021 00:04:45 -0500    

Click here for diff

PGDLLIMPORT is only appropriate for variables declared in the backend,  
not when the variable is coming from a library included in frontend code.  
(This isn't a particularly nice fix, but for now, use the same method  
employed elsewhere.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/common/pg_prng.h

Centralize timestamp computation of control file on updates

commit   : 6fb7c5d67cdd55454fe6317f939a191f85e96473    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Nov 2021 13:36:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Nov 2021 13:36:13 +0900    

Click here for diff

This commit moves the timestamp computation of the control file within  
the routine of src/common/ in charge of updating the backend's control  
file, which is shared by multiple frontend tools (pg_rewind,  
pg_checksums and pg_resetwal) and the backend itself.  
  
This change has as direct effect to update the control file's timestamp  
when writing the control file in pg_rewind and pg_checksums, something  
that is helpful to keep track of control file updates for those  
operations, something also tracked by the backend at startup within its  
logs.  This part is arguably a bug, as ControlFileData->time should be  
updated each time a new version of the control file is written, but this  
is a behavior change so no backpatch is done.  
  
Author: Amul Sul  
Reviewed-by: Nathan Bossart, Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/CAAJ_b97nd_ghRpyFV9Djf9RLXkoTbOUqnocq11WGq9TisX09Fw@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/common/controldata_utils.c

Replace random(), pg_erand48(), etc with a better PRNG API and algorithm.

commit   : 3804539e48e794781c6145c7f988f5d507418fa8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 28 Nov 2021 21:32:36 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 28 Nov 2021 21:32:36 -0500    

Click here for diff

Standardize on xoroshiro128** as our basic PRNG algorithm, eliminating  
a bunch of platform dependencies as well as fundamentally-obsolete PRNG  
code.  In addition, this API replacement will ease replacing the  
algorithm again in future, should that become necessary.  
  
xoroshiro128** is a few percent slower than the drand48 family,  
but it can produce full-width 64-bit random values not only 48-bit,  
and it should be much more trustworthy.  It's likely to be noticeably  
faster than the platform's random(), depending on which platform you  
are thinking about; and we can have non-global state vectors easily,  
unlike with random().  It is not cryptographically strong, but neither  
are the functions it replaces.  
  
Fabien Coelho, reviewed by Dean Rasheed, Aleksander Alekseev, and myself  
  
Discussion: https://postgr.es/m/alpine.DEB.2.22.394.2105241211230.165418@pseudo  

M configure
M configure.ac
M contrib/amcheck/verify_nbtree.c
M contrib/auto_explain/auto_explain.c
M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/tablefunc/tablefunc.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M src/backend/access/gin/ginget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/transam/xact.c
M src/backend/commands/analyze.c
M src/backend/executor/nodeSamplescan.c
M src/backend/lib/bloomfilter.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/s_lock.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/float.c
M src/backend/utils/misc/sampling.c
M src/bin/initdb/initdb.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/common/Makefile
A src/common/pg_prng.c
A src/include/common/pg_prng.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_random.h
M src/include/pg_config.h.in
M src/include/pg_config_manual.h
M src/include/port.h
M src/include/utils/sampling.h
M src/port/Makefile
D src/port/erand48.c
D src/port/random.c
D src/port/srandom.c
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_rbtree/test_rbtree.c
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Solution.pm
M src/tools/testint128.c

Improve psql tab completion for views, FDWs, sequences and transforms

commit   : f44ceb46ec2d8da48f6e145bf462d5620c25e079    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Nov 2021 10:28:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Nov 2021 10:28:29 +0900    

Click here for diff

The following improvements are done:  
- Addition of type completion for ALTER SEQUENCE AS.  
- Ignore ALTER for transforms, as the command is not supported.  
- Addition of more completion for ALTER FOREIGN DATA WRAPPER.  
- Addition of options related to columns in ALTER VIEW.  
  
This is a continuation of the work done in 0cd6d3b.  
  
Author: Ken Kato  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

vacuumlazy.c: prefer the term "cleanup lock".

commit   : 276db875d4f9be2911582f367596d444d6986c77    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 27 Nov 2021 16:05:01 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 27 Nov 2021 16:05:01 -0800    

Click here for diff

The term "super-exclusive lock" is an acceptable synonym of "cleanup  
lock".  Even still, switching from one term to the other in the same  
file is confusing.  Standardize on "cleanup lock" within vacuumlazy.c.  
  
Per a complaint from Andres Freund.  

M src/backend/access/heap/vacuumlazy.c

Update high level vacuumlazy.c comments.

commit   : 12b5ade9023f3ecaddcbc423a22dc284c91c79f6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 27 Nov 2021 14:29:43 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 27 Nov 2021 14:29:43 -0800    

Click here for diff

Update vacuumlazy.c file header comments (as well as comments above the  
lazy_scan_heap function) that were largely written before the  
introduction of the HOT optimization, when lazy_scan_heap did far less,  
and didn't actually prune during its initial heap pass.  
  
Since lazy_scan_heap now outsources far more work to lower level  
functions, it makes sense to introduce the function by talking about the  
high level invariant that dictates the order in which each phase takes  
place.  Also deemphasize the case where we run out of memory for TIDs,  
since delaying that discussion makes it easier to talk about issues of  
central importance.  
  
Finally, remove discussion of parallel VACUUM from header comments.  
These don't add much, and are in the wrong place.  

M src/backend/access/heap/vacuumlazy.c

Harden be-gssapi-common.h for headerscheck

commit   : f744519326e1ce4774d0966f7848601a8327eeaa    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 17:00:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 17:00:29 -0300    

Click here for diff

Surround the contents with a test that the feature is enabled by  
configure, to silence header checking tools on systems without GSSAPI  
installed.  
  
Backpatch to 12, where the file appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/libpq/be-gssapi-common.h

Go back to considering HOT on pages marked full.

commit   : 1a6f5a0e876306293fda697e7820b404d5b93693    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 26 Nov 2021 10:58:38 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 26 Nov 2021 10:58:38 -0800    

Click here for diff

Commit 2fd8685e7f simplified the checking of modified attributes that  
takes place within heap_update().  This included a micro-optimization  
affecting pages marked PD_PAGE_FULL: don't even try to use HOT to save a  
few cycles on determining HOT safety.  The assumption was that it won't  
work out this time around, since it can't have worked out last time  
around.  
  
Remove the micro-optimization.  It could only ever save cycles that are  
consumed by the vast majority of heap_update() calls, which hardly seems  
worth the added complexity.  It also seems quite possible that there are  
workloads that will do worse over time by repeated application of the  
micro-optimization, despite saving some cycles on average, in the short  
term.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznU1L3+DMPr1F7o2eJBT7=3bAJoY6ZkWABAxNt+-afyTA@mail.gmail.com  

M src/backend/access/heap/heapam.c

Copy-edit vacuuumdb --analyze-in-stages doc blurb

commit   : dd484c97f55be8336fcb41470768c5b8ae347d13    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 14:42:15 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 14:42:15 -0300    

Click here for diff

I had made a few typos, and Nikolai Berkoff made a wording change  
suggestion.  
  
Discussion: https://postgr.es/m/VMwe7-sGegrQPQ7fJjSCdsEbESKeJFOb6G4DFxxNrf45I7DzHio7sNUH88wWRMnAy5a5G0-FB31dxPM47ldigW6WdiCPncHgqO9bNl6F240=@pm.me  

M doc/src/sgml/ref/vacuumdb.sgml

Document units for max_slot_wal_keep_size

commit   : 013bb6c8c0b5b0ac7948d7126685008505b3aa58    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 14:31:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 14:31:57 -0300    

Click here for diff

The doc blurb failed to mention units, as well as lacking the point  
about changeability.  
  
Backpatch to 13.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reported by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Fix determination of broken LSN in OVERWRITTEN_CONTRECORD

commit   : 44bd3ed332d6ad3207f38b3b6deb6083f0baddf5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 11:14:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Nov 2021 11:14:27 -0300    

Click here for diff

In commit ff9f111bce24 I mixed up inconsistent definitions of the LSN of  
the first record in a page, when the previous record ends exactly at the  
page boundary.  The correct LSN is adjusted to skip the WAL page header;  
I failed to use that when setting XLogReaderState->overwrittenRecPtr,  
so at WAL replay time VerifyOverwriteContrecord would refuse to let  
replay continue past that record.  
  
Backpatch to 10.  9.6 also contains this bug, but it's no longer being  
maintained.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogreader.c

Add test for REVOKE ADMIN OPTION

commit   : 4597fd78d6dea2235cb948ea036c2d61057c415c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 26 Nov 2021 14:02:14 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 26 Nov 2021 14:02:14 +0100    

Click here for diff

The REVOKE ADMIN OPTION FOR <role_name> syntax didn't have ample  
test coverage. Fix by adding coverage in the privileges test suite.  
  
Author: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix GRANTED BY support in REVOKE ROLE statements

commit   : b2a459edfe645747744402f23de041e9c0a3cd93    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 26 Nov 2021 14:02:01 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 26 Nov 2021 14:02:01 +0100    

Click here for diff

Commit 6aaaa76bb added support for the GRANTED BY clause in GRANT and  
REVOKE statements, but missed adding support for checking the role in  
the REVOKE ROLE case. Fix by checking that the parsed role matches the  
CURRENT_ROLE/CURRENT_USER requirement, and also add some tests for it.  
Backpatch to v14 where GRANTED BY support was introduced.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Update comments

commit   : 36cb5e7c512bef394c9288786c62ef0eb1e891ba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Nov 2021 09:57:23 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Nov 2021 09:57:23 +0100    

Click here for diff

Various places wanted to point out that tuple descriptors don't  
contain the variable-length fields of pg_attribute.  This started when  
attacl was added, but more fields have been added since, and these  
comments haven't been kept up to date consistently.  Reword so that  
the purpose is clearer and we don't have to keep updating them.  

M src/backend/access/common/tupdesc.c
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c

Remove unneeded Python includes

commit   : 99e4d24a9d77e7bb87e15b318e96dc36651a7da2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Nov 2021 14:19:22 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Nov 2021 14:19:22 +0100    

Click here for diff

Inluding <compile.h> and <eval.h> has not been necessary since Python  
2.4, since they are included via <Python.h>.  Morever, <eval.h> is  
being removed in Python 3.11.  So remove these includes.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/84884.1637723223%40sss.pgh.pa.us  

M src/pl/plpython/plpython.h

Block ALTER TABLE .. DROP NOT NULL on columns in replica identity index

commit   : f0d43947a1b0c30f0bf2c117cd78bf95a3161268    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Nov 2021 15:04:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Nov 2021 15:04:56 +0900    

Click here for diff

Replica identities that depend directly on an index rely on a set of  
properties, one of them being that all the columns defined in this index  
have to be marked as NOT NULL.  There was a hole in the logic with ALTER  
TABLE DROP NOT NULL, where it was possible to remove the NOT NULL  
property of a column part of an index used as replica identity, so block  
it to avoid problems with logical decoding down the road.  
  
The same check was already done columns part of a primary key, so the  
fix is straight-forward.  
  
Author: Haiying Tang, Hou Zhijie  
Reviewed-by: Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/OS0PR01MB6113338C102BEE8B2FFC5BD9FB619@OS0PR01MB6113.jpnprd01.prod.outlook.com  
Backpatch-through: 10  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/replica_identity.out
M src/test/regress/sql/replica_identity.sql

Fix fstat() emulation on Windows with standard streams

commit   : 10260c794b211117a56ee2eb2deacf609bcca25f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Nov 2021 12:16:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Nov 2021 12:16:21 +0900    

Click here for diff

The emulation of fstat() in win32stat.c caused two issues with the  
existing in-core callers, failing on EINVAL when using a stream as  
argument:  
- psql's \copy would crash when using a stream.  
- pg_recvlogical would fail with -f -.  
  
The tests in copyselect.sql from the main test suite covers the first  
case, and there is a TAP test for the second case.  However, in both  
cases, as the standard streams are always redirected, automated tests  
did not notice those issues, requiring a terminal on Windows to be  
reproducible.  
  
This issue has been introduced in bed9075, and the origin of the problem  
is that GetFileInformationByHandle() does not work directly on streams,  
so this commit adds an extra code path to emulate and return a set of  
stats that match best with the reality.  Note that redirected streams  
rely on handles that can be queried with GetFileInformationByHandle(),  
but we can rely on GetFinalPathNameByHandleA() to detect this case.  
  
Author: Dmitry Koval, Juan José Santamaría Flecha  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/win32stat.c

Replace straggling uses of ReadRecPtr/EndRecPtr.

commit   : 3030903dfefb314ebb575834702904dc008eb5ca    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 24 Nov 2021 16:54:11 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 24 Nov 2021 16:54:11 -0800    

Click here for diff

d2ddfa681db removed ReadRecPtr/EndRecPtr, but two uses within an #ifdef  
WAL_DEBUG escaped.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Doc: improve documentation about nextval()/setval().

commit   : 4ac452e2285da347c75f5960ae211e183a87b57b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 24 Nov 2021 13:37:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 24 Nov 2021 13:37:11 -0500    

Click here for diff

Clarify that the results of nextval and setval are not guaranteed  
persistent until the calling transaction commits.  Some people  
seem to have drawn the opposite conclusion from the statement that  
these functions are never rolled back, so re-word to avoid saying  
it quite that way.  
  
Discussion: https://postgr.es/m/CAKU4AWohO=NfM-4KiZWvdc+z3c1C9FrUBR6xnReFJ6sfy0i=Lw@mail.gmail.com  

M doc/src/sgml/func.sgml

Fix missing space in docs.

commit   : 373e55218972f840ad29cd8a4dabe4b17e98d28b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Nov 2021 18:32:56 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 24 Nov 2021 18:32:56 +0200    

Click here for diff

Author: Japin Li  
Discussion: https://www.postgresql.org/message-id/MEYP282MB1669C36E5F733C2EFBDCB80BB6619@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M doc/src/sgml/arch-dev.sgml

xlog.c: Remove global variables ReadRecPtr and EndRecPtr.

commit   : d2ddfa681db27a138acb63c8defa8cc6fa588922    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 Nov 2021 11:27:39 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 Nov 2021 11:27:39 -0500    

Click here for diff

In most places, the variables necessarily store the same value as the  
eponymous members of the XLogReaderState that we use during WAL  
replay, because ReadRecord() assigns the values from the structure  
members to the global variables just after XLogReadRecord() returns.  
However, XLogBeginRead() adjusts the structure members but not the  
global variables, so after XLogBeginRead() and before the completion  
of XLogReadRecord() the values can differ. Otherwise, they must be  
identical.  According to my analysis, the only place where either  
variable is referenced at a point where it might not have the same  
value as the structure member is the refrence to EndRecPtr within  
XLogPageRead.  
  
Therefore, at every other place where we are using the global  
variable, we can just switch to using the structure member instead,  
and remove the global variable. However, we can, and in fact should,  
do this in XLogPageRead() as well, because at that point in the code,  
the global variable will actually store the start of the record we  
want to read - either because it's where the last WAL record ended, or  
because the read position has been changed using XLogBeginRead since  
the last record was read. The structure member, on the other hand,  
will already have been updated to point to the end of the record we  
just read. Elsewhere, the latter is what we use as an argument to  
emode_for_corrupt_record(), so we should do the same here.  
  
This part of the patch is perhaps a bug fix, but I don't think it has  
any important consequences, so no back-patch. The point here is just  
to continue to whittle down the entirely excessive use of global  
variables in xlog.c.  
  
Discussion: http://postgr.es/m/CA+Tgmoao96EuNeSPd+hspRKcsCddu=b1h-QNRuKfY8VmfNQdfg@mail.gmail.com  

M src/backend/access/transam/xlog.c

Fix corner-case failure to detect improper timeline switch.

commit   : e7ea2fa342b008ae97e794b0fa2ee538ddcee3b7    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 24 Nov 2021 08:13:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 24 Nov 2021 08:13:10 -0500    

Click here for diff

rescanLatestTimeLine() contains a guard against switching to  
a timeline that forked off from the current one prior to the  
current recovery point, but that guard does not work if the  
timeline switch occurs before the first WAL recod (which must  
be the checkpoint record) is read. Without this patch, an  
improper timeline switch is therefore possible in such cases.  
  
This happens because rescanLatestTimeLine() relies on the global  
variable EndRecPtr to understand the current position of WAL  
replay. However, EndRecPtr at this point in the code contains  
the endpoint of the last-replayed record, not the startpoint or  
endpoint of the record being replayed now. Thus, before any  
records have been replayed, it's zero, which causes the sanity  
check to always pass.  
  
To fix, pass down the correct timeline explicitly. The  
EndRecPtr value we want is the one from the xlogreader, which  
will be the starting position of the record we're about to  
try to read, rather than the global variable, which is the  
ending position of the last record we successfully read.  
They're usually the same, but not in the corner case described  
here.  
  
No back-patch, because in v14 and earlier branhes, we were using  
the wrong TLI here as well as the wrong LSN. In master, that was  
fixed by commit 4a92a1c3d1c361ffb031ed05bf65b801241d7cdd, but  
that and it's prerequisite patches are too invasive to  
back-patch for such a minor issue.  
  
Patch by me, reviewed by Amul Sul.  
  
Discussion: http://postgr.es/m/CA+Tgmoao96EuNeSPd+hspRKcsCddu=b1h-QNRuKfY8VmfNQdfg@mail.gmail.com  

M src/backend/access/transam/xlog.c

Remove useless LZ4 system call on failure when writing file header

commit   : f79962d8264b8d205ce45a8aa11d1b37f9592a81    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Nov 2021 20:12:54 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Nov 2021 20:12:54 +0900    

Click here for diff

If an error occurs when writing the LZ4 file header, LZ4F_compressEnd()  
was called in the error code path of write(), followed by  
LZ4F_freeCompressionContext() to finish the cleanup.  The code as-is was  
not broken, but the LZ4F_compressEnd() proves to not be necessary as  
there are no contents to flush at this stage, so remove it.  
  
Per gripe from Jeevan Ladhe and Robert Haas.  
  
Discussion: https://postgr.es/m/CAOgcT0PE33wbD7giAT1OSkNJt=p-vu8huq++qh=ny9O=SCP5aA@mail.gmail.com  

M src/bin/pg_basebackup/walmethods.c

Flush Memoize cache when non-key parameters change, take 2

commit   : 411137a429210e432f923264a8e313a9872910ca    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 23:29:14 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 23:29:14 +1300    

Click here for diff

It's possible that a subplan below a Memoize node contains a parameter  
from above the Memoize node.  If this parameter changes then cache entries  
may become out-dated due to the new parameter value.  
  
Previously Memoize was mistakenly not aware of this.  We fix this here by  
flushing the cache whenever a parameter that's not part of the cache  
key changes.  
  
Bug: #17213  
Reported by: Elvis Pranskevichus  
Author: David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Memoize was added  

M src/backend/executor/nodeMemoize.c
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/clauses.h
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Fix incorrect format placeholders

commit   : fb5961fd13b1262df280e400645bdf4ed192f058    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 08:15:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Nov 2021 08:15:17 +0100    

Click here for diff

Also choose better types for the underlying variables to make this  
more consistent.  

M contrib/pageinspect/heapfuncs.c

Add support for Visual Studio 2022 in build scripts

commit   : b2265d305d81b0c1a2cec6c5b66a190a9e69e853    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Nov 2021 13:03:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Nov 2021 13:03:23 +0900    

Click here for diff

Documentation and any code paths related to VS are updated to keep the  
whole consistent.  Similarly to 2017 and 2019, the version of VS and the  
version of nmake that we use to determine which code paths to use for  
the build are still inconsistent in their own way.  
  
Backpatch down to 10, so as buildfarm members are able to use this new  
version of Visual Studio on all the stable branches supported.  
  
Author: Hans Buschmann  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/install-windows.sgml
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/README
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm

Rename SnapBuild* macros in slot.c.

commit   : 875e02c2dff34f1bc9f3832a4f83c34bf300eb9f    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 24 Nov 2021 08:06:55 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 24 Nov 2021 08:06:55 +0530    

Click here for diff

Same macro names for SnapBuildOnDiskNotChecksummedSize and  
SnapBuildOnDiskChecksummedSize are being used in slot.c and snapbuild.c.  
This patch renames them, in slot.c, to  
ReplicationSlotOnDiskNotChecksummedSize and  
ReplicationSlotOnDiskChecksummedSize similar to the other macros. This  
makes all macro names look consistent in slot.c.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVZo-piDGzBOJRY4ob=_goFR6t9DhZMDMjJWN7LQs34Aw@mail.gmail.com  

M src/backend/replication/slot.c

Revert "Flush Memoize cache when non-key parameters change"

commit   : dad20ad4709f602b4827a1ab2b0e715f36c548c3    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 15:27:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 15:27:43 +1300    

Click here for diff

This reverts commit 1050048a315790a505465bfcceb26eaf8dbc7e2e.  

M src/backend/executor/nodeMemoize.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/clauses.h
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Flush Memoize cache when non-key parameters change

commit   : 1050048a315790a505465bfcceb26eaf8dbc7e2e    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 14:56:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 14:56:18 +1300    

Click here for diff

It's possible that a subplan below a Memoize node contains a parameter  
from above the Memoize node.  If this parameter changes then cache entries  
may become out-dated due to the new parameter value.  
  
Previously Memoize was mistakenly not aware of this.  We fix this here by  
flushing the cache whenever a parameter that's not part of the cache  
key changes.  
  
Bug: #17213  
Reported by: Elvis Pranskevichus  
Author: David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Memoize was added  

M src/backend/executor/nodeMemoize.c
M src/backend/nodes/bitmapset.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/clauses.h
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Allow Memoize to operate in binary comparison mode

commit   : e502150f7d0be41e3c8784be007fa871a32d8a7f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 10:06:59 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 24 Nov 2021 10:06:59 +1300    

Click here for diff

Memoize would always use the hash equality operator for the cache key  
types to determine if the current set of parameters were the same as some  
previously cached set.  Certain types such as floating points where -0.0  
and +0.0 differ in their binary representation but are classed as equal by  
the hash equality operator may cause problems as unless the join uses the  
same operator it's possible that whichever join operator is being used  
would be able to distinguish the two values.  In which case we may  
accidentally return in the incorrect rows out of the cache.  
  
To fix this here we add a binary mode to Memoize to allow it to the  
current set of parameters to previously cached values by comparing  
bit-by-bit rather than logically using the hash equality operator.  This  
binary mode is always used for LATERAL joins and it's used for normal  
joins when any of the join operators are not hashable.  
  
Reported-by: Tom Lane  
Author: David Rowley  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Memoize was added  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/nodeMemoize.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/datum.c
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/include/utils/datum.h
M src/test/regress/expected/join.out
M src/test/regress/expected/memoize.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/memoize.sql

Add SQL functions to monitor the directory contents of replication slots

commit   : 1922d7c6e1a74178bd2f1d5aa5a6ab921b3fcd34    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Nov 2021 19:29:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Nov 2021 19:29:42 +0900    

Click here for diff

This commit adds a set of functions able to look at the contents of  
various paths related to replication slots:  
- pg_ls_logicalsnapdir, for pg_logical/snapshots/  
- pg_ls_logicalmapdir, for pg_logical/mappings/  
- pg_ls_replslotdir, for pg_replslot/<slot_name>/  
  
These are intended to be used by monitoring tools.  Unlike pg_ls_dir(),  
execution permission can be granted to non-superusers.  Roles members of  
pg_monitor gain have access to those functions.  
  
Bump catalog version.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Justin Pryzby  
Discussion: https://postgr.es/m/CALj2ACWsfizZjMN6bzzdxOk1ADQQeSw8HhEjhmVXn_Pu+7VzLw@mail.gmail.com  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/genfile.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Adjust pg_dump's priority ordering for casts.

commit   : b55f2b6926556115155930c4b2d006c173f45e65    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 17:16:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 17:16:29 -0500    

Click here for diff

When a stored expression depends on a user-defined cast, the backend  
records the dependency as being on the cast's implementation function  
--- or indeed, if there's no cast function involved but just  
RelabelType or CoerceViaIO, no dependency is recorded at all.  This  
is problematic for pg_dump, which is at risk of dumping things in the  
wrong order leading to restore failures.  Given the lack of previous  
reports, the risk isn't that high, but it can be demonstrated if the  
cast is used in some view whose rowtype is then used as an input or  
result type for some other function.  (That results in the view  
getting hoisted into the functions portion of the dump, ahead of  
the cast.)  
  
A logically bulletproof fix for this would require including the  
cast's OID in the parsed form of the expression, whence it could be  
extracted by dependency.c, and then the stored dependency would force  
pg_dump to do the right thing.  Such a change would be fairly invasive,  
and certainly not back-patchable.  Moreover, since we'd prefer that  
an expression using cast syntax be equal() to one doing the same  
thing by explicit function call, the cast OID field would have to  
have special ignored-by-comparisons semantics, making things messy.  
  
So, let's instead fix this by a very simple hack in pg_dump: change  
the object-type priority order so that casts are initially sorted  
before functions, immediately after types.  This fixes the problem  
in a fairly direct way for casts that have no implementation function.  
For those that do, the implementation function will be hoisted to just  
before the cast by the dependency sorting step, so that we still have  
a valid dump order.  (I'm not sure that this provides a full guarantee  
of no problems; but since it's been like this for many years without  
any previous reports, this is probably enough to fix it in practice.)  
  
Per report from Дмитрий Иванов.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/CAPL5KHoGa3uvyKp6z6m48LwCnTsK+LRQ_mcA4uKGfqAVSEjV_A@mail.gmail.com  

M src/bin/pg_dump/pg_dump_sort.c

Pacify perlcritic.

commit   : db3a660c6327a6df81a55c4aa86e6c0837ecd505    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 15:57:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 15:57:31 -0500    

Click here for diff

Per buildfarm.  

M config/check_modules.pl

Fix pg_dump --inserts mode for generated columns with dropped columns.

commit   : 0b126c6a4b00972f2f3533e1718bbe297e2851c2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 15:25:48 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 15:25:48 -0500    

Click here for diff

If a table contains a generated column that's preceded by a dropped  
column, dumpTableData_insert failed to account for the dropped  
column, and would emit DEFAULT placeholder(s) in the wrong column(s).  
This resulted in failures at restore time.  The default COPY code path  
did not have this bug, likely explaining why it wasn't noticed sooner.  
  
While we're fixing this, we can be a little smarter about the  
situation: (1) avoid unnecessarily fetching the values of generated  
columns, (2) omit generated columns from the output, too, if we're  
using --column-inserts.  While these modes aren't expected to be  
as high-performance as the COPY path, we might as well be as  
efficient as we can; it doesn't add much complexity.  
  
Per report from Дмитрий Иванов.  
Back-patch to v12 where generated columns came in.  
  
Discussion: https://postgr.es/m/CAPL5KHrkBniyQt5e1rafm5DdXvbgiiqfEQEJ9GjtVzN71Jj5pA@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Probe $PROVE not $PERL while checking for modules needed by TAP tests.

commit   : c4fe3199a6d65212537a59eb0d7e6fad22b9e903    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 12:54:52 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 22 Nov 2021 12:54:52 -0500    

Click here for diff

Normally "prove" and "perl" come from the same Perl installation,  
but we support the case where they don't (mainly because the MSys  
buildfarm animals need this).  In that case, AX_PROG_PERL_MODULES  
is completely the wrong thing to use, because it's checking what  
"perl" has.  Instead, make a little TAP test script including the  
required modules, and run that under "prove".  
  
We don't need ax_prog_perl_modules.m4 at all after this change,  
so remove it.  
  
Back-patch to all supported branches, for the buildfarm's benefit.  
(In v10, this also back-patches the effects of commit 264eb03aa.)  
  
Andrew Dunstan and Tom Lane, per an observation by Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  

M aclocal.m4
D config/ax_prog_perl_modules.m4
A config/check_modules.pl
M configure
M configure.ac

Be more specific about OOM in XLogReaderAllocate

commit   : 2fed48f48f7f2f7a6d6f6d020f046efe3c249828    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 13:43:43 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 13:43:43 -0300    

Click here for diff

A couple of spots can benefit from an added errdetail(), which matches  
what we were already doing in other places; and those that cannot  
withstand errdetail() can get a more descriptive primary message.  
  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACV+cX1eM03GfcA=ZMLXh5fSn1X1auJLz3yuS1duPSb9QA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/replication/logical/logical.c
M src/backend/replication/walsender.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c

autovacuum: Improve wording in a couple places

commit   : 042412879e35791a65509f2786b4954a273466e5    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 12:55:36 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 12:55:36 -0300    

Click here for diff

A few strings (one WARNING and some memory context names) in the  
autovacuum code were written in a world where "worker" had no other  
possible meaning than "autovacuum worker", but that's long time gone.  
Be more specific about it.  
  
Also, change the WARNING from elog() to ereport(), to add translability.  
  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Reviewed-by: Justin Pryzby <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Dilip Kumar <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACX2UHp76dqdoZq92a7v4APFuV5wJQ+AUrb+2HURrKN=NQ@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Add missing words in comment

commit   : 67385544ce672a9a53cfd51b39c1ff9048d65585    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 12:38:41 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Nov 2021 12:38:41 -0300    

Click here for diff

Reported by Zhihong Yu.  
  
Discussion: https://postgr.es/m/CALNJ-vR6uZivg_XkB1zKjEXeyZDEgoYanFXB-++1kBT9yZQoUw@mail.gmail.com  

M src/backend/commands/tablecmds.c

Add ABI extra field to fmgr magic block

commit   : d6d1dfcc99e3dd6e70e2a7024924e491bb7a9670    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Nov 2021 07:40:17 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Nov 2021 07:40:17 +0100    

Click here for diff

This allows derived products to intentionally make their fmgr ABI  
incompatible, with a clean error message.  
  
Discussion: https://www.postgresql.org/message-id/flat/55215fda-db31-a045-d6b7-d6f2d2dc9920%40enterprisedb.com  

M src/backend/utils/fmgr/dfmgr.c
M src/include/fmgr.h
M src/include/pg_config_manual.h

Report wait events for local shell commands like archive_command.

commit   : 1b06d7bac901e5fd20bba597188bae2882bf954b    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 22 Nov 2021 10:28:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 22 Nov 2021 10:28:21 +0900    

Click here for diff

This commit introduces new wait events for archive_command,  
archive_cleanup_command, restore_command and recovery_end_command.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/pgarch.c
M src/backend/utils/activity/wait_event.c
M src/include/access/xlogarchive.h
M src/include/utils/wait_event.h

Remove lazy_scan_heap parallel VACUUM comment block.

commit   : 97f5aef609ce51422934b7dbdba599a7de4dbafd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 21 Nov 2021 16:22:57 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 21 Nov 2021 16:22:57 -0800    

Click here for diff

This doesn't belong next to very high level discussion of the tasks that  
lazy_scan_heap performs.  There is already a similar, longer comment  
block at the top of vacuumlazy.c that mentions lazy_scan_heap directly.  

M src/backend/access/heap/vacuumlazy.c

pg_receivewal, pg_recvlogical: allow canceling initial password prompt.

commit   : 282b6d00abf5cebece6f94c796a4ed807a0176db    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Nov 2021 14:13:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Nov 2021 14:13:35 -0500    

Click here for diff

Previously it was impossible to terminate these programs via control-C  
while they were prompting for a password.  We can fix that trivially  
for their initial password prompts, by moving setup of the SIGINT  
handler from just before to just after their initial GetConnection()  
calls.  
  
This fix doesn't permit escaping out of later re-prompts, but those  
should be exceedingly rare, since the user's password or the server's  
authentication setup would have to have changed meanwhile.  We  
considered applying a fix similar to commit 46d665bc2, but that  
seemed more complicated than it'd be worth.  Moreover, this way is  
back-patchable, which that wasn't.  
  
The misbehavior exists in all supported versions, so back-patch to all.  
  
Tom Lane and Nathan Bossart  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c

Doc: update some things relevant to minimum Test::More version.

commit   : 92e70796e91e2f9086fad0156e0e91513e54a66b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 21 Nov 2021 11:49:16 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 21 Nov 2021 11:49:16 -0500    

Click here for diff

Oversights in commit 405f32fc4.  
  
Also, add a tip (discovered the hard way) about getting Test::More  
0.98 to pass its regression tests on recent Linux platforms.  

M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/README

Require version 0.98 of Test::More for TAP tests

commit   : 405f32fc49609eb94fa39e7b5e7c1fe2bb2b73aa    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 20 Nov 2021 17:54:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 20 Nov 2021 17:54:43 -0500    

Click here for diff

This means that the subtest feature will be available for use.  
  
We expect that this change will make prairiedog go red until it is  
updated, but other buildfarm animals should be fine.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/test/perl/PostgreSQL/Test/Utils.pm

Fix SP-GiST scan initialization logic for binary-compatible cases.

commit   : f4e7ae2b8a67ad6801726553a024a3306716ef80    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Nov 2021 14:29:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Nov 2021 14:29:56 -0500    

Click here for diff

Commit ac9099fc1 rearranged the logic in spgGetCache() that determines  
the index's attType (nominal input data type) and leafType (actual  
type stored in leaf index tuples).  Turns out this broke things for  
the case where (a) the actual input data type is different from the  
nominal type, (b) the opclass's config function leaves leafType  
defaulted, and (c) the opclass has no "compress" function.  (b) caused  
us to assign the actual input data type as leafType, and then since  
that's not attType, we complained that a "compress" function is  
required.  For non-polymorphic opclasses, condition (a) arises in  
binary-compatible cases, such as using SP-GiST text_ops for a varchar  
column, or using any opclass on a domain over its nominal input type.  
  
To fix, use attType for leafType when the index's declared column type  
is different from but binary-compatible with attType.  Do this only in  
the defaulted-leafType case, to avoid overriding any explicit  
selection made by the opclass.  
  
Per bug #17294 from Ilya Anfimov.  Back-patch to v14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgutils.c
M src/test/regress/expected/spgist.out
M src/test/regress/sql/spgist.sql

Allow psql's other uses of simple_prompt() to be interrupted by ^C.

commit   : 46d665bc26ce57b5afecbc218c8fc3c6848211d8    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 19 Nov 2021 12:11:38 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 19 Nov 2021 12:11:38 -0500    

Click here for diff

This fills in the work left un-done by 5f1148224.  \prompt can  
be canceled out of now, and so can password prompts issued during  
\connect.  (We don't need to do anything for password prompts  
issued during startup, because we aren't yet trapping SIGINT  
at that point.)  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c
M src/bin/psql/startup.c
M src/common/sprompt.c

Initialize backend status reporting during bootstrap.

commit   : 3b34645678d1a516c148e3e27c26325708e92f6f    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 19 Nov 2021 08:43:12 -0800    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 19 Nov 2021 08:43:12 -0800    

Click here for diff

This allows a later commit to reduce the number of branches in performance  
sensitive functions during normal running, compared to a very minor saving  
during bootstrapping.  
  
Author: Melanie Plageman <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAAKRu_Yeg+vh6SHNEo1+=O7e-BPX35cU0XQM=YwQRnkFyv_y+w@mail.gmail.com  

M src/backend/utils/init/postinit.c

Fix parallel operations that prevent oldest xmin from advancing.

commit   : 0f0cfb494004befb0f6e89d3129347869420c509    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 19 Nov 2021 09:04:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 19 Nov 2021 09:04:40 +0530    

Click here for diff

While determining xid horizons, we skip over backends that are running  
Vacuum. We also ignore Create Index Concurrently, or Reindex Concurrently  
for the purposes of computing Xmin for Vacuum. But we were not setting the  
flags corresponding to these operations when they are performed in  
parallel which was preventing Xid horizon from advancing.  
  
The optimization related to skipping Create Index Concurrently, or Reindex  
Concurrently operations was implemented in PG-14 but the fix is the same  
for the Parallel Vacuum as well so back-patched till PG-13.  
  
Author: Masahiko Sawada  
Reviewed-by: Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CAD21AoCLQqgM1sXh9BrDFq0uzd3RBFKi=Vfo6cjjKODm0Onr5w@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h

Improve psql tab completion for transforms, domains and sequences

commit   : 0cd6d3b3c5aeac81903aa7de92e406f8567898a2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Nov 2021 11:02:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Nov 2021 11:02:15 +0900    

Click here for diff

The following improvements are done:  
- Addition of some tab completion for CREATE DOMAIN.  
- Addition of some tab completion for CREATE TRANSFORM.  
- Addition of type completion for CREATE SEQUENCE AS.  
  
Author: Ken Kato  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Use appropriate -Wno-warning switches when compiling bitcode.

commit   : 276517a96484f9e39a7a1095ab39fa76ef1ee8cc    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Nov 2021 14:50:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Nov 2021 14:50:13 -0500    

Click here for diff

We use "clang" to compile bitcode files for LLVM inlining.  That might  
be different from the build's main C compiler, so it needs its own set  
of compiler flags.  To simplify configure, we don't bother adding any  
-W switches to that flag set; there's little need since the main build  
will show us any warnings.  However, if we don't want to see unwanted  
warnings, we still have to add any -Wno-warning switches we'd normally  
use with clang.  
  
This escaped notice before commit 9ff47ea41, which tried to add  
-Wno-compound-token-split-by-macro; buildfarm animals using mismatched  
CC and CLANG still showed those warnings.  I'm not sure why we never  
saw any effects from the lack of -Wno-unused-command-line-argument  
(maybe that's only activated by -Wall?).  clang does not currently  
support -Wno-format-truncation or -Wno-stringop-truncation, although  
in the interests of future-proofing and consistency I included tests  
for those.  
  
Back-patch to v11 where we started building bitcode files.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Fix quoting of ACL item in table for upgrade binary compatibility checks

commit   : ac1c7458b17633d1e53a01393d12774c10cb6a91    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Nov 2021 12:52:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Nov 2021 12:52:49 +0900    

Click here for diff

Per buildfarm member prion, that runs the regression tests under a role  
name that uses a hyphen.  Issue introduced by 835bcba.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Add table to regression tests for binary-compatibility checks in pg_upgrade

commit   : 835bcba8b8d72a00cecc5431b67e70bbea93f947    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Nov 2021 10:37:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Nov 2021 10:37:15 +0900    

Click here for diff

This commit adds to the main regression test suite a table with all  
the in-core data types (some exceptions apply).  This table is not  
dropped, so as pg_upgrade would be able to check the binary  
compatibility of the types tracked in the table.  If a new type is added  
in core, this part of the tests would need a refresh but the tests are  
designed to fail if that were to happen.  
  
As this is useful for upgrades and that these rely on the objects  
created in the regression test suite of the old version upgraded from,  
a backpatch down to 12 is done, which is the last point where a binary  
incompatible change has been done (7c15cef).  This will hopefully be  
enough to find out if something gets broken during the development of a  
new version of Postgres, so as it is possible to take actions in  
pg_upgrade itself in this case (like 0ccfc28 for sql_identifier).  
  
An area that is not covered yet is related to external modules, which  
may create their own types.  The testing infrastructure of pg_upgrade is  
not integrated yet with the external modules stored in core  
(src/test/modules/ or contrib/, all use the same database name for their  
tests so there would be an overlap).  This could be improved in the  
future.  
  
Author: Justin Pryzby  
Reviewed-by: Jacob Champion, Peter Eisentraut, Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Provide a variant of simple_prompt() that can be interrupted by ^C.

commit   : 5f1148224bd78bcf3bf7d916b8fe85dd820c52c6    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 19:09:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 19:09:54 -0500    

Click here for diff

Up to now, you couldn't escape out of psql's \password command  
by typing control-C (or other local spelling of SIGINT).  This  
is pretty user-unfriendly, so improve it.  To do so, we have to  
modify the functions provided by pg_get_line.c; but we don't  
want to mess with psql's SIGINT handler setup, so provide an  
API that lets that handler cause the cancel to occur.  
  
This relies on the assumption that we won't do any major harm by  
longjmp'ing out of fgets().  While that's obviously a little shaky,  
we've long had the same assumption in the main input loop, and few  
issues have been reported.  
  
psql has some other simple_prompt() calls that could usefully  
be improved the same way; for now, just deal with \password.  
  
Nathan Bossart, minor tweaks by me  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/hba.c
M src/bin/initdb/initdb.c
M src/bin/psql/command.c
M src/bin/psql/nls.mk
M src/common/pg_get_line.c
M src/common/sprompt.c
M src/include/common/string.h

Add a planner support function for starts_with().

commit   : a148f8bc04b9980f019ea0d4b89311cf0bdc22b7    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 16:54:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 16:54:12 -0500    

Click here for diff

This fills in some gaps in planner support for starts_with() and  
the equivalent ^@ operator:  
  
* A condition such as "textcol ^@ constant" can now use a regular  
btree index, not only an SP-GiST index, so long as the index's  
collation is C.  (This works just like "textcol LIKE 'foo%'".)  
  
* "starts_with(textcol, constant)" can be optimized the same as  
"textcol ^@ constant".  
  
* Fixed-prefix LIKE and regex patterns are now more like starts_with()  
in another way: if you apply one to an SPGiST-indexed column, you'll  
get an index condition using ^@ rather than two index conditions with  
>= and <.  
  
Per a complaint from Shay Rojansky.  Patch by me; thanks to  
Nathan Bossart for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/like_support.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/create_index_spgist.out
M src/test/regress/sql/create_index_spgist.sql

Clean up error handling in pg_basebackup's walmethods.c.

commit   : 248c3a937dd018a72095f407cff727c9f08db0c1    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 14:16:34 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 14:16:34 -0500    

Click here for diff

The error handling here was a mess, as a result of a fundamentally  
bad design (relying on errno to keep its value much longer than is  
safe to assume) as well as a lot of just plain sloppiness, both as  
to noticing errors at all and as to reporting the correct errno.  
Moreover, the recent addition of LZ4 compression broke things  
completely, because liblz4 doesn't use errno to report errors.  
  
To improve matters, keep the error state in the DirectoryMethodData or  
TarMethodData struct, and add a string field so we can handle cases  
that don't set errno.  (The tar methods already had a version of this,  
but it can be done more efficiently since all these cases use a  
constant error string.)  Make the dir and tar methods handle errors  
in basically identical ways, which they didn't before.  
  
This requires copying errno into the state struct in a lot of places,  
which is a bit tedious, but it has the virtue that we can get rid of  
ad-hoc code to save and restore errno in a number of places ... not  
to mention that it fixes other places that should've saved/restored  
errno but neglected to.  
  
In passing, fix some pointlessly static buffers to be ordinary  
local variables.  
  
There remains an issue about exactly how to handle errors from  
fsync(), but that seems like material for its own patch.  
  
While the LZ4 problems are new, all the rest of this is fixes for  
old bugs, so backpatch to v10 where walmethods.c was introduced.  
  
Patch by me; thanks to Michael Paquier for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/walmethods.c

Handle close() failures more robustly in pg_dump and pg_basebackup.

commit   : 3cac2c8caaefc642332e6994ce80032cc7d4cfdf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 13:08:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 13:08:25 -0500    

Click here for diff

Coverity complained that applying get_gz_error after a failed gzclose,  
as we did in one place in pg_basebackup, is unsafe.  I think it's  
right: it's entirely likely that the call is touching freed memory.  
Change that to inspect errno, as we do for other gzclose calls.  
  
Also, be careful to initialize errno to zero immediately before any  
gzclose() call where we care about the error status.  (There are  
some calls where we don't, because we already failed at some previous  
step.)  This ensures that we don't get a misleadingly irrelevant  
error code if gzclose() fails in a way that doesn't set errno.  
We could work harder at that, but it looks to me like all such cases  
are basically can't-happen if we're not misusing zlib, so it's  
not worth the extra notational cruft that would be required.  
  
Also, fix several places that simply failed to check for close-time  
errors at all, mostly at some remove from the close or gzclose itself;  
and one place that did check but didn't bother to report the errno.  
  
Back-patch to v12.  These mistakes are older than that, but between  
the frontend logging API changes that happened in v12 and the fact  
that frontend code can't rely on %m before that, the patch would need  
substantial revision to work in older branches.  It doesn't quite  
seem worth the trouble given the lack of related field complaints.  
  
Patch by me; thanks to Michael Paquier for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c

Fix display of SQL-standard function's arguments in INSERT/SELECT.

commit   : a8d8445a7b2f80f6d0bfe97b19f90bd2cbef8759    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 11:31:31 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 17 Nov 2021 11:31:31 -0500    

Click here for diff

If a SQL-standard function body contains an INSERT ... SELECT statement,  
any function parameters referenced within the SELECT were always printed  
in $N style, rather than using the parameter name if any.  While not  
strictly incorrect, this wasn't the intention, and it's inconsistent  
with the way that such parameters would be printed in any other kind  
of statement.  
  
The cause is that the recursion to get_query_def from  
get_insert_query_def neglected to pass down the context->namespaces  
list, passing constant NIL instead.  This is a very ancient oversight,  
but AFAICT it had no visible consequences before commit e717a9a18  
added an outermost namespace with function parameters.  We don't allow  
INSERT ... SELECT as a sub-query, except in a top-level WITH clause,  
where it couldn't contain any outer references that might need to access  
upper namespaces.  So although that's arguably a bug, I don't see any  
point in changing it before v14.  
  
In passing, harden the code added to get_parameter by e717a9a18 so that  
it won't crash if a PARAM_EXTERN Param appears in an unexpected place.  
  
Per report from Erki Eessaar.  Code fix by me, regression test case  
by Masahiko Sawada.  
  
Discussion: https://postgr.es/m/AM9PR01MB8268347BED344848555167FAFE949@AM9PR01MB8268.eurprd01.prod.exchangelabs.com  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

Improve publication error messages

commit   : aa12781b0d039d93e1a851ece4bc75c3746cbd43    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Nov 2021 14:40:38 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Nov 2021 14:40:38 +0100    

Click here for diff

Commit 81d5995b4b introduced more fine-grained errormessages for  
incorrect relkinds for publication, while unlogged and temporary  
tables were reported with using the same message.  This provides  
separate error messages for these types of relpersistence.  
  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Jeevan Ladhe <[email protected]>  
Reviewed-by: Euler Taveira <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACW9S=AswyQHjtO6WMcsergMkCBTtzXGrM8DX26DzfeTLQ@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/catalog/pg_publication.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Doc: add see-also references to CREATE PUBLICATION.

commit   : 3374a87b62cc553fa65f57ade019dcf3104ae639    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Nov 2021 13:34:41 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Nov 2021 13:34:41 +0100    

Click here for diff

The "See also" section on the reference page for CREATE PUBLICATION  
didn't match the cross references on CREATE SUBSCRIPTION and their  
ALTER counterparts. Fixed by adding an xref to the CREATE and ALTER  
SUBSCRIPTION pages.  Backpatch down to v10 where CREATE PUBLICATION  
was introduced.  
  
Author: Peter Smith <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAHut+PvGWd3-Ktn96c-z6uq-8TGVVP=TPOkEovkEfntoo2mRhw@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ref/create_publication.sgml

Fix incorrect format placeholders

commit   : 303d4eb1c548f1d0821e168a6e7c7e9bd02c8088    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 17 Nov 2021 07:30:30 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 17 Nov 2021 07:30:30 +0100    

Click here for diff

M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c

Remove global variable "LastRec" in xlog.c

commit   : f975fc3a3542005ed0dd689bdb5bd9ed4e1f4d52    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Nov 2021 11:04:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Nov 2021 11:04:18 +0900    

Click here for diff

This variable is used only by StartupXLOG() now, so let's make it local  
to simplify the code.  
  
Author: Amul Sul  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/CAAJ_b96Qd023itERBRN9Z7P2saNDT3CYvGuMO8RXwndVNN6z7g@mail.gmail.com  

M src/backend/access/transam/xlog.c

Fix headerscheck failure in replication/worker_internal.h

commit   : ad26ee28250c4cd357a7420161a2be321c3dd536    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 16 Nov 2021 13:30:37 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 16 Nov 2021 13:30:37 -0300    

Click here for diff

Broken by 31c389d8de91  

M src/include/replication/worker_internal.h

Move InitXLogInsert() call from InitXLOGAccess() to BaseInit().

commit   : e51c46991f0ee99cca222305619dee5543a1290a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Nov 2021 09:43:17 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Nov 2021 09:43:17 -0500    

Click here for diff

At present, there is an undocumented coding rule that you must call  
RecoveryInProgress(), or do something else that results in a call  
to InitXLogInsert(), before trying to write WAL. Otherwise, the  
WAL construction buffers won't be initialized, resulting in  
failures.  
  
Since it's not good to rely on a status inquiry function like  
RecoveryInProgress() having the side effect of initializing  
critical data structures, instead do the initialization eariler,  
when the backend first starts up.  
  
Patch by me. Reviewed by Nathan Bossart and Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmoY7b65qRjzHN_tWUk8B4sJqk1vj1d31uepVzmgPnZKeLg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/utils/init/postinit.c

Invalidate relcache when changing REPLICA IDENTITY index.

commit   : 354a1f8d220fbbb07b0ded32c5ade72646afb801    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 16 Nov 2021 08:10:13 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 16 Nov 2021 08:10:13 +0530    

Click here for diff

When changing REPLICA IDENTITY INDEX to another one, the target table's  
relcache was not being invalidated. This leads to skipping update/delete  
operations during apply on the subscriber side as the columns required to  
search corresponding rows won't get logged.  
  
Author: Tang Haiying, Hou Zhijie  
Reviewed-by: Euler Taveira, Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/OS0PR01MB61133CA11630DAE45BC6AD95FB939@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/backend/commands/tablecmds.c
M src/test/subscription/t/100_bugs.pl

Fix thinko in bbsink_throttle_manifest_contents.

commit   : 1b098da2009362e0e8d9a1d0a6aac2f2bd3e2f0b    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 Nov 2021 14:22:13 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 Nov 2021 14:22:13 -0500    

Click here for diff

Report and diagnosis by Dmitry Dolgov.  
  
Discussion: http://postgr.es/m/20211115162641.dmo6l32fklh64gnw@localhost  

M src/backend/replication/basebackup_throttle.c

Explain pruning pgstats accounting subtleties.

commit   : b0f7425ec2445678f32381de8bd3174d3cc2167e    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 12 Nov 2021 19:45:58 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 12 Nov 2021 19:45:58 -0800    

Click here for diff

Add a comment explaining why the pgstats accounting used during  
opportunistic heap pruning operations (to maintain the current number of  
dead tuples in the relation) needs to compensate by subtracting away the  
number of new LP_DEAD items.  This is needed so it can avoid completely  
forgetting about tuples that become LP_DEAD items during pruning -- they  
should still count.  
  
It seems more natural to discuss this issue at the only relevant call  
site (opportunistic pruning), since the same issue does not apply to the  
only other caller (the VACUUM call site).  Move everything there too.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzm7f+A6ej650gi_ifTgbhsadVW5cujAL3punpupHff5Yg@mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Document PG_TEST_NOCLEAN in TAP test README

commit   : 05d8785af2a192d436df5b7734aacb4e0bab5da8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 12 Nov 2021 21:38:10 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 12 Nov 2021 21:38:10 +0100    

Click here for diff

Commit 90627cf98 added support for retaining the data directory even on  
successful tests, but failed to document the environment variable which  
controls retention. This adds a small note to the TAP test README about  
PG_TEST_NOCLEAN which when set skips removing the data directories from  
successful tests.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/README

Make psql's \password default to CURRENT_USER, not PQuser(conn).

commit   : d6eb5a0c258d3da5471814bcc6ed6498129fee16    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Nov 2021 14:55:32 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Nov 2021 14:55:32 -0500    

Click here for diff

The documentation says plainly that \password acts on "the current user"  
by default.  What it actually acted on, or tried to, was the username  
used to log into the current session.  This is not the same thing if  
one has since done SET ROLE or SET SESSION AUTHENTICATION.  Aside from  
the possible surprise factor, it's quite likely that the current role  
doesn't have permissions to set the password of the original role.  
  
To fix, use "SELECT CURRENT_USER" to get the role name to act on.  
(This syntax works with servers at least back to 7.0.)  Also, in  
hopes of reducing confusion, include the role name that will be  
acted on in the password prompt.  
  
The discrepancy from the documentation makes this a bug, so  
back-patch to all supported branches.  
  
Patch by me; thanks to Nathan Bossart for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/command.c

postgres_fdw: suppress casts on constants in limited cases.

commit   : f8abb0f5e114d8c309239f0faa277b97f696d829    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 12 Nov 2021 11:50:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 12 Nov 2021 11:50:40 -0500    

Click here for diff

When deparsing an expression of the form "remote_var OP constant",  
we'd normally apply a cast to the constant to make sure that the  
remote parser thinks it's of the same type we do.  However, doing  
so is often not necessary, and it causes problems if the user has  
intentionally declared the local column as being of a different  
type than the remote column.  A plausible use-case for that is  
using text to represent a type that's an enum on the remote side.  
A comparison on such a column will get shipped as "var = 'foo'::text",  
which blows up on the remote side because there's no enum = text  
operator.  But if we simply leave off the explicit cast, the  
comparison will do exactly what the user wants.  
  
It's possible to do this without major risk of semantic problems, by  
relying on the longstanding parser heuristic that "if one operand of  
an operator is of type unknown, while the other one has a known type,  
assume that the unknown operand is also of that type".  Hence, this  
patch leaves off the cast only if (a) the operator inputs have the same  
type locally; (b) the constant will print as a string literal or NULL,  
both of which are initially taken as type unknown; and (c) the non-Const  
input is a plain foreign Var.  Rule (c) guarantees that the remote  
parser will know the type of the non-Const input; moreover, it means  
that if this cast-omission does cause any semantic surprises, that can  
only happen in cases where the local column has a different type than  
the remote column.  That wasn't guaranteed to work anyway, and this  
patch should represent a net usability gain for such cases.  
  
One point that I (tgl) remain slightly uncomfortable with is that we  
will ignore an implicit RelabelType when deciding if the non-Const input  
is a plain Var.  That makes it a little squishy to argue that the remote  
should resolve the Const as being of the same type as its Var, because  
then our Const is not the same type as our Var.  However, if we don't do  
that, then this hack won't work as desired if the user chooses to use  
varchar rather than text to represent some remote column.  That seems  
useful, so do it like this for now.  We might have to give up the  
RelabelType-ignoring bit if any problems surface.  
  
Dian Fay, with review and kibitzing by me  
  
Discussion: https://postgr.es/m/C9LU294V7K4F.34LRRDU449O45@lamia  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Report found versions of required perl modules

commit   : 1593998ae858902e805eb0f8bf3b019399044471    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 12 Nov 2021 10:36:30 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 12 Nov 2021 10:36:30 -0500    

Click here for diff

Configure tests for the presence of perl modules required for TAP tests,  
and that they meet specified minimum version requirements. This patch  
makes it report the version of the module that's actually found rather  
than just an 'ok' message. This will help in deciding if we can upgrade  
minimum requirements for these modules.  
  
Discussion: https://postgr.es/m/[email protected]  

M config/ax_prog_perl_modules.m4
M configure

Fix memory overrun when querying pg_stat_slru

commit   : a45ed975c58fde7303eeae488b313bf0314383f7    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Nov 2021 21:49:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Nov 2021 21:49:21 +0900    

Click here for diff

pg_stat_get_slru() in pgstatfuncs.c would point to one element after the  
end of the array PgStat_SLRUStats when finishing to scan its entries.  
This had no direct consequences as no data from the extra memory area  
was read, but static analyzers would rightfully complain here.  So let's  
be clean.  
  
While on it, this adds one regression test in the area reserved for  
system views.  
  
Reported-by: Alexander Kozhemyakin, via AddressSanitizer  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/utils/adt/pgstatfuncs.c
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Report any XLogReadRecord() error in XlogReadTwoPhaseData().

commit   : 335474691054a74d771f0e7c24d25e800e3a37b6    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 11 Nov 2021 17:10:18 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 11 Nov 2021 17:10:18 -0800    

Click here for diff

Buildfarm members kittiwake and tadarida have witnessed errors at this  
site.  The site discarded key facts.  Back-patch to v10 (all supported  
versions).  
  
Reviewed by Michael Paquier and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/twophase.c

Update heap_page_prune() free space map comments.

commit   : 42f9427aa98a2245d29737e0f3b8aaf39a7f57ec    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 11 Nov 2021 13:42:17 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 11 Nov 2021 13:42:17 -0800    

Click here for diff

It is up to the heap_page_prune() caller to decide what to do about  
updating the FSM for a page following pruning.  Update old comments that  
address what we might want to do as if it was the responsibility of  
heap_page_prune() itself.  heap_page_prune() doesn't have enough  
high-level context to make a sensible choice.  

M src/backend/access/heap/pruneheap.c

Update another obsolete reference in vacuumlazy.c.

commit   : eb9baef8e92adf81c6adbe44f1d67878d850bff7    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 11 Nov 2021 13:13:08 -0800    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 11 Nov 2021 13:13:08 -0800    

Click here for diff

Addresses an oversight in commit 7ab96cf6.  

M src/backend/access/heap/vacuumlazy.c

Improve performance of pgarch_readyXlog() with many status files.

commit   : beb4e9ba1652a04f66ff20261444d06f678c0b2d    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Nov 2021 15:02:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Nov 2021 15:02:53 -0500    

Click here for diff

Presently, the archive_status directory was scanned for each file to  
archive.  When there are many status files, say because archive_command  
has been failing for a long time, these directory scans can get very  
slow.  With this change, the archiver remembers several files to archive  
during each directory scan, speeding things up.  
  
To ensure timeline history files are archived as quickly as possible,  
XLogArchiveNotify() forces the archiver to do a new directory scan as  
soon as the .ready file for one is created.  
  
Nathan Bossart, per a long discussion involving many people. It is  
not clear to me exactly who out of all those people reviewed this  
particular patch.  
  
Discussion: http://postgr.es/m/CA+TgmobhAbs2yabTuTRkJTq_kkC80-+jw=pfpypdOJ7+gAbQbw@mail.gmail.com  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/pgarch.c
M src/include/postmaster/pgarch.h

Fall back to unsigned int, not int, for socklen_t.

commit   : 01ec41a5fe4aa590dde18a2c551432aa1925caea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Nov 2021 10:36:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Nov 2021 10:36:39 -0500    

Click here for diff

It's a coin toss which of these is a better default assumption.  
However, of the machines we have in the buildfarm, the only ones  
relying on the fallback socklen_t definition are ancient HPUX,  
and on that platform unsigned int is the right choice.  Minor  
tweak to ee3a1a5b6.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port.h

Restore lock level to set vacuum flags

commit   : 0726c764bc4ec337a0216a546ce41c758d81600d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 11 Nov 2021 11:03:29 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 11 Nov 2021 11:03:29 -0300    

Click here for diff

Commit 27838981be9d mistakenly reduced the lock level from exclusive to  
shared that is acquired to set PGPROC->statusFlags; this was reverted  
by dcfff74fb166, but failed to do so in one spot.  Fix it.  
  
Backpatch to 14.  
  
Noted by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/slot.c

doc: Add referential actions to CREATE/ALTER TABLE synopsis

commit   : db9f287711ac49d9799f93f664d6d101ff8f5891    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Nov 2021 10:49:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Nov 2021 10:49:44 +0100    

Click here for diff

The general constraint synopsis references "referential_action", but  
this was not further defined in the synopsis section.  Compared to the  
level of detail that the synopsis gives to other subclauses, this  
should surely be there.  
  
extracted from a patch by Paul Martinez <[email protected]>  
  
Discussion: https://www.postgresql.org/message-id/flat/CACqFVBZQyMYJV=njbSMxf+rbDHpx=W=B7AEaMKn8dWn9OZJY7w@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml

Fix buffer overrun in unicode string normalization with empty input

commit   : 098c134556664d37b78ae87853a82f4a9d23a2c8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Nov 2021 15:00:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Nov 2021 15:00:59 +0900    

Click here for diff

PostgreSQL 13 and newer versions are directly impacted by that through  
the SQL function normalize(), which would cause a call of this function  
to write one byte past its allocation if using in input an empty  
string after recomposing the string with NFC and NFKC.  Older versions  
(v10~v12) are not directly affected by this problem as the only code  
path using normalization is SASLprep in SCRAM authentication that  
forbids the case of an empty string, but let's make the code more robust  
anyway there so as any out-of-core callers of this function are covered.  
  
The solution chosen to fix this issue is simple, with the addition of a  
fast-exit path if the decomposed string is found as empty.  This would  
only happen for an empty string as at its lowest level a codepoint would  
be decomposed as itself if it has no entry in the decomposition table or  
if it has a decomposition size of 0.  
  
Some tests are added to cover this issue in v13~.  Note that an empty  
string has always been considered as normalized (grammar "IS NF[K]{C,D}  
NORMALIZED", through the SQL function is_normalized()) for all the  
operations allowed (NFC, NFD, NFKC and NFKD) since this feature has been  
introduced as of 2991ac5.  This behavior is unchanged but some tests are  
added in v13~ to check after that.  
  
I have also checked "make normalization-check" in src/common/unicode/,  
while on it (works in 13~, and breaks in older stable branches  
independently of this commit).  
  
The release notes should just mention this commit for v13~.  
  
Reported-by: Matthijs van der Vleuten  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/common/unicode_norm.c
M src/test/regress/expected/unicode.out
M src/test/regress/sql/unicode.sql

Clean up compilation warnings coming from PL/Perl with clang-12~

commit   : 9ff47ea414c4e6ace347fc4e59866e38b9bbceaf    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Nov 2021 10:51:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Nov 2021 10:51:00 +0900    

Click here for diff

clang-12 has introduced -Wcompound-token-split-by-macro, that is causing  
a large amount of warnings when building PL/Perl because of its  
interactions with upstream Perl.  This commit adds one -Wno to CFLAGS at  
./configure time if the flag is supported by the compiler to silence all  
those warnings.  
  
Upstream perl has fixed this issue, but it is going to take some time  
before this is spread across the buildfarm, and we have noticed that  
some animals would be useful with an extra -Werror to help with the  
detection of incorrect placeholders (see b0cf544), dangomushi being  
one.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/YYr3qYa/[email protected]  
Backpatch-through: 10  

M configure
M configure.ac

Doc: improve protocol spec for logical replication Type messages.

commit   : c3b33698cf88550b017620f73b94b53029897f39    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 10 Nov 2021 13:12:58 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 10 Nov 2021 13:12:58 -0500    

Click here for diff

protocol.sgml documented the layout for Type messages, but completely  
dropped the ball otherwise, failing to explain what they are, when  
they are sent, or what they're good for.  While at it, do a little  
copy-editing on the description of Relation messages.  
  
In passing, adjust the comment for apply_handle_type() to make it  
clearer that we choose not to do anything when receiving a Type  
message, not that we think it has no use whatsoever.  
  
Per question from Stefen Hillman.  
  
Discussion: https://postgr.es/m/CAPgW8pMknK5pup6=T4a_UG=Cz80Rgp=KONqJmTdHfaZb0RvnFg@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/logical/worker.c

Fix thinko in assertion in basebackup.c.

commit   : 10eae82b27cebbb9586cda8baf8e3226496891d0    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Nov 2021 10:12:20 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Nov 2021 10:12:20 -0500    

Click here for diff

Commit 5a1007a5088cd6ddf892f7422ea8dbaef362372f tried to introduce  
an assertion that the block size was at least twice the size of a  
tar block, but I got the math wrong. My error was reported to me  
off-list.  

M src/backend/replication/basebackup.c

More cleanup of 'ThisTimeLineID'.

commit   : a27048cbcb582056bfbf15aa2f898b4a3ec74304    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 10 Nov 2021 09:36:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 10 Nov 2021 09:36:57 -0500    

Click here for diff

In XLogCtlData, rename the structure member ThisTimeLineID to  
InsertTimeLineID and update the comments to make clear that it's only  
expected to be set after recovery is complete.  
  
In StartupXLOG, replace the local variables ThisTimeLineID and  
PrevTimeLineID with new local variables replayTLI and newTLI.  In the  
old scheme, ThisTimeLineID was the replay TLI until we created a new  
timeline, and after that the replay TLI was in PrevTimeLineID. Now,  
replayTLI is the TLI from which we last replayed WAL throughout the  
entire function, and newTLI is either that, or the new timeline created  
upon promotion.  
  
Remove some misleading comments from the comment block just above where  
recoveryTargetTimeLineGoal and friends are declared. It's become  
incorrect, not only because ThisTimeLineID as a variable is now gone,  
but also because the rmgr code does not care about ThisTimeLineID and  
has not since what used to be the TLI field in the page header was  
repurposed to store the page checksum.  
  
Add a comment GetFlushRecPtr that it's only supposed to be used in  
normal running, and an assertion to verify that this is so.  
  
Per some ideas from Michael Paquier and some of my own. Review by  
Michael Paquier also.  
  
Discussion: http://postgr.es/m/CA+TgmoY1a2d1AnVR3tJcKmGGkhj7GGrwiNwjtKr21dxOuLBzCQ@mail.gmail.com  

M src/backend/access/transam/xlog.c

Fix incorrect format placeholders

commit   : 733e0391536dad99a2677ca5e19291854da5730f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 10 Nov 2021 08:13:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 10 Nov 2021 08:13:12 +0100    

Click here for diff

M contrib/amcheck/verify_heapam.c

Improve error messages for some callers of XLogReadRecord()

commit   : c9c401a5e13accc4a3a775e3feeabdc5940c9178    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Nov 2021 12:00:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Nov 2021 12:00:33 +0900    

Click here for diff

A couple of code paths related to logical decoding (WAL sender, slot  
advancing, etc.) use XLogReadRecord(), feeding on error messages  
generated by walreader.c on a failure.  All those messages have no  
context, making it harder to spot from where an error could come even if  
these should not happen.  All the other callers of XLogReadRecord() do  
that already.  
  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c

Add pg_checkpointer predefined role for CHECKPOINT command.

commit   : 4168a4745492cd54a0ffffc271b452525ef4dc60    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 9 Nov 2021 10:59:08 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 9 Nov 2021 10:59:08 -0800    

Click here for diff

Any user with the privileges of pg_checkpointer can issue a CHECKPOINT  
command.  
  
Reviewed-by: Stephen Frost  
Discussion: https://postgr.es/m/67a1d667e8ec228b5e07f232184c80348c5d93f4.camel%40j-davis.com  

M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/tcop/utility.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat

Fix instability in 026_overwrite_contrecord.pl test.

commit   : b66767b56b1cd082f3499a7e5a21b480dd004f51    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Nov 2021 18:40:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Nov 2021 18:40:19 -0500    

Click here for diff

We've seen intermittent failures in this test on slower buildfarm  
machines, which I think can be explained by assuming that autovacuum  
emitted some additional WAL.  Disable autovacuum to stabilize it.  
  
In passing, use stringwise not numeric comparison to compare  
WAL file names.  Doesn't matter at present, but they are  
hex strings not decimal ...  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/026_overwrite_contrecord.pl

Have the server properly terminate tar archives.

commit   : 5a1007a5088cd6ddf892f7422ea8dbaef362372f    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 9 Nov 2021 14:21:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 9 Nov 2021 14:21:35 -0500    

Click here for diff

Earlier versions of PostgreSQL featured a version of pg_basebackup  
that wanted to edit tar archives but was too dumb to parse them  
properly. The server made things easier for the client by failing  
to add the two blocks of zero bytes that ought to end a tar file,  
leaving it up to the client to do that.  
  
But since commit 23a1c6578c87fca0e361c4f5f9a07df5ae1f9858, we  
don't need this hack any more, because pg_basebackup is now smarter  
and can parse tar files even if they are properly terminated! So  
change the server to always properly terminate the tar files. Older  
versions of pg_basebackup can't talk to new servers anyway, so  
there's no compatibility break.  
  
On the pg_basebackup side, we see still need to add the terminating  
zero bytes if we're talking to an older server, but not when the  
server is v15+. Hopefully at some point we'll be able to remove  
some of this compatibility cruft, but it seems best to hang on to  
it for now.  
  
In passing, add a file header comment to bbstreamer_tar.c, to make  
it clearer what's going on here.  
  
Discussion: http://postgr.es/m/CA+TgmoZbNzsWwM4BE5Jb_qHncY817DYZwGf+2-7hkMQ27ZwsMQ@mail.gmail.com  

M src/backend/replication/basebackup.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/pg_basebackup.c

Remove check for accept() argument types

commit   : ee3a1a5b636b69dde33d68c428dd56b3389a4538    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 9 Nov 2021 15:20:47 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 9 Nov 2021 15:20:47 +0100    

Click here for diff

This check was used to accommodate a staggering variety in particular  
in the type of the third argument of accept().  This is no longer of  
concern on currently supported systems.  We can just use socklen_t in  
the code and put in a simple check that substitutes int for socklen_t  
if it's missing, to cover the few stragglers.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M aclocal.m4
D config/ac_func_accept_argtypes.m4
M configure
M configure.ac
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/pgstat.c
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/include/port.h
M src/interfaces/libpq/fe-connect.c
M src/port/getpeereid.c
M src/tools/msvc/Solution.pm

Make some comments use the term "ProcSignal" for consistency

commit   : 4cd046c203bbca2955182f78eabc06e831ffdbb1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Nov 2021 12:56:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Nov 2021 12:56:34 +0900    

Click here for diff

The surroundings in procsignal.c prefer using "ProcSignal" rather than  
"procsignal".  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACX99ghPmm1M_O4r4g+YsXFjCn=qF7PeDXntLwMpht_Gdg@mail.gmail.com  

M src/backend/storage/ipc/procsignal.c

doc: Add index entries for pg_stat_statements configuration parameters.

commit   : ec21779a5847ed89fab19431abbdba794d4a998e    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 9 Nov 2021 12:39:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 9 Nov 2021 12:39:47 +0900    

Click here for diff

Author: Ken Kato  
Reviewed-by: Julien Rouhaud, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Rename some enums to use TABLE instead of REL.

commit   : b3812d0b9bcf00e8478186fc287940e17912248a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 9 Nov 2021 08:39:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 9 Nov 2021 08:39:33 +0530    

Click here for diff

Commit 5a2832465f introduced some enums to represent all tables in schema  
publications and used REL in their names. Use TABLE instead of REL in  
those enums to avoid confusion with other objects like SEQUENCES that can  
be part of a publication in the future.  
  
In the passing, (a) Change one of the newly introduced error messages to  
make it consistent for Create and Alter commands, (b) add missing alias in  
one of the SQL Statements that is used to print publications associated  
with the table.  
  
Reported-by: Tomas Vondra, Peter Smith  
Author: Vignesh C  
Reviewed-by: Hou Zhijie, Peter Smith  
Discussion: https://www.postgresql.org/message-id/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ%40mail.gmail.com  

M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/psql/describe.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/publication.out

Minimal fix for unterminated tar archive problem.

commit   : 57b5a9646d97a3e8a5b6b6d86b375cc8da6ac85c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 8 Nov 2021 16:36:06 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 8 Nov 2021 16:36:06 -0500    

Click here for diff

Commit 23a1c6578c87fca0e361c4f5f9a07df5ae1f9858 improved  
pg_basebackup's ability to parse tar archives, but also arranged  
to parse them only when we need to make some modification to the  
contents of the archive. That's a problem, because the server  
doesn't actually terminate tar archives. When the new parsing  
logic was engaged, pg_basebackup would properly terminate the  
tar file, but when it was skipped, pg_basebackup would just write  
whatever it got from the server, meaning that the terminator  
was missing.  
  
Most versions of tar are willing to overlook the missing terminator, but  
the AIX buildfarm animals were not. Fix by inventing a new kind of  
bbstreamer that just blindly adds a terminator, and using it whenever we  
don't parse the tar archive.  
  
Discussion: http://postgr.es/m/CA+TgmoZbNzsWwM4BE5Jb_qHncY817DYZwGf+2-7hkMQ27ZwsMQ@mail.gmail.com  

M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/pg_basebackup.c

Fix incorrect format placeholder.

commit   : b0cf5444f9a8d915b2e9b44790025f17a7dc107f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 14:32:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 14:32:29 -0500    

Click here for diff

Per buildfarm warnings.  

M src/bin/pg_basebackup/pg_receivewal.c

libpq: reject extraneous data after SSL or GSS encryption handshake.

commit   : 160c0258802d10b0600d7671b1bbea55d8e17d45    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 11:14:56 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 11:14:56 -0500    

Click here for diff

libpq collects up to a bufferload of data whenever it reads data from  
the socket.  When SSL or GSS encryption is requested during startup,  
any additional data received with the server's yes-or-no reply  
remained in the buffer, and would be treated as already-decrypted data  
once the encryption handshake completed.  Thus, a man-in-the-middle  
with the ability to inject data into the TCP connection could stuff  
some cleartext data into the start of a supposedly encryption-protected  
database session.  
  
This could probably be abused to inject faked responses to the  
client's first few queries, although other details of libpq's behavior  
make that harder than it sounds.  A different line of attack is to  
exfiltrate the client's password, or other sensitive data that might  
be sent early in the session.  That has been shown to be possible with  
a server vulnerable to CVE-2021-23214.  
  
To fix, throw a protocol-violation error if the internal buffer  
is not empty after the encryption handshake.  
  
Our thanks to Jacob Champion for reporting this problem.  
  
Security: CVE-2021-23222  

M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-connect.c

Reject extraneous data after SSL or GSS encryption handshake.

commit   : 28e24125541545483093819efae9bca603441951    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 11:01:43 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Nov 2021 11:01:43 -0500    

Click here for diff

The server collects up to a bufferload of data whenever it reads data  
from the client socket.  When SSL or GSS encryption is requested  
during startup, any additional data received with the initial  
request message remained in the buffer, and would be treated as  
already-decrypted data once the encryption handshake completed.  
Thus, a man-in-the-middle with the ability to inject data into the  
TCP connection could stuff some cleartext data into the start of  
a supposedly encryption-protected database session.  
  
This could be abused to send faked SQL commands to the server,  
although that would only work if the server did not demand any  
authentication data.  (However, a server relying on SSL certificate  
authentication might well not do so.)  
  
To fix, throw a protocol-violation error if the internal buffer  
is not empty after the encryption handshake.  
  
Our thanks to Jacob Champion for reporting this problem.  
  
Security: CVE-2021-23214  

M src/backend/libpq/pqcomm.c
M src/backend/postmaster/postmaster.c
M src/include/libpq/libpq.h

Fix incorrect hash equality operator bug in Memoize

commit   : 39a3105678a247bbfdc132cd95db5b515b8cd7f6    
  
author   : David Rowley <[email protected]>    
date     : Mon, 8 Nov 2021 14:40:33 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 8 Nov 2021 14:40:33 +1300    

Click here for diff

In v14, because we don't have a field in RestrictInfo to cache both the  
left and right type's hash equality operator, we just restrict the scope  
of Memoize to only when the left and right types of a RestrictInfo are the  
same.  
  
In master we add another field to RestrictInfo and cache both hash  
equality operators.  
  
Reported-by: Jaime Casanova  
Author: David Rowley  
Discussion: https://postgr.es/m/20210929185544.GB24346%40ahch-to  
Backpatch-through: 14  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/nodes/pathnodes.h

Fix gist_bool_ops to use gbtreekey2

commit   : e2fbb883720aa222f61eb9f3affad1c63bac7cbb    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 8 Nov 2021 01:14:55 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 8 Nov 2021 01:14:55 +0100    

Click here for diff

Commit 57e3c5160b added a new GiST bool opclass, but it used gbtreekey4  
to store the data, which left two bytes undefined, as reported by skink,  
our valgrind animal. There was a bit more confusion, because the opclass  
also used gbtreekey8 in the definition.  
  
Fix by defining a new gbtreekey2 struct, and using it in all the places.  
  
Discussion: https://postgr.es/m/CAE2gYzyDKJBZngssR84VGZEN=Ux=V9FV23QfPgo+7-yYnKKg4g@mail.gmail.com  

M contrib/btree_gist/btree_bool.c
M contrib/btree_gist/btree_gist–1.6–1.7.sql

Remove tests added by bd807be6935929bdefe74d1258ca08048f0aafa3.

commit   : ccf289745d3e50360653181dce6a277a1fc79730    
  
author   : Robert Haas <[email protected]>    
date     : Sun, 7 Nov 2021 15:32:32 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Sun, 7 Nov 2021 15:32:32 -0500    

Click here for diff

The buildfarm is unhappy. It's not obvious why it doesn't like  
these tests, but let's remove them until we figure it out.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Silence uninitialized-variable warning.

commit   : c3ec4f8fe867807613c08fe16789434ab1a74a15    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Nov 2021 12:18:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Nov 2021 12:18:18 -0500    

Click here for diff

Quite a few buildfarm animals are warning about this, and lapwing  
is actually failing (because -Werror).  It's a false positive AFAICS,  
so no need to do more than zero the variable to start with.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

contrib/sslinfo needs a fix too to make hamerkop happy.

commit   : 568620dfd6912351b4127435eca5309f823abde8    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 7 Nov 2021 11:33:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 7 Nov 2021 11:33:53 -0500    

Click here for diff

Re-ordering the #include's is a bit problematic here because  
libpq/libpq-be.h needs to include <openssl/ssl.h>.  Instead,  
let's #undef the unwanted macro after all the #includes.  
This is definitely uglier than the other way, but it should  
work despite possible future header rearrangements.  
  
(A look at the openssl headers indicates that X509_NAME is the  
only conflicting symbol that we use.)  
  
In passing, remove a related but long-incorrect comment in  
pg_backup_archiver.h.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sslinfo/sslinfo.c
M src/bin/pg_dump/pg_backup_archiver.h

Doc: add some notes about performance of the List functions.

commit   : 27ef132a805c8633ed8bb94ed70be995c681ab1f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 19:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 19:12:51 -0400    

Click here for diff

Per suggestion from Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c

windows: Remove use of WIN32_LEAN_AND_MEAN from crashdump.c.

commit   : 87bb606b20ae4e52fa45eda2d9914c19eb7eea5e    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 6 Nov 2021 15:43:22 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 6 Nov 2021 15:43:22 -0700    

Click here for diff

Since 8162464a25e we do so in win32_port.h. But it likely didn't do much  
before that either, because at that point windows.h was already included via  
win32_port.h.  
  
Reported-By: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/port/win32/crashdump.c

Blind attempt to fix MSVC pgcrypto build.

commit   : 3c2c391dc9f82fae181508ebcc2f7621ffefd024    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 18:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 18:02:27 -0400    

Click here for diff

Commit db7d1a7b0 pulled out Mkvcbuild.pm's custom support for building  
contrib/pgcrypto, but neglected to inform it that that module can now  
be built normally.  Or at least I guess it can now be built normally.  
But this is definitely causing bowerbird to fail, since it's trying to  
test a module it hasn't built.  

M src/tools/msvc/Mkvcbuild.pm

Disallow making an empty lexeme via array_to_tsvector().

commit   : cbe25dcff73a297adbada9dc1d6cad3df18014e9    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 13:28:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 13:28:53 -0400    

Click here for diff

The tsvector data type has always forbidden lexemes to be empty.  
However, array_to_tsvector() didn't get that memo, and would  
allow an empty-string array element to become an empty lexeme.  
This could result in dump/restore failures later, not to mention  
whatever semantic issues might be behind the original prohibition.  
  
However, other functions that take a plain text input directly as  
a lexeme value do not need a similar restriction, because they only  
match the string against existing tsvector entries.  In particular  
it'd be a bad idea to make ts_delete() reject empty strings, since  
that is the most convenient way to clean up any bad data that might  
have gotten into a tsvector column via this bug.  
  
Reflecting on that, let's also remove the prohibition against NULL  
array elements in tsvector_delete_arr and tsvector_setweight_by_filter.  
It seems more consistent to ignore them, as an empty-string element  
would be ignored.  
  
There's a case for back-patching this, since it's clearly a bug fix.  
On balance though, it doesn't seem like something to change in a  
minor release.  
  
Jean-Christophe Arnu  
  
Discussion: https://postgr.es/m/CAHZmTm1YVndPgUVRoag2WL0w900XcoiivDDj-gTTYBsG25c65A@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/tsvector_op.c
M src/test/regress/expected/tstypes.out
M src/test/regress/sql/tstypes.sql

Second attempt to silence SSL compile failures on hamerkop.

commit   : 1241fcbd7e649414f09f9858ba73e63975dcff64    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 12:43:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 12:43:18 -0400    

Click here for diff

After further investigation, it seems the cause of the problem  
is our recent decision to start defining WIN32_LEAN_AND_MEAN.  
That causes <windows.h> to no longer include <wincrypt.h>, which  
means that the OpenSSL headers are unable to prevent conflicts  
with that header by #undef'ing the conflicting macros.  Apparently,  
some other system header that be-secure-openssl.c #includes after  
the OpenSSL headers is pulling in <wincrypt.h>.  It's obscure just  
where that happens and why we're not seeing it on other Windows  
buildfarm animals.  However, it should work to move the OpenSSL  
#includes to the end of the list.  For the sake of future-proofing,  
do likewise in fe-secure-openssl.c.  In passing, remove useless  
double inclusions of <openssl/ssl.h>.  
  
Thanks to Thomas Munro for running down the relevant information.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c

Reset lastOverflowedXid on standby when needed

commit   : 05e6e78c1840d07154a4b52092178a2d1ad39445    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 6 Nov 2021 18:31:21 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 6 Nov 2021 18:31:21 +0300    

Click here for diff

Currently, lastOverflowedXid is never reset.  It's just adjusted on new  
transactions known to be overflowed.  But if there are no overflowed  
transactions for a long time, snapshots could be mistakenly marked as  
suboverflowed due to wraparound.  
  
This commit fixes this issue by resetting lastOverflowedXid when needed  
altogether with KnownAssignedXids.  
  
Backpatch to all supported versions.  
  
Reported-by: Stan Hu  
Discussion: https://postgr.es/m/CAMBWrQ%3DFp5UAsU_nATY7EMY7NHczG4-DTDU%3DmCvBQZAQ6wa2xQ%40mail.gmail.com  
Author: Kyotaro Horiguchi, Alexander Korotkov  
Reviewed-by: Stan Hu, Simon Riggs, Nikolay Samokhvalov, Andrey Borodin, Dmitry Dolgov  

M src/backend/storage/ipc/procarray.c

Un-break pg_basebackup's MSVC build.

commit   : d8bf0a1c1d3429cafb3019f2773e2f3aa68f3b65    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 12:12:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Nov 2021 12:12:32 -0400    

Click here for diff

Commit 23a1c6578 thought it'd be cute to refactor  
pg_basebackup/Makefile with a new variable BBOBJS,  
but our MSVC build system knows nothing of that.  
Per buildfarm.  

M src/tools/msvc/Mkvcbuild.pm

Add bool GiST opclass to btree_gist

commit   : 57e3c5160b24e61758f817feb7aac152cd695c6f    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 17:00:43 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 17:00:43 +0100    

Click here for diff

Adds bool opclass to btree_gist extension, to allow creating GiST  
indexes on bool columns. GiST indexes on a single bool column don't seem  
particularly useful, but this allows defining exclusion constraings  
involving a bool column, for example.  
  
Author: Emre Hasegeli  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/CAE2gYzyDKJBZngssR84VGZEN=Ux=V9FV23QfPgo+7-yYnKKg4g@mail.gmail.com  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_bool.c
A contrib/btree_gist/btree_gist–1.6–1.7.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/btree_gist.h
M contrib/btree_gist/btree_utils_num.c
A contrib/btree_gist/expected/bool.out
A contrib/btree_gist/sql/bool.sql

Mark mystreamer variable as PG_USED_FOR_ASSERTS_ONLY

commit   : dafcf887daa472b0a49bee7e07042372bc37cee4    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 16:32:11 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 16:32:11 +0100    

Click here for diff

Silences warnings about unused variable, when built without asserts.  

M src/bin/pg_basebackup/bbstreamer_file.c

Update obsolete reference in vacuumlazy.c.

commit   : 02f9fd129432cab565b2a3cb9f3b3a5000dfe540    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 5 Nov 2021 23:38:07 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 5 Nov 2021 23:38:07 -0700    

Click here for diff

Oversight in commit 7ab96cf6.  

M src/backend/access/heap/vacuumlazy.c

Fix handling of NaN values in BRIN minmax multi

commit   : d91353f4b21f10417d142e6ac17a0490adae867c    
  
author   : Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 01:25:31 +0100    
  
committer: Tomas Vondra <[email protected]>    
date     : Sat, 6 Nov 2021 01:25:31 +0100    

Click here for diff

When calculating distance between float4/float8 values, we need to be a  
bit more careful about NaN values in order not to trigger assert. We  
consider NaN values to be equal (distace 0.0) and in infinite distance  
from all other values.  
  
On builds without asserts, this issue is mostly harmless - the ranges  
may be merged in less efficient order, but the index is still correct.  
  
Per report from Andreas Seltenreich. Backpatch to 14, where this new  
BRIN opclass was introduced.  
  
Reported-by: Andreas Seltenreich  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_minmax_multi.c
M src/test/regress/expected/brin_multi.out
M src/test/regress/sql/brin_multi.sql

Update obsolete heap pruning comments.

commit   : f214960adde6028a39ba3014b1ab2b224faeefed    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 5 Nov 2021 14:08:47 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 5 Nov 2021 14:08:47 -0700    

Click here for diff

Add new comments that spell out what VACUUM expects from heap pruning:  
pruning must never leave behind DEAD tuples that still have tuple  
storage.  This has at least been the case since commit 8523492d, which  
established the principle that vacuumlazy.c doesn't have to deal with  
DEAD tuples that still have tuple storage directly, except perhaps by  
simply retrying pruning (to handle a rare corner case involving  
concurrent transaction abort).  
  
In passing, update some references to old symbol names that were missed  
by the snapshot scalability work (specifically commit dc7420c2c9).  

M src/backend/access/heap/pruneheap.c

Change ThisTimeLineID from a global variable to a local variable.

commit   : 4a92a1c3d1c361ffb031ed05bf65b801241d7cdd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:53:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:53:15 -0400    

Click here for diff

StartupXLOG() still has ThisTimeLineID as a local variable, but the  
remaining code in xlog.c now needs to the relevant TimeLineID by some  
other means. Mostly, this means that we now pass it as a function  
parameter to a bunch of functions where we didn't previously.  
However, a few cases require special handling:  
  
- In functions that might be called by outside callers who  
  wouldn't necessarily know what timeline to specify, we get  
  the timeline ID from shared memory. XLogCtl->ThisTimeLineID  
  can be used in most cases since recovery is known to have  
  completed by the time those functions are called.  In  
  xlog_redo(), we can use XLogCtl->replayEndTLI.  
  
- XLogFileClose() needs to know the TLI of the open logfile.  
  Do that with a new global variable openLogTLI. While  
  someone could argue that this is just trading one global  
  variable for another, the new one has a far more narrow  
  purposes and is referenced in just a few places.  
  
- read_backup_label() now returns the TLI that it obtains  
  by parsing the backup_label file. Previously, ReadRecord()  
  could be called to parse the checkpoint record without  
  ThisTimeLineID having been initialized. Now, the timeline  
  is passed down, and I didn't want to pass an uninitialized  
  variable; this change lets us avoid that. The old coding  
  didn't seem to have any practical consequences that we need  
  to worry about, but this is cleaner.  
  
- In BootstrapXLOG(), it's just a constant.  
  
Patch by me, reviewed and tested by Michael Paquier, Amul Sul, and  
Álvaro Herrera.  
  
Discussion: https://postgr.es/m/CA+TgmobfAAqhfWa1kaFBBFvX+5CjM=7TE=n4r4Q1o2bjbGYBpA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/include/access/xlog.h

Remove all use of ThisTimeLineID global variable outside of xlog.c

commit   : e997a0c642860a96df0151cbeccfecbdf0450d08    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:50:01 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:50:01 -0400    

Click here for diff

All such code deals with this global variable in one of three ways.  
Sometimes the same functions use it in more than one of these ways  
at the same time.  
  
First, sometimes it's an implicit argument to one or more functions  
being called in xlog.c or elsewhere, and must be set to the  
appropriate value before calling those functions lest they  
misbehave. In those cases, it is now passed as an explicit argument  
instead.  
  
Second, sometimes it's used to obtain the current timeline after  
the end of recovery, i.e. the timeline to which WAL is being  
written and flushed. Such code now calls GetWALInsertionTimeLine()  
or relies on the new out parameter added to GetFlushRecPtr().  
  
Third, sometimes it's used during recovery to store the current  
replay timeline. That can change, so such code must generally  
update the value before each use. It can still do that, but must  
now use a local variable instead.  
  
The net effect of these changes is to reduce by a fair amount the  
amount of code that is directly accessing this global variable.  
That's good, because history has shown that we don't always think  
clearly about which timeline ID it's supposed to contain at any  
given point in time, or indeed, whether it has been or needs to  
be initialized at any given point in the code.  
  
Patch by me, reviewed and tested by Michael Paquier, Amul Sul, and  
Álvaro Herrera.  
  
Discussion: https://postgr.es/m/CA+TgmobfAAqhfWa1kaFBBFvX+5CjM=7TE=n4r4Q1o2bjbGYBpA@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h
M src/include/access/xlogarchive.h
M src/include/access/xlogutils.h

Don't set ThisTimeLineID when there's no reason to do so.

commit   : caf1f675b88d1aa67ea3fb642e8f38b470cc911e    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:43:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 12:43:04 -0400    

Click here for diff

In slotfuncs.c, pg_replication_slot_advance() needs to determine  
the LSN up to which the slot should be advanced, but that doesn't  
require us to update ThisTimeLineID, because none of the code called  
from here depends on it. If the replication slot is logical,  
pg_logical_replication_slot_advance will call read_local_xlog_page,  
which does use ThisTimeLineID, but also takes care of making sure  
it's up to date. If the replication slot is physical, the timeline  
isn't used for anything at all.  
  
In logicalfuncs.c, pg_logical_slot_get_changes_guts() has the same  
issue: the only code we're going to run that cares about timelines  
is in or downstream of read_local_xlog_page, which already makes  
sure that the correct value gets set. Hence, don't do it here.  
  
Patch by me, reviewed and tested by Michael Paquier, Amul Sul, and  
Álvaro Herrera.  
  
Discussion: https://postgr.es/m/CA+TgmobfAAqhfWa1kaFBBFvX+5CjM=7TE=n4r4Q1o2bjbGYBpA@mail.gmail.com  

M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slotfuncs.c

Avoid crash in rare case of concurrent DROP

commit   : d74b54b3ddf710926a44bf3f9c87c00e6f82d825    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 12:29:35 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 12:29:35 -0300    

Click here for diff

When a role being dropped contains is referenced by catalog objects that  
are concurrently also being dropped, a crash can result while trying to  
construct the string that describes the objects.  Suppress that by  
ignoring objects whose descriptions are returned as NULL.  
  
The majority of relevant codesites were already cautious about this  
already; we had just missed a couple.  
  
This is an old bug, so backpatch all the way back.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/dependency.c
M src/backend/catalog/pg_shdepend.c

Document that ALTER TABLE .. TYPE removes statistics

commit   : df80f9da5c6541e744eeb20eaca919c7fc189999    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 12:09:31 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 12:09:31 -0300    

Click here for diff

Co-authored-by: Nikolai Berkoff <[email protected]>  
Discussion: https://postgr.es/m/vCc8XnwDmlP4ZnHBQLIVxzD405BiYHVC9qZlhIF7IsfxK0gC9mZ4PUUOH0-3y6kv5p-87-3_ljqT1KvQVAnb8OoWhPU3kcqWn2ZpmxRBCQg=@pm.me  

M doc/src/sgml/ref/alter_table.sgml

Pipeline mode disallows multicommand strings

commit   : 105c1de0197473dac8ada55dc8cf773d782224cb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:40:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:40:03 -0300    

Click here for diff

... so mention that in appropriate places of the libpq docs.  
  
Backpatch to 14.  
  
Reported-by: RekGRpth <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml

Document default and changeability of log_startup_progress_interval

commit   : e543906e217509ad95c1e341de4e874f027f871b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:31:57 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:31:57 -0300    

Click here for diff

Review for 9ce346eabf35.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml

Introduce 'bbstreamer' abstraction to modularize pg_basebackup.

commit   : 23a1c6578c87fca0e361c4f5f9a07df5ae1f9858    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 10:22:07 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 10:22:07 -0400    

Click here for diff

pg_basebackup knows how to do quite a few things with a backup that it  
gets from the server, like just write out the files, or compress them  
first, or even parse the tar format and inject a modified  
postgresql.auto.conf file into the archive generated by the server.  
Unforatunely, this makes pg_basebackup.c a very large source file, and  
also somewhat difficult to enhance, because for example the knowledge  
that the server is sending us a 'tar' file rather than some other sort  
of archive is spread all over the place rather than centralized.  
  
In an effort to improve this situation, this commit invents a new  
'bbstreamer' abstraction. Each archive received from the server is  
fed to a bbstreamer which may choose to dispose of it or pass it  
along to some other bbstreamer. Chunks may also be "labelled"  
according to whether they are part of the payload data of a file  
in the archive or part of the archive metadata.  
  
So, for example, if we want to take a tar file, modify the  
postgresql.auto.conf file it contains, and the gzip the result  
and write it out, we can use a bbstreamer_tar_parser to parse the  
tar file received from the server, a bbstreamer_recovery_injector  
to modify the contents of postgresql.auto.conf, a  
bbstreamer_tar_archiver to replace the tar headers for the file  
modified in the previous step with newly-built ones that are  
correct for the modified file, and a bbstreamer_gzip_writer to  
gzip and write the resulting data. Only the objects with "tar"  
in the name know anything about the tar archive format, and in  
theory we could re-archive using some other format rather than  
"tar" if somebody wanted to write the code.  
  
These chances do add a substantial amount of code, but I think the  
result is a lot more maintainable and extensible. pg_basebackup.c  
itself shrinks by roughly a third, with a lot of the complexity  
previously contained there moving into the newly-added files.  
  
Patch by me. The larger patch series of which this is a part has been  
reviewed and tested at various times by Andres Freund, Sumanta  
Mukherjee, Dilip Kumar, Suraj Kharage, Dipesh Pandit, Tushar Ahuja,  
Mark Dilger, Sergei Kornilov, and Jeevan Ladhe.  
  
Discussion: https://postgr.es/m/CA+TgmoZGwR=ZVWFeecncubEyPdwghnvfkkdBe9BLccLSiqdf9Q@mail.gmail.com  
Discussion: https://postgr.es/m/CA+TgmoZvqk7UuzxsX1xjJRmMGkqoUGYTZLDCH8SmU1xTPr1Xig@mail.gmail.com  

M src/bin/pg_basebackup/Makefile
A src/bin/pg_basebackup/bbstreamer.h
A src/bin/pg_basebackup/bbstreamer_file.c
A src/bin/pg_basebackup/bbstreamer_inject.c
A src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/pg_basebackup.c

Reword doc blurb for vacuumdb --analyze-in-stages

commit   : 00a354a13560dc529ac34a303c85c265aaf033b7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:22:30 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 5 Nov 2021 11:22:30 -0300    

Click here for diff

Make users aware that using it in a database with existing stats might  
cause transient problems.  
  
Author: Nikolai Berkoff <[email protected]>  
Discussion: https://postgr.es/m/s-kSljtWXMWgMfGTztPTPcS80R8FHdOrBxDTnrQI6GMZbT7au1A4b0fzaSFtKwCI8nwN0MhgPLfVOTvJ7DwTjkip4P3d0o4VgrMJs4OLN-o=@pm.me  

M doc/src/sgml/ref/vacuumdb.sgml

Introduce 'bbsink' abstraction to modularize base backup code.

commit   : bef47ff85df18bf4a3a9b13bd2a54820e27f3614    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 10:08:30 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 10:08:30 -0400    

Click here for diff

The base backup code has accumulated a healthy number of new  
features over the years, but it's becoming increasingly difficult  
to maintain and further enhance that code because there's no  
real separation of concerns. For example, the code that  
understands knows the details of how we send data to the client  
using the libpq protocol is scattered throughout basebackup.c,  
rather than being centralized in one place.  
  
To try to improve this situation, introduce a new 'bbsink' object  
which acts as a recipient for archives generated during the base  
backup progress and also for the backup manifest. This commit  
introduces three types of bbsink: a 'copytblspc' bbsink forwards the  
backup to the client using one COPY OUT operation per tablespace and  
another for the manifest, a 'progress' bbsink performs command  
progress reporting, and a 'throttle' bbsink performs rate-limiting.  
The 'progress' and 'throttle' bbsink types also forward the data to a  
successor bbsink; at present, the last bbsink in the chain will  
always be of type 'copytblspc'. There are plans to add more types  
of 'bbsink' in future commits.  
  
This abstraction is a bit leaky in the case of progress reporting,  
but this still seems cleaner than what we had before.  
  
Patch by me, reviewed and tested by Andres Freund, Sumanta Mukherjee,  
Dilip Kumar, Suraj Kharage, Dipesh Pandit, Tushar Ahuja, Mark Dilger,  
and Jeevan Ladhe.  
  
Discussion: https://postgr.es/m/CA+TgmoZGwR=ZVWFeecncubEyPdwghnvfkkdBe9BLccLSiqdf9Q@mail.gmail.com  
Discussion: https://postgr.es/m/CA+TgmoZvqk7UuzxsX1xjJRmMGkqoUGYTZLDCH8SmU1xTPr1Xig@mail.gmail.com  

M src/backend/replication/Makefile
M src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup.c
A src/backend/replication/basebackup_copy.c
A src/backend/replication/basebackup_progress.c
A src/backend/replication/basebackup_sink.c
A src/backend/replication/basebackup_throttle.c
M src/include/replication/backup_manifest.h
A src/include/replication/basebackup_sink.h

amcheck: Add additional TOAST pointer checks.

commit   : bd807be6935929bdefe74d1258ca08048f0aafa3    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 09:17:40 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 5 Nov 2021 09:17:40 -0400    

Click here for diff

Expand the checks of toasted attributes to complain if the rawsize is  
overlarge.  For compressed attributes, also complain if compression  
appears to have expanded the attribute or if the compression method is  
invalid.  
  
Mark Dilger, reviewed by Justin Pryzby, Alexander Alekseev, Heikki  
Linnakangas, Greg Stark, and me.  
  
Discussion: http://postgr.es/m/[email protected]  

M contrib/amcheck/verify_heapam.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl

pgcrypto: Remove non-OpenSSL support

commit   : db7d1a7b0530e8cbd045744e1c75b0e63fb6916f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 5 Nov 2021 13:59:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 5 Nov 2021 13:59:42 +0100    

Click here for diff

pgcrypto had internal implementations of some encryption algorithms,  
as an alternative to calling out to OpenSSL.  These were rarely used,  
since most production installations are built with OpenSSL.  Moreover,  
maintaining parallel code paths makes the code more complex and  
difficult to maintain.  
  
This patch removes these internal implementations.  Now, pgcrypto is  
only built if OpenSSL support is configured.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/0b42f1df-8cba-6a30-77d7-acc241cc88c1%40enterprisedb.com  

M contrib/Makefile
M contrib/pgcrypto/Makefile
D contrib/pgcrypto/blf.c
D contrib/pgcrypto/blf.h
D contrib/pgcrypto/imath.c
D contrib/pgcrypto/imath.h
D contrib/pgcrypto/internal-sha2.c
D contrib/pgcrypto/internal.c
D contrib/pgcrypto/pgp-mpi-internal.c
D contrib/pgcrypto/rijndael.c
D contrib/pgcrypto/rijndael.h
D contrib/pgcrypto/rijndael.tbl
M doc/src/sgml/pgcrypto.sgml
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/vcregress.pl

Improve psql tab completion for COMMENT

commit   : a5b336b8b9e04a93e7c8526302504d2e5201eb80    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Nov 2021 15:25:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Nov 2021 15:25:36 +0900    

Click here for diff

Completion is added for more object types, like domain constraints, text  
search-ish objects or policies.  Moreover, the area is reorganized,  
changing the list of objects supported by COMMENT to be in the same  
order as the documentation to ease future additions.  
  
Author: Ken Kato  
Reviewed-by: Fujii Masao, Shinya Kato, Suraj Khamkar, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Add hardening to catch invalid TIDs in indexes.

commit   : e7428a99a13f973549aab30c57ec8380ddda1869    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 4 Nov 2021 19:54:05 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 4 Nov 2021 19:54:05 -0700    

Click here for diff

Add hardening to the heapam index tuple deletion path to catch TIDs in  
index pages that point to a heap item that index tuples should never  
point to.  The corruption we're trying to catch here is particularly  
tricky to detect, since it typically involves "extra" (corrupt) index  
tuples, as opposed to the absence of required index tuples in the index.  
  
For example, a heap TID from an index page that turns out to point to an  
LP_UNUSED item in the heap page has a good chance of being caught by one  
of the new checks.  There is a decent chance that the recently fixed  
parallel VACUUM bug (see commit 9bacec15) would have been caught had  
that particular check been in place for Postgres 14.  No backpatch of  
this extra hardening for now, though.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk-4_raTzawWGaiqNvkpwDXxv3y1AQhQyUeHfkU=tFCeA@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/include/access/tableam.h

Add support for LZ4 compression in pg_receivewal

commit   : babbbb595d2322da095a1e6703171b3f1f2815cb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Nov 2021 11:33:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Nov 2021 11:33:25 +0900    

Click here for diff

pg_receivewal gains a new option, --compression-method=lz4, available  
when the code is compiled with --with-lz4.  Similarly to gzip, this  
gives the possibility to compress archived WAL segments with LZ4.  This  
option is not compatible with --compress.  
  
The implementation uses LZ4 frames, and is compatible with simple lz4  
commands.  Like gzip, using --synchronous ensures that any data will be  
flushed to disk within the current .partial segment, so as it is  
possible to retrieve as much WAL data as possible even from a  
non-completed segment (this requires completing the partial file with  
zeros up to the WAL segment size supported by the backend after  
decompression, but this is the same as gzip).  
  
The calculation of the streaming start LSN is able to transparently find  
and check LZ4-compressed segments.  Contrary to gzip where the  
uncompressed size is directly stored in the object read, the LZ4 chunk  
protocol does not store the uncompressed data by default.  There is  
contentSize that can be used with LZ4 frames by that would not help if  
using an archive that includes segments compressed with the defaults of  
a "lz4" command, where this is not stored.  So, this commit has taken  
the most extensible approach by decompressing the already-archived  
segment to check its uncompressed size, through a blank output buffer in  
chunks of 64kB (no actual performance difference noticed with 8kB, 16kB  
or 32kB, and the operation in itself is actually fast).  
  
Tests have been added to verify the creation and correctness of the  
generated LZ4 files.  The latter is achieved by the use of command  
"lz4", if found in the environment.  
  
The tar-based WAL method in walmethods.c, used now only by  
pg_basebackup, does not know yet about LZ4.  Its code could be extended  
for this purpose.  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier, Jian Guo, Magnus Hagander, Dilip Kumar  
Discussion: https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/Makefile.global.in
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Add various assertions to heap pruning code.

commit   : 5cd7eb1f1c32e1b95894f28b277b4e4b89add772    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 4 Nov 2021 19:07:54 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 4 Nov 2021 19:07:54 -0700    

Click here for diff

These assertions document (and verify) our high level assumptions about  
how pruning can and cannot affect existing items from target heap pages.  
For example, one of the new assertions verifies that pruning does not  
set a heap-only tuple to LP_DEAD.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=vhvBx1GjF+oueHh8YQcHoQYrMi0F0zFMHEr8yc4sCoA@mail.gmail.com  

M src/backend/access/heap/pruneheap.c

Fix some thinkos with pg_receivewal --compression-method

commit   : 9588622945754305836555273a6a3be814db315c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Nov 2021 12:32:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Nov 2021 12:32:37 +0900    

Click here for diff

The option name was incorrect in one of the error messages, and the  
short option 'I' was used in the code but we did not intend things to be  
this way.  While on it, fix the documentation to refer to a "method",  
and not a "level.  
  
Oversights in commit d62bcc8, that I have detected after more review of  
the LZ4 patch for pg_receivewal.  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c

Rework compression options of pg_receivewal

commit   : d62bcc8b07f921bad105c7a826702c117ea7be58    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Nov 2021 11:10:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Nov 2021 11:10:31 +0900    

Click here for diff

pg_receivewal includes since cada1af the option --compress, to allow the  
compression of WAL segments using gzip, with a value of 0 (the default)  
meaning that no compression can be used.  
  
This commit introduces a new option, called --compression-method, able  
to use as values "none", the default, and "gzip", to make things more  
extensible.  The case of --compress=0 becomes fuzzy with this option  
layer, so we have made the choice to make pg_receivewal return an error  
when using "none" and a non-zero compression level, meaning that the  
authorized values of --compress are now [1,9] instead of [0,9].  Not  
specifying --compress with "gzip" as compression method makes  
pg_receivewal use the default of zlib instead (Z_DEFAULT_COMPRESSION).  
  
The code in charge of finding the streaming start LSN when scanning the  
existing archives is refactored and made more extensible.  While on it,  
rename "compression" to "compression_level" in walmethods.c, to reduce  
the confusion with the introduction of the compression method, even if  
the tar method used by pg_basebackup does not rely on the compression  
method (yet, at least), but just on the compression level (this area  
could be improved more, actually).  
  
This is in preparation for an upcoming patch that adds LZ4 support to  
pg_receivewal.  
  
Author: Georgios Kokolatos  
Reviewed-by: Michael Paquier, Jian Guo, Magnus Hagander, Dilip Kumar,  
Robert Haas  
Discussion: https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/tools/pgindent/typedefs.list

Add another old commit to git-blame-ignore-revs.

commit   : 581055c32fbb5018431265877754cbd8019bc012    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 3 Nov 2021 17:34:19 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 3 Nov 2021 17:34:19 -0700    

Click here for diff

Add another historic pgindent commit that was missed by the initial work  
done in commit 8e638845.  

M .git-blame-ignore-revs

Update alternative expected output file.

commit   : d5ab0681bf1bbf6c0c2cba9a2d55fe8e080597b6    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Nov 2021 19:38:17 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Nov 2021 19:38:17 +0200    

Click here for diff

Previous commit added a test to 'largeobject', but neglected the  
alternative expected output file 'largeobject_1.source'. Per failure  
on buildfarm animal 'hamerkop'.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/regress/output/largeobject_1.source

Fix snapshot reference leak if lo_export fails.

commit   : 6b1b405ebfdce9da47f59d8d4144b1168709fbce    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Nov 2021 10:28:52 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Nov 2021 10:28:52 +0200    

Click here for diff

If lo_export() fails to open the target file or to write to it, it leaks  
the created LargeObjectDesc and its snapshot in the top-transaction  
context and resource owner. That's pretty harmless, it's a small leak  
after all, but it gives the user a "Snapshot reference leak" warning.  
  
Fix by using a short-lived memory context and no resource owner for  
transient LargeObjectDescs that are opened and closed within one function  
call. The leak is easiest to reproduce with lo_export() on a directory  
that doesn't exist, but in principle the other lo_* functions could also  
fail.  
  
Backpatch to all supported versions.  
  
Reported-by: Andrew B  
Reviewed-by: Alvaro Herrera  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/libpq/be-fsstubs.c
M src/backend/storage/large_object/inv_api.c
M src/test/regress/input/largeobject.source
M src/test/regress/output/largeobject.source

Fix incorrect format placeholder

commit   : ef6f047d2c87b91318364341c058dd6b715951b2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 3 Nov 2021 07:34:28 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 3 Nov 2021 07:34:28 +0100    

Click here for diff

M src/bin/initdb/initdb.c

Fix parallel amvacuumcleanup safety bug.

commit   : c59278a1aa5ef2ee8a6d5d83bd987a7ce5c89e84    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 2 Nov 2021 19:52:11 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 2 Nov 2021 19:52:11 -0700    

Click here for diff

Commit b4af70cb inverted the return value of the function  
parallel_processing_is_safe(), but missed the amvacuumcleanup test.  
Index AMs that don't support parallel cleanup at all were affected.  
  
The practical consequences of this bug were not very serious.  Hash  
indexes are affected, but since they just return the number of blocks  
during hashvacuumcleanup anyway, it can't have had much impact.  
  
Author: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoA-Em+aeVPmBbL_s1V-ghsJQSxYL-i3JP8nTfPiD1wjKw@mail.gmail.com  
Backpatch: 14-, where commit b4af70cb appears.  

M src/backend/access/heap/vacuumlazy.c

Blind attempt to silence SSL compile failures on hamerkop.

commit   : 24f9e49e430b4173d75a570e06abef8e3fd12c5e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 15:18:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 15:18:00 -0400    

Click here for diff

Buildfarm member hamerkop has been failing for the last few days  
with errors that look like OpenSSL's X509-related symbols have  
not been imported into be-secure-openssl.c.  It's unclear why  
this should be, but let's try adding an explicit #include of  
<openssl/x509v3.h>, as there has long been in fe-secure-openssl.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/be-secure-openssl.c

Don't overlook indexes during parallel VACUUM.

commit   : 9bacec15b67d1a643915858f054790f36b2b7871    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 2 Nov 2021 12:06:17 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 2 Nov 2021 12:06:17 -0700    

Click here for diff

Commit b4af70cb, which simplified state managed by VACUUM, performed  
refactoring of parallel VACUUM in passing.  Confusion about the exact  
details of the tasks that the leader process is responsible for led to  
code that made it possible for parallel VACUUM to miss a subset of the  
table's indexes entirely.  Specifically, indexes that fell under the  
min_parallel_index_scan_size size cutoff were missed.  These indexes are  
supposed to be vacuumed by the leader (alongside any parallel unsafe  
indexes), but weren't vacuumed at all.  Affected indexes could easily  
end up with duplicate heap TIDs, once heap TIDs were recycled for new  
heap tuples.  This had generic symptoms that might be seen with almost  
any index corruption involving structural inconsistencies between an  
index and its table.  
  
To fix, make sure that the parallel VACUUM leader process performs any  
required index vacuuming for indexes that happen to be below the size  
cutoff.  Also document the design of parallel VACUUM with these  
below-size-cutoff indexes.  
  
It's unclear how many users might be affected by this bug.  There had to  
be at least three indexes on the table to hit the bug: a smaller index,  
plus at least two additional indexes that themselves exceed the size  
cutoff.  Cases with just one additional index would not run into  
trouble, since the parallel VACUUM cost model requires two  
larger-than-cutoff indexes on the table to apply any parallel  
processing.  Note also that autovacuum was not affected, since it never  
uses parallel processing.  
  
Test case based on tests from a larger patch to test parallel VACUUM by  
Masahiko Sawada.  
  
Many thanks to Kamigishi Rei for her invaluable help with tracking this  
problem down.  
  
Author: Peter Geoghegan <[email protected]>  
Author: Masahiko Sawada <[email protected]>  
Reported-By: Kamigishi Rei <[email protected]>  
Reported-By: Andrew Gierth <[email protected]>  
Diagnosed-By: Andres Freund <[email protected]>  
Bug: #17245  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where the refactoring commit appears.  

M src/backend/access/heap/vacuumlazy.c
M src/include/commands/vacuum.h
A src/test/regress/expected/vacuum_parallel.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/vacuum_parallel.sql

Ensure consistent logical replication of datetime and float8 values.

commit   : f3d4019da5d026f2c3fe5bd258becf6fbb6b4673    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 14:28:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 14:28:50 -0400    

Click here for diff

In walreceiver, set the publisher's relevant GUCs (datestyle,  
intervalstyle, extra_float_digits) to the same values that pg_dump uses,  
and for the same reason: we need the output to be read the same way  
regardless of the receiver's settings.  Without this, it's possible  
for subscribers to misinterpret transmitted values.  
  
Although this is clearly a bug fix, it's not without downsides:  
subscribers that are storing values into some other datatype, such as  
text, could get different results than before, and perhaps be unhappy  
about that.  Given the lack of previous complaints, it seems best  
to change this only in HEAD, and to call it out as an incompatible  
change in v15.  
  
Japin Li, per report from Sadhuprasad Patro  
  
Discussion: https://postgr.es/m/CAFF0-CF=D7pc6st-3A9f1JnOt0qmc+BcBPVzD6fLYisKyAjkGA@mail.gmail.com  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Fix variable lifespan in ExecInitCoerceToDomain().

commit   : 01fc6527034a6f70ed44a078af8f636b1ab64947    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 13:36:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 13:36:47 -0400    

Click here for diff

This undoes a mistake in 1ec7679f1: domainval and domainnull were  
meant to live across loop iterations, but they were incorrectly  
moved inside the loop.  The effect was only to emit useless extra  
EEOP_MAKE_READONLY steps, so it's not a big deal; nonetheless,  
back-patch to v13 where the mistake was introduced.  
  
Ranier Vilela  
  
Discussion: https://postgr.es/m/CAEudQAqXuhbkaAp-sGH6dR6Nsq7v28_0TPexHOm6FiDYqwQD-w@mail.gmail.com  

M src/backend/executor/execExpr.c

Doc: clean up some places that mentioned template1 but not template0.

commit   : 7d9ec0754afeabb9f336c5220ef415c3ea27a0b6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 12:54:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 12:54:35 -0400    

Click here for diff

Improve old text that wasn't updated when we added template0 to  
the standard database set.  
  
Per suggestion from P. Luzanov.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/runtime.sgml

Doc: be more precise about conflicts between relation names.

commit   : af8c580e5cf32bb85dde70083a260c93a1f783eb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 12:12:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 12:12:02 -0400    

Click here for diff

Use verbiage like "The name of the table must be distinct from the name  
of any other relation (table, sequence, index, view, materialized view,  
or foreign table) in the same schema." in the reference pages for all  
those object types.  The main change here is to mention materialized  
views explicitly; although a couple of these pages failed to say  
anything at all about name conflicts.  
  
Per suggestion from Daniel Westermann.  
  
Discussion: https://postgr.es/m/ZR0P278MB0920D0946509233459AF0DEFD2889@ZR0P278MB0920.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_materialized_view.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_view.sgml

Avoid O(N^2) behavior in SyncPostCheckpoint().

commit   : 65c6cab1365ac33b11a49a2a193f6b3f9c53e487    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 11:31:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 2 Nov 2021 11:31:54 -0400    

Click here for diff

As in commits 6301c3ada and e9d9ba2a4, avoid doing repetitive  
list_delete_first() operations, since that would be expensive when  
there are many files waiting to be unlinked.  This is a slightly  
larger change than in those cases.  We have to keep the list state  
valid for calls to AbsorbSyncRequests(), so it's necessary to invent a  
"canceled" field instead of immediately deleting PendingUnlinkEntry  
entries.  Also, because we might not be able to process all the  
entries, we need a new list primitive list_delete_first_n().  
  
list_delete_first_n() is almost list_copy_tail(), but it modifies the  
input List instead of making a new copy.  I found a couple of existing  
uses of the latter that could profitably use the new function.  (There  
might be more, but the other callers look like they probably shouldn't  
overwrite the input List.)  
  
As before, back-patch to v13.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/list.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_func.c
M src/backend/storage/sync/sync.c
M src/include/nodes/pg_list.h

pgbench: Fix typo in comment.

commit   : d8dba4d03068eeee1ea3ffc8e7c7b4fa3e35a7f4    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 2 Nov 2021 23:08:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 2 Nov 2021 23:08:02 +0900    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

pgbench: Improve error-handling in pgbench.

commit   : cd29be5459f0e138c0f19d49ee588feeda78e3c9    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 2 Nov 2021 22:49:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 2 Nov 2021 22:49:57 +0900    

Click here for diff

Previously failures of initial connection and logfile open caused pgbench  
to proceed the benchmarking, report the incomplete results and exit with  
status 2. It didn't make sense to proceed the benchmarking even when  
pgbench could not start as prescribed.  
  
This commit improves pgbench so that early errors that occur when  
starting benchmark such as those failures should make pgbench exit  
immediately with status 1.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/TYCPR01MB5870057375ACA8A73099C649F5349@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Move MarkCurrentTransactionIdLoggedIfAny() out of the critical section.

commit   : 335397456b7e3f9f619038cb322fbfc9dd649d4f    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Nov 2021 09:10:17 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Nov 2021 09:10:17 +0530    

Click here for diff

We don't modify any shared state in this function which could cause  
problems for any concurrent session. This will make it look similar to the  
other updates for the same structure (TransactionState) which avoids  
confusion for future readers of code.  
  
Author: Dilip Kumar  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Replace XLOG_INCLUDE_XID flag with a more localized flag.

commit   : 71db6459e6e4ef623e98f3b1e3e9fed1bfb0ae3b    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Nov 2021 08:35:29 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Nov 2021 08:35:29 +0530    

Click here for diff

Commit 0bead9af484c introduced XLOG_INCLUDE_XID flag to indicate that the  
WAL record contains subXID-to-topXID association. It uses that flag later  
to mark in CurrentTransactionState that top-xid is logged so that we  
should not try to log it again with the next WAL record in the current  
subtransaction. However, we can use a localized variable to pass that  
information.  
  
In passing, change the related function and variable names to make them  
consistent with what the code is actually doing.  
  
Author: Dilip Kumar  
Reviewed-by: Alvaro Herrera, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/include/access/xact.h
M src/include/access/xlog.h

Replace unicode characters in comments with ascii

commit   : 43a134f28b350c4b731db9dddf2f53c407a7077f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 1 Nov 2021 22:42:49 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 1 Nov 2021 22:42:49 +0100    

Click here for diff

The unicode characters, while in comments and not code, caused MSVC  
to emit compiler warning C4819:  
  
  The file contains a character that cannot be represented in the  
  current code page (number).  Save the file in Unicode format to  
  prevent data loss.  
  
Fix by replacing the characters in print.c with descriptive comments  
containing the codepoints and symbol names, and remove the character  
in brin_bloom.c which was a footnote reference copied from the paper  
citation.  
  
Per report from hamerkop in the buildfarm.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/brin/brin_bloom.c
M src/fe_utils/print.c

Avoid some other O(N^2) hazards in list manipulation.

commit   : e9d9ba2a4ddc39e331dd8461b511aa59ec0dc8af    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Nov 2021 16:24:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Nov 2021 16:24:39 -0400    

Click here for diff

In the same spirit as 6301c3ada, fix some more places where we were  
using list_delete_first() in a loop and thereby risking O(N^2)  
behavior.  It's not clear that the lists manipulated in these spots  
can get long enough to be really problematic ... but it's not clear  
that they can't, either, and the fixes are simple enough.  
  
As before, back-patch to v13.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/trgm_regexp.c
M src/backend/executor/nodeAgg.c
M src/backend/jit/llvm/llvmjit.c

Handle XLOG_OVERWRITE_CONTRECORD in DecodeXLogOp

commit   : 40c516bba864395c77bcfb1bae65ba9562ba8f71    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 1 Nov 2021 13:07:23 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 1 Nov 2021 13:07:23 -0300    

Click here for diff

Failing to do so results in inability of logical decoding to process the  
WAL stream.  Handle it by doing nothing.  
  
Backpatch all the way back.  
  
Reported-by: Petr Jelínek <[email protected]>  

M src/backend/replication/logical/decode.c

Add TAP test for pg_receivewal with timeline switch

commit   : 0f9b9938a0367313fcf6a32fcb7fb5be9e281198    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Nov 2021 13:16:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Nov 2021 13:16:04 +0900    

Click here for diff

pg_receivewal is able to follow a timeline switch, but this was not  
tested.  This test uses an empty archive location with a restart done  
from a slot, making its implementation a tad simpler than if we would  
reuse an existing archive directory.  
  
Author: Ronan Dunklau  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/18708360.4lzOvYHigE@aivenronan  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Preserve opclass parameters across REINDEX CONCURRENTLY

commit   : add5cf28d48149459466b9aff374d78aebf17482    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Nov 2021 11:38:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Nov 2021 11:38:23 +0900    

Click here for diff

The opclass parameter Datums from the old index are fetched in the same  
way as for predicates and expressions, by grabbing them directly from  
the system catalogs.  They are then copied into the new IndexInfo that  
will be used for the creation of the new copy.  
  
This caused the new index to be rebuilt with default parameters rather  
than the ones pre-defined by a user.  The only way to get back a new  
index with correct opclass parameters would be to recreate a new index  
from scratch.  
  
The issue has been introduced by 911e702.  
  
Author: Michael Paquier  
Reviewed-by: Zhihong Yu  
Discussion: https://postgr.es/m/YX0CG/[email protected]  
Backpatch-through: 13  

M src/backend/catalog/index.c
M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql

Don't try to read a multi-GB pg_stat_statements file in one call.

commit   : a667b066837849c5e55e0d626f1f7c93e267b8b7    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 19:13:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 19:13:48 -0400    

Click here for diff

Windows fails on a request to read() more than INT_MAX bytes,  
and perhaps other platforms could have similar issues.  Let's  
adjust this code to read at most 1GB per call.  
  
(One would not have thought the file could get that big, but now  
we have a field report of trouble, so it can.  We likely ought to  
add some mechanism to limit the size of the query-texts file  
separately from the size of the hash table.  That is not this  
patch, though.)  
  
Per bug #17254 from Yusuke Egashira.  It's been like this for  
awhile, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/pg_stat_statements.c

Doc: improve README files associated with TAP tests.

commit   : b21415595cace7f3a45cfeb3023359b4b4d56b85    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 18:12:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 18:12:44 -0400    

Click here for diff

Rearrange src/test/perl/README so that the first section is more  
clearly "how to run these tests", and the rest "how to write new  
tests".  Add some basic info there about debugging test failures.  
Then, add cross-refs to that READNE from other READMEs that  
describe how to run TAP tests.  
  
Per suggestion from Kevin Burke, though this is not his original  
patch.  
  
Discussion: https://postgr.es/m/CAKcy5eiSbwiQnmCfnOnDCVC7B8fYyev3E=6pvvECP9pLE-Fcuw@mail.gmail.com  

M src/bin/pg_amcheck/README
M src/test/authentication/README
M src/test/kerberos/README
M src/test/ldap/README
M src/test/perl/README
M src/test/recovery/README
M src/test/ssl/README
M src/test/subscription/README

Avoid O(N^2) behavior when the standby process releases many locks.

commit   : 6301c3adabd947394682e37c933b0f3f83353b28    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 15:31:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 15:31:29 -0400    

Click here for diff

When replaying a transaction that held many exclusive locks on the  
primary, a standby server's startup process would expend O(N^2)  
effort on manipulating the list of locks.  This code was fine when  
written, but commit 1cff1b95a made repetitive list_delete_first()  
calls inefficient, as explained in its commit message.  Fix by just  
iterating the list normally, and releasing storage only when done.  
(This'd be inadequate if we needed to recover from an error occurring  
partway through; but we don't.)  
  
Back-patch to v13 where 1cff1b95a came in.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/standby.c

plpgsql: report proper line number for errors in variable initialization.

commit   : acb2d7d5d2301f07d5857ee252995e62ce9e7055    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 12:43:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 31 Oct 2021 12:43:47 -0400    

Click here for diff

Previously, we pointed at the surrounding block's BEGIN keyword.  
If there are multiple variables being initialized in a DECLARE section,  
this isn't good enough: it can be quite confusing and unhelpful.  
We do know where the variable's declaration started, so it just takes  
a tiny bit more error-reporting infrastructure to use that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_domain.out
M src/pl/plpgsql/src/expected/plpgsql_varprops.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/domain.out
M src/test/regress/expected/plpgsql.out

pg_dump: Refactor messages

commit   : fd2706589a7da4be6f6998befdf8e5fdea1565b8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 19:05:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 19:05:12 +0200    

Click here for diff

This reduces the number of separate messages for translation.  

M src/bin/pg_dump/pg_dump.c

doc: Remove some obsolete pgcrypto documentation

commit   : e6c60719e6c6ee9bd396f430879e1de9079bf74c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 13:14:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 13:14:52 +0200    

Click here for diff

The pgcrypto documentation contained acknowledgments of used external  
code, but some of this code has been moved to src/common/, so  
mentioning it with pgcrypto no longer makes sense, so remove it.  

M doc/src/sgml/pgcrypto.sgml

uuid-ossp: Remove obsolete build connection with pgcrypto

commit   : 237c12aabe39a58f3f5364fd94e0ca8ae8824957    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 12:53:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 12:53:02 +0200    

Click here for diff

unused since a8ed6bb8f4cf259b95c1bff5da09a8f4c79dca46  

M contrib/uuid-ossp/Makefile

Remove unused chunk from standalone-profile.xsl

commit   : b8b62b4be28b8acd36d32d5db65162bbbcd3a754    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 12:38:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 30 Oct 2021 12:38:14 +0200    

Click here for diff

unused since 1707a0d2aa6b2bcfe78f63836c769943a1a6b9e0  

M doc/src/sgml/standalone-profile.xsl

Fix race condition in startup progress reporting.

commit   : 5ccceb2946d4104804f8dca67515b602f5e78cdd    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Oct 2021 14:40:15 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Oct 2021 14:40:15 -0400    

Click here for diff

Commit 9ce346eabf350a130bba46be3f8c50ba28506969 added startup  
progress reporting, but begin_startup_progress_phase has a race  
condition: the timeout for the previous phase might fire just  
before we reschedule the interrupt for the next phase.  
  
To avoid the race, disable the timeout, clear the flag, and then  
re-enable the timeout.  
  
Patch by me, reviewed by Nitin Jadhav.  
  
Discussion: https://postgr.es/m/CA+TgmoYq38i6iAzfRLVxA6Cm+wMCf4WM8wC3o_a+X_JvWC8bJg@mail.gmail.com  

M src/backend/postmaster/startup.c

When fetching WAL for a basebackup, report errors with a sensible TLI.

commit   : 2f5c4397c39dea49c5608ba583868e26d767fc32    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 29 Oct 2021 14:00:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 29 Oct 2021 14:00:32 -0400    

Click here for diff

The previous code used ThisTimeLineID, which need not even be  
initialized here, although it usually was in practice, because  
pg_basebackup issues IDENTIFY_SYSTEM before calling BASE_BACKUP,  
and that initializes ThisTimeLineID as a side effect. That's not  
really good enough, though, not only because we shoudn't be counting  
on side effects like that, but also because the TLI could change  
meanwhile. Fortunately, we have convenient access to more meaningful  
TLI values, so use those instead.  
  
Because of the way this logic is coded, the consequences of using  
a possibly-incorrect TLI here are no worse than a slightly confusing  
error message, I don't want to take any risk here, so no back-patch  
at least for now.  
  
Patch by me, reviewed by Kyotaro Horiguchi and Michael Paquier  
  
Discussion: http://postgr.es/m/CA+TgmoZRNWGWYDX9RgTXMG6_nwSdB=PB-PPRUbvMUTGfmL2sHQ@mail.gmail.com  

M src/backend/replication/basebackup.c

Demote pg_unreachable() in heapam to an assertion.

commit   : 5f55fc5a346e1ab54f3d756e368d276b95be8c4a    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 29 Oct 2021 10:53:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 29 Oct 2021 10:53:48 -0700    

Click here for diff

Commit d168b66682, which overhauled index deletion, added a  
pg_unreachable() to the end of a sort comparator used when sorting heap  
TIDs from an index page.  This allows the compiler to apply  
optimizations that assume that the heap TIDs from the index AM must  
always be unique.  
  
That doesn't seem like a good idea now, given recent reports of  
corruption involving duplicate TIDs in indexes on Postgres 14.  Demote  
to an assertion, just in case.  
  
Backpatch: 14-, where index deletion was overhauled.  

M src/backend/access/heap/heapam.c

Test and document the behavior of initialization cross-refs in plpgsql.

commit   : a2a731d6c9db0ba650aa6f7c4fe349ccf712f74d    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Oct 2021 12:45:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Oct 2021 12:45:33 -0400    

Click here for diff

We had a test showing that a variable isn't referenceable in its  
own initialization expression, nor in prior ones in the same block.  
It *is* referenceable in later expressions in the same block, but  
AFAICS there is no test case exercising that.  Add one, and also  
add some error cases.  
  
Also, document that this is possible, since the docs failed to  
cover the point.  
  
Per question from tomás at tuxteam.  I don't feel any need to  
back-patch this, but we should ensure we don't break it in future.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/plpgsql.sgml
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Update time zone data files to tzdata release 2021e.

commit   : 937aafd6d5580b81134c7f303d04cf7561ad0309    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 29 Oct 2021 11:38:18 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 29 Oct 2021 11:38:18 -0400    

Click here for diff

DST law changes in Fiji, Jordan, Palestine, and Samoa.  Historical  
corrections for Barbados, Cook Islands, Guyana, Niue, Portugal, and  
Tonga.  
  
Also, the Pacific/Enderbury zone has been renamed to Pacific/Kanton.  
The following zones have been merged into nearby, more-populous zones  
whose clocks have agreed since 1970: Africa/Accra, America/Atikokan,  
America/Blanc-Sablon, America/Creston, America/Curacao,  
America/Nassau, America/Port_of_Spain, Antarctica/DumontDUrville,  
and Antarctica/Syowa.  

M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt

Add tap tests for the schema publications.

commit   : 6b0f6f79eef2168ce38a8ee99c3ed76e3df5d7ad    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 29 Oct 2021 07:48:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 29 Oct 2021 07:48:10 +0530    

Click here for diff

This adds additional tests for commit 5a2832465f ("Allow publishing the  
tables of schema.). This allows testing streaming of data in tables that  
are published via schema publications.  
  
Author: Vignesh C, Haiying Tang  
Reviewed-by: Greg Nancarrow, Hou Zhijie, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ%40mail.gmail.com  

A src/test/subscription/t/025_rep_changes_for_schema.pl

Speed up TAP tests of pg_receivewal

commit   : d680992af5406245f769b697fbb4e130e6220664    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 29 Oct 2021 10:41:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 29 Oct 2021 10:41:44 +0900    

Click here for diff

This commit improves the speed of those tests by 25~30%, using some  
simple ideas to reduce the amount of data written by pg_receivewal:  
- Use a segment size of 1MB.  While reducing the amount of data zeroed  
by pg_receivewal for the new segments, this improves the code coverage  
with a non-default segment size.  
- In the last test involving a slot's restart_lsn, generate a checkpoint  
to advance the redo LSN and the WAL retained by the slot created,  
reducing the number of segments that need to be archived.  This counts  
for most of the gain.  
- Minimize the amount of data inserted into the dummy table.  
  
Reviewed-by: Ronan Dunklau  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Speed up printing of integers in snprintf.c.

commit   : 3c17926eedd51c4094db7c62f59950918044ab1c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Oct 2021 13:39:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Oct 2021 13:39:57 -0400    

Click here for diff

Since the only possible divisors are 8, 10, and 16, it doesn't cost  
much code space to replace the division loop with three copies using  
constant divisors.  On most machines, division by a constant can be  
done a lot more cheaply than division by an arbitrary value.  
A microbenchmark testing just snprintf("foo %d") with a 9-digit value  
showed about a 2X speedup for me (tgl).  Most of Postgres isn't too  
dependent on the speed of snprintf, so that the effect in real-world  
cases is barely measurable.  Still, a cycle saved is a cycle earned.  
  
Arjan van de Ven  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Improve contrib/amcheck's tests for CREATE INDEX CONCURRENTLY.

commit   : 7f580aa5d88a9b03d66fcb9a1d7c4fcd69d9e126    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 28 Oct 2021 11:45:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 28 Oct 2021 11:45:14 -0400    

Click here for diff

Commits fdd965d07 and 3cd9c3b92 tested CREATE INDEX CONCURRENTLY by  
launching two separate pgbench runs concurrently.  This was needed so  
that only a single client thread would run CREATE INDEX CONCURRENTLY,  
avoiding deadlock between two CICs.  However, there's a better way,  
which is to use an advisory lock to prevent concurrent CICs.  That's  
better in part because the test code is shorter and more readable, but  
mostly because it automatically scales things to launch an appropriate  
number of CICs relative to the number of INSERT transactions.  
As committed, typically half to three-quarters of the CIC transactions  
were pointless because the INSERT transactions had already stopped.  
  
In passing, remove background_pgbench, which was added to support  
these tests and isn't needed anymore.  We can always put it back  
if we find a use for it later.  
  
Back-patch to v12; older pgbench versions lack the  
conditional-execution features needed for this method.  
  
Tom Lane and Andrey Borodin  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Add TAP test for archive_cleanup_command and recovery_end_command

commit   : 46dea2419ee7895a4eb3d048317682e6f18a17e1    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Oct 2021 10:49:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Oct 2021 10:49:26 +0900    

Click here for diff

This adds tests checking for the execution of both commands.  The  
recovery test 002_archiving.pl is nicely adapted to that, as promotion  
is triggered already twice there, and even if any of those commands fail  
they don't affect recovery or promotion.  
  
A command success is checked using a file generated by an "echo"  
command, that should be able to work in all the buildfarm environments,  
even Msys (but we'll know soon about that).  Command failure is tested  
with an "echo" command that points to a path that does not exist,  
scanning the backend logs to make sure that the failure happens.  Both  
rely on the backend triggering the commands from the root of the data  
folder, making its logic more robust.  
  
Thanks to Neha Sharma for the extra tests on Windows.  
  
Author: Amul Sul, Michael Paquier  
Reviewed-by: Andres Freund, Euler Taveira  
Discussion: https://postgr.es/m/CAAJ_b95R_c4T5moq30qsybSU=eDzDHm=4SPiAWaiMWc2OW7=1Q@mail.gmail.com  

M src/test/recovery/t/002_archiving.pl

commit   : cc1853b30048307d93f8aa30f4d64f88b527f04d    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 28 Oct 2021 09:25:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 28 Oct 2021 09:25:55 +0900    

Click here for diff

Reported-by: Anton Voloshin  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M doc/src/sgml/sepgsql.sgml

Remove obsolete nbtree LP_DEAD item comments.

commit   : 4c6afd805b8db3492c8f409ecdba192d853fd571    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 14:35:21 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 14:35:21 -0700    

Click here for diff

Comments above _bt_findinsertloc() that talk about LP_DEAD items are now  
out of place.  We already discuss index tuple deletion at an earlier  
point in the same comment block.  
  
Oversight in commit d168b666.  

M src/backend/access/nbtree/nbtinsert.c

Grant memory views to pg_read_all_stats.

commit   : 77ea4f94393eb4a16df32b573bf053bedaef2e09    
  
author   : Jeff Davis <[email protected]>    
date     : Wed, 27 Oct 2021 12:37:09 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Wed, 27 Oct 2021 12:37:09 -0700    

Click here for diff

Grant privileges on views pg_backend_memory_contexts and  
pg_shmem_allocations to the role pg_read_all_stats. Also grant on the  
underlying functions that those views depend on.  
  
Author: Bharath Rupireddy <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACWAZo3Ar_EVsn2Zf9irG+hYK3cmh1KWhZS_Od45nd01RA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix typos in comments

commit   : 8af57ad81578f825ac8c46840c841833db205106    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Oct 2021 22:38:38 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Oct 2021 22:38:38 +0200    

Click here for diff

Author: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/CAHut+PsN_gmKu-KfeEb9NDARoTPbs4AN4PPu=6LZXFZRJ13SEw@mail.gmail.com  

M src/backend/access/transam/xlogreader.c
M src/backend/commands/copyfrom.c

Fix ordering of items in nbtree error message.

commit   : c2381b51049bad5dd1863ab1116b315bd7693b7c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 13:05:35 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 13:05:35 -0700    

Click here for diff

Oversight in commit a5213adf.  
  
Backpatch: 13-, just like commit a5213adf.  

M src/backend/access/nbtree/nbtinsert.c

Fix VPATH builds for src/test/ssl targets

commit   : 349cd8c582a1e666c9c804850cf5b532b86cd1b4    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Oct 2021 21:49:48 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 27 Oct 2021 21:49:48 +0200    

Click here for diff

Commit b4c4a00ea refactored the gist of the sslfiles target into a  
separate makefile in order to override settings in Makefile.global.  
The invocation of this this file didn't however include the absolute  
path for VPATH builds, resulting in "make clean" failing. Fix by  
providing the path to the new makefile.  
  
Reported-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/Makefile

Further harden nbtree posting split code.

commit   : a5213adf3d351a31c5f5eae1a756a9d3555dc31c    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 12:10:47 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 27 Oct 2021 12:10:47 -0700    

Click here for diff

Add more defensive checks around posting list split code.  These should  
detect corruption involving duplicate table TIDs earlier and more  
reliably than any existing check.  
  
Follow up to commit 8f72bbac.  
  
Discussion: https://postgr.es/m/CAH2-WzkrSY_kjyd1_M5xJK1uM0govJXMxPn8JUSvwcUOiHuWVw@mail.gmail.com  
Backpatch: 13-, where nbtree deduplication was introduced.  

M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsearch.c

Clarify that --system reindexes system catalogs *only*

commit   : eff61383b982be8dc71d942340a839bea88a9eab    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 27 Oct 2021 16:20:02 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 27 Oct 2021 16:20:02 +0200    

Click here for diff

Make this more clear both in the help message and docs.  
  
Reviewed-By: Michael Paquier  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CABUevEw6Je0WUFTLhPKOk4+BoBuDrE-fKw3N4ckqgDBMFu4paA@mail.gmail.com  

M doc/src/sgml/ref/reindexdb.sgml
M src/bin/scripts/reindexdb.c

Add test for copy of shared dependencies from template database

commit   : 70bfc5ae537c8bfeed4849b7d9f814de89a155fe    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 27 Oct 2021 16:02:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 27 Oct 2021 16:02:19 +0900    

Click here for diff

As 98ec35b has proved, there has never been any coverage in this area of  
the code.  This commit adds a new TAP test with a template database that  
includes a small set of shared dependencies copied to a new database.  
The test is added in createdb, where we have never tested that -T  
generates a query with TEMPLATE, either.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/scripts/t/020_createdb.pl

Allow publishing the tables of schema.

commit   : 5a2832465fd8984d089e8c44c094e6900d987fcd    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 27 Oct 2021 07:44:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 27 Oct 2021 07:44:52 +0530    

Click here for diff

A new option "FOR ALL TABLES IN SCHEMA" in Create/Alter Publication allows  
one or more schemas to be specified, whose tables are selected by the  
publisher for sending the data to the subscriber.  
  
The new syntax allows specifying both the tables and schemas. For example:  
CREATE PUBLICATION pub1 FOR TABLE t1,t2,t3, ALL TABLES IN SCHEMA s1,s2;  
OR  
ALTER PUBLICATION pub1 ADD TABLE t1,t2,t3, ALL TABLES IN SCHEMA s1,s2;  
  
A new system table "pg_publication_namespace" has been added, to maintain  
the schemas that the user wants to publish through the publication.  
Modified the output plugin (pgoutput) to publish the changes if the  
relation is part of schema publication.  
  
Updates pg_dump to identify and dump schema publications. Updates the \d  
family of commands to display schema publications and \dRp+ variant will  
now display associated schemas if any.  
  
Author: Vignesh C, Hou Zhijie, Amit Kapila  
Syntax-Suggested-by: Tom Lane, Alvaro Herrera  
Reviewed-by: Greg Nancarrow, Masahiko Sawada, Hou Zhijie, Amit Kapila, Haiying Tang, Ajin Cherian, Rahila Syed, Bharath Rupireddy, Mark Dilger  
Tested-by: Haiying Tang  
Discussion: https://www.postgresql.org/message-id/CALDaNm0OANxuJ6RXqwZsM1MSY4s19nuH3734j4a72etDwvBETQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_publication.h
A src/include/catalog/pg_publication_namespace.h
M src/include/commands/publicationcmds.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/utils/syscache.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
M src/tools/pgindent/typedefs.list

Allow GRANT on pg_log_backend_memory_contexts().

commit   : f0b051e322d530a340e62f2ae16d99acdbcb3d05    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 26 Oct 2021 13:13:52 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 26 Oct 2021 13:13:52 -0700    

Click here for diff

Remove superuser check, allowing any user granted permissions on  
pg_log_backend_memory_contexts() to log the memory contexts of any  
backend.  
  
Note that this could allow a privileged non-superuser to log the  
memory contexts of a superuser backend, but as discussed, that does  
not seem to be a problem.  
  
Reviewed-by: Nathan Bossart, Bharath Rupireddy, Michael Paquier, Kyotaro Horiguchi, Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/mcxtfuncs.c
M src/include/catalog/catversion.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Improve HINT message that FDW reports when there are no valid options.

commit   : 5fedf7417b69295294b154a219edd8a26eaa6ab6    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 27 Oct 2021 00:46:52 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 27 Oct 2021 00:46:52 +0900    

Click here for diff

The foreign data wrapper's validator function provides a HINT message with  
list of valid options for the object specified in CREATE or ALTER command,  
when the option given in the command is invalid. Previously  
postgresql_fdw_validator() and the validator functions for postgres_fdw and  
dblink_fdw worked in that way even there were no valid options in the object,  
which could lead to the HINT message with empty list (because there were  
no valid options). For example, ALTER FOREIGN DATA WRAPPER postgres_fdw  
OPTIONS (format 'csv') reported the following ERROR and HINT messages.  
This behavior was confusing.  
  
    ERROR: invalid option "format"  
    HINT: Valid options in this context are:  
  
There is no such issue in file_fdw. The validator function for file_fdw  
reports the HINT message "There are no valid options in this context."  
instead in that case.  
  
This commit improves postgresql_fdw_validator() and the validator functions  
for postgres_fdw and dblink_fdw so that they do likewise. For example,  
this change causes the above ALTER FOREIGN DATA WRAPPER command to  
report the following messages.  
  
    ERROR:  invalid option "nonexistent"  
    HINT:  There are no valid options in this context.  
  
Author: Kosei Masumura  
Reviewed-by: Bharath Rupireddy, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/dblink/sql/dblink.sql
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/foreign/foreign.c
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Ensure that slots are zeroed before use

commit   : e63ce9e8d6ac8dced20592c4134004640f9f5644    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 26 Oct 2021 10:40:08 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 26 Oct 2021 10:40:08 +0200    

Click here for diff

The previous coding relied on the memory for the slots being zeroed  
elsewhere, which while it was true in this case is not an contract  
which is guaranteed to hold.  Explicitly clear the tts_isnull array  
to ensure that the slots are filled from a known state.  
  
Backpatch to v14 where the catalog multi-inserts were introduced.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CAJ7c6TP0AowkUgNL6zcAK-s5HYsVHVBRWfu69FRubPpfwZGM9A@mail.gmail.com  
Backpatch-through: 14  

M src/backend/catalog/heap.c
M src/backend/catalog/pg_shdepend.c

doc: Fix grammar in page of pg_receivewal

commit   : 8af09daf5629e9b85f37cc23983819b8ccd11b43    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 13:57:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 13:57:18 +0900    

Click here for diff

Introduced by f61e1dd.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/pg_receivewal.sgml

Fix overly-lax regex pattern in TAP test of READ_REPLICATION_SLOT

commit   : 0db343dc13bc8657976c39ddbf7e0c7db8b2efff    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 11:16:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 11:16:06 +0900    

Click here for diff

The case checking for a NULL output when a slot does not exist was  
too lax, as it was passing for any output generated by the query.  This  
fixes the matching pattern to be what it should be, matching only on  
"||".  
  
Oversight in b4ada4e.  

M src/test/recovery/t/001_stream_rep.pl

Allow pg_receivewal to stream from a slot's restart LSN

commit   : f61e1dd2cee6b1a1da75c2bb0ca3bc72f18748c1    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 09:30:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 26 Oct 2021 09:30:37 +0900    

Click here for diff

Prior to this patch, when running pg_receivewal, the streaming start  
point would be the current location of the archives if anything is  
found in the local directory where WAL segments are written, and  
pg_receivewal would fall back to the current WAL flush location if there  
are no archives, as of the result of an IDENTIFY_SYSTEM command.  
  
If for some reason the WAL files from pg_receivewal were moved, it is  
better to try a restart where we left at, which is the replication  
slot's restart_lsn instead of skipping right to the current flush  
location, to avoid holes in the WAL backed up.  This commit changes  
pg_receivewal to use the following sequence of methods to determine the  
starting streaming LSN:  
- Scan the local archives.  
- Use the slot's restart_lsn, if supported by the backend and if a slot  
is defined.  
- Fallback to the current flush LSN as reported by IDENTIFY_SYSTEM.  
  
To keep compatibility with older server versions, we only attempt to use  
READ_REPLICATION_SLOT if the backend version is at least 15, and  
fallback to the older behavior of streaming from the current flush  
LSN if the command is not supported.  
  
Some TAP tests are added to cover this feature.  
  
Author: Ronan Dunklau  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/18708360.4lzOvYHigE@aivenronan  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Reject huge_pages=on if shared_memory_type=sysv.

commit   : 8781b0ce25e702ba4a4f032d00da7acdef8dbfe1    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 26 Oct 2021 12:54:55 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 26 Oct 2021 12:54:55 +1300    

Click here for diff

It doesn't work (it could, but hasn't been implemented).  
Back-patch to 12, where shared_memory_type arrived.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/port/sysv_shmem.c

Initialize variable to placate compiler.

commit   : a030a0c5ccb113ccd09d0f0b82f1edb5e49ed607    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 16:30:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 16:30:12 -0400    

Click here for diff

Per Nathan Bossart.  
  
Discussion: http://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Report progress of startup operations that take a long time.

commit   : 9ce346eabf350a130bba46be3f8c50ba28506969    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 11:51:57 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 11:51:57 -0400    

Click here for diff

Users sometimes get concerned whe they start the server and it  
emits a few messages and then doesn't emit any more messages for  
a long time. Generally, what's happening is either that the  
system is taking a long time to apply WAL, or it's taking a  
long time to reset unlogged relations, or it's taking a long  
time to fsync the data directory, but it's not easy to tell  
which is the case.  
  
To fix that, add a new 'log_startup_progress_interval' setting,  
by default 10s. When an operation that is known to be potentially  
long-running takes more than this amount of time, we'll log a  
status update each time this interval elapses.  
  
To avoid undesirable log chatter, don't log anything about WAL  
replay when in standby mode.  
  
Nitin Jadhav and Robert Haas, reviewed by Amul Sul, Bharath  
Rupireddy, Justin Pryzby, Michael Paquier, and Álvaro Herrera.  
  
Discussion: https://postgr.es/m/CA+TgmoaHQrgDFOBwgY16XCoMtXxsrVGFB2jNCvb7-ubuEe1MGg@mail.gmail.com  
Discussion: https://postgr.es/m/CAMm1aWaHF7VE69572_OLQ+MgpT5RUiUDgF1x5RrtkJBLdpRj3Q@mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/nls.mk
M src/backend/postmaster/startup.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/reinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/startup.h
M src/include/utils/timeout.h

Add enable_timeout_every() to fire the same timeout repeatedly.

commit   : 732e6677a667c03b1551a855e3216644b0f125ec    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 30 Sep 2021 12:04:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 30 Sep 2021 12:04:50 -0400    

Click here for diff

enable_timeout_at() and enable_timeout_after() can still be used  
when you want to fire a timeout just once.  
  
Patch by me, per a suggestion from Tom Lane.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CA+TgmoYqSF5sCNrgTom9r3Nh=at4WmYFD=gsV-omStZ60S0ZUQ@mail.gmail.com  

M src/backend/utils/misc/timeout.c
M src/include/utils/timeout.h

Remove useless code from CreateReplicationSlot.

commit   : 902a2c280012557b85c7e0fce3f6f0e355cb2d69    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 10:57:12 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 10:57:12 -0400    

Click here for diff

According to the comments, we initialize sendTimeLineIsHistoric  
and sendTimeLine here for the benefit of WalSndSegmentOpen.  
However, the only way that can happen is if logical_read_xlog_page  
calls WALRead. And since logical_read_xlog_page initializes the  
same global variables internally, we don't need to also do it here.  
  
These initializations have been here since replication slots were  
introduced in commit 858ec11858a914d4c380971985709b6d6b7dd6fc. They  
were certainly useless at that time, too, because logical decoding  
didn't yet exist then, and physical replication doesn't examine any  
WAL at the time of slot creation. I haven't checked all the  
intermediate versions, but I suspect there's no point at which  
this code ever did anything useful.  
  
To reduce future confusion, remove the code. Since there's no  
functional defect, no back-patch.  
  
Discussion: http://postgr.es/m/CA+TgmobSWzacEs+r6C-7DrOPDHoDar4i9gzxB3SCBr5qjnLmVQ@mail.gmail.com  

M src/backend/replication/walsender.c

StartupXLOG: Don't repeatedly disable/enable local xlog insertion.

commit   : 18e0913a420349d373cfd8e45b91b4777501fb74    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 10:16:28 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 10:16:28 -0400    

Click here for diff

All the code that runs in the startup process to write WAL records  
before that's allowed generally is now consecutive, so there's no  
reason to shut the facility to write WAL locally off and then turn  
it on again three times in a row.  
  
Unfortunately, this requires a slight kludge in the checkpointer,  
which needs to separately enable writing WAL in order to write the  
checkpoint record. Because that code might run in the same process  
as StartupXLOG() if we are in single-user mode, we must save/restore  
the state of the LocalXLogInsertAllowed flag. Hopefully, we'll be  
able to eliminate this wart in further refactoring, but it's  
not too bad anyway.  
  
Amul Sul, with modifications by me.  
  
Discussion: http://postgr.es/m/CAAJ_b97fysj6sRSQEfOHj-y8Jfd5uPqOgO74qast89B4WfD+TA@mail.gmail.com  

M src/backend/access/transam/xlog.c

StartupXLOG: Call CleanupAfterArchiveRecovery after XLogReportParameters.

commit   : a75dbf7f9ee6ff0c0e2ab4b224b04fc50c4e6577    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 09:49:46 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 25 Oct 2021 09:49:46 -0400    

Click here for diff

This does a better job grouping related operations together, since  
all of the WAL records that we need to write prior to allowing WAL  
writes generally and written by a single uninterrupted stretch of code.  
  
Since CleanupAfterArchiveRecovery() just (1) runs recovery_end_command,  
(2) removes non-parent xlog files, and (3) archives any final partial  
segment, this should be safe, because all of those things are pretty  
much unrelated to the WAL record written by XLogReportParameters().  
  
Amul Sul, per a suggestion from me  
  
Discussion: http://postgr.es/m/CAAJ_b97fysj6sRSQEfOHj-y8Jfd5uPqOgO74qast89B4WfD+TA@mail.gmail.com  

M src/backend/access/transam/xlog.c

Clarify the logic in a few places in the new balanced merge code.

commit   : 166f94377c886516ca986ef8a623cd2e854fe911    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Oct 2021 09:30:49 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 25 Oct 2021 09:30:49 +0300    

Click here for diff

In selectnewtape(), use 'nOutputTapes' rather than 'nOutputRuns' in the  
check for whether to start a new tape or to append a new run to an  
existing tape. Until 'maxTapes' is reached, nOutputTapes is always equal  
to nOutputRuns, so it doesn't change the logic, but it seems more logical  
to compare # of tapes with # of tapes. Also, currently maxTapes is never  
modified after the merging begins, but written this way, the code would  
still work if it was. (Although the nOutputRuns == nOutputTapes assertion  
would need to be removed and using nOutputRuns % nOutputTapes to  
distribute the runs evenly across the tapes wouldn't do a good job  
anymore).  
  
Similarly in mergeruns(), change to USEMEM(state->tape_buffer_mem) to  
account for the memory used for tape buffers. It's equal to availMem  
currently, but tape_buffer_mem is more direct and future-proof. For  
example, if we changed the logic to only allocate half of the remaining  
memory to tape buffers, USEMEM(state->tape_buffer_mem) would still be  
correct.  
  
Coverity complained about these. Hopefully this patch helps it to  
understand the logic better. Thanks to Tom Lane for initial analysis.  

M src/backend/utils/sort/tuplesort.c

Add replication command READ_REPLICATION_SLOT

commit   : b4ada4e19fd7bedb433e46516ccd0ca4213d2719    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 25 Oct 2021 07:40:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 25 Oct 2021 07:40:42 +0900    

Click here for diff

The command is supported for physical slots for now, and returns the  
type of slot, its restart_lsn and its restart_tli.  
  
This will be useful for an upcoming patch related to pg_receivewal, to  
allow the tool to be able to stream from the position of a slot, rather  
than the last WAL position flushed by the backend (as reported by  
IDENTIFY_SYSTEM) if the archive directory is found as empty, which would  
be an advantage in the case of switching to a different archive  
locations with the same slot used to avoid holes in WAL segment  
archives.  
  
Author: Ronan Dunklau  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/18708360.4lzOvYHigE@aivenronan  

M doc/src/sgml/protocol.sgml
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/include/nodes/nodes.h
M src/include/nodes/replnodes.h
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/tools/pgindent/typedefs.list

Fix minor memory leaks in pg_dump.

commit   : 70bef494000e4dbbeca0f0a40347ca1747aea701    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 24 Oct 2021 12:38:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 24 Oct 2021 12:38:26 -0400    

Click here for diff

I found these by running pg_dump under "valgrind --leak-check=full".  
  
The changes in flagInhIndexes() and getIndexes() replace allocation of  
an array of which we use only some elements by individual allocations  
of just the actually-needed objects.  The previous coding wasted some  
memory, but more importantly it confused valgrind's leak tracking.  
  
collectComments() and collectSecLabels() remain major blots on  
the valgrind report, because they don't PQclear their query  
results, in order to avoid a lot of strdup's.  That's a dubious  
tradeoff, but I'll leave it alone here; an upcoming patch will  
modify those functions enough to justify changing the tradeoff.  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

Move Perl test modules to a better namespace

commit   : b3b4d8e68ae83f432f43f035c7eb481ef93e1583    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 24 Oct 2021 10:28:19 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 24 Oct 2021 10:28:19 -0400    

Click here for diff

The five modules in our TAP test framework all had names in the top  
level namespace. This is unwise because, even though we're not  
exporting them to CPAN, the names can leak, for example if they are  
exported by the RPM build process. We therefore move the modules to the  
PostgreSQL::Test namespace. In the process PostgresNode is renamed to  
Cluster, and TestLib is renamed to Utils. PostgresVersion becomes simply  
PostgreSQL::Version, to avoid possible confusion about what it's the  
version of.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed by Erik Rijkers and Michael Paquier  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/bloom/t/001_wal.pl
M contrib/oid2name/t/001_basic.pl
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/vacuumlo/t/001_basic.pl
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/Makefile
R092 src/test/perl/PostgresNode.pm src/test/perl/PostgreSQL/Test/Cluster.pm
R091 src/test/perl/RecursiveCopy.pm src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
R094 src/test/perl/SimpleTee.pm src/test/perl/PostgreSQL/Test/SimpleTee.pm
R096 src/test/perl/TestLib.pm src/test/perl/PostgreSQL/Test/Utils.pm
R087 src/test/perl/PostgresVersion.pm src/test/perl/PostgreSQL/Version.pm
M src/test/perl/README
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/regress/pg_regress.c
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/SSLServer.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/100_bugs.pl

Fix CREATE INDEX CONCURRENTLY for the newest prepared transactions.

commit   : 3cd9c3b921977272e6650a5efbeade4203c4bca2    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 23 Oct 2021 18:36:38 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 23 Oct 2021 18:36:38 -0700    

Click here for diff

The purpose of commit 8a54e12a38d1545d249f1402f66c8cde2837d97c was to  
fix this, and it sufficed when the PREPARE TRANSACTION completed before  
the CIC looked for lock conflicts.  Otherwise, things still broke.  As  
before, in a cluster having used CIC while having enabled prepared  
transactions, queries that use the resulting index can silently fail to  
find rows.  It may be necessary to reindex to recover from past  
occurrences; REINDEX CONCURRENTLY suffices.  Fix this for future index  
builds by making CIC wait for arbitrarily-recent prepared transactions  
and for ordinary transactions that may yet PREPARE TRANSACTION.  As part  
of that, have PREPARE TRANSACTION transfer locks to its dummy PGPROC  
before it calls ProcArrayClearTransaction().  Back-patch to 9.6 (all  
supported versions).  
  
Andrey Borodin, reviewed (in earlier versions) by Andres Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

A contrib/amcheck/t/003_cic_2pc.pl
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/cache/inval.c
M src/include/access/twophase.h
M src/include/storage/lock.h

Avoid race in RelationBuildDesc() affecting CREATE INDEX CONCURRENTLY.

commit   : fdd965d074d46765c295223b119ca437dbcac973    
  
author   : Noah Misch <[email protected]>    
date     : Sat, 23 Oct 2021 18:36:38 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sat, 23 Oct 2021 18:36:38 -0700    

Click here for diff

CIC and REINDEX CONCURRENTLY assume backends see their catalog changes  
no later than each backend's next transaction start.  That failed to  
hold when a backend absorbed a relevant invalidation in the middle of  
running RelationBuildDesc() on the CIC index.  Queries that use the  
resulting index can silently fail to find rows.  Fix this for future  
index builds by making RelationBuildDesc() loop until it finishes  
without accepting a relevant invalidation.  It may be necessary to  
reindex to recover from past occurrences; REINDEX CONCURRENTLY suffices.  
Back-patch to 9.6 (all supported versions).  
  
Noah Misch and Andrey Borodin, reviewed (in earlier versions) by Andres  
Freund.  
  
Discussion: https://postgr.es/m/[email protected]  

A contrib/amcheck/t/002_cic.pl
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/include/utils/inval.h
M src/include/utils/relcache.h
M src/test/perl/PostgresNode.pm
M src/tools/pgindent/typedefs.list

doc: Describe calculation method of streaming start for pg_receivewal

commit   : 1e9475694b0ae2cf1204d01d2ef6ad86f3c7cac8    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 23 Oct 2021 14:43:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 23 Oct 2021 14:43:03 +0900    

Click here for diff

The documentation was imprecise about the starting LSN used for WAL  
streaming if nothing can be found in the local archive directory  
defined with the pg_receivewal command, so be more talkative on this  
matter.  
  
Extracted from a larger patch by the same author.  
  
Author: Ronan Dunklau, Michael Paquier  
Discussion: https://postgr.es/m/18708360.4lzOvYHigE@aivenronan  
Backpatch-through: 10  

M doc/src/sgml/ref/pg_receivewal.sgml

In pg_dump, use simplehash.h to look up dumpable objects by OID.

commit   : 92316a4582a5714d4e494aaf90360860e7fec37a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 17:19:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 17:19:03 -0400    

Click here for diff

Create a hash table that indexes dumpable objects by CatalogId  
(that is, catalog OID + object OID).  Use this to replace the  
former catalogIdMap array, as well as various other single-  
catalog index arrays, and also the extension membership map.  
  
In principle this should be faster for databases with many objects,  
since lookups are now O(1) not O(log N).  However, it seems that these  
lookups are pretty much negligible in context, so that no overall  
performance change can be measured.  But having only one lookup  
data structure to maintain makes the code simpler and more flexible,  
so let's do it anyway.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Fix frontend version of sh_error() in simplehash.h.

commit   : 974aedcea46dfd0119eea2fbb2eeacd232596f05    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 16:43:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 16:43:38 -0400    

Click here for diff

The code does not expect sh_error() to return, but the patch  
that made this header usable in frontend didn't get that memo.  
  
While here, plaster unlikely() on the tests that decide whether  
to invoke sh_error(), and add our standard copyright notice.  
  
Noted by Andres Freund.  Back-patch to v13 where this frontend  
support came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/lib/simplehash.h

pg_dump: fix mis-dumping of non-global default privileges.

commit   : 2acc84c6fd299125702c8a8af13820abcc0d4891    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 15:22:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 22 Oct 2021 15:22:25 -0400    

Click here for diff

Non-global default privilege entries should be dumped as-is,  
not made relative to the default ACL for their object type.  
This would typically only matter if one had revoked some  
on-by-default privileges in a global entry, and then wanted  
to grant them again in a non-global entry.  
  
Per report from Boris Korzun.  This is an old bug, so back-patch  
to all supported branches.  
  
Neil Chen, test case by Masahiko Sawada  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAA3qoJnr2+1dVJObNtfec=qW4Z0nz=A9+r5bZKoTSy5RDjskMw@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl

Add module build directory to the PATH for TAP tests

commit   : f4ce6c4d3a30ec3a12c7f64b90a6fc82887ddd7b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 22 Oct 2021 09:11:52 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 22 Oct 2021 09:11:52 -0400    

Click here for diff

For non-MSVC builds this is make's $(CURDIR), while for MSVC builds it  
is $topdir/$Config/$module. The directory is added as the second element  
in the PATH, so that the install location takes precedence, but the  
added PATH element takes precedence over the rest of the PATH.  
  
The reason for this is to allow tests to find built products that are  
not installed, such as the libpq_pipeline test driver.  
  
The libpq_pipeline test is adjusted to take advantage of this.  
  
Based on a suggestion from Andres Freund.  
  
Backpatch to release 14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/tools/msvc/vcregress.pl

Doc: clarify a critical and undocumented aspect of simplehash.h.

commit   : b1ce6c284366ce1dae120f5d10dd59e8804322ee    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 21 Oct 2021 17:08:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 21 Oct 2021 17:08:53 -0400    

Click here for diff

I just got burnt by trying to use pg_malloc instead of pg_malloc0  
with this.  Save the next hacker some time by not leaving this  
API detail undocumented.  

M src/include/lib/simplehash.h

Fix SSL tests on 32-bit Perl

commit   : 0c04342b1d3dd5b24f795f94874163be8e21710e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Oct 2021 10:28:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 21 Oct 2021 10:28:50 +0200    

Click here for diff

The certificate serial number generation was changed in b4c4a00ea to  
use the current timestamp. The testharness must thus interrogate the  
cert for the serialnumber using "openssl x509" which emits the serial  
in hex format. Converting the serial to integer format to match whats  
in pg_stat_ssl requires a 64-bit capable Perl. This adds a fallback  
to checking for an integer when the tests with a 32-bit Perl.  
  
Per failure on buildfarm member prairiedog.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/t/001_ssltests.pl

Remove unused wait events.

commit   : 1607cd0b6c9919bf765198882ea48a98e901e1bc    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 21 Oct 2021 08:01:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 21 Oct 2021 08:01:25 +0530    

Click here for diff

Commit 464824323e introduced the wait events which were neither used by  
that commit nor by follow-up commits for that work.  
  
Author: Masahiro Ikeda  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

Fix corruption of pg_shdepend when copying deps from template database

commit   : 98ec35b0bbf6003e89fc06aa140e12fd90bbad47    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 21 Oct 2021 10:39:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 21 Oct 2021 10:39:01 +0900    

Click here for diff

Using for a new database a template database with shared dependencies  
that need to be copied over was causing a corruption of pg_shdepend  
because of an off-by-one computation error of the index number used for  
the values inserted with a slot.  
  
Issue introduced by e3931d0.  Monitoring the rest of the code, there are  
no similar mistakes.  
  
Reported-by: Sven Klemm  
Author: Aleksander Alekseev  
Reviewed-by: Daniel Gustafsson, Michael Paquier  
Discussion: https://postgr.es/m/CAJ7c6TP0AowkUgNL6zcAK-s5HYsVHVBRWfu69FRubPpfwZGM9A@mail.gmail.com  
Backpatch-through: 14  

M src/backend/catalog/pg_shdepend.c

Improve pg_regress.c's infrastructure for issuing psql commands.

commit   : f45dc59a38cab1d2af6baaedb79559fe2e9b3781    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 20 Oct 2021 18:44:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 20 Oct 2021 18:44:37 -0400    

Click here for diff

Support issuing more than one "-c command" switch to a single  
psql invocation.  This allows combining some things that formerly  
required two or more backend launches into a single session.  
In particular, we can issue DROP DATABASE as one of the -c commands  
without getting "DROP DATABASE cannot run inside a transaction block".  
  
In addition to reducing the number of sessions needed, this patch  
also suppresses "NOTICE:  database "foo" does not exist, skipping"  
chatter that was formerly generated during pg_regress's DROP DATABASE  
(or ROLE) IF NOT EXISTS calls.  That moves us another step closer  
to the ideal of not seeing any messages during successful build/test.  
  
This also eliminates some hard-coded restrictions on the length of  
the commands issued.  I don't think we were anywhere near hitting  
those, but getting rid of the limit is comforting.  
  
Patch by me, but thanks to Nathan Bossart for starting the discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/pg_regress.c

Protect against collation variations in test

commit   : cd124d205c42a623b68cd155ace94cc376851b78    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 20 Oct 2021 13:05:42 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 20 Oct 2021 13:05:42 -0300    

Click here for diff

Discussion: https://postgr.es/m/YW/[email protected]  

M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix build of MSVC with OpenSSL 3.0.0

commit   : 41f30ecc29c89285d3eecd435906c4e9cb048be4    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 20 Oct 2021 16:48:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 20 Oct 2021 16:48:24 +0900    

Click here for diff

The build scripts of Visual Studio would fail to detect properly a 3.0.0  
build as the check on the second digit was failing.  This is adjusted  
where needed, allowing the builds to complete.  Note that the MSIs of  
OpenSSL mentioned in the documentation have not changed any library  
names for Win32 and Win64, making this change straight-forward.  
  
Reported-by: htalaco, via github  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/tools/msvc/Solution.pm

Ensure correct lock level is used in ALTER ... RENAME

commit   : c2c618ff1137f9ef58827f57e4ec0f97453e454e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 19 Oct 2021 19:08:45 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 19 Oct 2021 19:08:45 -0300    

Click here for diff

Commit 1b5d797cd4f7 intended to relax the lock level used to rename  
indexes, but inadvertently allowed *any* relation to be renamed with a  
lowered lock level, as long as the command is spelled ALTER INDEX.  
That's undesirable for other relation types, so retry the operation with  
the higher lock if the relation turns out not to be an index.  
  
After this fix, ALTER INDEX <sometable> RENAME will require access  
exclusive lock, which it didn't before.  
  
Author: Nathan Bossart <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Onder Kalaci <[email protected]>  
Discussion: https://postgr.es/m/PH0PR21MB1328189E2821CDEC646F8178D8AE9@PH0PR21MB1328.namprd21.prod.outlook.com  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

pg_dump: Reorganize getTables()

commit   : 4438eb4a495c977d8ac485dd6e544c2b6e077deb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 17:22:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 17:22:22 -0400    

Click here for diff

Along the same lines as 047329624, ed2c7f65b and daa9fe8a5, reduce  
code duplication by having just one copy of the parts of the query  
that are the same across all server versions; and make the  
conditionals control the smallest possible amount of code.  
This also gets rid of the confusing assortment of different ways  
to accomplish the same result that we had here before.  
  
While at it, make sure all three relevant parts of the function  
list the fields in the same order.  This is just neatnik-ism,  
of course.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Adapt src/test/ldap/t/001_auth.pl to work with openldap 2.5.

commit   : 984f460e2f29e7ba9174cabb9f43a0d1dce543bf    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 19 Oct 2021 10:14:49 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 19 Oct 2021 10:14:49 -0700    

Click here for diff

ldapsearch's deprecated -h/-p arguments were removed, need to use -H now -  
which has been around for over 20 years.  
  
As perltidy insists on reflowing the parameters anyway, change order and  
"phrasing" to yield a less confusing layout (per suggestion from Tom Lane).  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 11-, where the tests were added.  

M src/test/ldap/t/001_auth.pl

Refactor the sslfiles Makefile target for ease of use

commit   : b4c4a00eada3c512e819e9163114a5ad1606bc7e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 20:11:42 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 20:11:42 +0200    

Click here for diff

The Makefile handling of certificate and keypairs used for TLS testing  
had become quite difficult to work with. Adding a new cert without the  
need to regenerate everything was too complicated. This patch refactors  
the sslfiles make target such that adding a new certificate requires  
only adding a .config file, adding it to the top of the Makefile, and  
running make sslfiles.  
  
Improvements:  
- Interfile dependencies should be fixed, with the exception of the CRL  
  dirs.  
- New certificates have serial numbers based on the current time,  
  reducing the chance of collision.  
- The CA index state is created on demand and cleaned up automatically  
  at the end of the Make run.  
- *.config files are now self-contained; one certificate needs one  
  config file instead of two.  
- Duplication is reduced, and along with it some unneeded code (and  
  possible copy-paste errors).  
- all configuration files underneath the conf/ directory.  
  
The target is moved to its own makefile in order to avoid colliding  
with global make settings.  
  
Author: Jacob Champion <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/Makefile
M src/test/ssl/README
R093 src/test/ssl/cas.config src/test/ssl/conf/cas.config
R097 src/test/ssl/client-dn.config src/test/ssl/conf/client-dn.config
A src/test/ssl/conf/client-revoked.config
R096 src/test/ssl/client.config src/test/ssl/conf/client.config
R081 src/test/ssl/client_ca.config src/test/ssl/conf/client_ca.config
R092 src/test/ssl/root_ca.config src/test/ssl/conf/root_ca.config
R100 src/test/ssl/server-cn-and-alt-names.config src/test/ssl/conf/server-cn-and-alt-names.config
R085 src/test/ssl/server-cn-only.config src/test/ssl/conf/server-cn-only.config
R100 src/test/ssl/server-multiple-alt-names.config src/test/ssl/conf/server-multiple-alt-names.config
R085 src/test/ssl/server-no-names.config src/test/ssl/conf/server-no-names.config
R088 src/test/ssl/server-revoked.config src/test/ssl/conf/server-revoked.config
R100 src/test/ssl/server-single-alt-name.config src/test/ssl/conf/server-single-alt-name.config
R081 src/test/ssl/server_ca.config src/test/ssl/conf/server_ca.config
M src/test/ssl/ssl/both-cas-1.crt
M src/test/ssl/ssl/both-cas-2.crt
M src/test/ssl/ssl/client+client_ca.crt
M src/test/ssl/ssl/client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/client-dn.crt
M src/test/ssl/ssl/client-revoked.crt
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/client.crt
M src/test/ssl/ssl/client_ca.crt
M src/test/ssl/ssl/root+client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/root+client-crldir/a3d11bff.r0
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/ssl/root+client_ca.crt
M src/test/ssl/ssl/root+server-crldir/a3d11bff.r0
M src/test/ssl/ssl/root+server-crldir/a836cc2d.r0
M src/test/ssl/ssl/root+server.crl
M src/test/ssl/ssl/root+server_ca.crt
M src/test/ssl/ssl/root.crl
M src/test/ssl/ssl/root_ca.crt
M src/test/ssl/ssl/server-cn-and-alt-names.crt
M src/test/ssl/ssl/server-cn-only.crt
M src/test/ssl/ssl/server-crldir/a836cc2d.r0
M src/test/ssl/ssl/server-multiple-alt-names.crt
M src/test/ssl/ssl/server-no-names.crt
M src/test/ssl/ssl/server-revoked.crt
M src/test/ssl/ssl/server-single-alt-name.crt
M src/test/ssl/ssl/server.crl
M src/test/ssl/ssl/server_ca.crt
A src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl

Fix assignment to array of domain over composite.

commit   : 3e310d837a9b3de8ad977c0a3e2a769bcdf61cc9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 13:54:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 13:54:45 -0400    

Click here for diff

An update such as "UPDATE ... SET fld[n].subfld = whatever"  
failed if the array elements were domains rather than plain  
composites.  That's because isAssignmentIndirectionExpr()  
failed to cope with the CoerceToDomain node that would appear  
in the expression tree in this case.  The result would typically  
be a crash, and even if we accidentally didn't crash, we'd not  
correctly preserve other fields of the same array element.  
  
Per report from Onder Kalaci.  Back-patch to v11 where arrays of  
domains came in.  
  
Discussion: https://postgr.es/m/PH0PR21MB132823A46AA36F0685B7A29AD8BD9@PH0PR21MB1328.namprd21.prod.outlook.com  

M src/backend/executor/execExpr.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Remove bogus assertion in transformExpressionList().

commit   : 697dd1925f418c9f54ee1fd1cefbc613d6504b1f    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 11:35:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 19 Oct 2021 11:35:15 -0400    

Click here for diff

I think when I added this assertion (in commit 8f889b108), I was only  
thinking of the use of transformExpressionList at top level of INSERT  
and VALUES.  But it's also called by transformRowExpr(), which can  
certainly occur in an UPDATE targetlist, so it's inappropriate to  
suppose that p_multiassign_exprs must be empty.  Besides, since the  
input is not expected to contain ResTargets, there's no reason it  
should contain MultiAssignRefs either.  Hence this code need not  
be concerned about the state of p_multiassign_exprs, and we should  
just drop the assertion.  
  
Per bug #17236 from ocean_li_996.  It's been wrong for years,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_target.c

Fix bug in TOC file error message printing

commit   : 998d060f3db79c6918cb4a547695be150833f9a4    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 12:59:54 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 12:59:54 +0200    

Click here for diff

If the blob TOC file cannot be parsed, the error message was failing  
to print the filename as the variable holding it was shadowed by the  
destination buffer for parsing.  When the filename fails to parse,  
the error will print an empty string:  
  
 ./pg_restore -d foo -F d dump  
 pg_restore: error: invalid line in large object TOC file "": ..  
  
..instead of the intended error message:  
  
 ./pg_restore -d foo -F d dump  
 pg_restore: error: invalid line in large object TOC file "dump/blobs.toc": ..  
  
Fix by renaming both variables as the shared name was too generic to  
store either and still convey what the variable held.  
  
Backpatch all the way down to 9.6.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/bin/pg_dump/pg_backup_directory.c

Fix sscanf limits in pg_basebackup and pg_dump

commit   : 1d7641d51a51aa00dff685022fab6c03be8f8af8    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 12:59:50 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 19 Oct 2021 12:59:50 +0200    

Click here for diff

Make sure that the string parsing is limited by the size of the  
destination buffer.  
  
In pg_basebackup the available values sent from the server  
is limited to two characters so there was no risk of overflow.  
  
In pg_dump the buffer is bounded by MAXPGPATH, and thus the limit  
must be inserted via preprocessor expansion and the buffer increased  
by one to account for the terminator. There is no risk of overflow  
here, since in this case, the buffer scanned is smaller than the  
destination buffer.  
  
Backpatch the pg_basebackup fix to 11 where it was introduced, and  
the pg_dump fix all the way down to 9.6.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 11 and 9.6  

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_dump/pg_backup_directory.c

Block ALTER INDEX/TABLE index_name ALTER COLUMN colname SET (options)

commit   : fdd88571454e2b00dbe446e8609c6e4294ca89ae    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 19 Oct 2021 11:03:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 19 Oct 2021 11:03:52 +0900    

Click here for diff

The grammar of this command run on indexes with column names has always  
been authorized by the parser, and it has never been documented.  
  
Since 911e702, it is possible to define opclass parameters as of CREATE  
INDEX, which actually broke the old case of ALTER INDEX/TABLE where  
relation-level parameters n_distinct and n_distinct_inherited could be  
defined for an index (see 76a47c0 and its thread where this point has  
been touched, still remained unused).  Attempting to do that in v13~  
would cause the index to become unusable, as there is a new dedicated  
code path to load opclass parameters instead of the relation-level ones  
previously available.  Note that it is possible to fix things with a  
manual catalog update to bring the relation back online.  
  
This commit disables this command for now as the use of column names for  
indexes does not make sense anyway, particularly when it comes to index  
expressions where names are automatically computed.  One way to properly  
support this case properly in the future would be to use column numbers  
when it comes to indexes, in the same way as ALTER INDEX .. ALTER COLUMN  
.. SET STATISTICS.  
  
Partitioned indexes were already blocked, but not indexes.  Some tests  
are added for both cases.  
  
There was some code in ANALYZE to enforce n_distinct to be used for an  
index expression if the parameter was defined, but just remove it for  
now until/if there is support for this (note that index-level parameters  
never had support in pg_dump either, previously), so this was just dead  
code.  
  
Reported-by: Matthijs van der Vleuten  
Author: Nathan Bossart, Michael Paquier  
Reviewed-by: Vik Fearing, Dilip Kumar  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql

Invalidate partitions of table being attached/detached

commit   : d6f1e16c8fe27100e371a15aeeb498faa680ceed    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 18 Oct 2021 19:08:25 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 18 Oct 2021 19:08:25 -0300    

Click here for diff

Failing to do that, any direct inserts/updates of those partitions  
would fail to enforce the correct constraint, that is, one that  
considers the new partition constraint of their parent table.  
  
Backpatch to 10.  
  
Reported by: Hou Zhijie <[email protected]>  
Author: Amit Langote <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Nitin Jadhav <[email protected]>  
Reviewed-by: Pavel Borisov <[email protected]>  
  
Discussion: https://postgr.es/m/OS3PR01MB5718DA1C4609A25186D1FBF194089%40OS3PR01MB5718.jpnprd01.prod.outlook.com  

M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Fix parallel sort, broken by the balanced merge patch.

commit   : fc0f3b4cb0e882a9c5d51c302d4aa3591e4f80fd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 20:42:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 20:42:10 +0300    

Click here for diff

The code for initializing the tapes on each merge iteration was skipped  
in a parallel worker. I put the !WORKER(state) check in wrong place while  
rebasing the patch.  
  
That caused failures in the index build in 'multiple-row-versions'  
isolation test, in multiple buildfarm members. On my laptop it was easier  
to reproduce by building an index on a larger table, so that you got a  
parallel sort more reliably.  

M src/backend/utils/sort/tuplesort.c

Fix duplicate typedef LogicalTape.

commit   : aa3ac6453b28049b3198433b75228271b7612d4a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 17:02:01 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 17:02:01 +0300    

Click here for diff

To make buildfarm member locust happy.  

M src/backend/utils/sort/logtape.c

Fix format modifier used in elog.

commit   : 0bd65a3905706927cdd6b3158b6457c1c854471b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 16:15:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 16:15:44 +0300    

Click here for diff

The previous commit 65014000b3 changed the variable passed to elog  
from an int64 to a size_t variable, but neglected to change the modifier  
in the format string accordingly.  
  
Per failure on buildfarm member lapwing.  

M src/backend/utils/sort/tuplesort.c

Replace polyphase merge algorithm with a simple balanced k-way merge.

commit   : 65014000b351d5725eb00d133416ab1b4f8245b1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 14:33:42 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 14:33:42 +0300    

Click here for diff

The advantage of polyphase merge is that it can reuse the input tapes as  
output tapes efficiently, but that is irrelevant on modern hardware, when  
we can easily emulate any number of tape drives. The number of input tapes  
we can/should use during merging is limited by work_mem, but output tapes  
that we are not currently writing to only cost a little bit of memory, so  
there is no need to skimp on them.  
  
This makes sorts that need multiple merge passes faster.  
  
Discussion: https://www.postgresql.org/message-id/420a0ec7-602c-d406-1e75-1ef7ddc58d83%40iki.fi  
Reviewed-by: Peter Geoghegan, Zhihong Yu, John Naylor  

M src/backend/utils/sort/tuplesort.c

Refactor LogicalTapeSet/LogicalTape interface.

commit   : c4649cce39a41b27db874e75ddd47adaec1b0ea4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 14:30:00 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 18 Oct 2021 14:30:00 +0300    

Click here for diff

All the tape functions, like LogicalTapeRead and LogicalTapeWrite, now  
take a LogicalTape as argument, instead of LogicalTapeSet+tape number.  
You can create any number of LogicalTapes in a single LogicalTapeSet, and  
you don't need to decide the number upfront, when you create the tape set.  
  
This makes the tape management in hash agg spilling in nodeAgg.c simpler.  
  
Discussion: https://www.postgresql.org/message-id/420a0ec7-602c-d406-1e75-1ef7ddc58d83%40iki.fi  
Reviewed-by: Peter Geoghegan, Zhihong Yu, John Naylor  

M src/backend/executor/nodeAgg.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/tuplesort.c
M src/include/nodes/execnodes.h
M src/include/utils/logtape.h

Reset properly snapshot export state during transaction abort

commit   : 409f9ca4471331be0f77b665ff3a1836a41de5b3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Oct 2021 11:55:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Oct 2021 11:55:42 +0900    

Click here for diff

During a replication slot creation, an ERROR generated in the same  
transaction as the one creating a to-be-exported snapshot would have  
left the backend in an inconsistent state, as the associated static  
export snapshot state was not being reset on transaction abort, but only  
on the follow-up command received by the WAL sender that created this  
snapshot on replication slot creation.  This would trigger inconsistency  
failures if this session tried to export again a snapshot, like during  
the creation of a replication slot.  
  
Note that a snapshot export cannot happen in a transaction block, so  
there is no need to worry resetting this state for subtransaction  
aborts.  Also, this inconsistent state would very unlikely show up to  
users.  For example, one case where this could happen is an  
out-of-memory error when building the initial snapshot to-be-exported.  
Dilip found this problem while poking at a different patch, that caused  
an error in this code path for reasons unrelated to HEAD.  
  
Author: Dilip Kumar  
Reviewed-by: Michael Paquier, Zhihong Yu  
Discussion: https://postgr.es/m/CAFiTN-s0zA1Kj0ozGHwkYkHwa5U0zUE94RSc_g81WrpcETB5=w@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/access/transam/xact.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Fix portability issues in new TAP tests of psql

commit   : 384f1abdb9b0f669279fcd57ba2173eb31724740    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 18 Oct 2021 09:51:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 18 Oct 2021 09:51:21 +0900    

Click here for diff

The tests added by c0280bc and d9ddc50 in 001_basic.pl have introduced  
commands calling directly psql, making them sensitive to the  
environment.  One issue was that those commands forgot -X to not use a  
local .psqlrc, causing all those tests to fail if psql cannot properly  
parse this file.  
  
TAP tests should be designed so as they run in an isolated fashion,  
without any dependency on the environment where they are run.  As  
PostgresNode::psql gives already all the facilities those new tests  
need, switch to that instead of calling plain psql commands where  
interactions with a backend are needed.  The test is slightly refactored  
to be able to check after the expected patterns of stdout and stderr,  
keeping the same amount of coverage as previously.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzn8ftvcDPwomn+y04JJzbT=TG7TN=QsmSEATUOW-ZuvQQ@mail.gmail.com  

M src/bin/psql/t/001_basic.pl

Avoid core dump in pg_dump when dumping from pre-8.3 server.

commit   : 40dfac4fc4776213a02291f13046d36e318f2629    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Oct 2021 15:02:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Oct 2021 15:02:55 -0400    

Click here for diff

Commit f0e21f2f6 missed adding a tgisinternal output column  
to getTriggers' query for pre-8.3 servers.  Back-patch to v11,  
like that commit.  

M src/bin/pg_dump/pg_dump.c

Make pg_dump acquire lock on partitioned tables that are to be dumped.

commit   : e2ff7d9a83d4b489806281dc6dfce88510b40ad7    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 16 Oct 2021 12:23:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 16 Oct 2021 12:23:57 -0400    

Click here for diff

It was clearly the intent to do so all along, but the original coding  
fat-fingered this by checking the wrong array element.  We fixed it  
in passing in 403a3d91c, but that later got reverted, and we forgot  
to keep this bug fix.  
  
Most of the time this'd be relatively harmless, since once we lock  
any of the partitioned table's leaf partitions, that would suffice  
to prevent major DDL on the partitioned table itself.  However, a  
childless partitioned table would get dumped with no relevant lock  
whatsoever, possibly allowing dump failure or inconsistent output.  
  
Unlike 403a3d91c, there are no versioning concerns, since every server  
version that has partitioned tables will allow you to lock one.  
  
Back-patch to v10 where partitioned tables were introduced.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Remove obsolete nbtree deduplication comments.

commit   : b76c1d6e849779e4a5a6c24d159a42125e522154    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 15 Oct 2021 15:25:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 15 Oct 2021 15:25:20 -0700    

Click here for diff

Follow up to commit 2903f140.  

M src/backend/access/nbtree/nbtutils.c

Fix PostgresNode install_path sanity tests that fail on Windows

commit   : 15124d0e22ed2280e4603638e5baede190ae584c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Fri, 15 Oct 2021 12:56:29 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Fri, 15 Oct 2021 12:56:29 -0400    

Click here for diff

Backpatch to 14 where install_path was introduced.  

M src/test/perl/PostgresNode.pm

Remove unstable pg_amcheck tests.

commit   : cd3f429d9565b2e5caf0980ea7c707e37bc3b317    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 14 Oct 2021 14:50:26 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 14 Oct 2021 14:50:26 -0700    

Click here for diff

Recent pg_amcheck bugfix commit d2bf06db added a test case that the  
buildfarm has shown to be non-portable.  It doesn't particularly seem  
worth keeping anyway.  Remove it.  
  
Discussion: https://postgr.es/m/CAH2-Wz=7HKJ9WzAh7+M0JfwJ1yfT9qoE+KPa3P7iGToPOtGhXg@mail.gmail.com  
Backpatch: 14-, just like the original commit.  

D src/bin/pg_amcheck/t/006_bad_targets.pl

shm_mq: Update mq_bytes_written less often.

commit   : 46846433a03dff4f2e08c8a161e54a842da360d6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Oct 2021 16:06:43 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Oct 2021 16:06:43 -0400    

Click here for diff

Do not update shm_mq's mq_bytes_written until we have written  
an amount of data greater than 1/4th of the ring size, unless  
the caller of shm_mq_send(v) requests a flush at the end of  
the message. This reduces the number of calls to SetLatch(),  
and also the number of CPU cache misses, considerably, and thus  
makes shm_mq significantly faster.  
  
Dilip Kumar, reviewed by Zhihong Yu and Tomas Vondra. Some  
minor cosmetic changes by me.  
  
Discussion: http://postgr.es/m/CAFiTN-tVXqn_OG7tHNeSkBbN+iiCZTiQ83uakax43y1sQb2OBA@mail.gmail.com  

M src/backend/executor/tqueue.c
M src/backend/libpq/pqmq.c
M src/backend/storage/ipc/shm_mq.c
M src/include/storage/shm_mq.h
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/worker.c

Check criticalSharedRelcachesBuilt in GetSharedSecurityLabel().

commit   : 7821a0bf2096df659671924fbeef0ebc66449292    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 14 Oct 2021 12:24:00 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 14 Oct 2021 12:24:00 -0700    

Click here for diff

An extension may want to call GetSecurityLabel() on a shared object  
before the shared relcaches are fully initialized. For instance, a  
ClientAuthentication_hook might want to retrieve the security label on  
a role.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/backend/commands/seclabel.c

Fix planner error with pulling up subquery expressions into function RTEs.

commit   : 4d5f651f1d651c6fa79f9188e7b9a04654c7125a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 14 Oct 2021 12:43:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 14 Oct 2021 12:43:43 -0400    

Click here for diff

If a function-in-FROM laterally references the output of some sub-SELECT  
earlier in the FROM clause, and we are able to flatten that sub-SELECT  
into the outer query, the expression(s) copied into the function RTE  
missed being processed by eval_const_expressions.  This'd lead to trouble  
and probable crashes at execution if such expressions contained  
named-argument function call syntax or functions with defaulted arguments.  
The bug is masked if the query contains any explicit JOIN syntax, which  
may help explain why we'd not noticed.  
  
Per bug #17227 from Bernd Dorn.  This is an oversight in commit 7266d0997,  
so back-patch to v13 where that came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/rangefuncs.sql

commit   : 811051c2e7af1b030467760baf7ee0f4a22bc992    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 14 Oct 2021 11:55:50 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 14 Oct 2021 11:55:50 -0400    

Click here for diff

CreateOverwriteContrecordRecord(), UpdateFullPageWrites(),  
PerformRecoveryXLogAction(), and CleanupAfterArchiveRecovery()  
are moved somewhat later in StartupXLOG(). This is preparatory  
work for a future patch that wants to allow recovery to end at one  
time and only later start to allow WAL writes. To do that, it's  
necessary to separate code that has to do with allowing WAL writes  
from other things that need to happen simply because recovery is  
ending, such as initializing shared memory data structures that  
depend on information that might not be accurate before redo is  
complete.  
  
This commit does not achieve that goal, but it is a step in that  
direction.  For example, there are a few different bits of code that  
write things into WAL once we have finished recovery, and with this  
change, those bits of code are closer to each other than previously,  
with fewer unrelated bits of code interspersed.  
  
Robert Haas and Amul Sul  
  
Discussion: http://postgr.es/m/CAAJ_b97abMuq=470Wahun=aS1PHTSbStHtrjjPaD-C0YQ1AqVw@mail.gmail.com  

M src/backend/access/transam/xlog.c

Change recently added test code for stability

commit   : 010e5233733aedf86634e1719d9536c42e18a27d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 13 Oct 2021 18:49:27 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 13 Oct 2021 18:49:27 -0300    

Click here for diff

The test code added with ff9f111bce24 fails under valgrind, and probably  
other slow cases too, because if (say) autovacuum runs in between and  
produces WAL of its own, the large INSERT fails to account for that in  
the LSN calculations.  Rewrite to use a DO loop.  
  
Per complaint from Andres Freund  
  
Backpatch to all branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/026_overwrite_contrecord.pl

pg_amcheck: avoid unhelpful verification attempts.

commit   : d2bf06db377967b0d671ae372d513806e2a28052    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 13 Oct 2021 14:08:12 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 13 Oct 2021 14:08:12 -0700    

Click here for diff

Avoid calling contrib/amcheck functions with relations that are  
unsuitable for checking.  Specifically, don't attempt verification of  
temporary relations, or indexes whose pg_index entry indicates that the  
index is invalid, or not ready.  
  
These relations are not supported by any of the contrib/amcheck  
functions, for reasons that are pretty fundamental.  For example, the  
implementation of REINDEX CONCURRENTLY can add its own "transient"  
pg_index entries, which has rather unclear implications for the B-Tree  
verification functions, at least in the general case -- so they just  
treat it as an error.  It falls to the amcheck caller (in this case  
pg_amcheck) to deal with the situation at a higher level.  
  
pg_amcheck now simply treats these conditions as additional "visibility  
concerns" when it queries system catalogs.  This is a little arbitrary.  
It seems to have the least problems among any of the available  
alternatives.  
  
Author: Mark Dilger <[email protected]>  
Reported-By: Alexander Lakhin <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Bug: #17212  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where pg_amcheck was introduced.  

M doc/src/sgml/ref/pg_amcheck.sgml
M src/bin/pg_amcheck/pg_amcheck.c
A src/bin/pg_amcheck/t/006_bad_targets.pl

Refactor some end-of-recovery code out of StartupXLOG().

commit   : 6df1543abfed6f6a86b76a48fa11a6f019111c01    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 13 Oct 2021 12:16:38 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 13 Oct 2021 12:16:38 -0400    

Click here for diff

Create a new function PerformRecoveryXLogAction() and move the  
code which either writes an end-of-recovery record or requests a  
checkpoint there.  
  
Also create a new function CleanupAfterArchiveRecovery() to  
perform a few tasks that we want to do after we've actually exited  
archive recovery but before we start accepting new WAL writes.  
  
More refactoring of this file is planned, but this commit is  
just straightforward code movement to make StartupXLOG() a  
little bit shorter and a little bit easier to understand.  
  
Robert Haas and Amul Sul  
  
Discussion: http://postgr.es/m/CAAJ_b97abMuq=470Wahun=aS1PHTSbStHtrjjPaD-C0YQ1AqVw@mail.gmail.com  

M src/backend/access/transam/xlog.c

postgres_fdw: Move comments about elog level in (sub)abort cleanup.

commit   : 8c7be8688309dd7f30f313d3b312b31f64e93497    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 13 Oct 2021 19:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 13 Oct 2021 19:00:00 +0900    

Click here for diff

The comments were misplaced when adding postgres_fdw.  Fix that by  
moving the comments to more appropriate functions.  
  
Author: Etsuro Fujita  
Backpatch-through: 9.6  
Discussion: https://postgr.es/m/CAPmGK164sAXQtC46mDFyu6d-T25Mzvh5qaRNkit06VMmecYnOA%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Fix use-after-free with multirange types in CREATE TYPE

commit   : 5b0e7fe1d67235a092be1132bc5c97f1d7f29aaf    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Oct 2021 16:38:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Oct 2021 16:38:07 +0900    

Click here for diff

The code was freeing the name of the multirange type function stored in  
the parse tree but it should not do that.  Event triggers could for  
example look at such a corrupted parsed tree with a ddl_command_end  
event.  
  
Author: Alex Kozhemyakin, Sergey Shinderuk  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/commands/typecmds.c

Fix incorrect format placeholder

commit   : 780054bf31a0a6ba781f46c454f0116efee8a74c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 13 Oct 2021 08:20:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 13 Oct 2021 08:20:59 +0200    

Click here for diff

M src/bin/pgbench/pgbench.c

Fix tests of pg_upgrade across different major versions

commit   : fa66b6dee0843d2bca5bf9c9b8b7be32defbffae    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 13 Oct 2021 09:22:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 13 Oct 2021 09:22:00 +0900    

Click here for diff

This fixes a set of issues that cause different breakages or annoyances  
when using pg_upgrade's test.sh to do upgrades across different major  
versions:  
- test.sh is completely broken when using v14 as new version because of  
the removal of testtablespace/ as Makefile rule.  Older versions of  
pg_regress don't support --make-tablespacedir, blocking the creation of  
the tablespace.  In order to fix that, it is simple enough to create  
those directories in the script itself, but only do that when an old  
version is involved.  This fix is needed on HEAD and REL_14_STABLE.  
- The script would fail when using PG <= v11 as old version because of  
WITH OIDS relations not supported in v12.  In order to fix this, this  
steals a method from the buildfarm that uses a DO block to change all  
the relations marked as WITH OIDS, allowing pg_upgrade to pass.  This is  
more portable than using ALTER TABLE queries on the relations causing  
issues.  This is fixed down to v12, and authored originally by Andrew  
Dunstan.  
- Not using --extra-float-digits=0 with v11 as old version causes  
a lot of diffs in the dumps, making the whole unreadable.  This gets  
only done when using v11 as old version.  This is fixed down to v12.  
The buildfarm code uses that already.  
  
Note that the addition of --wal-segsize and --allow-group-access breaks  
the script when using v10 or older at initdb time as these got added in  
11.  10 would be EOL'd next year and nobody has complained about those  
problems yet, so nothing is done about that.  This means that this  
commit fixes upgrade tests using test.sh with v11 as minimum older  
version, up to HEAD, and that it is enough to apply this change down to  
12.  The old and new dumps still generate diffs, still require manual  
checks, and more could be done to reduce the noise, but this allows the  
tests to run with a rather minimal amount of them.  
  
I have tested this commit and test.sh with v11 as minimum across all the  
branches where this is applied.  Note that this commit has no impact on  
the normal pg_upgrade test run with a simple "make check".  
  
Author:  Justin Pryzby, Andrew Dunstan, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/bin/pg_upgrade/test.sh

psql: Fix some scan-build warnings

commit   : 390edeeb570c01de1a14e2985ffed96de001e42e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 21:14:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 21:14:50 +0200    

Click here for diff

A repeated complaint was that scan-build thought that if the \timing  
setting changes during processing of a query, the post-processing  
might read garbage time values.  This is probably not possible right  
now, but it's not entirely inconceivable given the code structure.  So  
silence this warning with small restructuring that makes this more  
robust.  The other warnings were a few dead stores that are easy to  
remove.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/describe.c

Doc: normalize vacuum_multixact_failsafe_age ID.

commit   : 00c61a74bcdbc04a3db721d53c7aff62244da198    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 12 Oct 2021 10:59:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 12 Oct 2021 10:59:24 -0700    

Click here for diff

Author: Pavel Luzanov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where the failsafe was introduced.  

M doc/src/sgml/config.sgml

Refactor basebackup.c's _tarWriteDir() function.

commit   : 967a17fe2fa77b61061c8fb1183f64a5df4e080a    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 12 Oct 2021 13:11:29 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 12 Oct 2021 13:11:29 -0400    

Click here for diff

Sometimes, we replace a symbolic link that we find in the data  
directory with an actual directory within the tarfile that we  
create. _tarWriteDir was responsible both for making this  
substitution and also for writing the tar header for the  
resulting directory into the tar file. Make it do only the first  
of those things, and rename to convert_link_to_directory.  
  
Substantially larger refactoring of this source file is planned,  
but this little bit seemed to make sense to commit  
independently.  
  
Discussion: http://postgr.es/m/CA+Tgmobz6tuv5tr-WxURe5JA1vVcGz85k4kkvoWxcyHvDpEqFA@mail.gmail.com  

M src/backend/replication/basebackup.c

psql: Fix test

commit   : d9ddc50bafc062ec1ae7f98b886b7950102d87fc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 18:22:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 18:22:15 +0200    

Click here for diff

The test didn't work on platforms where getopt() doesn't support  
non-option arguments before options.  

M src/bin/psql/t/001_basic.pl

psql: Add test for handling of replication commands

commit   : 67c069848a998de1436cad2d67baedbf31c3a28c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 15:33:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 15:33:36 +0200    

Click here for diff

Add a test for the clean handling of unsupported replication command  
responses.  This was once accidentally broken, and it seems unusual  
enough that it's easy to forget when testing manually.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/t/001_basic.pl

psql: More tests

commit   : c0280bc3edeb9e9958efc14083b6f301d2ef79d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 09:45:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 12 Oct 2021 09:45:57 +0200    

Click here for diff

Add some basic tests for command-line option handling and help output,  
similar to what we have for other command-line programs.  This also  
creates a place to put some more one-off test cases later.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

A src/bin/psql/t/001_basic.pl

Add more $Test::Builder::Level in the TAP tests

commit   : f9c4cb686800d46ef9e9e90ed5133493b23962af    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 12 Oct 2021 11:15:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 12 Oct 2021 11:15:44 +0900    

Click here for diff

Incrementing the level of the call stack reported is useful for  
debugging purposes as it allows to control which part of the test is  
exactly failing, especially if a test is structured with subroutines  
that call routines from Test::More.  
  
This adds more incrementations of $Test::Builder::Level where debugging  
gets improved (for example it does not make sense for some paths like  
pg_rewind where long subroutines are used).  
  
A note is added to src/test/perl/README about that, based on a  
suggestion from Andrew Dunstan and a wording coming from both of us.  
  
Usage of Test::Builder::Level has spread in 12, so a backpatch down to  
this version is done.  
  
Reviewed-by: Andrew Dunstan, Peter Eisentraut, Daniel Gustafsson  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/test_decoding/t/001_repl_stats.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/psql/t/010_tab_completion.pl
M src/test/kerberos/t/001_auth.pl
M src/test/perl/README
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/018_wal_optimize.pl

Make autovacuum launcher more responsive to pg_log_backend_memory_contexts().

commit   : e3e29cec10d15bbcedc6b41887d8f4e138d719bd    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 12 Oct 2021 09:50:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 12 Oct 2021 09:50:17 +0900    

Click here for diff

Previously when pg_log_backend_memory_contexts() sent the request to  
the autovacuum launcher, it could take more than several seconds to  
log its memory contexts. Because the function (HandleAutoVacLauncherInterrupts)  
to process any new interrupts that autovacuum launcher received  
didn't handle the request for logging of memory contexts. This commit changes  
the function so that it handles the request, to make autovacuum launcher  
more responsitve to pg_log_backend_memory_contexts().  
  
Back-patch to v14 where pg_log_backend_memory_contexts() was added.  
  
Author: Koyu Tanigawa  
Reviewed-by: Bharath Rupireddy, Atsushi Torikoshi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/autovacuum.c

amcheck: Skip unlogged relations in Hot Standby.

commit   : 292698f158ddb3f9a88f536e6eecb9e55d9619c9    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 11 Oct 2021 17:21:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 11 Oct 2021 17:21:48 -0700    

Click here for diff

Have verify_heapam.c treat unlogged relations as if they were simply  
empty when in Hot Standby mode.  This brings it in line with  
verify_nbtree.c, which has handled unlogged relations in the same way  
since bugfix commit 6754fe65a4.  This was an oversight in commit  
866e24d47d, which extended contrib/amcheck to check heap relations.  
  
In passing, lower the verbosity used when reporting that a relation has  
been skipped like this, from NOTICE to DEBUG1.  This is appropriate  
because the skipping behavior is only an implementation detail, needed  
to work around the fact that unlogged tables don't have smgr-level  
storage for their main fork when in Hot Standby mode.  
  
Affected unlogged relations should be considered "trivially verified",  
not skipped over.  They are verified in the same sense that a totally  
empty relation can be verified.  This behavior seems least surprising  
overall, since unlogged relations on a replica will initially be empty  
if and when the replica is promoted and Hot Standby ends.  
  
Author: Mark Dilger <[email protected]>  
Reviewed-By: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk_pukOFY7JmdiFLsrz+Pd3V8OwgC1TH2Vd5BH5ZgK4bA@mail.gmail.com  
Backpatch: 14-, where heapam verification was introduced.  

M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c

Make configure check for minimum required version of IPC::Run.

commit   : 4a235efddaa78ec78a47614ddc6161644e089290    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Oct 2021 16:49:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Oct 2021 16:49:49 -0400    

Click here for diff

Per the discussion around 3eb1f4d09, let's have configure verify that  
the available IPC::Run version is at least 0.79, the agreed-on minimum.  
It seems unlikely that this could bite anybody anymore, but it's useful  
as documentation.  (Based on that, there's little need to back-patch.)  
  
For consistency, also supply a minimum version for the other Perl  
module we have an explicit check for, Time::HiRes.  I used the  
version that ships with Perl 5.8.3.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Fix EXPLAIN of SEARCH BREADTH FIRST queries some more.

commit   : 39ae0ef8561362304ee512963aa51d5a705e5616    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 11 Oct 2021 11:56:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 11 Oct 2021 11:56:52 -0400    

Click here for diff

Commit 3f50b8263 had an oversight: formerly, to deparse expressions  
attached to a plan node, it was only necessary to update the  
deparse_namespace ancestors list alongside calling set_deparse_plan.  
Now it's necessary to update the ancestors list *first*, because  
set_deparse_plan consults it, and one call site got that wrong.  
  
This error was masked in most cases because explain.c uses just one  
List object for the ancestors list, updating it in-place as the plan  
is scanned, so that we accidentally had the right List assigned to  
dpns->ancestors before it was needed.  It would fail only if a  
WorkTableScan node were the first one that we tried to deparse a  
subexpression of.  
  
Per report from Markus Winand.  Like the previous patch,  
back-patch to v14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c

Clean up more code using "(expr) ? true : false"

commit   : 68f7c4b57a27dbcd3e93ba3ff7b0b49664b25e09    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 11 Oct 2021 09:36:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 11 Oct 2021 09:36:42 +0900    

Click here for diff

This is similar to fd0625c, taking care of any remaining code paths that  
are worth the cleanup.  This also changes some cases using opposite  
expression patterns.  
  
Author: Justin Pryzby, Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoCdF8dnUvr-BUWWGvA_XhKSoANacBMZb6jKyCk4TYfQ2Q@mail.gmail.com  

M contrib/ltree/ltree_op.c
M src/backend/access/gist/gistsplit.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeResult.c
M src/backend/statistics/mcv.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser_def.c

Doc: update testing recipe in src/test/perl/README.

commit   : 3eb1f4d09745433c70ccac411cad24d0374b9c3b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 10 Oct 2021 17:55:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 10 Oct 2021 17:55:36 -0400    

Click here for diff

The previous text didn't provide any clear explanation of our policy  
around TAP test portability.  The recipe for using perlbrew had some  
problems, too: it resulted in a non-shared libperl (preventing  
testing of plperl) and it caused some modules to be updated to  
current when the point of the recipe is to build an old environment.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/README

Doc: improve documentation for ^@ starts-with operator.

commit   : 2ae5d72f004f599c351ee31e8da5fb3e40303760    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 9 Oct 2021 14:42:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 9 Oct 2021 14:42:52 -0400    

Click here for diff

This operator wasn't formally documented anywhere.  To give it  
a natural home, relabel the functions-string-other table as  
"Other String Functions and Operators", which is more parallel  
to the functions-string-sql table anyway.  
  
While here, add cross-references to the pattern match and text  
search sections.  It seems moderately likely that people would  
come to this section looking for those (but I don't want to  
actually list them in these tables).  
  
Discussion: https://postgr.es/m/CADT4RqB13KQHOJqqQ+WXmYtJrukS2UiFdtfTvT-XA3qYLyB6Cw@mail.gmail.com  

M doc/src/sgml/func.sgml

Refactor fallback to stderr for csvlog to handle better WIN32 service case

commit   : 8b76f89c37973082b3d64f5a27937efcca9d65f6    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 8 Oct 2021 11:08:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 8 Oct 2021 11:08:35 +0900    

Click here for diff

send_message_to_server_log() would force a redirection of a log entry to  
stderr in some cases for csvlog, like the syslogger not being available  
yet.  If this happens, csvlog would fall back to stderr to log  
some information rather than nothing.  The code was organized so as  
stderr is done before csvlog, with csvlog checking that stderr did not  
happen yet with a reversed condition.  With this code organization, it  
could be possible to lose some messages if running Postgres as a service  
on WIN32, as there is no usable stderr, and the handling of the  
StringInfoData holding the message for stderr was rather confusing  
because of that.  
  
This commit moves the csvlog handling to be before stderr, as as we are  
able to track down if it is necessary to log something to stderr.  The  
reduces the handling of stderr to be in a single code path, adding a  
fallback to event logs for a WIN32 service.  This also simplifies the  
way we handle the StringInfoData for stderr, making easier the  
integration of new file-based log destinations.  I got to play with  
services and event logs on Windows while checking this change.  
  
Reviewed-by: Chris Bandy  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/error/elog.c

commit   : 08e2daf06c71881415ebd19105a8fe53f6eb2f8f    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 15:36:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 15:36:57 -0400    

Click here for diff

We currently have buildfarm members testing back to AIX 7.1,  
but not before, and older AIX versions are long out of support  
from IBM.  So say that 7.1 is the oldest supported version.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Update test/perl/README to insist on Perl version >= 5.8.3, too.

commit   : 93fb39eca643a33dd6e3c8818fc7899aa67a8103    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 14:42:45 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 14:42:45 -0400    

Click here for diff

Oversight in previous commit, noted by Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/README

Adjust configure to insist on Perl version >= 5.8.3.

commit   : 92e6a98c3636948e7ece9a3260f9d89dd60da278    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 14:26:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 14:26:17 -0400    

Click here for diff

Previously it only checked for version >= 5.8.0, although the  
documentation has said that the minimum version is 5.8.3 since  
commit dea6ba939.  Per the discussion leading up to that commit,  
I (tgl) left it that way intentionally because you could, at the  
time, do some bare-bones stuff with 5.8.0.  But we aren't actually  
testing against anything older than 5.8.3, so who knows if that's  
still true.  It's pretty unlikely that anyone would care anyway,  
so let's just make configure's version check match the docs.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M config/perl.m4
M configure

plperl: update ppport.h to Perl 5.34.0.

commit   : 05798c9f7f08908bdd06c82d934da67535b72005    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 13:59:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 7 Oct 2021 13:59:43 -0400    

Click here for diff

Also apply the changes suggested by running  
    perl ppport.h --compat-version=5.8.0  
  
And remove some no-longer-required NEED_foo declarations.  
  
Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
M src/pl/plperl/ppport.h

postgres_fdw: Fix comments in connection.c.

commit   : 972c7c6567fbb02a59b94ede80b17805de1bc03c    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 7 Oct 2021 18:15:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 7 Oct 2021 18:15:00 +0900    

Click here for diff

Commit 27e1f1456 missed updating some comments.  
  
Reviewed-by: Bharath Rupireddy  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CAPmGK15Q2Nm6U%2Ba_GwskrWFEVBZ9_3VKOvRrprGufpx91M_3Sw%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Add missing word to comment in joinrels.c.

commit   : 700c73312841bd1a89263f238556ce8d8d916258    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 7 Oct 2021 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 7 Oct 2021 17:45:00 +0900    

Click here for diff

Author: Amit Langote  
Backpatch-through: 13  
Discussion: https://postgr.es/m/CA%2BHiwqGQNbtamQ_9DU3osR1XiWR4wxWFZurPmN6zgbdSZDeWmw%40mail.gmail.com  

M src/backend/optimizer/path/joinrels.c

Fix compilation warning in syslogger.c

commit   : 05c4248ad1bf0c2721ce9445f6908da9ece36ff8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Oct 2021 16:24:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Oct 2021 16:24:26 +0900    

Click here for diff

Oversight in 5c6e33f.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/syslogger.c

Improve order in file

commit   : d942887039a608c91084a942fe10571c6f6be35a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 7 Oct 2021 08:20:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 7 Oct 2021 08:20:55 +0200    

Click here for diff

Move support functions for new PublicationTable node to more sensible  
locations in the files.  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

Refactor per-destination file rotation in logging collector

commit   : 5c6e33f071537d9831db57471a06d39a175b535a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 7 Oct 2021 10:12:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 7 Oct 2021 10:12:45 +0900    

Click here for diff

stderr and csvlog have been using duplicated code when it came to the  
rotation of their file by size, age or if forced by a user request  
(pg_ctl logrotate or the SQL function pg_rotate_logfile).  The main  
difference between both is that stderr requires its file to always be  
opened, so as it is possible to have a redirection route if the logging  
collector is not ready yet to do its work if alternate destinations are  
enabled.  
  
Also, if csvlog gets disabled, we need to close properly its meta-data  
stored in the logging collector (last file name for current_logfiles and  
fd currently open for business).  Except for those points, the code is  
the same in terms of error handling and if a file should be created or  
just continued.  
  
This change makes the code simpler overall, and it will help in the  
introduction of more file-based log destinations.  This refactoring is  
similar to the work done in 5b0b699.  Most of the duplication originates  
from fd801f4.  
  
Some of the TAP tests of pg_ctl check the case of a forced log rotation,  
but this is somewhat limited as there is no coverage for  
log_rotation_age or log_rotation_size (these may not be worth the extra  
resources to run either), and no coverage for reload of log_destination  
with different combinations of stderr and csvlog.  I have tested all  
those cases separately for this refactoring.  
  
Author: Michael Paquier  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M src/backend/postmaster/syslogger.c

Fix null-pointer crash in postgres_fdw's conversion_error_callback.

commit   : 3071bbfe44f36019710190a9273ad2bd4a947878    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Oct 2021 15:50:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Oct 2021 15:50:24 -0400    

Click here for diff

Commit c7b7311f6 adjusted conversion_error_callback to always use  
information from the query's rangetable, to avoid doing catalog lookups  
in an already-failed transaction.  However, as a result of the utterly  
inadequate documentation for make_tuple_from_result_row, I failed to  
realize that fsstate could be NULL in some contexts.  That led to a  
crash if we got a conversion error in such a context.  Fix by falling  
back to the previous coding when fsstate is NULL.  Improve the  
commentary, too.  
  
Per report from Andrey Borodin.  Back-patch to 9.6, like the previous  
patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Doc: improve timezone/README's recipe for tracking Windows zones.

commit   : db692b0c84908b4ef5ea4c15fa2d742582ad2cf9    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 6 Oct 2021 13:38:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 6 Oct 2021 13:38:42 -0400    

Click here for diff

We should now cite CLDR as primary reference for the zone name  
mapping.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/timezone/README

Fix corner-case loss of precision in numeric_power().

commit   : e54a758d24dab056bb7f50d26c57a3c8761cc44a    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 6 Oct 2021 13:16:51 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 6 Oct 2021 13:16:51 +0100    

Click here for diff

This fixes a loss of precision that occurs when the first input is  
very close to 1, so that its logarithm is very small.  
  
Formerly, during the initial low-precision calculation to estimate the  
result weight, the logarithm was computed to a local rscale that was  
capped to NUMERIC_MAX_DISPLAY_SCALE (1000). However, the base may be  
as close as 1e-16383 to 1, hence its logarithm may be as small as  
1e-16383, and so the local rscale needs to be allowed to exceed 16383,  
otherwise all precision is lost, leading to a poor choice of rscale  
for the full-precision calculation.  
  
Fix this by removing the cap on the local rscale during the initial  
low-precision calculation, as we already do in the full-precision  
calculation. This doesn't change the fact that the initial calculation  
is a low-precision approximation, computing the logarithm to around 8  
significant digits, which is very fast, especially when the base is  
very close to 1.  
  
Patch by me, reviewed by Alvaro Herrera.  
  
Discussion: https://postgr.es/m/CAEZATCV-Ceu%2BHpRMf416yUe4KKFv%3DtdgXQAe5-7S9tD%3D5E-T1g%40mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Fix loop variable signedness

commit   : ba216d3b54ac334729c505ec8a725db3826290a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 6 Oct 2021 07:22:47 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 6 Oct 2021 07:22:47 +0200    

Click here for diff

M src/test/modules/worker_spi/worker_spi.c

Fix warning in TAP test of pg_verifybackup

commit   : ec2133a447318ac6d78887e91940d69e6d92a435    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 6 Oct 2021 13:28:23 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 6 Oct 2021 13:28:23 +0900    

Click here for diff

Oversight in a3fcbcd.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKGKnajZEwe91OTjro9kQLCMGGFHh2vvFn8tgHgbyn4bF9w@mail.gmail.com  
Backpatch-through: 13  

M src/bin/pg_verifybackup/t/007_wal.pl

Flexible options for CREATE_REPLICATION_SLOT.

commit   : 0266e98c6b865246c3031bbf55cb15f330134e30    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Oct 2021 12:52:49 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Oct 2021 12:52:49 -0400    

Click here for diff

Like BASE_BACKUP, CREATE_REPLICATION_SLOT has historically used a  
hard-coded syntax.  To improve future extensibility, adopt a flexible  
options syntax here, too.  
  
In the new syntax, instead of three mutually exclusive options  
EXPORT_SNAPSHOT, USE_SNAPSHOT, and NOEXPORT_SNAPSHOT, there is now a single  
SNAPSHOT option with three possible values: 'export', 'use', and 'nothing'.  
  
This commit does not remove support for the old syntax. It just adds  
the new one as an additional option, makes pg_receivewal,  
pg_recvlogical, and walreceiver processes use it.  
  
Patch by me, reviewed by Fabien Coelho, Sergei Kornilov, and  
Fujii Masao.  
  
Discussion: http://postgr.es/m/CA+TgmobAczXDRO_Gr2euo_TxgzaH1JxbNxvFx=HYvBinefNH8Q@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZGwR=ZVWFeecncubEyPdwghnvfkkdBe9BLccLSiqdf9Q@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/repl_gram.y
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/streamutil.c

Flexible options for BASE_BACKUP.

commit   : 0ba281cb4bf9f5f65529dfa4c8282abb734dd454    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 5 Oct 2021 11:50:21 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 5 Oct 2021 11:50:21 -0400    

Click here for diff

Previously, BASE_BACKUP used an entirely hard-coded syntax, but that's  
hard to extend. Instead, adopt the same kind of syntax we've used for  
SQL commands such as VACUUM, ANALYZE, COPY, and EXPLAIN, where it's  
not necessary for all of the option names to be parser keywords.  
  
In the new syntax, most of the options now take an optional Boolean  
argument. To match our practice in other in places, the options which  
the old syntax called NOWAIT and NOVERIFY_CHECKSUMS options are in the  
new syntax called WAIT and VERIFY_CHECKUMS, and the default value is  
false. In the new syntax, the FAST option has been replaced by a  
CHECKSUM option whose value may be 'fast' or 'spread'.  
  
This commit does not remove support for the old syntax. It just adds  
the new one as an additional option, and makes pg_basebackup prefer  
the new syntax when the server is new enough to support it.  
  
Patch by me, reviewed and tested by Fabien Coelho, Sergei Kornilov,  
Fujii Masao, and Tushar Ahuja.  
  
Discussion: http://postgr.es/m/CA+TgmobAczXDRO_Gr2euo_TxgzaH1JxbNxvFx=HYvBinefNH8Q@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoZGwR=ZVWFeecncubEyPdwghnvfkkdBe9BLccLSiqdf9Q@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/basebackup.c
M src/backend/replication/repl_gram.y
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

Make recovery report error message when invalid page header is found.

commit   : 68601985e699adeb267636fd19d3d6113554bd1f    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 6 Oct 2021 00:16:03 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 6 Oct 2021 00:16:03 +0900    

Click here for diff

Commit 0668719801 changed XLogPageRead() so that it validated the page  
header, if invalid page header was found reset the error message and  
retried reading the page, to fix the scenario where streaming standby  
got stuck at a continuation record. This change hid the error message  
about invalid page header, which would make it harder for users to  
investigate what the actual issue was found in WAL.  
  
To fix the issue, this commit makes XLogPageRead() report the error  
message when invalid page header is found.  
  
When not in standby mode, an invalid page header should cause recovery  
to end, not retry reading the page, so XLogPageRead() doesn't need to  
validate the page header for the retry. Instead, ReadPageInternal() should  
be responsible for the validation in that case. Therefore this commit  
changes XLogPageRead() so that if not in standby mode it doesn't validate  
the page header for the retry.  
  
Reported-by: Yugo Nagata  
Author: Yugo Nagata, Kyotaro Horiguchi  
Reviewed-by: Ranier Vilela, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Doc: improve description of UNION/INTERSECT/EXCEPT syntax.

commit   : f3fec23dbdead113700fb1b401b681fa24f1e4f4    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 5 Oct 2021 10:24:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 5 Oct 2021 10:24:14 -0400    

Click here for diff

queries.sgml failed to mention the rather important point that  
INTERSECT binds more tightly than UNION or EXCEPT.  I thought  
it could also use more discussion of the role of parentheses  
in these constructs.  
  
Per gripe from Christopher Painter-Wakefield.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/queries.sgml

doc: Document pg_encoding_to_char() and pg_char_to_encoding().

commit   : f6b5d05ba9a4ac7c5ebec76045c6e0afcf7c9eec    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 5 Oct 2021 12:52:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 5 Oct 2021 12:52:51 +0900    

Click here for diff

Previously both functions were not described anywhere in the docs.  
But since they have been around since 7.0 and mentioned in the description  
for system catalog like pg_database, it's reasonable to add short  
descriptions for them.  
  
Author: Ian Lawrence Barwick  
Reviewed-by: Laurenz Albe, Fujii Masao  
Discussion: https://postgr.es/m/CAB8KJ=infievn4q1N4X7Vx8w4_RMPPG0pLvxhSDjy5WQOSHW9g@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml

Remove obsolete comment in snapbuild.c.

commit   : 826584fa5284341c601f3c49804dfa9c02295554    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 5 Oct 2021 09:05:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 5 Oct 2021 09:05:40 +0530    

Click here for diff

Commits 955a684e04 and a975ff4980 removed the usage of running xacts  
information from serialized snapshots but forgot to remove the  
corresponding comment.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBifOr7RS=jRe7YCavc646y9omChv6zkWXvJeZcjS9mXA@mail.gmail.com  

M src/backend/replication/logical/snapbuild.c

psql: Improve tab-completion for LOCK TABLE.

commit   : 0b0d277c35533baecc8d1a9356f71de5f2ee0bd8    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 5 Oct 2021 10:10:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 5 Oct 2021 10:10:43 +0900    

Click here for diff

This commit makes psql support the tab-completion for ONLY and  
NOWAIT keywords of LOCK TABLE command.  
  
Author: Koyu Tanigawa  
Reviewed-by: Shinya Kato, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

doc: remove URL for ICU explorer/locexp

commit   : e8259439066c5fa4f3266f30434d5a52b8347bd1    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 4 Oct 2021 17:10:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 4 Oct 2021 17:10:59 -0400    

Click here for diff

The old URL was HTTP 404 and the git link didn't build.  Also update two  
other ICU links.  If we ever get a good link we will add it back.  
  
Reported-by: Anton Voloshin  
  
Author: Laurenz Albe  
  
Backpatch-through: 10  

M doc/src/sgml/charset.sgml

Fix TestLib::slurp_file() with offset on windows.

commit   : 2f74db1236fe83e6665e5b0ddad4454c69495614    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 4 Oct 2021 13:28:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 4 Oct 2021 13:28:06 -0700    

Click here for diff

3c5b0685b921 used setFilePointer() to set the position of the filehandle, but  
passed the wrong filehandle, always leaving the position at 0. Instead of just  
fixing that, remove use of setFilePointer(), we have a perl fd at this point,  
so we can just use perl's seek().  
  
Additionally, the perl filehandle wasn't closed, just the windows filehandle.  
  
Reviewed-By: Andrew Dunstan <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 9.6-, like 3c5b0685b921  

M src/test/perl/TestLib.pm

windows: Define WIN32_LEAN_AND_MEAN to make compilation faster.

commit   : 8162464a25e5314e753c580389f76a9b7f69445b    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 1 Oct 2021 09:50:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 1 Oct 2021 09:50:45 -0700    

Click here for diff

windows.h includes a lot of other headers, slowing down compilation  
significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to  
remove the include of windows.h (as well as indirect inclusions of it) from such  
a central place, but until then...  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/win32_port.h

Fix check for trapping exit() calls in libpq

commit   : de744e9efbc55288572d1e81168c74ea85a4b90a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 21:04:11 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 21:04:11 +0200    

Click here for diff

Commit e9bc0441f added an errorhint on the exit() check for libpq, but  
accidentally changed the nm commandline to use -a instead of -A. These  
options are similar enough to hide it in testing, but -a can also show  
debugger symbols which isn't what we want. Fix by reverting the check  
back to using -A again.  
  
Reported-by: Anton Voloshin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

Update our mapping of Windows time zone names some more.

commit   : c1aa3b3c0d2125cb04df8ed0387448d8aeb9519c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Oct 2021 14:52:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Oct 2021 14:52:16 -0400    

Click here for diff

Per discussion, let's just follow CLDR's default zone mappings  
faithfully.  There are two changes here that are clear improvements:  
  
* Mapping "Greenwich Standard Time" to Atlantic/Reykjavik is actually  
a better fit than using London, because Iceland hasn't observed DST  
since 1968, so this is more nearly what people might expect.  
  
* Since the "Samoa" zone is specified to be UTC+13:00, we must map  
it to Pacific/Apia not Pacific/Samoa; the latter refers to American  
Samoa which is now on the other side of the date line.  
  
The rest of these changes look like they're choosing the most populous  
IANA zone as representative.  Whatever the details, we're just going  
to say "if you don't like this mapping, complain to CLDR".  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c

Make Unicode makefile parallel-safe

commit   : e752727195798c324e769cfebf9dc4baa1c6bb0c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Oct 2021 20:26:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Oct 2021 20:26:48 +0200    

Click here for diff

Fix the rules so that each rule is parallel safe, using the same  
trickery that we use elsewhere in the tree for rules that produce more  
than one output file.  Refactor the whole makefile so that there is  
less repetition.  
  
Discussion: https://www.postgresql.org/message-id/18e34084-aab1-1b4c-edd1-c4f9fb04f714%40enterprisedb.com  

M src/backend/utils/mb/Unicode/Makefile

Doc: fix minor issues in GiST support function documentation.

commit   : 36d1a848a86afd2855215af2a112b9bde999354a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 4 Oct 2021 13:34:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 4 Oct 2021 13:34:31 -0400    

Click here for diff

gist.sgml and xindex.sgml hadn't been fully updated for the  
addition of a sortsupport support function (commit 16fa9b2b3).  
xindex.sgml also missed that the compress and decompress support  
functions are optional, an apparently far older oversight.  
  
In passing, fix gratuitous inconsistencies in wording and  
capitalization.  
  
Noted by E. Rogov.  Back-patch to v14; the residual issues  
before that aren't significant enough to bother with.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/gist.sgml
M doc/src/sgml/xindex.sgml

Fix duplicate words in comments

commit   : 7111e332c57ddb562d0ce26a4e08761a0baafb65    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 15:12:57 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 15:12:57 +0200    

Click here for diff

Remove accidentally duplicated words in code comments.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c
M src/backend/catalog/heap.c
M src/backend/commands/copyfromparse.c
M src/backend/partitioning/partdesc.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/include/access/tableam.h

Provide error hint on exit() check when building libpq

commit   : e9bc0441f1446f6614fa6712841acec91890e089    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 14:32:21 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 14:32:21 +0200    

Click here for diff

Commit dc227eb82 introduced a restriction on libpq that no functions which  
invoke exit() are allowed to be called. This was further refined and fixed  
in e45b0dfa1f and 2f7bae2f92 and 792259591. While this is well documented  
in the Makefile, the error message emitted when the check failed was terse,  
without hints for new developers without prior context. This adds an error  
hint to assist new developers onboarding to postgres.  
  
Author: Rachel Heaton <[email protected]>  
Co-authored-by: Jacob Champion <[email protected]>  
Discussion: https://postgr.es/m/CADJcwiVL20955HCNzDqz9BEDr6A77pz6-nac5sbZVvhAEMijLg@mail.gmail.com  

M src/interfaces/libpq/Makefile

Update Unicode map text files

commit   : ce27c8953e8e48c69c690c0e5795cde40ed59fd2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 4 Oct 2021 13:00:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 4 Oct 2021 13:00:59 +0200    

Click here for diff

A couple of newer ones are available.  There are no functional  
differences, but let's get them in anyway, so that there is no  
surprise diff next time someone wants to do some actual work in this  
area.  

M src/backend/utils/mb/Unicode/euc-jis-2004-std.txt
M src/backend/utils/mb/Unicode/sjis-0213-2004-std.txt

Provide error hint if TAP tests are not enabled

commit   : b5cb4db91327c2cef66207bde9cbcb592b91f93c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 11:46:29 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 11:46:29 +0200    

Click here for diff

The error message for trying to run the TAP tests in a tree not  
configured with --enable-tap-tests is quite terse, and could be  
made more helpful to new developers onboarding to postgres. This  
adds a small hint on how to get the tests running in such cases.  
  
Author: Kevin Burke <[email protected]>  
Discussion: https://postgr.es/m/CAKcy5ejKVYwUXguQcd6i9KHDm7cM7FzjQ+aayaPveoa_woyQpQ@mail.gmail.com  

M src/Makefile.global.in

Replace occurrences of InvalidXid with InvalidTransactionId

commit   : 941921b875c7710e2b070c02c7819f2510808fdd    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 10:31:01 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 4 Oct 2021 10:31:01 +0200    

Click here for diff

While Xid is a known shortening of TransactionId, InvalidXid is not  
defined in the code. Fix comments which mistakenly were using the  
shorter version.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACUQzdigML868nV4cojfELPkEzNLNOk7b91Pho4JB90fng@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/utils/time/snapmgr.c

Fix snapshot builds during promotion of hot standby node with 2PC

commit   : 8a4237908c0fe73dd41d4d7c7a6314f17dfd7a6f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 4 Oct 2021 14:05:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 4 Oct 2021 14:05:20 +0900    

Click here for diff

Some specific logic is done at the end of recovery when involving 2PC  
transactions:  
1) Call RecoverPreparedTransactions(), to recover the state of 2PC  
transactions into memory (re-acquire locks, etc.).  
2) ShutdownRecoveryTransactionEnvironment(), to move back to normal  
operations, mainly cleaning up recovery locks and KnownAssignedXids  
(including any 2PC transaction tracked previously).  
3) Switch XLogCtl->SharedRecoveryState to RECOVERY_STATE_DONE, which is  
the tipping point for any process calling RecoveryInProgress() to check  
if the cluster is still in recovery or not.  
  
Any snapshot taken between steps 2) and 3) would be empty, causing any  
transaction relying on a snapshot at this point to potentially corrupt  
data as there could still be some 2PC transactions to track, with  
RecentXmin moving backwards on successive calls to GetSnapshotData() in  
the same transaction.  
  
As SharedRecoveryState is the point to take into account to know if it  
is safe to discard KnownAssignedXids, this commit moves step 2) after  
step 3), so as we can never finish with empty snapshots.  
  
This exists since the introduction of hot standby, so backpatch all the  
way down.  The window with incorrect snapshots is extremely small, but I  
have seen it when running 023_pitr_prepared_xact.pl, as did buildfarm  
member fairywren.  Thomas Munro also found it independently.  Special  
thanks to Andres Freund for taking the time to analyze this issue.  
  
Reported-by: Thomas Munro, Michael Paquier  
Analyzed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/backend/access/transam/xlog.c

Fix checking of query type in plpgsql's RETURN QUERY command.

commit   : a0558cfa395b47adb245972f5eba7978461e7baa    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 3 Oct 2021 13:21:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 3 Oct 2021 13:21:20 -0400    

Click here for diff

Prior to v14, we insisted that the query in RETURN QUERY be of a type  
that returns tuples.  (For instance, INSERT RETURNING was allowed,  
but not plain INSERT.)  That happened indirectly because we opened a  
cursor for the query, so spi.c checked SPI_is_cursor_plan().  As a  
consequence, the error message wasn't terribly on-point, but at least  
it was there.  
  
Commit 2f48ede08 lost this detail.  Instead, plain RETURN QUERY  
insisted that the query be a SELECT (by checking for SPI_OK_SELECT)  
while RETURN QUERY EXECUTE failed to check the query type at all.  
Neither of these changes was intended.  
  
The only convenient place to check this in the EXECUTE case is inside  
_SPI_execute_plan, because we haven't done parse analysis until then.  
So we need to pass down a flag saying whether to enforce that the  
query returns tuples.  Fortunately, we can squeeze another boolean  
into struct SPIExecuteOptions without an ABI break, since there's  
padding space there.  (It's unlikely that any extensions would  
already be using this new struct, but preserving ABI in v14 seems  
like a smart idea anyway.)  
  
Within spi.c, it seemed like _SPI_execute_plan's parameter list  
was already ridiculously long, and I didn't want to make it longer.  
So I thought of passing SPIExecuteOptions down as-is, allowing that  
parameter list to become much shorter.  This makes the patch a bit  
more invasive than it might otherwise be, but it's all internal to  
spi.c, so that seems fine.  
  
Per report from Marc Bachmann.  Back-patch to v14 where the  
faulty code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/include/executor/spi.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Enable deduplication in system catalog indexes.

commit   : 2903f1404df37e11ecc303dbc164826c4717194b    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 2 Oct 2021 17:12:59 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 2 Oct 2021 17:12:59 -0700    

Click here for diff

The "equality implies image equality" opclass infrastructure disallowed  
deduplication in system catalog indexes and TOAST indexes before now.  
That seemed like the right approach back when the infrastructure was  
added by commit 612a1ab7, since ALTER INDEX cannot set deduplicate_items  
to 'off' (due to an old implementation restriction).  But that decision  
now seems arbitrary at best.  Remove special case handling implementing  
this policy.  
  
No catversion bump, since existing catalog indexes will still work.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=rYQHFaJ3WYBdK=xgwxKzaiGMSSrh-ZCREa-pS-7Zjew@mail.gmail.com  

M src/backend/access/nbtree/nbtutils.c

Update our mapping of Windows time zone names using CLDR info.

commit   : 9b8d68cc6589814d121344f59e927a7e4506fb8c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Oct 2021 16:05:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Oct 2021 16:05:42 -0400    

Click here for diff

This corrects a bunch of entries in win32_tzmap[], and adds a few  
new ones, based on the CLDR project's windowsZones.xml file.  
Non-cosmetic changes fall into four main categories:  
  
* Flat-out errors:  
  
US/Aleutan doesn't exist  
America/Salvador doesn't exist  
Asia/Baku is wrong for Yerevan  
Asia/Dhaka (Bangladesh) is wrong for Astana (Kazakhstan)  
Europe/Bucharest is wrong for Chisinau  
America/Mexico_City is wrong for Chetumal  
America/Buenos_Aires is wrong for Cayenne  
America/Caracas has its own zone, so poor fit for La Paz  
US/Eastern is wrong for Haiti  
US/Eastern is wrong for Indiana (East)  
Asia/Karachi is wrong for Tashkent  
Etc/UTC+12 doesn't exist  
Signs of Etc/GMT zones were backwards  
  
* Judgment calls:  
  
(These changes follow CLDR's choices, except for the first one)  
  
Use Europe/London for "Greenwich Standard Time", since that seems much  
more likely than Africa/Casablanca to be what people will think that  
zone name means.  CLDR has Atlantic/Reykjavik here, but that's no better.  
  
Asia/Shanghai seems a better fit than Hong Kong for "China Standard  
Time".  
  
Europe/Sarajevo is now a link to Belgrade, ie "Central Europe Standard  
Time"; so use Warsaw for "Central European Standard Time".  
  
America/Sao_Paulo seems more representative than Araguaina for  
"E. South America Standard Time".  
  
Africa/Johannesburg seems more representative than Harare for  
"South Africa Standard Time".  
  
* New Windows zone names:  
  
"Israel Standard Time"  
"Kaliningrad Standard Time"  
"Russia Time Zone N" for various N  
"Singapore Standard Time"  
"South Sudan Standard Time"  
"W. Central Africa Standard Time"  
"West Bank Standard Time"  
"Yukon Standard Time"  
  
Some of these replace older spellings, but I kept the older spellings  
too in case our code runs on a machine with the older data.  
  
* Replace aliases (tzdb Links) with underlying city-named zones:  
  
(This tracks tzdb's longstanding practice, and reduces inconsistency  
with the rest of the entries, as well as with CLDR.)  
  
US/Alaska  
Asia/Kuwait  
Asia/Muscat  
Canada/Atlantic  
Australia/Canberra  
Canada/Saskatchewan  
US/Central  
US/Eastern  
US/Hawaii  
US/Mountain  
Canada/Newfoundland  
US/Pacific  
  
Back-patch to all supported branches, as is our usual practice for  
time zone data updates.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c

Re-alphabetize the win32_tzmap[] array.

commit   : ad740067aea5b643ca2f79da086808573d35b5f4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 2 Oct 2021 16:05:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 2 Oct 2021 16:05:10 -0400    

Click here for diff

The original intent seems to have been to sort case-insensitively  
by the Windows zone name, but various changes over the years did  
not get that memo.  This commit just moves a few entries to  
restore exact alphabetic order, to ease comparison to the outputs  
of processing scripts.  
  
Back-patch to all supported branches, as is our usual practice for  
time zone data updates.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/findtimezone.c

pg_stat_statements: Add some tests for older versions still usable

commit   : 2b0da0365bec6c62cc9c5c317bab6cbee3d52ef4    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 2 Oct 2021 17:40:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 2 Oct 2021 17:40:13 +0900    

Click here for diff

When the newest version is loaded, the backend would load objects from  
the oldest complete SQL file (here 1.4) and then update to the latest  
version with transition scripts (up to 1.9 currently).  This provides  
some coverage for upgrades of pg_stat_statements, but there is no test  
to show how things have changed across each version.  
  
This adds a couple of tests for the upgrade paths using objects from  
each version supported, stressing the objects whose behaviors have  
changed across each version supported.  
  
Author: Erica Zhang  
Reviewed-by: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/Makefile
A contrib/pg_stat_statements/expected/oldextversions.out
A contrib/pg_stat_statements/sql/oldextversions.sql

Reference test binary using TESTDIR in 001_libpq_pipeline.pl.

commit   : 795862c280c5949bafcd8c44543d887fd32b590a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 29 Sep 2021 18:02:32 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 29 Sep 2021 18:02:32 -0700    

Click here for diff

The previous approach didn't really work on windows, due to the PATH separator  
being ';' not ':'. Instead of making the PATH change more complicated,  
reference the binary using the TESTDIR environment.  
  
Reported-By: Andres Freund <[email protected]>  
Suggested-By: Andrew Dunstan <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14-, where the test was introduced.  

M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl

Error out if SKIP LOCKED and WITH TIES are both specified

commit   : c6bc655ee2ef09449da7ff688a8be19a13db5c4a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Oct 2021 18:29:18 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Oct 2021 18:29:18 -0300    

Click here for diff

Both bugs #16676[1] and #17141[2] illustrate that the combination of  
SKIP LOCKED and FETCH FIRST WITH TIES break expectations when it comes  
to rows returned to other sessions accessing the same row.  Since this  
situation is detectable from the syntax and hard to fix otherwise,  
forbid for now, with the potential to fix in the future.  
  
[1] https://postgr.es/m/[email protected]  
[2] https://postgr.es/m/[email protected]  
  
Backpatch-through: 13, where WITH TIES was introduced  
Author: David Christensen <[email protected]>  
Discussion: https://postgr.es/m/CAOxo6XLPccCKru3xPMaYDpa+AXyPeWFs+SskrrL+HKwDjJnLhg@mail.gmail.com  

M doc/src/sgml/ref/select.sgml
M src/backend/commands/matview.c
M src/backend/parser/gram.y
M src/test/regress/expected/limit.out
M src/test/regress/sql/limit.sql

Remove unstable, unnecessary test; fix typo

commit   : d186d233dfde4afb9dff346e13c8adaf4deec6b3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 1 Oct 2021 18:03:11 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 1 Oct 2021 18:03:11 -0300    

Click here for diff

Commit ff9f111bce24 added some test code that's unportable and doesn't  
add meaningful coverage.  Remove it rather than try and get it to work  
everywhere.  
  
While at it, fix a typo in a log message added by the aforementioned  
commit.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/026_overwrite_contrecord.pl
D src/test/recovery/t/idiosyncratic_copy

Fix memory leak in pg_hmac

commit   : 0ded7039fab314afb7cbaf36b52209f253c05539    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 1 Oct 2021 22:47:05 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 1 Oct 2021 22:47:05 +0200    

Click here for diff

The intermittent h buffer was not freed, causing it to leak. Backpatch  
through 14 where HMAC was refactored to the current API.  
  
Author: Sergey Shinderuk <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/common/hmac.c

Avoid believing incomplete MCV-only stats in get_variable_range().

commit   : 8c1144ba73478b818d9cebe8ecd64a14b7d45bde    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Oct 2021 14:59:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Oct 2021 14:59:35 -0400    

Click here for diff

get_variable_range() would incautiously believe that statistics  
containing only an MCV list are sufficient to derive a range estimate.  
That's okay for an enum-like column that contains only MCVs, but  
otherwise the estimate could be pretty bad.  Make it report that the  
range is indeterminate unless the MCVs plus nullfrac account for  
the whole table.  
  
I don't think this needs a dedicated test case, since a quick code  
coverage check verifies that the existing regression tests traverse  
all the alternatives.  There is room to doubt that a future-proof  
test case could be built anyway, given that the submitted example  
accidentally doesn't fail before v11.  
  
Per bug #17207 from Simon Perepelitsa.  Back-patch to v10.  
In principle this has been broken all along, but I'm hesitant to  
make such changes in 9.6, since if anyone is unhappy with 9.6.24's  
behavior there will be no second chance to fix it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/selfuncs.c

Fix Portal snapshot tracking to handle subtransactions properly.

commit   : 7b5d4c29ed0262e537026cb3a85161d6cf98abcc    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 1 Oct 2021 11:10:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 1 Oct 2021 11:10:12 -0400    

Click here for diff

Commit 84f5c2908 forgot to consider the possibility that  
EnsurePortalSnapshotExists could run inside a subtransaction with  
lifespan shorter than the Portal's.  In that case, the new active  
snapshot would be popped at the end of the subtransaction, leaving  
a dangling pointer in the Portal, with mayhem ensuing.  
  
To fix, make sure the ActiveSnapshot stack entry is marked with  
the same subtransaction nesting level as the associated Portal.  
It's certainly safe to do so since we won't be here at all unless  
the stack is empty; hence we can't create an out-of-order stack.  
  
Let's also apply this logic in the case where PortalRunUtility  
sets portalSnapshot, just to be sure that path can't cause similar  
problems.  It's slightly less clear that that path can't create  
an out-of-order stack, so add an assertion guarding it.  
  
Report and patch by Bertrand Drouvot (with kibitzing by me).  
Back-patch to v11, like the previous commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/tcop/pquery.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/portal.h
M src/include/utils/snapmgr.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Doc: Move pg_stat_replication_slots view to "Collected Statistics Views" section.

commit   : 2d44dee0281a1abf0dcb1548c910fae067f1d34d    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 1 Oct 2021 08:17:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 1 Oct 2021 08:17:56 +0530    

Click here for diff

Commit 9868167500 added pg_stat_replication_slots view to monitor  
ReorderBuffer stats but mistakenly added it under  
"Dynamic Statistics Views" section in the docs whereas it belongs to  
"Collected Statistics Views" section.  
  
Author: Amit Kapila  
Reviewed-by: Masahiko Sawada  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAA4eK1Kb5ur=OC-G4cAsqPOjoVe+S8LNw1WmUY8Owasjk8o5WQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Ensure interleaved_parts field is always initialized

commit   : 16239c5fdf6e457f8274c49209d1fbdeab472703    
  
author   : David Rowley <[email protected]>    
date     : Fri, 1 Oct 2021 15:09:49 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 1 Oct 2021 15:09:49 +1300    

Click here for diff

This field was recently added in db632fbca, however that commit missed one  
place where it should have initialized the new field to NULL.  The missed  
location is where the PartitionBoundInfo is created for partition-wise  
join relations.  Technically there could be interleaved partitions in a  
partition-wise join relation, but currently the only optimization we use  
this field for only does so for base rels and other member rels.  So just  
document that we don't populate this field for join rels.  
  
Reported-by: Amit Langote  
Author: Amit Langote, David Rowley  
Reviewed-by: Amit Langote, David Rowley  
Discussion: https://postgr.es/m/CA+HiwqE76Rps24kwHsd2Cr82Ua07tJC9t9reG0c7ScX9n_xrEA@mail.gmail.com  

M src/backend/partitioning/partbounds.c
M src/include/partitioning/partbounds.h

Remove gratuitous environment dependency in 002_types.pl test.

commit   : 20f8671ef69b864c25ffa59471814102c1260d78    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Sep 2021 16:23:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Sep 2021 16:23:10 -0400    

Click here for diff

Computing related timestamps by subtracting "N days" is sensitive  
to the prevailing timezone, since we interpret that as "same local  
time on the N'th prior day".  Even though the intervals in question  
are only two to four days, through remarkable bad luck they managed  
to cross the end of Ramadan in 2014, causing the test's output to  
change if timezone is set to Africa/Casablanca.  (Maybe in other  
Muslim areas as well; I didn't check.)  There's absolutely no reason  
for this test to exercise interval subtraction, so just get rid of  
that and use plain timestamptz constants representing the intended  
values.  
  
Per report from Andres Freund.  Back-patch to v10 where this test  
script came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/002_types.pl

Treat ETIMEDOUT as indicating a non-recoverable connection failure.

commit   : b484ddf4d2eb81736512efa35ed3e5d2a72993d8    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 30 Sep 2021 14:16:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 30 Sep 2021 14:16:08 -0400    

Click here for diff

Add ETIMEDOUT to ALL_CONNECTION_FAILURE_ERRNOS' list of "errnos that  
identify hard failure of a previously-established network connection".  
While one could imagine that this is sometimes recoverable, the same  
could be said of other entries such as ENETDOWN.  
  
In support of this, handle ETIMEDOUT on par with other socket errors  
in relevant infrastructure, such as TranslateSocketError().  
(I made a couple of cosmetic adjustments in TranslateSocketError(),  
too.)  The code now assumes that ETIMEDOUT is defined everywhere,  
which it should be given that POSIX has required it since SUSv2.  
  
Perhaps this should be back-patched, but I'm hesitant to do so given  
the lack of previous complaints, and the hazard that there's a small  
ABI break on Windows from redefining the symbol.  Even if we decide  
to do that, it'd be prudent to let this bake awhile in HEAD first.  
  
Jelte Fennema  
  
Discussion: https://postgr.es/m/AM5PR83MB01782BFF2978505F6D6C559AF7AA9@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/backend/port/win32/socket.c
M src/include/port.h
M src/include/port/win32_port.h
M src/port/strerror.c

Repair two portability oversights of new test

commit   : d03bca4d70c29cca4f09e3a0e78a56cf97e237f3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 30 Sep 2021 10:01:03 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 30 Sep 2021 10:01:03 -0300    

Click here for diff

First, as pointed out by Tom Lane and Michael Paquier, I failed to  
realize that Windows' PostgresNode needs an extra pg_hba.conf line  
(added by PostgresNode->set_replication_conf, called internally by  
->init() when 'allows_streaming=>1' is given -- but I purposefully  
omitted that).  I think a good fix should be to have nodes with only  
'has_archiving=>1' set up for replication too, but that's a bigger  
discussion.  Fix it by calling ->set_replication_conf, which is not  
unprecedented, as pointed out by Andrew Dunstan.  
  
I also forgot to uncomment a ->finish() call for a pumpable IPC::Run  
file descriptor.  Apparently this is innocuous in almost all platforms.  
  
Backpatch to 14.  The older branches were added this file too, but not  
this particular part of the test.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/026_overwrite_contrecord.pl

psql: Add various tests

commit   : 14d755b00037ce04b9e24504f4b540d9e731c29e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Sep 2021 23:16:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Sep 2021 23:16:00 +0200    

Click here for diff

Add tests for psql features  
  
- AUTOCOMMIT  
- ON_ERROR_ROLLBACK  
- ECHO errors  
  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/6954328d-96f2-77f7-735f-7ce493a40949%40enterprisedb.com  

M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Fix WAL replay in presence of an incomplete record

commit   : ff9f111bce24fd9bbca7a20315586de877d74923    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 29 Sep 2021 11:21:51 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 29 Sep 2021 11:21:51 -0300    

Click here for diff

Physical replication always ships WAL segment files to replicas once  
they are complete.  This is a problem if one WAL record is split across  
a segment boundary and the primary server crashes before writing down  
the segment with the next portion of the WAL record: WAL writing after  
crash recovery would happily resume at the point where the broken record  
started, overwriting that record ... but any standby or backup may have  
already received a copy of that segment, and they are not rewinding.  
This causes standbys to stop following the primary after the latter  
crashes:  
  LOG:  invalid contrecord length 7262 at A8/D9FFFBC8  
because the standby is still trying to read the continuation record  
(contrecord) for the original long WAL record, but it is not there and  
it will never be.  A workaround is to stop the replica, delete the WAL  
file, and restart it -- at which point a fresh copy is brought over from  
the primary.  But that's pretty labor intensive, and I bet many users  
would just give up and re-clone the standby instead.  
  
A fix for this problem was already attempted in commit 515e3d84a0b5, but  
it only addressed the case for the scenario of WAL archiving, so  
streaming replication would still be a problem (as well as other things  
such as taking a filesystem-level backup while the server is down after  
having crashed), and it had performance scalability problems too; so it  
had to be reverted.  
  
This commit fixes the problem using an approach suggested by Andres  
Freund, whereby the initial portion(s) of the split-up WAL record are  
kept, and a special type of WAL record is written where the contrecord  
was lost, so that WAL replay in the replica knows to skip the broken  
parts.  With this approach, we can continue to stream/archive segment  
files as soon as they are complete, and replay of the broken records  
will proceed across the crash point without a hitch.  
  
Because a new type of WAL record is added, users should be careful to  
upgrade standbys first, primaries later. Otherwise they risk the standby  
being unable to start if the primary happens to write such a record.  
  
A new TAP test that exercises this is added, but the portability of it  
is yet to be seen.  
  
This has been wrong since the introduction of physical replication, so  
backpatch all the way back.  In stable branches, keep the new  
XLogReaderState members at the end of the struct, to avoid an ABI  
break.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
M src/include/catalog/pg_control.h
A src/test/recovery/t/026_overwrite_contrecord.pl
A src/test/recovery/t/idiosyncratic_copy
M src/tools/pgindent/typedefs.list

pgbench: Fix handling of socket errors during benchmark.

commit   : 2acb7cc6b56c2b80029c202217e19553578456e9    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 29 Sep 2021 21:01:10 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 29 Sep 2021 21:01:10 +0900    

Click here for diff

Previously socket errors such as invalid socket or socket wait method failures  
during benchmark caused pgbench to exit with status 0. Instead, errors during  
the run should result in exit status 2.  
  
Back-patch to v12 where pgbench started reporting exit status.  
  
Original complaint and patch by Hayato Kuroda.  
  
Author: Yugo Nagata, Fabien COELHO  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/TYCPR01MB5870057375ACA8A73099C649F5349@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M src/bin/pgbench/pgbench.c

pgbench: Correct log level of message output when socket wait method fails.

commit   : d33674708948e10806480ee628b072a2ef8ecba1    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 29 Sep 2021 20:35:00 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 29 Sep 2021 20:35:00 +0900    

Click here for diff

The failure of socket wait method like "select()" doesn't terminate pgbench.  
So the log level of error message when that failure happens should be ERROR.  
But previously FATAL was used in that case.  
  
Back-patch to v13 where pgbench started using common logging API.  
  
Author: Yugo Nagata, Fabien COELHO  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Clarify use of "statistics objects" in the code

commit   : 070d2e19e40897d857f570f24888fc30727ed9c0    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 15:29:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 15:29:38 +0900    

Click here for diff

The code inconsistently used "statistic object" or "statistics" where  
the correct term, as discussed, is actually "statistics object".  This  
improves the state of the code to be more consistent.  
  
While on it, fix an incorrect error message introduced in a4d75c8.  This  
error should never happen, as the code states, but it would be  
misleading.  
  
Author: Justin Pryzby  
Reviewed-by: Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c

Fix incorrect format placeholder

commit   : 0b947c3101d1d05c55531731d6b778f82cb21350    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 29 Sep 2021 08:12:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 29 Sep 2021 08:12:23 +0200    

Click here for diff

M src/include/lib/simplehash.h

doc: Fix some typos and markups

commit   : c8dd2cb49405d2a39a714bd5adc31d39b8372a4e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 11:56:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 11:56:13 +0900    

Click here for diff

Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/btree.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/spgist.sgml
M doc/src/sgml/test-decoding.sgml

Refactor output file handling when forking syslogger under EXEC_BACKEND

commit   : 5b0b699f748ead1b7414c58aaa7cf0ea83808147    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 10:54:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 29 Sep 2021 10:54:45 +0900    

Click here for diff

A forked logging collector in EXEC_BACKEND builds passes down file  
descriptors (or HANDLEs in WIN32) through a command for files to be  
reopened (for stderr and csvlog).  Some of its logic was duplicated, and  
this commit refactors the code with some wrapper routines for file  
reopening after forking and fd grabbing when building the command for  
the fork.  
  
While on it, this simplifies a use of "long" in the code, introduced by  
ab0ba6e to take care of a warning related to MinGW-W64 when mapping a  
intptr_t to a printed value.  "long" is 32-bit long on Windows, and  
interoperability of Win32 and Win64 ensures that handles are always  
32-bit significant, so we can just use "int" for the same result.  This  
also makes the new routines more symmetric.  
  
This change makes easier the introduction of new log destinations in the  
logging collector, and this is not the only piece of refactoring  
planned.  I have tested this change with EXEC_BACKEND on linux, macos,  
and of course MSVC (both Win32 and Win64), but not MinGW so the  
buildfarm may have something to say here.  
  
Author: Sehrope Sarkuni, Michael Paquier  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M src/backend/postmaster/syslogger.c

Fix instability in contrib/bloom TAP tests.

commit   : 6bc6bd47cf715c8717a8af3f617957045772d38b    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 28 Sep 2021 17:34:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 28 Sep 2021 17:34:31 -0400    

Click here for diff

It turns out that the instability complained of in commit d3c09b9b1  
has an embarrassingly simple explanation.  The test script waits for  
the standby to flush incoming WAL to disk, but it should wait for  
the WAL to be replayed, since we are testing for the effects of that  
to be visible.  
  
While at it, use wait_for_catchup instead of reinventing that logic,  
and adjust $Test::Builder::Level to improve future error reports.  
  
Back-patch to v12 where the necessary infrastructure came in  
(cf. aforesaid commit).  Also back-patch 7d1aa6bf1 so that the  
test will actually get run.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/t/001_wal.pl

Properly schema-prefix reference to pg_catalog.pg_get_statisticsobjdef_columns

commit   : 07f8a9e784236a3baf707c59cf80d0f015594ffc    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 28 Sep 2021 16:23:18 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 28 Sep 2021 16:23:18 +0200    

Click here for diff

Author: Tatsuro Yamada  
Backpatch-through: 14  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/bin/psql/describe.c

Support amcheck of sequences

commit   : c3b011d9918100c6ec2d72297fb51635bce70e80    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 28 Sep 2021 15:26:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 28 Sep 2021 15:26:25 +0200    

Click here for diff

Sequences were left out of the list of relation kinds that  
verify_heapam knew how to check, though it is fairly trivial to allow  
them.  Doing that, and while at it, updating pg_amcheck to include  
sequences in relations matched by table and relation patterns.  
  
Author: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/81ad4757-92c1-4aa3-7bee-f609544837e3%40enterprisedb.com  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/verify_heapam.c
M doc/src/sgml/amcheck.sgml
M doc/src/sgml/ref/pg_amcheck.sgml
M src/bin/pg_amcheck/pg_amcheck.c

Re-enable contrib/bloom's TAP tests.

commit   : 7d1aa6bf1c27bf7438179db446f7d1e72ae093d0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 27 Sep 2021 18:48:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 27 Sep 2021 18:48:01 -0400    

Click here for diff

These tests were disabled back in 2018 (commit d3c09b9b1) because of  
failures observed in the buildfarm.  I've not been able to reproduce  
any failure on longfin's host, though, so I'm curious whether or to  
what extent we've fixed the problem.  Let's re-enable it (in HEAD  
only) and see what blows up.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/bloom/Makefile

Fix typos and grammar in code comments

commit   : e767ddcd354b51fc4c12d6b02e268861bd871fbc    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 27 Sep 2021 14:21:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 27 Sep 2021 14:21:28 +0900    

Click here for diff

Several mistakes have piled in the code comments over the time,  
including incorrect grammar, function names and simple typos.  This  
commit takes care of a portion of these.  
  
No backpatch is done as this is only cosmetic.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  

M contrib/tablefunc/tablefunc.c
M src/backend/commands/statscmds.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/statistics/README
M src/backend/statistics/README.mcv
M src/backend/statistics/extended_stats.c
M src/common/pg_lzcompress.c

Remove unneeded nbtree latestRemovedXid comments.

commit   : 895267a3266484440c0b2f42f613bcff28844cc1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sun, 26 Sep 2021 20:25:14 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sun, 26 Sep 2021 20:25:14 -0700    

Click here for diff

Discussing the low level issue of nbtree VACUUM and recovery conflicts  
in btvacuumpage() now seems inappropriate.  The same issue is discussed  
in nbtxlog.h, as well as in a comment block above _bt_delitems_vacuum().  
  
The comment block made more sense when it was part of a broader  
discussion of nbtree VACUUM "pin scans".  These were removed by commit  
9f83468b.  

M src/backend/access/nbtree/nbtree.c

Track LLVM 14 API changes.

commit   : e6a7600202105919bffd62b3dfd941f4a94e082b    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 27 Sep 2021 10:39:01 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 27 Sep 2021 10:39:01 +1300    

Click here for diff

Only done on the master branch for now to fix build farm animal seawasp  
(which tests bleeeding edge PostgreSQL with bleeding edge LLVM).  We can  
back-patch a consolidated fix closer to LLVM 14's release, once its API  
has stopped moving around.  
  
Discussion: https://postgr.es/m/CA%2BhUKGL%3Dyg6qqgg6W6SAuvRQejditeoDNy-X3b9H_6Fnw8j5Wg%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit_inline.cpp

Avoid unnecessary division in interval_cmp_value().

commit   : e94c1a55dada49772622d2be2d17a2a9973b2661    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 26 Sep 2021 14:24:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 26 Sep 2021 14:24:03 -0400    

Click here for diff

Splitting the time field into days and microseconds is pretty  
useless when we're just going to recombine those values.  
It's unclear if anyone will notice the speedup in real-world  
cases, but a cycle shaved is a cycle earned.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/timestamp.c

Fix typos in docs

commit   : 7c1d8a243f8bd46604c9b292f392aab170eed821    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 26 Sep 2021 19:17:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 26 Sep 2021 19:17:30 +0900    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/datatype.sgml

Update obsolete nbtree deletion comments.

commit   : ce2a86053380f7e82dc8318ac48a22a7ab266398    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 25 Sep 2021 15:05:56 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 25 Sep 2021 15:05:56 -0700    

Click here for diff

_bt_delitems_delete() is no longer the high-level entry point used by  
index tuple deletion driven by index tuples whose LP_DEAD bits are set  
(now called "simple index tuple deletion").  It became a lower level  
routine that's only called by _bt_delitems_delete_check() following  
commit d168b66682.  

M src/backend/access/nbtree/nbtpage.c

vacuumlazy.c: Remove obsolete 'onecall' comment.

commit   : c1a47dfe2e9f814e61377f47aa79a113a4c73a63    
  
author   : Peter Geoghegan <[email protected]>    
date     : Sat, 25 Sep 2021 10:22:53 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Sat, 25 Sep 2021 10:22:53 -0700    

Click here for diff

Remove obsolete reference to lazy_vacuum()'s onecall argument.  The  
function argument was removed by commit 3499df0dee.  
  
Also remove adjoining comment block that introduces the wraparound  
failsafe concept.  Talking about the failsafe here no longer makes  
sense, since lazy_vacuum() (and related functions) are no longer the  
only place where the failsafe might be triggered.  This has been the  
case since commit c242baa4a8 taught VACUUM to consider triggering the  
failsafe mechanism during its initial heap scan.  

M src/backend/access/heap/vacuumlazy.c

Doc: extend warnings about collation-mismatch hazards in postgres_fdw.

commit   : 7b0be9fb2dddb214db2bed0e137b9b42c1479455    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 10:53:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 25 Sep 2021 10:53:54 -0400    

Click here for diff

Be a little more vocal about the risks of remote collations not  
matching local ones.  Actually fixing these risks seems hard,  
and I've given up on the idea that it might be back-patchable.  
So the best we can do for the back branches is add documentation.  
  
Per discussion of bug #16583 from Jiří Fejfar.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/postgres-fdw.sgml

doc: Improve description of index vacuuming with GUCs

commit   : 1ba841072ebeb1a6605395950a51c869de42a104    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 15:10:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 15:10:24 +0900    

Click here for diff

Index vacuums may happen multiple times depending on the number of dead  
tuples stored, as of maintenance_work_mem for a manual VACUUM.  For  
autovacuum, this is controlled by autovacuum_work_mem instead, if set.  
The documentation mentioned the former, but not the latter in the  
context of autovacuum.  
  
Reported-by: Nikolai Berkoff  
Author: Laurenz Albe, Euler Taveira  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/monitoring.sgml

doc: Add missing markup in CREATE EVENT TRIGGER page

commit   : 1ab70b11e6425c955c24aa301188de32356bebb8    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 14:48:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 25 Sep 2021 14:48:03 +0900    

Click here for diff

Reported-by: rir  
Discussion: https://postgr.es/m/20210924183658.3syyitp3yuxjv2fp@localhost  
Backpatch-through: 9.6  

M doc/src/sgml/ref/create_event_trigger.sgml

nbtree README: Add note about latestRemovedXid.

commit   : 48064a8d330db259076fb7b2300544fbf65f4109    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 24 Sep 2021 13:53:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 24 Sep 2021 13:53:48 -0700    

Click here for diff

Point out that index tuple deletion generally needs a latestRemovedXid  
value for the deletion operation's WAL record.  This is bound to be the  
most expensive part of the whole deletion operation now that it takes  
place up front, during original execution.  
  
This was arguably an oversight in commit 558a9165e08, which moved the  
work required to generate these values from index deletion REDO routines  
to original execution of index deletion operations.  

M src/backend/access/nbtree/README

Add missing $Test::Builder::Level settings

commit   : 73aa5e0cafd0d577fe464ed1d9ac317103f27ea4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 Sep 2021 22:49:20 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 Sep 2021 22:49:20 +0200    

Click here for diff

One of these was accidentally removed by c50624c.  The others are  
added by analogy.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl

Add exception for unicode_east_asian_fw_table.h to headerscheck also

commit   : 88b0ae15bc099df6192a3b69b853f86fb015339a    
  
author   : John Naylor <[email protected]>    
date     : Thu, 23 Sep 2021 15:30:25 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 23 Sep 2021 15:30:25 -0400    

Click here for diff

Followup to a315b19cc  

M src/tools/pginclude/headerscheck

Add exception for unicode_east_asian_fw_table.h to cpluspluscheck

commit   : a315b19cceeb2ccbe17c7ddd6e7c90911b325f9b    
  
author   : John Naylor <[email protected]>    
date     : Thu, 23 Sep 2021 15:14:22 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 23 Sep 2021 15:14:22 -0400    

Click here for diff

unicode_east_asian_fw_table.h should not be compiled standalone, similarly  
to unicode_combining_table.h, but cpluspluscheck did not get the memo.  
  
Oversight in bab982161.  
  
Per report from Tom Lane  

M src/tools/pginclude/cpluspluscheck

Split macros from visibilitymap.h into a separate header

commit   : b92f9f74436c48054e7743548edc8ca50e97c6b1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 Sep 2021 19:59:03 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 Sep 2021 19:59:03 +0300    

Click here for diff

That allows to include just visibilitymapdefs.h from file.c, and in turn,  
remove include of postgres.h from relcache.h.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20210913232614.czafiubr435l6egi%40alap3.anarazel.de  
Author: Alexander Korotkov  
Reviewed-by: Andres Freund, Tom Lane, Alvaro Herrera  
Backpatch-through: 13  

M src/bin/pg_upgrade/file.c
M src/include/access/visibilitymap.h
A src/include/access/visibilitymapdefs.h
M src/include/utils/relcache.h

Release memory allocated by dependency_degree

commit   : ad8a166ca86846ab691bd6dafc695e0f7dd96012    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:13:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:13:11 +0200    

Click here for diff

Calculating degree of a functional dependency may allocate a lot of  
memory - we have released mot of the explicitly allocated memory, but  
e.g. detoasted varlena values were left behind. That may be an issue,  
because we consider a lot of dependencies (all combinations), and the  
detoasting may happen for each one again.  
  
Fixed by calling dependency_degree() in a dedicated context, and  
resetting it after each call. We only need the calculated dependency  
degree, so we don't need to copy anything.  
  
Backpatch to PostgreSQL 10, where extended statistics were introduced.  
  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com  

M src/backend/statistics/dependencies.c

Free memory after building each statistics object

commit   : 83772cc78e0392a247231ba510c61b6612b93b3f    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:14:11 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 21 Sep 2021 01:14:11 +0200    

Click here for diff

Until now, all extended statistics on a given relation were built in the  
same memory context, without resetting. Some of the memory was released  
explicitly, but not all of it - for example memory allocated while  
detoasting values is hard to free. This is how it worked since extended  
statistics were introduced in PostgreSQL 10, but adding support for  
extended stats on expressions made the issue somewhat worse as it  
increases the number of statistics to build.  
  
Fixed by adding a memory context which gets reset after building each  
statistics object (all the statistics kinds included in it). Resetting  
it after building each statistics kind would be even better, but it  
would require more invasive changes and copying of results, making it  
harder to backpatch.  
  
Backpatch to PostgreSQL 10, where extended statistics were introduced.  
  
Author: Justin Pryzby  
Reported-by: Justin Pryzby  
Reviewed-by: Tomas Vondra  
Backpatch-through: 10  
Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com  

M src/backend/statistics/extended_stats.c

Document issue with heapam line pointer truncation.

commit   : c7aeb775df895db240dcd6f47242f7e08899adfb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 22 Sep 2021 19:21:36 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 22 Sep 2021 19:21:36 -0700    

Click here for diff

Checking that an offset number isn't past the end of a heap page's line  
pointer array was just a defensive sanity check for HOT-chain traversal  
code before commit 3c3b8a4b.  It's etrictly necessary now, though.  Add  
comments that reference the issue to code in heapam that needs to get it  
right.  
  
Per suggestion from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c

postgres_fdw: Refactor transaction rollback code to avoid code duplication.

commit   : 85c69611288f4096b7460d980bedaa777f824d24    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 22 Sep 2021 23:47:36 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 22 Sep 2021 23:47:36 +0900    

Click here for diff

In postgres_fdw, pgfdw_xact_callback() and pgfdw_subxact_callback()  
callback functions do almost the same thing to rollback remote toplevel-  
and sub-transaction. But previously their such rollback logics were  
implemented separately in each function and in different way. Which  
could decrease the readability and maintainability of the code.  
  
To fix the issue, this commit creates the common function to rollback  
remote transactions, and makes those callback functions use it. Which  
allows us to avoid unnecessary code duplication.  
  
Author: Fujii Masao  
Reviewed-by: Zhihong Yu, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/connection.c

Make use of PG_INT64_MAX/PG_INT64_MIN

commit   : f9ea2960310c235a7ae97847c0757eba9f6f9a85    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 22 Sep 2021 07:31:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 22 Sep 2021 07:31:05 +0200    

Click here for diff

This code was written before those symbols were introduced, but now we  
can simplify it.  

M src/backend/utils/adt/xml.c

Invalidate all partitions for a partitioned table in publication.

commit   : 4548c76738b368a11a5dad052f9653a349eeb52c    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 08:00:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 08:00:54 +0530    

Click here for diff

Updates/Deletes on a partition were allowed even without replica identity  
after the parent table was added to a publication. This would later lead  
to an error on subscribers. The reason was that we were not invalidating  
the partition's relcache and the publication information for partitions  
was not getting rebuilt. Similarly, we were not invalidating the  
partitions' relcache after dropping a partitioned table from a publication  
which will prohibit Updates/Deletes on its partition without replica  
identity even without any publication.  
  
Reported-by: Haiying Tang  
Author: Hou Zhijie and Vignesh C  
Reviewed-by: Vignesh C and Amit Kapila  
Backpatch-through: 13  
Discussion: https://postgr.es/m/OS0PR01MB6113D77F583C922F1CEAA1C3FBD29@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/include/catalog/pg_publication.h
M src/include/commands/publicationcmds.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Add parent table name in an error in reorderbuffer.c.

commit   : 5e77625b260a781316bb94ea9750dc66c50152bf    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 07:42:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 22 Sep 2021 07:42:52 +0530    

Click here for diff

This can help in troubleshooting the cause of a particular error that can  
occur during decoding.  
  
Author: Jeremy Schneider  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/reorderbuffer.c

Fix "single value strategy" index deletion issue.

commit   : dd94c2852e6e3a246b9fd64bf2d9c7fc01020905    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 21 Sep 2021 18:57:32 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 21 Sep 2021 18:57:32 -0700    

Click here for diff

It is not appropriate for deduplication to apply single value strategy  
when triggered by a bottom-up index deletion pass.  This wastes cycles  
because later bottom-up deletion passes will overinterpret older  
duplicate tuples that deduplication actually just skipped over "by  
design".  It also makes bottom-up deletion much less effective for low  
cardinality indexes that happen to cross a meaningless "index has single  
key value per leaf page" threshold.  
  
To fix, slightly narrow the conditions under which deduplication's  
single value strategy is considered.  We already avoided the strategy  
for a unique index, since our high level goal must just be to buy time  
for VACUUM to run (not to buy space).  We'll now also avoid it when we  
just had a bottom-up pass that reported failure.  The two cases share  
the same high level goal, and already overlapped significantly, so this  
approach is quite natural.  
  
Oversight in commit d168b666, which added bottom-up index deletion.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com  
Backpatch: 14-, where bottom-up deletion was introduced.  

M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/include/access/nbtree.h

Fix some issues with TAP tests for postgres -C

commit   : 1a9d802828110c87a207785aaf6b00d8917a86ad    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 10:13:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 10:13:38 +0900    

Click here for diff

This addresses two issues with the tests added in 0c39c292 for runtime  
GUCs:  
- Re-enable the test on Msys.  The test could fail because of \r\n  
generated by Msys perl.  0d91c52a has taken care of this issue.  
- Allow the test to run in the context of a privileged account.  CIs  
running under privileged accounts would fail on permission failures, as  
reported by Andres Freund.  This issue is fixed by wrapping the postgres  
command within pg_ctl as the latter will take care of any permissions  
needed.  The test checking a failure of postgres -C for a runtime  
parameter with an instance running is removed, as pg_ctl produces an  
unstable error code (no need for a CI to reproduce that).  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_checksums/t/002_actions.pl

Fix places in TestLib.pm in need of adaptation to the output of Msys perl

commit   : 0d91c52a8fc71bfe5664a13368e42e1dabc5fe78    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 08:42:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 22 Sep 2021 08:42:42 +0900    

Click here for diff

Contrary to the output of native perl, Msys perl generates outputs with  
CRLFs characters.  There are already places in the TAP code where CRLFs  
(\r\n) are automatically converted to LF (\n) on Msys, but we missed a  
couple of places when running commands and using their output for  
comparison, that would lead to failures.  
  
This problem has been found thanks to the test added in 5adb067 using  
TestLib::command_checks_all(), but after a closer look more code paths  
were missing a filter.  
  
This is backpatched all the way down to prevent any surprises if a new  
test is introduced in stable branches.  
  
Reviewed-by: Andrew Dunstan, Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/test/perl/TestLib.pm

Fix misevaluation of STABLE parameters in CALL within plpgsql.

commit   : 4476bcb8773b306b9ca84bf2fadcf30acfa2c687    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 21 Sep 2021 19:06:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 21 Sep 2021 19:06:33 -0400    

Click here for diff

Before commit 84f5c2908, a STABLE function in a plpgsql CALL  
statement's argument list would see an up-to-date snapshot,  
because exec_stmt_call would push a new snapshot.  I got rid of  
that because the possibility of the snapshot disappearing within  
COMMIT made it too hard to manage a snapshot across the CALL  
statement.  That's fine so far as the procedure itself goes,  
but I forgot to think about the possibility of STABLE functions  
within the CALL argument list.  As things now stand, those'll  
be executed with the Portal's snapshot as ActiveSnapshot,  
keeping them from seeing updates more recent than Portal startup.  
  
(VOLATILE functions don't have a problem because they take their  
own snapshots; which indeed is also why the procedure itself  
doesn't have a problem.  There are no STABLE procedures.)  
  
We can fix this by pushing a new snapshot transiently within  
ExecuteCallStmt itself.  Popping the snapshot before we get  
into the procedure proper eliminates the management problem.  
The possibly-useless extra snapshot-grab is slightly annoying,  
but it's no worse than what happened before 84f5c2908.  
  
Per bug #17199 from Alexander Nawratil.  Back-patch to v11,  
like the previous patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/functioncmds.c
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql

Document XLOG_INCLUDE_XID a little better

commit   : ade24dab97a20dae74fb57c0106dfe0e0303541b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 21 Sep 2021 19:47:53 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 21 Sep 2021 19:47:53 -0300    

Click here for diff

I noticed that commit 0bead9af484c left this flag undocumented in  
XLogSetRecordFlags, which led me to discover that the flag doesn't  
actually do what the one comment on it said it does.  Improve the  
situation by adding some more comments.  
  
Backpatch to 14, where the aforementioned commit appears.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xloginsert.c
M src/include/access/xlog.h
M src/include/access/xlogrecord.h

Introduce GUC shared_memory_size_in_huge_pages

commit   : 43c1c4f65eab77bcfc4f535a7e9ac0421e0cf2a5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 21 Sep 2021 10:31:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 21 Sep 2021 10:31:58 +0900    

Click here for diff

This runtime-computed GUC shows the number of huge pages required  
for the server's main shared memory area, taking advantage of the  
work done in 0c39c29 and 0bd305e.  This is useful for users to estimate  
the amount of huge pages required for a server as it becomes possible to  
do an estimation without having to start the server and potentially  
allocate a large chunk of shared memory.  
  
The number of huge pages is calculated based on the existing GUC  
huge_page_size if set, or by using the system's default by looking at  
/proc/meminfo on Linux.  There is nothing new here as this commit reuses  
the existing calculation methods, and just exposes this information  
directly to the user.  The routine calculating the huge page size is  
refactored to limit the number of files with platform-specific flags.  
  
This new GUC's name was the most popular choice based on the discussion  
done.  This is only supported on Linux.  
  
I have taken the time to test the change on Linux, Windows and MacOS,  
though for the last two ones large pages are not supported.  The first  
one calculates correctly the number of pages depending on the existing  
GUC huge_page_size or the system's default.  
  
Thanks to Andres Freund, Robert Haas, Kyotaro Horiguchi, Tom Lane,  
Justin Pryzby (and anybody forgotten here) for the discussion.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/postgres-ref.sgml
M doc/src/sgml/runtime.sgml
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/misc/guc.c
M src/include/storage/pg_shmem.h

Remove overzealous index deletion assertion.

commit   : 5e6716cde5749aea506dd3f30b099b6e9b4c5af8    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 20 Sep 2021 14:26:25 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 20 Sep 2021 14:26:25 -0700    

Click here for diff

A broken HOT chain is not an unexpected condition, even when the offset  
number points past the end of the page's line pointer array.  
heap_prune_chain() does not (and never has) treated this condition as  
unexpected, so derivative code in heap_index_delete_tuples() shouldn't  
do so either.  
  
Oversight in commit 4228817449.  
  
The assertion can probably only fail on Postgres 14 and master.  Earlier  
releases don't have commit 3c3b8a4b, which taught VACUUM to truncate the  
line pointer array of heap pages.  Backpatch all the same, just to be  
consistent.  
  
Author: Peter Geoghegan <[email protected]>  
Reported-By: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 12-, just like commit 4228817449.  

M src/backend/access/heap/heapam.c

pgstat: Prepare to use mechanism for truncated rels also for droppped rels.

commit   : 6b9501660c9384476ca9a04918f5cf94379e419e    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 3 Apr 2021 17:39:54 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 3 Apr 2021 17:39:54 -0700    

Click here for diff

The upcoming shared memory stats patch drops stats for dropped objects in a  
transactional manner, rather than removing them later as part of vacuum. This  
means that stats for DROP inside a transaction needs to handle aborted  
(sub-)transactions similar to TRUNCATE: The stats up to the DROP should be  
restored.  
  
Rename the existing infrastructure in preparation.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

pgstat: Split out relation stats handling from AtEO[Sub]Xact_PgStat() etc.

commit   : e1f958d759ff71a264973d13e9bc86c7db822928    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 20 Sep 2021 13:56:16 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 20 Sep 2021 13:56:16 -0700    

Click here for diff

An upcoming patch will add additional work to these functions. To avoid the  
functions getting too complicated / doing too many things at once, split out  
sub-tasks into their own functions.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Doc: add glossary term for "auxiliary process"

commit   : d3014fff4cd4dcaf4b2764d96ad038f3be7413b0    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 20 Sep 2021 12:22:02 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 20 Sep 2021 12:22:02 -0300    

Click here for diff

Add entries for existing processes not documented, too, and adjust  
existing definitions for consistency.  
  
Per question from Bharath Rupireddy.  
  
Author: Justin Pryzby <[email protected]>  
Author: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACVpYCT0M+k8zqrAa4ZQZV+ce5s6G=yajwoS1m=h-jj8NQ@mail.gmail.com  

M doc/src/sgml/glossary.sgml
M src/include/miscadmin.h

Doc: minor improvements for "Formatting" section.

commit   : 5577cd571ad3528471152f68636ac03c80576977    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 Sep 2021 10:48:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 Sep 2021 10:48:02 -0400    

Click here for diff

Add more-specific links into the source tree.  

M doc/src/sgml/sources.sgml

Disallow extended statistics on system columns

commit   : c9eeef2a15c02ff7dd2bf3251dbee925b050fc0f    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 20 Sep 2021 00:34:57 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 20 Sep 2021 00:34:57 +0200    

Click here for diff

Since introduction of extended statistics, we've disallowed references  
to system columns. So for example  
  
    CREATE STATISTICS s ON ctid FROM t;  
  
would fail. But with extended statistics on expressions, it was possible  
to work around this limitation quite easily  
  
    CREATE STATISTICS s ON (ctid::text) FROM t;  
  
This is an oversight in a4d75c86bf, fixed by adding a simple check.  
Backpatch to PostgreSQL 14, where support for extended statistics on  
expressions was introduced.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com  

M src/backend/commands/statscmds.c

Doc: fix typos.

commit   : d5eeb51bc053d75f647136026de522d6ee3bf725    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 11:36:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 19 Sep 2021 11:36:53 -0400    

Click here for diff

"PGcon" should be "PGconn".  Noted by D. Frey.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/lobj.sgml

process startup: Split single user code out of PostgresMain().

commit   : 7c83a3bf51489e5b48c567c2ac54fed030d23c52    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 8 Sep 2021 12:19:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 8 Sep 2021 12:19:50 -0700    

Click here for diff

It was harder than necessary to understand PostgresMain() because the code for  
a normal backend was interspersed with single-user mode specific code. Split  
most of the single-user mode code into its own function  
PostgresSingleUserMain(), that does all the necessary setup for single-user  
mode, and then hands off after that to PostgresMain().  
  
There still is some single-user mode code in InitPostgres(), and it'd likely  
be worth moving at least some of it out. But that's for later.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/include/tcop/tcopprot.h

Improve some check logic in pg_receivewal

commit   : 499c9b1266395c5e4c22bd7b2cbdb7f5a64ea4fa    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 18 Sep 2021 10:42:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 18 Sep 2021 10:42:13 +0900    

Click here for diff

The following things are improved:  
- Fetch the system identifier from the source server before any  
WAL streaming loop.  This triggers extra checks to make sure that  
pg_receivewal is still connected to a server with the same system ID  
with a correct timeline.  
- Switch umask() (for file creation mode mask) and RetrieveWalSegSize()  
(to fetch the size of WAL segments) a bit later before the initial  
stream attempt.  If the connection was done with a database,  
pg_receivewal would fail but those commands were still executed, which  
was a waste.  The slot creation and drop are now done before retrieving  
the segment size.  
  
Author: Bharath Rupireddy  
Reviewed-by: Ronan Dunklau, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACX00YYeyBfoi55Cy=NrP-FcfMgiYYx1qRUEib3yjCVoaA@mail.gmail.com  

M src/bin/pg_basebackup/pg_receivewal.c

pageinspect: Make page deletion elog less chatty.

commit   : d7897abf9e0071946e9e4e8efd2d4463607c04de    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 17 Sep 2021 14:19:51 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 17 Sep 2021 14:19:51 -0700    

Click here for diff

An elog that reports the value of a transaction ID stored on a deleted  
nbtree page was added by commit e5d8a999, which taught page deletion to  
store full 64-bit XIDs.  It seems very chatty on further reflection, so  
lower its elevel from NOTICE to DEBUG2.  
  
Author: Peter Geoghegan <[email protected]>  
Backpatch: 14-, just like the nbtree XID enhancement.  

M contrib/pageinspect/btreefuncs.c

Fix pull_varnos to cope with translated PlaceHolderVars.

commit   : a21049fd3f64518c8a7227cf07c56f2543241db2    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 Sep 2021 15:41:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 Sep 2021 15:41:16 -0400    

Click here for diff

Commit 55dc86eca changed pull_varnos to use (if possible) the associated  
ph_eval_at for a PlaceHolderVar.  I missed a fine point though: we might  
be looking at a PHV in the quals or tlist of a child appendrel, in which  
case we need to compute a ph_eval_at value that's been translated in the  
same way that the PHV itself has been (cf. adjust_appendrel_attrs).  
Fortunately, enough info is available in the PlaceHolderInfo to make  
such translation possible without additional outside data, so we don't  
need another round of uglification of planner APIs.  This is a little  
bit complicated, but since it's a hard-to-hit corner case, I'm not much  
worried about adding cycles here.  
  
Per report from Jaime Casanova.  Back-patch to v12, like the previous  
commit.  
  
Discussion: https://postgr.es/m/20210915230959.GB17635@ahch-to  

M src/backend/optimizer/util/var.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Clarify some errors in pg_receivewal when closing WAL segments

commit   : cddcf7842c31b4d07ca75439f6b4ddacaadbbd0d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Sep 2021 15:53:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Sep 2021 15:53:01 +0900    

Click here for diff

A WAL segment closed during a WAL stream for pg_receivewal would  
generate incorrect error messages depending on the context, as the file  
name used when referring to a WAL segment ignored partial files or the  
compression method used.  In such cases, the error message generated  
(failure on close, seek or rename) would not match a physical file  
name.  The same code paths are used by pg_basebackup, but it uses no  
partial suffix so it is not impacted.  
  
7fbe0c8 has introduced in walmethods.c a callback to get the exact  
physical file name used for a given context, this commit makes use of it  
to improve those error messages.  This could be extended to more code  
paths of pg_basebackup/ in the future, if necessary.  
  
Extracted from a larger patch by the same author.  
  
Author: Georgios Kokolatos  
Discussion: https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me  

M src/bin/pg_basebackup/receivelog.c

Disable test for postgres -C on Msys

commit   : 5adb06732d7fac8171609392ea83f18bc8f285f4    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 Sep 2021 09:11:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 Sep 2021 09:11:47 +0900    

Click here for diff

The output generated on Msys is incorrect because of the different way  
IPC::Run processes outputs with native Perl (converts natively \r\n to  
\n) and Msys perl (\r\n kept as-is), causing this test to fail.  
  
For now, just disable the test to bring the buildfarm to a green state.  
I think that the correct long-term solution would be to tweak all the  
routines command_checks_* in PostgresNode.pm to handle this output like  
psql does when using Msys, by discarding \r automatically before  
comparing it.  
  
Per report from jacana and fairywren.  Thanks to Tom Lane for the ping.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_checksums/t/002_actions.pl

Fix EXPLAIN to handle SEARCH BREADTH FIRST queries.

commit   : 3f50b82639637c9908afa2087de7588450aa866b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 16 Sep 2021 10:45:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 16 Sep 2021 10:45:42 -0400    

Click here for diff

The rewriter transformation for SEARCH BREADTH FIRST produces a  
FieldSelect on a Var of type RECORD, where the Var references the  
recursive union's worktable output.  EXPLAIN VERBOSE failed to handle  
this case, because it only expected such Vars to appear in CteScans  
not WorkTableScans.  Fix that, and add some test cases exercising  
EXPLAIN on SEARCH and CYCLE queries.  
  
In principle this oversight is an old bug, but it seems that the  
case is unreachable without SEARCH BREADTH FIRST, because the  
parser fails when attempting to create such a reference manually.  
So for today I'll just patch HEAD/v14.  Someday we might find that  
the code portion of this patch needs to be back-patched further.  
  
Per report from Atsushi Torikoshi.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Message style improvements

commit   : 4ac0f450b698442c3273ddfe8eed0e1a7e56645f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 Sep 2021 14:48:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 Sep 2021 14:48:52 +0200    

Click here for diff

M src/backend/commands/typecmds.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/multirangetypes.c
M src/test/regress/expected/jsonb.out

process startup: Do InitProcess() at the same time regardless of EXEC_BACKEND.

commit   : 3d7c752a2f092b9f6581497009eacd10cab90548    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 03:23:05 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 03:23:05 -0700    

Click here for diff

An upcoming patch splits single user mode into its own function. This makes  
that easier. Split out for easier review / testing.  
  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c

Fix performance regression from session statistics.

commit   : 37a9aa659111c454386b7055dcd3809e45bc17de    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 02:02:40 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 16 Sep 2021 02:02:40 -0700    

Click here for diff

Session statistics, as introduced by 960869da08, had several shortcomings:  
  
- an additional GetCurrentTimestamp() call that also impaired the accuracy of  
  the data collected  
  
  This can be avoided by passing the current timestamp we already have in  
  pgstat_report_stat().  
  
- an additional statistics UDP packet sent every 500ms  
  
  This is solved by adding the new statistics to PgStat_MsgTabstat.  
  This is conceptually ugly, because session statistics are not  
  table statistics.  But the struct already contains data unrelated  
  to tables, so there is not much damage done.  
  
  Connection and disconnection are reported in separate messages, which  
  reduces the number of additional messages to two messages per session and a  
  slight increase in PgStat_MsgTabstat size (but the same number of table  
  stats fit).  
  
- Session time computation could overflow on systems where long is 32 bit.  
  
Reported-By: Andres Freund <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/20210801205501.nyxzxoelqoo4x2qc%40alap3.anarazel.de  
Backpatch: 14-, where the feature was introduced.  

M src/backend/postmaster/pgstat.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/backend_status.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Fix variable shadowing in procarray.c.

commit   : dc899146dbf0e1d23fb24155a5155826ddce34c9    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 13:06:21 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 13:06:21 +0900    

Click here for diff

ProcArrayGroupClearXid function has a parameter named "proc",  
but the same name was used for its local variables. This commit fixes  
this variable shadowing, to improve code readability.  
  
Back-patch to all supported versions, to make future back-patching  
easy though this patch is classified as refactoring only.  
  
Reported-by: Ranier Vilela  
Author: Ranier Vilela, Aleksander Alekseev  
https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com  

M src/backend/storage/ipc/procarray.c

Use int instead of size_t in procarray.c.

commit   : 64a62ebeeb84af2a51b963a1737f804a0fed4246    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 12:52:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 16 Sep 2021 12:52:30 +0900    

Click here for diff

All size_t variables declared in procarray.c are actually int ones.  
Let's use int instead of size_t for those variables. Which would  
reduce Wsign-compare compiler warnings.  
  
Back-patch to v14 where commit 941697c3c1 added size_t variables  
in procarray.c, to make future back-patching easy though  
this patch is classified as refactoring only.  
  
Reported-by: Ranier Vilela  
Author: Ranier Vilela, Aleksander Alekseev  
https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com  

M src/backend/storage/ipc/procarray.c

Support "postgres -C" with runtime-computed GUCs

commit   : 0c39c292077ef3ba987ced0dc6ea1c8f4f1e1f4b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 Sep 2021 10:59:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 Sep 2021 10:59:26 +0900    

Click here for diff

Until now, the -C option of postgres was handled before a small subset  
of GUCs computed at runtime are initialized, leading to incorrect  
results as GUC machinery would fall back to default values for such  
parameters.  
  
For example, data_checksums could report "off" for a cluster as the  
control file is not loaded yet.  Or wal_segment_size would show a  
segment size at 16MB even if initdb --wal-segsize used something else.  
Worse, the command would fail to properly report the recently-introduced  
shared_memory, that requires to load shared_preload_libraries as these  
could ask for a chunk of shared memory.  
  
Support for runtime GUCs comes with a limitation, as the operation is  
now allowed on a running server.  One notable reason for this is that  
_PG_init() functions of loadable libraries are called before all  
runtime-computed GUCs are initialized, and this is not guaranteed to be  
safe to do on running servers.  For the case of shared_memory_size,  
where we want to know how much memory would be used without allocating  
it, this limitation is fine.  Another case where this will help is for  
huge pages, with the introduction of a different GUC to evaluate the  
amount of huge pages required for a server before starting it, without  
having to allocate large chunks of memory.  
  
This feature is controlled with a new GUC flag, and four parameters are  
classified as runtime-computed as of this change:  
- data_checksums  
- shared_memory_size  
- data_directory_mode  
- wal_segment_size  
  
Some TAP tests are added to provide some coverage here, using  
data_checksums in the tests of pg_checksums.  
  
Per discussion with Andres Freund, Justin Pryzby, Magnus Hagander and  
more.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/postgres-ref.sgml
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc.c
M src/bin/pg_checksums/t/002_actions.pl
M src/include/utils/guc.h

process startup: Initialize PgStartTime earlier in single user mode.

commit   : 2c7615f77b8d84130d304365aa2235eea7b5949c    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 15 Sep 2021 13:16:00 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 15 Sep 2021 13:16:00 -0700    

Click here for diff

An upcoming patch splits single user mode handling out of PostgresMain(). The  
startup time only needs to be determined in single user mode. Currently the  
initialization happens late, which makes the split a bit harder. As postmaster  
determines the time earlier it makes sense to move the time for single user  
mode to a roughly similar point in time.  
  
Reviewd-By: Kyotaro Horiguchi <[email protected]>  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/postgres.c

Remove arbitrary 64K-or-so limit on rangetable size.

commit   : e3ec3c00d85bd2844ffddee83df2bd67c4f8297f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 14:11:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 14:11:21 -0400    

Click here for diff

Up to now the size of a query's rangetable has been limited by the  
constants INNER_VAR et al, which mustn't be equal to any real  
rangetable index.  65000 doubtless seemed like enough for anybody,  
and it still is orders of magnitude larger than the number of joins  
we can realistically handle.  However, we need a rangetable entry  
for each child partition that is (or might be) processed by a query.  
Queries with a few thousand partitions are getting more realistic,  
so that the day when that limit becomes a problem is in sight,  
even if it's not here yet.  Hence, let's raise the limit.  
  
Rather than just increase the values of INNER_VAR et al, this patch  
adopts the approach of making them small negative values, so that  
rangetables could theoretically become as long as INT_MAX.  
  
The bulk of the patch is concerned with changing Var.varno and some  
related variables from "Index" (unsigned int) to plain "int".  This  
is basically cosmetic, with little actual effect other than to help  
debuggers print their values nicely.  As such, I've only bothered  
with changing places that could actually see INNER_VAR et al, which  
the parser and most of the planner don't.  We do have to be careful  
in places that are performing less/greater comparisons on varnos,  
but there are very few such places, other than the IS_SPECIAL_VARNO  
macro itself.  
  
A notable side effect of this patch is that while it used to be  
possible to add INNER_VAR et al to a Bitmapset, that will now  
draw an error.  I don't see any likelihood that it wouldn't be a  
bug to include these fake varnos in a bitmapset of real varnos,  
so I think this is all to the good.  
  
Although this touches outfuncs/readfuncs, I don't think a catversion  
bump is required, since stored rules would never contain Vars  
with these fake varnos.  
  
Andrey Lepikhov and Tom Lane, after a suggestion by Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execScan.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h

Add Cardinality typedef

commit   : 6fe0eb963d3894ae9b0b6e151083887b664d45a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 18:56:13 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 18:56:13 +0200    

Click here for diff

Similar to Cost and Selectivity, this is just a double, which can be  
used in path and plan nodes to give some hint about the meaning of a  
field.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h

Disallow LISTEN in background workers.

commit   : 1316be28664f1834ac091113217537101331bdf3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 12:31:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 Sep 2021 12:31:56 -0400    

Click here for diff

It's possible to execute user-defined SQL in some background processes;  
for example, logical replication workers can fire triggers.  This opens  
the possibility that someone would try to execute LISTEN in such a  
context.  But since only regular backends ever call  
ProcessNotifyInterrupt, no messages would actually be received, and  
thus the registered listener would simply prevent the message queue  
from being cleaned.  Eventually NOTIFY would stop working, which is bad.  
  
Perhaps someday somebody will invent infrastructure to make listening  
in a background worker actually useful.  In the meantime, forbid it.  
  
Back-patch to v13, which is where we introduced the MyBackendType  
variable.  It'd be a lot harder to implement the check without that,  
and it doesn't seem worth the trouble.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/utility.c

Make node output prefix match node structure name

commit   : e58136069687b9cf29c27281e227ac397d72141d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 16:35:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 16:35:41 +0200    

Click here for diff

In most cases, the prefix string in a node output is the upper case of  
the node structure name, e.g., MergeAppend -> MERGEAPPEND.  There were  
a few exceptions that for either no apparent reason or perhaps minor  
aesthetic reasons deviated from this.  In order to simplify this and  
perhaps allow automatic generation without having to deal with  
exception cases, make them all match.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

Fix hash_array

commit   : 851ff9335742d22a3cb1a5ab789208e4ee01dcef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 11:59:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 11:59:34 +0200    

Click here for diff

Commit a3d2b1bbe904b0ca8d9fdde20f25295ff3e21f79 neglected to  
initialize the type_id field of the synthesized type cache entry, so  
it would make a new one on every call.  
  
Also, better use the per-function memory context for this; otherwise  
it leaks memory.  
  
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org  

M src/backend/utils/adt/arrayfuncs.c

doc: Clarify refresh options for DROP PUBLICATION

commit   : 379591fecf7c1011b72ddc0ffceae7a3f18b8320    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Sep 2021 09:54:45 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 15 Sep 2021 09:54:45 +0200    

Click here for diff

The available refresh options are specified as refresh_options under  
REFRESH PUBLICATION, and DROP PUBLICATION itself has an option named  
refresh. Clarify what we mean by refresh options to avoid confusion.  
  
Backpatch through v14 where ALTER SUBSCRIPTION ... DROP PUBLICATION  
was introduced.  
  
Author: Masahiko Sawada <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Peter Smith <[email protected]>  
Discussion: https://postgr.es/m/CAD21AoCm1wJ3A8Q9EmBjRbShYkJ+o+Oa_z9O0hvwhvhUa2BSyg@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/alter_subscription.sgml

Fix incorrect format placeholders

commit   : e03b807e12bbb72d53ed53502dfb2c1e063e467c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 09:19:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 09:19:01 +0200    

Click here for diff

Also remove obsolete comments about why the 64-bit integers need to be  
printed in a separate buffer.  The reason used to be portability, but  
now the remaining reason is that we need the string lengths for the  
progress displays.  That is evident by looking at the code right  
below, so a new comment doesn't seem necessary.  

M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/pg_rewind.c

Update Unicode data to Unicode 14.0.0

commit   : f7e56f1f540fbef204a03094b97ddfe908c44070    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 08:04:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 Sep 2021 08:04:49 +0200    

Click here for diff

M src/Makefile.global.in
M src/include/common/unicode_combining_table.h
M src/include/common/unicode_east_asian_fw_table.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_normprops_table.h

Update README for resource owners about the resource types supported

commit   : cae6fc2bc27cdb072693076249ce688f048ca7b7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 Sep 2021 10:47:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 Sep 2021 10:47:44 +0900    

Click here for diff

All the types supported were listed directly in the README, but it was  
very outdated.  Rather than listing all the types supported in the  
README, this commit adds a reference to look at ResourceOwnerData in  
resowner.c to get this information.  
  
The order of the paragraphs is reworked a bit for clarity.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqHtfT9z=4H5+F7DOy0OyNHAaVwuRcakt9b2t2uADOaiag@mail.gmail.com  

M src/backend/utils/resowner/README

Improve log messages from pg_import_system_collations().

commit   : 69e31d05b0a33f55aa5d9540917540f5fccb93a7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 18:55:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 18:55:15 -0400    

Click here for diff

pg_import_system_collations() was a bit inconsistent about how it  
reported locales (names output by "locale -a") that it didn't make  
pg_collation entries for.  IMV we should print some suitable message  
for every locale that we reject, except when it matches a pre-existing  
pg_collation entry.  (This is all at DEBUG1 log level, though, so as  
not to create noise during initdb.)  Add messages for the two cases  
that were previously not logged, namely unrecognized encoding and  
client-only encoding.  Re-word the existing messages to have a  
consistent style.  
  
Anton Voloshin and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/collationcmds.c

Send NOTIFY signals during CommitTransaction.

commit   : 2e4eae87d02fef51c42c2028b65d85b9e051f9eb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 17:18:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 17:18:25 -0400    

Click here for diff

Formerly, we sent signals for outgoing NOTIFY messages within  
ProcessCompletedNotifies, which was also responsible for sending  
relevant ones of those messages to our connected client.  It therefore  
had to run during the main-loop processing that occurs just before  
going idle.  This arrangement had two big disadvantages:  
  
* Now that procedures allow intra-command COMMITs, it would be  
useful to send NOTIFYs to other sessions immediately at COMMIT  
(though, for reasons of wire-protocol stability, we still shouldn't  
forward them to our client until end of command).  
  
* Background processes such as replication workers would not send  
NOTIFYs at all, since they never execute the client communication  
loop.  We've had requests to allow triggers running in replication  
workers to send NOTIFYs, so that's a problem.  
  
To fix these things, move transmission of outgoing NOTIFY signals  
into AtCommit_Notify, where it will happen during CommitTransaction.  
Also move the possible call of asyncQueueAdvanceTail there, to  
ensure we don't bloat the async SLRU if a background worker sends  
many NOTIFYs with no one listening.  
  
We can also drop the call of asyncQueueReadAllNotifications,  
allowing ProcessCompletedNotifies to go away entirely.  That's  
because commit 790026972 added a call of ProcessNotifyInterrupt  
adjacent to PostgresMain's call of ProcessCompletedNotifies,  
and that does its own call of asyncQueueReadAllNotifications,  
meaning that we were uselessly doing two such calls (inside two  
separate transactions) whenever inbound notify signals coincided  
with an outbound notify.  We need only set notifyInterruptPending  
to ensure that ProcessNotifyInterrupt runs, and we're done.  
  
The existing documentation suggests that custom background workers  
should call ProcessCompletedNotifies if they want to send NOTIFY  
messages.  To avoid an ABI break in the back branches, reduce it  
to an empty routine rather than removing it entirely.  Removal  
will occur in v15.  
  
Although the problems mentioned above have existed for awhile,  
I don't feel comfortable back-patching this any further than v13.  
There was quite a bit of churn in adjacent code between 12 and 13.  
At minimum we'd have to also backpatch 51004c717, and a good deal  
of other adjustment would also be needed, so the benefit-to-risk  
ratio doesn't look attractive.  
  
Per bug #15293 from Michael Powers (and similar gripes from others).  
  
Artur Zakirov and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/xact.c
M src/backend/commands/async.c
M src/backend/tcop/postgres.c
M src/include/commands/async.h

Fix planner error with multiple copies of an AlternativeSubPlan.

commit   : e8638d78a2cb94efba11a5dfbf3e7cd746d0af3e    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 15:11:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 Sep 2021 15:11:21 -0400    

Click here for diff

It's possible for us to copy an AlternativeSubPlan expression node  
into multiple places, for example the scan quals of several  
partition children.  Then it's possible that we choose a different  
one of the alternatives as optimal in each place.  Commit 41efb8340  
failed to consider this scenario, so its attempt to remove "unused"  
subplans could remove subplans that were still used elsewhere.  
  
Fix by delaying the removal logic until we've examined all the  
AlternativeSubPlans in a given query level.  (This does assume that  
AlternativeSubPlans couldn't get copied to other query levels, but  
for the foreseeable future that's fine; cf qual_is_pushdown_safe.)  
  
Per report from Rajkumar Raghuwanshi.  Back-patch to v14  
where the faulty logic came in.  
  
Discussion: https://postgr.es/m/CAKcux6==O3NNZC3bZ2prRYv3cjm3_Zw1GfzmOjEVqYN4jub2+Q@mail.gmail.com  

M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Add WRITE_INDEX_ARRAY

commit   : bdeb2c4ec2700bfa561061ccd19181326ee01c3f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    

Click here for diff

We have a few WRITE_{name of type}_ARRAY macros, but the one case  
using the Index type was hand-coded.  Wrap it into a macro as well.  
  
This also changes the behavior slightly: Before, the field name was  
skipped if the length was zero.  Now it prints the field name even in  
that case.  This is more consistent with how other array fields are  
handled.  
  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/nodes/outfuncs.c

Add COPY_ARRAY_FIELD and COMPARE_ARRAY_FIELD

commit   : 308da179e7c2c41c146e23a1418f6419aee340af    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    

Click here for diff

These handle node fields that are inline arrays (as opposed to  
dynamically allocated arrays handled by COPY_POINTER_FIELD and  
COMPARE_POINTER_FIELD).  These cases were hand-coded until now.  
  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c

Remove T_Expr

commit   : 85399291977324d5c9f634a9a9d6d8591bfe7520    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 Sep 2021 09:34:50 +0200    

Click here for diff

This is an abstract node that shouldn't have a node tag defined.  
  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/nodes/nodes.h

jit: Do not try to shut down LLVM state in case of LLVM triggered errors.

commit   : edb4d95ddf8984ad5b24d964d45884977d2fde4b    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 18:07:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 13 Sep 2021 18:07:19 -0700    

Click here for diff

If an allocation failed within LLVM it is not safe to call back into LLVM as  
LLVM is not generally safe against exceptions / stack-unwinding. Thus errors  
while in LLVM code are promoted to FATAL. However llvm_shutdown() did call  
back into LLVM even in such cases, while llvm_release_context() was careful  
not to do so.  
  
We cannot generally skip shutting down LLVM, as that can break profiling. But  
it's OK to do so if there was an error from within LLVM.  
  
Reported-By: Jelte Fennema <[email protected]>  
Author: Andres Freund <[email protected]>  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178C52CCA0A8DEA0207DC14F7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com  
Backpatch: 11-, where jit was introduced  

M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/include/jit/llvmjit.h

Remove code duplication for permission checks with replication slots

commit   : 026ed8efd6b1d774924937baf3209b676df4531f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 14 Sep 2021 10:15:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 14 Sep 2021 10:15:49 +0900    

Click here for diff

Two functions, both named check_permissions(), used the same checks to  
verify if a user had required privileges to work on replication slots.  
This commit removes the duplication, and moves the function doing the  
checks to slot.c to be centralized.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart, Euler Taveira  
Discussion: https://postgr.es/m/CALj2ACUPpVw1u7sQocFVWrSs0n10pt_G_4NPZKSxXK6cW1dErw@mail.gmail.com  

M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h

Clear conn->errorMessage at successful completion of PQconnectdb().

commit   : 138531f1bbc333745bd8422371c07e7e108d5528    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 16:53:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 16:53:11 -0400    

Click here for diff

Commits ffa2e4670 and 52a10224e caused libpq's connection-establishment  
functions to usually leave a nonempty string in the connection's  
errorMessage buffer, even after a successful connection.  While that  
was intentional on my part, more sober reflection says that it wasn't  
a great idea: the string would be a bit confusing.  Also this broke at  
least one application that checked for connection success by examining  
the errorMessage, instead of using PQstatus() as documented.  Let's  
clear the buffer at success exit, restoring the pre-v14 behavior.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c

Doc: improve documentation of CREATE/ALTER SUBSCRIPTION.

commit   : 1882d6cca161dcf9fa05ecab5abeb1a027a5cfd2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 14:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 14:27:02 -0400    

Click here for diff

Improve the descriptions of some options.  Fix sloppy grammar and markup.  
  
Peter Smith and Tom Lane  
  
Discussion: https://postgr.es/m/CAHut+PtPJDSOxtuMGpO2yDrRPKxcYGL4n7HqJP9HernZE=Cj+g@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml

Fix EXIT out of outermost block in plpgsql.

commit   : 1bf2518dd67be58b207979a66db7bb7c94b93a62    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 12:42:03 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 Sep 2021 12:42:03 -0400    

Click here for diff

Ordinarily, using EXIT this way would draw "control reached end of  
function without RETURN".  However, if the function is one where we  
don't require an explicit RETURN (such as a DO block), that should  
not happen.  It did anyway, because add_dummy_return() neglected to  
account for the case.  
  
Per report from Herwig Goemans.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_control.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_control.sql

Fix reorder buffer memory accounting for toast changes.

commit   : df3640e5293dccbf964508babfc067282ea7a2fc    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 10:24:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 10:24:00 +0530    

Click here for diff

While processing toast changes in logical decoding, we rejigger the  
tuple change to point to in-memory toast tuples instead to on-disk toast  
tuples. And, to make sure the memory accounting is correct, we were  
subtracting the old change size and then after re-computing the new tuple,  
re-adding its size at the end. Now, if there is any error before we add  
the new size, we will release the changes and that will update the  
accounting info (subtracting the size from the counters). And we were  
underflowing there which leads to an assertion failure in assert enabled  
builds and wrong memory accounting in reorder buffer otherwise.  
  
Author: Bertrand Drouvot  
Reviewed-by: Amit Kapila  
Backpatch-through: 13, where memory accounting was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/reorderbuffer.c

Fix error handling with threads on OOM in ECPG connection logic

commit   : fa703b317e9d261ffd34bbf5651ea29aff3ff0f0    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 13:23:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 13:23:50 +0900    

Click here for diff

An out-of-memory failure happening when allocating the structures to  
store the connection parameter keywords and values would mess up with  
the set of connections saved, as on failure the pthread mutex would  
still be hold with the new connection object listed but free()'d.  
  
Rather than just unlocking the mutex, which would leave the static list  
of connections into an inconsistent state, move the allocation for the  
structures of the connection parameters before beginning the test  
manipulation.  This ensures that the list of connections and the  
connection mutex remain consistent all the time in this code path.  
  
This error is unlikely going to happen, but this could mess up badly  
with ECPG clients in surprising ways, so backpatch all the way down.  
  
Reported-by: ryancaicse  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M src/interfaces/ecpg/ecpglib/connect.c

Doc: Change optional parameters grouping in Create Subscription.

commit   : fee1040fe330bd17054fc7e4296e9cde203ede0f    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 08:29:10 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 13 Sep 2021 08:29:10 +0530    

Click here for diff

The subscription parameters are rearranged into two groups:  
a) those that control what happens during Create Subscription  
b) those that control the replication behavior  
  
This makes the documentation of Create Subscription easier to follow.  
  
Author: Peter Smith  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PtPJDSOxtuMGpO2yDrRPKxcYGL4n7HqJP9HernZE=Cj+g@mail.gmail.com  

M doc/src/sgml/ref/create_subscription.sgml

Add regression tests for csvlog with the logging collector

commit   : 72b76f76161c78dd1be42592c4e5b980beef5f26    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 10:23:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 10:23:59 +0900    

Click here for diff

These are added in the existing tests of pg_ctl for log rotation, that  
already tested stderr.  The same amount of coverage is added for csvlog:  
- Checks for pg_current_logfile().  
- Log rotation with expected file name.  
- Log contents generated.  
  
This test is refactored to minimize the amount of work required to add  
tests for new log formats, easing some upcoming work.  
  
Author: Michael Paquier, Sehrope Sarkuni  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M src/bin/pg_ctl/t/004_logrotate.pl

Refactor the syslogger pipe protocol to use a bitmask for its options

commit   : 2d77d835403a20b51e17e59f0343ddc17f431eec    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 09:03:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 13 Sep 2021 09:03:45 +0900    

Click here for diff

The previous protocol expected a set of matching characters to check if  
a message sent was the last one or not, that changed depending on the  
destination wanted:  
- 't' and 'f' tracked the last message of a log sent to stderr.  
- 'T' and 'F' tracked the last message of a log sent to csvlog.  
  
This could be extended with more characters when introducing new  
destinations, but using a bitmask is much more elegant.  This commit  
changes the protocol so as a bitmask is used in the header of a log  
chunk message sent to the syslogger, with the following options  
available for now:  
- log_destination as stderr.  
- log_destination as csvlog.  
- if a message is the last chunk of a message.  
  
Sehrope found this issue in a patch set to introduce JSON as an option  
for log_destination, but his patch made the size of the protocol header  
larger.  This commit keeps the same size as the original, and adapts the  
protocol as wanted.  
  
Thanks also to Andrew Dunstan and Greg Stark for the discussion.  
  
Author: Michael Paquier, Sehrope Sarkuni  
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com  

M src/backend/postmaster/syslogger.c
M src/backend/utils/error/elog.c
M src/include/postmaster/syslogger.h

Make pg_regexec() robust against out-of-range search_start.

commit   : e757080e041214cf6983e3e77ef01e83f1371d72    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 11 Sep 2021 15:19:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 11 Sep 2021 15:19:31 -0400    

Click here for diff

If search_start is greater than the length of the string, we should just  
return REG_NOMATCH immediately.  (Note that the equality case should  
*not* be rejected, since the pattern might be able to match zero  
characters.)  This guards various internal assumptions that the min of a  
range of string positions is not more than the max.  Violation of those  
assumptions could allow an attempt to fetch string[search_start-1],  
possibly causing a crash.  
  
Jaime Casanova pointed out that this situation is reachable with the  
new regexp_xxx functions that accept a user-specified start position.  
I don't believe it's reachable via any in-core call site in v14 and  
below.  However, extensions could possibly call pg_regexec with an  
out-of-range search_start, so let's back-patch the fix anyway.  
  
Discussion: https://postgr.es/m/20210911180357.GA6870@ahch-to  

M src/backend/regex/regexec.c

Fix some anomalies with NO SCROLL cursors.

commit   : c1b7a6c2731241cf5af4c08de54a64fc8999d727    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 10 Sep 2021 13:18:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 10 Sep 2021 13:18:32 -0400    

Click here for diff

We have long forbidden fetching backwards from a NO SCROLL cursor,  
but the prohibition didn't extend to cases in which we rewind the  
query altogether and then re-fetch forwards.  I think the reason is  
that this logic was mainly meant to protect plan nodes that can't  
be run in the reverse direction.  However, re-reading the query output  
is problematic if the query is volatile (which includes SELECT FOR  
UPDATE, not just queries with volatile functions): the re-read can  
produce different results, which confuses the cursor navigation logic  
completely.  Another reason for disliking this approach is that some  
code paths will either fetch backwards or rewind-and-fetch-forwards  
depending on the distance to the target row; so that seemingly  
identical use-cases may or may not draw the "cursor can only scan  
forward" error.  Hence, let's clean things up by disallowing rewind  
as well as fetch-backwards in a NO SCROLL cursor.  
  
Ordinarily we'd only make such a definitional change in HEAD, but  
there is a third reason to consider this change now.  Commit ba2c6d6ce  
created some new user-visible anomalies for non-scrollable cursors  
WITH HOLD, in that navigation in the cursor result got confused if the  
cursor had been partially read before committing.  The only good way  
to resolve those anomalies is to forbid rewinding such a cursor, which  
allows removal of the incorrect cursor state manipulations that  
ba2c6d6ce added to PersistHoldablePortal.  
  
To minimize the behavioral change in the back branches (including  
v14), refuse to rewind a NO SCROLL cursor only when it has a holdStore,  
ie has been held over from a previous transaction due to WITH HOLD.  
This should avoid breaking most applications that have been sloppy  
about whether to declare cursors as scrollable.  We'll enforce the  
prohibition across-the-board beginning in v15.  
  
Back-patch to v11, as ba2c6d6ce was.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/portalcmds.c
M src/backend/tcop/pquery.c
M src/test/regress/expected/portals.out
M src/test/regress/expected/tablesample.out
M src/test/regress/sql/portals.sql
M src/test/regress/sql/tablesample.sql

Update src/test/kerberos to account for previous commit.

commit   : 2d689f2ee4615629867c4319a35533696cd16589    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 10 Sep 2021 00:44:01 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 10 Sep 2021 00:44:01 -0700    

Click here for diff

M src/test/kerberos/t/001_auth.pl

Revoke PUBLIC CREATE from public schema, now owned by pg_database_owner.

commit   : b073c3ccd06e4cb845e121387a43faa8c68a7b62    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 9 Sep 2021 23:38:09 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 9 Sep 2021 23:38:09 -0700    

Click here for diff

This switches the default ACL to what the documentation has recommended  
since CVE-2018-1058.  Upgrades will carry forward any old ownership and  
ACL.  Sites that declined the 2018 recommendation should take a fresh  
look.  Recipes for commissioning a new database cluster from scratch may  
need to create a schema, grant more privileges, etc.  Out-of-tree test  
suites may require such updates.  
  
Reviewed by Peter Eisentraut.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ddl.sgml
M doc/src/sgml/user-manag.sgml
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_namespace.dat
M src/pl/plperl/expected/plperl_setup.out
M src/pl/plperl/sql/plperl_setup.sql
M src/test/regress/input/tablespace.source
M src/test/regress/output/tablespace.source

Avoid fetching from an already-terminated plan.

commit   : cba79a163267a44205e391137deb543f4f89bc8b    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 13:36:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 13:36:31 -0400    

Click here for diff

Some plan node types don't react well to being called again after  
they've already returned NULL.  PortalRunSelect() has long dealt  
with this by calling the executor with NoMovementScanDirection  
if it sees that we've already run the portal to the end.  However,  
commit ba2c6d6ce overlooked this point, so that persisting an  
already-fully-fetched cursor would fail if it had such a plan.  
  
Per report from Tomas Barton.  Back-patch to v11, as the faulty  
commit was.  (I've omitted a test case because the type of plan  
that causes a problem isn't all that stable.)  
  
Discussion: https://postgr.es/m/CAPV2KRjd=ErgVGbvO2Ty20tKTEZZr6cYsYLxgN_W3eAo9pf5sw@mail.gmail.com  

M src/backend/commands/portalcmds.c

pgbench: Stop counting skipped transactions as soon as timer is exceeded.

commit   : 9bcbd7c581a5de3b915ef8fe0262e4abd9cb6e59    
  
author   : Fujii Masao <[email protected]>    
date     : Fri, 10 Sep 2021 01:28:17 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Fri, 10 Sep 2021 01:28:17 +0900    

Click here for diff

When throttling is used, transactions that lag behind schedule by  
more than the latency limit are counted and reported as skipped.  
Previously, there was the case where pgbench counted all skipped  
transactions even if the timer specified in -T option was exceeded.  
This could take a very long time to do that especially when unrealistically  
high rate setting in -R option caused quite a lot of transactions that  
lagged behind schedule. This could prevent pgbench from ending  
immediately, and so pgbench could look like it got stuck to users.  
  
To fix the issue, this commit changes pgbench so that it stops counting  
skipped transactions as soon as the timer is exceeded. The timer can  
make pgbench end soon even when there are lots of skipped transactions  
that have not been counted yet.  
  
Note that there is no guarantee that all skipped transactions are  
counted under -T though there is under -t. This is OK in practice  
because it's very unlikely to happen with realistic setting. Also this is  
not the issue that this commit newly introdues. There used to be  
the case where pgbench ended without counting all skipped  
transactions since before.  
  
Back-patch to v14. Per discussion, we decided not to bother  
back-patch to the stable branches because it's hard to imagine  
the issue happens in practice (with realistic setting).  
  
Author: Yugo Nagata, Fabien COELHO  
Reviewed-by: Greg Sabino Mullane, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Check for relation length overrun soon enough.

commit   : 8481f99896a192e9fd57f5e1a99e255e27680a10    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 11:45:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 Sep 2021 11:45:48 -0400    

Click here for diff

We don't allow relations to exceed 2^32-1 blocks, because block  
numbers are 32 bits and the last possible block number is reserved  
to mean InvalidBlockNumber.  There is a check for this in mdextend,  
but that's really way too late, because the smgr API requires us to  
create a buffer for the block-to-be-added, and we do not want to  
have any buffer with blocknum InvalidBlockNumber.  (Such a case  
can trigger assertions in bufmgr.c, plus I think it might confuse  
ReadBuffer's logic for data-past-EOF later on.)  So put the check  
into ReadBuffer.  
  
Per report from Christoph Berg.  It's been like this forever,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/smgr/md.c

Fix issue with WAL archiving in standby.

commit   : 596ba75cb11173a528c6b6ec0142a282e42b69ec    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 9 Sep 2021 23:56:57 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 9 Sep 2021 23:56:57 +0900    

Click here for diff

Previously, walreceiver always closed the currently-opened WAL segment  
and created its archive notification file, after it finished writing  
the current segment up and received any WAL data that should be  
written into the next segment. If walreceiver exited just before  
any WAL data in the next segment arrived at standby, it did not  
create the archive notification file of the current segment  
even though that's known completed. This behavior could cause  
WAL archiving of the segment to be delayed until subsequent  
restartpoints or checkpoints created its notification file.  
  
To fix the issue, this commit changes walreceiver so that it creates  
an archive notification file of a current WAL segment immediately  
if that's known completed before receiving next WAL data.  
  
Back-patch to all supported branches.  
  
Reported-by: Kyotaro Horiguchi  
Author: Fujii Masao  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/walreceiver.c

Fix _equalA_Const

commit   : 0ffbe900ce599d204536b9623291e05e965da23e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 10:23:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 10:23:29 +0200    

Click here for diff

639a86e36aaecb84faaf941dcd0b183ba0aba9e9 neglected to make the  
necessary adjustments to _equalA_Const.  Found only via  
COPY_PARSE_PLAN_TREES.  

M src/backend/nodes/equalfuncs.c

Remove Value node struct

commit   : 639a86e36aaecb84faaf941dcd0b183ba0aba9e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 07:58:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 07:58:12 +0200    

Click here for diff

The Value node struct is a weird construct.  It is its own node type,  
but most of the time, it actually has a node type of Integer, Float,  
String, or BitString.  As a consequence, the struct name and the node  
type don't match most of the time, and so it has to be treated  
specially a lot.  There doesn't seem to be any value in the special  
construct.  There is very little code that wants to accept all Value  
variants but nothing else (and even if it did, this doesn't provide  
any convenient way to check it), and most code wants either just one  
particular node type (usually String), or it accepts a broader set of  
node types besides just Value.  
  
This change removes the Value struct and node type and replaces them  
by separate Integer, Float, String, and BitString node types that are  
proper node types and structs of their own and behave mostly like  
normal node types.  
  
Also, this removes the T_Null node tag, which was previously also a  
possible variant of Value but wasn't actually used outside of the  
Value contained in A_Const.  Replace that by an isnull field in  
A_Const.  
  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_enum.c
M src/backend/commands/copy.c
M src/backend/commands/define.c
M src/backend/commands/tsearchcmds.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/nodes/README
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/value.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc.c
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/value.h
M src/include/parser/parse_node.h

Remove useless casts

commit   : cbdf75bf8053f88bbae6b307f34ab057424a370f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 07:58:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 Sep 2021 07:58:12 +0200    

Click here for diff

Casting the argument of strVal() to (Value *) is useless, since  
strVal() already does that.  
  
Most code didn't do that anyway; this was apparently just a style that  
snuck into certain files.  
  
Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/comment.c
M src/backend/commands/dropcmds.c
M src/backend/commands/statscmds.c

Make shared_memory_size a preset option

commit   : 3b231596ccfc6bb6564c63a574e429765c0f775e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 9 Sep 2021 09:57:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 9 Sep 2021 09:57:28 +0900    

Click here for diff

bd17880 set up that as a memory parameter, but the docs told a different  
story.  A preset parameter is adapted here, as this option is compiled  
at startup time.  
  
Reported-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc.c

Avoid useless malloc/free traffic around getFormattedTypeName().

commit   : 072e2f8a62002cb01ed6c4e161442e133509349e    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 15:09:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 15:09:42 -0400    

Click here for diff

Coverity complained that one caller of getFormattedTypeName() failed  
to free the returned string.  Which is true, but rather than fixing  
that one, let's get rid of this tedious and error-prone requirement.  
Now that getFormattedTypeName() caches its result, strdup'ing that  
result and expecting the caller to free it accomplishes little except  
to waste cycles.  We do create a leak in the case where getTypes didn't  
make a TypeInfo for the type, but that basically shouldn't ever happen.  
  
Back-patch, as commit 6c450a861 was.  This isn't a particularly  
interesting bug fix, but the API change seems like a hazard for  
future back-patching activity if we don't back-patch it.  

M src/bin/pg_dump/pg_dump.c

Fix misleading comments about TOAST access macros.

commit   : 490798451a3adc32b71b30e285bd99875d67fa2b    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 14:11:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 14:11:35 -0400    

Click here for diff

Seems to have been my error in commit aeb1631ed.  
Noted by Christoph Berg.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/postgres.h

In psql tab completion, offer spelled-out commands not abbreviations.

commit   : 7cffa2ed0c9f7f4d96bac7af5284c47e82af5ffa    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 13:21:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 13:21:42 -0400    

Click here for diff

Various psql backslash commands have both single-letter and long  
forms, for example \e and \edit.  Previously, tab completion  
generally offered the single-letter form but not the long form.  
It seems more sensible to offer the long form, because (a) no  
useful completion can happen when you've already typed the single  
letter, and (b) if you're not so familiar with the command set  
as to know that, the long form is likely to be less confusing.  
  
Haiying Tang, reviewed by Dagfinn Ilmari Mannsåker and myself  
  
Discussion: https://postgr.es/m/OS0PR01MB61136018064660F095CB57A8FB129@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c

Fix rewriter to set hasModifyingCTE correctly on rewritten queries.

commit   : 362e2dcc46195faadd3fa0ba011dd9a8e3829e7a    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 12:05:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 8 Sep 2021 12:05:43 -0400    

Click here for diff

If we copy data-modifying CTEs from the original query to a replacement  
query (from a DO INSTEAD rule), we must set hasModifyingCTE properly  
in the replacement query.  Failure to do this can cause various  
unpleasantness, such as unsafe usage of parallel plans.  The code also  
neglected to propagate hasRecursive, though that's only cosmetic at  
the moment.  
  
A difficulty arises if the rule action is an INSERT...SELECT.  We  
attach the original query's RTEs and CTEs to the sub-SELECT Query, but  
data-modifying CTEs are only allowed to appear in the topmost Query.  
For the moment, throw an error in such cases.  It would probably be  
possible to avoid this error by attaching the CTEs to the top INSERT  
Query instead; but that would require a bunch of new code to adjust  
ctelevelsup references.  Given the narrowness of the use-case, and  
the need to back-patch this fix, it does not seem worth the trouble  
for now.  We can revisit this if we get field complaints.  
  
Per report from Greg Nancarrow.  Back-patch to all supported branches.  
(The test case added here does not fail before v10, but there are  
plenty of places checking top-level hasModifyingCTE in 9.6, so I have  
no doubt that this code change is necessary there too.)  
  
Greg Nancarrow and Tom Lane  
  
Discussion: https://postgr.es/m/CAJcOf-f68DT=26YAMz_i0+Au3TcLO5oiHY5=fL6Sfuits6r+_w@mail.gmail.com  
Discussion: https://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Consistently use "superuser" instead of "super user"

commit   : f7c53bb9e309cfea3206f4ed44b38eb2bd1cf726    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 8 Sep 2021 17:02:18 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 8 Sep 2021 17:02:18 +0200    

Click here for diff

The correct nomenclature for the highest privileged user is superuser  
and not "super user", this replaces the few instances where that was  
used erroneously. No user-visible changes are done as all changes are  
in comments, so no back-patching.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACW3snGBD8BAQiArMDS1Y43LuX3ymwO+N8aUg1Hrv6hYNw@mail.gmail.com  

M src/backend/commands/amcmds.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/tablespace.c
M src/test/regress/expected/conversion.out
M src/test/regress/sql/conversion.sql

Fix typo

commit   : 7390b6421a98b70554b6b5edea5d6e012dfdbbba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 16:48:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 16:48:51 +0200    

Click here for diff

M src/backend/utils/adt/jsonfuncs.c

Disable anonymous record hash support except in special cases

commit   : a3d2b1bbe904b0ca8d9fdde20f25295ff3e21f79    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 09:25:46 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 09:25:46 +0200    

Click here for diff

Commit 01e658fa74 added hash support for row types.  This also added  
support for hashing anonymous record types, using the same approach  
that the type cache uses for comparison support for record types: It  
just reports that it works, but it might fail at run time if a  
component type doesn't actually support the operation.  We get away  
with that for comparison because most types support that.  But some  
types don't support hashing, so the current state can result in  
failures at run time where the planner chooses hashing over sorting,  
whereas that previously worked if only sorting was an option.  
  
We do, however, want the record hashing support for path tracking in  
recursive unions, and the SEARCH and CYCLE clauses built on that.  In  
that case, hashing is the only plan option.  So enable that, this  
commit implements the following approach: The type cache does not  
report that hashing is available for the record type.  This undoes  
that part of 01e658fa74.  Instead, callers that require hashing no  
matter what can override that result themselves.  This patch only  
touches the callers to make the aforementioned recursive query cases  
work, namely the parse analysis of unions, as well as the hash_array()  
function.  
  
Reported-by: Sait Talha Nisanci <[email protected]>  
Bug: #17158  
Discussion: https://www.postgresql.org/message-id/flat/17158-8a2ba823982537a4%40postgresql.org  

M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/cache/typcache.c
M src/include/parser/analyze.h
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

postgres_fdw: Revert unstable tests for postgres_fdw.application_name.

commit   : 98dbef90eb29b13079ba3bd260b3c5818904ee86    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 8 Sep 2021 16:28:43 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 8 Sep 2021 16:28:43 +0900    

Click here for diff

Commit 449ab63505 added the tests that check that postgres_fdw.application_name  
GUC works as expected. But they were unstable and caused some buildfarm  
members to report the failure. This commit reverts those unstable tests.  
  
Reported-by: Tom Lane as per buildfarm  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Fix incorrect format placeholders

commit   : bb1412baa5b57652ef69f7e995657d085fd308e4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 08:52:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 8 Sep 2021 08:52:29 +0200    

Click here for diff

M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c

Invalidate relcache for publications defined for all tables.

commit   : 8bd534274099aabf721ca4baef2e8a3a379d7b02    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 8 Sep 2021 11:50:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 8 Sep 2021 11:50:37 +0530    

Click here for diff

Updates/Deletes on a relation were allowed even without replica identity  
after we define the publication for all tables. This would later lead to  
an error on subscribers. The reason was that for such publications we were  
not invalidating the relcache and the publication information for  
relations was not getting rebuilt. Similarly, we were not invalidating the  
relcache after dropping of such publications which will prohibit  
Updates/Deletes without replica identity even without any publication.  
  
Author: Vignesh C and Hou Zhijie  
Reviewed-by: Hou Zhijie, Kyotaro Horiguchi, Amit Kapila  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/CALDaNm0pF6zeWqCA8TCe2sDuwFAy8fCqba=nHampCKag-qLixg@mail.gmail.com  

M src/backend/catalog/dependency.c
M src/backend/commands/publicationcmds.c
M src/include/commands/publicationcmds.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Fix compilation warning in ipci.c

commit   : aa37a439db6bd328d68ce815ab9e12467f42493b    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 14:22:52 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 14:22:52 +0900    

Click here for diff

A Size had better use %zu when printed.  
  
Oversight in bd17880, per buildfarm member lapwing.  

M src/backend/storage/ipc/ipci.c

Introduce GUC shared_memory_size

commit   : bd1788051b02cfddcd9ef0e2fd094972f372b8fd    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 12:02:30 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 12:02:30 +0900    

Click here for diff

This runtime-computed GUC shows the size of the server's main shared  
memory area, taking into account the amount of shared memory allocated  
by extensions as this is calculated after processing  
shared_preload_libraries.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/misc/guc.c
M src/include/storage/ipc.h

Clean up some code using "(expr) ? true : false"

commit   : fd0625c7a9c679c0c1e896014b8f49a489c3a245    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 09:44:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 8 Sep 2021 09:44:04 +0900    

Click here for diff

All the code paths simplified here were already using a boolean or used  
an expression that led to zero or one, making the extra bits  
unnecessary.  
  
Author: Justin Pryzby  
Reviewed-by: Tom Lane, Michael Paquier, Peter Smith  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/_int_tool.c
M contrib/ltree/ltree_gist.c
M contrib/sepgsql/selinux.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/executor/spi.c
M src/backend/jit/jit.c
M src/backend/optimizer/util/pathnode.c
M src/backend/statistics/mcv.c
M src/backend/storage/file/buffile.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/fmgr/dfmgr.c

Consistently use read-only instead of "read only"

commit   : d6c916f020e291b45563d4e76a649e9364cb6f2d    
  
author   : Magnus Hagander <[email protected]>    
date     : Tue, 7 Sep 2021 21:59:25 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Tue, 7 Sep 2021 21:59:25 +0200    

Click here for diff

This affects one message and some documentation that used the format  
"read only", unlike everything else that used read-only.  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CABUevExuxKwn0YM3+wdSeQSvK6CRrJ-hewocGVX3R4-xVX4eMw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/mvcc.sgml
M src/backend/postmaster/postmaster.c

windows: Only consider us to be running as service if stderr is invalid.

commit   : 76e38b37a5f179d4c9d2865ff31b79130407530b    
  
author   : Andres Freund <[email protected]>    
date     : Tue, 7 Sep 2021 11:56:13 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Tue, 7 Sep 2021 11:56:13 -0700    

Click here for diff

Previously pgwin32_is_service() would falsely return true when postgres is  
started from somewhere within a service, but not as a service. That is  
e.g. always the case with windows docker containers, which some CI services  
use to run windows tests in.  
  
When postgres falsely thinks its running as a service, no messages are  
writting to stdout / stderr. That can be very confusing and causes a few tests  
to fail.  
  
To fix additionally check if stderr is invalid in pgwin32_is_service(). For  
that to work in backend processes, pg_ctl is changed to pass down handles so  
that postgres can do the same check (otherwise "default" handles are created).  
  
While this problem exists in all branches, there have been no reports by  
users, the prospective CI usage currently is only for master, and I am not a  
windows expert. So doing the change in only master for now seems the sanest  
approach.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Magnus Hagander <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c
M src/port/win32security.c

Fix missing words in comment.

commit   : 6ac763f19a6556c43933c5252065a5c81cde094d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Sep 2021 10:28:55 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 7 Sep 2021 10:28:55 +0300    

Click here for diff

Introduced by commit c3928b467a, backpatch to v14 like that one.  
  
Author: Amit Langote  
Discussion: https://www.postgresql.org/message-id/CA+HiwqFQgNLS6VGntMcuJV6erBFV425xA6wBVnY=41GK4zC0Bw@mail.gmail.com  

M src/backend/executor/nodeForeignscan.c

postgres_fdw: Allow application_name of remote connection to be set via GUC.

commit   : 449ab6350526e99d33363706b759951ebad7928e    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 7 Sep 2021 12:27:30 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 7 Sep 2021 12:27:30 +0900    

Click here for diff

This commit adds postgres_fdw.application_name GUC which specifies  
a value for application_name configuration parameter used  
when postgres_fdw establishes a connection to a foreign server.  
This GUC setting always overrides application_name option of  
the foreign server object. This GUC is useful when we want to  
specify our own application_name per remote connection.  
  
Previously application_name of a remote connection could be set  
basically only via options of a server object. But which meant that  
every session connecting to the same foreign server basically  
should use the same application_name. Also if we want to change  
the setting, we had to execute "ALTER SERVER ... OPTIONS ..." command.  
It was inconvenient.  
  
Author: Hayato Kuroda  
Reviewed-by: Masahiro Ikeda, Fujii Masao  
Discussion: https://postgr.es/m/TYCPR01MB5870D1E8B949DAF6D3B84E02F5F29@TYCPR01MB5870.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Log new catalog xmin candidate in LogicalIncreaseXminForSlot().

commit   : 4c3478859b7359912d7e99fea702c56b1f53000c    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 7 Sep 2021 08:07:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 7 Sep 2021 08:07:11 +0530    

Click here for diff

Similar to LogicalIncreaseRestartDecodingForSlot() add a debug message to  
LogicalIncreaseXminForSlot() reporting a new catalog_xmin candidate.  
  
This just adds additional diagnostic information during logical decoding that  
can aid debugging.  
  
Author: Ashutosh Bapat  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/CAExHW5usQWbiUz0hHOCu5twS1O9DvpcPojf6sor=8q--VUuMbA@mail.gmail.com  

M src/backend/replication/logical/logical.c

Further fix psql query-cancel test.

commit   : bd5846e4a9c1338ded5efcef53511f0d71f53f0e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 16:14:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 16:14:49 -0400    

Click here for diff

The query to wait for pg_sleep to be running did no such thing,  
because the regex pattern it used could match itself.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=conchuela&dt=2021-09-06%2018%3A00%3A20  

M src/bin/psql/t/020_cancel.pl

AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS.

commit   : 8670b9b999adb66e2e063225496962763c4c28de    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 6 Sep 2021 11:27:59 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 6 Sep 2021 11:27:59 -0700    

Click here for diff

We make each AIX shared library export all globals found in .o files  
that originate in the library.  That doesn't include symbols acquired by  
-lpgcommon_shlib.  That is good on average, but it became a problem for  
libpq when commit e6afa8918c461c1dd80c5063a950518fa4e950cd moved five  
official libpq API symbols into src/common.  Fix this by implementing  
the SHLIB_EXPORTS mechanism for AIX, so affected libraries export the  
same symbols that they export on Linux.  This reintroduces symbols  
pg_encoding_to_char, pg_utf_mblen, pg_char_to_encoding,  
pg_valid_server_encoding, and pg_valid_server_encoding_id.  Back-patch  
to v13, where the aforementioned commit first appeared.  While a minor  
release is usually the wrong time to add or remove symbol exports in  
libpq or libecpg, we should expect users to want each documented symbol.  
  
Tony Reix  
  
Discussion: https://postgr.es/m/PR3PR02MB6396742E2FC3E77D37A920BC86C79@PR3PR02MB6396.eurprd02.prod.outlook.com  

M src/Makefile.shlib
M src/port/README

Add PublicationTable and PublicationRelInfo structs

commit   : 0c6828fa987b791744b9c8685aadf1baa21f8977    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 6 Sep 2021 14:24:50 -0300    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 6 Sep 2021 14:24:50 -0300    

Click here for diff

These encapsulate a relation when referred from replication DDL.  
Currently they don't do anything useful (they're just wrappers around  
RangeVar and Relation respectively) but in the future they'll be used to  
carry column lists.  
  
Extracted from a larger patch by Rahila Syed.  
  
Author: Rahila Syed <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Amit Kapila <[email protected]>  
Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com  

M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/include/catalog/pg_publication.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/tools/pgindent/typedefs.list

Fix actively-misleading comments about the contents of struct pg_tm.

commit   : 89dba59590fdd03799a47daf8019890d4324fbcf    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:43:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:43:44 -0400    

Click here for diff

pgtime.h documented the PG interpretation of tm_mon right alongside  
the POSIX interpretation of tm_year, with no hint that neither  
comment was correct throughout our code.  
  
Perhaps someday we ought to switch to using two separate struct  
definitions to provide a clearer indication of which semantics are  
in use where.  But I fear the tedium-versus-safety-gain tradeoff  
would not be very good.  
  
Discussion: https://postgr.es/m/CAJ7c6TOMG8zSNEZtCn5SPe+cCk3Lfxb71ZaQwT2F4T7PJ_t=KA@mail.gmail.com  

M src/include/pgtime.h

Make timetz_zone() stable, and correct a bug for DYNTZ abbreviations.

commit   : 388e71af880d579212c2489686903c2cfdea9032    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:03:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 6 Sep 2021 11:03:56 -0400    

Click here for diff

Historically, timetz_zone() has used time(NULL) as the reference point  
for deciding whether DST is active.  That means its result can change  
intra-statement, requiring it to be marked VOLATILE (cf. 35979e6c3).  
But that definition is pretty inconsistent with the way we deal with  
timestamps elsewhere.  Let's make it use the transaction start time  
("now()") as the reference point instead.  That lets it be marked  
STABLE, and also saves a kernel call per invocation.  
  
While at it, remove the function's use of pg_time_t and pg_localtime.  
Those are inconsistent with the other code in this area, which indeed  
created a bug: timetz_zone() delivered completely wrong answers if  
the zone was specified by a dynamic TZ abbreviation.  (We need to do  
something about that in the back branches, but the fix will look  
different from this.)  
  
Aleksander Alekseev and Tom Lane  
  
Discussion: https://postgr.es/m/CAJ7c6TOMG8zSNEZtCn5SPe+cCk3Lfxb71ZaQwT2F4T7PJ_t=KA@mail.gmail.com  

M src/backend/utils/adt/date.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix typo in comments.

commit   : 78aa616be74a13156f4fc8db3a131f1fdc2cce47    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 6 Sep 2021 17:03:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 6 Sep 2021 17:03:40 +0900    

Click here for diff

Author: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB5716E6A6535FDFDC5A1B004194CE9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/parser/gram.y
M src/backend/utils/adt/xid8funcs.c

Improve fix pkg-config files for static linking

commit   : 55392bc5b0e0c1a8045627bbc41b4ec7143c4cc7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 6 Sep 2021 09:12:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 6 Sep 2021 09:12:34 +0200    

Click here for diff

Amend 4c2eab3a0dec2eae40892fb525830a5947a398c7 to link against the  
libraries without the "_shlib" suffix, since this is meant for static  
linking.  

M src/Makefile.shlib

Move the shared memory size calculation to its own function

commit   : 0bd305ee1d427ef29f5fa4fa20567e3b3f5ff792    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Sep 2021 10:59:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Sep 2021 10:59:20 +0900    

Click here for diff

This change refactors the shared memory size calculation in  
CreateSharedMemoryAndSemaphores() to its own function.  This is intended  
for use in a future change related to the setup of huge pages and shared  
memory with some GUCs, while useful on its own for extensions.  
  
Author: Nathan Bossart  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/ipc/ipci.c
M src/include/storage/ipc.h

Remove some unused variables in TAP tests

commit   : 5fcb23c18fe408bfc6669aa5bca2d21896f9fe90    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 6 Sep 2021 09:25:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 6 Sep 2021 09:25:45 +0900    

Click here for diff

Author: Amul Sul  
Discussion: https://postgr.es/m/CAAJ_b96xuFh4JZE6p-zhLyDu7q=NbxJfb1z_yeAu6t-MqaBC+Q@mail.gmail.com  

M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/test/modules/test_pg_dump/t/001_base.pl

Further portability tweaks for float4/float8 hash functions.

commit   : b30cc0fd6d5d96c63037824c286cec561e092b6f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 16:29:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 16:29:08 -0400    

Click here for diff

Attempting to make hashfloat4() look as much as possible like  
hashfloat8(), I'd figured I could replace NaNs with get_float4_nan()  
before widening to float8.  However, results from protosciurus  
and topminnow show that on some platforms that produces a different  
bit-pattern from get_float8_nan(), breaking the intent of ce773f230.  
Rearrange so that we use the result of get_float8_nan() for all NaN  
cases.  As before, back-patch.  

M src/backend/access/hash/hashfunc.c

Minor improvements for psql help output.

commit   : ac5ea660996ecbbfbe78b881a581132a95d93d26    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 13:27:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 4 Sep 2021 13:27:55 -0400    

Click here for diff

Fix alphabetization of the output of "\?", and improve one description.  
  
Update PageOutput counts where needed, fixing breakage from previous  
patches.  
  
Haiying Tang (PageOutput fixes by me)  
  
Discussion: https://postgr.es/m/OS0PR01MB61136018064660F095CB57A8FB129@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/bin/psql/help.c

Revert "Avoid creating archive status ".ready" files too early"

commit   : 96b665083eb72570e226cf2d25c960b3acc62040    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 4 Sep 2021 12:14:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 4 Sep 2021 12:14:30 -0400    

Click here for diff

This reverts commit 515e3d84a0b5 and equivalent commits in back  
branches.  This solution to the problem has a number of problems, so  
we'll try again with a different approach.  
  
Per note from Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog.h
M src/include/access/xlogarchive.h
M src/include/access/xlogdefs.h

Remove arbitrary MAXPGPATH limit on command lengths in pg_ctl.

commit   : 87ad491472d6f8620d83ec9db4f515ce303052ac    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 21:04:44 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 21:04:44 -0400    

Click here for diff

Replace fixed-length command buffers with psprintf() calls.  We didn't  
have anything as convenient as psprintf() when this code was written,  
but now that we do, there's little reason for the limitation to  
stand.  Removing it eliminates some corner cases where (for example)  
starting the postmaster with a whole lot of options fails.  
  
Most individual file names that pg_ctl deals with are still restricted  
to MAXPGPATH, but we've seldom had complaints about that limitation  
so long as it only applies to one filename.  
  
Back-patch to all supported branches.  
  
Phil Krylov  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_ctl/pg_ctl.c

Disallow creating an ICU collation if the DB encoding won't support it.

commit   : db2760a84191c329c0cdfaa1dae048c32b0c1752    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 16:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 16:38:55 -0400    

Click here for diff

Previously this was allowed, but the collation effectively vanished  
into the ether because of the way lookup_collation() works: you could  
not use the collation, nor even drop it.  Seems better to give an  
error up front than to leave the user wondering why it doesn't work.  
  
(Because this test is in DefineCollation not CreateCollation, it does  
not prevent pg_import_system_collations from creating ICU collations,  
regardless of the initially-chosen encoding.)  
  
Per bug #17170 from Andrew Bille.  Back-patch to v10 where ICU support  
was added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/collationcmds.c

Set the volatility of the timestamptz version of date_bin() back to immutable

commit   : 0c6a6a0ab7675e151a6e46d3ec0846bfce9e030a    
  
author   : John Naylor <[email protected]>    
date     : Fri, 3 Sep 2021 13:38:15 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 3 Sep 2021 13:38:15 -0400    

Click here for diff

543f36b43d was too hasty in thinking that the volatility of date_bin()  
had to match date_trunc(), since only the latter references  
session_timezone.  
  
Bump catversion  
  
Per feedback from Aleksander Alekseev  
Backpatch to v14, as the former commit was  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix portability issue in tests from commit ce773f230.

commit   : fd549145d5d9fba3367cbf7e3d4fc7cb3562feb0    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 10:01:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 3 Sep 2021 10:01:02 -0400    

Click here for diff

Modern POSIX seems to require strtod() to accept "-NaN", but there's  
nothing about NaN in SUSv2, and some of our oldest buildfarm members  
don't like it.  Let's try writing it as -'NaN' instead; that seems  
to produce the same result, at least on Intel hardware.  
  
Per buildfarm.  

M src/test/regress/expected/hash_func.out
M src/test/regress/sql/hash_func.sql

Make pkg-config files cross-compile friendly

commit   : 6588d8416e4ef84fd99fb271b63116f207c6c479    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Sep 2021 11:59:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Sep 2021 11:59:12 +0200    

Click here for diff

Currently the pc files use hard coded paths for "includedir" and  
"libdir."  
  
Example:  
  
  Cflags: -I/usr/include  
  Libs: -L/usr/lib -lpq  
  
This is not very fortunate when cross compiling inside a buildroot,  
where the includes and libs are inside a staging directory, because  
this introduces host paths into the build:  
  
  checking for pkg-config... /builder/shared-workdir/build/sdk/staging_dir/host/bin/pkg-config  
  checking for PostgreSQL libraries via pkg_config... -L/usr/lib <----  
  
This commit addresses this by doing the following two things:  
  
  1. Instead of hard coding the paths in "Cflags" and "Libs"  
     "${includedir}" and "${libdir}" are used.  Note: these variables  
     can be overriden on the pkg-config command line  
     ("--define-variable=libdir=/some/path").  
  
  2. Add the variables "prefix" and "exec_prefix".  If "includedir"  
     and/or "libdir" are using these then construct them accordingly.  
     This is done because buildroots (for instance OpenWrt) tend to  
     rename the real pkg-config and call it indirectly from a script  
     that sets "prefix", "exec_prefix" and "bindir", like so:  
  
     pkg-config.real --define-variable=prefix=${STAGING_PREFIX} \  
       --define-variable=exec_prefix=${STAGING_PREFIX} \  
       --define-variable=bindir=${STAGING_PREFIX}/bin $@  
  
Example #1: user calls ./configure with "--libdir=/some/lib" and  
"--includedir=/some/include":  
  
  prefix=/usr/local/pgsql  
  exec_prefix=${prefix}  
  libdir=/some/lib  
  includedir=/some/include  
  
  Name: libpq  
  Description: PostgreSQL libpq library  
  Url: http://www.postgresql.org/  
  Version: 12.1  
  Requires:  
  Requires.private:  
  Cflags: -I${includedir}  
  Libs: -L${libdir} -lpq  
  Libs.private:  -lcrypt -lm  
  
Example #2: user calls ./configure with no arguments:  
  
  prefix=/usr/local/pgsql  
  exec_prefix=${prefix}  
  libdir=${exec_prefix}/lib  
  includedir=${prefix}/include  
  
  Name: libpq  
  Description: PostgreSQL libpq library  
  Url: http://www.postgresql.org/  
  Version: 12.1  
  Requires:  
  Requires.private:  
  Cflags: -I${includedir}  
  Libs: -L${libdir} -lpq  
  Libs.private:  -lcrypt -lm  
  
Like this the paths can be forced into the staging directory when  
using a buildroot setup:  
  
  checking for pkg-config... /home/sk/tmp/openwrt/staging_dir/host/bin/pkg-config  
  checking for PostgreSQL libraries via pkg_config... -L/home/sk/tmp/openwrt/staging_dir/target-mips_24kc_musl/usr/lib  
  
Author: Sebastian Kemper <[email protected]>  
Co-authored-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20200305213827.GA25135%40darth.lan  

M src/Makefile.shlib

Fix pkg-config files for static linking

commit   : 4c2eab3a0dec2eae40892fb525830a5947a398c7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 3 Sep 2021 10:52:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 3 Sep 2021 10:52:11 +0200    

Click here for diff

Since ea53100d5 (PostgreSQL 12), the shipped pkg-config files have  
been broken for statically linking libpq because libpgcommon and  
libpgport are missing.  This patch adds those two missing private  
dependencies (in a non-hardcoded way).  
  
Reported-by: Filip Gospodinov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/Makefile.shlib

In count_usable_fds(), duplicate stderr not stdin.

commit   : c95ede41b8d47b21d58702fbc519e720f41fdaf1    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 18:53:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 18:53:10 -0400    

Click here for diff

We had a complaint that the postmaster fails to start if the invoking  
program closes stdin.  That happens because count_usable_fds expects  
to be able to dup(0), and if it can't, we conclude there are no free  
FDs and go belly-up.  So far as I can find, though, there is no other  
place in the server that touches stdin, and it's not unreasonable to  
expect that a daemon wouldn't use that file.  
  
As a simple improvement, let's dup FD 2 (stderr) instead.  Unlike stdin,  
it *is* reasonable for us to expect that stderr be open; even if we are  
configured not to touch it, common libraries such as libc might try to  
write error messages there.  
  
Per gripe from Mario Emmenlauer.  Given the lack of previous complaints,  
I'm not excited about pushing this into stable branches, but it seems  
OK to squeeze it into v14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c

Fix float4/float8 hash functions to produce uniform results for NaNs.

commit   : ce773f230d9b5bb2e0dd23fec4e5462fd99487fe    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 17:24:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 2 Sep 2021 17:24:41 -0400    

Click here for diff

The IEEE 754 standard allows a wide variety of bit patterns for NaNs,  
of which at least two ("NaN" and "-NaN") are pretty easy to produce  
from SQL on most machines.  This is problematic because our btree  
comparison functions deem all NaNs to be equal, but our float hash  
functions know nothing about NaNs and will happily produce varying  
hash codes for them.  That causes unexpected results from queries  
that hash a column containing different NaN values.  It could also  
produce unexpected lookup failures when using a hash index on a  
float column, i.e. "WHERE x = 'NaN'" will not find all the rows  
it should.  
  
To fix, special-case NaN in the float hash functions, not too much  
unlike the existing special case that forces zero and minus zero  
to hash the same.  I arranged for the most vanilla sort of NaN  
(that coming from the C99 NAN constant) to still have the same  
hash code as before, to reduce the risk to existing hash indexes.  
  
I dithered about whether to back-patch this into stable branches,  
but ultimately decided to do so.  It's a clear improvement for  
queries that hash internally.  If there is anybody who has -NaN  
in a hash index, they'd be well advised to re-index after applying  
this patch ... but the misbehavior if they don't will not be much  
worse than the misbehavior they had before.  
  
Per bug #17172 from Ma Liangzhu.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hashfunc.c
M src/test/regress/expected/hash_func.out
M src/test/regress/sql/hash_func.sql

Remove superfluous variable assignment

commit   : ba1b763102b89bca2711e921cf3083d8487b8c96    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Sep 2021 13:03:21 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 2 Sep 2021 13:03:21 +0200    

Click here for diff

Commit a4205fa00 moved setting conn to NULL directly after the call  
to PQfinish, but the original conn = NULL; remained a few lines down.  
Fix by removing the superfluous assignment.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACVRiNvMDHYQGiRrGs2Z9dOydfLh2MymEk9i8CSn23UtCg@mail.gmail.com  

M src/bin/pg_basebackup/pg_receivewal.c

Enhance pg_stat_reset_single_table_counters function.

commit   : e04267844a9bbf97c2e85c919b84dfe498ab0302    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 2 Sep 2021 14:01:06 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 2 Sep 2021 14:01:06 +0900    

Click here for diff

This commit allows pg_stat_reset_single_table_counters() to reset statistics  
for a single relation shared across all databases in the cluster to zero.  
  
Bump catalog version.  
  
Author: B Sadhu Prasad Patro  
Reviewed-by: Mahendra Singh Thalor, Himanshu Upadhyaya, Dilip Kumar, Fujii Masao  
Discussion: https://postgr.es/m/CAFF0-CGy7EHeF=AqqkGMF85cySPQBgDcvNk73G2O0vL94O5U5A@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/postmaster/pgstat.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Optimize fileset usage in apply worker.

commit   : 31c389d8de915b705ee06c7a6e9246e20f36b9dc    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 2 Sep 2021 08:13:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 2 Sep 2021 08:13:46 +0530    

Click here for diff

Use one fileset for the entire worker lifetime instead of using  
separate filesets for each streaming transaction. Now, the  
changes/subxacts files for every streaming transaction will be  
created under the same fileset and the files will be deleted  
after the transaction is completed.  
  
This patch extends the BufFileOpenFileSet and BufFileDeleteFileSet  
APIs to allow users to specify whether to give an error on missing  
files.  
  
Author: Dilip Kumar, based on suggestion by Thomas Munro  
Reviewed-by: Hou Zhijie, Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/include/replication/worker_internal.h
M src/include/storage/buffile.h

doc: Replace some uses of "which" by "that" in parallel.sgml

commit   : 163074ea84efec6ffa4813db43cc956ac5d12565    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 2 Sep 2021 11:35:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 2 Sep 2021 11:35:38 +0900    

Click here for diff

This makes the documentation more accurate grammatically.  
  
Author: Elena Indrupskaya  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6  

M doc/src/sgml/parallel.sgml

Use COPY FREEZE in pgbench for faster benchmark table population.

commit   : 06ba4a63b85e5aa47b325c3235c16c05a0b58b96    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Thu, 2 Sep 2021 10:39:09 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Thu, 2 Sep 2021 10:39:09 +0900    

Click here for diff

While populating the pgbench_accounts table, plain COPY was  
unconditionally used. By changing it to COPY FREEZE, the time for  
VACUUM is significantly reduced, thus the total time of "pgbench -i"  
is also reduced. This only happens if pgbench runs against PostgreSQL  
14 or later because COPY FREEZE in previous versions of PostgreSQL does  
not bring the benefit. Also if partitioning is used, COPY FREEZE  
cannot be used. In this case plain COPY will be used too.  
  
Author: Tatsuo Ishii  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Fabien COELHO, Laurenz Albe, Peter Geoghegan, Dean Rasheed  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c

Doc: clarify how triggers relate to transactions.

commit   : 469150a240dd79acbe7d86cb5df869d95f4d6d2d    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 17:24:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 17:24:59 -0400    

Click here for diff

Laurenz Albe, per gripe from Nathan Long.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/trigger.sgml

Refactor postgresImportForeignSchema to avoid code duplication.

commit   : 2dc53fe2a77d8d5f22c656fdf6590198e358a996    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 16:21:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 1 Sep 2021 16:21:13 -0400    

Click here for diff

Avoid repeating fragments of the query we're building, along the  
same lines as recent cleanup in pg_dump.  I got annoyed about this  
because aa769f80e broke my pending patch to change postgres_fdw's  
collation handling, due to each of us having incompletely done  
this same refactoring.  Let's finish that job in hopes of having  
a more stable base.  

M contrib/postgres_fdw/postgres_fdw.c

Identify simple column references in extended statistics

commit   : 537ca68dbb2463f7b1c44e9466b8fbdd7505b2e1    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 17:41:54 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 17:41:54 +0200    

Click here for diff

Until now, when defining extended statistics, everything except a plain  
column reference was treated as complex expression. So for example "a"  
was a column reference, but "(a)" would be an expression. In most cases  
this does not matter much, but there were a couple strange consequences.  
For example  
  
    CREATE STATISTICS s ON a FROM t;  
  
would fail, because extended stats require at least two columns. But  
  
    CREATE STATISTICS s ON (a) FROM t;  
  
would succeed, because that requirement does not apply to expressions.  
Moreover, that statistics object is useless - the optimizer will always  
use the regular statistics collected for attribute "a".  
  
So do a bit more work to identify those expressions referencing a single  
column, and translate them to a simple column reference. Backpatch to  
14, where support for extended statistics on expressions was introduced.  
  
Reported-by: Justin Pryzby  
Backpatch-through: 14  
Discussion: https://postgr.es/m/20210816013255.GS10479%40telsasoft.com  

M src/backend/commands/statscmds.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Improve tab-completion for CREATE PUBLICATION.

commit   : b0c066297bdac901a13a5a900a197697a026b357    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 22:01:15 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 22:01:15 +0900    

Click here for diff

Author: Peter Smith  
Reviewed-by: Vignesh C  
Discussion: https://postgr.es/m/CAHut+Ps-vkmnWAShWSRVCB3gx8aM=bFoDqWgBNTzofK0q1LpwA@mail.gmail.com  

M src/bin/psql/tab-complete.c

Fix incorrect format placeholders

commit   : 590ecd982304dec8599d6ca339903982d39a9a1a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 1 Sep 2021 10:43:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 1 Sep 2021 10:43:55 +0200    

Click here for diff

M src/backend/access/brin/brin_minmax_multi.c

pgbench: Fix bug in measurement of disconnection delays.

commit   : 4dc528bfa7dacee1cfbe2ec59b25039616268b69    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 17:05:13 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 1 Sep 2021 17:05:13 +0900    

Click here for diff

When -C/--connect option is specified, pgbench establishes and closes  
the connection for each transaction. In this case pgbench needs to  
measure the times taken for all those connections and disconnections,  
to include the average connection time in the benchmark result.  
But previously pgbench could not measure those disconnection delays.  
To fix the bug, this commit makes pgbench measure the disconnection  
delays whenever the connection is closed at the end of transaction,  
if -C/--connect option is specified.  
  
Back-patch to v14. Per discussion, we concluded not to back-patch to v13  
or before because changing that behavior in stable branches would  
surprise users rather than providing benefits.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Tatsuo Ishii, Asif Rehman, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Fix the random test failure in 001_rep_changes.

commit   : 8d0138ef51b51ba3e419cf49069eb72a15f74706    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 1 Sep 2021 10:18:23 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 1 Sep 2021 10:18:23 +0530    

Click here for diff

The check to test whether the subscription workers were restarting after a  
change in the subscription was failing. The reason was that the test was  
assuming the walsender started before it reaches the 'streaming' state and  
the walsender was exiting due to an error before that. Now, the walsender  
was erroring out before reaching the 'streaming' state because it tries to  
acquire the slot before the previous walsender has exited.  
  
In passing, improve the die messages so that it is easier to investigate  
the failures in the future if any.  
  
Reported-by: Michael Paquier, as per buildfarm  
Author: Ajin Cherian  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Backpatch-through: 10, where this test was introduced  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/022_twophase_cascade.pl

VACUUM VERBOSE: Don't report "pages removed".

commit   : b175b9cde720a81852b70c0c7fbc18c72ff1acc6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 20:37:18 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 20:37:18 -0700    

Click here for diff

It doesn't make any sense to report this information, since VACUUM  
VERBOSE reports on heap relation truncation directly.  This was an  
oversight in commit 7ab96cf6, which made VACUUM VERBOSE output a little  
more consistent with nearby autovacuum-specific log output.  Adjust  
comments that describe how this is supposed to work in passing.  
  
Also bring truncation-related VACUUM VERBOSE output in line with the  
convention established for VACUUM VERBOSE output by commit f4f4a649.  
  
Author: Peter Geoghegan <[email protected]>  
Backpatch: 14-, where VACUUM VERBOSE's output changed.  

M src/backend/access/heap/vacuumlazy.c

Refactor one conversion of SQLSTATE to string in elog.c

commit   : c4f7a6b87ff350200f4b3afb9fe05e2899161070    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Sep 2021 11:48:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Sep 2021 11:48:08 +0900    

Click here for diff

unpack_sql_state() has been introduced in d46bc44 to refactor the  
unpacking of a SQLSTATE into a string, but it forgot one code path when  
sending error reports to clients that could make use of it.  This  
changes the code to also use unpack_sql_state() there, simplifying a bit  
the code.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PuYituuD1-VVZUNcmCQuc3ZzZMPoO57POgm8tnXOkwJAA@mail.gmail.com  

M src/backend/utils/error/elog.c

Add PostgresNode::command_fails_like()

commit   : de1d4fef71cb00370aa5f794fe05355c1d063aea    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 1 Sep 2021 10:28:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 1 Sep 2021 10:28:01 +0900    

Click here for diff

This is useful to test for a command failure with some default  
connection parameters associated to a node, in combination with checks  
on error patterns expected.  This routine will be used by an upcoming  
future patch, but could be also plugged into some of the existing  
tests.  
  
Extracted from a larger patch by the same author.  
  
Author: Ronan Dunklau  
Discussion: https://postgr.es/m/5742739.ga3mSNWIix@aivenronan  

M src/test/perl/PostgresNode.pm

Remove obsolete nbtree relation extension comment.

commit   : 0f6aa893cb58c2a5a92016914c94865635345a22    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 16:55:39 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 16:55:39 -0700    

Click here for diff

Commit 0d1fe9f7 improved the approach that vacuumlazy.c takes when it  
encounters an empty heap page.  It no acquires the relation extension  
lock.  

M src/backend/access/nbtree/nbtree.c

vacuumlazy.c: Correct prune state comment.

commit   : 6320806ac3792a297f1c4eb149c3ddeda25d3930    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 16:35:01 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 16:35:01 -0700    

Click here for diff

Oversight in commit 7ab96cf6b3.  

M src/backend/access/heap/vacuumlazy.c

Don't print extra parens around expressions in extended stats

commit   : 13380e1476490932c7b15530ead1f649a16e1125    
  
author   : Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 00:42:32 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Wed, 1 Sep 2021 00:42:32 +0200    

Click here for diff

The code printing expressions for extended statistics doubled the  
parens, producing results like ((a+1)), which is unnecessary and not  
consistent with how we print expressions elsewhere.  
  
Fixed by tweaking the code to produce just a single set of parens.  
  
Reported by Mark Dilger, fix by me. Backpatch to 14, where support for  
extended statistics on expressions was added.  
  
Reported-by: Mark Dilger  
Discussion: https://postgr.es/m/20210122040101.GF27167%40telsasoft.com  

M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/stats_ext.out

Remove unneeded old_rel_pages VACUUM state field.

commit   : 47029f775adf83796fecb5871ce52488996a7969    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 14:59:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 14:59:52 -0700    

Click here for diff

The field hasn't been used since commit 3d351d91, which redefined  
pg_class.reltuples to be -1 before the first VACUUM or ANALYZE.  
  
Also rename a local variable of the same name ("old_rel_pages"). This is  
used by relation truncation to represent the original relation size at  
the start of the ongoing VACUUM operation.  Rename it to orig_rel_pages,  
since that's a lot clearer.  (This name matches similar nearby code.)  

M src/backend/access/heap/vacuumlazy.c

Add historic commit to git-blame-ignore-revs file.

commit   : aec5cc9efda00f7f418c9a068c92cab119602084    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 12:57:52 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 31 Aug 2021 12:57:52 -0700    

Click here for diff

Add a historic pgindent commit that was missed by the initial work done  
in commit 8e638845.  

M .git-blame-ignore-revs

Mark the timestamptz variant of date_bin() as stable

commit   : 543f36b43d835c819c24b2952ac4ecabbdf2b944    
  
author   : John Naylor <[email protected]>    
date     : Tue, 31 Aug 2021 14:15:22 -0400    
  
committer: John Naylor <[email protected]>    
date     : Tue, 31 Aug 2021 14:15:22 -0400    

Click here for diff

Previously, it was immutable by lack of marking. This is not  
correct, since the time zone could change.  
  
Bump catversion  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsG2UHk8mOWL0tca%3D_cg%2B_oA5mVRNLhDF0TBw980iOg5NQ%40mail.gmail.com  
Backpatch to v14, when this function came in  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

In pg_dump, avoid doing per-table queries for RLS policies.

commit   : bd3611db5a6f3726094872f59feab426374d2c46    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 15:04:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 15:04:05 -0400    

Click here for diff

For no particularly good reason, getPolicies() queried pg_policy  
separately for each table.  We can collect all the policies in  
a single query instead, and attach them to the correct TableInfo  
objects using findTableByOid() lookups.  On the regression  
database, this reduces the number of queries substantially, and  
provides a visible savings even when running against a local  
server.  
  
Per complaint from Hubert Depesz Lubaczewski.  Since this is such  
a simple fix and can have a visible performance benefit, back-patch  
to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c

Cache the results of format_type() queries in pg_dump.

commit   : 6c450a861f1a928f44c9ae80814ed9a91927c25a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 13:53:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 13:53:33 -0400    

Click here for diff

There's long been a "TODO: there might be some value in caching  
the results" annotation on pg_dump's getFormattedTypeName function;  
but we hadn't gotten around to checking what it was costing us to  
repetitively look up type names.  It turns out that when dumping the  
current regression database, about 10% of the total number of queries  
issued are duplicative format_type() queries.  However, Hubert Depesz  
Lubaczewski reported a not-unusual case where these account for over  
half of the queries issued by pg_dump.  Individually these queries  
aren't expensive, but when network lag is a factor, they add up to a  
problem.  We can very easily add some caching to getFormattedTypeName  
to solve it.  
  
Since this is such a simple fix and can have a visible performance  
benefit, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Rename the role in stats_ext to have regress_ prefix

commit   : 628bc9d13be8c55492aef122c25dbba3b036366d    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 19:21:29 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 19:21:29 +0200    

Click here for diff

Commit 5be8ce82e8 added a new role to the stats_ext regression suite,  
but the role name did not start with regress_ causing failures when  
running with ENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS. Fixed by  
renaming the role to start with the expected regress_ prefix.  
  
Backpatch-through: 10, same as the new regression test  
Discussion: https://postgr.es/m/1F238937-7CC2-4703-A1B1-6DC225B8978A%40enterprisedb.com  

M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix lookup error in extended stats ownership check

commit   : 5be8ce82e84f8f3604916c06668990c524f3856d    
  
author   : Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 18:03:05 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Tue, 31 Aug 2021 18:03:05 +0200    

Click here for diff

When an ownership check on extended statistics object failed, the code  
was calling aclcheck_error_type to report the failure, which is clearly  
wrong, resulting in cache lookup errors. Fix by calling aclcheck_error.  
  
This issue exists since the introduction of extended statistics, so  
backpatch all the way back to PostgreSQL 10. It went unnoticed because  
there were no tests triggering the error, so add one.  
  
Reported-by: Mark Dilger  
Backpatch-through: 10, where extended stats were introduced  
Discussion: https://postgr.es/m/1F238937-7CC2-4703-A1B1-6DC225B8978A%40enterprisedb.com  

M src/backend/catalog/objectaddress.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Fix missed lock acquisition while inlining new-style SQL functions.

commit   : 589be6f6c732a20e2bcaa02560de464ebbd48af2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 12:02:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 31 Aug 2021 12:02:36 -0400    

Click here for diff

When starting to use a query parsetree loaded from the catalogs,  
we must begin by applying AcquireRewriteLocks(), to obtain the same  
relation locks that the parser would have gotten if the query were  
entered interactively, and to do some other cleanup such as dealing  
with later-dropped columns.  New-style SQL functions are just as  
subject to this rule as other stored parsetrees; however, of the  
places dealing with such functions, only init_sql_fcache had gotten  
the memo.  In particular, if we successfully inlined a new-style  
set-returning SQL function that contained any relation references,  
we'd either get an assertion failure or attempt to use those  
relation(s) sans locks.  
  
I also added AcquireRewriteLocks calls to fmgr_sql_validator and  
print_function_sqlbody.  Desultory experiments didn't demonstrate any  
failures in those, but I suspect that I just didn't try hard enough.  
Certainly we don't expect nearby code paths to operate without locks.  
  
On the same logic of it-ought-to-have-the-same-effects-as-the-old-code,  
call pg_rewrite_query() in fmgr_sql_validator, too.  It's possible  
that neither code path there needs to bother with rewriting, but  
doing the analysis to prove that is beyond my goals for today.  
  
Per bug #17161 from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_proc.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/create_function_3.out
M src/test/regress/sql/create_function_3.sql

Prohibit map and grep in void context

commit   : bb466c6b0992a1a21c03239a7b0a87ebadd3bee1    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 31 Aug 2021 11:07:04 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 31 Aug 2021 11:07:04 +0200    

Click here for diff

map and grep are not intended to be used as mutators, iterating  
with side-effects should be done with for or foreach loops. This  
fixes the one occurrence of the pattern, and bumps the perlcritic  
policy to severity 5 for the map and grep policies.  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Andrew Dunstan <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M contrib/intarray/bench/create_test.pl
M src/tools/perlcheck/perlcriticrc

Add tab completion for data types after ALTER TABLE ADD [COLUMN] in psql

commit   : f2bbadce6b5052337a11a33ea6bd8d8aebe2610a    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Aug 2021 12:07:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Aug 2021 12:07:20 +0900    

Click here for diff

This allows finding data types that can be used for the creation of a  
new column, completing d3fa876.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Refactor one use of IDENTIFY_SYSTEM in WAL streaming code of pg_basebackup

commit   : 99709c9b908eba99ecd787c4dc757f71edd98d87    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 31 Aug 2021 10:19:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 31 Aug 2021 10:19:38 +0900    

Click here for diff

0c013e0 has done a large refactoring to unify all the code paths using  
replication commands, but forgot one code path doing WAL streaming that  
checks the validity of a cluster connecting to with IDENTIFY_SYSTEM.  
There is a generic routine able to handle that, so make use of it in  
this code path.  This impacts pg_receivewal and pg_basebackup.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVKKYUMC8GE72Y7BP9g1batrrq3sEwUh+1_i2krWZC_2Q@mail.gmail.com  

M src/bin/pg_basebackup/receivelog.c

Report tuple address in data-corruption error message

commit   : 961dd7565726a507d4551f7ea54ad888fc6ee93a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 16:29:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 16:29:12 -0400    

Click here for diff

Most data-corruption reports mention the location of the problem, but  
this one failed to.  Add it.  
  
Backpatch all the way back.  In 12 and older, also assign the  
ERRCODE_DATA_CORRUPTED error code as was done in commit fd6ec93bf890 for  
13 and later.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam_handler.c

psql: Fix name quoting on extended statistics

commit   : a397109114c8569e21ed3c858a16143de28a1897    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 14:01:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 30 Aug 2021 14:01:29 -0400    

Click here for diff

Per our message style guidelines, for human consumption we quote  
qualified names as a whole rather than each part separately; but commits  
bc085205c8a4 introduced a deviation for extended statistics and  
a4d75c86bf15 copied it.  I don't agree with this policy applying to  
names shown by psql, but that's a poor reason to deviate from the  
practice only in two obscure corners, so make said corners use the same  
style as everywhere else.  
  
Backpatch to 14.  The first of these is older, but I'm not sure we want  
to destabilize the psql output in the older branches for such a small  
thing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/stats_ext.out

pgbench: Avoid unnecessary measurement of connection delays.

commit   : bfd4567b88496bf9669658e5ab381b296dd9ffe1    
  
author   : Fujii Masao <[email protected]>    
date     : Mon, 30 Aug 2021 21:35:24 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Mon, 30 Aug 2021 21:35:24 +0900    

Click here for diff

Commit 547f04e734 changed pgbench so that it used the measurement result  
of connection delays in its benchmark report only when -C/--connect option  
is specified. But previously those delays were unnecessarily measured  
even when that option is not specified. Which was a waste of cycles.  
This commit improves pgbench so that it avoids such unnecessary measurement.  
  
Back-patch to v14 where commit 547f04e734 first appeared.  
  
Author: Yugo Nagata  
Reviewed-by: Fabien COELHO, Asif Rehman, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Fix incorrect error code in StartupReplicationOrigin().

commit   : bad6cef32ca2dd60c8be18f95a7157ced189ec99    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 09:14:31 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 09:14:31 +0530    

Click here for diff

ERRCODE_CONFIGURATION_LIMIT_EXCEEDED was used for checksum failure, use  
ERRCODE_DATA_CORRUPTED instead.  
  
Reported-by: Tatsuhito Kasahara  
Author: Tatsuhito Kasahara  
Backpatch-through: 9.6, where it was introduced  
Discussion: https://postgr.es/m/CAP0=ZVLHtYffs8SOWcFJWrBGoRzT9QQbk+_aP+E5AHLNXiOorA@mail.gmail.com  

M src/backend/replication/logical/origin.c

Refactor sharedfileset.c to separate out fileset implementation.

commit   : dcac5e7ac157964f71f15d81c7429130c69c3f9b    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 08:45:35 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 30 Aug 2021 08:45:35 +0530    

Click here for diff

Move fileset related implementation out of sharedfileset.c to allow its  
usage by backends that don't want to share filesets among different  
processes. After this split, fileset infrastructure is used by both  
sharedfileset.c and worker.c for the named temporary files that survive  
across transactions.  
  
Author: Dilip Kumar, based on suggestion by Andres Freund  
Reviewed-by: Hou Zhijie, Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/backend/storage/file/Makefile
M src/backend/storage/file/buffile.c
M src/backend/storage/file/fd.c
A src/backend/storage/file/fileset.c
M src/backend/storage/file/sharedfileset.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/include/replication/worker_internal.h
M src/include/storage/buffile.h
A src/include/storage/fileset.h
M src/include/storage/sharedfileset.h
M src/tools/pgindent/typedefs.list

Add more tab completion support for ALTER TABLE ADD in psql

commit   : d3fa87657860a50643118c682cdbf53f508a3fab    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 30 Aug 2021 09:46:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 30 Aug 2021 09:46:20 +0900    

Click here for diff

This includes the detection of new patterns for various constraint  
types, with the addition of USING INDEX for unique indexes of a table  
on primary keys and unique constraints.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Doc: add a little about LACON execution to src/backend/regex/README.

commit   : 10d58228bb1c824c5124ecd1b6c5e46a3c157a39    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 29 Aug 2021 12:48:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 29 Aug 2021 12:48:49 -0400    

Click here for diff

I wrote this while thinking about a possible optimization, but it's  
a useful description of the existing code regardless of whether the  
optimization ever happens.  So push it separately.  

M src/backend/regex/README

Keep stats up to date for partitioned tables

commit   : 375aed36ad83f0e021e9bdd3a0034c0c992c66dc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 15:58:23 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 15:58:23 -0400    

Click here for diff

In the long-going saga for analyze on partitioned tables, one thing I  
missed while reverting 0827e8af70f4 is the maintenance of analyze count  
and last analyze time for partitioned tables.  This is a mostly trivial  
change that enables users assess the need for invoking manual ANALYZE on  
partitioned tables.  
  
This patch, posted by Justin and modified a bit by me (Álvaro), can be  
mostly traced back to Hosoya-san, though any problems introduced with  
the scissors are mine.  
  
Backpatch to 14, in line with 6f8127b73901.  
  
Co-authored-by: Yuzuko Hosoya <[email protected]>  
Co-authored-by: Justin Pryzby <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/analyze.c
M src/backend/postmaster/pgstat.c

psql \dX: reference regclass with "pg_catalog." prefix

commit   : 1f092a309eeecd097938bacc201c779574ced3b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 12:04:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 12:04:15 -0400    

Click here for diff

Déjà vu of commit fc40ba1296a7, for another backslash command.  
Strictly speaking this isn't a bug, but since all references to catalog  
objects are schema-qualified, we might as well be consistent.  The  
omission first appeared in commit ad600bba0422 and replicated in  
a4d75c86bf15; backpatch to 14.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

psql \dP: reference regclass with "pg_catalog." prefix

commit   : fc40ba1296a7d4aee7bd975be9925c74c8073dfe    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 11:45:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 28 Aug 2021 11:45:47 -0400    

Click here for diff

Strictly speaking this isn't a bug, but since all references to catalog  
objects are schema-qualified, we might as well be consistent.  The  
omission first appeared in commit 1c5d9270e339, so backpatch to 12.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/describe.c

Fix data loss in wal_level=minimal crash recovery of CREATE TABLESPACE.

commit   : 97ddda8a82ac470ae581d0eb485b6577707678bc    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 27 Aug 2021 23:33:23 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 27 Aug 2021 23:33:23 -0700    

Click here for diff

If the system crashed between CREATE TABLESPACE and the next checkpoint,  
the result could be some files in the tablespace unexpectedly containing  
no rows.  Affected files would be those for which the system did not  
write WAL; see the wal_skip_threshold documentation.  Before v13, a  
different set of conditions governed the writing of WAL; see v12's  
<sect2 id="populate-pitr">.  (The v12 conditions were broader in some  
ways and narrower in others.)  Users may want to audit non-default  
tablespaces for unexpected short files.  The bug could have truncated an  
index without affecting the associated table, and reindexing the index  
would fix that particular problem.  
  
This fixes the bug by making create_tablespace_directories() more like  
TablespaceCreateDbspace().  create_tablespace_directories() was  
recursively removing tablespace contents, reasoning that WAL redo would  
recreate everything removed that way.  That assumption holds for other  
wal_level values.  Under wal_level=minimal, the old approach could  
delete files for which no other copy existed.  Back-patch to 9.6 (all  
supported versions).  
  
Reviewed by Robert Haas and Prabhat Sahu.  Reported by Robert Haas.  
  
Discussion: https://postgr.es/m/CA+TgmoaLO9ncuwvr2nN-J4VEP5XyAcy=zKiHxQzBbFRxxGxm0w@mail.gmail.com  

M src/backend/commands/tablespace.c
M src/test/recovery/t/018_wal_optimize.pl

Count SP-GiST index scans in pg_stat statistics.

commit   : 3778bcb39a94a3b6a821fd60fcd9919a95725e78    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 19:42:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 19:42:42 -0400    

Click here for diff

Somehow, spgist overlooked the need to call pgstat_count_index_scan().  
Hence, pg_stat_all_indexes.idx_scan and equivalent columns never  
became nonzero for an SP-GiST index, although the related per-tuple  
counters worked fine.  
  
This fix works a bit differently from other index AMs, in that the  
counter increment occurs in spgrescan not spggettuple/spggetbitmap.  
It looks like this won't make the user-visible semantics noticeably  
different, so I won't go to the trouble of introducing an is-this-  
the-first-call flag just to make the counter bumps happen in the  
same places.  
  
Per bug #17163 from Christian Quest.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgscan.c

Use maintenance_io_concurrency for ANALYZE prefetch

commit   : ce42efaa2696fa74dffcbaa7d25c4ef00e93e1c0    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 19:23:14 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 19:23:14 -0400    

Click here for diff

When prefetching pages for ANALYZE, we should be using  
maintenance_io_concurrenty (by calling  
get_tablespace_maintenance_io_concurrency(), not  
get_tablespace_io_concurrency()).  
  
ANALYZE prefetching was introduced in c6fc50c, so back-patch to 14.  
  
Backpatch-through: 14  
Reported-By: Egor Rogov  
Discussion: https://postgr.es/m/9beada99-34ce-8c95-fadb-451768d08c64%40postgrespro.ru  

M src/backend/commands/analyze.c

docs: Add command tags for SQL commands

commit   : f01727290fe0c7fdf7bb5a0c2526a15db8c2c52f    
  
author   : Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 18:25:26 -0400    
  
committer: Stephen Frost <[email protected]>    
date     : Fri, 27 Aug 2021 18:25:26 -0400    

Click here for diff

Commit 6c3ffd6 added a couple new predefined roles but didn't properly  
wrap the SQL commands mentioned in the description of those roles with  
command tags, so add them now.  
  
Backpatch-through: 14  
Reported-by: Michael Banck  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/user-manag.sgml

docs: clarify bgw_restart_time documentation

commit   : 10d2695b0cbad0ef64367d9c900ca59b9abcc80f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 22:50:19 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 22:50:19 +0200    

Click here for diff

Author: Dave Cramer <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CADK3HHLZmqAQZ2ByPDQQ9yhGqax36kksq6sDkV0yYzsxw6ipvQ@mail.gmail.com  

M doc/src/sgml/bgworker.sgml

track_io_timing logging: Don't special case 0 ms.

commit   : bda822554b96c6564911df95fcb898d6c30efe46    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:34:00 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:34:00 -0700    

Click here for diff

Adjust track_io_timing related logging code added by commit 94d13d474d.  
Make it consistent with other nearby autovacuum and autoanalyze logging  
code by removing logic that suppressed zero millisecond outputs.  
  
log_autovacuum_min_duration log output now reliably shows "read:" and  
"write:" millisecond-based values in its report (when track_io_timing is  
enabled).  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Stephen Frost <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WznW0FNxSVQMSRazAMYNfZ6DR_gr5WE78hc6E1CBkkJpzw@mail.gmail.com  
Backpatch: 14-, where the track_io_timing logging was introduced.  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

Reorder log_autovacuum_min_duration log output.

commit   : fdfbfa24fa6ae50d9e78dd70f835146f4b40e2fb    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:08:41 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 13:08:41 -0700    

Click here for diff

This order seems more natural.  It starts with details that are  
particular to heap and index data structures, and ends with system-level  
costs incurred during the autovacuum worker's VACUUM/ANALYZE operation.  
  
Author: Peter Geoghegan <[email protected]>  
Discussion: https://postgr.es/m/CAH2-WzkzxK6ahA9xxsOftRtBX_R0swuHZsvo4QUbak1Bz7hb7Q@mail.gmail.com  
Backpatch: 14-, which enhanced the log output in various ways.  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

vacuumlazy.c: Remove unnecessary parentheses.

commit   : de5dcb0796e281fae0ee25ea33b915240de319f6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 09:47:16 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Fri, 27 Aug 2021 09:47:16 -0700    

Click here for diff

This was arguably a minor oversight in commit b4af70cb, which cleaned up  
the function signatures of functions that modify IndexBulkDeleteResult  
variables.  

M src/backend/access/heap/vacuumlazy.c

Change Texinfo output to UTF-8

commit   : e2799528d4f232f8d5fcbddb04629d73f7b342c9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 27 Aug 2021 18:15:57 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 27 Aug 2021 18:15:57 +0200    

Click here for diff

Since the whole documentation tool chain is now UTF-8 and there is an  
increasing number of non-ISO-8859-1 characters in the text, keeping  
the Texinfo output in ISO 8859-1 just creates unnecessary  
complications.  Depending on the platform, there are conversion  
failures and thus build failures, or weirdly converted characters.  By  
changing the output to UTF-8, the whole encoding conversion business  
is sidestepped.  

M doc/src/sgml/Makefile

Handle interaction of regexp's makesearch and MATCHALL more honestly.

commit   : 8f72becd6b9484fbb429651d8859faa36532a35a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 12:18:58 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 27 Aug 2021 12:18:58 -0400    

Click here for diff

Second thoughts about commit 824bf7190: we apply makesearch() to  
an NFA after having determined whether it is a MATCHALL pattern.  
Prepending ".*" doesn't make it non-MATCHALL, but it does change the  
maximum possible match length, and makesearch() failed to update that.  
This has no ill effects given the stylized usage of search NFAs, but  
it seems like it's better to keep the data structure consistent.  In  
particular, fixing this allows more honest handling of the MATCHALL  
check in matchuntil(): we can now assert that maxmatchall is infinity,  
instead of lamely assuming that it should act that way.  
  
In passing, improve the code in dump[c]nfa so that infinite maxmatchall  
is printed as "inf" not a magic number.  

M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c

Avoid invoking PQfnumber in loop constructs

commit   : d782d5987e1022ba70171bcf3507cd87564ef23c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 16:24:33 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 27 Aug 2021 16:24:33 +0200    

Click here for diff

When looping over the resultset from a SQL query, extracting the field  
number before the loop body to avoid repeated calls to PQfnumber is an  
established pattern.  On very wide tables this can have a performance  
impact, but it wont be noticeable in the common case. This fixes a few  
queries which were extracting the field number in the loop body.  
  
Author: Hou Zhijie <[email protected]>  
Reviewed-by: Nathan Bossart <[email protected]>  
Discussion: https://postgr.es/m/OS0PR01MB57164C392783F29F6D0ECA0B94139@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/bin/pg_dump/pg_dump.c

Add logical change details to logical replication worker errcontext.

commit   : abc0910e2e0adfc5a17e035465ee31242e32c4fc    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 27 Aug 2021 08:30:23 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 27 Aug 2021 08:30:23 +0530    

Click here for diff

Previously, on the subscriber, we set the error context callback for the  
tuple data conversion failures. This commit replaces the existing error  
context callback with a comprehensive one so that it shows not only the  
details of data conversion failures but also the details of logical change  
being applied by the apply worker or table sync worker. The additional  
information displayed will be the command, transaction id, and timestamp.  
  
The error context is added to an error only when applying a change but not  
while doing other work like receiving data etc.  
  
This will help users in diagnosing the problems that occur during logical  
replication. It also can be used for future work that allows skipping a  
particular transaction on the subscriber.  
  
Author: Masahiko Sawada  
Reviewed-by: Hou Zhijie, Greg Nancarrow, Haiying Tang, Amit Kapila  
Tested-by: Haiying Tang  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalproto.h
M src/tools/pgindent/typedefs.list

contrib/amcheck: Add heapam CHECK_FOR_INTERRUPTS().

commit   : 191dce109be3870f5800003bbee1484c8a92c9dd    
  
author   : Peter Geoghegan <[email protected]>    
date     : Thu, 26 Aug 2021 18:42:20 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Thu, 26 Aug 2021 18:42:20 -0700    

Click here for diff

Add a CHECK_FOR_INTERRUPTS() call to make heap relation verification  
responsive to query cancellations.  
  
Author: Mark Dilger <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wzk-9RtQgb2QiuLv8j2O0j9tSFKPmmch5nWSZhguUxvbrw%40mail.gmail.com  
Backpatch: 14-, where amcheck heap verification was introduced.  

M contrib/amcheck/verify_heapam.c

Extend collection of Unicode combining characters to beyond the BMP

commit   : 5bc429aacb3722e55638a776332eebfa88dd60e5    
  
author   : John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 13:07:34 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 13:07:34 -0400    

Click here for diff

The former limit was perhaps a carryover from an older hand-coded  
table. Since commit bab982161 we have enough space in mbinterval to  
store larger codepoints, so collect all combining characters.  
  
Discussion: https://www.postgresql.org/message-id/49ad1fa0-174e-c901-b14c-c484b60907f1%40enterprisedb.com  

M src/common/unicode/generate-unicode_combining_table.pl
M src/include/common/unicode_combining_table.h

Update display widths as part of updating Unicode

commit   : bab982161e0590746a2fd2a03043b27108b23ac6    
  
author   : John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 10:53:56 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 10:53:56 -0400    

Click here for diff

The hardcoded "wide character" set in ucs_wcwidth() was last updated  
around the Unicode 5.0 era.  This led to misalignment when printing  
emojis and other codepoints that have since been designated  
wide or full-width.  
  
To fix and keep up to date, extend update-unicode to download the list  
of wide and full-width codepoints from the offical sources.  
  
In passing, remove some comments about non-spacing characters that  
haven't been accurate since we removed the former hardcoded logic.  
  
Jacob Champion  
  
Reported and reviewed by Pavel Stehule  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRCeX21O69YHxmykYySYyprZAqrKWWg0KoGKdjgqcGyygg@mail.gmail.com  

M src/common/unicode/.gitignore
M src/common/unicode/Makefile
A src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/wchar.c
A src/include/common/unicode_east_asian_fw_table.h

Revert "Rename unicode_combining_table to unicode_width_table"

commit   : 1563ecbc1be8b8e5c57651cf5c87f90dea9aea8f    
  
author   : John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 10:06:12 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 10:06:12 -0400    

Click here for diff

This reverts commit eb0d0d2c7300c9c5c22b35975c11265aa4becc84.  
  
After I had committed eb0d0d2c7 and 78ab944cd, I decided to add  
a sanity check for a "can't happen" scenario just to be cautious.  
It turned out that it already happened in the official Unicode source  
data, namely that a character can be both wide and a combining  
character. This fact renders the aforementioned commits unnecessary,  
so revert both of them.  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsH5ejH4-1xaTLpSK8vWoK1m6fA1JBtTM6jmBsLfmDki1g%40mail.gmail.com  

M src/common/unicode/Makefile
R091 src/common/unicode/generate-unicode_width_table.pl src/common/unicode/generate-unicode_combining_table.pl
M src/common/wchar.c
R097 src/include/common/unicode_width_table.h src/include/common/unicode_combining_table.h

Revert "Change mbbisearch to return the character range"

commit   : f8c8a8bccc23f6ca38f7a92c9a614e73fa1fcfb6    
  
author   : John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 09:58:28 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 26 Aug 2021 09:58:28 -0400    

Click here for diff

This reverts commit 78ab944cd4b9977732becd9d0bc83223b88af9a2.  
  
After I had committed eb0d0d2c7 and 78ab944cd, I decided to add  
a sanity check for a "can't happen" scenario just to be cautious.  
It turned out that it already happened in the official Unicode source  
data, namely that a character can be both wide and a combining  
character. This fact renders the aforementioned commits unnecessary,  
so revert both of them.  
  
Discussion:  
https://www.postgresql.org/message-id/CAFBsxsH5ejH4-1xaTLpSK8vWoK1m6fA1JBtTM6jmBsLfmDki1g%40mail.gmail.com  

M src/common/unicode/generate-unicode_width_table.pl
M src/common/wchar.c
M src/include/common/unicode_width_table.h

Fix handling of partitioned index in RelationGetNumberOfBlocksInFork()

commit   : 0d906b2c0b1f0d625ff63d9ace906556b1c66a68    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 26 Aug 2021 08:48:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 26 Aug 2021 08:48:07 +0200    

Click here for diff

Since a partitioned index doesn't have storage, getting the number of  
blocks from it will not give sensible results.  Existing callers  
already check that they don't call it that way, so there doesn't  
appear to be a live problem.  But for correctness, handle  
RELKIND_PARTITIONED_INDEX together with the other non-storage  
relkinds.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/buffer/bufmgr.c

Change mbbisearch to return the character range

commit   : 78ab944cd4b9977732becd9d0bc83223b88af9a2    
  
author   : John Naylor <[email protected]>    
date     : Fri, 20 Aug 2021 11:10:17 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 20 Aug 2021 11:10:17 -0400    

Click here for diff

Add a width field to mbinterval and have mbbisearch return a  
pointer to the found range rather than just bool for success.  
A future commit will add another width besides zero, and this  
will allow that to use the same search.  
  
Reviewed by Jacob Champion  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGOCpzV7c-f3a8ADsA1n4uZ%3D8puCctQp%2Bx7W0vgkv%3Dw%2Bg%40mail.gmail.com  

M src/common/unicode/generate-unicode_width_table.pl
M src/common/wchar.c
M src/include/common/unicode_width_table.h

Rename unicode_combining_table to unicode_width_table

commit   : eb0d0d2c7300c9c5c22b35975c11265aa4becc84    
  
author   : John Naylor <[email protected]>    
date     : Fri, 20 Aug 2021 10:34:26 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 20 Aug 2021 10:34:26 -0400    

Click here for diff

No functional changes. A future commit will use this table for  
other purposes besides combining characters.  

M src/common/unicode/Makefile
R091 src/common/unicode/generate-unicode_combining_table.pl src/common/unicode/generate-unicode_width_table.pl
M src/common/wchar.c
R097 src/include/common/unicode_combining_table.h src/include/common/unicode_width_table.h

Remove redundant test.

commit   : 373e08a9f771e724efd3bd29f78c39515792dcf3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 25 Aug 2021 11:06:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 25 Aug 2021 11:06:34 -0400    

Click here for diff

The condition "context_start < context_end" is strictly weaker  
than "context_end - context_start >= 50", so we don't need both.  
Oversight in commit ffd3944ab, noted by tanghy.fnst.  
  
In passing, line-wrap a nearby test to make it more readable.  
  
Discussion: https://postgr.es/m/OS0PR01MB61137C4054774F44E3A9DC89FBC69@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M src/backend/utils/adt/jsonfuncs.c

Fix broken snapshot handling in parallel workers.

commit   : a780b2fcce6cf45462946fffcd84021a4d1429c8    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 25 Aug 2021 08:32:04 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 25 Aug 2021 08:32:04 -0400    

Click here for diff

Pengchengliu reported an assertion failure in a parallel woker while  
performing a parallel scan using an overflowed snapshot. The proximate  
cause is that TransactionXmin was set to an incorrect value.  The  
underlying cause is incorrect snapshot handling in parallel.c.  
  
In particular, InitializeParallelDSM() was unconditionally calling  
GetTransactionSnapshot(), because I (rhaas) mistakenly thought that  
was always retrieving an existing snapshot whereas, at isolation  
levels less than REPEATABLE READ, it's actually taking a new one. So  
instead do this only at higher isolation levels where there actually  
is a single snapshot for the whole transaction.  
  
By itself, this is not a sufficient fix, because we still need to  
guarantee that TransactionXmin gets set properly in the workers. The  
easiest way to do that seems to be to install the leader's active  
snapshot as the transaction snapshot if the leader did not serialize a  
transaction snapshot. This doesn't affect the results of future  
GetTrasnactionSnapshot() calls since those have to take a new snapshot  
anyway; what we care about is the side effect of setting TransactionXmin.  
  
Report by Pengchengliu. Patch by Greg Nancarrow, except for some comment  
text which I supplied.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c

psql: Make cancel test more timing robust

commit   : 43d4dd87977d5ed66961605649d61973caf80f40    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 11:54:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 11:54:58 +0200    

Click here for diff

The previous coding relied on the PID file appearing and the query  
starting "fast enough", which can fail on slow machines.  Also, there  
might have been an undocumented interference between alarm and  
IPC::Run.  This new coding doesn't rely on any of these concurrency  
mechanisms.  Instead, we wait unitl the PID file is complete before  
proceeding, and then also wait until the sleep query is registered by  
the server.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1mH14Q-0002gh-HS%40gemulon.postgresql.org  

M src/bin/psql/t/020_cancel.pl

Fix typo

commit   : bb9ff46bc4e659a865deaeb1b9aeac8d1ff4d36f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 10:14:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 25 Aug 2021 10:14:51 +0200    

Click here for diff

M src/include/utils/typcache.h

Fix incorrect merge in ECPG code with DECLARE

commit   : 1387925a488eb002b59f3b7f58855a4b711b6415    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 15:16:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 15:16:31 +0900    

Click here for diff

The same condition was repeated twice when comparing the connection used  
by existing declared statement with the one coming from a fresh DECLARE  
statement.  This had no consequences, but let's keep the code clean.  
Oversight in f576de1.  
  
Author: Shenhao Wang  
Discussion: https://postgr.es/m/OSBPR01MB42149653BC0AB0A49D23C1B8F2C69@OSBPR01MB4214.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M src/interfaces/ecpg/preproc/ecpg.header

Fix toast rewrites in logical decoding.

commit   : 29b5905470285bf730f6fe7cc5ddb3513d0e6945    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 25 Aug 2021 09:53:07 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 25 Aug 2021 09:53:07 +0530    

Click here for diff

Commit 325f2ec555 introduced pg_class.relwrite to skip operations on  
tables created as part of a heap rewrite during DDL. It links such  
transient heaps to the original relation OID via this new field in  
pg_class but forgot to do anything about toast tables. So, logical  
decoding was not able to skip operations on internally created toast  
tables. This leads to an error when we tried to decode the WAL for the  
next operation for which it appeared that there is a toast data where  
actually it didn't have any toast data.  
  
To fix this, we set pg_class.relwrite for internally created toast tables  
as well which allowed skipping operations on them during logical decoding.  
  
Author: Bertrand Drouvot  
Reviewed-by: David Zhang, Amit Kapila  
Backpatch-through: 11, where it was introduced  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/sql/toast.sql
M src/backend/catalog/toasting.c
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/include/catalog/toasting.h
M src/include/commands/tablecmds.h

Doc: Tweak function prototype indentation for consistency.

commit   : 255ed90fd260061b4261569151539068be262b51    
  
author   : Etsuro Fujita <[email protected]>    
date     : Wed, 25 Aug 2021 13:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Wed, 25 Aug 2021 13:00:00 +0900    

Click here for diff

M doc/src/sgml/fdwhandler.sgml

Add tab completion for EXPLAIN .. EXECUTE in psql

commit   : 34651131348dfb60be124b3c1dfe92d09a94494f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 12:00:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 25 Aug 2021 12:00:31 +0900    

Click here for diff

Author: Dagfinn Ilmari Mannsåker  
Discussion: https://posgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Avoid using ambiguous word "positive" in error message.

commit   : 170aec63cd7139b453c52ad52bbeb83993faa31d    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:46:25 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:46:25 +0900    

Click here for diff

There are two identical error messages about valid value of modulus for  
hash partition, in PostgreSQL source code. Commit 0e1275fb07 improved  
only one of them so that ambiguous word "positive" was avoided there,  
and forgot to improve the other. This commit improves the other.  
Which would reduce translator burden.  
  
Back-pach to v11 where the error message exists.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out

Improve error message about valid value for distance in phrase operator.

commit   : 085400fee9d58d7a97976755ae0627ef072e3776    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:43:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 11:43:56 +0900    

Click here for diff

The distance in phrase operator must be an integer value between zero  
and MAXENTRYPOS inclusive. But previously the error message about  
its valid value included the information about its upper limit  
but not lower limit (i.e., zero). This commit improves the error message  
so that it also includes the information about its lower limit.  
  
Back-patch to v9.6 where full-text phrase search was supported.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/tsquery.c

ecpg: Remove trailing period from error message.

commit   : 71fee6cfaca35208d266c172e63b76d37df88b77    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 09:56:04 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 25 Aug 2021 09:56:04 +0900    

Click here for diff

This commit improves the ecpg's error message that commit f576de1db1 updated,  
so that it gets rid of trailing period and uppercases the command name  
in the error message.  
  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/preproc/ecpg.header

Fix regexp misbehavior with capturing parens inside "{0}".

commit   : 65dc30ced64cd17f3800ff1b73ab1d358e92efd8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 24 Aug 2021 16:37:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 24 Aug 2021 16:37:26 -0400    

Click here for diff

Regexps like "(.){0}...\1" drew an "invalid backreference number".  
That's not unreasonable on its face, since the capture group will  
never be matched if it's iterated zero times.  However, other engines  
such as Perl's don't complain about this, nor do we throw an error for  
related cases such as "(.)|\1", even though that backref can never  
succeed either.  Also, if the zero-iterations case happens at runtime  
rather than compile time --- say, "(x)*...\1" when there's no "x" to  
be found --- that's not an error, we just deem the backref to not  
match.  Making this even less defensible, no error was thrown for  
nested cases such as "((.)){0}...\2"; and to add insult to injury,  
those cases could result in assertion failures instead.  (It seems  
that nothing especially bad happened in non-assert builds, though.)  
  
Let's just fix it so that no error is thrown and instead the backref  
is deemed to never match, so that compile-time detection of no  
iterations behaves the same as run-time detection.  
  
Per report from Mark Dilger.  This appears to be an aboriginal error  
in Spencer's library, so back-patch to all supported versions.  
  
Pre-v14, it turns out to also be necessary to back-patch one aspect of  
commits cb76fbd7e/00116dee5, namely to create capture-node subREs with  
the begin/end states of their subexpressions, not the current lp/rp  
of the outer parseqatom invocation.  Otherwise delsub complains that  
we're trying to disconnect a state from itself.  This is a bit scary  
but code examination shows that it's safe: in the pre-v14 code, if we  
want to wrap iteration around the subexpression, the first thing we do  
is overwrite the atom's begin/end fields with new states.  So the  
bogus values didn't survive long enough to be used for anything, except  
if no iteration is required, in which case it doesn't matter.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Fix Alter Subscription's Add/Drop Publication behavior.

commit   : 1046a69b3087a6417e85cae9b6bc76caa22f913b    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 24 Aug 2021 08:25:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 24 Aug 2021 08:25:21 +0530    

Click here for diff

The current refresh behavior tries to just refresh added/dropped  
publications but that leads to removing wrong tables from subscription. We  
can't refresh just the dropped publication because it is quite possible  
that some of the tables are removed from publication by that time and now  
those will remain as part of the subscription. Also, there is a chance  
that the tables that were part of the publication being dropped are also  
part of another publication, so we can't remove those.  
  
So, we decided that by default, add/drop commands will also act like  
REFRESH PUBLICATION which means they will refresh all the publications. We  
can keep the old behavior for "add publication" but it is better to be  
consistent with "drop publication".  
  
Author: Hou Zhijie  
Reviewed-by: Masahiko Sawada, Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/OS0PR01MB5716935D4C2CC85A6143073F94EF9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/bin/psql/tab-complete.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
A src/test/subscription/t/024_add_drop_pub.pl

Prevent regexp back-refs from sometimes matching when they shouldn't.

commit   : 9bbf6f7341f2b5a8ce41d838154380faa7346101    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 23 Aug 2021 17:41:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 23 Aug 2021 17:41:07 -0400    

Click here for diff

The recursion in cdissect() was careless about clearing match data  
for capturing parentheses after rejecting a partial match.  This  
could allow a later back-reference to succeed when by rights it  
should fail for lack of a defined referent.  
  
To fix, think a little more rigorously about what the contract  
between different levels of cdissect's recursion needs to be.  
With the right spec, we can fix this using fewer rather than more  
resets of the match data; the key decision being that a failed  
sub-match is now explicitly responsible for clearing any matches  
it may have set.  
  
There are enough other cross-checks and optimizations in the code  
that it's not especially easy to exhibit this problem; usually, the  
match will fail as-expected.  Plus, regexps that are even potentially  
vulnerable are most likely user errors, since there's just not much  
point in writing a back-ref that doesn't always have a referent.  
These facts perhaps explain why the issue hasn't been detected,  
even though it's almost certainly a couple of decades old.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regexec.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/regress/expected/regex.out
M src/test/regress/sql/regex.sql

Avoid creating archive status ".ready" files too early

commit   : 515e3d84a0b58b58eb30194209d2bc47ed349f5b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 23 Aug 2021 15:50:35 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 23 Aug 2021 15:50:35 -0400    

Click here for diff

WAL records may span multiple segments, but XLogWrite() does not  
wait for the entire record to be written out to disk before  
creating archive status files.  Instead, as soon as the last WAL page of  
the segment is written, the archive status file is created, and the  
archiver may process it.  If PostgreSQL crashes before it is able to  
write and flush the rest of the record (in the next WAL segment), the  
wrong version of the first segment file lingers in the archive, which  
causes operations such as point-in-time restores to fail.  
  
To fix this, keep track of records that span across segments and ensure  
that segments are only marked ready-for-archival once such records have  
been completely written to disk.  
  
This has always been wrong, so backpatch all the way back.  
  
Author: Nathan Bossart <[email protected]>  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Ryo Matsumura <[email protected]>  
Reviewed-by: Andrey Borodin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog.h
M src/include/access/xlogarchive.h
M src/include/access/xlogdefs.h

Improve defaults shown in postgresql.conf.sample and pg_settings

commit   : f7bda63a487c542949c8150de8e63bc728e5e31e    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 23 Aug 2021 12:33:38 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 23 Aug 2021 12:33:38 -0400    

Click here for diff

Previously, these showed unlikely default values.  The new default value  
128MB (since PG 10) is not always accurate since initdb tries several  
increasing values, but it likely to be accurate.  
  
Reported-by: Zhangjie <[email protected]>  
  
Discussion: https://postgr.es/m/TYWPR01MB7678772FD8640C404F1DC882F9079@TYWPR01MB7678.jpnprd01.prod.outlook.com  
  
Author: Zhangjie  
  
Backpatch-through: master  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c

Fix backup manifests to generate correct WAL-Ranges across timelines

commit   : a3fcbcda7505e9079cec95e7209cde4f5d5c8bd8    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 23 Aug 2021 11:09:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 23 Aug 2021 11:09:33 +0900    

Click here for diff

In a backup manifest, WAL-Ranges stores the range of WAL that is  
required for the backup to be valid.  pg_verifybackup would then  
internally use pg_waldump for the checks based on this data.  
  
When the timeline where the backup started was more than 1 with a  
history file looked at for the manifest data generation, the calculation  
of the WAL range for the first timeline to check was incorrect.  The  
previous logic used as start LSN the start position of the first  
timeline, but it needs to use the start LSN of the backup.  This would  
cause failures with pg_verifybackup, or any tools making use of the  
backup manifests.  
  
This commit adds a test based on a logic using a self-promoted node,  
making it rather cheap.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/backend/replication/backup_manifest.c
M src/bin/pg_verifybackup/t/007_wal.pl

psql: Improve portability of query cancel test

commit   : c818c25f448d0085e1bb2be402463a4b28bc20c4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 22 Aug 2021 18:41:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 22 Aug 2021 18:41:31 +0200    

Click here for diff

Some shells apparently don't support $PPID, so skip the test in that  
case.  

M src/bin/psql/t/020_cancel.pl

Fix broken regression test caused by 22c4e88eb

commit   : 945f395aeb74cea77d5239db01357bbcbea80534    
  
author   : David Rowley <[email protected]>    
date     : Mon, 23 Aug 2021 01:44:20 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 23 Aug 2021 01:44:20 +1200    

Click here for diff

Per buildfarm members hoverfly and thorntail  

M src/test/regress/expected/select_distinct.out
M src/test/regress/sql/select_distinct.sql

Allow parallel DISTINCT

commit   : 22c4e88ebff408acd52e212543a77158bde59e69    
  
author   : David Rowley <[email protected]>    
date     : Sun, 22 Aug 2021 23:31:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 22 Aug 2021 23:31:16 +1200    

Click here for diff

We've supported parallel aggregation since e06a38965.  At the time, we  
didn't quite get around to also adding parallel DISTINCT. So, let's do  
that now.  
  
This is implemented by introducing a two-phase DISTINCT.  Phase 1 is  
performed on parallel workers, rows are made distinct there either by  
hashing or by sort/unique.  The results from the parallel workers are  
combined and the final distinct phase is performed serially to get rid of  
any duplicate rows that appear due to combining rows for each of the  
parallel workers.  
  
Author: David Rowley  
Reviewed-by: Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvrjRxVKwQN0he79xS+9wyotFXL=RmoWqGGO2N45Farpgw@mail.gmail.com  

M src/backend/optimizer/README
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/select_distinct.out
M src/test/regress/sql/select_distinct.sql

Improve error messages about misuse of SELECT INTO.

commit   : 26ae66090398082c54ce046936fc41633dbfc41e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 21 Aug 2021 10:22:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 21 Aug 2021 10:22:14 -0400    

Click here for diff

Improve two places in plpgsql, and one in spi.c, where an error  
message would confusingly tell you that you couldn't use a SELECT  
query, when what you had written *was* a SELECT query.  The actual  
problem is that you can't use SELECT ... INTO in these contexts,  
but the messages failed to make that apparent.  Special-case  
SELECT INTO to make these errors more helpful.  
  
Also, fix the same spots in plpgsql, as well as several messages  
in exec_eval_expr(), to not quote the entire complained-of query or  
expression in the primary error message.  That behavior very easily  
led to violating our message style guideline about keeping the primary  
error message short and single-line.  Also, since the important part  
of the message was after the inserted text, it could make the real  
problem very hard to see.  We can report the query or expression as  
the first line of errcontext instead.  
  
Per complaint from Roger Mason.  Back-patch to v14, since (a) some  
of these messages are new in v14 and (b) v14's translatable strings  
are still somewhat in flux.  The problem's older than that of  
course, but I'm hesitant to change the behavior further back.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/spi.c
M src/pl/plpgsql/src/expected/plpgsql_array.out
M src/pl/plpgsql/src/pl_exec.c

Fix performance bug in regexp's citerdissect/creviterdissect.

commit   : facce1da918a8bf55a8f54606512f944529cba85    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 20 Aug 2021 14:19:04 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 20 Aug 2021 14:19:04 -0400    

Click here for diff

After detecting a sub-match "dissect" failure (i.e., a backref match  
failure) in the i'th sub-match of an iteration node, we should proceed  
by adjusting the attempted length of the i'th submatch.  As coded,  
though, these functions changed the attempted length of the *last*  
sub-match, and only after exhausting all possibilities for that would  
they back up to adjust the next-to-last sub-match, and then the  
second-from-last, etc; all of which is wasted effort, since only  
changing the start or length of the i'th sub-match can possibly make  
it succeed.  This oversight creates the possibility for exponentially  
bad performance.  Fortunately the problem is masked in most cases by  
optimizations or constraints applied elsewhere; which explains why  
we'd not noticed it before.  But it is possible to reach the problem  
with fairly simple, if contrived, regexps.  
  
Oversight in my commit 173e29aa5.  That's pretty ancient now,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regexec.c

Remove --quiet option from pg_amcheck

commit   : 9a9c8b92018d4d48f93cd8fa1895c53fa5946d75    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 20 Aug 2021 12:44:54 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 20 Aug 2021 12:44:54 +0200    

Click here for diff

Using --quiet in combination with --no-strict-names didn't work as  
documented, a warning message was still emitted. Since the --quiet  
flag was working in an unconventional way to other utilities, fix  
by removing the functionality instead.  
  
Backpatch through 14 where pg_amcheck was introduced.  
  
Bug: 17148  
Reported-by: Chen Jiaoqian <[email protected]>  
Reviewed-by: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M doc/src/sgml/ref/pg_amcheck.sgml
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl

psql: Add test for query canceling

commit   : 5b3f471ff23a2773e6c1ee1704377581c987107d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 11:28:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 11:28:56 +0200    

Click here for diff

Query canceling in psql was accidentally broken by  
3a5130672296ed4e682403a77a9a3ad3d21cef75 (since reverted), so having  
some test coverage for that seems useful.  
  
Reviewed-by: Fabien COELHO <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

A src/bin/psql/t/020_cancel.pl

pg_resetwal: Improve numeric command-line argument parsing

commit   : 9a6345ed741783e8770ef160e822d2257873adef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:54:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:54:23 +0200    

Click here for diff

Check errno after strtoul()/strtol() to handle out of range errors  
better.  For out of range, strtoul() returns ULONG_MAX, and the  
previous code would proceed with that result.  
  
Reported-by: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/6a10a211-872b-3c4c-106b-909ae5fefa61%40enterprisedb.com  

M src/bin/pg_resetwal/pg_resetwal.c

pg_amcheck: Fix block number parsing on command line

commit   : f1899f251df421a4715ce5e231855eb6914bf77d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:48:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 20 Aug 2021 07:48:22 +0200    

Click here for diff

The previous code wouldn't handle higher block numbers on systems  
where sizeof(long) == 4.  
  
Reviewed-by: Mark Dilger <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/6a10a211-872b-3c4c-106b-909ae5fefa61%40enterprisedb.com  

M src/bin/pg_amcheck/pg_amcheck.c

Avoid trying to lock OLD/NEW in a rule with FOR UPDATE.

commit   : 8d2d6ec7708b475787fd92a9f828e554805e3df6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 19 Aug 2021 12:12:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 19 Aug 2021 12:12:35 -0400    

Click here for diff

transformLockingClause neglected to exclude the pseudo-RTEs for  
OLD/NEW when processing a rule's query.  This led to odd errors  
or even crashes later on.  This bug is very ancient, but it's  
not terribly surprising that nobody noticed, since the use-case  
for SELECT FOR UPDATE in a non-view rule is somewhere between  
thin and non-existent.  Still, crashing is not OK.  
  
Per bug #17151 from Zhiyong Wu.  Thanks to Masahiko Sawada  
for analysis of the problem.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/analyze.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql

Unset MyBEEntry, making elog.c's call to pgstat_get_my_query_id() safe.

commit   : bed5eac2d50eb86a254861dcdea7b064d10c72cf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 19 Aug 2021 04:59:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 19 Aug 2021 04:59:06 -0700    

Click here for diff

Previously log messages late during shutdown could end up using either another  
backend's PgBackendStatus (multi user) or segfault (single user) because  
pgstat_get_my_query_id()'s check for !MyBEEntry didn't filter out use after  
pgstat_beshutdown_hook().  
  
This became a bug in 4f0b0966c86, but was a bit fishy before. But given  
there's no known problematic cases before 14, it doesn't seem worth  
backpatching further.  
  
Also fixes a wrong filename in a comment, introduced in e1025044.  
  
Reported-By: Andres Freund <[email protected]>  
Reviewed-By: Julien Rouhaud <[email protected]>  
Discussion: https://postgr.es/m/Julien Rouhaud <[email protected]>  
Backpatch: 14-  

M src/backend/utils/activity/backend_status.c

Rename LOGICAL_REP_MSG_STREAM_END to LOGICAL_REP_MSG_STREAM_STOP.

commit   : 4cd7a189687171374ff302ad71c99d39ff6d2bab    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:34:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:34:26 +0530    

Click here for diff

In the code, most places used the term "Stream Stop" for the logical  
stream message. This commit improves consistency by renaming LogicalRepMsgType  
"LOGICAL_REP_MSG_STREAM_END" to "LOGICAL_REP_MSG_STREAM_STOP".  
  
Author: Masahiko Sawada  
Reviewed-by: Hou Zhijie, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalproto.h

Fix typo in protocol.sgml.

commit   : 0ac1aee0d7d8d5c3493e6e8b1d3925af35a31648    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:03:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 19 Aug 2021 09:03:11 +0530    

Click here for diff

The 'Stream Stop' message is misspelled as 'Stream End' in the docs.  
  
Author: Masahiko Sawada  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/protocol.sgml

Improve performance of float overflow checks in btree_gist

commit   : 32cf7f7acce3891cbc3de53327704372bdd36d38    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 10:42:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 10:42:44 +0900    

Click here for diff

The current code could do unnecessary calls to isinf() (two for the  
argument values all the time while one could be sufficient in some  
cases).  zero_is_valid was never used but the result value was still  
checked on 0 in the first position of the check.  
  
This is similar to 607f8ce.  btree_gist has just copy-pasted the code  
doing those checks from the backend float4/8 code, as of the macro  
CHECKFLOATVAL(), to do the work.  
  
Author: Haiying Tang  
Discussion: https://postgr.es/m/OS0PR01MB611358E3A7BC3C2F874AC36BFBF39@OS0PR01MB6113.jpnprd01.prod.outlook.com  

M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_utils_num.h

Revert refactoring of hex code to src/common/

commit   : 2576dcfb76aa71e4222bac5a3a43f71875bfa9e8    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 09:20:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 19 Aug 2021 09:20:13 +0900    

Click here for diff

This is a combined revert of the following commits:  
- c3826f8, a refactoring piece that moved the hex decoding code to  
src/common/.  This code was cleaned up by aef8948, as it originally  
included no overflow checks in the same way as the base64 routines in  
src/common/ used by SCRAM, making it unsafe for its purpose.  
- aef8948, a more advanced refactoring of the hex encoding/decoding code  
to src/common/ that added sanity checks on the result buffer for hex  
decoding and encoding.  As reported by Hans Buschmann, those overflow  
checks are expensive, and it is possible to see a performance drop in  
the decoding/encoding of bytea or LOs the longer they are.  Simple SQLs  
working on large bytea values show a clear difference in perf profile.  
- ccf4e27, a cleanup made possible by aef8948.  
  
The reverts of all those commits bring back the performance of hex  
decoding and encoding back to what it was in ~13.  Fow now and  
post-beta3, this is the simplest option.  
  
Reported-by: Hans Buschmann  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/replication/backup_manifest.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/varlena.c
M src/common/Makefile
D src/common/hex.c
D src/include/common/hex.h
M src/include/common/sha2.h
M src/include/utils/builtins.h
M src/tools/msvc/Mkvcbuild.pm

Fix check_agg_arguments' examination of aggregate FILTER clauses.

commit   : 2313dda9d493d3685ac7328b49dc6f5a87c1c295    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 18 Aug 2021 18:12:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 18 Aug 2021 18:12:51 -0400    

Click here for diff

Recursion into the FILTER clause was mis-implemented, such that a  
relevant Var or Aggref at the very top of the FILTER clause would  
be ignored.  (Of course, that'd have to be a plain boolean Var or  
boolean-returning aggregate.)  The consequence would be  
mis-identification of the correct semantic level of the aggregate,  
which could lead to not-per-spec query behavior.  If the FILTER  
expression is an aggregate, this could also lead to failure to issue  
an expected "aggregate function calls cannot be nested" error, which  
would likely result in a core dump later on, since the planner and  
executor aren't expecting such cases to appear.  
  
The root cause is that commit b560ec1b0 blindly copied some code  
that assumed it's recursing into a List, and thus didn't examine the  
top-level node.  To forestall questions about why this call doesn't  
look like the others, as well as possible future copy-and-paste  
mistakes, let's change all three check_agg_arguments_walker calls in  
check_agg_arguments, even though only the one for the filter clause  
is really broken.  
  
Per bug #17152 from Zhiyong Wu.  This has been wrong since we  
implemented FILTER, so back-patch to all supported versions.  
(Testing suggests that pre-v11 branches manage to avoid crashing  
in the bad-Aggref case, thanks to "redundant" checks in ExecInitAgg.  
But I'm not sure how thorough that protection is, and anyway the  
wrong-behavior issue remains, so fix 9.6 and 10 too.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_agg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Doc: Fix typo in logical decoding example

commit   : 76987bad3380be862ea3cc36d1709134be126150    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 19:44:57 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 19:44:57 +0200    

Click here for diff

Fixes one occurrence of "atleast" in the logical decoding example section.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/logicaldecoding.sgml

Fix pg_amcheck --skip option parameter handling

commit   : 500256d953444628164f0b77ef1ce8c9e05e575f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 11:23:43 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 18 Aug 2021 11:23:43 +0200    

Click here for diff

The skip options set for all-visible and all-frozen were incorrect  
as they used space rather than hyphen, causing a syntax error when  
invoked. Also, the option for not skipping any pages at all, none,  
was documented but not implemented.  
  
Backpatch through 14 where pg_amcheck was introduced.  
  
Bug: #17149  
Reported-by: Chen Jiaoqian <[email protected]>  
Reviewed-by: Masahiko Sawada <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/bin/pg_amcheck/pg_amcheck.c

Prevent ALTER TYPE/DOMAIN/OPERATOR from changing extension membership.

commit   : 6b71c925cb817f79cb0d389edacdd033efaa301d    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 14:29:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 14:29:22 -0400    

Click here for diff

If recordDependencyOnCurrentExtension is invoked on a pre-existing,  
free-standing object during an extension update script, that object  
will become owned by the extension.  In our current code this is  
possible in three cases:  
  
* Replacing a "shell" type or operator.  
* CREATE OR REPLACE overwriting an existing object.  
* ALTER TYPE SET, ALTER DOMAIN SET, and ALTER OPERATOR SET.  
  
The first of these cases is intentional behavior, as noted by the  
existing comments for GenerateTypeDependencies.  It seems like  
appropriate behavior for CREATE OR REPLACE too; at least, the obvious  
alternatives are not better.  However, the fact that it happens during  
ALTER is an artifact of trying to share code (GenerateTypeDependencies  
and makeOperatorDependencies) between the CREATE and ALTER cases.  
Since an extension script would be unlikely to ALTER an object that  
didn't already belong to the extension, this behavior is not very  
troubling for the direct target object ... but ALTER TYPE SET will  
recurse to dependent domains, and it is very uncool for those to  
become owned by the extension if they were not already.  
  
Let's fix this by redefining the ALTER cases to never change extension  
membership, full stop.  We could minimize the behavioral change by  
only changing the behavior when ALTER TYPE SET is recursing to a  
domain, but that would complicate the code and it does not seem like  
a better definition.  
  
Per bug #17144 from Alex Kozhemyakin.  Back-patch to v13 where ALTER  
TYPE SET was added.  (The other cases are older, but since they only  
affect the directly-named object, there's not enough of a problem to  
justify changing the behavior further back.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/typecmds.c
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_type.h

Reduce assumptions about locale's behavior in new regex tests.

commit   : b66336c4e1af0e8eae520623e4b018251807b0bb    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 13:00:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 13:00:36 -0400    

Click here for diff

I was overoptimistic to assume that UTF8-based locales would all  
consider U+1500 to be a member of the [[:alpha:]] char class.  
Tweak the test cases added by commit 78a843f11 to avoid that  
assumption.  We might need to lobotomize them further, but this  
should be enough to fix the early buildfarm reports.  

M src/test/modules/test_regex/expected/test_regex_utf8.out
M src/test/modules/test_regex/sql/test_regex_utf8.sql

Improve regex compiler's arc moving/copying logic.

commit   : 78a843f119ca7d4a6eb173a7ee3bed45889d48d8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 12:00:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 17 Aug 2021 12:00:02 -0400    

Click here for diff

The functions moveins(), copyins(), moveouts(), copyouts() are  
required to preserve the invariant that there are no duplicate arcs in  
the regex's NFA.  Spencer's original implementation of them was O(N^2)  
since it checked separately for a match to each source arc.  In commit  
579840ca0 I improved that by adding sort/merge logic to be used if  
more than a few arcs are to be moved/copied.  However, I now realize  
that that missed a bet.  At many call sites, the target state is newly  
made and cannot have any existing in-arcs (respectively out-arcs)  
that could be duplicates.  So spending any cycles at all on checking  
for duplicates is wasted effort; in these cases we can just blindly  
move/copy all the source arcs.  Add code paths to do that.  
  
It turns out that for copyins()/copyouts(), *all* the call sites have  
this property, making all the "improved" logic in them flat out  
unreachable.  Perhaps we'll need the full capability again someday,  
so I just #ifdef'd those paths out rather than removing them entirely.  
  
In passing, add a few test cases to improve code coverage in this  
area as well as in regc_locale.c/regc_pg_locale.c.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regc_nfa.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/expected/test_regex_utf8.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/modules/test_regex/sql/test_regex_utf8.sql

Improved ECPG warning as suggested by Michael Paquier and removed test case that triggers the warning during regression tests.

commit   : f576de1db1eeca63180b1ffa4b42b1e360f88577    
  
author   : Michael Meskes <[email protected]>    
date     : Tue, 17 Aug 2021 14:58:33 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Tue, 17 Aug 2021 14:58:33 +0200    

Click here for diff

M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/test/expected/sql-declare.c
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/sql/declare.pgc

Set type identifier on BIO

commit   : 31f860a52bf97b898d8af6333b23869f1bbac17e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 17 Aug 2021 14:27:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 17 Aug 2021 14:27:37 +0200    

Click here for diff

In OpenSSL there are two types of BIO's (I/O abstractions):  
source/sink and filters. A source/sink BIO is a source and/or  
sink of data, ie one acting on a socket or a file. A filter  
BIO takes a stream of input from another BIO and transforms it.  
In order for BIO_find_type() to be able to traverse the chain  
of BIO's and correctly find all BIO's of a certain type they  
shall have the type bit set accordingly, source/sink BIO's  
(what PostgreSQL implements) use BIO_TYPE_SOURCE_SINK and  
filter BIO's use BIO_TYPE_FILTER. In addition to these, file  
descriptor based BIO's should have the descriptor bit set,  
BIO_TYPE_DESCRIPTOR.  
  
The PostgreSQL implementation didn't set the type bits, which  
went unnoticed for a long time as it's only really relevant  
for code auditing the OpenSSL installation, or doing similar  
tasks. It is required by the API though, so this fixes it.  
  
Backpatch through 9.6 as this has been wrong for a long time.  
  
Author: Itamar Gafni  
Discussion: https://postgr.es/m/SN6PR06MB39665EC10C34BB20956AE4578AF39@SN6PR06MB3966.namprd06.prod.outlook.com  
Backpatch-through: 9.6  

M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c

doc: \123 and \x12 escapes in COPY are in database encoding.

commit   : e9a79c220bf55e179bb8e0c37fca1239e0fb3b0b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Aug 2021 10:00:06 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 17 Aug 2021 10:00:06 +0300    

Click here for diff

The backslash sequences, including \123 and \x12 escapes, are interpreted  
after encoding conversion. The docs failed to mention that.  
  
Backpatch to all supported versions.  
  
Reported-by: Andreas Grob  
Discussion: https://www.postgresql.org/message-id/17142-9181542ca1df75ab%40postgresql.org  

M doc/src/sgml/ref/copy.sgml

Revert analyze support for partitioned tables

commit   : 6f8127b7390119c21479f5ce495b7d2168930e82    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 16 Aug 2021 17:27:52 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 16 Aug 2021 17:27:52 -0400    

Click here for diff

This reverts the following commits:  
1b5617eb844cd2470a334c1d2eec66cf9b39c41a Describe (auto-)analyze behavior for partitioned tables  
0e69f705cc1a3df273b38c9883fb5765991e04fe Set pg_class.reltuples for partitioned tables  
41badeaba8beee7648ebe7923a41c04f1f3cb302 Document ANALYZE storage parameters for partitioned tables  
0827e8af70f4653ba17ed773f123a60eadd9f9c9 autovacuum: handle analyze for partitioned tables  
  
There are efficiency issues in this code when handling databases with  
large numbers of partitions, and it doesn't look like there isn't any  
trivial way to handle those.  There are some other issues as well.  It's  
now too late in the cycle for nontrivial fixes, so we'll have to let  
Postgres 14 users continue to manually deal with ANALYZE their  
partitioned tables, and hopefully we can fix the issues for Postgres 15.  
  
I kept [most of] be280cdad298 ("Don't reset relhasindex for partitioned  
tables on ANALYZE") because while we added it due to 0827e8af70f4, it is  
a good bugfix in its own right, since it affects manual analyze as well  
as autovacuum-induced analyze, and there's no reason to revert it.  
  
I retained the addition of relkind 'p' to tables included by  
pg_stat_user_tables, because reverting that would require a catversion  
bump.  
Also, in pg14 only, I keep a struct member that was added to  
PgStat_TabStatEntry to avoid breaking compatibility with existing stat  
files.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/backend/access/common/reloptions.c
M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pgstat.c
M src/include/pgstat.h

Reduce memory consumption for pending invalidation messages.

commit   : 3aafc030a53621e91be2e7c1c72b5f3e8b103486    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 16 Aug 2021 16:48:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 16 Aug 2021 16:48:25 -0400    

Click here for diff

The existing data structures in inval.c are fairly inefficient for  
the common case of a command or subtransaction that registers a small  
number of cache invalidation events.  While this doesn't matter if we  
commit right away, it can build up to a lot of bloat in a transaction  
that contains many DDL operations.  By making a few more assumptions  
about the expected use-case, we can switch to a representation using  
densely-packed arrays.  Although this eliminates some data-copying,  
it doesn't seem to make much difference time-wise.  But the space  
consumption decreases substantially.  
  
Patch by me; thanks to Nathan Bossart for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/inval.c

Emit namespace in the post-copy errmsg

commit   : 069d33d0c5a021601245e44df77a0423ddd69359    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 16 Aug 2021 20:06:54 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 16 Aug 2021 20:06:54 +0200    

Click here for diff

During a VACUUM or CLUSTER command, the initial output emits a  
fully qualified relation path with namespace.  The post-action  
errmsg only emitted the relation name however, which may lead  
to hard to parse output when using multiple jobs with vacuumdb  
as the output from different jobs may be interleaved.  Include  
the full path in the post-action errmsg to be consistent with  
the initial errmsg.  
  
Author: Mike Fiedler <[email protected]>  
Reviewed-by: Corey Huinker <[email protected]>  
Discussion: https://postgr.es/m/CAMerE0oz+8G-aORZL_BJcPxnBqewZAvND4bSUysjz+r-oT1BxQ@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c

Use direct function calls for pg_popcount{32,64} on non-x86 platforms

commit   : 4864c8e8f184a35ed1c2c51a15e9a455e9fbb398    
  
author   : John Naylor <[email protected]>    
date     : Mon, 16 Aug 2021 11:45:21 -0400    
  
committer: John Naylor <[email protected]>    
date     : Mon, 16 Aug 2021 11:45:21 -0400    

Click here for diff

Previously, all pg_popcount{32,64} calls were indirected through  
a function pointer, even though we had no fast implementation for  
non-x86 platforms. Instead, for those platforms use wrappers around  
the pg_popcount{32,64}_slow functions.  
  
Review and additional hacking by David Rowley  
Reviewed by Álvaro Herrera  
  
Discussion: https://www.postgresql.org/message-id/flat/CAFBsxsE7otwnfA36Ly44zZO%2Bb7AEWHRFANxR1h1kxveEV%3DghLQ%40mail.gmail.com  

M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c

Clarify initdb --sync-only help message and docs

commit   : ea499f3d28c657a044f0a948e6b77ac56f28a8f6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 16 Aug 2021 13:38:01 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 16 Aug 2021 13:38:01 +0200    

Click here for diff

The initdb help message for --sync-only was a bit terse, and not  
really self-explanatory. Make it clearer that initdb --sync-only  
will exit after syncing, and expand the docs with a note on when  
the option can be useful. Also align the help output with others  
that exit immediately.  
  
Author: Nathan Bossart, Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4U6hbNNE1bv=LxQdJybmUdZ5NJQ9rKY9tN82NXM8QH+iQ@mail.gmail.com  

M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/initdb.c

Refresh apply delay on reload of recovery_min_apply_delay at recovery

commit   : e4ba1005c0f7a95e3252f38aee02426117b8e12b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 16 Aug 2021 12:10:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 16 Aug 2021 12:10:22 +0900    

Click here for diff

This commit ensures that the wait interval in the replay delay loop  
waiting for an amount of time defined by recovery_min_apply_delay is  
correctly handled on reload, recalculating the delay if this GUC value  
is updated, based on the timestamp of the commit record being replayed.  
  
The previous behavior would be problematic for example with replay  
still waiting even if the delay got reduced or just cancelled.  If the  
apply delay was increased to a larger value, the wait would have just  
respected the old value set, finishing earlier.  
  
Author: Soumyadeep Chakraborty, Ashwin Agrawal  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/CAE-ML+93zfr-HLN8OuxF0BjpWJ17O5dv1eMvSE5jsj9jpnAXZA@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/access/transam/xlog.c

Un-break s_lock_test.

commit   : 0a208ed63ffe50a8d9d7c0b33996ec01cc4fdef6    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 14:42:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 14:42:27 -0400    

Click here for diff

Commit 80abbeba2 evidently didn't bother checking this code.  
Also, list the generated executable in .gitignore (so it's  
been a REALLY long time since anyone tried this).  
  
Noted while trying out RISC-V spinlock patch.  Given that  
this has been broken for 5 years and nobody noticed, it's  
likely not worth back-patching.  

M src/backend/storage/lmgr/.gitignore
M src/backend/storage/lmgr/s_lock.c

Add RISC-V spinlock support in s_lock.h.

commit   : c32fcac56a212b4e6bb5ba63596f60a25a18109a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 13:58:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 13 Aug 2021 13:58:47 -0400    

Click here for diff

Like the ARM case, just use gcc's __sync_lock_test_and_set();  
that will compile into AMOSWAP.W.AQ which does what we need.  
  
At some point it might be worth doing some work on atomic ops  
for RISC-V, but this should be enough for a creditable port.  
  
Back-patch to all supported branches, just in case somebody  
wants to try them on RISC-V.  
  
Marek Szuba  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/storage/s_lock.h

pg_amcheck: Message style and structuring improvements

commit   : 4279e5bc8c0b3a0cb6b6d3f1316ae81cd0028447    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 13 Aug 2021 17:15:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 13 Aug 2021 17:15:03 +0200    

Click here for diff

M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl

Remove support for background workers without BGWORKER_SHMEM_ACCESS.

commit   : 80a8f95b3bca6a80672d1766c928cda34e979112    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Aug 2021 05:49:26 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Aug 2021 05:49:26 -0700    

Click here for diff

Background workers without shared memory access have been broken on  
EXEC_BACKEND / windows builds since shortly after background workers have been  
introduced, without that being reported. Clearly they are not commonly used.  
  
The problem is that bgworker startup requires to be attached to shared memory  
in EXEC_BACKEND child processes. StartBackgroundWorker() detaches from shared  
memory for unconnected workers, but at that point we already have initialized  
subsystems referencing shared memory.  
  
Fixing this problem is not entirely trivial, so removing the option to not be  
connected to shared memory seems the best way forward. In most use cases the  
advantages of being connected to shared memory far outweigh the disadvantages.  
  
As there have been no reports about this issue so far, we have decided that it  
is not worth trying to address the problem in the back branches.  
  
Per discussion with Alvaro Herrera, Robert Haas and Tom Lane.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bgworker.sgml
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
M src/include/postmaster/bgworker.h

Fix typo.

commit   : 1d5135f0043b32a7d9fdc66a9553c2078900e240    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 13 Aug 2021 05:44:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 13 Aug 2021 05:44:03 -0700    

Click here for diff

Reported-By: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/postinit.c

Fix connection handling for DEALLOCATE and DESCRIBE statements

commit   : 399edafa2aba562a8013fbe039f3cbf3a41a436e    
  
author   : Michael Meskes <[email protected]>    
date     : Fri, 13 Aug 2021 10:34:04 +0200    
  
committer: Michael Meskes <[email protected]>    
date     : Fri, 13 Aug 2021 10:34:04 +0200    

Click here for diff

After binding a statement to a connection with DECLARE STATEMENT the connection  
was still not used for DEALLOCATE and DESCRIBE statements. This patch fixes  
that, adds a missing warning and cleans up the code.  
  
Author: Hayato Kuroda  
Reviewed-by: Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/TYAPR01MB5866BA57688DF2770E2F95C6F5069%40TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/ecpg.addons
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/ecpg.type
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/sql-declare.c
M src/interfaces/ecpg/test/expected/sql-declare.stderr
M src/interfaces/ecpg/test/expected/sql-declare.stdout
M src/interfaces/ecpg/test/sql/declare.pgc

Fix sslsni connparam boolean check

commit   : 512f4ca6c6b5d2e3a1620288048ccaa712121e12    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Aug 2021 10:32:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 13 Aug 2021 10:32:17 +0200    

Click here for diff

The check for sslsni only checked for existence of the parameter  
but not for the actual value of the param.  This meant that the  
SNI extension was always turned on.  Fix by inspecting the value  
of sslsni and only activate the SNI extension iff sslsni has been  
enabled.  Also update the docs to be more in line with how other  
boolean params are documented.  
  
Backpatch to 14 where sslsni was first implemented.  
  
Reviewed-by: Tom Lane  
Backpatch-through: 14, where sslni was added  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-secure-openssl.c

Fix incorrect hash table resizing code in simplehash.h

commit   : 37450f2ca9ad430d78673cc26816fc2085e65904    
  
author   : David Rowley <[email protected]>    
date     : Fri, 13 Aug 2021 16:41:26 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 13 Aug 2021 16:41:26 +1200    

Click here for diff

This fixes a bug in simplehash.h which caused an incorrect size mask to be  
used when the hash table grew to SH_MAX_SIZE (2^32).  The code was  
incorrectly setting the size mask to 0 when the hash tables reached the  
maximum possible number of buckets.  This would result always trying to  
use the 0th bucket causing an  infinite loop of trying to grow the hash  
table due to there being too many collisions.  
  
Seemingly it's not that common for simplehash tables to ever grow this big  
as this bug dates back to v10 and nobody seems to have noticed it before.  
However, probably the most likely place that people would notice it would  
be doing a large in-memory Hash Aggregate with something close to at least  
2^31 groups.  
  
After this fix, the code now works correctly with up to within 98% of 2^32  
groups and will fail with the following error when trying to insert any  
more items into the hash table:  
  
ERROR:  hash table size exceeded  
  
However, the work_mem (or hash_mem_multiplier in newer versions) settings  
will generally cause Hash Aggregates to spill to disk long before reaching  
that many groups.  The minimal test case I did took a work_mem setting of  
over 192GB to hit the bug.  
  
simplehash hash tables are used in a few other places such as Bitmap Index  
Scans, however, again the size that the hash table can become there is  
also limited to work_mem and it would take a relation of around 16TB  
(2^31) pages and a very large work_mem setting to hit this.  With smaller  
work_mem values the table would become lossy and never grow large enough  
to hit the problem.  
  
Author: Yura Sokolov  
Reviewed-by: David Rowley, Ranier Vilela  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10, where simplehash.h was added  

M src/include/lib/simplehash.h

Make EXEC_BACKEND more convenient on macOS.

commit   : 88cbbbfa3e2b0d38d6047af83764f140face5991    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 13 Aug 2021 10:38:22 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 13 Aug 2021 10:38:22 +1200    

Click here for diff

It's hard to disable ASLR on current macOS releases, for testing with  
-DEXEC_BACKEND.  You could already set the environment variable  
PG_SHMEM_ADDR to something not likely to collide with mappings created  
earlier in process startup.  Let's also provide a default value that  
works on current releases and architectures, for developer convenience.  
  
As noted in the pre-existing comment, this is a horrible hack, but  
-DEXEC_BACKEND is only used by Unix-based PostgreSQL developers for  
testing some otherwise Windows-only code paths, so it seems excusable.  
  
Back-patch to all supported branches.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/20210806032944.m4tz7j2w47mant26%40alap3.anarazel.de  

M src/backend/port/sysv_shmem.c

Use appropriate tuple descriptor in FDW batching

commit   : 650663b4cb4714a34d7171981de4392486a85f86    
  
author   : Tomas Vondra <[email protected]>    
date     : Thu, 12 Aug 2021 21:32:53 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Thu, 12 Aug 2021 21:32:53 +0200    

Click here for diff

The FDW batching code was using the same tuple descriptor both for all  
slots (regular and plan slots), but that's incorrect - the subplan may  
use a different descriptor. Currently this is benign, because batching  
is used only for INSERTs, and in that case the descriptors always match.  
But that would change if we allow batching UPDATEs.  
  
Fix by copying the appropriate tuple descriptor. Backpatch to 14, where  
the FDW batching was implemented.  
  
Author: Amit Langote  
Backpatch-through: 14, where FDW batching was added  
Discussion: https://postgr.es/m/CA%2BHiwqEWd5B0-e-RvixGGUrNvGkjH2s4m95%3DJcwUnyV%3Df0rAKQ%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Speed up generation of Unicode hash functions.

commit   : ba958299eaf3d2f55bddb8efb037091d14ca6fd0    
  
author   : John Naylor <[email protected]>    
date     : Thu, 12 Aug 2021 09:08:56 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 12 Aug 2021 09:08:56 -0400    

Click here for diff

Sets of Unicode keys are picky about the primes used when generating  
a perfect hash function for them. Callers can spend many seconds  
iterating through all the possible combinations of candidate  
multipliers and seeds to find one that works.  
  
Unicode updates typically happen only once a year, but it still makes  
development and testing of Unicode scripts unnecessarily slow. To fix,  
iterate over the primes in the innermost loop. This does not change  
any existing functions checked into the tree.  

M src/tools/PerfectHash.pm

Fix grammar mistake in hash index README

commit   : b05f7ecec44be22f6de703e5afdeb4ff3559315a    
  
author   : John Naylor <[email protected]>    
date     : Thu, 12 Aug 2021 08:53:41 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 12 Aug 2021 08:53:41 -0400    

Click here for diff

Dilip Kumar  
  
Discussion: https://www.postgresql.org/message-id/CAFiTN-tjZbuY6vy7kZZ6xO%2BD4mVcO5wOPB5KiwJ3AHhpytd8fg%40mail.gmail.com  

M src/backend/access/hash/README

Avoid unnecessary shared invalidations in ROLLBACK PREPARED

commit   : 710796f0542180cca18ee93889da692df642bdf2    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 12 Aug 2021 20:12:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 12 Aug 2021 20:12:47 +0900    

Click here for diff

The performance gain is minimal, but this makes the logic more  
consistent with AtEOXact_Inval().  No other invalidation is needed in  
this case as PREPARE takes already care of sending any local ones.  
  
Author: Liu Huailing  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/OSZPR01MB6215AA84D71EF2B3D354CF86BE139@OSZPR01MB6215.jpnprd01.prod.outlook.com  

M src/backend/access/transam/twophase.c

Fix segfault during EvalPlanQual with mix of local and foreign partitions.

commit   : c3928b467a4f0ed2b0ef21a33848e9fcdade37b4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Aug 2021 11:02:29 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 12 Aug 2021 11:02:29 +0300    

Click here for diff

It's not sensible to re-evaluate a direct-modify Foreign Update or Delete  
during EvalPlanQual. However, ExecInitForeignScan() can still get called  
if a table mixes local and foreign partitions. EvalPlanQualStart() left  
the es_result_relations array uninitialized in the child EPQ EState, but  
ExecInitForeignScan() still expected to find it. That caused a segfault.  
  
Fix by skipping the es_result_relations lookup during EvalPlanQual  
processing. To make things a bit more robust, also skip the  
BeginDirectModify calls, and add a runtime check that ExecForeignScan()  
is not called on direct-modify foreign scans during EvalPlanQual  
processing.  
  
This is new in v14, commit 1375422c782. Before that, EvalPlanQualStart()  
copied the whole ResultRelInfo array to the EPQ EState. Backpatch to v14.  
  
Report and diagnosis by Andrey Lepikhov.  
  
Discussion: https://www.postgresql.org/message-id/cb2b808d-cbaa-4772-76ee-c8809bafcf3d%40postgrespro.ru  

M src/backend/executor/nodeForeignscan.c

Fix failure of btree_gin indexscans with "char" type and </<= operators.

commit   : a6bd28beb0639d4cf424e961862a65c466ca65bf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 10 Aug 2021 18:10:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 10 Aug 2021 18:10:29 -0400    

Click here for diff

As a result of confusion about whether the "char" type is signed or  
unsigned, scans for index searches like "col < 'x'" or "col <= 'x'"  
would start at the middle of the index not the left end, thus missing  
many or all of the entries they should find.  Fortunately, this  
is not a symptom of index corruption.  It's only the search logic  
that is broken, and we can fix it without unpleasant side-effects.  
  
Per report from Jason Kim.  This has been wrong since btree_gin's  
beginning, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/expected/char.out

Add alternative output for OpenSSL 3 without legacy loaded

commit   : 72bbff4cd6eaf55239ccef79cec61766b5f8f1d2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 15:08:46 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 15:08:46 +0200    

Click here for diff

OpenSSL 3 introduced the concept of providers to support modularization,  
and moved the outdated ciphers to the new legacy provider. In case it's  
not loaded in the users openssl.cnf file there will be a lot of regress  
test failures, so add alternative outputs covering those.  
  
Also document the need to load the legacy provider in order to use older  
ciphers with OpenSSL-enabled pgcrypto.  
  
This will be backpatched to all supported version once there is sufficient  
testing in the buildfarm of OpenSSL 3.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

A contrib/pgcrypto/expected/blowfish_1.out
A contrib/pgcrypto/expected/cast5_1.out
A contrib/pgcrypto/expected/des_1.out
A contrib/pgcrypto/expected/pgp-decrypt_1.out
A contrib/pgcrypto/expected/pgp-pubkey-decrypt_1.out
M doc/src/sgml/pgcrypto.sgml

Disable OpenSSL EVP digest padding in pgcrypto

commit   : 318df802355924015d4d8f21859bc0ef7a348970    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 15:01:52 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 15:01:52 +0200    

Click here for diff

The PX layer in pgcrypto is handling digest padding on its own uniformly  
for all backend implementations. Starting with OpenSSL 3.0.0, DecryptUpdate  
doesn't flush the last block in case padding is enabled so explicitly  
disable it as we don't use it.  
  
This will be backpatched to all supported version once there is sufficient  
testing in the buildfarm of OpenSSL 3.  
  
Reviewed-by: Peter Eisentraut, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/openssl.c

Remove unused regression test certificate server-ss

commit   : 152c2e0ae1a8d0ed810b2e833b536e64b91da0a6    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 11:15:02 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 10 Aug 2021 11:15:02 +0200    

Click here for diff

The server-ss certificate was included in e39250c64 but was never  
used in the TLS regression tests so remove.  
  
Author: Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/Makefile
M src/test/ssl/README
D src/test/ssl/ssl/server-ss.crt
D src/test/ssl/ssl/server-ss.key

Add tab completion for DECLARE .. ASENSITIVE in psql

commit   : e2ce88b58f151753b094f28bc387cebae865927c    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 15:54:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 15:54:42 +0900    

Click here for diff

This option has been introduced in dd13ad9.  
  
Author: Shinya Kato  
Discussion: https://postgr.es/m/TYAPR01MB289665526B76DA29DC70A031C4F09@TYAPR01MB2896.jpnprd01.prod.outlook.com  

M src/bin/psql/tab-complete.c

Fix regression test output of sepgsql

commit   : 1e3445237b861fee2524defde79428058d90c0d8    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 13:14:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 13:14:37 +0900    

Click here for diff

The difference is caused by 7b56584, for the tests involving a table  
rewrite.  
  
Per buildfarm member rhinoceros.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/ddl.out

Add call to object access hook at the end of table rewrite in ALTER TABLE

commit   : 7b565843a94412395149c6add0cbfc21d2bca0d4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 12:21:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 10 Aug 2021 12:21:05 +0900    

Click here for diff

ALTER TABLE .. SET {LOGGED,UNLOGGED,ACCESS METHOD} would never do a  
table-level object access hook, which was inconsistent with SET  
TABLESPACE.  Note that contrary to SET TABLESPACE, the no-op case is  
left off for those commands as this requires tracking if commands have  
been called, but they may not execute a physical rewrite.  Another thing  
worth noting is that the physical file swap at the end of a rewrite  
does a couple of access calls for internal objects created for the swap  
operation (internal objects are for example skipped by the tests of  
sepgsql), but this does not trigger the hook for the table on which the  
operation is done.  
  
f41872d, that added support for SET LOGGED/UNLOGGED in ALTER TABLE,  
visibly forgot to consider that.  
  
Based on what I checked, two regression tests of sepgsql in ddl.sql are  
going to log more information with this test, something that buildfarm  
member rhinoceros will tell soon enough.  I am not completely sure of  
their format though, so these are not refreshed yet.  
  
This is arguably a bug, but no backpatch is done as this could cause a  
behavior change for anybody using object access hooks.  
  
Reported-by: Jeff Davis  
Discussion: https://postgr.es/m/YQJKV29/[email protected]  

M src/backend/commands/tablecmds.c

Let regexp_replace() make use of REG_NOSUB when feasible.

commit   : 18bac60ede44359a1e577df80aef196e371c902e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 20:53:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 20:53:25 -0400    

Click here for diff

If the replacement string doesn't contain \1...\9, then we don't  
need sub-match locations, so we can use the REG_NOSUB optimization  
here too.  There's already a pre-scan of the replacement string  
to look for backslashes, so extend that to check for digits, and  
refactor to allow that to happen before we compile the regexp.  
  
While at it, try to speed up the pre-scan by using memchr() instead  
of a handwritten loop.  It's likely that this is lost in the noise  
compared to the regexp processing proper, but maybe not.  In any  
case, this coding is shorter.  
  
Also, add some test cases to improve the poor coverage of  
appendStringInfoRegexpSubstr().  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/varlena.c
M src/include/utils/varlena.h
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

Fix bogus assertion in BootstrapModeMain().

commit   : e12694523e7e4482a052236f12d3d8b58be9a22c    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 9 Aug 2021 08:26:59 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 9 Aug 2021 08:26:59 -0700    

Click here for diff

The assertion was always true, as written, thanks to me "simplifying" it  
before commit.  
  
Per coverity and Tom Lane.  

M src/backend/bootstrap/bootstrap.c

Avoid determining regexp subexpression matches, when possible.

commit   : 0e6aa8747d439bb7f08f95e358f0509c50396785    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 11:26:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 9 Aug 2021 11:26:34 -0400    

Click here for diff

Identifying the precise match locations for parenthesized subexpressions  
is a fairly expensive task given the way our regexp engine works, both  
at regexp compile time (where we must create an optimized NFA for each  
parenthesized subexpression) and at runtime (where determining exact  
match locations requires laborious search).  
  
Up to now we've made little attempt to optimize this situation.  This  
patch identifies cases where we know at compile time that we won't  
need to know subexpression match locations, and teaches the regexp  
compiler to not bother creating per-subexpression regexps for  
parenthesis pairs that are not referenced by backrefs elsewhere in  
the regexp.  (To preserve semantics, we obviously still have to  
pin down the match locations of backref references.)  Users could  
have obtained the same results before this by being careful to  
write "non capturing" parentheses wherever possible, but few people  
bother with that.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_trgm/trgm_regexp.c
M src/backend/regex/regc_lex.c
M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/regexp.c
M src/include/regex/regex.h
M src/include/regex/regguts.h
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql

Remove some special cases from MSVC build scripts

commit   : 76ad24400d73fa10d527844d50bedf7dacb1e87b    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 19:45:26 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 19:45:26 +1200    

Click here for diff

Here we add additional parsing of Makefiles to determine when to add  
references to libpgport and libpgcommon.  We also remove the need for  
adding the current contrib_extrasource by adding sine very basic logic to  
implement the Makefile rules which add .l and .y files when they exist for  
a given .o file in the Makefile.  
  
This is just some very basic additional parsing of Makefiles to try to  
keep things more consistent between builds using make and MSVC builds.  
This happens to work with how our current Makefiles are laid out, but it  
could easily be broken in the future if someone chooses do something in  
the Makefile that we don't have parsing support for.  We will cross that  
bridge when we come to it.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvoPULi5JW3933NxgwxOmu9Ncvpcyt87UhEHAUX16QqmpA@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm

Doc: Fix misleading statement about VACUUM memory limits

commit   : deb6ffd4fdeb589de7a13ac1791380a7138cf59f    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 16:45:35 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 16:45:35 +1200    

Click here for diff

In ec34040af I added a mention that there was no point in setting  
maintenance_work_limit to anything higher than 1GB for vacuum, but that  
was incorrect as ginInsertCleanup() also looks at what  
maintenance_work_mem is set to during VACUUM and that's not limited to  
1GB.  
  
Here I attempt to make it more clear that the limitation is only around  
the number of dead tuple identifiers that we can collect during VACUUM.  
  
I've also added a note to autovacuum_work_mem to mention this limitation.  
I didn't do that in ec34040af as I'd had some wrong-headed ideas about  
just limiting the maximum value for that GUC to 1GB.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvpGwOAvunp-E-bN_rbAs3hmxMoasm5pzkYDbf36h73s7w@mail.gmail.com  
Backpatch-through: 9.6, same as ec34040af  

M doc/src/sgml/config.sgml

Use ExplainPropertyInteger for queryid in EXPLAIN

commit   : 4a3d806f38f99fecf8f2a2bf7990a7ebea9b6c63    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:47:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:47:00 +1200    

Click here for diff

This saves a few lines of code.  Also add a comment to mention why we use  
ExplainPropertyInteger instead of ExplainPropertyUInteger given that  
queryid is a uint64 type.  
  
Author: David Rowley  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/CAApHDvqhSLYpSU_EqUdN39w9Uvb8ogmHV7_3YhJ0S3aScGBjsg@mail.gmail.com  
Backpatch-through: 14, where this code was originally added  

M src/backend/commands/explain.c

Fix typo in 022_twophase_cascade.pl.

commit   : c9229d3d2b05b90fba32bd4afb5eb251b53b73be    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 9 Aug 2021 08:58:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 9 Aug 2021 08:58:38 +0530    

Click here for diff

Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pta=zo8G1DWVVg-LU6b_JvHHCueC=AKVpKJOrwLzj9EZA@mail.gmail.com  

M src/test/subscription/t/022_twophase_cascade.pl

Add POPCNT support for MSVC x86_64 builds

commit   : 2e281249af6c702fd057f34150fd9ac6cb8c7a8b    
  
author   : David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:23:48 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 9 Aug 2021 15:23:48 +1200    

Click here for diff

02a6a54ec added code to make use of the POPCNT instruction when available  
for many of our common platforms.  Here we do the same for MSVC for x86_64  
machines.  
  
MSVC's intrinsic functions for popcnt seem to differ from GCCs in that  
they always appear to emit the popcnt instructions.  In GCC the behavior  
will depend on if the source file was compiled with -mpopcnt or not.  For  
this reason, the MSVC intrinsic function has been lumped into the  
pg_popcount*_asm function, however doing that sort of invalidates the name  
of that function, so let's rename it to pg_popcount*_fast().  
  
Author: David Rowley  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CAApHDvqL3cbbK%3DGzNcwzsNR9Gi%2BaUvTudKkC4XgnQfXirJ_oRQ%40mail.gmail.com  

M src/port/pg_bitutils.c

doc: mention pg_upgrade extension script

commit   : d8a75b1308b133502ae3f02be485e9cd4eda9803    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 8 Aug 2021 21:05:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 8 Aug 2021 21:05:46 -0400    

Click here for diff

Since commit e462856a7a, pg_upgrade automatically creates a script to  
update extensions, so mention that instead of ALTER EXTENSION.  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pgupgrade.sgml

Remove some unnecessary casts in format arguments

commit   : ae03a7c7391dfc59f14226b7cfd8ef9f3390e56f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 22:05:42 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 22:05:42 +0200    

Click here for diff

We can use %zd or %zu directly, no need to cast to int.  Conversely,  
some code was casting away from int when it could be using %d  
directly.  

M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/xlogutils.c
M src/backend/utils/adt/xml.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_waldump/pg_waldump.c

Doc: remove bogus <indexterm> items.

commit   : cf5ce5aa70d33fc3048ab63c50585b8cc0f11dfd    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 15:35:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 15:35:30 -0400    

Click here for diff

Copy-and-pasteo in 665c5855e, evidently.  The 9.6 docs toolchain  
whined about duplicate index entries, though our modern toolchain  
doesn't.  In any case, these GUCs surely are not about the  
default settings of these values.  

M doc/src/sgml/config.sgml

Check the size in COPY_POINTER_FIELD

commit   : c1132aae336c41cf9d316222e525d8d593c2b5d2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    

Click here for diff

instead of making each caller do it.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/copyfuncs.c

Change NestPath node to contain JoinPath node

commit   : 18fea737b5e47cc677eaf97365c765a47f346763    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    

Click here for diff

This makes the structure of all JoinPath-derived nodes the same,  
independent of whether they have additional fields.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h

Change SeqScan node to contain Scan node

commit   : 2226b4189bb4ccfcc53917a8695d24e91ff2f950    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 8 Aug 2021 16:55:51 +0200    

Click here for diff

This makes the structure of all Scan-derived nodes the same,  
independent of whether they have additional fields.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/executor/nodeSeqscan.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/plannodes.h

commit   : 00116dee5ad4c1964777c91e687bb98b1d9f7ea0    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 11:56:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 8 Aug 2021 11:56:29 -0400    

Click here for diff

I had committer's remorse almost immediately after pushing cb76fbd7e,  
upon finding that removing capturing subexpressions' subREs from the  
data structure broke my proposed patch for REG_NOSUB optimization.  
Revert that data structure change.  Instead, address the concern  
about not changing capturing subREs' endpoints by not changing the  
endpoints.  We don't need to, because the point of that bit was just  
to ensure that the atom has endpoints distinct from the outer state  
pair that we're stringing the branch between.  We already made  
suitable states in the parenthesized-subexpression case, so the  
additional ones were just useless overhead.  This seems more  
understandable than Spencer's original coding, and it ought to be  
a shade faster too by saving a few state creations and arc changes.  
(I actually see a couple percent improvement on Jacobson's web  
corpus, though that's barely above the noise floor so I wouldn't  
put much stock in that result.)  
  
Also, fix the logic added by ea1268f63 to ensure that the subRE  
recorded in v->subs[subno] is exactly the one with capno == subno.  
Spencer's original coding recorded the child subRE of the capture  
node, which is okay so far as having the right endpoint states is  
concerned, but as of cb76fbd7e the capturing subRE itself always  
has those endpoints too.  I think the inconsistency is confusing  
for the REG_NOSUB optimization.  
  
As before, backpatch to v14.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c

Remove unused function declaration

commit   : 75a2d132eaef7d951db894cf3201f85e9a524774    
  
author   : David Rowley <[email protected]>    
date     : Sun, 8 Aug 2021 23:27:57 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 8 Aug 2021 23:27:57 +1200    

Click here for diff

It appears that check_track_commit_timestamp was declared but has never  
been defined in our code base.  Likely this is just leftover cruft from  
a development version of the original patch to add commit timestamps.  
  
Let's just remove the useless declaration.  The inclusion of guc.h also  
seems surplus to requirements.  
  
Author: Andrey Lepikhov  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/commit_ts.h

commit   : cb76fbd7ec87e44b3c53165d68dc2747f7e26a9a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:27:02 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:27:02 -0400    

Click here for diff

Up to now, we remembered the definition of a capturing parenthesis  
subexpression by storing a pointer to the associated subRE node.  
That was okay before, because that subRE didn't get modified anymore  
while parsing the rest of the regexp.  However, in the wake of  
commit ea1268f63, that's no longer true: the outer invocation of  
parseqatom() feels free to scribble on that subRE.  This seems to  
work anyway, because the states we jam into the child atom in the  
"prepare a general-purpose state skeleton" stanza aren't really  
semantically different from the original endpoints of the child atom.  
But that would be mighty easy to break, and it's definitely not how  
things worked before.  
  
Between this and the issue fixed in the prior commit, it seems best  
to get rid of this dependence on subRE nodes entirely.  We don't need  
the whole child subRE for future backrefs, only its starting and ending  
NFA states; so let's just store pointers to those.  
  
Also, in the corner case where we make an extra subRE to handle  
immediately-nested capturing parentheses, it seems like it'd be smart  
to have the extra subRE have the same begin/end states as the original  
child subRE does (s/s2 not lp/rp).  I think that linking it from lp to  
rp might actually be semantically wrong, though since Spencer's original  
code did it that way, I'm not totally certain.  Using s/s2 is certainly  
not wrong, in any case.  
  
Per report from Mark Dilger.  Back-patch to v14 where the problematic  
patches came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c

Fix use-after-free issue in regexp engine.

commit   : cc1868799c8311ed1cc3674df2c5e1374c914deb    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:05:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 22:05:27 -0400    

Click here for diff

Commit cebc1d34e taught parseqatom() to optimize cases where a branch  
contains only one, "messy", atom by getting rid of excess subRE nodes.  
The way we really should do that is to keep the subRE built for the  
"messy" child atom; but to avoid changing parseqatom's nominal API,  
I made it delete that node after copying its fields to the outer subRE  
made by parsebranch().  It seems that that actually worked at the time;  
but it became dangerous after ea1268f63, because that later commit  
allowed the lower invocation of parse() to return a subRE that was also  
pointed to by some v->subs[] entry.  This meant we could wind up with a  
dangling pointer in v->subs[], allowing a later backref to misbehave,  
but only if that subRE struct had been reused in between.  So the damage  
seems confined to cases like '((...))...(...\2'.  
  
To fix, do what I should have done before and modify parseqatom's API  
to make it possible for it to remove the caller's subRE instead of the  
callee's.  That's safer because we know that subRE isn't complete yet,  
so noplace else will have a pointer to it.  
  
Per report from Mark Dilger.  Back-patch to v14 where the problematic  
patches came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/regex/regcomp.c
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/sql/test_regex.sql

Move temporary file cleanup to before_shmem_exit().

commit   : 675c945394b36c2db0e8c8c9f6209c131ce3f0a8    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 7 Aug 2021 19:14:20 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 7 Aug 2021 19:14:20 -0700    

Click here for diff

As reported by a few OSX buildfarm animals there exist at least one path where  
temporary files exist during AtProcExit_Files() processing. As temporary file  
cleanup causes pgstat reporting, the assertions added in ee3f8d3d3ae caused  
failures.  
  
This is not an OSX specific issue, we were just lucky that timing on OSX  
reliably triggered the problem.  The known way to cause this is a FATAL error  
during perform_base_backup() with a MANIFEST used - adding an elog(FATAL)  
after InitializeBackupManifest() reliably reproduces the problem in isolation.  
  
The problem is that the temporary file created in InitializeBackupManifest()  
is not cleaned up via resource owner cleanup as WalSndResourceCleanup()  
currently is only used for non-FATAL errors. That then allows to reach  
AtProcExit_Files() with existing temporary files, causing the assertion  
failure.  
  
To fix this problem, move temporary file cleanup to a before_shmem_exit() hook  
and add assertions ensuring that no temporary files are created before / after  
temporary file management has been initialized / shut down. The cleanest way  
to do so seems to be to split fd.c initialization into two, one for plain file  
access and one for temporary file access.  
  
Right now there's no need to perform further fd.c cleanup during process exit,  
so I just renamed AtProcExit_Files() to BeforeShmemExit_Files(). Alternatively  
we could perform another pass through the files to check that no temporary  
files exist, but the added assertions seem to provide enough protection  
against that.  
  
It might turn out that the assertions added in ee3f8d3d3ae will cause too much  
noise - in that case we'll have to downgrade them to a WARNING, at least  
temporarily.  
  
This commit is not necessarily the best approach to address this issue, but it  
should resolve the buildfarm failures. We can revise later.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/file/fd.c
M src/backend/utils/init/postinit.c
M src/include/storage/fd.h

Remove T_MemoryContext

commit   : 256909c6c1679767230d1088f1bfab727dd99e14    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 23:21:24 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 23:21:24 +0200    

Click here for diff

This is an abstract node that shouldn't have a node tag defined.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/nodes/nodes.h

pg_amcheck: Message style improvements

commit   : 80dfbbf1b17a1fb1123401799efdc660ee977051    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 20:34:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 20:34:49 +0200    

Click here for diff

M src/bin/pg_amcheck/pg_amcheck.c

Really fix the ambiguity in REFRESH MATERIALIZED VIEW CONCURRENTLY.

commit   : 9179a82d7af38112cd0f6e84ab62d0b3592a6e0e    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 13:29:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 7 Aug 2021 13:29:32 -0400    

Click here for diff

Rather than trying to pick table aliases that won't conflict with  
any possible user-defined matview column name, adjust the queries'  
syntax so that the aliases are only used in places where they can't be  
mistaken for column names.  Mostly this consists of writing "alias.*"  
not just "alias", which adds clarity for humans as well as machines.  
We do have the issue that "SELECT alias.*" acts differently from  
"SELECT alias", but we can use the same hack ruleutils.c uses for  
whole-row variables in SELECT lists: write "alias.*::compositetype".  
  
We might as well revert to the original aliases after doing this;  
they're a bit easier to read.  
  
Like 75d66d10e, back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/matview.c
M src/test/regress/expected/matview.out
M src/test/regress/sql/matview.sql

pg_amcheck: Add missing translation markers

commit   : 789d8060f0517d4da0776480d937d8b64d5c5976    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 13:36:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 13:36:59 +0200    

Click here for diff

M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/pg_amcheck.c

Message style improvements

commit   : f4f4a649d80fea3ae0214b06e160eb5d46b48a16    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 12:09:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 7 Aug 2021 12:09:22 +0200    

Click here for diff

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c

pgstat: Schedule per-backend pgstat shutdown via before_shmem_exit().

commit   : fb2c5028e63589c01fbdf8b031be824766dc7a68    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 6 Aug 2021 10:05:57 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 6 Aug 2021 10:05:57 -0700    

Click here for diff

Previously on_shmem_exit() was used. The upcoming shared memory stats patch  
uses DSM segments to store stats, which can not be used after the  
dsm_backend_shutdown() call in shmem_exit().  
  
The preceding commits were required to permit this change. This commit is  
split off the shared memory stats patch to make it easier to isolate problems  
caused by the ordering changes rather than the much larger changes in where  
stats are stored.  
  
Author: Andres Freund <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c

Schedule ShutdownXLOG() in single user mode using before_shmem_exit().

commit   : a1bb3d5dbe6a66ae73d7805a63b951793b5d55df    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 26 Mar 2021 10:52:14 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 26 Mar 2021 10:52:14 -0700    

Click here for diff

Previously on_shmem_exit() was used. The upcoming shared memory stats patch  
uses DSM segments to store stats, which can not be used after the  
dsm_backend_shutdown() call in shmem_exit().  There does not seem to be any  
reason to do ShutdownXLOG() via on_shmem_exit(), so change it.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/init/postinit.c

Make parallel worker shutdown complete entirely via before_shmem_exit().

commit   : fa91d4c91f28f4819dc54f93adbd413a685e366a    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 31 Mar 2021 00:50:28 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 31 Mar 2021 00:50:28 -0700    

Click here for diff

This is a step toward storing stats in dynamic shared memory. As dynamic  
shared memory segments are detached from just after before_shmem_exit()  
callbacks are processed, but before on_shmem_exit() callbacks are, no stats  
can be collected after before_shmem_exit() callbacks have been processed.  
  
Parallel worker shutdown can cause stats to be emitted during DSM detach  
callbacks, e.g. for SharedFileSet (which closes its files, which can causes  
fd.c to emit stats about temporary files). Therefore parallel worker shutdown  
needs to complete during the processing of before_shmem_exit callbacks.  
  
One might think this problem could instead be solved by carefully ordering the  
attaching to DSM segments, so that the pgstats segments get detached from  
later than the parallel query ones. That turns out to not work because the  
stats hash might need to grow which can cause new segments to be  
allocated, which then will be detached from earlier.  
  
There are two code changes:  
  
First, call ParallelWorkerShutdown() via before_shmem_exit. That's a good idea  
on its own, because other shutdown callbacks like ShutdownPostgres and  
ShutdownAuxiliaryProcess are called via before_*.  
  
Second, explicitly detach from the parallel query DSM segment, thereby  
ensuring all stats are emitted during ParallelWorkerShutdown().  
  
There are nicer solutions to these problems, but it's not obvious which of  
those solutions is the correct one. As the shared memory stats work already is  
a huge amount of work...  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/parallel.c

pgstat: Bring up pgstat in BaseInit() to fix uninitialized use of pgstat by AV.

commit   : ee3f8d3d3aec0d7c961d6b398d31504bb272a450    
  
author   : Andres Freund <[email protected]>    
date     : Fri, 6 Aug 2021 18:54:39 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Fri, 6 Aug 2021 18:54:39 -0700    

Click here for diff

Previously pgstat_initialize() was called in InitPostgres() and  
AuxiliaryProcessMain(). As it turns out there was at least one case where we  
reported stats before pgstat_initialize() was called, see  
AutoVacWorkerMain()'s intentionally early call to pgstat_report_autovac().  
  
This turns out to not be a problem with the current pgstat implementation as  
pgstat_initialize() only registers a shutdown callback. But in the shared  
memory based stats implementation we are working towards pgstat_initialize()  
has to do more work.  
  
After b406478b87e BaseInit() is a central place where initialization shared by  
normal backends and auxiliary backends can be put. Obviously BaseInit() is  
called before InitPostgres() registers ShutdownPostgres. Previously  
ShutdownPostgres was the first before_shmem_exit callback, now that's commonly  
pgstats. That should be fine.  
  
Previously pgstat_initialize() was not called in bootstrap mode, but there  
does not appear to be a need for that. It's now done unconditionally.  
  
To detect future issues like this, assertions are added to a few places  
verifying that the pgstat subsystem is initialized and not yet shut down.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/init/postinit.c

Don't elide casting to typmod -1.

commit   : 5c056b0c2519e602c2e98bace5b16d2ecde6454b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 6 Aug 2021 17:32:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 6 Aug 2021 17:32:54 -0400    

Click here for diff

Casting a value that's already of a type with a specific typmod  
to an unspecified typmod doesn't do anything so far as run-time  
behavior is concerned.  However, it really ought to change the  
exposed type of the expression to match.  Up to now,  
coerce_type_typmod hasn't bothered with that, which creates gotchas  
in contexts such as recursive unions.  If for example one side of  
the union is numeric(18,3), but it needs to be plain numeric to  
match the other side, there's no direct way to express that.  
  
This is easy enough to fix, by inserting a RelabelType to update the  
exposed type of the expression.  However, it's a bit nervous-making  
to change this behavior, because it's stood for a really long time.  
(I strongly suspect that it's like this in part because the logic  
pre-dates the introduction of RelabelType in 7.0.  The commit log  
message for 57b30e8e2 is interesting reading here.)  As a compromise,  
we'll sneak the change into 14beta3, and consider back-patching to  
stable branches if no complaints emerge in the next three months.  
  
Discussion: https://postgr.es/m/CABNQVagu3bZGqiTjb31a8D5Od3fUMs7Oh3gmZMQZVHZ=uWWWfQ@mail.gmail.com  

M src/backend/parser/parse_coerce.c
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

Adjust the integer overflow tests in the numeric code.

commit   : 2642df9fac09540c761441edd9bdd0a72c62f39c    
  
author   : Dean Rasheed <[email protected]>    
date     : Fri, 6 Aug 2021 21:29:15 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Fri, 6 Aug 2021 21:29:15 +0100    

Click here for diff

Formerly, the numeric code tested whether an integer value of a larger  
type would fit in a smaller type by casting it to the smaller type and  
then testing if the reverse conversion produced the original value.  
That's perfectly fine, except that it caused a test failure on  
buildfarm animal castoroides, most likely due to a compiler bug.  
  
Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That  
matches existing code in other places, such as int84(), which is more  
widely tested, and so is less likely to go wrong.  
  
While at it, add regression tests covering the numeric-to-int8/4/2  
conversions, and adjust the recently added tests to the style of  
434ddfb79a (on the v11 branch) to make failures easier to diagnose.  
  
Per buildfarm via Tom Lane, reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Add missing message punctuation

commit   : ba4eb86ceff4eded5920d36ef82a2096db7ad0c0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 22:11:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 22:11:02 +0200    

Click here for diff

M src/backend/catalog/pg_type.c
M src/test/regress/expected/multirangetypes.out

Fix wording

commit   : 05e60aece33e84960ef566e4735b2d93c2d791c8    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 20:55:59 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 6 Aug 2021 20:55:59 +0200    

Click here for diff

M doc/src/sgml/rules.sgml
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/bin/pg_resetwal/pg_resetwal.c

process startup: Always call Init[Auxiliary]Process() before BaseInit().

commit   : b406478b87e2234c0be4ca4105eee3bb466a646b    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 14:37:09 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 14:37:09 -0700    

Click here for diff

For EXEC_BACKEND InitProcess()/InitAuxiliaryProcess() needs to have been  
called well before we call BaseInit(), as SubPostmasterMain() needs LWLocks to  
work. Having the order of initialization differ between platforms makes it  
unnecessarily hard to understand the system and to add initialization points  
for new subsystems without a lot of duplication.  
  
To be able to change the order, BaseInit() cannot trigger  
CreateSharedMemoryAndSemaphores() anymore - obviously that needs to have  
happened before we can call InitProcess(). It seems cleaner to create shared  
memory explicitly in single user/bootstrap mode anyway.  
  
After this change the separation of bufmgr initialization into  
InitBufferPoolAccess() / InitBufferPoolBackend() is not meaningful anymore so  
the latter is removed.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/postinit.c
M src/include/storage/bufmgr.h

Call pgwin32_signal_initialize() in postmaster as well.

commit   : 0de13bbc47d19c95de132cc85c341fdab079c170    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 15:31:29 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 15:31:29 -0700    

Click here for diff

This was an oversight in 07bf3785099. While it does reduce the benefit of the  
simplification due to that commit, it still seems like a win to me.  
  
It seems like it might be a good idea to have a function mirroring  
InitPostmasterChild() / InitStandaloneProcess() for postmaster in miscinit.c  
to make it easier to keep initialization between the three possible  
environment in sync.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

process startup: Centralize pgwin32_signal_initialize() calls.

commit   : 07bf37850991c68a7038fb06186bddfd64c72faf    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:36:06 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:36:06 -0700    

Click here for diff

For one, the existing location lead to somewhat awkward code in main(). For  
another, the new location is easier to understand anyway.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c

process startup: Remove bootstrap / checker modes from AuxProcType.

commit   : f8dd4ecb0b7fc3420e199021375e622815cd326f    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:17:31 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:17:31 -0700    

Click here for diff

Neither is actually initialized as an auxiliary process, so it does not really  
make sense to reserve a PGPROC etc for them.  
  
This keeps checker mode implemented by exiting partway through bootstrap  
mode. That might be worth changing at some point, perhaps if we ever extend  
checker mode to be a more general tool.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/main/main.c
M src/backend/postmaster/auxprocess.c
M src/bin/initdb/initdb.c
M src/include/bootstrap/bootstrap.h
M src/include/miscadmin.h

process startup: Move AuxiliaryProcessMain into its own file.

commit   : 0a692109dcc73178962069addf7478ac89950e4d    
  
author   : Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:09:19 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Thu, 5 Aug 2021 12:09:19 -0700    

Click here for diff

After the preceding commits the auxprocess code is independent from  
bootstrap.c - so a dedicated file seems less confusing.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/Makefile
A src/backend/postmaster/auxprocess.c
M src/backend/postmaster/postmaster.c
M src/include/bootstrap/bootstrap.h
M src/include/miscadmin.h
A src/include/postmaster/auxprocess.h

process startup: auxprocess: reindent block

commit   : 27f790346621e1db3cc0305e7ae2b2cbfb537aa6    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:30:12 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:30:12 -0700    

Click here for diff

Kept separate for ease of review, particularly because pgindent insists on  
reflowing a few comments.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c

process startup: Separate out BootstrapModeMain from AuxiliaryProcessMain.

commit   : 5aa4a9d2077fa902b4041245805082fec6be0648    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:29:45 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:29:45 -0700    

Click here for diff

There practically was no shared code between the two, once all the ifs are  
removed. And it was quite confusing that aux processes weren't actually  
started by the call to AuxiliaryProcessMain() in main().  
  
There's more to do, AuxiliaryProcessMain() should move out of bootstrap.c, and  
BootstrapModeMain() shouldn't use/be part of AuxProcType.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/bootstrap/bootstrap.c
M src/backend/main/main.c
M src/backend/postmaster/postmaster.c
M src/include/bootstrap/bootstrap.h

process startup: Rename postmaster's --forkboot to --forkaux.

commit   : 50017f77722b8b998ead5ca6fdb0b821fe7a34d2    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:28:46 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:28:46 -0700    

Click here for diff

It is confusing that aux processes are started with --forkboot, given that  
bootstrap mode cannot run below postmaster.  
  
Author: Andres Freund <[email protected]>  
Reviewed-By: Kyotaro Horiguchi <[email protected]>  
Reviewed-By: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/postmaster.c

postgres_fdw: Fix issues with generated columns in foreign tables.

commit   : aa769f80ed80b7adfbdea9a6bc267ba4aeb80fd7    
  
author   : Etsuro Fujita <[email protected]>    
date     : Thu, 5 Aug 2021 20:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Thu, 5 Aug 2021 20:00:00 +0900    

Click here for diff

postgres_fdw imported generated columns from the remote tables as plain  
columns, and caused failures like "ERROR: cannot insert a non-DEFAULT  
value into column "foo"" when inserting into the foreign tables, as it  
tried to insert values into the generated columns.  To fix, we do the  
following under the assumption that generated columns in a postgres_fdw  
foreign table are defined so that they represent generated columns in  
the underlying remote table:  
  
* Send DEFAULT for the generated columns to the foreign server on insert  
  or update, not generated column values computed on the local server.  
* Add to postgresImportForeignSchema() an option "import_generated" to  
  include column generated expressions in the definitions of foreign  
  tables imported from a foreign server.  The option is true by default.  
  
The assumption seems reasonable, because that would make a query of the  
postgres_fdw foreign table return values for the generated columns that  
are consistent with the generated expression.  
  
While here, fix another issue in postgresImportForeignSchema(): it tried  
to include column generated expressions as column default expressions in  
the foreign table definitions when the import_default option was enabled.  
  
Per bug #16631 from Daniel Cherniy.  Back-patch to v12 where generated  
columns were added.  
  
Discussion: https://postgr.es/m/16631-e929fe9db0ffc7cf%40postgresql.org  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Remove unused argument "txn" in maybe_send_schema().

commit   : 93d573d86571d148e2d14415166ec6981d34ea9d    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 5 Aug 2021 17:49:51 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 5 Aug 2021 17:49:51 +0900    

Click here for diff

Commit 464824323e added the argument "txn" into maybe_send_schema()  
though it was not used.  
  
Author: Hou Zhijie  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/OS0PR01MB5716146E43928FB92D45D29794EC9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/replication/pgoutput/pgoutput.c

Fix division-by-zero error in to_char() with 'EEEE' format.

commit   : 226ec49ffd78c0f246da8fceb3094991dd2302ff    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 5 Aug 2021 09:24:11 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 5 Aug 2021 09:24:11 +0100    

Click here for diff

This fixes a long-standing bug when using to_char() to format a  
numeric value in scientific notation -- if the value's exponent is  
less than -NUMERIC_MAX_DISPLAY_SCALE-1 (-1001), it produced a  
division-by-zero error.  
  
The reason for this error was that get_str_from_var_sci() divides its  
input by 10^exp, which it produced using power_var_int(). However, the  
underflow test in power_var_int() causes it to return zero if the  
result scale is too small. That's not a problem for power_var_int()'s  
only other caller, power_var(), since that limits the rscale to 1000,  
but in get_str_from_var_sci() the exponent can be much smaller,  
requiring a much larger rscale. Fix by introducing a new function to  
compute 10^exp directly, with no rscale limit. This also allows 10^exp  
to be computed more efficiently, without any numeric multiplication,  
division or rounding.  
  
Discussion: https://postgr.es/m/CAEZATCWhojfH4whaqgUKBe8D5jNHB8ytzemL-PnRx+KCTyMXmg@mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

pgbench: When using pipelining only do PQconsumeInput() when necessary.

commit   : 87bff68840d542011ed8f60427502fb90fdf2873    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:19:44 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:19:44 -0700    

Click here for diff

Up to now we did a PQconsumeInput() for each pipelined query, asking the OS  
for more input - which it often won't have, as all results might already have  
been sent. That turns out to have a noticeable performance impact.  
  
Alvaro Herrera reviewed the idea to add the PQisBusy() check, but not this  
concrete patch.  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14, where libpq/pgbench pipelining was introduced.  

M src/bin/pgbench/pgbench.c

pgstat: split reporting/fetching of bgwriter and checkpointer stats.

commit   : 1bc8e7b0991c1eae5fa6dc2d29bb2280efb52740    
  
author   : Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:16:04 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Wed, 4 Aug 2021 19:16:04 -0700    

Click here for diff

These have been unrelated since bgwriter and checkpointer were split into two  
processes in 806a2aee379. As there several pending patches (shared memory  
stats, extending the set of tracked IO / buffer statistics) that are made a  
bit more awkward by the grouping, split them. Done separately to make  
reviewing easier.  
  
This does *not* change the contents of pg_stat_bgwriter or move fields out of  
bgwriter/checkpointer stats that arguably do not belong in either. However  
pgstat_fetch_global() was renamed and split into  
pgstat_fetch_stat_checkpointer() and pgstat_fetch_stat_bgwriter().  
  
Author: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h

Make vacuum_index_cleanup reloption RELOPT_TYPE_ENUM.

commit   : cc8033e1dafe89271aa86c2f2f86a828956929f0    
  
author   : Peter Geoghegan <[email protected]>    
date     : Tue, 3 Aug 2021 21:53:41 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Tue, 3 Aug 2021 21:53:41 -0700    

Click here for diff

Oversight in commit 3499df0d, which generalized the reloption as a way  
of giving users a way to consistently avoid VACUUM's index bypass  
optimization.  
  
Per off-list report from Nikolay Shaplov.  
  
Backpatch: 14-, where index cleanup reloption was extended.  

M src/backend/access/common/reloptions.c

Add prepare API support for streaming transactions in logical replication.

commit   : 63cf61cdeb7b0450dcf3b2f719c553177bac85a2    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 4 Aug 2021 07:47:06 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 4 Aug 2021 07:47:06 +0530    

Click here for diff

Commit a8fd13cab0 added support for prepared transactions to built-in  
logical replication via a new option "two_phase" for a subscription. The  
"two_phase" option was not allowed with the existing streaming option.  
  
This commit permits the combination of "streaming" and "two_phase"  
subscription options. It extends the pgoutput plugin and the subscriber  
side code to add the prepare API for streaming transactions which will  
apply the changes accumulated in the spool-file at prepare time.  
  
Author: Peter Smith and Ajin Cherian  
Reviewed-by: Vignesh C, Amit Kapila, Greg Nancarrow  
Tested-By: Haiying Tang  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAMGcDxeqEpWj3fTXwqhSwBdXd2RS9jzwWscO-XbeCfso6ts3+Q@mail.gmail.com  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/logicalproto.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/022_twophase_cascade.pl
A src/test/subscription/t/023_twophase_stream.pl

Add assorted new regexp_xxx SQL functions.

commit   : 6424337073589476303b10f6d7cc74f501b8d9d7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 3 Aug 2021 13:08:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 3 Aug 2021 13:08:49 -0400    

Click here for diff

This patch adds new functions regexp_count(), regexp_instr(),  
regexp_like(), and regexp_substr(), and extends regexp_replace()  
with some new optional arguments.  All these functions follow  
the definitions used in Oracle, although there are small differences  
in the regexp language due to using our own regexp engine -- most  
notably, that the default newline-matching behavior is different.  
Similar functions appear in DB2 and elsewhere, too.  Aside from  
easing portability, these functions are easier to use for certain  
tasks than our existing regexp_match[es] functions.  
  
Gilles Darold, heavily revised by me  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/varlena.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/varlena.h
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql

C comment: correct heading of extension query

commit   : 9e51cc87fd0ac46b183cb7302a6751d52d3f159a    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:26:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:26:08 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

M src/bin/pg_upgrade/version.c

interval: round values when spilling to months

commit   : 95ab1e0a9db321dd796344d526457016eada027f    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:10:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 12:10:29 -0400    

Click here for diff

Previously spilled units greater than months were truncated to months.  
Also document the spill behavior.  
  
Reported-by: Bryn Llewelly  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: master  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/datetime.c
M src/interfaces/ecpg/pgtypeslib/interval.c

pg_upgrade: warn about extensions that need updating

commit   : e462856a7a559c94bad51507c6b324f337d8254b    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:58:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:58:15 -0400    

Click here for diff

Also create a script that can be run to update them.  
  
Reported-by: Dave Cramer  
  
Discussion: https://postgr.es/m/CADK3HHKawwbOcGwMGnDuAf3-U8YfvTcS8jqDv3UM=niijs3MMA@mail.gmail.com  
  
Backpatch-through: 9.6  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/version.c

pg_upgrade: improve docs about extension upgrades

commit   : 5090d709f172ecd00b16b6e336c8c149a3f3d33d    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:27:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:27:33 -0400    

Click here for diff

The previous wording was unclear about the steps needed to upgrade  
extensions, and how to update them after pg_upgrade.  
  
Reported-by: Dave Cramer  
  
Discussion: https://postgr.es/m/CADK3HHKawwbOcGwMGnDuAf3-U8YfvTcS8jqDv3UM=niijs3MMA@mail.gmail.com  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pgupgrade.sgml

doc: mention inheritance's tableoid can be used in partitioning

commit   : 691272cae96b3c947d3d2d4d8c43c499e72c65a2    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:11:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 11:11:51 -0400    

Click here for diff

Previously tableoid was not mentioned in the partition doc section.  We  
only had a link to the "all the normal rules" of inheritance section.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 10  

M doc/src/sgml/ddl.sgml

doc: add example of using pg_dump with GNU split and gzip

commit   : cfbbb8610d17bc6d82f37a446c38b29e2a5258f4    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 10:57:32 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 3 Aug 2021 10:57:32 -0400    

Click here for diff

This is only possible with GNU split, not other versions like BSD split.  
  
Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

M doc/src/sgml/backup.sgml

Further simplify a bit of logic in StartupXLOG().

commit   : 8f7c8e2bef2bd2587e5d66dd20de15f3db0a6bcb    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 3 Aug 2021 14:11:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 3 Aug 2021 14:11:55 +1200    

Click here for diff

Commit 7ff23c6d277d1d90478a51f0dd81414d343f3850 left us with two  
identical cases. Collapse them.  
  
Author: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ8NRsqgkZEnsnRc2MFROBV-jCnacbYvtpptK2A9YYp9Q%40mail.gmail.com  

M src/backend/access/transam/xlog.c

Allow ordered partition scans in more cases

commit   : db632fbca392389807ffb9d9b2207157e8e9b3e8    
  
author   : David Rowley <[email protected]>    
date     : Tue, 3 Aug 2021 12:25:52 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 3 Aug 2021 12:25:52 +1200    

Click here for diff

959d00e9d added the ability to make use of an Append node instead of a  
MergeAppend when we wanted to perform a scan of a partitioned table and  
the required sort order was the same as the partitioned keys and the  
partitioned table was defined in such a way that earlier partitions were  
guaranteed to only contain lower-order values than later partitions.  
However, previously we didn't allow these ordered partition scans for  
LIST partitioned table when there were any partitions that allowed  
multiple Datums.  This was a very cheap check to make and we could likely  
have done a little better by checking if there were interleaved  
partitions, but at the time we didn't have visibility about which  
partitions were pruned, so we still may have disallowed cases where all  
interleaved partitions were pruned.  
  
Since 475dbd0b7, we now have knowledge of pruned partitions, we can do a  
much better job inside partitions_are_ordered().  
  
Here we pass which partitions survived partition pruning into  
partitions_are_ordered() and, for LIST partitioning, have it check to see  
if any live partitions exist that are also in the new "interleaved_parts"  
field defined in PartitionBoundInfo.  
  
For RANGE partitioning we can relax the code which caused the partitions  
to be unordered if a DEFAULT partition existed.  Since we now know which  
partitions were pruned, partitions_are_ordered() now returns true when the  
DEFAULT partition was pruned.  
  
Reviewed-by: Amit Langote, Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvrdoN_sXU52i=QDXe2k3WAo=EVry29r2+Tq2WYcn2xhEA@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/partitioning/partbounds.c
M src/include/partitioning/partbounds.h
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Track a Bitmapset of non-pruned partitions in RelOptInfo

commit   : 475dbd0b718de8ac44da144f934651b959e3b705    
  
author   : David Rowley <[email protected]>    
date     : Tue, 3 Aug 2021 11:47:24 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 3 Aug 2021 11:47:24 +1200    

Click here for diff

For partitioned tables with large numbers of partitions where queries are  
able to prune all but a very small number of partitions, the time spent in  
the planner looping over RelOptInfo.part_rels checking for non-NULL  
RelOptInfos could become a large portion of the overall planning time.  
  
Here we add a Bitmapset that records the non-pruned partitions.  This  
allows us to more efficiently skip the pruned partitions by looping over  
the Bitmapset.  
  
This will cause a very slight slow down in cases where no or not many  
partitions could be pruned, however, those cases are already slow to plan  
anyway and the overhead of looping over the Bitmapset would be  
unmeasurable when compared with the other tasks such as path creation for  
a large number of partitions.  
  
Reviewed-by: Amit Langote, Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvqnPx6JnUuPwaf5ao38zczrAb9mxt9gj4U1EKFfd4AqLA@mail.gmail.com  

M src/backend/nodes/outfuncs.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partprune.c
M src/include/nodes/pathnodes.h

Doc: minor improvements for logical replication protocol documentation.

commit   : a5cb4f9829fbfd68655543d2d371a18a8eb43b84    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 2 Aug 2021 11:32:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 2 Aug 2021 11:32:17 -0400    

Click here for diff

Where appropriate, annotate message field data types with the backend  
code's name for the data type, eg XLogRecPtr or TimestampTz.  Previously  
we just said "Int64" which didn't provide as much info.  
  
Also clarify references to object OIDs, and make use of the existing  
convention to denote the value of a field that must have a fixed value.  
  
Vignesh C, reviewed by Peter Smith and Euler Taveira.  
  
Discussion: https://postgr.es/m/CALDaNm0+fatx57KFcBopUZWQpH_tz3WKKfm-_eiTwcXui5BnhQ@mail.gmail.com  

M doc/src/sgml/protocol.sgml

Run checkpointer and bgwriter in crash recovery.

commit   : 7ff23c6d277d1d90478a51f0dd81414d343f3850    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 2 Aug 2021 17:32:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 2 Aug 2021 17:32:20 +1200    

Click here for diff

Start up the checkpointer and bgwriter during crash recovery (except in  
--single mode), as we do for replication.  This wasn't done back in  
commit cdd46c76 out of caution.  Now it seems like a better idea to make  
the environment as similar as possible in both cases.  There may also be  
some performance advantages.  
  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Tested-by: Jakub Wartak <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ8NRsqgkZEnsnRc2MFROBV-jCnacbYvtpptK2A9YYp9Q%40mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/sync/sync.c
M src/include/storage/sync.h

Remove misplaced comment from AuxiliaryProcessMain().

commit   : 8b1de88b7ce9fe0458d3950121a797fd3d988f6c    
  
author   : Andres Freund <[email protected]>    
date     : Sun, 1 Aug 2021 21:10:11 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sun, 1 Aug 2021 21:10:11 -0700    

Click here for diff

The comment didn't make sense anymore since at least 626eb021988. As it didn't  
actually explain anything anyway, just remove it.  
  
Author: Andres Freund <[email protected]>  

M src/backend/bootstrap/bootstrap.c

Fix oversight in commit 1ec7fca8592178281cd5cdada0f27a340fb813fc.

commit   : a8ed9bd59d48c13da50ed2358911721b2baf1de3    
  
author   : Etsuro Fujita <[email protected]>    
date     : Mon, 2 Aug 2021 12:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Mon, 2 Aug 2021 12:45:00 +0900    

Click here for diff

I failed to account for the possibility that when  
ExecAppendAsyncEventWait() notifies multiple async-capable nodes using  
postgres_fdw, a preceding node might invoke process_pending_request() to  
process a pending asynchronous request made by a succeeding node.  In  
that case the succeeding node should produce a tuple to return to the  
parent Append node from tuples fetched by process_pending_request() when  
notified.  Repair.  
  
Per buildfarm via Michael Paquier.  Back-patch to v14, like the previous  
commit.  
  
Thanks to Tom Lane for testing.  
  
Discussion: https://postgr.es/m/YQP0UPT8KmPiHTMs%40paquier.xyz  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/nodeAppend.c

Fix test failure in 021_twophase.pl.

commit   : eaf5321c352478266cebe2aa50ea4c34a8fdd2c7    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 2 Aug 2021 08:29:26 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 2 Aug 2021 08:29:26 +0530    

Click here for diff

The test is expecting two prepared transactions corresponding to two  
subscriptions but it waits to catch up for just one subscription. Fix it  
by allowing to wait for both subscriptions.  
  
Reported-by: Michael Paquier, as per buildfarm  
Author: Ajin Cherian  
Reviewed-By: Amit Kapila, Vignesh C, Peter Smith  
Discussion: https://postgr.es/m/CAA4eK1+_0iNQ8Z=KVTjmmAqNX-hyv+1+fnZ-Yx8CVP=uAcekqw@mail.gmail.com  

M src/test/subscription/t/021_twophase.pl

Silence perl warning about uninitialized value

commit   : 0d1401931868e03342ed4689b5af2522eb40f750    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 1 Aug 2021 13:03:15 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 1 Aug 2021 13:03:15 -0400    

Click here for diff

M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl

Doc: alphabetize the regexp_foo() function descriptions in 9.7.3.

commit   : 64a1f225654f8866422010ff28e0d3384ae4c3af    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 15:35:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 15:35:27 -0400    

Click here for diff

For no visible reason (other than historical accident no doubt),  
regexp_replace() was out of order.  Re-order to match the way  
that these functions are listed in 9.4.  (That means substring()  
remains first, because it's SQL-standard and the rest aren't.)  
I've not touched the text other than to move it.  This is just  
to reduce confusion in the diffs for upcoming additions.  

M doc/src/sgml/func.sgml

Use elog, not Assert, to report failure to provide an outer snapshot.

commit   : ef12f32c0870b73ab7589ffc178094ac9ba3e84f    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 11:50:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 31 Jul 2021 11:50:14 -0400    

Click here for diff

As of commit 84f5c2908, executing SQL commands (via SPI or otherwise)  
requires having either an active Portal, or a caller-established  
active snapshot.  We were simply Assert'ing that that's the case.  
But we've now had a couple different reports of people testing  
extensions that didn't meet this requirement, and were confused by  
the resulting crash.  Let's convert the Assert to a test-and-elog,  
in hopes of making the issue clearer for extension authors.  
  
Per gripes from Liu Huailing and RekGRpth.  Back-patch to v11,  
like the prior commit.  
  
Discussion: https://postgr.es/m/OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/tcop/pquery.c

Remove redundant setting of pg_attribute.attcompression

commit   : 89404a01b4dadab8231dfa08cab507191c2ac929    
  
author   : John Naylor <[email protected]>    
date     : Sat, 31 Jul 2021 07:25:27 -0400    
  
committer: John Naylor <[email protected]>    
date     : Sat, 31 Jul 2021 07:25:27 -0400    

Click here for diff

Since e6241d8e0, no attribute needs a non-default value of this during  
initdb, so let the usual machinery for defaults take care of it.  

M src/backend/catalog/genbki.pl

Fix corner-case errors and loss of precision in numeric_power().

commit   : 4dd5ce2fd9b9b2134886fee7fe4cb36d1988adb2    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 31 Jul 2021 11:21:44 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 31 Jul 2021 11:21:44 +0100    

Click here for diff

This fixes a couple of related problems that arise when raising  
numbers to very large powers.  
  
Firstly, when raising a negative number to a very large integer power,  
the result should be well-defined, but the previous code would only  
cope if the exponent was small enough to go through power_var_int().  
Otherwise it would throw an internal error, attempting to take the  
logarithm of a negative number. Fix this by adding suitable handling  
to the general case in power_var() to cope with negative bases,  
checking for integer powers there.  
  
Next, when raising a (positive or negative) number whose absolute  
value is slightly less than 1 to a very large power, the result should  
approach zero as the power is increased. However, in some cases, for  
sufficiently large powers, this would lose all precision and return 1  
instead of 0. This was due to the way that the local_rscale was being  
calculated for the final full-precision calculation:  
  
  local_rscale = rscale + (int) val - ln_dweight + 8  
  
The first two terms on the right hand side are meant to give the  
number of significant digits required in the result ("val" being the  
estimated result weight). However, this failed to account for the fact  
that rscale is clipped to a maximum of NUMERIC_MAX_DISPLAY_SCALE  
(1000), and the result weight might be less then -1000, causing their  
sum to be negative, leading to a loss of precision. Fix this by  
forcing the number of significant digits calculated to be nonnegative.  
It's OK for it to be zero (when the result weight is less than -1000),  
since the local_rscale value then includes a few extra digits to  
ensure an accurate result.  
  
Finally, add additional underflow checks to exp_var() and power_var(),  
so that they consistently return zero for cases like this where the  
result is indistinguishable from zero. Some paths through this code  
already returned zero in such cases, but others were throwing overflow  
errors.  
  
Dean Rasheed, reviewed by Yugo Nagata.  
  
Discussion: http://postgr.es/m/CAEZATCW6Dvq7+3wN3tt5jLj-FyOcUgT5xNoOqce5=6Su0bCR0w@mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Move InRecovery and standbyState global vars to xlogutils.c.

commit   : 317632f3073fc06047a42075eb5e28a9577a4f96    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:50:26 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:50:26 +0300    

Click here for diff

They are used in code that runs both during normal operation and during  
WAL replay, and needs to behave differently during replay. Move them to  
xlogutils.c, because that's where we have other helper functions used by  
redo routines.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi  

M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/tablespace.c
M src/backend/postmaster/startup.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/smgr.c
M src/include/access/xlog.h
M src/include/access/xlogutils.h

Extract code to describe recovery stop reason to a function.

commit   : 4fe8dcdff3af73f6ca16eb3edfa3339c7ee0d2c4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:49:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:49:30 +0300    

Click here for diff

StartupXLOG() is very long, this makes it a little bit more readable.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi  

M src/backend/access/transam/xlog.c

Remove unnecessary 'restoredFromArchive' global variable.

commit   : 6b16532811f07fbb58e4b1b248775acbf9f732a2    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:38:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:38:32 +0300    

Click here for diff

It might've been useful for debugging purposes, but meh. There's  
'readSource' which does almost the same thing.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi  

M src/backend/access/transam/xlog.c

Don't use O_SYNC or similar when opening signal file to fsync it.

commit   : e9f5a0681cb9cf74b4c1c98e10182ccce04aa08c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:36:11 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 31 Jul 2021 09:36:11 +0300    

Click here for diff

No need to use get_sync_bit() when we're calling pg_fsync() on the file.  
We're not writing to the files, so it doesn't make any difference in  
practice, but seems less surprising this way.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi  

M src/backend/access/transam/xlog.c

Enable TAP tests of pg_receivewal for ZLIB on Windows, take three

commit   : 0b8ea707580640f9d5562de77f4b563fa9131547    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 31 Jul 2021 10:13:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 31 Jul 2021 10:13:15 +0900    

Click here for diff

This reverts commit 6a2c532.  fairywren and bowerbird failed those tests  
because of incorrect versions of ZLIB linked to, causing errors like  
SIGBREAKs that stopped buildfarm runs or EACCES failures when writing  
compressed WAL segments.  
  
Andrew Dunstan has done all the investigation here, so he deserves all  
the credit for being able to enable those tests on Windows.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Improve documentation for START_REPLICATION ... LOGICAL.

commit   : 14d474e079e1edf08926a2e68028cbd82dd614c4    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 30 Jul 2021 14:59:19 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 30 Jul 2021 14:59:19 -0700    

Click here for diff

The starting point may not be exactly what the client requested; it  
may be at the slot's confirmed_flush_lsn.  
  
Also, upgrade the message from DEBUG1 to LOG when this happens.  
  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/c5c861d576f2511732f8002c76245da587110b1c.camel%40j-davis.com  

M doc/src/sgml/protocol.sgml
M src/backend/replication/logical/logical.c

Fix range check in ECPG numeric to int conversion

commit   : 5fcf3945bd90bb0170938ad780159779367dc8ac    
  
author   : John Naylor <[email protected]>    
date     : Fri, 30 Jul 2021 13:50:23 -0400    
  
committer: John Naylor <[email protected]>    
date     : Fri, 30 Jul 2021 13:50:23 -0400    

Click here for diff

The previous coding guarded against -INT_MAX instead of INT_MIN,  
leading to -2147483648 being rejected as out of range.  
  
Per bug #17128 from Kevin Sweet  
  
Discussion: https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org  
Reviewed-by: Tom Lane  
Backpatch to all supported branches  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
M src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
M src/interfaces/ecpg/test/pgtypeslib/num_test.pgc

Doc: add a glossary entry for "domain".

commit   : 3dddb2a8219d3cfd163a83561d4b4613cd2ea376    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jul 2021 14:50:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jul 2021 14:50:21 -0400    

Click here for diff

Anton Voloshin and Jürgen Purtz, reviewed by Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/charset.sgml
M doc/src/sgml/earthdistance.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/lo.sgml
M doc/src/sgml/rowtypes.sgml

In postgres_fdw, allow CASE expressions to be pushed to the remote server.

commit   : 5d44fff01eebfe0c7a118326605864e662a44f46    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 30 Jul 2021 13:39:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 30 Jul 2021 13:39:48 -0400    

Click here for diff

This is simple enough except for the need to check whether CaseTestExpr  
nodes have a collation that is not derived from a remote Var.  For that,  
examine the CASE's "arg" expression and then pass that info down into the  
recursive examination of the WHEN expressions.  
  
Alexander Pyhalov, reviewed by Gilles Darold and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql

Remove unnecessary call to ReadCheckpointRecord().

commit   : 1d919de5eb3fffa7cc9479ed6d2915fb89794459    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 30 Jul 2021 08:33:33 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 30 Jul 2021 08:33:33 -0400    

Click here for diff

It should always be the case that the last checkpoint record is still  
readable, because otherwise, a crash would leave us in a situation  
from which we can't recover. Therefore the test removed by this patch  
should always succeed. For it to fail, either there has to be a serious  
bug in the code someplace, or the user has to be manually modifying  
pg_wal while crash recovery is running. If it's the first one, we  
should fix the bug. If it's the second one, they should stop, or  
anyway they're doing so at their own risk. In neither case does  
a full checkpoint instead of an end-of-recovery record seem like a  
clear winner. Furthermore, rarely-taken code paths are particularly  
vulnerable to bugs, so let's simplify by getting rid of this one.  
  
Discussion: http://postgr.es/m/CA+TgmoYmw==TOJ6EzYb_vcjyS09NkzrVKSyBKUUyo1zBEaJASA@mail.gmail.com  

M src/backend/access/transam/xlog.c

Use --no-loop for new calls of pg_receivewal --endpos in TAP tests

commit   : 3df93a66593c344e6298e618df3fa5090fca4309    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 30 Jul 2021 21:28:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 30 Jul 2021 21:28:03 +0900    

Click here for diff

Those tests are not designed to fail, but if they do, like on some cases  
for Windows because of ZLIB (?), they could remain stuck.  Using  
--no-loop makes the test fail immediately.  The oldest test with  
--endpos already did that.  
  
Those tests have been added in ffc9dda.  
  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Update obsolete comment that still referred to CheckpointLock

commit   : df9f0c716cc75d9842b3de79159b9191c108987c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jul 2021 12:52:44 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 30 Jul 2021 12:52:44 +0300    

Click here for diff

CheckpointLock was removed in commit d18e75664a, and commit ce197e91d0  
updated a leftover comment in CreateCheckPoint, but there was another  
copy of it in CreateRestartPoint still.  

M src/backend/access/transam/xlog.c

postgres_fdw: Fix handling of pending asynchronous requests.

commit   : 1ec7fca8592178281cd5cdada0f27a340fb813fc    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 30 Jul 2021 17:00:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 30 Jul 2021 17:00:00 +0900    

Click here for diff

A pending asynchronous request is handled by process_pending_request(),  
which previously not only processed an in-progress remote query but  
performed ExecForeignScan() to produce a tuple to return to the local  
server asynchronously from the result of the remote query.  But that led  
to a server crash when executing a query or led to an "InstrStartNode  
called twice in a row" or "InstrEndLoop called on running node" failure  
when doing EXPLAIN ANALYZE of it, in cases where the plan tree for it  
contained multiple async-capable nodes accessing the same  
initplan/subplan that contained multiple async-capable nodes scanning  
the same foreign tables as for the parent async-capable nodes, as  
reported by Andrey Lepikhov.  The reason is that the second step in  
process_pending_request() invoked when executing the initplan/subplan  
for one of the parent async-capable nodes caused recursive execution of  
the initplan/subplan for another of the parent async-capable nodes.  
  
To fix, split process_pending_request() into the two steps and postpone  
the second step until ForeignAsyncConfigureWait() is called for each of  
the pending asynchronous requests.  Also, in ExecAppendAsyncEventWait()  
we assumed that FDWs would register at least one wait event in a  
WaitEventSet created there when they were called from  
ForeignAsyncConfigureWait() in that function, but allow FDWs to register  
zero wait events in the WaitEventSet; modify ExecAppendAsyncEventWait()  
to just return in that case.  
  
Oversight in commit 27e1f1456.  Back-patch to v14 where that commit went  
in.  
  
Andrey Lepikhov and Etsuro Fujita  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/nodeAppend.c

Remove unused argument in apply_handle_commit_internal().

commit   : 16bd4becee32240d09db5c6cbec87957fdfcd2d9    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 30 Jul 2021 08:17:38 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 30 Jul 2021 08:17:38 +0530    

Click here for diff

Oversight in commit 0926e96c49.  
  
Author: Masahiko Sawada  
Reviewed-By: Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M src/backend/replication/logical/worker.c

Close yet another race condition in replication slot test code

commit   : ce197e91d02ca38ac1b956a3e0c11596099e7893    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 29 Jul 2021 17:09:06 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 29 Jul 2021 17:09:06 -0400    

Click here for diff

Buildfarm shows that this test has a further failure mode when a  
checkpoint starts earlier than expected, so we detect a "checkpoint  
completed" line that's not the one we want.  Change the config to try  
and prevent this.  
  
Per buildfarm  
  
While at it, update one comment that was forgotten in commit  
d18e75664a2f.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/test/recovery/t/019_replslot_limit.pl

docs: Fix bit_count example output

commit   : fcf4c0ae1db8594cf3d3e84d2564616497eecd5a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 21:39:40 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 21:39:40 +0200    

Click here for diff

The returnvalue for the bit_count(::bytea) example was assuming a  
non-default value of standard_conforming_strings.  This was fixed  
in the tests in commit ebedd0c78.  
  
Author: [email protected]  
Discussion: https://postgr.es/m/OSZPR01MB6551FFAC1088C82C3D799BE0FAEB9@OSZPR01MB6551.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M doc/src/sgml/func.sgml

Improve libpq's handling of OOM during error message construction.

commit   : 514b4c11d24701d2cc90ad75ed787bf1380af673    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 29 Jul 2021 13:33:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 29 Jul 2021 13:33:31 -0400    

Click here for diff

Commit ffa2e4670 changed libpq so that multiple error reports  
occurring during one operation (a connection attempt or query)  
are accumulated in conn->errorMessage, where before new ones  
usually replaced any prior error.  At least in theory, that makes  
us more vulnerable to running out of memory for the errorMessage  
buffer.  If it did happen, the user would be left with just an  
empty-string error report, which is pretty unhelpful.  
  
We can improve this by relying on pqexpbuffer.c's existing "broken  
buffer" convention to track whether we've hit OOM for the current  
operation's error string, and then substituting a constant "out of  
memory" string in the small number of places where the errorMessage  
is read out.  
  
While at it, apply the same method to similar OOM cases in  
pqInternalNotice and pqGetErrorNotice3.  
  
Back-patch to v14 where ffa2e4670 came in.  In principle this could  
go back further; but in view of the lack of field reports, the  
hazard seems negligible in older branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

Avoid calling TestLib::perl2host on a symlinked directory

commit   : b35a67bc04243da609843949c53e6841e748243a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    

Click here for diff

Certain versions of msys2/Windows have been observed to resolve symlinks  
in perl2host rather than just follow them. This defeats using a  
symlinked shorter path to a longer path, and makes certain tests fail.  
We therefore call perl2host on the parent directory of the symlink and  
thereafter just use that result.  
  
Apply to release 14 where the problem has been observed.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Make TestLib::perl2host more consistent and robust

commit   : bad106752272c05de5a56036b8a84ae6ff3249a0    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 12:15:03 -0400    

Click here for diff

Sometimes cygpath has been observed to return a path with a trailing  
slash. That can cause problems, Also, make "cygpath" usage  
consistent with "pwd -W" with respect to the use of forward slashes.  
  
Backpatch to release 14 where the current code was introduced.  

M src/test/perl/TestLib.pm

Refactor to make common functions in proto.c and worker.c.

commit   : 91f9861242cd7dcf28fae216b1d8b47551c9159d    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 29 Jul 2021 15:51:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 29 Jul 2021 15:51:45 +0530    

Click here for diff

This is a non-functional change only to refactor code to extract some  
replication logic into static functions.  
  
This is done as preparation for the 2PC streaming patch which also shares  
this common logic.  
  
Author: Peter Smith  
Reviewed-By: Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PuiSA8AiLcE2N5StzSKs46SQEP_vDOUD5fX2XCVtfZ7mQ@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/worker.c

Remove unused directory from test/ssl .gitignore

commit   : 454ae15d10ea2d11669b69e82c98fbd03126fd69    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 12:05:54 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Jul 2021 12:05:54 +0200    

Click here for diff

The clientside log saved from the testrun was removed in 1caef31d9  
but the entry in the .gitignore file remained.  While this exists  
in older branches as well, it's mostly a cosmetical fix so no back-  
patching is done.  
  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/.gitignore

Add a getter function for a PostgresNode install_path

commit   : 87076c40834c2971f073f69be33a5f95ffa8f8a1    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    

Click here for diff

Experience has shown this can be useful, and while not strictly necessary  
we should not normally expose the internals of PostgresNode objects.  

M src/test/perl/PostgresNode.pm

Add PostgresVersion.pm method to emit the major version string

commit   : 1e8d89f8800e0aaafc66e87e8e5fedf5dbd038cf    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    

Click here for diff

For versions before 10, this will produce dotted notation unless a  
separator argument is given, in which case it is used.  

M src/test/perl/PostgresVersion.pm

Remove the last vestiges of Exporter from PostgresNode

commit   : 5dc932f9e7b7d1992abd33d1c519899dd1c30272    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    

Click here for diff

Clients wanting to call get_free_port now need to do so via a qualified  
name: PostgresNode::get_free_port().  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/perl/PostgresNode.pm

Unify PostgresNode's new() and get_new_node() methods

commit   : 201a76183e2056c2217129e12d68c25ec9c559c8    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:08 -0400    

Click here for diff

There is only one constructor now for PostgresNode, with the idiomatic  
name 'new'. The method is not exported by the class, and must be called  
as "PostgresNode->new('name',[args])". All the TAP tests that use  
PostgresNode are modified accordingly. Third party scripts will need  
adjusting, which is a fairly mechanical process (I just used a sed  
script).  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/bloom/t/001_wal.pl
M contrib/test_decoding/t/001_repl_stats.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgresNode.pm
M src/test/perl/README
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/011_crash_recovery.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/100_bugs.pl

Add adjust_conf method to PostgresNode

commit   : dbfe6e4b1766369654e20113b0cab79bd939d544    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:07 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:07 -0400    

Click here for diff

This method will modify or delete an existing line in the config file  
rather than simply appending to the file. This makes adjustment of files  
for older versions much simpler and more compact.  

M src/test/perl/PostgresNode.pm

Add -w back to the flags for pg_ctl (re)start in PostgresNode

commit   : b33259e261ae99dc7c503a6a7615bd492047588b    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 29 Jul 2021 05:58:06 -0400    

Click here for diff

This is now the default for pg_ctl, but having the flag here explicitly  
does no harm and helps with backwards compatibility of the PostgresNode  
module.  

M src/test/perl/PostgresNode.pm

Fix typo in tab-complete.c

commit   : 15c6ede04577f856f702bf0a032297de667f382a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 14:49:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 14:49:48 +0900    

Click here for diff

Introduced in b048326.  
  
Reported-by: Jeff Davis  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/psql/tab-complete.c

Add some missing exit() calls in error paths for various binaries

commit   : 856de3b39cf6041338b286a99257c324ce647f4e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 11:42:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 11:42:58 +0900    

Click here for diff

The following changes are done:  
- In pg_archivecleanup, the cleanup of older WAL segments would never  
fail immediately.  
- In pgbench, the initialization of a thread barrier would not fail  
hard.  
- In pg_recvlogical, a stat() failure never got the call.  
- In pg_basebackup, two chmod() reported a failure without exit()'ing  
when unpacking some tar data freshly received.  It may be possible to  
continue writing some data even after this failure, but that could be  
confusing to the user at the end.  
  
These are arguably bugs, but they would happen for code paths where a  
failure is unlikely going to happen, so no backpatch is done.  
  
Reviewed-by: Robert Haas, Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pgbench/pgbench.c

Add missing exit() in pg_verifybackup when failing to find pg_waldump

commit   : 2ad98fdf53edf1a90123e3b189cc6f0a31986891    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 10:59:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Jul 2021 10:59:49 +0900    

Click here for diff

pg_verifybackup needs by default pg_waldump to check after a range of  
WAL segments required for a backup, except if --no-parse-wal is  
specified.  The code checked for the presence of the binary pg_waldump  
in an installation and reported an error, but it forgot to properly  
exit().  This could lead to confusing errors reported.  
  
Reviewed-by: Robert Haas, Fabien Coelho  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 13  

M src/bin/pg_verifybackup/pg_verifybackup.c

Adjust MSVC build scripts to parse Makefiles for defines

commit   : 245de48455daaf51f2f3e8b198d87b5dd9fd4516    
  
author   : David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 12:01:23 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 12:01:23 +1200    

Click here for diff

This adjusts the MSVC build scripts to look at the compile flags mentioned  
in the Makefile to look for -D arguments in order to determine which  
constants should be defined in Visual Studio builds.  
  
One small anomaly that appeared as a result of this change is that the  
Makefile for the ltree contrib module defined LOWER_NODE, but this was  
not properly defined in the MSVC build scripts.  This meant that MSVC  
builds would differ in case sensitivity in the ltree module when  
compared to builds using a make build environment.  To maintain the same  
behavior here we remove the -DLOWER_NODE from the Makefile and just always  
define it in ltree.h for non-MSVC builds.  We need to maintain the old  
behavior here as this affects the on-disk compatibility of GiST indexes  
when using the ltree type.  
  
The only other resulting change here is that REFINT_VERBOSE is now defined  
for the autoinc, insert_username and moddatetime contrib modules.  
Previously on MSVC, this was only defined for the refint module.  This  
aligns the behavior to build environments using make as all 4 of these  
modules share the same Makefile.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com  

M contrib/ltree/Makefile
M contrib/ltree/crc32.c
M contrib/ltree/ltree.h
M src/tools/msvc/Mkvcbuild.pm

Don't duplicate references and libraries in MSVC scripts

commit   : 15f16ec6511cf50374b09876e39c6939f2da0f08    
  
author   : David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 10:41:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 10:41:31 +1200    

Click here for diff

In order not to duplicate references and libraries in the Visual Studio  
project files produced by the MSVC build scripts, have them check if a  
particular reference or library already exists before adding the same one  
again.  
  
Reviewed-by: Álvaro Herrera, Andrew Dunstan, Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com  

M src/tools/msvc/Project.pm

Make the includes field an array in MSVC build scripts

commit   : 33d74c5d00e45248df66fa1bcd9222e0713ea5b1    
  
author   : David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 10:14:25 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 29 Jul 2021 10:14:25 +1200    

Click here for diff

Previously the 'includes' field was a string.  It's slightly nicer to  
manage this when it's defined as an array instead. This allows us to  
more easily detect and eliminate duplicates.  
  
Reviewed-by: Álvaro Herrera, Andrew Dunstan, Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm

Update minimum recovery point on truncation during WAL replay of abort record.

commit   : a00c138b78521b9bc68b480490a8d601ecdeb816    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 29 Jul 2021 01:30:02 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 29 Jul 2021 01:30:02 +0900    

Click here for diff

If a file is truncated, we must update minRecoveryPoint. Once a file is  
truncated, there's no going back; it would not be safe to stop recovery  
at a point earlier than that anymore.  
  
Commit 7bffc9b7bf changed xact_redo_commit() so that it updates  
minRecoveryPoint on truncation, but forgot to change xact_redo_abort().  
  
Back-patch to all supported versions.  
  
Reported-by: [email protected]  
Author: Fujii Masao  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/b029fce3-4fac-4265-968e-16f36ff4d075.mengjuan.cmj@alibaba-inc.com  

M src/backend/access/transam/xact.c

Disallow negative strides in date_bin()

commit   : 3ba70d4e152372fd8ab90ed0887ee08d505ef306    
  
author   : John Naylor <[email protected]>    
date     : Wed, 28 Jul 2021 11:22:58 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 28 Jul 2021 11:22:58 -0400    

Click here for diff

It's not clear what the semantics of negative strides would be, so throw  
an error instead.  
  
Per report from Bauyrzhan Sakhariyev  
  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://www.postgresql.org/message-id/CAKpL73vZmLuFVuwF26FJ%2BNk11PVHhAnQRoREFcA03x7znRoFvA%40mail.gmail.com  
Backpatch to v14  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Use the AddFile function consistently in MSVC build scripts

commit   : ed1884a2fedeffd2e6902451a9d41f4b3f6e859f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 23:43:40 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 23:43:40 +1200    

Click here for diff

We seem to be using a mix of manually adding to the 'files' hash and  
calling the Addfile() method.  Let's just consistently use AddFile().  
  
Reviewed-by: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com  

M src/tools/msvc/Project.pm

Doc: Clarify lock levels taken during ATTACH PARTITION

commit   : 8709228775b549a2388e6568f463a4115e5a4c10    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 15:02:37 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 15:02:37 +1200    

Click here for diff

It wasn't all that clear which lock levels, if any, would be held on the  
DEFAULT partition during an ATTACH PARTITION operation.  
  
Also, clarify which locks will be taken if the DEFAULT partition or the  
table being attached are themselves partitioned tables.  
  
Here I'm only backpatching to v12 as before then we obtained an ACCESS  
EXCLUSIVE lock on the partitioned table.  It seems much less relevant to  
mention which locks are taken on other tables when the partitioned table  
itself is locked with an ACCESS EXCLUSIVE lock.  
  
Author: Matthias van de Meent, David Rowley  
Discussion: https://postgr.es/m/CAEze2WiTB6iwrV8W_J=fnrnZ7fowW3qu-8iQ8zCHP3FiQ6+o-A@mail.gmail.com  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml

Clarify some comments making use of leetspeak term "up2date"

commit   : 7b7fbe1e8bb4b2a244d1faa618789db411316e55    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Jul 2021 10:31:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Jul 2021 10:31:24 +0900    

Click here for diff

Most of these are new, as of a8fd13c, and "up-to-date" is much easier to  
parse for the average reader.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PtHbHvgOjs_R9LyDF21j-Wn8SxoTtWMQNP2ifXN6t2cSg@mail.gmail.com  

M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/replication/logical/logical.c

Add support for SET ACCESS METHOD in ALTER TABLE

commit   : b0483263dda0824cc49e3f8a022dab07e1cdf9a7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Jul 2021 10:10:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Jul 2021 10:10:44 +0900    

Click here for diff

The logic used to support a change of access method for a table is  
similar to changes for tablespace or relation persistence, requiring a  
table rewrite with an exclusive lock of the relation changed.  Table  
rewrites done in ALTER TABLE already go through the table AM layer when  
scanning tuples from the old relation and inserting them into the new  
one, making this implementation straight-forward.  
  
Note that partitioned tables are not supported as these have no access  
methods defined.  
  
Author: Justin Pryzby, Jeff Davis  
Reviewed-by: Michael Paquier, Vignesh C  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/cluster.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.c
M src/include/commands/cluster.h
M src/include/commands/event_trigger.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/create_am.out
M src/test/regress/sql/create_am.sql

Remove seemingly unneeded include directory in MSVC scripts

commit   : 4b763ff642e1a3608cbcaff062f6c2f465bfc6bd    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 12:56:43 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Jul 2021 12:56:43 +1200    

Click here for diff

This appears to have been added way back in ee3b4188a but it's a little  
unclear why the change made in that commit is even needed given that  
320c7eb8c, dated 18 months earlier, added code to copy fmgroids.h to  
src/include/utils.  
  
amcheck seems to get away without adding the additional include directory,  
so perhaps dblink can get away with it too.  
  
This builds ok in my VS2017 environment, but the buildfarm may serve as a  
reminder about why ee3b4188a was required.  There's only one way to find  
out for sure.  
  
Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com  

M src/tools/msvc/Mkvcbuild.pm

Set pg_setting.pending_restart when pertinent config lines are removed

commit   : 93a0bf2390327a482ff37317f6e17547e735409e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 27 Jul 2021 15:44:12 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 27 Jul 2021 15:44:12 -0400    

Click here for diff

This changes the behavior of examining the pg_file_settings view after  
changing a config option that requires restart.  The user needs to know  
that any change of such options does not take effect until a restart,  
and this worked correctly if the line is edited without removing it.  
However, for the case where the line is removed altogether, the flag  
doesn't get set, because a flag was only set in set_config_option, but  
that's not called for lines removed.  Repair.  
  
(Ref.: commits 62d16c7fc561 and a486e35706ea)  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/guc-file.l

Fix bugs in polymorphic-argument resolution for multiranges.

commit   : 336ea6e6ff1109e7b83370565e3cb211804fda0c    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 15:01:49 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 15:01:49 -0400    

Click here for diff

We failed to deal with an UNKNOWN-type input for  
anycompatiblemultirange; that should throw an error indicating  
that we don't know how to resolve the multirange type.  
  
We also failed to infer the type of an anycompatiblerange output  
from an anycompatiblemultirange input or vice versa.  
  
Per bug #17066 from Alexander Lakhin.  Back-patch to v14  
where multiranges were added.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_coerce.c
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/sql/polymorphism.sql

Stabilize output of new regression test.

commit   : 674f6fe8e65a37289432fa373e5d742a36751ae8    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:49:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:49:40 -0400    

Click here for diff

Commit 48c5c9068 failed to allow for buildfarm animals that  
force jit = on.  I'm surprised that this hasn't come up  
elsewhere in explain.sql, so turn it off for that whole  
test script not just the one new test case.  
  
Per buildfarm.  

M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Avoid using ambiguous word "non-negative" in error messages.

commit   : 0e1275fb073cbbff2185f4067d67785e56941e50    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 28 Jul 2021 01:20:16 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 28 Jul 2021 01:20:16 +0900    

Click here for diff

The error messages using the word "non-negative" are confusing  
because it's ambiguous about whether it accepts zero or not.  
This commit improves those error messages by replacing it with  
less ambiguous word like "greater than zero" or  
"greater than or equal to zero".  
  
Also this commit added the note about the word "non-negative" to  
the error message style guide, to help writing the new error messages.  
  
When postgres_fdw option fetch_size was set to zero, previously  
the error message "fetch_size requires a non-negative integer value"  
was reported. This error message was outright buggy. Therefore  
back-patch to all supported versions where such buggy error message  
could be thrown.  
  
Reported-by: Hou Zhijie  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/OS0PR01MB5716415335A06B489F1B3A8194569@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/option.c
M doc/src/sgml/sources.sgml
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/tsquery_op.c
M src/test/modules/test_shm_mq/test.c
M src/test/regress/expected/hash_part.out

In event triggers, use "pg_temp" only for our own temp schema.

commit   : 024515cac50e246d92bbe67e9de4da0f302972ef    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:08:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:08:20 -0400    

Click here for diff

pg_event_trigger_ddl_commands used "pg_temp" to refer to any  
temp schema, not only that of the current backend.  This seems  
like overreach.  It's somewhat unlikely that DDL commands would  
refer to temp objects of other sessions to begin with, but if they  
do, "pg_temp" would be a most misleading way to display the action.  
  
While this seems like a bug, it's not quite out of the realm of  
possibility that somebody out there is expecting the current  
behavior.  Hence, fix in HEAD, but don't back-patch.  
  
Discussion: https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com  

M src/backend/commands/event_trigger.c

commit   : 48c5c9068211e0a04fd9553c8714b2821ed3ad17    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:03:16 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 27 Jul 2021 12:03:16 -0400    

Click here for diff

This patch causes EXPLAIN output to refer to objects that are in  
the current session's temp schema with the "pg_temp" schema alias  
rather than that schema's actual name.  This is useful for our own  
testing purposes since it will stabilize EXPLAIN VERBOSE output  
for such cases, allowing us to use that in regression tests.  
It should be less confusing for end users too.  
  
Since ruleutils.c needs to change behavior for this, the change  
also leaks into a few other users of ruleutils.c, for example  
pg_get_viewdef().  AFAICS that won't cause any problems.  
We did find that aggressively trying to change this behavior  
across-the-board would cause issues, but as long as "pg_temp"  
only appears within generated SQL text, I think it'll be fine.  
  
Along the way, make get_namespace_name_or_temp conform to the  
same API as get_namespace_name, ie that it returns a palloc'd  
string or NULL.  The current behavior hasn't caused any bugs  
since no callers attempt to pfree the result, but if it gets  
more widespread usage that could become a problem.  
  
Amul Sul, reviewed and extended by me  
  
Discussion: https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/explain.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Disable command echo in pg_upgrade-created windows scripts

commit   : 91d76613b7ec75b6642accaff91dc7d657e549e9    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 27 Jul 2021 11:15:38 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 27 Jul 2021 11:15:38 -0400    

Click here for diff

This makes them more like the Unix equivalents.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/pg_upgrade.h

doc: for various substring funcs, document if only first match

commit   : 6feebcb6b44631c3dc435e971bd80c2dd218a5ab    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:54:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:54:35 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

pg_resetxlog: add option to set oldest xid & use by pg_upgrade

commit   : 74cf7d46a91d601e0f8d957a7edbaeeb7df83efc    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:38:15 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 26 Jul 2021 22:38:15 -0400    

Click here for diff

Add pg_resetxlog -u option to set the oldest xid in pg_control.  
Previously -x set this value be -2 billion less than the -x value.  
However, this causes the server to immediately scan all relation's  
relfrozenxid so it can advance pg_control's oldest xid to be inside the  
autovacuum_freeze_max_age range, which is inefficient and might disrupt  
diagnostic recovery.  pg_upgrade will use this option to better create  
the new cluster to match the old cluster.  
  
Reported-by: Jason Harvey, Floris Van Nee  
  
Discussion: https://postgr.es/m/[email protected], [email protected]  
  
Author: Bertrand Drouvot  
  
Backpatch-through: 9.6  

M doc/src/sgml/ref/pg_resetwal.sgml
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h

Simplify matching pattern check in TAP tests of pg_receivewal

commit   : 24ba1a87e4056ec34c8a685633a1a14fb89e5700    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Jul 2021 10:58:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Jul 2021 10:58:21 +0900    

Click here for diff

A check in the ZLIB portion of the test to match the name of a  
non-compressed partial segment with a completed compressed segment was  
using m//, while a simple equality check is enough.  This makes the test  
a bit stricter without impacting its coverage.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Skip trailing whitespaces when parsing integer options

commit   : f7a9a3d4b24a4ad0de7992f01a0dd2a02ccd30a4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Jul 2021 10:39:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Jul 2021 10:39:05 +0900    

Click here for diff

strtoint(), via strtol(), would skip leading whitespaces but the same  
rule was not applied for trailing whitespaces, leading to an  
inconsistent behavior.  Some tests are changed to cover more this area.  
  
Author: Michael Paquier  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_dump/t/001_basic.pl
M src/fe_utils/option_utils.c

Remove newly added useless assertion check

commit   : 21b3aa9c8faf39ef45a5223681d8947e0a00e7da    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Jul 2021 12:56:33 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Jul 2021 12:56:33 -0400    

Click here for diff

Coverity complained that my commit 80ba4bb38353 added a dubious coding  
for a consistency check that there isn't more than one row for a certain  
tgrelid/tgparentid combination.  But we don't check for that explicitly  
anywhere else, and if we were to do it, it should be a full  
shouldn't-happen elog not just an assert.  It doesn't seem that this is  
very important anyway, so remove it.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

psql \dX: check schema when listing statistics objects

commit   : f68b609230689f9886a46e5d9ab8d6cdd947e0dc    
  
author   : Tomas Vondra <[email protected]>    
date     : Mon, 26 Jul 2021 17:12:28 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Mon, 26 Jul 2021 17:12:28 +0200    

Click here for diff

Commit ad600bba04 added psql command \dX listing extended statistics  
objects, but it failed to consider search_path when selecting the  
elements so some of the returned elements might be invisible.  
  
The visibility was already considered for tab completion (added by  
commit d99d58cdc8), so adding it to the query is fairly simple.  
  
Reported and fix by Justin Pryzby, regression tests by me. Backpatch  
to PostgreSQL 14, where \dX was introduced.  
  
Batchpatch-through: 14  
Author: Justin Pryzby  
Reviewed-by: Tatsuro Yamada  
Discussion: https://postgr.es/m/c027a541-5856-75a5-0868-341301e1624b%40nttcom.co.jp_1  

M src/bin/psql/describe.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Allow numeric scale to be negative or greater than precision.

commit   : 085f931f52494e1f304e35571924efa6fcdc2b44    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 26 Jul 2021 14:13:47 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 26 Jul 2021 14:13:47 +0100    

Click here for diff

Formerly, when specifying NUMERIC(precision, scale), the scale had to  
be in the range [0, precision], which was per SQL spec. This commit  
extends the range of allowed scales to [-1000, 1000], independent of  
the precision (whose valid range remains [1, 1000]).  
  
A negative scale implies rounding before the decimal point. For  
example, a column might be declared with a scale of -3 to round values  
to the nearest thousand. Note that the display scale remains  
non-negative, so in this case the display scale will be zero, and all  
digits before the decimal point will be displayed.  
  
A scale greater than the precision supports fractional values with  
zeros immediately after the decimal point.  
  
Take the opportunity to tidy up the code that packs, unpacks and  
validates the contents of a typmod integer, encapsulating it in a  
small set of new inline functions.  
  
Bump the catversion because the allowed contents of atttypmod have  
changed for numeric columns. This isn't a change that requires a  
re-initdb, but negative scale values in the typmod would confuse old  
backends.  
  
Dean Rasheed, with additional improvements by Tom Lane. Reviewed by  
Tom Lane.  
  
Discussion: https://postgr.es/m/CAEZATCWdNLgpKihmURF8nfofP0RFtAKJ7ktY6GcZOPnMfUoRqA@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/numeric.c
M src/include/catalog/catversion.h
M src/include/utils/numeric.h
M src/test/regress/expected/numeric.out
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/numeric.sql

doc: Fix command example to run regression tests with PGOPTIONS

commit   : efe080220942fb8c2fdca66a3ab436159f7db86b    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 16:26:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 16:26:47 +0900    

Click here for diff

The documentation mentioned the use of log_checkpoints, that cannot be  
used in this context.  This commit replaces log_checkpoints with  
force_parallel_mode, a developer option useful to perform checks related  
to parallelism.  
  
Oversight in 854434c.  
  
Author: Haiying Tang  
Discussion: https://postgr.es/m/OS0PR01MB6113954B883ACEB2DDC973F2FBE59@OS0PR01MB6113.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M doc/src/sgml/regress.sgml

Harden pg_stat_statements tests against CLOBBER_CACHE_ALWAYS.

commit   : 0806d08d4626f0a71a4e83cb399ee965a8aac99b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 23:25:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 23:25:15 -0400    

Click here for diff

Turns out the buildfarm hasn't been testing this, which will soon change.  
  
Julien Rouhaud, per report from me  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql

Fix incorrect comment for get_agg_clause_costs

commit   : 2b58f894e56a1944e824e19c92337d6bf24d9c41    
  
author   : David Rowley <[email protected]>    
date     : Mon, 26 Jul 2021 14:55:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 26 Jul 2021 14:55:31 +1200    

Click here for diff

Adjust the header comment in get_agg_clause_costs so that it matches what  
the function currently does.  No recursive searching has been done ever  
since 0a2bc5d61.  It also does not determine the aggtranstype like the  
comment claimed. That's all done in preprocess_aggref().  
preprocess_aggref also now determines the numOrderedAggs, so remove the  
mention that get_agg_clause_costs also calculates "counts".  
  
Normally, since this is just an adjustment of a comment it might not be  
worth back-patching, but since this code is new to PG14 and that version  
is still in beta, then it seems worth having the comments match.  
  
Discussion: https://postgr.es/m/CAApHDvrrGrTJFPELrjx0CnDtz9B7Jy2XYW3Z2BKifAWLSaJYwQ@mail.gmail.com  
Backpatch-though: 14  

M src/backend/optimizer/prep/prepagg.c

Fix a couple of memory leaks in src/bin/pg_basebackup/

commit   : 4ef64c425dbcda151c9f163aadff982343808e09    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 11:13:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Jul 2021 11:13:37 +0900    

Click here for diff

These have been introduced by 7fbe0c8, and could happen for  
pg_basebackup and pg_receivewal.  
  
Per report from Coverity for the ones in walmethods.c, I have spotted  
the ones in receivelog.c after more review.  
  
Backpatch-through: 10  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Get rid of artificial restriction on hash table sizes on Windows.

commit   : 28d936031a86d94806c6604480ff3f3f169b371c    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 14:02:27 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Jul 2021 14:02:27 -0400    

Click here for diff

The point of introducing the hash_mem_multiplier GUC was to let users  
reproduce the old behavior of hash aggregation, i.e. that it could use  
more than work_mem at need.  However, the implementation failed to get  
the job done on Win64, where work_mem is clamped to 2GB to protect  
various places that calculate memory sizes using "long int".  As  
written, the same clamp was applied to hash_mem.  This resulted in  
severe performance regressions for queries requiring a bit more than  
2GB for hash aggregation, as they now spill to disk and there's no  
way to stop that.  
  
Getting rid of the work_mem restriction seems like a good idea, but  
it's a big job and could not conceivably be back-patched.  However,  
there's only a fairly small number of places that are concerned with  
the hash_mem value, and it turns out to be possible to remove the  
restriction there without too much code churn or any ABI breaks.  
So, let's do that for now to fix the regression, and leave the  
larger task for another day.  
  
This patch does introduce a bit more infrastructure that should help  
with the larger task, namely pg_bitutils.h support for working with  
size_t values.  
  
Per gripe from Laurent Hasson.  Back-patch to v13 where the  
behavior change came in.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/MN2PR15MB25601E80A9B6D1BA6F592B1985E39@MN2PR15MB2560.namprd15.prod.outlook.com  

M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeMemoize.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/storage/ipc/shm_mq.c
M src/include/miscadmin.h
M src/include/port/pg_bitutils.h

Deduplicate choice of horizon for a relation procarray.c.

commit   : d9d8aa9bb9aa2a850f53facd2c91e454129af57b    
  
author   : Andres Freund <[email protected]>    
date     : Sat, 24 Jul 2021 20:14:03 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Sat, 24 Jul 2021 20:14:03 -0700    

Click here for diff

5a1e1d83022 was a minimal bug fix for dc7420c2c92. To avoid future bugs of  
that kind, deduplicate the choice of a relation's horizon into a new helper,  
GlobalVisHorizonKindForRel().  
  
As the code in question was only introduced in dc7420c2c92 it seems worth  
backpatching this change as well, otherwise 14 will look different from all  
other branches.  
  
A different approach to this was suggested by Matthias van de Meent.  
  
Author: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch: 14, like 5a1e1d83022  

M src/backend/storage/ipc/procarray.c

Fix check for conflicting session- vs transaction-level locks.

commit   : 6310809c4aa146b3996a35524955c6c6943d241a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:52 -0400    

Click here for diff

We have an implementation restriction that PREPARE TRANSACTION can't  
handle cases where both session-lifespan and transaction-lifespan locks  
are held on the same lockable object.  (That's because we'd otherwise  
need to acquire a new PROCLOCK entry during post-prepare cleanup, which  
is an operation that might fail.  The situation can only arise with odd  
usages of advisory locks, so removing the restriction is probably not  
worth the amount of effort it would take.)  AtPrepare_Locks attempted  
to enforce this, but its logic was many bricks shy of a load, because  
it only detected cases where the session and transaction locks had the  
same lockmode.  Locks of different modes on the same object would lead  
to the rather unhelpful message "PANIC: we seem to have dropped a bit  
somewhere".  
  
To fix, build a transient hashtable with one entry per locktag,  
not one per locktag + mode, and use that to detect conflicts.  
  
Per bug #17122 from Alexander Pyhalov.  This bug is ancient,  
so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/lock.c
M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/prepared_xacts.sql

Make printf("%s", NULL) print "(null)" instead of crashing.

commit   : 3779ac62d709467fe6331c8f0285d42e7487a01c    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 13:41:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 13:41:17 -0400    

Click here for diff

We previously took a hard-line attitude that callers should never print  
a null string pointer, and doing so is worthy of an assertion failure  
or crash.  However, we've long since flushed out any easy-to-find bugs  
of that nature.  What remains is a lot of code that perhaps could fail  
that way in hard-to-reach corner cases.  For example, in something as  
simple as  
    ereport(ERROR,  
            (errcode(ERRCODE_UNDEFINED_OBJECT),  
             errmsg("constraint \"%s\" for table \"%s\" does not exist",  
                    conname, get_rel_name(relid))));  
one must wonder whether it's completely guaranteed that get_rel_name  
cannot return NULL in this context.  If such a situation did occur,  
the existing policy converts what might be a pretty minor bug into  
a server crash condition.  This is not good for robustness.  
  
Hence, let's follow the lead of glibc and print "(null)" instead  
of failing.  We should, of course, still consider it a bug if that  
behavior is reachable in ordinary use; but crashing seems less  
desirable than not crashing.  
  
This fix works across-the-board in v12 and up, where we always use  
src/port/snprintf.c.  Before that, on most platforms we're at the mercy  
of the local libc, but it appears that Solaris 10 is the only supported  
platform where we'd still get a crash.  Most other platforms such as  
*BSD, macOS, and Solaris 11 have adopted glibc's behavior at some  
point.  (AIX and HPUX just print "" not "(null)", but that's close  
enough.)  I've not checked what Windows' native printf would do, but  
it doesn't matter because we've long used snprintf.c on that platform.  
  
In v12 and up, also const-ify related code so that we're not casting  
away const on the constant string.  This is just neatnik-ism, since  
next to no compilers will warn about that.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/port/snprintf.c

Remove configure-time thread safety checking (thread_test.c).

commit   : 76fa3db33654e543b5c796e28c6fc5b505a19c2a    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 12:16:39 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 12:16:39 -0400    

Click here for diff

This testing was useful when it was written, nigh twenty years ago,  
but it seems fairly pointless for any platform built in the last  
dozen or more years.  (Compare also the comments at 8a2121185.)  
Also we now have reports that the test program itself fails under  
ThreadSanitizer.  Rather than invest effort in fixing it, let's  
just drop it, and assume that the few people who still care  
already know they need to use --disable-thread-safety.  
  
Back-patch into v14, for consistency with 8a2121185.  
  
Discussion: https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com  

D config/thread_test.c
M configure
M configure.ac

Fix failure of some headers to compile "standalone".

commit   : 678f5448c2d86976a98b402ef14482a8ba3b159b    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 11:34:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 24 Jul 2021 11:34:33 -0400    

Click here for diff

Recently-added references to ParseState weren't covered by #include  
references, creating unwanted ordering dependencies for users of  
these headers.  
  
Oversight in commit 2bfb50b3d.  Per headerscheck/cpluspluscheck.  

M src/include/commands/publicationcmds.h
M src/include/commands/subscriptioncmds.h

Add missing header declarations for pg_basebackup and pg_{dump,restore}

commit   : bc0cc68f8a1648029424e9300b2e4457acd474a6    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 24 Jul 2021 19:05:14 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 24 Jul 2021 19:05:14 +0900    

Click here for diff

This fixes two compilation failures caused by 6f164e6.  Interesting to  
see that missing <limits.h> dies not fail in Linux or even Windows.  On  
MacOS, it fails, though.  
  
Per various buildfarm members.  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_dump/parallel.h

Unify parsing logic for command-line integer options

commit   : 6f164e6d17616a157ea5d9e34dbb1b211c080c41    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 24 Jul 2021 18:35:03 +0900    

Click here for diff

Most of the integer options for command-line binaries now make use of a  
single routine able to do the job, fixing issues with the detection of  
sloppy values caused for example by the use of atoi(), that fails on  
strings beginning with numerical characters with junk trailing  
characters.  
  
This commit cuts down the number of strings requiring translation by 26  
per my count, switching the code to have two error types for invalid and  
out-of-range values instead.  
  
Much more could be done here, with float or even int64 options, but  
int32 was the most appealing case as it is possible to rely on strtol()  
to do the job reliably.  Note that there are some exceptions for now,  
like pg_ctl or pg_upgrade that use their own logging logic.  A couple of  
negative TAP tests required some adjustments for the new errors  
generated.  
  
pg_dump and pg_restore tracked the maximum number of parallel jobs  
within the option parsing.  The code is refactored a bit to track that  
in the code dedicated to parallelism instead.  
  
Author: Kyotaro Horiguchi, Michael Paquier  
Reviewed-by: David Rowley, Álvaro Herrera  
Discussion: https://postgr.es/m/CALj2ACXqdG9WhqVoJ9zYf-iZt7sgK7Szv5USs=he6NnWQ2ofTA@mail.gmail.com  

M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/scripts/createuser.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/fe_utils/option_utils.c
M src/include/fe_utils/option_utils.h

Make new test immune to collation

commit   : 6beb38cfc9ddd4cd3d2eb5402981ebdd69a618b4    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 23 Jul 2021 11:01:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 23 Jul 2021 11:01:22 -0400    

Click here for diff

Animals running in Czech locale failed.  I could try to find table names  
that don't have this problem, but it seems simpler to just use the C  
locale.  
  
Per buildfarm  

M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Make ALTER TRIGGER RENAME consistent for partitioned tables

commit   : 80ba4bb383538a2ee846fece6a7b8da9518b6866    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jul 2021 18:33:47 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jul 2021 18:33:47 -0400    

Click here for diff

Renaming triggers on partitioned tables had two problems: first,  
it did not recurse to renaming the triggers on the partitions; and  
second, it failed to prohibit renaming clone triggers.  Having triggers  
with different names in partitions is pointless, and furthermore pg_dump  
would not preserve names for partitions anyway.  
  
Not backpatched -- making the ALTER TRIGGER throw an error in stable  
versions might cause problems for existing scripts.  
  
Co-authored-by: Arne Roland <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/alter_trigger.sgml
M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Rework installation instructions again

commit   : 73c5d2bfee2907b7f158485a531f00ba61b054f7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jul 2021 18:03:26 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 22 Jul 2021 18:03:26 -0400    

Click here for diff

Dept. of second thoughts: the new verbiage added in commit aaec237b1a2f  
is targeted at the wrong audience.  Remove the bits about git and talk  
about how to get tarballs only.  People looking for the git repo can  
look in the appendix.  That'll need to be expanded, but this commit  
doesn't do that.  
  
In passing, fix a couple of typos that snuck in with the previous  
commit.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/installation.sgml

Fix division by zero error in date_bin

commit   : a0db4294aeffe428cdcb381fc66ba725ec588e95    
  
author   : John Naylor <[email protected]>    
date     : Thu, 22 Jul 2021 17:34:19 -0400    
  
committer: John Naylor <[email protected]>    
date     : Thu, 22 Jul 2021 17:34:19 -0400    

Click here for diff

Bauyrzhan Sakhariyev, via Github  
  
Backpatch to v14  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Fix typo in comment

commit   : 86a1aae764b03c7fe06e290e409c8d1a72ff187d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Jul 2021 09:37:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Jul 2021 09:37:35 +0200    

Click here for diff

Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20210716.170209.175434392011070182.horikyota.ntt%40gmail.com  

M src/backend/utils/mb/Unicode/big5_to_utf8.map
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/Unicode/euc_cn_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/euc_jp_to_utf8.map
M src/backend/utils/mb/Unicode/euc_kr_to_utf8.map
M src/backend/utils/mb/Unicode/euc_tw_to_utf8.map
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/gbk_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_10_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_13_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_14_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_15_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_16_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_2_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_3_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_4_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_5_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_6_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_7_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_8_to_utf8.map
M src/backend/utils/mb/Unicode/iso8859_9_to_utf8.map
M src/backend/utils/mb/Unicode/johab_to_utf8.map
M src/backend/utils/mb/Unicode/koi8r_to_utf8.map
M src/backend/utils/mb/Unicode/koi8u_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/sjis_to_utf8.map
M src/backend/utils/mb/Unicode/uhc_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_big5.map
M src/backend/utils/mb/Unicode/utf8_to_euc_cn.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jp.map
M src/backend/utils/mb/Unicode/utf8_to_euc_kr.map
M src/backend/utils/mb/Unicode/utf8_to_euc_tw.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map
M src/backend/utils/mb/Unicode/utf8_to_gbk.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_10.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_13.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_14.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_15.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_16.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_2.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_3.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_4.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_5.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_6.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_7.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_8.map
M src/backend/utils/mb/Unicode/utf8_to_iso8859_9.map
M src/backend/utils/mb/Unicode/utf8_to_johab.map
M src/backend/utils/mb/Unicode/utf8_to_koi8r.map
M src/backend/utils/mb/Unicode/utf8_to_koi8u.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_sjis.map
M src/backend/utils/mb/Unicode/utf8_to_uhc.map
M src/backend/utils/mb/Unicode/utf8_to_win1250.map
M src/backend/utils/mb/Unicode/utf8_to_win1251.map
M src/backend/utils/mb/Unicode/utf8_to_win1252.map
M src/backend/utils/mb/Unicode/utf8_to_win1253.map
M src/backend/utils/mb/Unicode/utf8_to_win1254.map
M src/backend/utils/mb/Unicode/utf8_to_win1255.map
M src/backend/utils/mb/Unicode/utf8_to_win1256.map
M src/backend/utils/mb/Unicode/utf8_to_win1257.map
M src/backend/utils/mb/Unicode/utf8_to_win1258.map
M src/backend/utils/mb/Unicode/utf8_to_win866.map
M src/backend/utils/mb/Unicode/utf8_to_win874.map
M src/backend/utils/mb/Unicode/win1250_to_utf8.map
M src/backend/utils/mb/Unicode/win1251_to_utf8.map
M src/backend/utils/mb/Unicode/win1252_to_utf8.map
M src/backend/utils/mb/Unicode/win1253_to_utf8.map
M src/backend/utils/mb/Unicode/win1254_to_utf8.map
M src/backend/utils/mb/Unicode/win1255_to_utf8.map
M src/backend/utils/mb/Unicode/win1256_to_utf8.map
M src/backend/utils/mb/Unicode/win1257_to_utf8.map
M src/backend/utils/mb/Unicode/win1258_to_utf8.map
M src/backend/utils/mb/Unicode/win866_to_utf8.map
M src/backend/utils/mb/Unicode/win874_to_utf8.map

Disable TAP tests of pg_receivewal for ZLIB on Windows

commit   : 6a2c532c2230159b909382cfa58494ef9d6df703    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Jul 2021 12:57:43 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Jul 2021 12:57:43 +0900    

Click here for diff

This reverts commit 91d395f, to avoid running those tests on Windows.  
The tests are globally stable across all buildfarm members, except  
fairywren (crash of pg_receivewal) and bowerdird (SIGBREAK preventing  
the buildfarm run to complete).  Those errors are rather strange, as  
other hosts with very similar characteristics are able to run those  
tests without breaking a sweat.  
  
For now, disable those tests on Windows to turn back the buildfarm to  
green.  
  
Per discussion with Andrew Dunstan.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

jit: Don't inline functions that access thread-locals.

commit   : 0207d5fbebed7eb698a7e5f3adf30fafe95bc4b9    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 22 Jul 2021 14:11:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 22 Jul 2021 14:11:17 +1200    

Click here for diff

Code inlined by LLVM can crash or fail with "Relocation type not  
implemented yet!" if it tries to access thread local variables.  Don't  
inline such code.  
  
Back-patch to 11, where LLVM arrived.  Bug #16696.  
  
Author: Dmitry Marakasov <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/llvm/llvmjit_inline.cpp

Make nodeSort.c use Datum sorts for single column sorts

commit   : 91e9e89dccdfdf4216953d3d8f5515dcdef177fb    
  
author   : David Rowley <[email protected]>    
date     : Thu, 22 Jul 2021 14:03:19 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 22 Jul 2021 14:03:19 +1200    

Click here for diff

Datum sorts can be significantly faster than tuple sorts, especially when  
the data type being sorted is a pass-by-value type.  Something in the  
region of 50-70% performance improvements appear to be possible.  
  
Just in case there's any confusion; the Datum sort is only used when the  
targetlist of the Sort node contains a single column, not when there's a  
single column in the sort key and multiple items in the target list.  
  
Author: Ronan Dunklau  
Reviewed-by: James Coleman, David Rowley, Ranier Vilela, Hou Zhijie  
Tested-by: John Naylor  
Discussion: https://postgr.es/m/3177670.itZtoPt7T5@aivenronan  

M src/backend/executor/nodeSort.c
M src/include/nodes/execnodes.h

Doc: improve documentation about exponentiation operator.

commit   : 7fa1e1ef741964eeb50f33d7c72622658bb7e5f4    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 21 Jul 2021 18:03:33 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 21 Jul 2021 18:03:33 -0400    

Click here for diff

Now that we're not having to wedge this into the straitjacket of  
the old operator table format, we can add another example to  
clarify the point about left-to-right associativity.  
  
Per suggestion from mdione at grulic.org.ar.  
  
https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Improve installation instructions a bit

commit   : aaec237b1a2f368ed2a8794c4f48b3656750eabc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Jul 2021 13:56:15 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Jul 2021 13:56:15 -0400    

Click here for diff

Reported-by: Daniel Westermann  
Discussion: https://postgr.es/m/GV0P278MB04835AAEACF894617574EB6BD25A9@GV0P278MB0483.CHEP278.PROD.OUTLOOK.COM  

M doc/src/sgml/installation.sgml

Document "B" and "us" as accepted units in postgres.conf.sample

commit   : bb95feabb8572f5069ad37763707862af5a81942    
  
author   : John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 10:17:07 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 10:17:07 -0400    

Click here for diff

In postgresql.conf, memory and file size GUCs can be specified with "B"  
(bytes) as of b06d8e58b. Likewise, time GUCs can be specified with "us"  
(microseconds) as of caf626b2c. Update postgres.conf.sample to reflect  
that fact.  
  
Pavel Luzanov  
  
Backpatch to v12, which is the earliest version that allows both of  
these units. A separate commit will document the "B" case for v11.  
  
Discussion: https://www.postgresql.org/message-id/flat/f10d16fc-8fa0-1b3c-7371-cb3a35a13b7a%40postgrespro.ru  

M src/backend/utils/misc/postgresql.conf.sample

Add missing check of noError parameter in euc_tw_and_big5.c

commit   : 004874b72e8e60966f88de2d95667fe66c0466ca    
  
author   : John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 09:11:32 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 21 Jul 2021 09:11:32 -0400    

Click here for diff

Oversight in ea1b99a66  
  
Yukun Wang  
  
Backpatch to v14 where this parameter was introduced  
  
Discussion: https://www.postgresql.org/message-id/flat/OS0PR01MB6003FCEFF0201EF21685FD33B4E39%40OS0PR01MB6003.jpnprd01.prod.outlook.com  

M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c

Add missing enum tags in enums used in nodes

commit   : 983bdc4fac492a99bb8ab5a471ca7437139e5cf6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 11:03:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 11:03:25 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/primnodes.h

Rename some node support functions for consistency

commit   : 31360381f0a5ff5193c3631e6076442352906f59    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 10:24:06 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 10:24:06 +0200    

Click here for diff

Some node function names didn't match their node type names exactly.  
Fix those for consistency.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c

Rename argument of _outValue()

commit   : 3d25b4ea6e2c93c60566c1185d4ee79a6285089a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 09:18:32 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 09:18:32 +0200    

Click here for diff

Rename from value to node, for consistency with similar functions.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/outfuncs.c

Rename NodeTag of ExprState

commit   : d9a38c52cef3cf80c4259277f11d42a86ecb1952    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 08:48:33 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 08:48:33 +0200    

Click here for diff

Rename from tag to type, for consistency with all other node structs.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/executor/execExpr.c
M src/include/nodes/execnodes.h

More improvements of error messages about mismatching relkind

commit   : 81d5995b4b78017ef9e5c6f151361d1fb949924c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 07:40:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 21 Jul 2021 07:40:05 +0200    

Click here for diff

Follow-up to 2ed532ee8c474e9767e76e1f3251cc3a0224358c, a few error  
messages in the logical replication area currently only deal with  
tables, but if we're anticipating more relkinds such as sequences  
being handled, then these messages also fall into the category  
affected by the previous patch, so adjust them too.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/catalog/pg_publication.c
M src/backend/executor/execReplication.c
M src/test/regress/expected/publication.out

doc: Document that only superusers can use pg_import_system_collations().

commit   : 90b6c339b2b37ee320ff6125ef8c8ad0073aa31b    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 13:52:37 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 13:52:37 +0900    

Click here for diff

Back-patch to v10 where pg_import_system_collations() was added.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml

Make XLOG_FPI_FOR_HINT records honor full_page_writes setting.

commit   : 7fcf2faf9c7dd473208fd6d5565f88d7f733782b    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 11:19:00 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 21 Jul 2021 11:19:00 +0900    

Click here for diff

Commit 2c03216d83 changed XLOG_FPI_FOR_HINT records so that they always  
included full-page images even when full_page_writes was disabled. However,  
in this setting, they don't need to do that because hint bit updates don't  
need to be protected from torn writes.  
  
Therefore, this commit makes XLOG_FPI_FOR_HINT records honor full_page_writes  
setting. That is, XLOG_FPI_FOR_HINT records may include no full-page images  
if full_page_writes is disabled, and WAL replay of them does nothing.  
  
Reported-by: Zhang Wenjie  
Author: Kyotaro Horiguchi  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c

Fix corner-case uninitialized-variable issues in plpgsql.

commit   : d9809bf8694c17e05537c5dd96cde3e67c02d52a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Jul 2021 13:01:48 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Jul 2021 13:01:48 -0400    

Click here for diff

If an error was raised during our initial attempt to check whether  
a successfully-compiled expression is "simple", subsequent calls of  
exec_stmt_execsql would suppose that stmt->mod_stmt was already computed  
when it had not been.  This could lead to assertion failures in debug  
builds; in production builds the effect would typically be to act as  
if INTO STRICT had been specified even when it had not been.  Of course  
that only matters if the subsequent attempt to execute the expression  
succeeds, so that the problem can only be reached by fixing a failure  
in some referenced, inline-able SQL function and then retrying the  
calling plpgsql function in the same session.  
  
(There might be even-more-obscure ways to change the expression's  
behavior without changing the plpgsql function, but that one seems  
like the only one people would be likely to hit in practice.)  
  
The most foolproof way to fix this would be to arrange for  
exec_prepare_plan to not set expr->plan until we've finished the  
subsidiary simple-expression check.  But it seems hard to do that  
without creating reference-count leak issues.  So settle for documenting  
the hazard in a comment and fixing exec_stmt_execsql to test separately  
for whether it's computed stmt->mod_stmt.  (That adds a test-and-branch  
per execution, but hopefully that's negligible in context.)  In v11 and  
up, also fix exec_stmt_call which had a variant of the same issue.  
  
Per bug #17113 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_simple.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/sql/plpgsql_simple.sql

Re-enable TAP tests of pg_receivewal for ZLIB on Windows

commit   : 91d395f47aa92849b2556b1a4d6bc1ff34121a30    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:17:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:17:08 +0900    

Click here for diff

This is a revert of 6cea447, that disabled those tests temporarily on  
Windows due to failures with bowerbird where gzflush() would fail when  
executed on a freshly-opened compressed and partial segment.  This  
problem should be taken care of now thanks to 7fbe0c8, so let's see what  
the buildfarm has to say on Windows for those tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Fix some issues with WAL segment opening for pg_receivewal --compress

commit   : 7fbe0c8c4d4fe429ee1d6383706ea5ccb0f639d3    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:12:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Jul 2021 12:12:39 +0900    

Click here for diff

The logic handling the opening of new WAL segments was fuzzy when using  
--compress if a partial, non-compressed, segment with the same base name  
existed in the repository storing those files.  In this case, using  
--compress would cause the code to first check for the existence and the  
size of a non-compressed segment, followed by the opening of a new  
compressed, partial, segment.  The code was accidentally working  
correctly on most platforms as the buildfarm has proved, except  
bowerbird where gzflush() could fail in this code path.  It is wrong  
anyway to take the code path used pre-padding when creating a new  
partial, non-compressed, segment, so let's fix it.  
  
Note that this issue exists when users mix successive runs of  
pg_receivewal with or without compression, as discovered with the tests  
introduced by ffc9dda.  
  
While on it, this refactors the code so as code paths that need to know  
about the ".gz" suffix are down from four to one in walmethods.c, easing  
a bit the introduction of new compression methods.  This addresses a  
second issue where log messages generated for an unexpected failure  
would not show the compressed segment name involved, which was  
confusing, printing instead the name of the non-compressed equivalent.  
  
Reported-by: Georgios Kokolatos  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 10  

M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Fix potential buffer overruns in proto.c.

commit   : 01c3adcdd85f1507ef49bdf5430c59925d08de6f    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 20 Jul 2021 08:15:01 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 20 Jul 2021 08:15:01 +0530    

Click here for diff

Prevent potential buffer overruns when using strcpy to gid buffer. This  
has been introduced by commit a8fd13cab0.  
  
Reported-by: Tom Lane as per coverity  
Author: Peter Smith  
Reviewed-by: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/161029.1626639923%40sss.pgh.pa.us  

M src/backend/replication/logical/proto.c

Doc: vacuum_multixact_failsafe_age is multixact-based.

commit   : dd498998a374b3d2a7f5211504f1f1aa15348cf1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:20:25 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:20:25 -0700    

Click here for diff

Oversight in commit 1e55e7d1, which added a wraparound failsafe  
mechanism to VACUUM.  
  
Backpatch: 14-, where VACUUM failsafe was introduced.  

M doc/src/sgml/config.sgml

vacuumdb: Correct comment about --force-index-cleanup.

commit   : 28766c054f8cc6a7bbcf99497954e7a259d3edb2    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:06:48 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 19 Jul 2021 17:06:48 -0700    

Click here for diff

Commit 3499df0d added a comment that incorrectly suggested that  
--force-index-cleanup did not appear in the same major version as the  
similar --no-index-cleanup option.  In fact, both options are new to  
PostgreSQL 14.  
  
Backpatch: 14-, where both options were introduced.  

M src/bin/scripts/vacuumdb.c

Don't use #if inside function-like macro arguments.

commit   : 0c08856856f54056ce8db116e9d254fda114c383    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 20 Jul 2021 10:49:08 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 20 Jul 2021 10:49:08 +1200    

Click here for diff

No concrete problem reported, but in the past it's been known to cause  
problems on some compilers so let's avoid doing that.  
  
Reported-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/234364.1626704007%40sss.pgh.pa.us  

M src/backend/storage/file/fd.c

Make new replication slot test code even less racy

commit   : 0d2cb6b2bbc3327dd002f3ecd4d5bde5851b0cdc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jul 2021 17:21:07 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 19 Jul 2021 17:21:07 -0400    

Click here for diff

Further fix the test code in ead9e51e8236, this time by waiting until  
the checkpoint has completed before moving on; this ensures that the  
WAL segment removal has already happened when we create the next slot.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Remove some whitespace in generated C output

commit   : 344dedfd1c24f2e2c591f1eadf8414a1f4df910a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 09:46:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 09:46:50 +0200    

Click here for diff

It doesn't match the normal coding style.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/Unicode/euc_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/shift_jis_2004_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_euc_jis_2004.map
M src/backend/utils/mb/Unicode/utf8_to_shift_jis_2004.map

Make UCS_to_most.pl process encodings in sorted order

commit   : 4d56115f721f3f2c6d3b6f017f40b5103ca71448    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 09:46:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 09:46:50 +0200    

Click here for diff

This just makes the progress output easier to follow.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/utils/mb/Unicode/UCS_to_most.pl

Use l*_node() family of functions where appropriate

commit   : 2b00db4fb0c7f02f000276bfadaab65a14059168    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 08:01:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Jul 2021 08:01:40 +0200    

Click here for diff

Instead of castNode(…, lfoo(…))  
  
Author: Dagfinn Ilmari Mannsåker <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeValuesscan.c
M src/backend/optimizer/util/paramassign.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/ruleutils.c
M src/pl/plpgsql/src/pl_exec.c
M src/test/modules/test_predtest/test_predtest.c

Don't allow to set replication slot_name as ''.

commit   : 29abde637bbb4b8fcdc96e049813890afa5ab671    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 10:36:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 10:36:15 +0530    

Click here for diff

We don't allow to create replication slot_name as an empty string ('') via  
SQL API pg_create_logical_replication_slot() but it is allowed to be set  
via Alter Subscription command. This will lead to apply worker repeatedly  
keep trying to stream data via slot_name '' and the user is not allowed to  
create the slot with that name.  
  
Author: Japin Li  
Reviewed-By: Ranier Vilela, Amit Kapila  
Backpatch-through: 10, where it was introduced  
Discussion: https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/commands/subscriptioncmds.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Adjust commit 2dbe8905 for ancient macOS.

commit   : 04cad8f7bcd63fac567e49fd72e6df42b3b251a9    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 19 Jul 2021 16:29:17 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 19 Jul 2021 16:29:17 +1200    

Click here for diff

A couple of open flags used in an assertion didn't exist in macOS 10.4.  
Per build farm animal prairiedog.  Also add O_EXCL while here (there are  
a few more standard flags but they're not relevant and likely to be  
missing).  

M src/backend/storage/file/fd.c

doc: Mention CASCADE/RESTRICT for DROP STATISTICS

commit   : d1216635610a9855a8ec139e55cd852f67d5ee81    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Jul 2021 12:39:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Jul 2021 12:39:38 +0900    

Click here for diff

This grammar has no effect as there are no dependencies on statistics,  
but it is supported by the parser.  This is more consistent with the  
other DROP commands.  
  
Author: Vignesh C  
Discussion: https://postgr.es/m/CALDaNm1LA=yNmzcSfy+0oe6CEAgsxXRf_-UutE3ZncFi8QkFNQ@mail.gmail.com  
Backpatch-through: 10  

M doc/src/sgml/ref/drop_statistics.sgml

Update comments for AlterSubscription.

commit   : dcecdfafbd2dbdfaa0f82e7710abfa65242a1d1e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 08:32:37 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Jul 2021 08:32:37 +0530    

Click here for diff

Add explanation as to why the subscription needs to be disabled to allow  
slot_name as none.  
  
Author: Japin Li and Amit Kapila  
Discussion: https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/commands/subscriptioncmds.c

Support direct I/O on macOS.

commit   : 2dbe8905711ba09a2214b6e835f8f0c2c4981cb3    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 19 Jul 2021 08:52:00 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 19 Jul 2021 08:52:00 +1200    

Click here for diff

Macs don't understand O_DIRECT, but they can disable caching with a  
separate fcntl() call.  Extend the file opening functions in fd.c to  
handle this for us if the caller passes in PG_O_DIRECT.  
  
For now, this affects only WAL data and even then only if you set:  
  
  max_wal_senders=0  
  wal_level=minimal  
  
This is not expected to be very useful on its own, but later proposed  
patches will make greater use of direct I/O, and it'll be useful for  
testing if developers on Macs can see the effects.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BADiyyHe0cun2wfT%2BSVnFVqNYPxoO6J9zcZkVO7%2BNGig%40mail.gmail.com  

M src/backend/storage/file/fd.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogdefs.h
M src/include/storage/fd.h

Forgotten catversion bump for 9e3c217bd9

commit   : f157db862225a7bfe041ca3f7b73e913e2a8d8d6    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:08:44 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:08:44 +0300    

Click here for diff

M src/include/catalog/catversion.h

Support for unnest(multirange)

commit   : 9e3c217bd98da803709872a8612577d88a39329a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:07:24 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 18 Jul 2021 21:07:24 +0300    

Click here for diff

It has been spotted that multiranges lack of ability to decompose them into  
individual ranges.  Subscription and proper expanded object representation  
require substantial work, and it's too late for v14.  This commit  
provides the implementation of unnest(multirange), which is quite trivial.  
unnest(multirange) is defined as a polymorphic procedure.  
  
Catversion is bumped.  
  
Reported-by: Jonathan S. Katz  
Discussion: https://postgr.es/m/flat/60258efe-bd7e-4886-82e1-196e0cac5433%40postgresql.org  
Author: Alexander Korotkov  
Reviewed-by: Justin Pryzby, Jonathan S. Katz, Zhihong Yu, Tom Lane  
Reviewed-by: Alvaro Herrera  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/multirangetypes.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

Improve error checking of CREATE COLLATION options.

commit   : ba620760c4c8ca90ff83ecf7e4d46f5ec4dabd7b    
  
author   : Dean Rasheed <[email protected]>    
date     : Sun, 18 Jul 2021 11:08:34 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sun, 18 Jul 2021 11:08:34 +0100    

Click here for diff

Check for conflicting or redundant options, as we do for most other  
commands. Specifying any option more than once is at best redundant,  
and quite likely indicates a bug in the user's code.  
  
While at it, improve the error for conflicting locale options by  
adding detail text (the same as for CREATE DATABASE).  
  
Bharath Rupireddy, reviewed by Vignesh C. Some additional hacking by  
me.  
  
Discussion: https://postgr.es/m/CALj2ACWtL6fTLdyF4R_YkPtf1YEDb6FUoD5DGAki3rpD+sWqiA@mail.gmail.com  

M src/backend/commands/collationcmds.c
M src/test/regress/expected/collate.out
M src/test/regress/sql/collate.sql

Make new replication slot test code less racy

commit   : 8589299e03fff012e0bbb9716693750a0d68eef7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sat, 17 Jul 2021 13:19:17 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sat, 17 Jul 2021 13:19:17 -0400    

Click here for diff

The new test code added in ead9e51e8236 is racy -- it hinges on  
shared-memory state, which changes before the WARNING message is logged.  
Put it the other way around.  
  
Backpatch to 13.  
  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/019_replslot_limit.pl

Doc: document the current-transaction-modes GUCs.

commit   : 665c5855e5820531f500dad50f29f377af537ecc    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 17 Jul 2021 11:52:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 17 Jul 2021 11:52:54 -0400    

Click here for diff

We had documentation of default_transaction_isolation et al,  
but for some reason not of transaction_isolation et al.  
AFAICS this is just an ancient oversight, so repair.  
  
Per bug #17077 from Yanliang Lei.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/set_transaction.sgml

Fix pg_dump for disabled triggers on partitioned tables

commit   : f0e21f2f61675f4e56ae53d32ea54d587a7c2257    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 17:29:22 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 17:29:22 -0400    

Click here for diff

pg_dump failed to preserve the 'enabled' flag (which can be not only  
disabled, but also REPLICA or ALWAYS) for partitions which had it  
changed from their respective parents.  Attempt to handle that by  
including a definition for such triggers in the dump, but replace the  
standard CREATE TRIGGER line with an ALTER TRIGGER line.  
  
Backpatch to 11, where these triggers can exist.  In branches 11 and 12,  
pick up a few test lines from commit b9b408c48724 to verify that  
pg_upgrade is okay with these arrangements.  
  
Co-authored-by: Justin Pryzby <[email protected]>  
Co-authored-by: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Preserve firing-on state when cloning row triggers to partitions

commit   : df80fa2ee50478391445cef03e42c1b3d64fccca    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 13:01:43 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 13:01:43 -0400    

Click here for diff

When triggers are cloned from partitioned tables to their partitions,  
the 'tgenabled' flag (origin/replica/always/disable) was not propagated.  
Make it so that the flag on the trigger on partition is initially set to  
the same value as on the partitioned table.  
  
Add a test case to verify the behavior.  
  
Backpatch to 11, where this appeared in commit 86f575948c77.  
  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Justin Pryzby <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/include/commands/trigger.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql

Advance old-segment horizon properly after slot invalidation

commit   : ead9e51e82363a0e492d56aee83ed11b3759a615    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 12:07:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 16 Jul 2021 12:07:30 -0400    

Click here for diff

When some slots are invalidated due to the max_slot_wal_keep_size limit,  
the old segment horizon should move forward to stay within the limit.  
However, in commit c6550776394e we forgot to call KeepLogSeg again to  
recompute the horizon after invalidating replication slots.  In cases  
where other slots remained, the limits would be recomputed eventually  
for other reasons, but if all slots were invalidated, the limits would  
not move at all afterwards.  Repair.  
  
Backpatch to 13 where the feature was introduced.  
  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: Marcin Krupowicz <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
M src/test/recovery/t/019_replslot_limit.pl

doc: Spell checking

commit   : 46111fb7b57876a87eb0630ec12ad30950e38a39    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jul 2021 10:35:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Jul 2021 10:35:38 +0200    

Click here for diff

M doc/src/sgml/bki.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/wal.sgml

Disable tests involving ZLIB on Windows for pg_receivewal

commit   : 6cea447e6a10cd7ef511470e809a894a013e6a18    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 16 Jul 2021 13:21:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 16 Jul 2021 13:21:18 +0900    

Click here for diff

As reported by buildfarm member bowerbird, those tests are unstable on  
Windows.  The failure produced there points to a problem with gzflush(),  
that fails to sync a file freshly-opened, with a gzFile properly  
opened.  While testing this myself with MSVC, I bumped into a different  
error where a file could simply not be opened, so this makes me rather  
doubtful that testing this area on Windows is a good idea if this  
finishes with random concurrency failures.  This requires more  
investigation, and keeping this buildfarm member red is not a good thing  
in the long-term, so for now this just disables this set of tests on  
Windows.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

docs: fix inconsistencies in markup and case

commit   : 830ef61bd8d0ac4c89c21a895047c1b3a6b202f3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 15 Jul 2021 23:22:58 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 15 Jul 2021 23:22:58 +0200    

Click here for diff

Ensure to properly mark up function parameters in text with <parameter>,  
avoid using <acronym> for terms which aren't acronyms and properly place  
the ", and" in a value list. The acronym removal is a follow-up to commit  
fb72a7b8c3 which removed it for minmax-multi.  In passing, also fix an  
incorrectly cased word.  
  
Author: Ekaterina Kiryanova <[email protected]>  
Reviewed-by: Laurenz Albe <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v14  

M doc/src/sgml/amcheck.sgml
M doc/src/sgml/brin.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml

Replace explicit PIN entries in pg_depend with an OID range test.

commit   : a49d081235997c67e8aab7a523b17e8d1cb93184    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:41:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:41:47 -0400    

Click here for diff

As of v14, pg_depend contains almost 7000 "pin" entries recording  
the OIDs of built-in objects.  This is a fair amount of bloat for  
every database, and it adds time to pg_depend lookups as well as  
initdb.  We can get rid of all of those entries in favor of an OID  
range check, i.e. "OIDs below FirstUnpinnedObjectId are pinned".  
  
(template1 and the public schema are exceptions.  Those exceptions  
are now wired into IsPinnedObject() instead of initdb's code for  
filling pg_depend, but it's the same amount of cruft either way.)  
  
The contents of pg_shdepend are modified likewise.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/storage/lmgr/predicate.c
M src/bin/initdb/initdb.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/access/transam.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_shdepend.h
M src/test/regress/expected/misc_sanity.out
M src/test/regress/sql/misc_sanity.sql

Ensure HAVE_DECL_XXX macros in MSVC builds match those in Unix.

commit   : e529b2dc37ac80ccebd76cdbb14966d3b40819c9    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:00:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Jul 2021 11:00:43 -0400    

Click here for diff

Autoconf's AC_CHECK_DECLS() always defines HAVE_DECL_whatever  
as 1 or 0, but some of the entries in msvc/Solution.pm showed  
such symbols as "undef" instead of 0.  Fix that for consistency.  
There's no live bug in current usages AFAICS, but it's not hard  
to imagine one creeping in if more-complex #if tests get added.  
  
Back-patch to v13, which is as far back as Solution.pm contains  
this data.  The inconsistency still exists in the manually-filled  
pg_config_ext.h.win32 files of older branches; but as long as the  
problem is only latent, it doesn't seem worth the trouble to  
clean things up there.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/msvc/Solution.pm

Fix portability issue with gzip in TAP test of pg_receivewal

commit   : 0da3c1bc3f7261d5157f5b86ade88e8b379f8686    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 21:25:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 21:25:03 +0900    

Click here for diff

The OpenBSD implementation of gzip considers only files suffixed by "Z",  
"gz", "z", "tgz" or "taz" as valid targets, discarding anything else and  
making a command using --test exit with an error code of 512 if anything  
invalid is found.  The test introduced in ffc9dda tested a WAL segment  
suffixed as .gz.partial, enough to make the test fail.  
  
Testing only a full segment is fine enough in terms of coverage, so  
simplify the code by discarding the .gz.partial segment in this check.  
This should be enough to make the test pass with OpenBSD environments.  
  
Per report from curculio.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Fix small inconsistencies in catalog definition of multirange operators

commit   : 768ea9bcf98120eef01a6deea9c5c6997b153ab1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Jul 2021 14:18:19 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Jul 2021 14:18:19 +0300    

Click here for diff

This commit fixes the description of a couple of multirange operators and  
oprjoin for another multirange operator.  The change of oprjoin is more  
cosmetic since both old and new functions return the same constant.  
  
These cosmetic changes don't worth catalog incompatibility between 14beta2  
and 14beta3.  So, catversion isn't bumped.  
  
Discussion: https://postgr.es/m/CAPpHfdv9OZEuZDqOQoUKpXhq%3Dmc-qa4gKCPmcgG5Vvesu7%3Ds1w%40mail.gmail.com  
Backpatch-throgh: 14  

M src/include/catalog/pg_operator.dat

Improve reporting of "conflicting or redundant options" errors.

commit   : 2bfb50b3df11399ed80347dd03bfaf8cd5acf962    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 15 Jul 2021 08:49:45 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 15 Jul 2021 08:49:45 +0100    

Click here for diff

When reporting "conflicting or redundant options" errors, try to  
ensure that errposition() is used, to help the user identify the  
offending option.  
  
Formerly, errposition() was invoked in less than 60% of cases. This  
patch raises that to over 90%, but there remain a few places where the  
ParseState is not readily available. Using errdetail() might improve  
the error in such cases, but that is left as a task for the future.  
  
Additionally, since this error is thrown from over 100 places in the  
codebase, introduce a dedicated function to throw it, reducing code  
duplication.  
  
Extracted from a slightly larger patch by Vignesh C. Reviewed by  
Bharath Rupireddy, Alvaro Herrera, Dilip Kumar, Hou Zhijie, Peter  
Smith, Daniel Gustafsson, Julien Rouhaud and me.  
  
Discussion: https://postgr.es/m/CALDaNm33FFSS5tVyvmkoK2cCMuDVxcui=gFrjti9ROfynqSAGA@mail.gmail.com  

M src/backend/catalog/aclchk.c
M src/backend/commands/copy.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/include/commands/publicationcmds.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/typecmds.h
M src/include/commands/user.h
M src/test/regress/expected/copy2.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/publication.out

Add TAP tests for ZLIB compression for pg_receivewal

commit   : ffc9ddaea33f6dfd3dfa95828a0970fbb617bf8a    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:53:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:53:20 +0900    

Click here for diff

There is a non-trivial amount of code that handles ZLIB compression in  
pg_receivewal, from basics like the format name, the calculation of the  
start streaming position and of course the compression itself, but there  
was no automated coverage for it.  
  
This commit introduces a set of conditional tests (if the build supports  
ZLIB) to cover the creation of ZLIB-compressed WAL segments, the  
handling of the partial, compressed, WAL segments and the compression  
operation in itself.  Note that there is an extra phase checking the  
validity of the generated files by using directly a gzip command, passed  
down by the Makefile of pg_receivewal.  This part is skipped if the  
command cannot be found, something likely going to happen on Windows  
with MSVC except if one sets the variable GZIP_PROGRAM in the  
environment of the test.  
  
This set of tests will become handy for upcoming patches that add more  
options for the compression methods used by pg_receivewal, like LZ4, to  
make sure that no existing facilities are broken.  
  
Author: Georgios Kokolatos  
Reviewed-by: Gilles Darold, Michael Paquier  
Discussion: https://postgr.es/m/07BK3Mk5aEOsTwGaY77qBVyf9GjoEzn8TMgHLyPGfEFPIpTEmoQuP2P4c7teesjSg-LPeUafsp1flnPeQYINMSMB_UpggJDoduB5EDYBqaQ=@protonmail.com  

M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Remove unnecessary assertion in postmaster.c

commit   : dc2db1eac365b97c9129393acfe11102859f9e23    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:00:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 15 Jul 2021 15:00:45 +0900    

Click here for diff

A code path asserted that the archiver was dead, but a check made that  
impossible to happen.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACW=CYE1ars+2XyPTEPq0wQvru4c0dPZ=Nrn3EqNBkksvQ@mail.gmail.com  
Backpatch-throgh: 14  

M src/backend/postmaster/postmaster.c

Portability fixes for sigwait.

commit   : 5865e064abfbbe11ebfc09881be009c0f69b4dc2    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 15 Jul 2021 12:23:47 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 15 Jul 2021 12:23:47 +1200    

Click here for diff

Build farm animals running ancient HPUX and Solaris have a non-standard  
sigwait() from draft versions of POSIX, so they didn't like commit  
7c09d279.  To avoid the problem in general, only try to use sigwait() if  
it's declared by <signal.h> and matches the expected declaration.  To  
select the modern declaration on Solaris (even in non-threaded  
programs), move -D_POSIX_PTHREAD_SEMANTICS into the right place to  
affect all translation units.  
  
Also fix the error checking.  Modern sigwait() doesn't set errno.  
  
Thanks to Tom Lane for help with this.  
  
Discussion: https://postgr.es/m/3187588.1626136248%40sss.pgh.pa.us  

M config/thread_test.c
M configure
M configure.ac
M src/bin/psql/command.c
M src/bin/psql/startup.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Fix some nonstandard C code indentation in grammar file

commit   : 9aa8268faa0ec2904f55e85be5ec7b365c98edd1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 23:54:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 23:54:56 +0200    

Click here for diff

M src/backend/parser/gram.y

Copy a Param's location field when replacing it with a Const.

commit   : be850f1822e4b54d1d570eefa8a7242788011634    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Jul 2021 14:15:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Jul 2021 14:15:12 -0400    

Click here for diff

This allows Param substitution to produce just the same result  
as writing a constant value literally would have done.  While  
it hardly matters so far as the current core code is concerned,  
extensions might take more interest in node location fields.  
  
Julien Rouhaud  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/clauses.c

Remove unused function parameter in get_qual_from_partbound

commit   : c203dcddf997180000bc574a60313f3437e35af9    
  
author   : John Naylor <[email protected]>    
date     : Wed, 14 Jul 2021 09:52:04 -0400    
  
committer: John Naylor <[email protected]>    
date     : Wed, 14 Jul 2021 09:52:04 -0400    

Click here for diff

Commit 0563a3a8b changed how partition constraints were generated such  
that this function no longer computes the mapping of parent attnos to  
child attnos.  
  
This is an external function that extensions could use, so this is  
potentially a breaking change. No external callers are known, however,  
and this will make it simpler to write such callers in the future.  
  
Author: Hou Zhijie  
Reviewed-by: David Rowley, Michael Paquier, Soumyadeep Chakraborty  
Discussion: https://www.postgresql.org/message-id/flat/OS0PR01MB5716A75A45BE46101A1B489894379@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/cache/partcache.c
M src/include/partitioning/partbounds.h

In psql \copy from, send data to server in larger chunks.

commit   : eec57115e4c866f26bdc8bcbe3e2e7be4c6d0450    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 14 Jul 2021 13:08:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 14 Jul 2021 13:08:28 +0300    

Click here for diff

Previously, we would send each line as a separate CopyData message.  
That's pretty wasteful if the table is narrow, as each CopyData message  
has 5 bytes of overhead. For efficiency, buffer up and pack 8 kB of  
input data into each CopyData message.  
  
The server also sends each line as a separate CopyData message in COPY TO  
STDOUT, and that's similarly wasteful. But that's documented in the FE/BE  
protocol description, so changing that would be a wire protocol break.  
  
Reviewed-by: Aleksander Alekseev  
Discussion: https://www.postgresql.org/message-id/40b2cec0-d0fb-3191-2ae1-9a3fe16a7e48%40iki.fi  

M src/bin/psql/copy.c

Clarify description of pg_stat_statements columns

commit   : b4deefc39b933b9808645667117f2d8208092794    
  
author   : Magnus Hagander <[email protected]>    
date     : Wed, 14 Jul 2021 11:04:15 +0200    
  
committer: Magnus Hagander <[email protected]>    
date     : Wed, 14 Jul 2021 11:04:15 +0200    

Click here for diff

Reported-By: Peter Eisentraut  
Backpatch-through: 14  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Fix lack of message pluralization

commit   : 55b2a2340758da8ff11357d719d169f264ac7112    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 09:15:14 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 14 Jul 2021 09:15:14 +0200    

Click here for diff

M src/backend/storage/ipc/signalfuncs.c

Add support for prepared transactions to built-in logical replication.

commit   : a8fd13cab0ba815e9925dc9676e6309f699b5f72    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Jul 2021 07:33:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Jul 2021 07:33:50 +0530    

Click here for diff

To add support for streaming transactions at prepare time into the  
built-in logical replication, we need to do the following things:  
  
* Modify the output plugin (pgoutput) to implement the new two-phase API  
callbacks, by leveraging the extended replication protocol.  
  
* Modify the replication apply worker, to properly handle two-phase  
transactions by replaying them on prepare.  
  
* Add a new SUBSCRIPTION option "two_phase" to allow users to enable  
two-phase transactions. We enable the two_phase once the initial data sync  
is over.  
  
We however must explicitly disable replication of two-phase transactions  
during replication slot creation, even if the plugin supports it. We  
don't need to replicate the changes accumulated during this phase,  
and moreover, we don't have a replication connection open so we don't know  
where to send the data anyway.  
  
The streaming option is not allowed with this new two_phase option. This  
can be done as a separate patch.  
  
We don't allow to toggle two_phase option of a subscription because it can  
lead to an inconsistent replica. For the same reason, we don't allow to  
refresh the publication once the two_phase is enabled for a subscription  
unless copy_data option is false.  
  
Author: Peter Smith, Ajin Cherian and Amit Kapila based on previous work by Nikhil Sontakke and Stas Kelvich  
Reviewed-by: Amit Kapila, Sawada Masahiko, Vignesh C, Dilip Kumar, Takamichi Osumi, Greg Nancarrow  
Tested-By: Haiying Tang  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAA4eK1+opiV4aFTmWWUF9h_32=HfPOW9vZASHarT0UA5oBrtGw@mail.gmail.com  

M contrib/test_decoding/test_decoding.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/access/transam/twophase.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/access/twophase.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/replication/logical.h
M src/include/replication/logicalproto.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/snapbuild.h
M src/include/replication/walreceiver.h
M src/include/replication/worker_internal.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
A src/test/subscription/t/021_twophase.pl
A src/test/subscription/t/022_twophase_cascade.pl
M src/tools/pgindent/typedefs.list

Install properly fe-auth-sasl.h

commit   : 6c9c2831668345122fd0f92280b30f3bbe2dd4e6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Jul 2021 10:37:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Jul 2021 10:37:26 +0900    

Click here for diff

The internals of the frontend-side callbacks for SASL are visible in  
libpq-int.h, but the header was not getting installed.  This would cause  
compilation failures for applications playing with the internals of  
libpq.  
  
Issue introduced in 9fd8557.  
  
Author: Mikhail Kulagin  
Reviewed-by: Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Install.pm

Change the name of the Result Cache node to Memoize

commit   : 83f4fcc65503c5d4e5d5eefc8e7a70d3c9a6496f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 14 Jul 2021 12:43:58 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 14 Jul 2021 12:43:58 +1200    

Click here for diff

"Result Cache" was never a great name for this node, but nobody managed  
to come up with another name that anyone liked enough.  That was until  
David Johnston mentioned "Node Memoization", which Tom Lane revised to  
just "Memoize".  People seem to like "Memoize", so let's do the rename.  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14, where Result Cache was introduced  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M src/backend/commands/explain.c
M src/backend/executor/Makefile
M src/backend/executor/execAmi.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
R065 src/backend/executor/nodeResultCache.c src/backend/executor/nodeMemoize.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/README
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
A src/include/executor/nodeMemoize.h
D src/include/executor/nodeResultCache.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out
R088 src/test/regress/expected/resultcache.out src/test/regress/expected/memoize.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/join.sql
R088 src/test/regress/sql/resultcache.sql src/test/regress/sql/memoize.sql
M src/test/regress/sql/partition_prune.sql
M src/tools/pgindent/typedefs.list

Rename debug_invalidate_system_caches_always to debug_discard_caches.

commit   : d68a00391214be2020e49be4b55f761d47a5c229    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Jul 2021 15:01:01 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Jul 2021 15:01:01 -0400    

Click here for diff

The name introduced by commit 4656e3d66 was agreed to be unreasonably  
long.  To match this change, rename initdb's recently-added  
--clobber-cache option to --discard-caches.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/regress.sgml
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/misc/guc.c
M src/bin/initdb/initdb.c
M src/include/pg_config_manual.h
M src/include/utils/inval.h
M src/pl/plpgsql/src/expected/plpgsql_cache.out
M src/pl/plpgsql/src/expected/plpgsql_cache_1.out
M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/sql/plpgsql_cache.sql
M src/pl/plpgsql/src/sql/plpgsql_record.sql
M src/test/isolation/specs/deadlock-soft-2.spec

Remove useless range checks on INT8 sequences

commit   : e0271d5f1e871dd61efc26bda8a0b556c7935901    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:56:59 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:56:59 +1200    

Click here for diff

There's no point in checking if an INT8 sequence has a seqmin and seqmax  
value is outside the range of the minimum and maximum values for an int64  
type.  These both use the same underlying types so an INT8 certainly  
cannot be outside the minimum and maximum values supported by int64.  
  
This code is fairly harmless and it seems likely that most compilers  
would optimize it out anyway, never-the-less, let's remove it replacing  
it with a small comment to mention why the check is not needed.  
  
Author: Greg Nancarrow, with the comment revised by David Rowley  
Discussion: https://postgr.es/m/CAJcOf-c9KBUZ8ow_6e%3DWSfbbEyTKfqV%3DVwoFuODQVYMySHtusw%40mail.gmail.com  

M src/backend/commands/sequence.c

Robustify tuplesort's free_sort_tuple function

commit   : 5bd38d2f2846c7e387d04a16c4372da0de7b1221    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:27:05 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 13:27:05 +1200    

Click here for diff

41469253e went to the trouble of removing a theoretical bug from  
free_sort_tuple by checking if the tuple was NULL before freeing it. Let's  
make this a little more robust by also setting the tuple to NULL so that  
should we be called again we won't end up doing a pfree on the already  
pfree'd tuple. Per advice from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 9.6, same as 41469253e  

M src/backend/utils/sort/tuplesort.c

Fix theoretical bug in tuplesort

commit   : 41469253e970b539a4ae75226dd4f226b7b2bc8c    
  
author   : David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 12:40:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 13 Jul 2021 12:40:16 +1200    

Click here for diff

This fixes a theoretical bug in tuplesort.c which, if a bounded sort was  
used in combination with a byval Datum sort (tuplesort_begin_datum), when  
switching the sort to a bounded heap in make_bounded_heap(), we'd call  
free_sort_tuple().  The problem was that when sorting Datums of a byval  
type, the tuple is NULL and free_sort_tuple() would free the memory for it  
regardless of that.  This would result in a crash.  
  
Here we fix that simply by adding a check to see if the tuple is NULL  
before trying to disassociate and free any memory belonging to it.  
  
The reason this bug is only theoretical is that nowhere in the current  
code base do we do tuplesort_set_bound() when performing a Datum sort.  
However, let's backpatch a fix for this as if any extension uses the code  
in this way then it's likely to cause problems.  
  
Author: Ronan Dunklau  
Discussion: https://postgr.es/m/CAApHDvpdoqNC5FjDb3KUTSMs5dg6f+XxH4Bg_dVcLi8UYAG3EQ@mail.gmail.com  
Backpatch-through: 9.6, oldest supported version  

M src/backend/utils/sort/tuplesort.c

Add PSQL_WATCH_PAGER for psql's \watch command.

commit   : 7c09d2797ecdf779e5dc3289497be85675f3d134    
  
author   : Thomas Munro <[email protected]>    
date     : Tue, 13 Jul 2021 11:13:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Tue, 13 Jul 2021 11:13:48 +1200    

Click here for diff

Allow a pager to be used by the \watch command.  This works but isn't  
very useful with traditional pagers like "less", so use a different  
environment variable.  The popular open source tool "pspg" (also by  
Pavel) knows how to display the output if you set PSQL_WATCH_PAGER="pspg  
--stream".  
  
To make \watch react quickly when the user quits the pager or presses  
^C, and also to increase the accuracy of its timing and decrease the  
rate of useless context switches, change the main loop of the \watch  
command to use sigwait() rather than a sleeping/polling loop, on Unix.  
  
Supported on Unix only for now (like pspg).  
  
Author: Pavel Stehule <[email protected]>  
Author: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CAFj8pRBfzUUPz-3gN5oAzto9SDuRSq-TQPfXU_P6h0L7hO%2BEhg%40mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/help.c
M src/bin/psql/startup.c

Probe for preadv/pwritev in a more macOS-friendly way.

commit   : f014b1b9bb8eda4e82c1805969dbae2b07b7d54d    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 19:17:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 19:17:35 -0400    

Click here for diff

Apple's mechanism for dealing with functions that are available  
in only some OS versions confuses AC_CHECK_FUNCS, and therefore  
AC_REPLACE_FUNCS.  We can use AC_CHECK_DECLS instead, so long as  
we enable -Werror=unguarded-availability-new.  This allows people  
compiling for macOS to control whether or not preadv/pwritev are  
used by setting MACOSX_DEPLOYMENT_TARGET, rather than supplying  
a back-rev SDK.  (Of course, the latter still works, too.)  
  
James Hilliard  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port/pg_iovec.h
M src/tools/msvc/Solution.pm

Replace RelationOpenSmgr() with RelationGetSmgr().

commit   : f10f0ae420ee62400876ab34dca2c09c20dcd030    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 17:01:29 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 12 Jul 2021 17:01:29 -0400    

Click here for diff

The idea behind this patch is to design out bugs like the one fixed  
by commit 9d523119f.  Previously, once one did RelationOpenSmgr(rel),  
it was considered okay to access rel->rd_smgr directly for some  
not-very-clear interval.  But since that pointer will be cleared by  
relcache flushes, we had bugs arising from overreliance on a previous  
RelationOpenSmgr call still being effective.  
  
Now, very little code except that in rel.h and relcache.c should ever  
touch the rd_smgr field directly.  The normal coding rule is to use  
RelationGetSmgr(rel) and not expect the result to be valid for longer  
than one smgr function call.  There are a couple of places where using  
the function every single time seemed like overkill, but they are now  
annotated with large warning comments.  
  
Amul Sul, after an idea of mine.  
  
Discussion: https://postgr.es/m/CANiYTQsU7yMFpQYnv=BrcRVqK_3U3mtAzAsJCaqtzsDHfsUbdQ@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/bloom/blinsert.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/table/tableam.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/include/utils/rel.h

doc: Fix typo in function prototype

commit   : 5b60cf35f566697030a2895dfe27dde2e34dd370    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 22:07:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 12 Jul 2021 22:07:35 +0200    

Click here for diff

M doc/src/sgml/indexam.sgml

Remove dead assignment to local variable.

commit   : 4c64b51dc51f8ff7e3e51eebfe8d10469a577df1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Jul 2021 11:13:33 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Jul 2021 11:13:33 +0300    

Click here for diff

This should have been removed in commit 7e30c186da, which split the loop  
into two. Only the first loop uses the 'from' variable; updating it in  
the second loop is bogus. It was never read after the first loop, so this  
was harmless and surely optimized away by the compiler, but let's be tidy.  
  
Backpatch to all supported versions.  
  
Author: Ranier Vilela  
Discussion: https://www.postgresql.org/message-id/CAEudQAoWq%2BAL3BnELHu7gms2GN07k-np6yLbukGaxJ1vY-zeiQ%40mail.gmail.com  

M src/backend/access/nbtree/nbtxlog.c

Revert "Fix issues with Windows' stat() for files pending on deletion"

commit   : 2c9b46c090e76c62f24563b9be2c34e6b92e9329    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 14:46:08 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 14:46:08 +0900    

Click here for diff

This reverts commit 54fb8c7, as per the issues reported by fairywren  
when it comes to MinGW because of the lack of microsoft_native_stat()  
there.  Using just stat() for MSVC is not sufficient to take care of the  
concurrency problems with files pending on deletion.  It may be possible  
to paint some __MINGW64__ in the code to switch to a different  
implementation of stat() in this build context, but I am not sure either  
if relying on the implementation of stat() in MinGW to take care of the  
problems we are trying to fix is enough or not.  So this needs more  
study.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/open.c
M src/port/win32stat.c

Fix issues with Windows' stat() for files pending on deletion

commit   : 54fb8c7ddf152629021cab3ac3596354217b7d81    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 13:02:31 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 13:02:31 +0900    

Click here for diff

The code introduced by bed9075 to enhance the stat() implementation on  
Windows for file sizes larger than 4GB fails to properly detect files  
pending for deletion with its method based on NtQueryInformationFile()  
or GetFileInformationByHandleEx(), as proved by Alexander Lakhin in a  
custom TAP test of his own.  
  
The method used in the implementation of open() to sleep and loop when  
when failing on ERROR_ACCESS_DENIED (EACCES) is showing much more  
stability, so switch to this method.  This could still lead to issues if  
the permission problem stays around for much longer than the timeout of  
1 second used, but that should (hopefully) never happen in  
performance-critical paths.  Still, there could be a point in increasing  
the timeouts for the sake of machines that handle heavy loads.  
  
Note that WIN32's open() now uses microsoft_native_stat() as it should  
be similar to stat() when working around issues with concurrent file  
deletions.  
  
I have spent some time testing this patch with pgbench in combination  
of the SQL functions from genfile.c, as well as running the TAP test  
provided on the thread with MSVC builds, and this looks much more  
stable than the previous method.  
  
Author: Alexander Lakhin  
Reviewed-by: Tom Lane, Michael Paquier,	Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/port/open.c
M src/port/win32stat.c

pageinspect: Improve page_header() for pages of 32kB

commit   : 127404fbe28455d6e8183fa58f3b7aefeba8f909    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 11:05:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 12 Jul 2021 11:05:27 +0900    

Click here for diff

ld_upper, ld_lower, pd_special and the page size have been using  
smallint as return type, which could cause those fields to return  
negative values in certain cases for builds configures with a page size  
of 32kB.  
  
Bump pageinspect to 1.10.  page_header() is able to handle the correct  
return type of those fields at runtime when using an older version of  
the extension, with some tests are added to cover that.  
  
Author: Quan Zongliang  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pageinspect/Makefile
M contrib/pageinspect/expected/oldextversions.out
A contrib/pageinspect/pageinspect–1.9–1.10.sql
M contrib/pageinspect/pageinspect.control
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/oldextversions.sql

Lock the extension during ALTER EXTENSION ADD/DROP.

commit   : 626731db26ae2617e41536678440c3817128a006    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 11 Jul 2021 12:54:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 11 Jul 2021 12:54:24 -0400    

Click here for diff

Although we were careful to lock the object being added or dropped,  
we failed to get any sort of lock on the extension itself.  This  
allowed the ALTER to proceed in parallel with a DROP EXTENSION,  
which is problematic for a couple of reasons.  If both commands  
succeeded we'd be left with a dangling link in pg_depend, which  
would cause problems later.  Also, if the ALTER failed for some  
reason, it might try to print the extension's name, and that could  
result in a crash or (in older branches) a silly error message  
complaining about extension "(null)".  
  
Per bug #17098 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/extension.c

Fix pgbench timestamp bugs.

commit   : 0e39a608ed5545cc6b9d538ac937c3c1ee8cdc36    
  
author   : Thomas Munro <[email protected]>    
date     : Sun, 11 Jul 2021 19:50:55 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sun, 11 Jul 2021 19:50:55 +1200    

Click here for diff

Commit 547f04e changed pgbench to use microsecond accounting, but  
introduced a couple of logging and aggregation bugs:  
  
1.  We print Unix epoch timestamps so that you can correlate them with  
other logs, but these were inadvertently changed to use a  
system-dependent reference epoch.  Compute Unix timestamps, and begin  
aggregation intervals on the boundaries of whole Unix epoch seconds, as  
before.  
  
2.  The user-supplied aggregation interval needed to be scaled.  
  
Back-patch to 14.  
  
Author: Fabien COELHO <[email protected]>  
Author: Yugo NAGATA <[email protected]>  
Author: Kyotaro Horiguchi <[email protected]>  
Reported-by: YoungHwan Joo <[email protected]>  
Reported-by: Gregory Smith <[email protected]>  
Discussion: https://postgr.es/m/CAF7igB1r6wRfSCEAB-iZBKxkowWY6%2BdFF2jObSdd9%2BiVK%2BvHJg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAHLJuCW_8Vpcr0%3Dt6O_gozrg3wXXWXZXDioYJd3NhvKriqgpfQ%40mail.gmail.com  

M src/bin/pgbench/pgbench.c

Fix assign_record_type_typmod().

commit   : dd0e37cc1598050ec38fa289908487d4f5c96dca    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:48 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:48 -0700    

Click here for diff

If an error occurred in the wrong place, it was possible to leave an  
unintialized entry in the hash table, leading to a crash. Fixed.  
  
Also, be more careful about the order of operations so that an  
allocation error doesn't leak memory in CacheMemoryContext or  
unnecessarily advance NextRecordTypmod.  
  
Backpatch through version 11. Earlier versions (prior to 35ea75632a5)  
do not exhibit the problem, because an uninitialized hash entry  
contains a valid empty list.  
  
Author: Sait Talha Nisanci <[email protected]>  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/HE1PR8303MB009069D476225B9A9E194B8891779@HE1PR8303MB0090.EURPRD83.prod.outlook.com  
Backpatch-through: 11  

M src/backend/utils/cache/typcache.c

Fix busted test for ldap_initialize.

commit   : 9f6be2e79f88c65cef7cfeb0580e8b2ba74974f6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 10 Jul 2021 13:19:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 10 Jul 2021 13:19:30 -0400    

Click here for diff

Sigh ... I was expecting AC_CHECK_LIB to do something it didn't,  
namely update LIBS.  This led to not finding ldap_initialize.  
Fix by moving the probe for ldap_initialize.  In some sense this  
is more correct anyway, since (at least for now) we care about  
whether ldap_initialize exists in libldap not libldap_r.  
  
Per buildfarm member elver and local testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Add more sanity checks in SASL exchanges

commit   : 44bd0126c70b5b90e8e2d604833a6476abbbffe6    
  
author   : Michael Paquier <[email protected]>    
date     : Sat, 10 Jul 2021 21:45:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sat, 10 Jul 2021 21:45:28 +0900    

Click here for diff

The following checks are added, to make the SASL infrastructure more  
aware of defects when implementing new mechanisms:  
- Detect that no output is generated by a mechanism if an exchange fails  
in the backend, failing if there is a message waiting to be sent.  
- Handle zero-length messages in the frontend.  The backend handles that  
already, and SCRAM would complain if sending empty messages as this is  
not authorized for this mechanism, but other mechanisms may want this  
capability (the SASL specification allows that).  
- Make sure that a mechanism generates a message in the middle of the  
exchange in the frontend.  
  
SCRAM, as implemented, respects all these requirements already, and the  
recent refactoring of SASL done in 9fd8557 helps in documenting that in  
a cleaner way.  
  
Analyzed-by: Jacob Champion  
Author: Michael Paquier  
Reviewed-by: Jacob Champion  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/auth-sasl.c
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth.c

Fix numeric_mul() overflow due to too many digits after decimal point.

commit   : e7fc488ad67caaad33f6d5177081884495cb81cb    
  
author   : Dean Rasheed <[email protected]>    
date     : Sat, 10 Jul 2021 12:42:59 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Sat, 10 Jul 2021 12:42:59 +0100    

Click here for diff

This fixes an overflow error when using the numeric * operator if the  
result has more than 16383 digits after the decimal point by rounding  
the result. Overflow errors should only occur if the result has too  
many digits *before* the decimal point.  
  
Discussion: https://postgr.es/m/CAEZATCUmeFWCrq2dNzZpRj5+6LfN85jYiDoqm+ucSXhb9U2TbA@mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

Un-break AIX build, take 2.

commit   : 53c38a086a8001d63401671755638bc95c7fa1c7    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 16:59:07 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 16:59:07 -0400    

Click here for diff

I incorrectly diagnosed the reason why hoverfly is unhappy.  
Looking closer, it appears that it fails to link libldap  
unless libssl is also present; so the problem was my  
idea of clearing LIBS before making the check.  Revert  
to essentially the original coding, except that instead  
of failing when libldap_r isn't there, use libldap.  
  
Per buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

libpq: Fix sending queries in pipeline aborted state

commit   : ab09679429009bfed4bd894a6187afde0b7bdfcd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jul 2021 15:57:59 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 9 Jul 2021 15:57:59 -0400    

Click here for diff

When sending queries in pipeline mode, we were careless about leaving  
the connection in the right state so that PQgetResult would behave  
correctly; trying to read further results after sending a query after  
having read a result with an error would sometimes hang.  Fix by  
ensuring internal libpq state is changed properly.  All the state  
changes were being done by the callers of pqAppendCmdQueueEntry(); it  
would have become too repetitious to have this logic in each of them, so  
instead put it all in that function and relieve callers of the  
responsibility.  
  
Add a test to verify this case.  Without the code fix, this new test  
hangs sometimes.  
  
Also, document that PQisBusy() would return false when no queries are  
pending result.  This is not intuitively obvious, and NULL would be  
obtained by calling PQgetResult() at that point, which is confusing.  
Wording by Boris Kolpackov.  
  
In passing, fix bogus use of "false" to mean "0", per Ranier Vilela.  
  
Backpatch to 14.  
  
Author: Álvaro Herrera <[email protected]>  
Reported-by: Boris Kolpackov <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

commit   : 8e7811e952b4e0993330f7ac1fb1448a1ca69b9a    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 08:48:19 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 9 Jul 2021 08:48:19 -0700    

Click here for diff

The requirement that IDENTIFY_SYSTEM be run before START_REPLICATION  
was both undocumented and unnecessary. Remove the error and ensure  
that ThisTimeLineID is initialized in START_REPLICATION.  
  
Elect not to backport because this requirement was expected behavior  
(even if inconsistently enforced), and is not likely to cause any  
major problem.  
  
Author: Jeff Davis  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/de4bbf05b7cd94227841c433ea6ff71d2130c713.camel%40j-davis.com  

M src/backend/replication/walsender.c

Un-break AIX build.

commit   : 31e8cfac5845fa57e1805f4ff81e00ab78dff025    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 14:15:41 -0400    

Click here for diff

In commit d0a02bdb8, I'd supposed that uniformly probing for  
ldap_bind would make the intent clearer.  However, that seems  
not to work on AIX, for obscure reasons (maybe it's a macro  
there?).  Revert to the former behavior of probing  
ldap_simple_bind for thread-safe cases and ldap_bind otherwise.  
  
Per buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac

Avoid creating a RESULT RTE that's marked LATERAL.

commit   : d23ac62afa646b7073a7f0db0a137308459a263b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 13:38:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 13:38:24 -0400    

Click here for diff

Commit 7266d0997 added code to pull up simple constant function  
results, converting the RTE_FUNCTION RTE to a dummy RTE_RESULT  
RTE since it no longer need be scanned.  But I forgot to clear  
the LATERAL flag if the RTE has it set.  If the function reduced  
to a constant, it surely contains no lateral references so this  
simplification is logically OK.  It's needed because various other  
places will Assert that RESULT RTEs aren't LATERAL.  
  
Per bug #17097 from Yaoguang Chen.  Back-patch to v13 where the  
faulty code came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Update configure's probe for libldap to work with OpenLDAP 2.5.

commit   : d0a02bdb8c2576b5aa607f127320e444080bd579    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 12:38:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 12:38:55 -0400    

Click here for diff

The separate libldap_r is gone and libldap itself is now always  
thread-safe.  Unfortunately there seems no easy way to tell by  
inspection whether libldap is thread-safe, so we have to take  
it on faith that libldap is thread-safe if there's no libldap_r.  
That should be okay, as it appears that libldap_r was a standard  
part of the installation going back at least 20 years.  
  
Report and patch by Adrian Ho.  Back-patch to all supported  
branches, since people might try to build any of them with  
a newer OpenLDAP.  
  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Reject cases where a query in WITH rewrites to just NOTIFY.

commit   : a9da1934e971b38ab360ce80a352fbfc4d2d986b    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 11:02:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Jul 2021 11:02:26 -0400    

Click here for diff

Since the executor can't cope with a utility statement appearing  
as a node of a plan tree, we can't support cases where a rewrite  
rule inserts a NOTIFY into an INSERT/UPDATE/DELETE command appearing  
in a WITH clause of a larger query.  (One can imagine ways around  
that, but it'd be a new feature not a bug fix, and so far there's  
been no demand for it.)  RewriteQuery checked for this, but it  
missed the case where the DML command rewrites to *only* a NOTIFY.  
That'd lead to crashes later on in planning.  Add the missed check,  
and improve the level of testing of this area.  
  
Per bug #17094 from Yaoguang Chen.  It's been busted since WITH  
was introduced, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Teach pg_size_pretty and pg_size_bytes about petabytes

commit   : ca2e4472ba7b6e5e8cd8955eacffb90e4d88d085    
  
author   : David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 18:56:00 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 18:56:00 +1200    

Click here for diff

There was talk about adding units all the way up to yottabytes but it  
seems quite far-fetched that anyone would need those.  Since such large  
units are not exactly commonplace, it seems unlikely that having  
pg_size_pretty outputting unit any larger than petabytes would actually be  
helpful to anyone.  
  
Since petabytes are on the horizon, let's just add those only.  Maybe one  
day we'll get to add additional units, but it will likely be a while  
before we'll need to think beyond petabytes in regards to the size of a  
database.  
  
Author: David Christensen  
Discussion: https://postgr.es/m/CAOxo6XKmHc_WZip-x5QwaOqFEiCq_SVD0B7sbTZQk+qqcn2qaw@mail.gmail.com  

M src/backend/utils/adt/dbsize.c
M src/test/regress/expected/dbsize.out
M src/test/regress/sql/dbsize.sql

Add forgotten LSN_FORMAT_ARGS() in xlogreader.c

commit   : 0f80b47d24b470babd61f2d9927d1956075f771d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Jul 2021 15:27:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Jul 2021 15:27:36 +0900    

Click here for diff

These should have been part of 4035cd5, that introduced LZ4 support for  
wal_compression.  

M src/backend/access/transam/xlogreader.c

Remove more obsolete comments about semaphores.

commit   : 2f783380641db4cc598acd108186a446e4919290    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 9 Jul 2021 17:51:48 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 9 Jul 2021 17:51:48 +1200    

Click here for diff

Commit 6753333f stopped using semaphores as the sleep/wake mechanism for  
heavyweight locks, but some obsolete references to that scheme remained  
in comments.  As with similar commit 25b93a29, back-patch all the way.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLafjB1uzXcy%3D%3D2L3cy7rjHkqOVn7qRYGBjk%3D%3DtMJE7Yg%40mail.gmail.com  

M src/backend/storage/lmgr/lwlock.c

Use a lookup table for units in pg_size_pretty and pg_size_bytes

commit   : 56ff8b29919f75a078969766393b9e20871a75c8    
  
author   : David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 16:29:02 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 16:29:02 +1200    

Click here for diff

We've grown 2 versions of pg_size_pretty over the years, one for BIGINT  
and one for NUMERIC.  Both should output the same, but keeping them in  
sync is harder than needed due to neither function sharing a source of  
truth about which units to use and how to transition to the next largest  
unit.  
  
Here we add a static array which defines the units that we recognize and  
have both pg_size_pretty and pg_size_pretty_numeric use it.  This will  
make adding any units in the future a very simple task.  
  
The table contains all information required to allow us to also modify  
pg_size_bytes to use the lookup table, so adjust that too.  
  
There are no behavioral changes here.  
  
Author: David Rowley  
Reviewed-by: Dean Rasheed, Tom Lane, David Christensen  
Discussion: https://postgr.es/m/CAApHDvru1F7qsEVL-iOHeezJ+5WVxXnyD_Jo9nht+Eh85ekK-Q@mail.gmail.com  

M src/backend/utils/adt/dbsize.c

Fix incorrect return value in pg_size_pretty(bigint)

commit   : 55fe609387685de1c754332e260b2d0e17d257dc    
  
author   : David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 14:04:30 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 9 Jul 2021 14:04:30 +1200    

Click here for diff

Due to how pg_size_pretty(bigint) was implemented, it's possible that when  
given a negative number of bytes that the returning value would not match  
the equivalent positive return value when given the equivalent positive  
number of bytes.  This was due to two separate issues.  
  
1. The function used bit shifting to convert the number of bytes into  
larger units.  The rounding performed by bit shifting is not the same as  
dividing.  For example -3 >> 1 = -2, but -3 / 2 = -1.  These two  
operations are only equivalent with positive numbers.  
  
2. The half_rounded() macro rounded towards positive infinity.  This meant  
that negative numbers rounded towards zero and positive numbers rounded  
away from zero.  
  
Here we fix #1 by dividing the values instead of bit shifting.  We fix #2  
by adjusting the half_rounded macro always to round away from zero.  
  
Additionally, adjust the pg_size_pretty(numeric) function to be more  
explicit that it's using division rather than bit shifting.  A casual  
observer might have believed bit shifting was used due to a static  
function being named numeric_shift_right.  However, that function was  
calculating the divisor from the number of bits and performed division.  
Here we make that more clear.  This change is just cosmetic and does not  
affect the return value of the numeric version of the function.  
  
Here we also add a set of regression tests both versions of  
pg_size_pretty() which test the values directly before and after the  
function switches to the next unit.  
  
This bug was introduced in 8a1fab36a. Prior to that negative values were  
always displayed in bytes.  
  
Author: Dean Rasheed, David Rowley  
Discussion: https://postgr.es/m/CAEZATCXnNW4HsmZnxhfezR5FuiGgp+mkY4AzcL5eRGO4fuadWg@mail.gmail.com  
Backpatch-through: 9.6, where the bug was introduced.  

M src/backend/utils/adt/dbsize.c
M src/test/regress/expected/dbsize.out
M src/test/regress/sql/dbsize.sql

Fix typos in pgstat.c, reorderbuffer.c and pathnodes.h

commit   : 387925893edf2a3a30a8ddf2c6474d8a7eb056a5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Jul 2021 12:45:09 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Jul 2021 12:45:09 +0200    

Click here for diff

Reviewed-by: Thomas Munro <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/reorderbuffer.c
M src/include/nodes/pathnodes.h

Improve error messages about mismatching relkind

commit   : 2ed532ee8c474e9767e76e1f3251cc3a0224358c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jul 2021 09:38:52 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Jul 2021 09:38:52 +0200    

Click here for diff

Most error messages about a relkind that was not supported or  
appropriate for the command was of the pattern  
  
    "relation \"%s\" is not a table, foreign table, or materialized view"  
  
This style can become verbose and tedious to maintain.  Moreover, it's  
not very helpful: If I'm trying to create a comment on a TOAST table,  
which is not supported, then the information that I could have created  
a comment on a materialized view is pointless.  
  
Instead, write the primary error message shorter and saying more  
directly that what was attempted is not possible.  Then, in the detail  
message, explain that the operation is not supported for the relkind  
the object was.  To simplify that, add a new function  
errdetail_relkind_not_supported() that does this.  
  
In passing, make use of RELKIND_HAS_STORAGE() where appropriate,  
instead of listing out the relkinds individually.  
  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/verify_heapam.c
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/rawpage.c
M contrib/pg_surgery/expected/heap_surgery.out
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/pg_visibility.c
M contrib/pgstattuple/expected/pgstattuple.out
M contrib/pgstattuple/pgstatapprox.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/catalog/Makefile
A src/backend/catalog/pg_class.c
M src/backend/catalog/toasting.c
M src/backend/commands/comment.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/parser/parse_utilcmd.c
M src/backend/rewrite/rewriteDefine.c
M src/include/catalog/pg_class.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/sequence.out
M src/test/regress/expected/stats_ext.out

Fix crash in postgres_fdw for provably-empty remote UPDATE/DELETE.

commit   : b9734c13f168ef0d487aa122e486ca9b6dd6aa59    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 7 Jul 2021 15:21:25 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 7 Jul 2021 15:21:25 -0400    

Click here for diff

In 86dc90056, I'd written find_modifytable_subplan with the assumption  
that if the immediate child of a ModifyTable is a Result, it must be  
a projecting Result with a subplan.  However, if the UPDATE or DELETE  
has a provably-constant-false WHERE clause, that's not so: we'll  
generate a dummy subplan with a childless Result.  Add the missing  
null-check so we don't crash on such cases.  
  
Per report from Alexander Pyhalov.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

doc: Fix description about pg_stat_statements.track_planning.

commit   : 9d2a7757347cb1adb48599fce4dcde0f1fc9e9ae    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 21:54:47 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 21:54:47 +0900    

Click here for diff

This commit fixes wrong wording like "a fewer kinds"  
in the description about track_planning option.  
  
Back-patch to v13 where pg_stat_statements.track_planning was added.  
  
Author: Justin Pryzby  
Reviewed-by: Julien Rouhaud, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pgstatstatements.sgml

Use a hash table to speed up NOT IN(values)

commit   : 29f45e299e7ffa1df0db44b8452228625479487f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 7 Jul 2021 16:29:17 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 7 Jul 2021 16:29:17 +1200    

Click here for diff

Similar to 50e17ad28, which allowed hash tables to be used for IN clauses  
with a set of constants, here we add the same feature for NOT IN clauses.  
  
NOT IN evaluates the same as: WHERE a <> v1 AND a <> v2 AND a <> v3.  
Obviously, if we're using a hash table we must be exactly equivalent to  
that and return the same result taking into account that either side of  
the condition could contain a NULL.  This requires a little bit of  
special handling to make work with the hash table version.  
  
When processing NOT IN, the ScalarArrayOpExpr's operator will be the <>  
operator.  To be able to build and lookup a hash table we must use the  
<>'s negator operator.  The planner checks if that exists and is hashable  
and sets the relevant fields in ScalarArrayOpExpr to instruct the executor  
to use hashing.  
  
Author: David Rowley, James Coleman  
Reviewed-by: James Coleman, Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvoF1mum_FRk6D621edcB6KSHBi2+GAgWmioj5AhOu2vwQ@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_oper.c
M src/backend/partitioning/partbounds.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/nodes/primnodes.h
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

postgres_fdw: Tighten up allowed values for batch_size, fetch_size options.

commit   : d854720df6df68cfe1432342e33c9e3020572a51    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 11:13:40 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 7 Jul 2021 11:13:40 +0900    

Click here for diff

Previously the values such as '100$%$#$#', '9,223,372,' were accepted and  
treated as valid integers for postgres_fdw options batch_size and fetch_size.  
Whereas this is not the case with fdw_startup_cost and fdw_tuple_cost options  
for which an error is thrown. This was because endptr was not used  
while converting strings to integers using strtol.  
  
This commit changes the logic so that it uses parse_int function  
instead of strtol as it serves the purpose by returning false in case  
if it is unable to convert the string to integer. Note that  
this function also rounds off the values such as '100.456' to 100 and  
'100.567' or '100.678' to 101.  
  
While on this, use parse_real for fdw_startup_cost and fdw_tuple_cost options.  
  
Since parse_int and parse_real are being used for reloptions and GUCs,  
it is more appropriate to use in postgres_fdw rather than using strtol  
and strtod directly.  
  
Back-patch to v14.  
  
Author: Bharath Rupireddy  
Reviewed-by: Ashutosh Bapat, Tom Lane, Kyotaro Horiguchi, Fujii Masao  
Discussion: https://postgr.es/m/CALj2ACVMO6wY5Pc4oe1OCgUOAtdjHuFsBDw8R5uoYR86eWFQDA@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Refactor SASL code with a generic interface for its mechanisms

commit   : 9fd85570d179f10f93344d722005f7086b3c31ca    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Jul 2021 10:55:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Jul 2021 10:55:15 +0900    

Click here for diff

The code of SCRAM and SASL have been tightly linked together since SCRAM  
exists in the core code, making hard to apprehend the addition of new  
SASL mechanisms, but these are by design different facilities, with  
SCRAM being an option for SASL.  This refactors the code related to both  
so as the backend and the frontend use a set of callbacks for SASL  
mechanisms, documenting while on it what is expected by anybody adding a  
new SASL mechanism.  
  
The separation between both layers is neat, using two sets of callbacks  
for the frontend and the backend to mark the frontier between both  
facilities.  The shape of the callbacks is now directly inspired from  
the routines used by SCRAM, so the code change is straight-forward, and  
the SASL code is moved into its own set of files.  These will likely  
change depending on how and if new SASL mechanisms get added in the  
future.  
  
Author: Jacob Champion  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/libpq/Makefile
A src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/include/libpq/auth.h
A src/include/libpq/sasl.h
M src/include/libpq/scram.h
A src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/tools/pgindent/typedefs.list

Allow CustomScan providers to say whether they support projections.

commit   : 955b3e0f9269639fb916cee3dea37aee50b82df0    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 18:10:11 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 18:10:11 -0400    

Click here for diff

Previously, all CustomScan providers had to support projections,  
but there may be cases where this is inconvenient.  Add a flag  
bit to say if it's supported.  
  
Important item for the release notes: this is non-backwards-compatible  
since the default is now to assume that CustomScan providers can't  
project, instead of assuming that they can.  It's fail-soft, but could  
result in visible performance penalties due to adding unnecessary  
Result nodes.  
  
Sven Klemm, reviewed by Aleksander Alekseev; some cosmetic fiddling  
by me.  
  
Discussion: https://postgr.es/m/CAMCrgp1kyakOz6c8aKhNDJXjhQ1dEjEnp+6KNT3KxPrjNtsrDg@mail.gmail.com  

M doc/src/sgml/custom-scan.sgml
M src/backend/executor/execAmi.c
M src/backend/optimizer/plan/createplan.c
M src/include/nodes/extensible.h

Improve TestLib::system_or_bail error reporting

commit   : 5798ca529935698ab976780565fb2b4d8d34d810    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Jul 2021 17:48:41 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Jul 2021 17:48:41 -0400    

Click here for diff

The original coding was not quoting the complete failing command, and it  
wasn't printing the reason for the failure either.  Do both.  
  
This is cosmetic only, so no backpatch.  
  
Author: Álvaro Herrera <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/TestLib.pm

Reduce the cost of planning deeply-nested views.

commit   : 64919aaab45076445051245c9bcd48dd84abebe7    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 14:23:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 14:23:09 -0400    

Click here for diff

Joel Jacobson reported that deep nesting of trivial (flattenable)  
views results in O(N^3) growth of planning time for N-deep nesting.  
It turns out that a large chunk of this cost comes from copying around  
the "subquery" sub-tree of each view's RTE_SUBQUERY RTE.  But once we  
have successfully flattened the subquery, we don't need that anymore,  
because the planner isn't going to do anything else interesting with  
that RTE.  We already zap the subquery pointer during setrefs.c (cf.  
add_rte_to_flat_rtable), but it's useless baggage earlier than that  
too.  Clearing the pointer as soon as pull_up_simple_subquery is done  
with the RTE reduces the cost from O(N^3) to O(N^2); which is still  
not great, but it's quite a lot better.  Further improvements will  
require rethinking of the RTE data structure, which is being considered  
in another thread.  
  
Patch by me; thanks to Dean Rasheed for review.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c

Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.

commit   : c7b7311f6177b90fe5033b8ed2c10dfcbb863eb6    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 12:36:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 12:36:12 -0400    

Click here for diff

As in 50371df26, this is a bad idea since the callback can't really  
know what error is being thrown and thus whether or not it is safe  
to attempt catalog accesses.  Rather than pushing said accesses into  
the mainline code where they'd usually be a waste of cycles, we can  
look at the query's rangetable instead.  
  
This change does mean that we'll be printing query aliases (if any  
were used) rather than the table or column's true name.  But that  
doesn't seem like a bad thing: it's certainly a more useful definition  
in self-join cases, for instance.  In any case, it seems unlikely that  
any applications would be depending on this detail, so it seems safe  
to change.  
  
Patch by me.  Original complaint by Andres Freund; Bharath Rupireddy  
noted the connection to conversion_error_callback.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql

Doc: add info about timestamps with fractional-minute UTC offsets.

commit   : ab2e19987ff66f83dfb99b5c541d9e05e8b0ede3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 10:34:51 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 6 Jul 2021 10:34:51 -0400    

Click here for diff

Our code has supported fractional-minute UTC offsets for ages, but  
there was no mention of the possibility in the main docs, and only  
a very indirect reference in Appendix B.  Improve that.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Refactor function parse_subscription_options.

commit   : 8aafb02616753f5c6c90bbc567636b73c0cbb9d4    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 6 Jul 2021 07:46:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 6 Jul 2021 07:46:50 +0530    

Click here for diff

Instead of using multiple parameters in parse_subscription_options  
function signature, use the struct SubOpts that encapsulate all the  
subscription options and their values. It will be useful for future work  
where we need to add other options in the subscription. Also, use bitmaps  
to pass the supported and retrieve the specified options much like the way  
it is done in the commit a3dc926009.  
  
Author: Bharath Rupireddy  
Reviewed-By: Peter Smith, Amit Kapila, Alvaro Herrera  
Discussion: https://postgr.es/m/CALj2ACXtoQczfNsDQWobypVvHbX2DtgEHn8DawS0eGFwuo72kw@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c
M src/tools/pgindent/typedefs.list

Fix typo in comment

commit   : 9ee91cc583802c6507fbc31c348a79e63a10f956    
  
author   : David Rowley <[email protected]>    
date     : Tue, 6 Jul 2021 12:38:50 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 6 Jul 2021 12:38:50 +1200    

Click here for diff

Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe8f8ENA0i1PdBtUNWDd2sxHSMgscNYbjhaXMuAdfBrZcg@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c

Reduce the number of pallocs when building partition bounds

commit   : 53d86957e980efa06f15232b8cff430d4cc6dd64    
  
author   : David Rowley <[email protected]>    
date     : Tue, 6 Jul 2021 12:24:43 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 6 Jul 2021 12:24:43 +1200    

Click here for diff

In each of the create_*_bound() functions for LIST, RANGE and HASH  
partitioning, there were a large number of palloc calls which could be  
reduced down to a much smaller number.  
  
In each of these functions, an array was built so that we could qsort it  
before making the PartitionBoundInfo. For LIST and HASH partitioning, an  
array of pointers was allocated then each element was allocated within  
that array.  Since the number of items of each dimension is known  
beforehand, we can just allocate a single chunk of memory for this.  
  
Similarly, with all partition strategies, we're able to reduce the number  
of allocations to build the ->datums field.  This is an array of Datum  
pointers, but there's no need for the Datums that each element points to  
to be singly allocated.  One big chunk will do.  For RANGE partitioning,  
the PartitionBoundInfo->kind field can get the same treatment.  
  
We can apply the same optimizations to partition_bounds_copy().  Doing  
this might have a small effect on cache performance when searching for the  
correct partition during partition pruning or DML on a partitioned table.  
However, that's likely to be small and this is mostly about reducing  
palloc overhead.  
  
Author: Nitin Jadhav, Justin Pryzby, David Rowley  
Reviewed-by: Justin Pryzby, Zhihong Yu  
Discussion: https://postgr.es/m/flat/CAMm1aWYFTqEio3bURzZh47jveiHRwgQTiSDvBORczNEz2duZ1Q@mail.gmail.com  

M src/backend/partitioning/partbounds.c

Use WaitLatch() instead of pg_usleep() at the end of backups

commit   : 2aca19f2989aa938ece7306678f5494a984ece3f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Jul 2021 08:10:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Jul 2021 08:10:59 +0900    

Click here for diff

This concerns pg_stop_backup() and BASE_BACKUP, when waiting for the  
WAL segments required for a backup to be archived.  This simplifies a  
bit the handling of the wait event used in this code path.  
  
Author: Bharath Rupireddy  
Reviewed-by: Michael Paquier, Stephen Frost  
Discussion: https://postgr.es/m/CALj2ACU4AdPCq6NLfcA-ZGwX7pPCK5FgEj-CAU0xCKzkASSy_A@mail.gmail.com  

M src/backend/access/transam/xlog.c

Reduce overhead of cache-clobber testing in LookupOpclassInfo().

commit   : 9753324b7d9eba0aaf7e12942f52c240bfc7da7c    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 16:51:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 16:51:57 -0400    

Click here for diff

Commit 03ffc4d6d added logic to bypass all caching behavior in  
LookupOpclassInfo when CLOBBER_CACHE_ALWAYS is enabled.  It doesn't  
look like I stopped to think much about what that would cost, but  
recent investigation shows that the cost is enormous: it roughly  
doubles the time needed for cache-clobber test runs.  
  
There does seem to be value in this behavior when trying to test  
the opclass-cache loading logic itself, but for other purposes the  
cost is excessive.  Hence, let's back off to doing this only when  
debug_invalidate_system_caches_always is at least 3; or in older  
branches, when CLOBBER_CACHE_RECURSIVELY is defined.  
  
While here, clean up some other minor issues in LookupOpclassInfo.  
Re-order the code so we aren't left with broken cache entries (leading  
to later core dumps) in the unlikely case that we suffer OOM while  
trying to allocate space for a new entry.  (That seems to be my  
oversight in 03ffc4d6d.)  Also, in >= v13, stop allocating one array  
entry too many.  That's evidently left over from sloppy reversion in  
851b14b0c.  
  
Back-patch to all supported branches, mainly to reduce the runtime  
of cache-clobbering buildfarm animals.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/cache/relcache.c

Rethink blocking annotations in detach-partition-concurrently-[34].

commit   : c04c767059b8460b99f6aa4aae5450ab3ee257a3    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 14:34:47 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 5 Jul 2021 14:34:47 -0400    

Click here for diff

In 741d7f104, I tried to make the reports from canceled steps come out  
after the pg_cancel_backend() steps, since that was the most common  
ordering before.  However, that doesn't ensure that a canceled step  
doesn't report even later, as shown in a recent failure on buildfarm  
member idiacanthus.  Rather than complicating things even more with  
additional annotations, let's just force the cancel's effect to be  
reported first.  It's not *that* unnatural-looking.  
  
Back-patch to v14 where these test cases appeared.  
  
Report: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=idiacanthus&dt=2021-07-02%2001%3A40%3A04  

M src/test/isolation/expected/detach-partition-concurrently-3.out
M src/test/isolation/expected/detach-partition-concurrently-4.out
M src/test/isolation/specs/detach-partition-concurrently-3.spec
M src/test/isolation/specs/detach-partition-concurrently-4.spec

Prevent numeric overflows in parallel numeric aggregates.

commit   : f025f2390e13d7da69da595086fb982bbaf7f329    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 5 Jul 2021 10:16:42 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 5 Jul 2021 10:16:42 +0100    

Click here for diff

Formerly various numeric aggregate functions supported parallel  
aggregation by having each worker convert partial aggregate values to  
Numeric and use numeric_send() as part of serializing their state.  
That's problematic, since the range of Numeric is smaller than that of  
NumericVar, so it's possible for it to overflow (on either side of the  
decimal point) in cases that would succeed in non-parallel mode.  
  
Fix by serializing NumericVars instead, to avoid the overflow risk and  
ensure that parallel and non-parallel modes work the same.  
  
A side benefit is that this improves the efficiency of the  
serialization/deserialization code, which can make a noticeable  
difference to performance with large numbers of parallel workers.  
  
No back-patch due to risk from changing the binary format of the  
aggregate serialization states, as well as lack of prior field  
complaints and low probability of such overflows in practice.  
  
Patch by me. Thanks to David Rowley for review and performance  
testing, and Ranier Vilela for an additional suggestion.  
  
Discussion: https://postgr.es/m/CAEZATCUmeFWCrq2dNzZpRj5+6LfN85jYiDoqm+ucSXhb9U2TbA@mail.gmail.com  

M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql

doc: Fix quoting markup

commit   : 903d9aa7801e3198ca24e90be805362ad11b6ec3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jul 2021 08:26:00 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Jul 2021 08:26:00 +0200    

Click here for diff

M doc/src/sgml/appendix-obsolete-default-roles.sgml

Doc: Hash Indexes.

commit   : e360aa0530b6d1f9e43f2aca760203de0421ef5e    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Jul 2021 09:36:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Jul 2021 09:36:11 +0530    

Click here for diff

A new chapter for Hash Indexes, designed to help users understand how  
they work and when to use them.  
  
Backpatch-through 10 where we have made hash indexes durable.  
  
Author: Simon Riggs  
Reviewed-By: Justin Pryzby, Amit Kapila  
Discussion: https://postgr.es/m/CANbhV-HRjNPYgHo--P1ewBrFJ-GpZPb9_25P7=Wgu7s7hy_sLQ@mail.gmail.com  

M doc/src/sgml/filelist.sgml
A doc/src/sgml/hash.sgml
M doc/src/sgml/postgres.sgml

doc: Mention requirement to --enable-tap-tests on section for TAP tests

commit   : 0f06359fb3622b289485306727300dd31f96fd9d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 4 Jul 2021 20:59:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 4 Jul 2021 20:59:04 +0900    

Click here for diff

Author: Greg Sabino Mullane  
Discussion: https://postgr.es/m/CAKAnmmJYH2FBn_+Vwd2FD5SaKn8hjhAXOCHpZc6n4wXaUaW_SA@mail.gmail.com  
Backpatch-through: 9.6  

M doc/src/sgml/regress.sgml

Doc: mention that VACUUM can't utilize over 1GB of RAM

commit   : ec34040af104a1d25233eccd5715863ace6cbb10    
  
author   : David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 22:28:38 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 22:28:38 +1200    

Click here for diff

Document that setting maintenance_work_mem to values over 1GB has no  
effect on VACUUM.  
  
Reported-by: Martín Marqués  
Author: Laurenz Albe  
Discussion: https://postgr.es/m/CABeG9LsZ2ozUMcqtqWu_-GiFKB17ih3p8wBHXcpfnHqhCnsc7A%40mail.gmail.com  
Backpatch-through: 9.6, oldest supported release  

M doc/src/sgml/config.sgml

Cleanup some aggregate code in the executor

commit   : 63b1af94375cc2be06a5d6a932db24cd8e9f45e9    
  
author   : David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 18:47:31 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sun, 4 Jul 2021 18:47:31 +1200    

Click here for diff

Here we alter the code that calls build_pertrans_for_aggref() so that the  
function no longer needs to special-case whether it's dealing with an  
aggtransfn or an aggcombinefn.  This allows us to reuse the  
build_aggregate_transfn_expr() function and just get rid of the  
build_aggregate_combinefn_expr() completely.  
  
All of the special case code that was in build_pertrans_for_aggref() has  
been moved up to the calling functions.  
  
This saves about a dozen lines of code in nodeAgg.c and a few dozen more  
in parse_agg.c  
  
Also, rename a few variables in nodeAgg.c to try to make it more clear  
that we're working with either a aggtransfn or an aggcombinefn.  Some of  
the old names would have you believe that we were always working with an  
aggtransfn.  
  
Discussion: https://postgr.es/m/CAApHDvptMQ9FmF0D67zC_w88yVnoNVR2+kkOQGUrCmdxWxLULQ@mail.gmail.com  

M src/backend/executor/nodeAgg.c
M src/backend/parser/parse_agg.c
M src/include/parser/parse_agg.h

Further restrict the scope of no-exit()-in-libpq test.

commit   : 792259591c0fc19c42247fc7668b1064d1e850d4    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 3 Jul 2021 11:21:40 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 3 Jul 2021 11:21:40 -0400    

Click here for diff

Disable this check altogether in --enable-coverage builds,  
because newer versions of gcc insert exit() as well as abort()  
calls for that.  Also disable it on AIX and Solaris, because  
those platforms tend to provide facilities such as libldap  
as static libraries, which then get included in libpq's shlib.  
We can't expect such libraries to honor our coding rules.  
(That platform list might need additional tweaking, but I think  
this is enough to keep the buildfarm happy.)  
  
Per reports from Jacob Champion and Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

doc: adjust "cities" example to be consistent with other SQL

commit   : d390bb62a6332f8a913c2c2021d56d6dba5a1dce    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 20:42:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 20:42:46 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 9.6  

M doc/src/sgml/advanced.sgml

docs: clarify new aggressive vacuum mode for multi-xacts

commit   : c552e171d16e461c7af60cfe1a891c87be9cbbbf    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 18:00:30 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 2 Jul 2021 18:00:30 -0400    

Click here for diff

Reported-by: [email protected]  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch-through: 14  

M doc/src/sgml/maintenance.sgml

Don't try to print data type names in slot_store_error_callback().

commit   : 50371df266d4c8f4faaf448cbd789d9697443952    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Jul 2021 16:04:54 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Jul 2021 16:04:54 -0400    

Click here for diff

The existing code tried to do syscache lookups in an already-failed  
transaction, which is problematic to say the least.  After some  
consideration of alternatives, the best fix seems to be to just drop  
type names from the error message altogether.  The table and column  
names seem like sufficient localization.  If the user is unsure what  
types are involved, she can check the local and remote table  
definitions.  
  
Having done that, we can also discard the LogicalRepTypMap hash  
table, which had no other use.  Arguably, LOGICAL_REP_MSG_TYPE  
replication messages are now obsolete as well; but we should  
probably keep them in case some other use emerges.  (The complexity  
of removing something from the replication protocol would likely  
outweigh any savings anyhow.)  
  
Masahiko Sawada and Bharath Rupireddy, per complaint from Andres  
Freund.  Back-patch to v10 where this code originated.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/relation.c
M src/backend/replication/logical/worker.c
M src/include/replication/logicalrelation.h

Use InvalidBucket instead of -1 where appropriate

commit   : 6bd3ec62d9d7921fad2125bbeb5f2eafbbb261e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jul 2021 11:59:55 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 2 Jul 2021 11:59:55 +0200    

Click here for diff

Reported-by: Ranier Vilela <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAEudQAp%3DZwKjrP4L%2BCzqV7SmWiaQidPPRqj4tqdjDG4KBx5yrg%40mail.gmail.com  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c

Use WaitLatch() instead of pg_usleep() at end-of-vacuum truncation

commit   : 70685385d70f8da73ab189a72f46311091ff09be    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Jul 2021 12:58:34 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Jul 2021 12:58:34 +0900    

Click here for diff

This has the advantage to make a process more responsive when the  
postmaster dies, even if the wait time was rather limited as there was  
only a 50ms timeout here.  Another advantage of this change is for  
monitoring, as we gain a new wait event for the end-of-vacuum  
truncation.  
  
Author: Bharath Rupireddy  
Reviewed-by: Aleksander Alekseev, Thomas Munro, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACU4AdPCq6NLfcA-ZGwX7pPCK5FgEj-CAU0xCKzkASSy_A@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h

Remove some dead stores.

commit   : a2595e039c4745d82f361ea15d692cac114575cc    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 2 Jul 2021 13:07:16 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 2 Jul 2021 13:07:16 +1200    

Click here for diff

Remove redundant local variable assignments left behind by commit  
2fc7af5e966.  
  
Author: Quan Zongliang <[email protected]>  
Reviewed-by: Jacob Champion <[email protected]>  
Discussion: https://postgr.es/m/de141d14-4fd6-3148-99bf-856b71aa948a%40yeah.net  

M src/backend/storage/ipc/procarray.c

Simplify error handing of jsonapi.c for the frontend

commit   : b44669b2ca6a510b2c81cbe74c704d59226d729c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 2 Jul 2021 09:35:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 2 Jul 2021 09:35:12 +0900    

Click here for diff

This commit removes a dependency to the central logging facilities in  
the JSON parsing routines of src/common/, which existed to log errors  
when seeing error codes that do not match any existing values in  
JsonParseErrorType, which is not something that should never happen.  
  
The routine providing a detailed error message based on the error code  
is made backend-only, the existing code being unsafe to use in the  
frontend as the error message may finish by being palloc'd or point to a  
static string, so there is no way to know if the memory of the message  
should be pfree'd or not.  The only user of this routine in the frontend  
was pg_verifybackup, that is changed to use a more generic error message  
on parsing failure.  
  
Note that making this code more resilient to OOM failures if used in  
shared libraries would require much more work as a lot of code paths  
still rely on palloc() & friends, but we are not sure yet if we need to  
go down to that.  Still, removing the dependency to logging is a step  
toward more portability.  
  
This cleans up the handling of check_stack_depth() while on it, as it  
exists only in the backend.  
  
Per discussion with Jacob Champion and Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_verifybackup/parse_manifest.c
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/common/jsonapi.c

doc: Remove inappropriate <acronym> tags

commit   : 1708f6b38aaf1b9375b5ca82792425410c98d441    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 22:23:37 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 22:23:37 +0200    

Click here for diff

M doc/src/sgml/brin.sgml
M doc/src/sgml/datatype.sgml

add missing tag from commit b8c4261e5e

commit   : 7355c241ed002496d70882eccea6027726e2fb5a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 15:38:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 15:38:06 -0400    

Click here for diff

M GNUmakefile.in
M doc/src/sgml/installation.sgml

doc: Clean up title case use

commit   : c0fdc963704983ebd5908dc5acfb4d52303091a4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 21:27:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 21:27:39 +0200    

Click here for diff

M doc/src/sgml/appendix-obsolete-default-roles.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/logicaldecoding.sgml

Add new make targets world-bin and install-world-bin

commit   : b8c4261e5e8dc5c20d033970ec584991638ca041    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 14:21:09 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 14:21:09 -0400    

Click here for diff

These are the same as world and install-world respectively, but without  
building or installing the documentation. There are many reasons for  
wanting to be able to do this, including speed, lack of documentation  
building tools, and wanting to build other formats of the documentation.  
Plans for simplifying the buildfarm client code include using these  
targets.  
  
Backpatch to all live branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M GNUmakefile.in
M doc/src/sgml/installation.sgml

Add --clobber-cache option to initdb, for CCA testing.

commit   : b741f4c3ee67666aa333dbb25bd71906b3474def    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 13:33:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 13:33:05 -0400    

Click here for diff

Commit 4656e3d66 replaced the "#define CLOBBER_CACHE_ALWAYS"  
testing mechanism with a GUC, which has been a great help for  
doing cache-clobber testing in more efficient ways; but there  
is a gap in the implementation.  The only way to do cache-clobber  
testing during an initdb run is to use the old method with #define,  
because one can't set the GUC from outside.  Improve this by  
adding a switch to initdb for the purpose.  
  
(Perhaps someday we should let initdb pass through arbitrary  
"-c NAME=VALUE" switches.  Quoting difficulties dissuaded me  
from attempting that right now, though.)  
  
Back-patch to v14 where 4656e3d66 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/initdb.sgml
M src/bin/initdb/initdb.c

Don't reset relhasindex for partitioned tables on ANALYZE

commit   : d700518d744e53994fdded14b23ebc15b031b0dd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jul 2021 12:56:30 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 1 Jul 2021 12:56:30 -0400    

Click here for diff

Commit 0e69f705cc1a introduced code to analyze partitioned table;  
however, that code fails to preserve pg_class.relhasindex correctly.  
Fix by observing whether any indexes exist rather than accidentally  
falling through to assuming none do.  
  
Backpatch to 14.  
  
Author: Alexander Pyhalov <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: Zhihong Yu <[email protected]>  
Discussion: https://postgr.es/m/CALNJ-vS1R3Qoe5t4tbzxrkpBtzRbPq1dDcW4RmA_a+oqweF30w@mail.gmail.com  

M src/backend/commands/analyze.c
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

Improve build-time check that libpq doesn't call exit().

commit   : 2f7bae2f924d8213a76370f825dc15eb0aa79796    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 10:45:12 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Jul 2021 10:45:12 -0400    

Click here for diff

Further fixes for commit dc227eb82.  Per suggestion from  
Peter Eisentraut, use a stamp-file to control when the check  
is run, avoiding repeated executions during "make all".  
Also, remove "-g" switch for nm: it's useless and some versions  
of nm consider it to conflict with "-u".  (Thanks to Noah Misch  
for running down that portability issue.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/.gitignore
M src/interfaces/libpq/Makefile

Fix prove_installcheck to use correct paths when used with PGXS

commit   : a0fc813266467d666b8f09ccccaccb700326a296    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 08:29:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Jul 2021 08:29:10 -0400    

Click here for diff

The prove_installcheck recipe in src/Makefile.global.in was emitting  
bogus paths for a couple of elements when used with PGXS. Here we create  
a separate recipe for the PGXS case that does it correctly. We also take  
the opportunity to make the make the file more readable by breaking up  
the prove_installcheck and prove_check recipes across several lines, and  
to remove the setting for REGRESS_SHLIB to src/test/recovery/Makefile,  
which is the only set of tests that actually need it.  
  
Backpatch to all live branches  
  
Discussion: https://postgr.es/m/[email protected]  

M src/Makefile.global.in
M src/test/recovery/Makefile

Allow specifying pg_waldump --rmgr option multiple times.

commit   : c8bf5098cbc4f32ca724d830d45d5ceb2ad7f96d    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 1 Jul 2021 15:32:57 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 1 Jul 2021 15:32:57 +0300    

Click here for diff

Before, if you specified multiple --rmgr options, only the last one took  
effect. It seems more sensible to select all the specified resource  
managers.  
  
Reviewed-By: Daniel Gustafsson, Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/98344bc2-e222-02ad-a75b-81ffc614c155%40iki.fi  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/pg_waldump.c

Add tests for UNBOUNDED syntax ambiguity

commit   : 71ba45a3602da0bdbb518e16e3990cfcf21e5f73    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 09:17:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 1 Jul 2021 09:17:44 +0200    

Click here for diff

There is a syntactic ambiguity in the SQL standard.  Since UNBOUNDED  
is a non-reserved word, it could be the name of a function parameter  
and be used as an expression.  There is a grammar hack to resolve such  
cases as the keyword.  Add some tests to record this behavior.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/b2a09a77-3c8f-7c68-c9b7-824054f87d98%40enterprisedb.com  

M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Improve various places that double the size of a buffer

commit   : 3788c66788e9f8c6904c6fe903724c1f44812c4d    
  
author   : David Rowley <[email protected]>    
date     : Thu, 1 Jul 2021 15:29:06 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 1 Jul 2021 15:29:06 +1200    

Click here for diff

Several places were performing a tight loop to determine the first power  
of 2 number that's > or >= the required memory.  Instead of using a loop  
for that, we can use pg_nextpower2_32 or pg_nextpower2_64.  When we need a  
power of 2 number equal to or greater than a given amount, we just pass  
the amount to the nextpower2 function.  When we need a power of 2 greater  
than the amount, we just pass the amount + 1.  
  
Additionally, in tsearch there were a couple of locations that were  
performing a while loop when a simple "if" would have done.  In both of  
these locations only 1 item is being added, so the loop could only have  
ever iterated once.  Changing the loop into an if statement makes the code  
very slightly more optimal as the condition is checked once rather than  
twice.  
  
There are quite a few remaining locations that increase the size of the  
buffer in the following form:  
  
  while (reqsize >= buflen)  
  {  
     buflen *= 2;  
     buf = repalloc(buf, buflen);  
  }  
  
These are not touched in this commit.  repalloc will error out for sizes  
larger than MaxAllocSize.  Changing these to use pg_nextpower2_32 would  
remove the chance of that error being raised.  It's unclear from the code  
if the sizes could ever become that large, so err on the side of caution.  
  
Discussion: https://postgr.es/m/CAApHDvp=tns7RL4PH0ZR0M+M-YFLquK7218x=0B_zO+DbOma+w@mail.gmail.com  
Reviewed-by: Zhihong Yu  

M src/backend/parser/scan.l
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/typcache.c

Fix portability fallout from commit dc227eb82.

commit   : e45b0dfa1f1028948decad3abd3b0f6e913a44b0    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 30 Jun 2021 10:52:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 30 Jun 2021 10:52:20 -0400    

Click here for diff

Give up on trying to mechanically forbid abort() within libpq.  
Even though there are no such calls in the source code, we've now  
seen three different scenarios where build toolchains silently  
insert such calls: gcc does it for profiling, some platforms  
implement assert() using it, and icc does so for no visible reason.  
Checking for accidental use of exit() seems considerably more  
important than checking for abort(), so we'll settle for doing  
that for now.  
  
Also, filter out __cxa_atexit() to avoid a false match.  It seems  
that OpenBSD inserts a call to that despite the fact that libpq  
contains no C++ code.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

doc: Improve descriptions of tup_returned and tup_fetched in pg_stat_database

commit   : 3465c8a8692fb628bc2710fbeedb9aeb534b0400    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 30 Jun 2021 20:57:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 30 Jun 2021 20:57:07 +0900    

Click here for diff

Previously the descriptions of tup_returned and tup_fetched columns  
in pg_stat_database view were confusing. This commit improves them  
so that they represent the following formulas of those columns  
more accurately.  
  
* pg_stat_database.tup_returned  
    = sum(pg_stat_all_tables.seq_tup_read)  
    + sum(pg_stat_all_indexes.idx_tup_read)  
  
* pg_stat_database.tup_fetched  
    = sum(pg_stat_all_tables.idx_tup_fetch)  
  
In these formulas, note that the counters for some system catalogs  
like pg_database shared across all databases of a cluster are excluded  
from the calculations of sum.  
  
Author: Masahiro Ikeda  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

doc: Add type information for postgres_fdw parameters.

commit   : 61d599ede7424d88bbd4006b968bae366b6b9f5d    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 30 Jun 2021 19:33:18 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 30 Jun 2021 19:33:18 +0900    

Click here for diff

Author: Shinya Kato  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/TYAPR01MB2896DEB25C3B0D57F6139768C40F9@TYAPR01MB2896.jpnprd01.prod.outlook.com  

M doc/src/sgml/postgres-fdw.sgml

genbki stricter error handling

commit   : 735dc1a09469002fd659a4b1f5d582377b318977    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 30 Jun 2021 08:29:03 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 30 Jun 2021 08:29:03 +0200    

Click here for diff

Instead of just writing warnings for invalid cross-catalog lookups,  
count the errors and error out at the end.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ca8ee41d-241b-1bf3-71f0-aaf1add6d3c5%40enterprisedb.com  

M src/backend/catalog/genbki.pl

Replace magic constants used in pg_stat_get_replication_slot().

commit   : ab5e48f153cfea2c571dc177ae96faf4ab072b8e    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 11:29:53 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 11:29:53 +0530    

Click here for diff

A few variables have been using 10 as a magic constant while  
PG_STAT_GET_REPLICATION_SLOT_COLS can be used instead.  
  
Author: Masahiko Sawada  
Reviewed-By: Amit Kapila  
Backpatch-through: 14, where it was introduced  
Discussion: https://postgr.es/m/CAD21AoBvqODDfmD17DkEuPCvV2KbruukXQ2Vwrv5Xi-TsAsTJA@mail.gmail.com  

M src/backend/utils/adt/pgstatfuncs.c

Allow streaming the changes after speculative aborts.

commit   : 52d26d560e272613c501e35b24fbf8d710de4b8a    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 09:37:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 09:37:59 +0530    

Click here for diff

Until now, we didn't allow to stream the changes in logical replication  
till we receive speculative confirm or the next DML change record after  
speculative inserts. The reason was that we never use to process  
speculative aborts but after commit 4daa140a2f it is possible to process  
them so we can allow streaming once we receive speculative abort after  
speculative insertion.  
  
We decided to backpatch to 14 where the feature for streaming in progress  
transactions have been introduced as this is a minor change and makes that  
functionality better.  
  
Author: Amit Kapila  
Reviewed-By: Dilip Kumar  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CAA4eK1KdqmTCtrBR6oFfGELrLLbDLDedL6zACcsUOQuTJBj1vw@mail.gmail.com  

M src/backend/replication/logical/reorderbuffer.c

Allow enabling two-phase option via replication protocol.

commit   : cda03cfed6b8bd5f64567bccbc9578fba035691e    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 08:45:47 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 30 Jun 2021 08:45:47 +0530    

Click here for diff

Extend the replication command CREATE_REPLICATION_SLOT to support the  
TWO_PHASE option. This will allow decoding commands like PREPARE  
TRANSACTION, COMMIT PREPARED and ROLLBACK PREPARED for slots created with  
this option. The decoding of the transaction happens at prepare command.  
  
This patch also adds support of two-phase in pg_recvlogical via a new  
option --two-phase.  
  
This option will also be used by future patches that allow streaming of  
transactions at prepare time for built-in logical replication. With this,  
the out-of-core logical replication solutions can enable replication of  
two-phase transactions via replication protocol.  
  
Author: Ajin Cherian  
Reviewed-By: Jeff Davis, Vignesh C, Amit Kapila  
Discussion:  
https://postgr.es/m/[email protected]  
https://postgr.es/m/[email protected]  

M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Fix incorrect PITR message for transaction ROLLBACK PREPARED

commit   : 17707c059cf4bf610e3b1833df5ca17cf223fe5f    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 11:48:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 11:48:53 +0900    

Click here for diff

Reaching PITR on such a transaction would cause the generation of a LOG  
message mentioning a transaction committed, not aborted.  
  
Oversight in 4f1b890.  
  
Author: Simon Riggs  
Discussion: https://postgr.es/m/CANbhV-GJ6KijeCgdOrxqMCQ+C8QiK657EMhCy4csjrPcEUFv_Q@mail.gmail.com  
Backpatch-through: 9.6  

M src/backend/access/transam/xlog.c

Optimize pg_checksums --enable where checksum is already set

commit   : 4c9f50d116461617848601e97dbc6f122b0a6f14    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 09:58:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 30 Jun 2021 09:58:59 +0900    

Click here for diff

This commit prevents pg_checksums to do a rewrite of a block if it has  
no need to, in the case where the computed checksum matches with what's  
already stored in the block read.  This is helpful to accelerate  
successive runs of the tool when the previous ones got interrupted, for  
example.  
  
The number of blocks and files written is tracked and reported by the  
tool once finished.  Note that the final flush of the data folder  
happens even if no blocks are written, as it could be possible that a  
previous interrupted run got stopped while doing a flush.  
  
Author: Greg Sabino Mullane  
Reviewed-by: Paquier Michael, Julien Rouhaud  
Discussion: https://postgr.es/m/CAKAnmmL+k6goxmVzQJB+0bAR0PN1sgo6GDUXJhyhUmVMze1QAw@mail.gmail.com  

M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c

Fixes for multirange selectivity estimation

commit   : 178ec460db0a0ced46ac5a01a28a704ca6251e53    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 29 Jun 2021 23:18:09 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 29 Jun 2021 23:18:09 +0300    

Click here for diff

 * Fix enumeration of the multirange operators in calc_multirangesel() and  
   calc_multirangesel() switches.  
 * Add more regression tests for matching to empty ranges/multiranges.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/c5269c65-f967-77c5-ff7c-15e621c47f6a%40gmail.com  
Author: Alexander Korotkov  
Backpatch-through: 14, where multiranges were introduced  

M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

Fix libpq state machine in pipeline mode

commit   : b71a9cb31e46b08aeac35a4355936165648b3c49    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 15:01:29 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 15:01:29 -0400    

Click here for diff

The original coding required that PQpipelineSync had been called before  
the first call to PQgetResult, and failure to do that would result in an  
unexpected NULL result being returned.  Fix by setting the right state  
when a query is sent, rather than leaving it unchanged and having  
PQpipelineSync apply the necessary state change.  
  
A new test case to verify the behavior is added, which relies on the new  
PQsendFlushRequest() function added by commit a7192326c74d.  
  
Backpatch to 14, where pipeline mode was added.  
  
Reported-by: Boris Kolpackov <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-exec.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
A src/test/modules/libpq_pipeline/traces/nosync.trace

Add PQsendFlushRequest to libpq

commit   : a7192326c74da417d024a189da4d33c1bf1b40b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 14:37:39 -0400    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 29 Jun 2021 14:37:39 -0400    

Click here for diff

This new libpq function allows the application to send an 'H' message,  
which instructs the server to flush its outgoing buffer.  
  
This hasn't been needed so far because the Sync message already requests  
a buffer; and I failed to realize that this was needed in pipeline mode  
because PQpipelineSync also causes the buffer to be flushed.  However,  
sometimes it is useful to request a flush without establishing a  
synchronization point.  
  
Backpatch to 14, where pipeline mode was introduced in libpq.  
  
Reported-by: Boris Kolpackov <[email protected]>  
Author: Álvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-fe.h

Fix bogus logic for reporting which hash partition conflicts.

commit   : dd2364ced98553e0217bfe8f621cd4b0970db74a    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 14:34:31 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 14:34:31 -0400    

Click here for diff

Commit efbfb6424 added logic for reporting exactly which existing  
partition conflicts when complaining that a new hash partition's  
modulus isn't compatible with the existing ones.  However, it  
misunderstood the partitioning data structure, and would select  
the wrong partition in some cases, or crash outright due to fetching  
a bogus table OID in other cases.  
  
Per bug #17076 from Alexander Lakhin.  Fix by Amit Langote;  
some further work on the code comments by me.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

Add a build-time check that libpq doesn't call exit() or abort().

commit   : dc227eb82ea8bf6919cd81a182a084589ddce7f3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 11:46:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 11:46:17 -0400    

Click here for diff

Directly exiting or aborting seems like poor form for a general-purpose  
library.  Now that libpq liberally uses bits out of src/common/,  
it's very easy to accidentally include code that would do something  
unwanted like calling exit(1) after OOM --- see for example 8ec00dc5c.  
Hence, add a simple cross-check that no such calls have made it into  
libpq.so.  
  
The cross-check depends on nm(1) being available and being able to  
work on a shared library, which probably isn't true everywhere.  
But we can just make the test silently do nothing if nm fails.  
As long as the check is effective on common platforms, that should  
be good enough.  (By the same logic, I've not worried about providing  
an equivalent test in MSVC builds.)  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/Makefile

Remove libpq's use of abort(3) to handle mutex failure cases.

commit   : aaddf6ba09e25878e792f0d15f725370e19396df    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 11:31:08 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 29 Jun 2021 11:31:08 -0400    

Click here for diff

Doing an abort() seems all right in development builds, but not in  
production builds of general-purpose libraries.  However, the functions  
that were doing this lack any way to report a failure back up to their  
callers.  It seems like we can just get away with ignoring failures in  
production builds, since (a) no such failures have been reported in the  
dozen years that the code's been like this, and (b) failure to enforce  
mutual exclusion during fe-auth.c operations would likely not cause any  
problems anyway in most cases.  (The OpenSSL callbacks that use this  
macro are obsolete, so even less likely to cause interesting problems.)  
  
Possibly a better answer would be to break compatibility of the  
pgthreadlock_t callback API, but in the absence of field problem  
reports, it doesn't really seem worth the trouble.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h

Remove literal backslash from Perl \Q ... \E.

commit   : 48cb244fb9aca1620e35a14617ca5869b3ea065a    
  
author   : Noah Misch <[email protected]>    
date     : Tue, 29 Jun 2021 00:44:57 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Tue, 29 Jun 2021 00:44:57 -0700    

Click here for diff

The behavior changed sometime after Perl 5.8.9, and "man perlre" says it  
"may lead to confusing results."  Per buildfarm member gaur.  This  
repairs commit a7a7be1f2fa6b9f0f48e69f12256d8f588af729b.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/t/002_pg_dump.pl

Add index OID macro argument to DECLARE_INDEX

commit   : 6a6389a08b228aa6bd21ced7a9c5151bf6f7f0a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jun 2021 07:57:16 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 29 Jun 2021 07:57:16 +0200    

Click here for diff

Instead of defining symbols such as AmOidIndexId explicitly, include  
them as an argument of DECLARE_INDEX() and have genbki.pl generate the  
way as the table OID symbols from the CATALOG() declaration.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/ccef1e46-a404-25b1-9b4c-85f2c08e1f28%40enterprisedb.com  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/utils/cache/syscache.c
M src/include/catalog/genbki.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h

commit   : 445e36ad4e14480a3c97d0f973a3532912424e85    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 13:57:45 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 13:57:45 +0900    

Click here for diff

Oversight in 4035cd5, spotted by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/xlog_internal.h

Fix compilation warning in xloginsert.c

commit   : 47f514dd9a0022a04d321b627b2e991cb85396e2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 11:54:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 11:54:11 +0900    

Click here for diff

This is reproducible with gcc using at least -O0.  The last checks  
validating the compression of a block could not be reached with this  
variable not set, but let's be clean.  
  
Oversight in 4035cd5, per buildfarm member lapwing.  

M src/backend/access/transam/xloginsert.c

Add support for LZ4 with compression of full-page writes in WAL

commit   : 4035cd5d4eee4dae797bfc77ab07f8dcd8781b41    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 11:17:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 29 Jun 2021 11:17:55 +0900    

Click here for diff

The logic is implemented so as there can be a choice in the compression  
used when building a WAL record, and an extra per-record bit is used to  
track down if a block is compressed with PGLZ, LZ4 or nothing.  
  
wal_compression, the existing parameter, is changed to an enum with  
support for the following backward-compatible values:  
- "off", the default, to not use compression.  
- "pglz" or "on", to compress FPWs with PGLZ.  
- "lz4", the new mode, to compress FPWs with LZ4.  
  
Benchmarking has showed that LZ4 outclasses easily PGLZ.  ZSTD would be  
also an interesting choice, but going just with LZ4 for now makes the  
patch minimalistic as toast compression is already able to use LZ4, so  
there is no need to worry about any build-related needs for this  
implementation.  
  
Author: Andrey Borodin, Justin Pryzby  
Reviewed-by: Dilip Kumar, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/standalone-profile.xsl
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlogrecord.h
M src/tools/pgindent/typedefs.list

Skip WAL recycling and preallocation during archive recovery.

commit   : cc2c7d65fc27e877c9f407587b0b92d46cd6dd16    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    

Click here for diff

The previous commit addressed the chief consequences of a race condition  
between InstallXLogFileSegment() and KeepFileRestoredFromArchive().  Fix  
three lesser consequences.  A spurious durable_rename_excl() LOG message  
remained possible.  KeepFileRestoredFromArchive() wasted the proceeds of  
WAL recycling and preallocation.  Finally, XLogFileInitInternal() could  
return a descriptor for a file that KeepFileRestoredFromArchive() had  
already unlinked.  That felt like a recipe for future bugs.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Don't ERROR on PreallocXlogFiles() race condition.

commit   : 2b3e4672f7602a6bb46a0735a1b41b635508b290    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    

Click here for diff

Before a restartpoint finishes PreallocXlogFiles(), a startup process  
KeepFileRestoredFromArchive() call can unlink the preallocated segment.  
If a CHECKPOINT sql command had elicited the restartpoint experiencing  
the race condition, that sql command failed.  Moreover, the restartpoint  
omitted its log_checkpoints message and some inessential resource  
reclamation.  Prevent the ERROR by skipping open() of the segment.  
Since these consequences are so minor, no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog.h

commit   : 421484f79c0b80209fa766eb00dbc2453a753273    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:56 -0700    

Click here for diff

Only initdb used it.  initdb refuses to operate on a non-empty directory  
and generally does not cope with pre-existing files of other kinds.  
Hence, use the opportunity to simplify.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog.h

In XLogFileInit(), fix *use_existent postcondition to suit callers.

commit   : 85656bc3050f0846f53de95768b0f9f9df410560    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    

Click here for diff

Infrequently, the mismatch caused log_checkpoints messages and  
TRACE_POSTGRESQL_CHECKPOINT_DONE() to witness an "added" count too high  
by one.  Since that consequence is so minor, no back-patch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c

Remove XLogFileInit() ability to skip ControlFileLock.

commit   : c53c6b98d38a4d238b2fe2ddcea63c33b0a61376    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    

Click here for diff

Cold paths, initdb and end-of-recovery, used it.  Don't optimize them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xlog.c
M src/backend/replication/walreceiver.c
M src/include/access/xlog.h

Dump COMMENT ON SCHEMA public.

commit   : 7ac10f692054e2690aa6f80efdd98bd283c94b10    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    

Click here for diff

As we do for other attributes of the public schema, omit the COMMENT  
command when its payload would match what initdb had installed.  For  
dumps that do carry this new COMMENT command, non-superusers restoring  
them are likely to get an error.  
  
Reviewed by Asif Rehman.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/pg_namespace.dat

Dump public schema ownership and security labels.

commit   : a7a7be1f2fa6b9f0f48e69f12256d8f588af729b    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 28 Jun 2021 18:34:55 -0700    

Click here for diff

As a side effect, this corrects dumps of public schema ACLs in databases  
where the DBA dropped and recreated that schema.  
  
Reviewed by Asif Rehman.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/modules/test_pg_dump/t/001_base.pl

Doc: further updates for RELEASE_CHANGES process notes.

commit   : 14b2ffaf7ffdd199937e8bcba8b459da5491bcb6    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 18:05:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 18:05:46 -0400    

Click here for diff

Mention expectations for email notifications of appropriate lists  
when a branch is made or retired.  
  
(I've been doing that informally for years, but it's better to have  
it written down.)  

M src/tools/RELEASE_CHANGES

Improve pgindent release workflow.

commit   : bc49ab3c277b6b478bdad80c1ae36f926a33b4a6    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 28 Jun 2021 13:08:46 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 28 Jun 2021 13:08:46 -0700    

Click here for diff

Update RELEASE_CHANGES to direct the reader towards completing the steps  
outlined in the pgindent README, both as a pre-beta task and as a task  
to be performed when starting a new development cycle.  
  
This makes it less likely that somebody will miss updating the  
.git-blame-ignore-revs file when running pgindent against the tree as a  
routine release change task.  
  
Author: Peter Geoghegan <[email protected]>  
Reviewed-By: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAH2-Wz=2PjF4As8dWECArsXxLKganYmQ-s0UeGqHHbHhqDKqeA@mail.gmail.com  

M src/tools/RELEASE_CHANGES
M src/tools/pgindent/README

Don't use abort(3) in libpq's fe-print.c.

commit   : 6f5d9bce57a7bb29ba61f0bf4fd465a26de9fc28    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 14:17:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 14:17:41 -0400    

Click here for diff

Causing a core dump on out-of-memory seems pretty unfriendly,  
and surely is far outside the expected behavior of a general-purpose  
library.  Just print an error message (as we did already) and return.  
These functions unfortunately don't have an error return convention,  
but code using them is probably just looking for a quick-n-dirty  
print method and wouldn't bother to check anyway.  
  
Although these functions are semi-deprecated, it still seems  
appropriate to back-patch this.  In passing, also back-patch  
b90e6cef1, just to reduce cosmetic differences between the  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/fe-print.c

Don't depend on -fwrapv semantics in pgbench's random() function.

commit   : 01697e92a460b10fde43707b29391c8deb69573e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 12:40:37 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 28 Jun 2021 12:40:37 -0400    

Click here for diff

Instead use the common/int.h functions to check for integer overflow  
in a more C-standard-compliant fashion.  This is motivated by recent  
failures on buildfarm member moonjelly, where it appears that  
development-tip gcc is optimizing without regard to the -fwrapv  
switch.  Presumably that's a gcc bug that will be fixed soon, but  
we might as well install cleaner coding here rather than wait.  
  
(This does not address the question of whether we'll ever be able  
to get rid of using -fwrapv.  Testing shows that this spot is the  
only place where doing so creates visible regression test failures,  
but unfortunately that proves very little.)  
  
Back-patch to v12.  The common/int.h functions exist in v11, but  
that branch doesn't use them in any client-side code.  I judge  
that this case isn't interesting enough in the real world to take  
even a small risk of issues from being the first such use.  
  
Tom Lane and Fabien Coelho  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c

Add pgindent commit to git-blame-ignore-revs file.

commit   : ba135fa537ab5c2fca0d589c826ebb3ecf98b2f1    
  
author   : Peter Geoghegan <[email protected]>    
date     : Mon, 28 Jun 2021 09:22:24 -0700    
  
committer: Peter Geoghegan <[email protected]>    
date     : Mon, 28 Jun 2021 09:22:24 -0700    

Click here for diff

Add entry for recent commit e1c1c30f.  

M .git-blame-ignore-revs

Stamp HEAD as 15devel.

commit   : 596b5af1d3675b58d4018acd64217e2f627da3e4    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 28 Jun 2021 11:31:16 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 28 Jun 2021 11:31:16 -0400    

Click here for diff

Let the hacking begin ...  

M configure
M configure.ac
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-14.sgml
A doc/src/sgml/release-15.sgml
M doc/src/sgml/release.sgml
M src/tools/git_changelog
M src/tools/version_stamp.pl