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