PostgreSQL 17.0 (upcoming) commit log

Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax

commit   : 655dc310460c601d434d05339b7fa46ed97675b3    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2024 18:03:48 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 1 Mar 2024 18:03:48 +0900    

Click here for diff

This commit switches pg_enc2gettext_tbl[] in encnames.c to use a  
C99-designated initializer syntax.  
  
pg_bind_textdomain_codeset() is simplified so as it is possible to do  
a direct lookup at the gettext() array with a value of the enum pg_enc  
rather than doing a loop through all its elements, as long as the  
encoding value provided by GetDatabaseEncoding() is in the correct range  
of supported encoding values.  Note that PG_MULE_INTERNAL gains a value  
in the array, pointing to NULL.  
  
Author: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/utils/mb/mbutils.c
M src/common/encnames.c
M src/include/mb/pg_wchar.h
M src/tools/pgindent/typedefs.list

Fix BF failure introduced by commit b3f6b14cf4.

commit   : def0ce3370689b939c6d7a3c3eb824d69989ef6e    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2024 10:25:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 1 Mar 2024 10:25:36 +0530    

Click here for diff

The test added by commit b3f6b14cf4 uses a non-superuser and forgot to set  
up pg_hba.conf to allow connections from it. The special setup is only  
needed on Windows machines that don't use UNIX sockets.  
  
As per buildfarm  
  
Discussion: https://postgr.es/m/CAJpy0uCfrSspV1x3VWkgamqyhYaUWQZpP0nqjJx4YPvKqN6P_A@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Convert unloggedLSN to an atomic variable.

commit   : 963d3072af21afbcb1183b3c960135cc7df02f3f    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 14:34:10 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 14:34:10 -0600    

Click here for diff

Currently, this variable is an XLogRecPtr protected by a spinlock.  
By converting it to an atomic variable, we can remove the spinlock,  
which saves a small amount of shared memory space.  Since this code  
is not performance-critical, we use atomic operations with full  
barrier semantics to make it easy to reason about correctness.  
  
Author: John Morris  
Reviewed-by: Michael Paquier, Robert Haas, Andres Freund, Stephen Frost, Bharath Rupireddy  
Discussion: https://postgr.es/m/BYAPR13MB26772534335255E50318C574A0409%40BYAPR13MB2677.namprd13.prod.outlook.com  
Discussion: https://postgr.es/m/MN2PR13MB2688FD8B757316CB5C54C8A2A0DDA%40MN2PR13MB2688.namprd13.prod.outlook.com  

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

Convert archiver's force_dir_scan variable to an atomic variable.

commit   : 3179701505b9ec58243ffba9d22b1803f320bf60    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:17:55 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:17:55 -0600    

Click here for diff

Commit bd5132db55 introduced new atomic read/write functions with  
full barrier semantics, which are intended to simplify converting  
non-performance-critical code to use atomic variables.  This commit  
demonstrates one such conversion.  
  
Reviewed-by: Yong Li  
Discussion: https://postgr.es/m/20231110205128.GB1315705%40nathanxps13  

M src/backend/postmaster/pgarch.c

Introduce atomic read/write functions with full barrier semantics.

commit   : bd5132db558b6c8d11eb838be81e2177a95c7388    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:00:44 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 29 Feb 2024 10:00:44 -0600    

Click here for diff

Writing correct code using atomic variables is often difficult due  
to the memory barrier semantics (or lack thereof) of the underlying  
operations.  This commit introduces atomic read/write functions  
with full barrier semantics to ease this cognitive load.  For  
example, some spinlocks protect a single value, and these new  
functions make it easy to convert the value to an atomic variable  
(thus eliminating the need for the spinlock) without modifying the  
barrier semantics previously provided by the spinlock.  Since these  
functions may be less performant than the other atomic reads and  
writes, they are not suitable for every use-case.  However, using a  
single atomic operation with full barrier semantics may be more  
performant in cases where a separate explicit barrier would  
otherwise be required.  
  
The base implementations for these new functions are atomic  
exchanges (for writes) and atomic fetch/adds with 0 (for reads).  
These implementations can be overwritten with better architecture-  
specific versions as they are discovered.  
  
This commit leaves converting existing code to use these new  
functions as a future exercise.  
  
Reviewed-by: Andres Freund, Yong Li, Jeff Davis  
Discussion: https://postgr.es/m/20231110205128.GB1315705%40nathanxps13  

M src/include/port/atomics.h
M src/include/port/atomics/generic.h

Support MERGE into updatable views.

commit   : 5f2e179bd31e5f5803005101eb12a8d7bf8db8f3    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 15:56:59 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 15:56:59 +0000    

Click here for diff

This allows the target relation of MERGE to be an auto-updatable or  
trigger-updatable view, and includes support for WITH CHECK OPTION,  
security barrier views, and security invoker views.  
  
A trigger-updatable view must have INSTEAD OF triggers for every type  
of action (INSERT, UPDATE, and DELETE) mentioned in the MERGE command.  
An auto-updatable view must not have any INSTEAD OF triggers. Mixing  
auto-update and trigger-update actions (i.e., having a partial set of  
INSTEAD OF triggers) is not supported.  
  
Rule-updatable views are also not supported, since there is no  
rewriter support for non-SELECT rules with MERGE operations.  
  
Dean Rasheed, reviewed by Jian He and Alvaro Herrera.  
  
Discussion: https://postgr.es/m/CAEZATCVcB1g0nmxuEc-A+gGB0HnfcGQNGYH7gS=7rq0u0zOBXA@mail.gmail.com  

M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/rules.sgml
M src/backend/commands/copyfrom.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/parser/parse_merge.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/executor/executor.h
M src/include/nodes/parsenodes.h
M src/include/rewrite/rewriteHandler.h
M src/test/regress/expected/merge.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/merge.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/updatable_views.sql

Add missing RangeTblEntry field to jumble

commit   : 8b29a119fdaa381d6f75105f539b1e658c0f8cdb    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 29 Feb 2024 14:05:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 29 Feb 2024 14:05:56 +0100    

Click here for diff

RangeTblEntry.funcordinality should be jumbled, because the WITH  
ORDINALITY clause changes the query result.  
  
This was apparently an oversight in the past.  
  
Discussion: https://www.postgresql.org/message-id/flat/d7f421f8-fd6d-4759-adc3-247090a5d44b%40eisentraut.org  

M src/backend/nodes/queryjumblefuncs.c

Remove field UpdateContext->updated in nodeModifyTable.c

commit   : 362de947cd7e8c826d9b3c5dc2590348263ed3c1    
  
author   : Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 11:49:30 +0000    
  
committer: Dean Rasheed <[email protected]>    
date     : Thu, 29 Feb 2024 11:49:30 +0000    

Click here for diff

This field has been redundant ever since it was added by commit  
25e777cf8e, which split up ExecUpdate() and ExecDelete() into reusable  
pieces. The only place that reads it is ExecMergeMatched(), if the  
result from ExecUpdateAct() is TM_Ok. However, all paths through  
ExecUpdateAct() that return TM_Ok also set this field to true, so the  
return status by itself is sufficient to tell if the update happened.  
  
Removing this field is a modest simplification, and it brings the  
UPDATE path in ExecMergeMatched() more into line with ExecUpdate(),  
ensuring that ExecUpdateEpilogue() is always called if ExecUpdateAct()  
returns TM_Ok, reducing the chance of bugs.  
  
Dean Rasheed, reviewed by Alvaro Herrera.  
  
Discussion: https://postgr.es/m/CAEZATCWGGmigGBzLHkJm5Ccv2mMxXmwi3%2Buq0yhwDHm-tsvSLg%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Fix integer underflow in shared memory debugging

commit   : 6fd144e3a9664ea545d10008c48dceb6c4e9d38a    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Feb 2024 12:19:52 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 29 Feb 2024 12:19:52 +0100    

Click here for diff

dsa_dump would print a large negative number instead of zero for  
segment bin 0.  Fix by explicitly checking for underflow and add  
special case for bin 0. Backpatch to all supported versions.  
  
Author: Ian Ilyasov <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://postgr.es/m/GV1P251MB1004E0D09D117D3CECF9256ECD502@GV1P251MB1004.EURP251.PROD.OUTLOOK.COM  
Backpatch-through: v12  

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

Fixups for commit 93db6cbda0.

commit   : b3f6b14cf48ffa81084072f1fdeee2fe9df20746    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 29 Feb 2024 09:45:20 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 29 Feb 2024 09:45:20 +0530    

Click here for diff

Ensure to set always-secure search path for both local and remote  
connections during slot synchronization, so that malicious users can't  
redirect user code (e.g. operators).  
  
In the passing, improve the name of define, remove spurious return  
statement, and a minor change in one of the comments.  
  
Author: Bertrand Drouvot and Shveta Malik  
Reviewed-by: Amit Kapila, Peter Smith  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAJpy0uBNP=nrkNJkJSfF=jSocEh8vU2Owa8Rtpi=63fG=SvfVQ@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/slotsync.c
M src/test/recovery/t/040_standby_failover_slots_sync.pl

commit   : ada87a4d95fc39dfb1214edf6653390314b6f0df    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 29 Feb 2024 09:54:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 29 Feb 2024 09:54:25 +0900    

Click here for diff

This updates the following lookup arrays to use C99-designated  
initializer syntax, indexed based on the enum pg_enc:  
pg_enc2icu_tbl[]  
pg_enc2name_tbl[]  
pg_wchar_table[]  
  
This is more readable, and removes problems with ordering mistakes as  
this removes dependencies between the arrays and their lookup index in  
the enum pg_enc.  So, adding new encodings becomes easier, even if this  
does not happen often.  
  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Japin Li  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/common/encnames.c
M src/common/wchar.c
M src/include/mb/pg_wchar.h

Fix cross-version upgrade tests after f0827b443.

commit   : e8aecc5c2ce1d3b2b1b01bd770c14f5214c2a369    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 17:47:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 17:47:25 -0500    

Click here for diff

Removing the get_columns_length() function from regress.so  
means we have to drop it when testing upgrades from versions  
that had it.  Per buildfarm.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Fix documentation comments for test CA config files

commit   : 6a6b7f5de3ff0dad46aab9e8e17a3747370199a3    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 28 Feb 2024 22:57:00 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 28 Feb 2024 22:57:00 +0100    

Click here for diff

The config files which are used to generate the server and client  
CAs claimed that these were self-signed, when they in reality are  
signed by the root_ca (which however is self-signed).  Reword the  
comments to match.  
  
Author: David Zhang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/test/ssl/conf/client_ca.config
M src/test/ssl/conf/root_ca.config
M src/test/ssl/conf/server_ca.config

Improve plpgsql's error messages for incorrect %TYPE and %ROWTYPE.

commit   : 2a6b47cb50eb9b62b050de2cddd03a9ac267e61f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 16:05:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 16:05:17 -0500    

Click here for diff

If one of these constructs referenced a nonexistent object, we'd fall  
through to feeding the whole construct to the core parser, which would  
reject it with a "syntax error" message.  That's pretty unhelpful and  
misleading.  There's no good reason for plpgsql_parse_wordtype and  
friends not to throw a useful error for incorrect input, so make them  
do that instead of returning NULL.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/sql/plpgsql_misc.sql

Convert README to Markdown.

commit   : 363eb059966d0be0a41c206cee40dfd21eb73251    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 28 Feb 2024 14:53:52 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 28 Feb 2024 14:53:52 -0600    

Click here for diff

This is a first step toward modernizing our README file.  Some  
popular developer platforms support rendering README.md files, so  
a direct conversion to Markdown seems like a good place to start.  
The intent is to keep this file legible as plain text even as it  
accumulates more content.  
  
Suggested-by: Andrew Atkinson  
Reviewed-by: Tom Lane, Daniel Gustafsson, Joe Conway  
Discussion: https://postgr.es/m/CAG6XLEmGE95DdKqjk%2BDd9vC8mfN7BnV2WFgYk_9ovW6ikN0YSg%40mail.gmail.com  

R075 README README.md

Mop-up for AIX-ectomy: remove now-dead test code.

commit   : f0827b443e6014a9d9fdcdd099603576154a3733    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:34:19 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:34:19 -0500    

Click here for diff

Commit 0b16bb877 removed the test query added by commit 79b716cfb,  
but not the C-language support function used by that query.  I don't  
see any plausible reason why we'd need that function again, so throw  
it overboard too.  

M src/test/regress/expected/test_setup.out
M src/test/regress/regress.c
M src/test/regress/sql/test_setup.sql

Fix mis-rounding and overflow hazards in date_bin().

commit   : d163fdbfea82a5a578de5bc6392ae84c590bb454    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:00:30 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 28 Feb 2024 14:00:30 -0500    

Click here for diff

In the case where the target timestamp is before the origin timestamp  
and their difference is already an exact multiple of the stride, the  
code incorrectly subtracted the stride anyway.  
  
Also detect several integer-overflow cases that previously produced  
bogus results.  (The submitted patch tried to avoid overflow, but  
I'm not convinced it's right, and problematic cases are so far out of  
the plausibly-useful range that they don't seem worth sweating over.  
Let's just use overflow-detecting arithmetic and throw errors.)  
  
timestamp_bin() and timestamptz_bin() are basically identical and  
so had identical bugs.  Fix both.  
  
Report and patch by Moaaz Assali, adjusted some by me.  Back-patch  
to v14 where date_bin() was introduced.  
  
Discussion: https://postgr.es/m/CALkF+nvtuas-2kydG-WfofbRSJpyODAJWun==W-yO5j2R4meqA@mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql

Improve performance of subsystems on top of SLRU

commit   : 53c2a97a92665be6bd7d70bd62ae6158fe4db96e    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:31 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:31 +0100    

Click here for diff

More precisely, what we do here is make the SLRU cache sizes  
configurable with new GUCs, so that sites with high concurrency and big  
ranges of transactions in flight (resp. multixacts/subtransactions) can  
benefit from bigger caches.  In order for this to work with good  
performance, two additional changes are made:  
  
1. the cache is divided in "banks" (to borrow terminology from CPU  
   caches), and algorithms such as eviction buffer search only affect  
   one specific bank.  This forestalls the problem that linear searching  
   for a specific buffer across the whole cache takes too long: we only  
   have to search the specific bank, whose size is small.  This work is  
   authored by Andrey Borodin.  
  
2. Change the locking regime for the SLRU banks, so that each bank uses  
   a separate LWLock.  This allows for increased scalability.  This work  
   is authored by Dilip Kumar.  (A part of this was previously committed as  
   d172b717c6f4.)  
  
Special care is taken so that the algorithms that can potentially  
traverse more than one bank release one bank's lock before acquiring the  
next.  This should happen rarely, but particularly clog.c's group commit  
feature needed code adjustment to cope with this.  I (Álvaro) also added  
lots of comments to make sure the design is sound.  
  
The new GUCs match the names introduced by bcdfa5f2e2f2 in the  
pg_stat_slru view.  
  
The default values for these parameters are similar to the previous  
sizes of each SLRU.  commit_ts, clog and subtrans accept value 0, which  
means to adjust by dividing shared_buffers by 512 (so 2MB for every 1GB  
of shared_buffers), with a cap of 8MB.  (A new slru.c function  
SimpleLruAutotuneBuffers() was added to support this.)  The cap was  
previously 1MB for clog, so for sites with more than 512MB of shared  
memory the total memory used increases, which is likely a good tradeoff.  
However, other SLRUs (notably multixact ones) retain smaller sizes and  
don't support a configured value of 0.  These values based on  
shared_buffers may need to be revisited, but that's an easy change.  
  
There was some resistance to adding these new GUCs: it would be better  
to adjust to memory pressure automatically somehow, for example by  
stealing memory from shared_buffers (where the caches can grow and  
shrink naturally).  However, doing that seems to be a much larger  
project and one which has made virtually no progress in several years,  
and because this is such a pain point for so many users, here we take  
the pragmatic approach.  
  
Author: Andrey Borodin <[email protected]>  
Author: Dilip Kumar <[email protected]>  
Reviewed-by: Amul Sul, Gilles Darold, Anastasia Lubennikova,  
	Ivan Lazarev, Robert Haas, Thomas Munro, Tomas Vondra,  
	Yura Sokolov, Васильев Дмитрий (Dmitry Vasiliev).  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/clog.h
M src/include/access/commit_ts.h
M src/include/access/multixact.h
M src/include/access/slru.h
M src/include/access/subtrans.h
M src/include/commands/async.h
M src/include/miscadmin.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h
M src/include/utils/guc_hooks.h
M src/test/modules/test_slru/test_slru.c

Remove configure --with-CC option

commit   : 1c1eec0f2d88b7e823af959103b2100da493caa9    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:09 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 17:05:09 +0400    

Click here for diff

It's been deprecated since commit cb292206c5 from July 2000.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M configure
M configure.ac

Run autoconf, for update of a comment.

commit   : 802d886054ff948022a93bae324eae66276623cc    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 16:44:32 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 16:44:32 +0400    

Click here for diff

I forgot to run autoconf in commit 0b16bb8776, after some last minute  
comment changes.  

M configure

Remove AIX support

commit   : 0b16bb8776bb834eb1ef8204ca95dd7667ab948b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 15:10:51 +0400    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 28 Feb 2024 15:10:51 +0400    

Click here for diff

There isn't a lot of user demand for AIX support, we have a bunch of  
hacks to work around AIX-specific compiler bugs and idiosyncrasies,  
and no one has stepped up to the plate to properly maintain it.  
Remove support for AIX to get rid of that maintenance overhead. It's  
still supported for stable versions.  
  
The acute issue that triggered this decision was that after commit  
8af2565248, the AIX buildfarm members have been hitting this  
assertion:  
  
    TRAP: failed Assert("(uintptr_t) buffer == TYPEALIGN(PG_IO_ALIGN_SIZE, buffer)"), File: "md.c", Line: 472, PID: 2949728  
  
Apperently the "pg_attribute_aligned(a)" attribute doesn't work on AIX  
for values larger than PG_IO_ALIGN_SIZE, for a static const variable.  
That could be worked around, but we decided to just drop the AIX support  
instead.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Reviewed-by: Andres Freund, Noah Misch, Thomas Munro  

M Makefile
M config/c-compiler.m4
M configure
M configure.ac
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/runtime.sgml
M meson.build
M src/Makefile.shlib
M src/backend/Makefile
M src/backend/meson.build
D src/backend/port/aix/mkldexport.sh
M src/backend/utils/error/elog.c
M src/backend/utils/misc/ps_status.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/include/c.h
D src/include/port/aix.h
M src/include/port/atomics.h
M src/include/storage/s_lock.h
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/meson.build
D src/makefiles/Makefile.aix
M src/port/README
M src/port/strerror.c
D src/template/aix
M src/test/regress/Makefile
M src/test/regress/expected/sanity_check.out
M src/test/regress/sql/sanity_check.sql
M src/tools/gen_export.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Rename SLRU elements in view pg_stat_slru

commit   : bcdfa5f2e2f274caeed20b2f986012a9cb6a259c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 09:39:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 28 Feb 2024 09:39:52 +0100    

Click here for diff

The new names are intended to match those in an upcoming patch that adds  
a few GUCs to configure the SLRU buffer sizes.  
  
Backwards compatibility concern: this changes the accepted names for  
function pg_stat_slru_rest().  Since this function recognizes "any other  
string" as a request to reset the entry for "other", this means that  
calling it with the old names would silently reset "other" instead of  
doing nothing or throwing an error.  
  
Reviewed-by: Andrey M. Borodin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/predicate.c
M src/include/utils/pgstat_internal.h
M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Remove last NULL element in config_group_names[]

commit   : 48920476b490544a3ee137da714424cd354bc2b6    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 12:51:35 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 12:51:35 +0900    

Click here for diff

This has not been needed since 9d77708d83ee where there was a loop to  
print all the possible GUC groups, relying on the last element to be  
NULL.  
  
Author: Japin Li  
Reviewed-By: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

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

Refactor AllocSetAlloc(), separating hot and cold paths

commit   : 413c18401dcc170636429127e2494d8beba4b92f    
  
author   : David Rowley <[email protected]>    
date     : Wed, 28 Feb 2024 14:20:43 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 28 Feb 2024 14:20:43 +1300    

Click here for diff

Allocating from a free list or from a block which contains enough space  
already, we deem to be common code paths and want to optimize for those.  
Having to allocate a new block, either a normal block or a dedicated one  
for a large allocation, we deem to be less common, therefore we class  
that as "cold".  Both cold paths require a malloc so are going to be  
slower as a result of that regardless.  
  
The main motivation here is to remove the calls to malloc() in the hot  
path and because of this, the compiler is now free to not bother setting  
up the stack frame in AllocSetAlloc(), thus making the hot path much  
cheaper.  
  
Author: Andres Freund  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

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

Use C99-designated initializer syntax for more arrays

commit   : afd8ef39094b0dff9d1f2bfecb1d9fa056b85e19    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 08:42:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 28 Feb 2024 08:42:36 +0900    

Click here for diff

This is in the same spirit as ef5e2e90859a, updating this time some  
arrays in parser.c, relpath.c, guc_tables.c and pg_dump_sort.c so as the  
order of their elements has no need to match the enum structures they  
are based on anymore.  
  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Japin Li  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/parser/parser.c
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_dump/pg_dump_sort.c
M src/common/relpath.c

Fix comments for the dshash_parameters struct.

commit   : e1724af42c7b0bddad2785f8f7a15c4c123862b2    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 27 Feb 2024 09:44:59 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 27 Feb 2024 09:44:59 -0600    

Click here for diff

A recent commit added a copy_function member to the  
dshash_parameters struct, but it missed updating a couple of  
comments that refer to the function pointer members of this struct.  
One of those comments also refers to a tranche_name member and non-  
arg variants of the function pointer members, all of which were  
either removed during development or removed shortly after dshash  
table support was committed.  
  
Oversights in commits 8c0d7bafad, d7694fc148, and 42a1de3013.  
  
Discussion: https://postgr.es/m/20240227045213.GA2329190%40nathanxps13  

M src/backend/lib/dshash.c
M src/include/lib/dshash.h

Rationalize and improve error messages for some jsonpath items

commit   : 92d2ab7554f92b841ea71bcc72eaa8ab11aae662    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 27 Feb 2024 01:31:40 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 27 Feb 2024 01:31:40 -0500    

Click here for diff

This is a followup to commit 66ea94e8e6.  
  
Error mssages concerning incorrect formats for date-time types are  
unified and parameterized, instead of using a fully separate error  
message for each type.  
  
Similarly, error messages regarding numeric and string arguments to  
certain items are standardized, and instead of saying that the argument  
is out of range simply say that it is invalid. The actual invalid  
arguments to these itesm are now shown in the error message.  
  
Error messages relating to numeric inputs of Nan or Infinity are  
made more informative.  
  
Jeevan Chalke and Kyotaro Horiguchi, with some input from Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/jsonpath_exec.c
M src/test/regress/expected/jsonb_jsonpath.out

Remove unnecessary array object_classes[] in dependency.c

commit   : ef5e2e90859a39efdd3a78e528c544b585295a78    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 15:18:17 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 15:18:17 +0900    

Click here for diff

object_classes[] provided unnecessary indirection between catalog OIDs  
and the enum ObjectClass when calling add_object_address().  This array  
has been originally introduced in 30ec31604d5 and was useful because not  
all relation OIDs were compile-time constants back then, which has not  
been the case for a long time now for all the elements of ObjectClass.  
  
This commit removes object_classes[], switching to the catalog OIDs  
when calling add_object_address().  This shaves some code while saving  
in maintenance because it was necessary to maintain the enum ObjectClass  
and the array in sync when adding new object types.  
  
Reported-by: Jeff Davis  
Author: Jelte Fennema-Nio  
Reviewed-by: Jian He, Michael Paquier  
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com  

M src/backend/catalog/dependency.c
M src/include/catalog/dependency.h

Adjust memory allocation functions to allow sibling calls

commit   : 743112a2e9938b98d716384fa9374c41afe74e41    
  
author   : David Rowley <[email protected]>    
date     : Tue, 27 Feb 2024 16:39:42 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 27 Feb 2024 16:39:42 +1300    

Click here for diff

Many modern compilers are able to optimize function calls to functions  
where the parameters of the called function match a leading subset of  
the calling function's parameters.  If there are no instructions in the  
calling function after the function is called, then the compiler is free  
to avoid any stack frame setup and implement the function call as a  
"jmp" rather than a "call".  This is called sibling call optimization.  
  
Here we adjust the memory allocation functions in mcxt.c to allow this  
optimization.  This requires moving some responsibility into the memory  
context implementations themselves.  It's now the responsibility of the  
MemoryContext to check for malloc failures.  This is good as it both  
allows the sibling call optimization, but also because most small and  
medium allocations won't call malloc and just allocate memory to an  
existing block.  That can't fail, so checking for NULLs in that case  
isn't required.  
  
Also, traditionally it's been the responsibility of palloc and the other  
allocation functions in mcxt.c to check for invalid allocation size  
requests.  Here we also move the responsibility of checking that into the  
MemoryContext.  This isn't to allow the sibling call optimization, but  
more because most of our allocators handle large allocations separately  
and we can just add the size check when doing large allocations.  We no  
longer check this for non-large allocations at all.  
  
To make checking the allocation request sizes and ERROR handling easier,  
add some helper functions to mcxt.c for the allocators to use.  
  
Author: Andres Freund  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils_internal.h

Fix comment thinko in sequence.c

commit   : 17a3f79f812cf196063c4146d64c6479e974a5c5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 08:19:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 27 Feb 2024 08:19:39 +0900    

Click here for diff

One comment mentioned indexes, but the relation opened should be  
sequences.  
  
Reported-by: Matthias van de Meent  
Discussion: https://postgr.es/m/CAEze2WiMGNG9XK3NSUen-5BARhCnP=u=FXnf8pvpL2qDKeOsZg@mail.gmail.com  

M src/backend/access/sequence/sequence.c

Add helper functions for dshash tables with string keys.

commit   : 42a1de3013eac394c3a170ce728f0280a62187bd    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:47:13 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:47:13 -0600    

Click here for diff

Presently, string keys are not well-supported for dshash tables.  
The dshash code always copies key_size bytes into new entries'  
keys, and dshash.h only provides compare and hash functions that  
forward to memcmp() and tag_hash(), both of which do not stop at  
the first NUL.  This means that callers must pad string keys so  
that the data beyond the first NUL does not adversely affect the  
results of copying, comparing, and hashing the keys.  
  
To better support string keys in dshash tables, this commit does  
a couple things:  
  
* A new copy_function field is added to the dshash_parameters  
  struct.  This function pointer specifies how the key should be  
  copied into new table entries.  For example, we only want to copy  
  up to the first NUL byte for string keys.  A dshash_memcpy()  
  helper function is provided and used for all existing in-tree  
  dshash tables without string keys.  
  
* A set of helper functions for string keys are provided.  These  
  helper functions forward to strcmp(), strcpy(), and  
  string_hash(), all of which ignore data beyond the first NUL.  
  
This commit also adjusts the DSM registry's dshash table to use the  
new helper functions for string keys.  
  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/20240119215941.GA1322079%40nathanxps13  

M src/backend/lib/dshash.c
M src/backend/replication/logical/launcher.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/cache/typcache.c
M src/include/lib/dshash.h

Use NULL instead of 0 for 'arg' argument in dshash_create() calls.

commit   : 5fe08c006c826da4a7f5db2a79327477599edbc6    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:46:01 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 26 Feb 2024 15:46:01 -0600    

Click here for diff

A couple of dshash_create() callers provide 0 for the 'void *arg'  
argument, which might give readers the incorrect impression that  
this is some sort of "flags" parameter.  
  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/20240119215941.GA1322079%40nathanxps13  

M src/backend/replication/logical/launcher.c
M src/backend/utils/activity/pgstat_shmem.c

Revise MERGE documentation

commit   : 6979ea2638a51c40acf6d04b816550b2c35b3e55    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 18:19:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 18:19:03 +0100    

Click here for diff

Add a note about the additional privileges required after the fix in  
4989ce72644b (wording per Tom Lane); also change marked-up mentions of  
"target_table_name" to be simply "the target table" or the like.  Also,  
note that "join_condition" is scouted for requisite privileges.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/[email protected]  

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

slru.c: Reduce scope of variables in 'for' blocks

commit   : 5f79cb7629a4ce6321f509694ebf475a931608b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 16:49:50 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 26 Feb 2024 16:49:50 +0100    

Click here for diff

Pretty boring.  

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

Group more closely cache updates for backends in sequence.c

commit   : 6e951bf98e2e0230ed95db2fafc244536bd7502f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 17:03:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 17:03:18 +0900    

Click here for diff

Information of sequences is cached for each backend for currval() and  
nextval(), and the update of some cached information was mixed in the  
middle of computations based on the other properties of a sequence, for  
the increment value in nextval() and the cached state when altering a  
sequence.  
  
Grouping them makes the code easier to follow and to refactor in the  
future, when splitting the computation and the SeqTable change parts.  
Note that the cached data is untouched between the areas where these  
cache updates are moved.  
  
Issue noticed while doing some refactoring of the sequence code.  
  
Author: Michael Paquier  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c

Introduce sequence_*() access functions

commit   : 449e798c77ed9a03f8bb04e5d324d4e3cfbbae8e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 16:04:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 26 Feb 2024 16:04:59 +0900    

Click here for diff

Similarly to tables and indexes, these functions are able to open  
relations with a sequence relkind, which is useful to make a distinction  
with the other relation kinds.  Previously, commands/sequence.c used a  
mix of table_{close,open}() and relation_{close,open}() routines when  
manipulating sequence relations, so this clarifies the code.  
  
A direct effect of this change is to align the error messages produced  
when attempting DDLs for sequences on relations with an unexpected  
relkind, like a table or an index with ALTER SEQUENCE, providing an  
extra error detail about the relkind of the relation used in the DDL  
query.  
  
Author: Michael Paquier  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/Makefile
M src/backend/access/meson.build
A src/backend/access/sequence/Makefile
A src/backend/access/sequence/meson.build
A src/backend/access/sequence/sequence.c
M src/backend/commands/sequence.c
A src/include/access/sequence.h
M src/test/regress/expected/sequence.out

Fix incorrect format placeholder

commit   : 025f0a6f9113efe89bb65b9efe0cb96a5d7c7ad1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2024 07:16:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 26 Feb 2024 07:16:31 +0100    

Click here for diff

Not only did the format placeholder not match the variable, the  
variable also didn't match the function it was getting its value from.  

M src/backend/backup/basebackup_incremental.c

Promote assertion about !ReindexIsProcessingIndex to runtime error.

commit   : f5a465f1a07474f380b54073a518602b342a188b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 16:15:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 16:15:07 -0500    

Click here for diff

When this assertion was installed (in commit d2f60a3ab), I thought  
it was only for catching server logic errors that caused accesses to  
catalogs that were undergoing index rebuilds.  However, it will also  
fire in case of a user-defined index expression that attempts to  
access its own table.  We occasionally see reports of people trying  
to do that, and typically getting unintelligible low-level errors  
as a result.  We can provide a more on-point message by making this  
a regular runtime check.  
  
While at it, adjust the similar error check in  
systable_beginscan_ordered to use the same message text.  That one  
is (probably) not reachable without a coding bug, but we might as  
well use a translatable message if we have one.  
  
Per bug #18363 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c

Doc: fix minor typos in two ECPG function descriptions.

commit   : 57b28c08305a7696375eae9a0a26532f8fb84d1b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 15:29:09 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 25 Feb 2024 15:29:09 -0500    

Click here for diff

Noted by Aidar Imamov.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ecpg.sgml

Improve documentation and GUC description for transaction_timeout

commit   : 28e858c0f951a5f86f43ba9b8922c64bba96d2e1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:30:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:30:17 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

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

Remove flaky isolation tests for timeouts

commit   : a661bf7b0f56dd8bc298309de9937081ef485370    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:00:03 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 25 Feb 2024 20:00:03 +0200    

Click here for diff

51efe38cb92f introduced bunch of tests for idle_in_transaction_session_timeout,  
transaction_timeout and statement_timeout. These tests were too flaky on some  
slow buildfarm machines, so we plan to replace them with TAP tests using  
injection points. This commit removes flaky tests.  
  
Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com  
Author: Andrey Borodin  

M src/test/isolation/expected/timeouts.out
M src/test/isolation/specs/timeouts.spec

Multiple revisions to the GROUP BY reordering tests

commit   : 874d817baa160ca7e68bee6ccc9fc1848c56e750    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 01:49:06 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 01:49:06 +0200    

Click here for diff

Discussion: https://postgr.es/m/CAMbWs4-NKLa%2BSs%2BX%3DWR6h0x%3DT07YBJoAz70ZGHzc-2zcHUHb0A%40mail.gmail.com  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov, Alexander Korotkov  

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

Replace lateral references to removed rels in subqueries

commit   : 466979ef031afff000f3f92b812b946cf3a416c1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 00:34:52 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 24 Feb 2024 00:34:52 +0200    

Click here for diff

This commit introduces a new field 'sublevels_up' in ReplaceVarnoContext,  
and enhances replace_varno_walker() to:  
  1) recurse into subselects with sublevels_up increased, and  
  2) perform the replacement only when varlevelsup is equal to sublevels_up.  
  
This commit also fixes some outdated comments.  And besides adding relevant  
test cases, it makes some unification over existing SJE test cases.  
  
Discussion: https://postgr.es/m/CAMbWs4-%3DPO6Mm9gNnySbx0VHyXjgnnYYwbN9dth%3DTLQweZ-M%2Bg%40mail.gmail.com  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov, Alexander Korotkov  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Avoid dangling-pointer problem with partitionwise joins under GEQO.

commit   : a6b2a51e16d7ae7b1982c9d8dfa61a637a832209    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2024 15:21:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 23 Feb 2024 15:21:53 -0500    

Click here for diff

build_child_join_sjinfo creates a derived SpecialJoinInfo in  
the short-lived GEQO context, but afterwards the semi_rhs_exprs  
from that may be used in a UniquePath for a child base relation.  
This breaks the expectation that all base-relation-level structures  
are in the planning-lifespan context, leading to use of a dangling  
pointer with probable ensuing crash later on in create_unique_plan.  
To fix, copy the expression trees when making a UniquePath.  
  
Per bug #18360 from Alexander Lakhin.  This has been broken since  
partitionwise joins were added, so back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix compiler warning on typedef redeclaration

commit   : d360e3cc60e37d6d41ee78acf7bd5cb313b978c1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 17:39:27 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 17:39:27 +0200    

Click here for diff

    bulk_write.c:78:3: error: redefinition of typedef 'BulkWriteState' is a C11 feature [-Werror,-Wtypedef-redefinition]  
    } BulkWriteState;  
      ^  
    ../../../../src/include/storage/bulk_write.h:20:31: note: previous definition is here  
    typedef struct BulkWriteState BulkWriteState;  
                                  ^  
    1 error generated.  
  
Per buildfarm animals 'sifaka' and 'longfin'.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/smgr/bulk_write.c
M src/include/storage/bulk_write.h

Introduce a new smgr bulk loading facility.

commit   : 8af256524893987a3e534c6578dd60edfb782a77    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 16:10:51 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 23 Feb 2024 16:10:51 +0200    

Click here for diff

The new facility makes it easier to optimize bulk loading, as the  
logic for buffering, WAL-logging, and syncing the relation only needs  
to be implemented once. It's also less error-prone: We have had a  
number of bugs in how a relation is fsync'd - or not - at the end of a  
bulk loading operation. By centralizing that logic to one place, we  
only need to write it correctly once.  
  
The new facility is faster for small relations: Instead of of calling  
smgrimmedsync(), we register the fsync to happen at next checkpoint,  
which avoids the fsync latency. That can make a big difference if you  
are e.g. restoring a schema-only dump with lots of relations.  
  
It is also slightly more efficient with large relations, as the WAL  
logging is performed multiple pages at a time. That avoids some WAL  
header overhead. The sorted GiST index build did that already, this  
moves the buffering to the new facility.  
  
The changes to pageinspect GiST test needs an explanation: Before this  
patch, the sorted GiST index build set the LSN on every page to the  
special GistBuildLSN value, not the LSN of the WAL record, even though  
they were WAL-logged. There was no particular need for it, it just  
happened naturally when we wrote out the pages before WAL-logging  
them. Now we WAL-log the pages first, like in B-tree build, so the  
pages are stamped with the record's real LSN. When the build is not  
WAL-logged, we still use GistBuildLSN. To make the test output  
predictable, use an unlogged index.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/30e8f366-58b3-b239-c521-422122dd5150%40iki.fi  

M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/sql/gist.sql
M src/backend/access/gist/gistbuild.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/catalog/storage.c
M src/backend/storage/smgr/Makefile
A src/backend/storage/smgr/bulk_write.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/meson.build
M src/backend/storage/smgr/smgr.c
A src/include/storage/bulk_write.h
M src/include/storage/md.h
M src/include/storage/smgr.h
M src/tools/pgindent/typedefs.list

Fix mistake in SQL features list

commit   : e612384fc78d35c3d3a8b3d27cef5181dca8430b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2024 14:40:25 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 23 Feb 2024 14:40:25 +0100    

Click here for diff

Fix for c9f57541d97: Feature F302-02 was renamed to F305, but that  
commit failed to delete the old line.  
  
Reported-by: Satoru Koizumi (小泉 悟) <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/170866661469.645.14101429540172934386%40wrigleys.postgresql.org  

M src/backend/catalog/sql_features.txt

Fix BF failure in commit 93db6cbda0.

commit   : d13ff82319ccaacb04d77b77a010ea7a1717564f    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 18:26:40 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 18:26:40 +0530    

Click here for diff

The code to match the required LOG in the test was not robust enough to  
match it. It was using a very specific format to search the required  
message which doesn't work when one uses log_error_verbosity = verbose.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/CAA4eK1KcQSk7wzC7Zfrth9OhrjW2HvxL4tKgU42qqH7p6jn+FA@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Make GetSlotInvalidationCause() return RS_INVAL_NONE on unexpected input

commit   : efa70c15c742511195e2ee6f0aef94d0797daf80    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 19:59:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 19:59:58 +0900    

Click here for diff

943f7ae1c869 has changed GetSlotInvalidationCause() so as it would  
return the last element of SlotInvalidationCauses[] when an incorrect  
conflict reason name is given by a caller, but this should return  
RS_INVAL_NONE in such cases, even if such a state should never be  
reached in practice.  
  
Per gripe from Peter Smith.  
  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CAHut+PtsrSWxczpGkSaSVtJo+BXrvJ3Hwp5gES14bbL-G+HL7A@mail.gmail.com  

M src/backend/replication/slot.c

Add a new slot sync worker to synchronize logical slots.

commit   : 93db6cbda037f1be9544932bd9a785dabf3ff712    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 15:25:15 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 15:25:15 +0530    

Click here for diff

By enabling slot synchronization, all the failover logical replication  
slots on the primary (assuming configurations are appropriate) are  
automatically created on the physical standbys and are synced  
periodically. The slot sync worker on the standby server pings the primary  
server at regular intervals to get the necessary failover logical slots  
information and create/update the slots locally. The slots that no longer  
require synchronization are automatically dropped by the worker.  
  
The nap time of the worker is tuned according to the activity on the  
primary. The slot sync worker waits for some time before the next  
synchronization, with the duration varying based on whether any slots were  
updated during the last cycle.  
  
A new parameter sync_replication_slots enables or disables this new  
process.  
  
On promotion, the slot sync worker is shut down by the startup process to  
drop any temporary slots acquired by the slot sync worker and to prevent  
the worker from trying to fetch the failover slots.  
  
A functionality to allow logical walsenders to wait for the physical will  
be done in a subsequent commit.  
  
Author: Shveta Malik, Hou Zhijie based on design inputs by Masahiko Sawada and Amit Kapila  
Reviewed-by: Masahiko Sawada, Bertrand Drouvot, Peter Smith, Dilip Kumar, Ajin Cherian, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/transam/xlogrecovery.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/miscadmin.h
M src/include/replication/slotsync.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl

pgindent fix

commit   : 3d47b75546d1ef70145f58e162a96f7e0c649389    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:59:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:59:15 +0100    

Click here for diff

for commit 489072ab7a  

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

Fix the intermittent buildfarm failures in 031_column_list.

commit   : b6df0798a5e2480d28cceee7df3f58650cf6fa7a    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 12:06:44 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 12:06:44 +0530    

Click here for diff

The reason was that the ALTER SUBSCRIPTION .. SET PUBLICATION will lead to  
the restarting of apply worker and after the restart, the apply worker  
will use the existing slot and replication origin corresponding to the  
subscription. Now, it is possible that before restart the origin has not  
been updated and the WAL start location points to a location before where  
PUBLICATION exists which can lead to the error "publication ... does not  
exist".  
  
Fix it by recreating the subscription as a newly created subscription will  
start processing WAL from the recent WAL location and will see the  
required publication.  
  
This behavior has existed from the time logical replication was introduced  
but is exposed by this test and we have started a discussion for a better  
fix for this problem.  
  
As per Buildfarm  
  
Diagnosed-by: Amit Kapila  
Author: Vignesh C  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/031_column_list.pl

Remove custom Constraint node read/write implementations

commit   : fbc93b8b5f59cfb23c22a26a46ca7bcc826be442    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:07:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 22 Feb 2024 07:07:12 +0100    

Click here for diff

This is part of an effort to reduce the number of special cases in the  
automatically generated node support functions.  
  
Allegedly, only certain fields of the Constraint node are valid based  
on contype.  But this has historically not been kept up to date in the  
read/write functions.  The Constraint node is only used for debugging  
DDL statements, so there are no strong requirements for its output,  
and there is no enforcement for its correctness.  (There was no read  
support before a6bc3301925.)  Commits e7a552f303c and abf46ad9c7b are  
examples of where omissions were fixed.  
  
This patch just removes the custom read/write implementations for the  
Constraint node type.  Now we just output all the fields, which is a  
bit more than before, but at least we don't have to maintain these  
functions anymore.  Also, we lose the string representation of the  
contype field, but for this marginal use case that seems tolerable.  
This patch also changes the documentation of the Constraint struct to  
put less emphasis on grouping fields by constraint type but rather  
document for each field how it's used.  
  
Reviewed-by: Paul Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/include/nodes/parsenodes.h

Improve ERROR/LOG messages added by commits ddd5f4f54a and 7a424ece48.

commit   : 801792e528d6cb5eeb3a70f5ceb10b15bf92f0c7    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 11:17:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 22 Feb 2024 11:17:00 +0530    

Click here for diff

Additionally, in slotsync.c, replace one StringInfoData variable usage  
with a constant string to avoid palloc/pfree. Also, replace the inclusion  
of "logical.h" with "slot.h" to prevent the exposure of unnecessary  
implementation details.  
  
Reported-by: Kyotaro Horiguchi, Masahiko Sawada  
Author: Shveta Malik based on suggestions by Robert Haas and Amit Kapila  
Reviewed-by: Kyotaro Horiguchi, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAD21AoCYXhDYOQDAS-rhGasC2T+tYbV=8Y18o94sB=5AxcW+yA@mail.gmail.com  

M src/backend/replication/logical/slotsync.c
M src/test/recovery/t/040_standby_failover_slots_sync.pl

Speed up uuid_out() by not relying on a StringInfo

commit   : 011d60c4352c5c48c0f1a185e8a12833c22a58db    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 10:02:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 10:02:55 +0900    

Click here for diff

Since the size of the string representation of an uuid is fixed, there  
is no benefit in using a StringInfo.  This commit simplifies uuid_oud()  
to not rely on a StringInfo, where avoiding the overhead of the string  
manipulation makes the function substantially faster.  
  
A COPY TO on a relation with one UUID attribute can show up to a 40%  
speedup when the bottleneck is the COPY computation with uuid_out()  
showing up at the top of the profiles (numbered measure here, Laurenz  
has mentioned something closer to 20% faster runtimes), for example when  
the data is fully in shared buffers or the OS cache.  
  
Author: Laurenz Albe  
Reviewed-by: Andres Freund, Michael Paquier  
Description: https://postgr.es/m/[email protected]  

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

Add lookup table for replication slot conflict reasons

commit   : 943f7ae1c8693cf3ea59d103aaf9590ea062fb9c    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 08:40:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 22 Feb 2024 08:40:40 +0900    

Click here for diff

This commit switches the handling of the conflict cause strings for  
replication slots to use a table rather than being explicitly listed,  
using a C99-designated initializer syntax for the array elements.  This  
makes the whole more readable while easing future maintenance with less  
areas to update when adding a new conflict reason.  
  
This is similar to 74a730631065, but the scale of the change is smaller  
as there are less conflict causes than LWLock builtin tranche names.  
  
Author: Bharath Rupireddy  
Reviewed-by: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CALj2ACUxSLA91QGFrJsWNKs58KXb1C03mbuwKmzqqmoAKLwJaw@mail.gmail.com  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h

Remove superfluous 'pgprocno' field from PGPROC

commit   : 28f3915b73f75bd1b50ba070f56b34241fe53fd1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Feb 2024 01:21:34 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 22 Feb 2024 01:21:34 +0200    

Click here for diff

It was always just the index of the PGPROC entry from the beginning of  
the proc array. Introduce a macro to compute it from the pointer  
instead.  
  
Reviewed-by: Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/clog.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/lock.h
M src/include/storage/proc.h

MERGE ... DO NOTHING: require SELECT privileges

commit   : 4989ce72644b9d636b9b23c7a1719a405e62670b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 21 Feb 2024 17:18:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 21 Feb 2024 17:18:52 +0100    

Click here for diff

Verify that a user running MERGE with a DO NOTHING clause has  
privileges to read the table, even if no columns are referenced.  Such  
privileges were already required if the ON clause or any of the WHEN  
conditions referenced any column at all, so there's no functional change  
in practice.  
  
This change fixes an assertion failure in the case where no column is  
referenced by the command and the WHEN clauses are all DO NOTHING.  
  
Backpatch to 15, where MERGE was introduced.  
  
Reported-by: Alena Rybakina <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/parser/parse_merge.c
M src/test/regress/expected/merge.out
M src/test/regress/sql/merge.sql

Fix typo

commit   : ed345c2728b3ebc160d8335464765679a08031b9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2024 10:54:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 20 Feb 2024 10:54:34 +0100    

Click here for diff

M src/backend/tcop/postgres.c

commit   : 690805ca75463a5511ddd5fa02d73928393e6c96    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 21 Feb 2024 09:08:28 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 21 Feb 2024 09:08:28 +0100    

Click here for diff

Commit a2c84990bea7 accidentally used the link for pg_hba_file_rules  
when linking to pg_ident_file_mappings.  Backpatch to v16 where this  
was introduced.  
  
Author: Erik Wienhold <[email protected]>  
Discussion: https://postgr.es/m/qt5hvgvfi4qzlgml2dfssaut2t2x5nwf7b5l63fklr7fpxwm6g@hle3mtglpm4y  
Backpatch-through: v16  

M doc/src/sgml/func.sgml

Add option force_initdb to PostgreSQL::Test::Cluster:init()

commit   : ff9e1e764fcce9a34467d614611a34d4d2a91b50    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 21 Feb 2024 13:28:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 21 Feb 2024 13:28:51 +0900    

Click here for diff

This option is useful to bypass the default behavior of init() which  
would create the data folder of a new cluster by copying it from a  
template previously initdb'd, if any.  Copying the data folder is much  
cheaper than running initdb, but some tests may want to force that.  For  
example, one scenario of pg_combinebackup updated in this commit needs a  
different system ID for two nodes.  
  
Previously, this could only be achieved by unsetting  
$ENV{'INITDB_TEMPLATE'}, which could become a problem in complex node  
setups by making tests less efficient.  
  
Author: Amul Sul  
Reviewed-by: Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_combinebackup/t/005_integrity.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm

Remove extra check_stack_depth() from dropconstraint_internal()

commit   : 75bcba6cbd2a6f62752d7917d9a3c0a52f8605c9    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 21 Feb 2024 02:46:56 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 21 Feb 2024 02:46:56 +0200    

Click here for diff

The second check was added by d57b7cc33 without taking into account there  
is already a check since b0f7dd915.  
  
Reported-by: Ashutosh Bapat, Alexander Lakhin  
Discussion: https://postgr.es/m/CAExHW5sBZWDjeBUFs_ehEDM%2BuhWxTiBkPbLiat7ZjWkb-DWQWw%40mail.gmail.com  

M src/backend/commands/tablecmds.c

Doc: improve explanation of type interval, especially extract().

commit   : fcd210d496dad7d9f68c9399113368ccf2f009b9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2024 14:35:12 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 20 Feb 2024 14:35:12 -0500    

Click here for diff

The explanation of interval's behavior in datatype.sgml wasn't wrong  
exactly, but it was unclear, partly because it buried the lede about  
there being three internal fields.  Rearrange and wordsmith for more  
clarity.  
  
The discussion of extract() claimed that input of type date was  
handled by casting, but actually there's been a separate SQL function  
taking date for a very long time.  Also, it was mostly silent about  
how interval inputs are handled, but there are several field types  
for which it seems useful to be specific.  
  
Improve discussion of justify_days()/justify_hours() too.  
  
In passing, remove vertical space in some groups of examples,  
as there was little consistency about whether to have such space  
or not.  (I only did this within the datetime functions section;  
there are some related inconsistencies elsewhere.)  
  
Per discussion of bug #18348 from Michael Bondarenko.  There  
may be some code changes coming out of that discussion too,  
but we likely won't back-patch them.  This docs-only patch  
seems useful to back-patch, though I only carried it back to  
v13 because it didn't apply easily in v12.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml

Replace relids in lateral subquery parse tree during SJE

commit   : 489072ab7a9e37987e1d1008a90b0a3644455ecd    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 20 Feb 2024 14:10:10 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 20 Feb 2024 14:10:10 +0200    

Click here for diff

Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/56ee4520-e9d1-d519-54fe-c8bff880ce9b%40gmail.com  
Author: Alexander Korotkov, Andrei Lepikhov  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Revert "Improve compression and storage support with inheritance"

commit   : 74563f6b90216180fc13649725179fc119dddeb5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2024 11:10:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 20 Feb 2024 11:10:59 +0100    

Click here for diff

This reverts commit 0413a556990ba628a3de8a0b58be020fd9a14ed0.  
  
pg_dump cannot currently dump all the structures that are allowed by  
this patch.  This needs more work in pg_dump and more test coverage.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_type.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/pg_type.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/compression.out
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/compression.sql
M src/test/regress/sql/create_table_like.sql
M src/test/regress/sql/inherit.sql

Minor corrections for partition pruning

commit   : d2ca9a50b5b99ef29aa65b68b5e6ddb253fbb04a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 18:34:21 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 18:34:21 +1300    

Click here for diff

When the partition pruning code finds an OpExpr with an operator that  
does not belong to the partition key's opfamily, the code checks to see  
if the negator of the operator is the opfamily's BTEqualStrategyNumber  
operator so that partition pruning can support that operator and invert  
the matching partitions.  Doing this only works for LIST partitioned  
tables.  
  
Here we fix a minor correctness issue where when we discover we're not  
pruning for a LIST partitioned table, we return PARTCLAUSE_NOMATCH.  
PARTCLAUSE_NOMATCH is only meant to be used when the clause may match  
another partitioned key column.  For this case, the clause is not going  
to be any more useful to another partitioned key as the partition strategy  
is not going to change from one key to the next.  
  
Noticed while working 4c2369ac5.  No backpatch because returning  
PARTCLAUSE_NOMATCH instead of PARTCLAUSE_UNSUPPORTED mostly just causes  
wasted effort checking subsequent partition keys against a clause that  
will never be used for pruning.  
  
In passing, correct a comment for get_matching_range_bounds() which  
mentions that an 'opstrategy' of 0 is supported.  It's not, so fix the  
comment.  This was pointed out by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/CAApHDvqriy8mPOFJ_Bd66YGXJ4+XULpv-4YdB+ePdCQFztyisA@mail.gmail.com  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partprune.c

Fix race leading to incorrect conflict cause in InvalidatePossiblyObsoleteSlot()

commit   : 818fefd8fd4412d45eb542155cb2833a2b864acc    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 13:43:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 13:43:51 +0900    

Click here for diff

The invalidation of an active slot is done in two steps:  
- Termination of the backend holding it, if any.  
- Report that the slot is obsolete, with a conflict cause depending on  
the slot's data.  
  
This can be racy because between these two steps the slot mutex would be  
released while doing system calls, which means that the effective_xmin  
and effective_catalog_xmin could advance during that time, detecting a  
conflict cause different than the one originally wanted before the  
process owning a slot is terminated.  
  
Holding the mutex longer is not an option, so this commit changes the  
code to record the LSNs stored in the slot during the termination of the  
process owning the slot.  
  
Bonus thanks to Alexander Lakhin for the various tests and the analysis.  
  
Author: Bertrand Drouvot  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/backend/replication/slot.c

doc: Use system-username instead of system-user

commit   : 01ec4d89b91ed4c0cad57b188b530b9e7980ccb5    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 11:59:03 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 20 Feb 2024 11:59:03 +0900    

Click here for diff

This inconsistency has been introduced in efb6f4a4f9b6.  
  
Reported-by: Julien Rouhaud  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Fix incorrect pruning of NULL partition for boolean IS NOT clauses

commit   : 4c2369ac5d0a108df4d65a2886657efa010d67ca    
  
author   : David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 12:49:37 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 20 Feb 2024 12:49:37 +1300    

Click here for diff

Partition pruning wrongly assumed that, for a table partitioned on a  
boolean column, a clause in the form "boolcol IS NOT false" and "boolcol  
IS NOT true" could be inverted to correspondingly become "boolcol IS true"  
and "boolcol IS false".  These are not equivalent as the NOT version  
matches the opposite boolean value *and* NULLs.  This incorrect assumption  
meant that partition pruning pruned away partitions that could contain  
NULL values.  
  
Here we fix this by correctly not pruning partitions which could store  
NULLs.  
  
To be affected by this, the table must be partitioned by a NULLable boolean  
column and queries would have to contain "boolcol IS NOT false" or "boolcol  
IS NOT true".  This could result in queries filtering out NULL values  
with a LIST partitioned table and "ERROR:  invalid strategy number 0"  
for RANGE and HASH partitioned tables.  
  
Reported-by: Alexander Lakhin  
Bug: #18344  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/partitioning/partprune.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Fix test race between primary XLOG_RUNNING_XACTS and standby logical slot.

commit   : 0e162810df7657bac24ba4657460a87104523fc6    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:28 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:28 -0800    

Click here for diff

Before the previous commit, the test could hang until  
LOG_SNAPSHOT_INTERVAL_MS (15s), until checkpoint_timeout (300s), or  
indefinitely.  An indefinite hang was awfully improbable.  It entailed  
the test reaching checkpoint_timeout before the  
DecodingContextFindStartpoint() of a CREATE SUBSCRIPTION, yet after the  
preceding WAL record.  Back-patch to v16, which introduced the test.  
  
Bertrand Drouvot, reported by Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/035_standby_logical_decoding.pl

Bound waits in 035_standby_logical_decoding.pl.

commit   : 4791f87f34bd3a055db34519d6f878afeedd2548    
  
author   : Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:07 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Mon, 19 Feb 2024 12:52:07 -0800    

Click here for diff

One IPC::Run::start() used an IPC::Run::timer() without checking for  
expiration.  The other used no timeout or timer.  Back-patch to v16,  
which introduced the test.  
  
Reviewed by Bertrand Drouvot.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/recovery/t/035_standby_logical_decoding.pl

Doc: fix typo in SECURITY LABEL synopsis.

commit   : 7f2718532401cfcf5ad2d5d6e7feb15a91b6aa03    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2024 14:17:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 19 Feb 2024 14:17:11 -0500    

Click here for diff

One case missed its trailing "|".  
  
Reported by Tim Needham.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/security_label.sgml

Get rid of pg_class usage in SJE regression tests

commit   : e1b7fde418f2c0ba4ab0d9fbfa801ef62d96397b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 19 Feb 2024 14:11:50 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 19 Feb 2024 14:11:50 +0200    

Click here for diff

Usage of pg_class led to instability, see the buildfarm failure.  
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=prion&dt=2024-02-15%2021%3A58%3A04  
  
Reported-by: Andrei Lepikhov  
Discussion: https://postgr.es/m/[email protected]  

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

ci: Add test coverage of different pg_upgrade modes

commit   : 21a71648d39fe386acf8928ae59f41c6cccb47cf    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 19 Feb 2024 09:21:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 19 Feb 2024 09:21:49 +0100    

Click here for diff

Run freebsd with --link and macos with --clone, to get some coverage  
of the non-default modes.  
  
Author: Justin Pryzby <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M .cirrus.tasks.yml

commit   : f17529b710977c6ae89a1bc141cd1fb587953cc3    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 19 Feb 2024 10:36:05 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 19 Feb 2024 10:36:05 +0530    

Click here for diff

The test was failing when executed in --link mode and the reason was that  
we were using the old cluster from a previously successful upgrade test.  
Re-arrange the tests so that the successful test case is at the end.  
  
Reported-by: Justin Pryzby, Peter Eisentraut  
Author: Kuroda Hayato  
Reviewed-by: Vignesh C, Amit Kapila  
Discussion: https://postgr.es/m/ZcvZipRoi_kopIpb@pryzbyj2023  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_upgrade/t/004_subscription.pl

ecpg: Fix zero-termination of string generated by intoasc()

commit   : e77a1c58e338a1aebf00e3ae82d282f8bd32fe17    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 11:38:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 11:38:18 +0900    

Click here for diff

intoasc(), a wrapper for PGTYPESinterval_to_asc that converts an  
interval to its textual representation, used a plain memcpy() when  
copying its result.  This could miss a zero-termination in the result  
string, leading to an incorrect result.  
  
The routines in informix.c do not provide the length of their result  
buffer, which would allow a replacement of strcpy() to safer strlcpy()  
calls, but this requires an ABI breakage and that cannot happen in  
back-branches.  
  
Author: Oleg Tselebrovskiy  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/test/compat_informix/.gitignore
M src/interfaces/ecpg/test/compat_informix/Makefile
A src/interfaces/ecpg/test/compat_informix/intoasc.pgc
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.c
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.stderr
A src/interfaces/ecpg/test/expected/compat_informix-intoasc.stdout

ecpg: Fix error handling on OOMs when parsing timestamps

commit   : 0a9118ccc0eb2e6a31201b2443a2eb1078e34894    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 09:05:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 19 Feb 2024 09:05:51 +0900    

Click here for diff

pgtypes_alloc() can return NULL when failing an allocation, which is  
something that PGTYPEStimestamp_defmt_asc() has forgotten about when  
translating a timestamp for 'D', 'r', 'R' and 'T' as these require a  
temporary allocation.  
  
This is unlikely going to be a problem in practice, so no backpatch is  
done.  
  
Author: Oleg Tselebrovskiy  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/pgtypeslib/dt_common.c

Remove remaining references to timeouts-long

commit   : a6c21887a9f0251fa2331ea3ad0dd20b31c4d11d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 23:58:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 23:58:44 +0200    

Click here for diff

Reported-by: Alexander Lakhin  

M src/test/isolation/Makefile

Use new overflow-safe integer comparison functions.

commit   : 3b42bdb47169c617cb79123c407a19d16458b49a    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 14:05:36 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 14:05:36 -0600    

Click here for diff

Commit 6b80394781 introduced integer comparison functions designed  
to be as efficient as possible while avoiding overflow.  This  
commit makes use of these functions in many of the in-tree qsort()  
comparators to help ensure transitivity.  Many of these comparator  
functions should also see a small performance boost.  
  
Author: Mats Kindahl  
Reviewed-by: Andres Freund, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_tool.c
M contrib/intarray/_intbig_gist.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/walsummary.c
M src/backend/catalog/heap.c
M src/backend/nodes/list.c
M src/backend/nodes/tidbitmap.c
M src/backend/parser/parse_agg.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/syncrep.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/xid.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/psql/crosstabview.c
M src/include/access/gin_private.h

Introduce overflow-safe integer comparison functions.

commit   : 6b80394781c8de17fe7cae6996476088af3c319f    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 13:37:02 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 13:37:02 -0600    

Click here for diff

This commit adds integer comparison functions that are designed to  
be as efficient as possible while avoiding overflow.  A follow-up  
commit will make use of these functions in many of the in-tree  
qsort() comparators.  The new functions are not better in all cases  
(e.g., when the comparator function is inlined), so it is important  
to consider the context before using them.  
  
Author: Mats Kindahl  
Reviewed-by: Tom Lane, Heikki Linnakangas, Andres Freund, Thomas Munro, Andrey Borodin, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M src/include/common/int.h
M src/include/lib/sort_template.h

Pass correct count to WALRead().

commit   : 73f0a1326608ac3a7d390706fdeec59fe4dc42c0    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 11:09:11 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 11:09:11 -0800    

Click here for diff

Previously, some callers requested XLOG_BLCKSZ bytes  
unconditionally. While this did not cause a problem, because the extra  
bytes are ignored, it's confusing and makes it harder to add safety  
checks. Additionally, the comment about zero padding was incorrect.  
  
With this commit, all callers request the number of bytes they  
actually need.  
  
Author: Bharath Rupireddy  
Reviewed-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/CALj2ACWBRFac2TingD3PE3w2EBHXUHY3=AEEZPJmqhpEOBGExg@mail.gmail.com  

M src/backend/access/transam/xlogutils.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/walsender.c

Add assert to WALReadFromBuffers().

commit   : 9ecbf54075a91ed155cc779fcc1870de0fff5fef    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 10:35:42 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 16 Feb 2024 10:35:42 -0800    

Click here for diff

Per suggestion from Andres.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Replace calls to pg_qsort() with the qsort() macro.

commit   : 5497daf3aa2ae6ec9d5097f25c40627f8c801de8    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 11:37:50 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 16 Feb 2024 11:37:50 -0600    

Click here for diff

Calls to this function might give the impression that pg_qsort()  
is somehow different than qsort(), when in fact there is a qsort()  
macro in port.h that expands all in-tree uses to pg_qsort().  
  
Reviewed-by: Mats Kindahl  
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/cache/syscache.c
M src/include/port.h

Add missing check_stack_depth() to some recursive functions

commit   : d57b7cc3338e9d9aa1d7c5da1b25a17c5a72dcce    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 16:02:00 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 16:02:00 +0200    

Click here for diff

Reported-by: Egor Chindyaskin, Alexander Lakhin  
Discussion: https://postgr.es/m/1672760457.940462079%40f306.i.mail.ru  

M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/jsonpath_exec.c

Remove timeouts-long.out

commit   : eb49e1bdd90b0f0434c01e6e00dedcd9466b5a6e    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 15:57:37 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 15:57:37 +0200    

Click here for diff

bf82f43790 removes timeouts-long.spec, but forgets to remove timeouts-long.out.  
  
Reported-by: Alexander Lakhin  

D src/test/isolation/expected/timeouts-long.out

Improve compression and storage support with inheritance

commit   : 0413a556990ba628a3de8a0b58be020fd9a14ed0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:51:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:51:35 +0100    

Click here for diff

A child table can specify a compression or storage method different  
from its parents.  This was previously an error.  (But this was  
inconsistently enforced because for example the settings could be  
changed later using ALTER TABLE.)  This now also allows an explicit  
override if multiple parents have different compression or storage  
settings, which was previously an error that could not be overridden.  
  
The compression and storage properties remains unchanged in a child  
inheriting from parent(s) after its creation, i.e., when using ALTER  
TABLE ...  INHERIT.  (This is not changed.)  
  
Before this change, the error detail would mention the first pair of  
conflicting parent compression or storage methods.  But with this  
change it waits till the child specification is considered by which  
time we may have encountered many such conflicting pairs.  Hence the  
error detail after this change does not include the conflicting  
compression/storage methods.  Those can be obtained from parent  
definitions if necessary.  The code to maintain list of all  
conflicting methods or even the first conflicting pair does not seem  
worth the convenience it offers.  This change is inline with what we  
do with conflicting default values.  
  
Before this commit, the specified storage method could be stored in  
ColumnDef::storage (CREATE TABLE ... LIKE) or ColumnDef::storage_name  
(CREATE TABLE ...).  This caused the MergeChildAttribute() and  
MergeInheritedAttribute() to ignore a storage method specified in the  
child definition since it looked only at ColumnDef::storage.  This  
commit removes ColumnDef::storage and instead uses  
ColumnDef::storage_name to save any storage method specification. This  
is similar to how compression method specification is handled.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/pg_type.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/pg_type.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/compression.out
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/compression.sql
M src/test/regress/sql/create_table_like.sql
M src/test/regress/sql/inherit.sql

Remove non-existing file from .gitattributes

commit   : e85732dac0e9933cf1ec4f9df1d8ed9c221c17da    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:39:09 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 16 Feb 2024 11:39:09 +0100    

Click here for diff

The file was removed by ac25173cdbc.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQQGzbroAXi%2BYicp3HvcCo4%3Dg84kaOgjuvQ5MW9F0ubOGg%40mail.gmail.com  

M .gitattributes

Disable autovacuum on primary in 040_standby_failover_slots_sync test.

commit   : b7bdade6a42f49021d41955d6534f334e827775c    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 14:42:50 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 14:42:50 +0530    

Click here for diff

Disable autovacuum to avoid generating xid during stats update as  
otherwise the new XID could then be replicated to standby at some random  
point making slots at primary lag behind standby during slot sync.  
  
As per buildfarm  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAA4eK1Jun8SGCoc6JEktxY_+L7GmoJWrdsx-KCEP=GL-SsWggQ@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Fix the incorrect format specifier used in commit 7a424ece48.

commit   : b987be39c3c790821e462a64151b890dd3bcdd98    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 11:34:11 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 11:34:11 +0530    

Click here for diff

Author: Hou Zhijie  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB5716CB015BAD807B29BC55BE944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Change the LOG level in 040_standby_failover_slots_sync.pl to DEBUG2.

commit   : d9e225f275b7d27e6d2b196f5c528f9ad8a39abf    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 10:13:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 10:13:51 +0530    

Click here for diff

Temporarily change the log level of 040_standby_failover_slots_sync.pl to  
DEBUG2. This is to get more information about BF failures. We will reset  
it back to default once the tests are stabilized.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB571633C23B2A4CAC5FB0371A944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Add more LOG and DEBUG messages for slot synchronization.

commit   : 7a424ece4828fa107f36e1c77985eabdbe69e50b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 09:02:54 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 16 Feb 2024 09:02:54 +0530    

Click here for diff

This provides more information about remote slots during synchronization  
which helps in debugging bugs and BF failures due to test case issues. We  
might later want to change the LOG message added by this patch to DEBUG1.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB571633C23B2A4CAC5FB0371A944C2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Attempt to stabilize flapping regression test

commit   : 1fe66680c09b6cc1ed20236c84f0913a7b786bbc    
  
author   : David Rowley <[email protected]>    
date     : Fri, 16 Feb 2024 15:01:29 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 16 Feb 2024 15:01:29 +1300    

Click here for diff

Per buildfarm animal mylodon, the plan for this test was sometimes  
swapping the join order for tenk1 and tenk2.  Given that add_path() has  
no code that would cause this fluctuation when given paths with consistent  
costs, this indicates that the costs must be fluctuating in some runs.  
The only proven reason I've seen where that could happen was slight  
variations in pg_class.relpages for some tables.  This was demonstrated to  
be true by f03a9ca43 and related discussion.  Manually adjusting tenk2's  
pg_class.relpages by subtracting just 1 page does cause the plan to change  
for this test.  
  
Here we've not gone to the same lengths to prove that's what's going on  
in this case.  Proving that does not seem worth the time.  Let's just  
shrink one side of the join so the additional cost of the swapped join  
order is sufficiently different that if the relpages estimate is off a few  
pages that the planner still shouldn't swap the join order.  
  
Reported-by: Thomas Munro  
Author: Andy Fan, David Rowley  
Discussion: https://postgr.es/m/CA+hUKGLqC-NobKYfjxNM3Gexv9OJ-Fhvy9bugUcXsZjTqH7W=Q@mail.gmail.com  

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

Followup fixes for transaction_timeout

commit   : bf82f43790a675dd1b9522a7799357e61e7aa635    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 03:36:38 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 16 Feb 2024 03:36:38 +0200    

Click here for diff

Don't deal with transaction timeout in PostgresMain().  Instead, release  
transaction timeout activated by StartTransaction() in  
CommitTransaction()/AbortTransaction()/PrepareTransaction().  Deal with both  
enabling and disabling transaction timeout in assign_transaction_timeout().  
  
Also, remove potentially flaky timeouts-long isolation test, which has no  
guarantees to pass on slow/busy machines.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20240215230856.pc6k57tqxt7fhldm%40awork3.anarazel.de  

M src/backend/access/transam/xact.c
M src/backend/tcop/postgres.c
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/timeouts-long.spec

Introduce transaction_timeout

commit   : 51efe38cb92f4b15b68811bcce9ab878fbc71ea5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 23:34:11 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 23:34:11 +0200    

Click here for diff

This commit adds timeout that is expected to be used as a prevention  
of long-running queries. Any session within the transaction will be  
terminated after spanning longer than this timeout.  
  
However, this timeout is not applied to prepared transactions.  
Only transactions with user connections are affected.  
  
Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com  
Author: Andrey Borodin <[email protected]>  
Author: Japin Li <[email protected]>  
Author: Junwang Zhao <[email protected]>  
Reviewed-by: Nikolay Samokhvalov <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Reviewed-by: Fujii Masao <[email protected]>  
Reviewed-by: bt23nguyent <[email protected]>  
Reviewed-by: Yuhang Qiu <[email protected]>  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/errcodes.txt
M src/backend/utils/init/globals.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_source.c
M src/include/miscadmin.h
M src/include/storage/proc.h
M src/include/utils/guc_hooks.h
M src/include/utils/timeout.h
M src/test/isolation/Makefile
A src/test/isolation/expected/timeouts-long.out
M src/test/isolation/expected/timeouts.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/timeouts-long.spec
M src/test/isolation/specs/timeouts.spec

Doc: improve a couple of comments in postgresql.conf.sample.

commit   : 5c9f2f9398b46a283dcdf4366aaeb06eb04aa76a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2024 16:45:03 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 15 Feb 2024 16:45:03 -0500    

Click here for diff

Clarify comments associated with max_parallel_workers and  
related settings.  
  
Per bug #18343 from Christopher Kline.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/misc/postgresql.conf.sample

commit   : 9f133763961e280d8ba692bcad0b061b861e9138    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 12:05:52 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 15 Feb 2024 12:05:52 +0200    

Click here for diff

For ANY-SUBLINK, we adopted a two-stage pull-up approach to handle  
different types of scenarios. In the first stage, the sublink is pulled up  
as a subquery. Because of this, when writing this code, we did not have  
the ability to perform lateral joins, and therefore, we were unable to  
pull up Var with varlevelsup=1. Now that we have the ability to use  
lateral joins, we can eliminate this limitation.  
  
Author: Andy Fan <[email protected]>  
Author: Tom Lane <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Richard Guo <[email protected]>  
Reviewed-by: Alena Rybakina <[email protected]>  
Reviewed-by: Andrey Lepikhov <[email protected]>  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/subselect.sql

Allow passing extra options to initdb for tests

commit   : 995d400ceca3e552f84fe19f150fb03327bdc0c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 15 Feb 2024 09:52:08 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 15 Feb 2024 09:52:08 +0100    

Click here for diff

Setting the environment variable PG_TEST_INITDB_EXTRA_OPTS passes  
extra options to initdb run by pg_regress or  
PostgreSQL::Test::Cluster's init.  
  
This can be useful for a wide variety of uses, like running all tests  
with checksums enabled, or with JIT enabled, or with different GUC  
settings, or with different locale settings.  (Not all tests are going  
to pass with arbitrary options, but it is useful to run this against  
specific test suites.)  
  
Reviewed-by: Ian Lawrence Barwick <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/d4d2ad9f-1c1d-47a1-bb4d-c10a747d4f15%40eisentraut.org  

M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/pg_regress.c

Another try to fix BF failure introduced in commit ddd5f4f54a.

commit   : 9bc1eee988c31e66a27e007d41020664df490214    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 15 Feb 2024 10:37:28 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 15 Feb 2024 10:37:28 +0530    

Click here for diff

Before attempting to sync the slot on standby by  
pg_sync_replication_slots(), ensure that on the primary restart_lsn for  
the slot has moved to a recent WAL position, by re-creating the  
subscription and the logical slot.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/CAA4eK1+d5Lne8vCAn0un4SP9x-ZBr2-xfxg01uSfeBTSCKFZoQ@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

Simplify PathKey checking code

commit   : 0c444a70f2a79d4d7ef6f1af057909839e5b2097    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 18:01:28 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 18:01:28 +1300    

Click here for diff

pathkeys_useful_for_ordering() contained some needless checks to return  
0 when either root->query_pathkeys or pathkeys lists were empty.  This is  
already handled by pathkeys_count_contained_in(), so let's have it do the  
work instead of having redundant checks.  
  
Similarly, in pathkeys_useful_for_grouping(), checking pathkeys is an  
empty list just before looping over it isn't required.  Technically,  
neither is the list empty check for group_pathkeys, but I felt a bit  
more work would have to be done to get the equivalent behavior if we'd  
left it up to the foreach loop to call list_member_ptr().  
  
This was noticed by Andy while he was reviewing a patch to improve the  
UNION planner.  Since that patch adds another function similar to  
pathkeys_useful_for_ordering() and since I wasn't planning to copy these  
redundant checks over to the new function, let's adjust the existing  
code so that both functions will be consistent.  
  
Author: Andy Fan  
Discussion: https://postgr.es/m/[email protected]  

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

Clarify the 'rows' parameter in create_append_path

commit   : 87027cb55bf7b33416880f7f5f5e67f4202d5881    
  
author   : David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 13:13:31 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 15 Feb 2024 13:13:31 +1300    

Click here for diff

This is extracted from a larger patch to improve the UNION planner.  
While working on that, I found myself having to check what the 'rows'  
parameter is for.  It's not obvious that passing a negative number is the  
way to have the rows estimate calculated and to find that out you need  
to read code in create_append_path() and in cost_append().  
  
Discussion: https://postgr.es/m/CAApHDvpb_63XQodmxKUF8vb9M7CxyUyT4sWvEgqeQU-GB7QFoQ@mail.gmail.com  

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

Remove obsolete check in SIGTERM handler for the startup process.

commit   : 8fd0498de2005b4136aaf6fcd056ca4b18e37724    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 17:09:31 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 17:09:31 -0600    

Click here for diff

Thanks to commit 3b00fdba9f, this check in the SIGTERM handler for  
the startup process is now obsolete and can be removed.  Instead of  
leaving around the dead function write_stderr_signal_safe(), I've  
opted to just remove it for now.  
  
This partially reverts commit 97550c0711.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M src/backend/postmaster/startup.c
M src/backend/utils/error/elog.c
M src/include/utils/elog.h

Centralize logic for restoring errno in signal handlers.

commit   : 28e46325091dfac5c6ab9ea1e047a8d09dbd16e7    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 16:34:18 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 16:34:18 -0600    

Click here for diff

Presently, we rely on each individual signal handler to save the  
initial value of errno and then restore it before returning if  
needed.  This is easily forgotten and, if missed, often goes  
undetected for a long time.  
  
In commit 3b00fdba9f, we introduced a wrapper signal handler  
function that checks whether MyProcPid matches getpid().  This  
commit moves the aforementioned errno restoration code from the  
individual signal handlers to the new wrapper handler so that we no  
longer need to worry about missing it.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M doc/src/sgml/sources.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/timeout.c
M src/fe_utils/cancel.c
M src/port/pqsignal.c

Check that MyProcPid == getpid() in backend signal handlers.

commit   : 3b00fdba9f20b641d5d3c2b781cd435b23540e61    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 14:52:14 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 14:52:14 -0600    

Click here for diff

In commit 97550c0711, we added a similar check to the SIGTERM  
handler for the startup process.  This commit adds this check to  
backend signal handlers installed with pqsignal().  This is done by  
using a wrapper function that performs the check before calling the  
actual handler.  
  
The hope is that this will offer more general protection against  
child processes of Postgres backends inadvertently modifying shared  
memory due to inherited signal handlers.  Another potential  
follow-up improvement is to use this wrapper handler function to  
restore errno instead of relying on each individual handler  
function to do so.  
  
This commit makes the changes in commit 97550c0711 obsolete but  
leaves reverting it for a follow-up commit.  
  
Reviewed-by: Andres Freund, Noah Misch  
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13  

M src/port/pqsignal.c

Allow pg_monitor to execute pg_current_logfile().

commit   : 8d8afd48d3f298bc4d8ab2b115cc39550132bde7    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 11:48:29 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 14 Feb 2024 11:48:29 -0600    

Click here for diff

We allow roles with privileges of pg_monitor to execute functions  
like pg_ls_logdir(), so it seems natural that such roles would also  
be able to execute this function.  
  
Bumps catversion.  
  
Co-authored-by: Pavlo Golub  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/CAK7ymcLmEYWyQkiCZ64WC-HCzXAB0omM%3DYpj9B3rXe8vUAFMqw%40mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/catalog/system_functions.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Fix multiranges to behave more like dependent types.

commit   : 3e8235ba4f9cc3375b061fb5d3f3575434539b5f    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2024 11:30:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 14 Feb 2024 11:30:39 -0500    

Click here for diff

For most purposes, multiranges act like dependent objects of the  
associated range type: you can't create them separately or drop them  
separately.  This is like the way that autogenerated array types  
behave.  However, a couple of points were overlooked: array types  
automatically track the ownership of their base type, and array types  
do not have their own permissions but use those of the base type,  
while multiranges didn't emulate those behaviors.  This is fairly  
broken, mainly because pg_dump doesn't think it needs to worry about  
multiranges as separate objects, and thus it fails to dump/restore  
ownership or permissions of multiranges.  
  
There's no apparent value in letting a multirange diverge from  
its parent's ownership or permissions, so let's make them act like  
arrays in these respects.  However, we continue to let multiranges  
be renamed or moved to a different schema independently of their  
parent, since that doesn't break anything.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_type.c
M src/backend/commands/typecmds.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/dependency.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/sql/multirangetypes.sql

Fix BF introduced in commit ddd5f4f54a.

commit   : bd8fc1677b88ed80e4e00e0e46401ec537952482    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 16:16:08 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 16:16:08 +0530    

Click here for diff

The failure is that the remote slot is not synchronized after the same  
slot on standby gets invalidated. The reason was that remote_slot's  
restart_lsn was lagged behind the standby's oldest WAL segment. The test  
didn't ensure that remote_slot's LSN was advanced to the latest position  
before we tried to sync the slots via new the function  
pg_sync_replication_slots().  
  
Discussion: https://postgr.es/m/CAA4eK1JLBi3HzenB6do3_hd78kN0UDD1mz-vumWE52XHHEq5Bw@mail.gmail.com  

M src/test/recovery/t/040_standby_failover_slots_sync.pl

commit   : b8f9e7772595bf8527ded33884d5ed9f16e0653d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Feb 2024 11:05:10 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 14 Feb 2024 11:05:10 +0100    

Click here for diff

The pgcrypto docs contained a set of links for useful reading and  
technical references. These sets of links were however not actively  
curated and had stale content and dead links. Rather than investing  
time into maintining these, this removes them altogether since there  
are lots of resources online which are actively maintained.  
  
Backpatch to all supported versions since these links have been in  
the docs for a long time.  
  
Reported-by: Hanefi Onaldi <[email protected]>  
Reviewed-by: Magnus Hagander <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/pgcrypto.sgml

Add a slot synchronization function.

commit   : ddd5f4f54a026db6a6692876d0d44aef902ab686    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 09:45:36 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 14 Feb 2024 09:45:36 +0530    

Click here for diff

This commit introduces a new SQL function pg_sync_replication_slots()  
which is used to synchronize the logical replication slots from the  
primary server to the physical standby so that logical replication can be  
resumed after a failover or planned switchover.  
  
A new 'synced' flag is introduced in pg_replication_slots view, indicating  
whether the slot has been synchronized from the primary server. On a  
standby, synced slots cannot be dropped or consumed, and any attempt to  
perform logical decoding on them will result in an error.  
  
The logical replication slots on the primary can be synchronized to the  
hot standby by using the 'failover' parameter of  
pg-create-logical-replication-slot(), or by using the 'failover' option of  
CREATE SUBSCRIPTION during slot creation, and then calling  
pg_sync_replication_slots() on standby. For the synchronization to work,  
it is mandatory to have a physical replication slot between the primary  
and the standby aka 'primary_slot_name' should be configured on the  
standby, and 'hot_standby_feedback' must be enabled on the standby. It is  
also necessary to specify a valid 'dbname' in the 'primary_conninfo'.  
  
If a logical slot is invalidated on the primary, then that slot on the  
standby is also invalidated.  
  
If a logical slot on the primary is valid but is invalidated on the  
standby, then that slot is dropped but will be recreated on the standby in  
the next pg_sync_replication_slots() call provided the slot still exists  
on the primary server. It is okay to recreate such slots as long as these  
are not consumable on standby (which is the case currently). This  
situation may occur due to the following reasons:  
- The 'max_slot_wal_keep_size' on the standby is insufficient to retain  
WAL records from the restart_lsn of the slot.  
- 'primary_slot_name' is temporarily reset to null and the physical slot  
is removed.  
  
The slot synchronization status on the standby can be monitored using the  
'synced' column of pg_replication_slots view.  
  
A functionality to automatically synchronize slots by a background worker  
and allow logical walsenders to wait for the physical will be done in  
subsequent commits.  
  
Author: Hou Zhijie, Shveta Malik, Ajin Cherian based on an earlier version by Peter Eisentraut  
Reviewed-by: Masahiko Sawada, Bertrand Drouvot, Peter Smith, Dilip Kumar, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/permissions.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/permissions.sql
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/meson.build
A src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
A src/include/replication/slotsync.h
M src/include/replication/walsender.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Revert "Refactor CopyReadAttributes{CSV,Text}() to use a callback in COPY FROM"

commit   : 06bd311bce24083c76d9741ae89c98750aaf4b41    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 10:07:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 10:07:22 +0900    

Click here for diff

This reverts commit 95fb5b49024, for reasons similar to what led to  
1aa8324b81fa.  In this case, the callback was called once per row, which  
is less worse than the previous callback introduced for COPY TO called  
once per argument for each row, still the patch set discussed to plug in  
custom routines to the COPY paths would be able to know which subroutine  
to use depending on its CopyFromState, so this led to a suboptimal  
approach at the end.  
  
For now, this part is reverted to consider better which approach to use.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copyfrom_internal.h

pgcrypto: Fix incorrect argument vs PG_GETARG*() mappings

commit   : d0071f922808981e2371351c46da5bb3c49554b2    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 08:59:05 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 08:59:05 +0900    

Click here for diff

The following functions use a mix of bytea and text arguments, but their  
C internals always used PG_GETARG_BYTEA_PP(), creating an incorrect mix  
with the argument types expected by encrypt_internal():  
- pgp_sym_encrypt_bytea(bytea,text[,text])  
- pgp_sym_encrypt(text,text[,text])  
- pgp_sym_decrypt_bytea(bytea,text[,text])  
- pgp_sym_decrypt(bytea,text[,text])  
- pgp_pub_encrypt_bytea(bytea,bytea[,text])  
- pgp_pub_encrypt(text,bytea[,text])  
- pgp_pub_decrypt_bytea(bytea, bytea[,text[,text]])  
- pgp_pub_decrypt(bytea,bytea[,text[,text]])  
  
This commit fixes the inconsistencies between the PG_GETARG*() macros  
and the argument types of each function.  
  
Both BYTEA_PP() and TEXT_PP() rely on PG_DETOAST_DATUM_PACKED(), that  
returns an unaligned pointer, so this was not leading to an actual  
problem as far as I know, but let's be consistent.  
  
Author: Shihao Zhong  
Discussion: https://postgr.es/m/CAGRkXqRfiWT--DzVPx_UGpNHTt0YT5Jo8eV2CtT56jNP=QpXSQ@mail.gmail.com  

M contrib/pgcrypto/pgp-pgsql.c

Improve comment about query_id_enabled in queryjumblefuncs.c

commit   : f854dae888ab69db92153369644951dfb5b3d034    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 07:20:15 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 14 Feb 2024 07:20:15 +0900    

Click here for diff

The comment was inexact because query_id_enabled will not be switched to  
"true" even if compute_query_id is "on", unless a module requests for  
it.  
  
While on it, this adds a comment to mention that IsQueryIdEnabled()  
should be used to check if query ID computation is enabled or not.  
  
Author: Yugo Nagata  
Reviewed-by: Julien Rouhaud  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/queryjumblefuncs.c

Catch overflow when rounding intervals in AdjustIntervalForTypmod.

commit   : 5ebc9c90173f32cffe373a80835f157b9ebfa3bd    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 15:58:40 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 15:58:40 -0500    

Click here for diff

Previously, an interval microseconds field close to INT64_MAX or  
INT64_MIN could overflow, producing a result with not even the  
correct sign, while being rounded to match a precision specification.  
  
This seems worth fixing, but not worth back-patching, in part  
because the ereturn() notation doesn't exist very far back.  
  
Report and patch by Joseph Koshakow (some cosmetic mods by me)  
  
Discussion: https://postgr.es/m/CAAvxfHfpuLgqJYzkUcher466Z1LpmE+5Sm+zc8L6zKCOQ+6TDQ@mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Fix 'mmap' DSM implementation with allocations larger than 4 GB

commit   : fbf9a7ac4d300bbadbffe11c58cb54fcbe15601f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Feb 2024 21:23:41 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 13 Feb 2024 21:23:41 +0200    

Click here for diff

Fixes bug #18341. Backpatch to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/ipc/dsm_impl.c

Use a safer outfuncs/readfuncs representation for BitStrings.

commit   : 0736a8ef6f0e108e3972750a58a4e42ba070b029    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 12:18:25 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 13 Feb 2024 12:18:25 -0500    

Click here for diff

For a long time, our outfuncs.c code has supposed that the string  
contents of a BitString node could just be printed literally with  
no concern for quoting/escaping.  Now, that's okay if the string  
literal contains only valid binary or hex digits ... but our lexer  
doesn't check that, preferring to let bitin() be the sole authority  
on what's valid.  So we could have raw parse trees that contain  
incorrect BitString literals, and that can result in failures when  
WRITE_READ_PARSE_PLAN_TREES debugging is enabled.  
  
Fix by using outToken() to print the string field, and debackslash()  
to read it.  This results in a change in the emitted representation  
only in cases that would have failed before, and don't represent valid  
SQL in the first place.  Between that and the fact that we don't store  
raw parse trees in the catalogs, I judge this safe to apply without a  
catversion bump.  
  
Per bug #18340 from Alexander Lakhin.  Back-patch to v16; before that,  
we lacked readfuncs support for BitString nodes, so that the problem  
was only cosmetic.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/read.c
M src/test/regress/expected/bit.out
M src/test/regress/sql/bit.sql

Skip .DS_Store files in server side utils

commit   : c1fc502f595bc843a603bddd267b249272de485f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 13 Feb 2024 13:47:12 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 13 Feb 2024 13:47:12 +0100    

Click here for diff

The macOS Finder application creates .DS_Store files in directories  
when opened,  which creates problems for serverside utilities which  
expect all files to be PostgreSQL specific files.  Skip these files  
when encountered in pg_checksums, pg_rewind and pg_basebackup.  
  
This was extracted from a larger patchset for skipping hidden files  
and system files, where the concencus was to just skip these. Since  
this is equally likely to happen in every version, backpatch to all  
supported versions.  
  
Reported-by: Mark Guertin <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Tobias Bussmann <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M src/backend/backup/basebackup.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/003_extrafiles.pl

Use correct format placeholder for timeline IDs

commit   : e4b88c5fa343ba03e299aa643f0c44120793ddfd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2024 06:54:58 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 13 Feb 2024 06:54:58 +0100    

Click here for diff

Should be %u rather than %d.  

M src/backend/postmaster/walsummarizer.c

Doc: Improve upgrade for streaming replication section.

commit   : 703c7a3c54547bfee84bdab77cf435a2becfb1dd    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 13 Feb 2024 09:45:01 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 13 Feb 2024 09:45:01 +0530    

Click here for diff

Currently the documentation of upgrade for streaming replication section  
says that logical replication slots will be copied, but the logical  
replication slots are copied only if the old primary is version 17.0 or  
later.  
  
Author: Shubham Khanna  
Discussion: https://postgr.es/m/CAHv8RjJHCw0jpUo9PZxjcguzGt3j2W1_NH=QuREoN0nYiVdVeA@mail.gmail.com  

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

Read WAL directly from WAL buffers.

commit   : 91f2cae7a4e664e9c0472b364c7db29d755ab151    
  
author   : Jeff Davis <[email protected]>    
date     : Mon, 12 Feb 2024 10:36:18 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Mon, 12 Feb 2024 10:36:18 -0800    

Click here for diff

If available, read directly from WAL buffers, avoiding the need to go  
through the filesystem. Only for physical replication for now, but can  
be expanded to other callers.  
  
In preparation for replicating unflushed WAL data.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXKKK%3DwbiG5_t6dGao5GoecMwRkhr7GjVBM_jg54%2BNa%3DQ%40mail.gmail.com  
Reviewed-by: Andres Freund, Alvaro Herrera, Nathan Bossart, Dilip Kumar, Nitin Jadhav, Melih Mutlu, Kyotaro Horiguchi  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h

Remove "#ifdef WIN32" guards from src/port/win32*.c

commit   : 09eb633e1baa3b7cd7929f3cc77f9c46f63c20b1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 11:57:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 11:57:45 +0200    

Click here for diff

These files are only compiled on Windows, and most of them didn't have  
"#ifdef WIN32" guards. Remove them from the few that did, for  
consistency.  
  
Author: Tristan Partin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/port/win32common.c
M src/port/win32fseek.c
M src/port/win32stat.c

Remove unnecessary smgropen() calls

commit   : 9f35e42e7d59fb8716020a42c7b586f0d70a5101    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 10:59:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 12 Feb 2024 10:59:45 +0200    

Click here for diff

Now that RelationCreateStorage() returns the SmgrRelation (since  
commit 5c1560606dc), use that.  
  
Author: Japin Li  
Discussion: https://www.postgresql.org/message-id/ME3P282MB316600FA62F6605477F26F6AB6742@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/tablecmds.c

Fix some typos in event trigger docs

commit   : 5fce30e77fe133e1404167c13caaf7e0d1369295    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:51 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:51 +0200    

Click here for diff

Discussion: https://postgr.es/m/CALj2ACWFUW4jX9EW7CLxbzSS%2Bb7b0Z%3DxKYrqzj2Rstc9MCEx7g%40mail.gmail.com  
Author: Bharath Rupireddy  

M doc/src/sgml/event-trigger.sgml

Use heap_inplace_update() to unset pg_database.dathasloginevt

commit   : 8be93177c46b0f6a29a7376229b7ee002066d5f8    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 12 Feb 2024 00:33:44 +0200    

Click here for diff

Doing this instead of regular updates serves two purposes. First, that avoids  
possible waiting on the row-level lock.  Second, that avoids dealing with  
TOAST.  
  
It's known that changes made by heap_inplace_update() may be lost due to  
concurrent normal updates.  However, we are OK with that.  The subsequent  
connections will still have a chance to set "dathasloginevt" to false.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/e2a0248e-5f32-af0c-9832-a90d303c2c61%40gmail.com  

M src/backend/commands/event_trigger.c

commit   : 428e2de1b895079bbf50a128f8b3824679f4bb65    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 23:42:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 23:42:40 +0100    

Click here for diff

D src/tools/ci/windows_build_config.pl

Fix gai_strerror() thread-safety on Windows.

commit   : 65f438471b769f6b9706a386028f81df065d0a25    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 12 Feb 2024 10:47:57 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 12 Feb 2024 10:47:57 +1300    

Click here for diff

Commit 5579388d removed code that supplied a fallback implementation of  
getaddrinfo(), which was dead code on modern systems.  One tiny piece of  
the removed code was still doing something useful on Windows, though:  
that OS's own gai_strerror()/gai_strerrorA() function returns a pointer  
to a static buffer that it overwrites each time, so it's not  
thread-safe.  In rare circumstances, a multi-threaded client program  
could get an incorrect or corrupted error message.  
  
Restore the replacement gai_strerror() function, though now that it's  
only for Windows we can put it into a win32-specific file and cut it  
down to the errors that Windows documents.  The error messages here are  
taken from FreeBSD, because Windows' own messages seemed too verbose.  
  
Back-patch to 16.  
  
Reviewed-by: Kyotaro Horiguchi <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGKz%2BF9d2PTiXwfYV7qJw%2BWg2jzACgSDgPizUw7UG%3Di58A%40mail.gmail.com  

M configure
M configure.ac
M src/include/port/win32/sys/socket.h
M src/port/meson.build
A src/port/win32gai_strerror.c

Use extensible buffers to assemble command lines

commit   : e70abd67c3e6155fe8e853c4e29255578d9cf48d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 09:08:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 11 Feb 2024 09:08:35 +0100    

Click here for diff

This makes use of StringInfo to assemble command lines, instead of  
using fixed-size buffers and the (remote) possibility of "command too  
long" errors.  Also makes the code a bit simpler.  
  
This covers the test driver programs pg_regress and  
pg_isolation_regress.  
  
Similar to the changes done for pg_rewind in a33e17f210.  
  
Discussion: https://www.postgresql.org/message-id/2be4fee5-738f-4749-b9f8-b452032c7ade%40eisentraut.org  

M src/test/isolation/isolation_main.c
M src/test/regress/pg_regress_main.c

Disallow jsonpath methods involving TZ in immutable functions

commit   : 469745468668917434dbef48eddad4f961880b3d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sat, 10 Feb 2024 12:12:39 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sat, 10 Feb 2024 12:12:39 -0500    

Click here for diff

Timezones are not immutable and so neither is any function that relies on  
them. In commit 66ea94e8, we introduced a few methods which do casting  
from one time to another and thus may involve the current timezone.  To  
preserve the immutability of jsonpath functions currently marked  
immutable, disallow these methods from being called from non-TZ aware  
functions.  
  
Jeevan Chalke, per a report from Jian He.  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/jsonpath_exec.c
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql

Remove race condition in pg_get_expr().

commit   : ce571434ae7027462565706236a0c6fbdf603734    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 12:29:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 12:29:41 -0500    

Click here for diff

Since its introduction, pg_get_expr() has intended to silently  
return NULL if called with an invalid relation OID, as can happen  
when scanning the catalogs concurrently with relation drops.  
However, there is a race condition: we check validity of the OID  
at the start, but it could get dropped just afterward, leading to  
failures.  This is the cause of some intermittent instability we're  
seeing in a proposed new test case, and presumably it's a hazard in  
the field as well.  
  
We can fix this by AccessShareLock-ing the target relation for the  
duration of pg_get_expr().  Since we don't require any permissions  
on the target relation, this is semantically a bit undesirable.  But  
it turns out that the set_relation_column_names() subroutine already  
takes a transient AccessShareLock on that relation, and has done since  
commit 2ffa740be in 2012.  Given the lack of complaints about that, it  
seems like there should be no harm in holding the lock a bit longer.  
  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Avoid concurrent calls to bindtextdomain().

commit   : a584d03ced5fe302256160b4d8961d4ea9b3cc52    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:21:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:21:08 -0500    

Click here for diff

We previously supposed that it was okay for different threads to  
call bindtextdomain() concurrently (cf. commit 1f655fdc3).  
It now emerges that there's at least one gettext implementation  
in which that triggers an abort() crash, so let's stop doing that.  
Add mutexes guarding libpq's and ecpglib's calls, which are the  
only ones that need worry about multithreaded callers.  
  
Note: in libpq, we could perhaps have piggybacked on  
default_threadlock() to avoid defining a new mutex variable.  
I judge that not terribly safe though, since libpq_gettext could  
be called from code that is holding the default mutex.  If that  
were the first such call in the process, it'd fail.  An extra  
mutex is cheap insurance against unforeseen interactions.  
  
Per bug #18312 from Christian Maurer.  Back-patch to all  
supported versions.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/libpq/fe-misc.c

Clean up Windows-specific mutex code in libpq and ecpglib.

commit   : 0028b55bc8e2fc80816094620d116e2cbbd8e5f3    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:11:39 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 9 Feb 2024 11:11:39 -0500    

Click here for diff

Fix pthread-win32.h and pthread-win32.c to provide a more complete  
emulation of POSIX pthread mutexes: define PTHREAD_MUTEX_INITIALIZER  
and make sure that pthread_mutex_lock() can operate on a mutex  
object that's been initialized that way.  Then we don't need the  
duplicative platform-specific logic in default_threadlock() and  
pgtls_init(), which we'd otherwise need yet a third copy of for  
an upcoming bug fix.  
  
Also, since default_threadlock() supposes that pthread_mutex_lock()  
cannot fail, try to ensure that that's actually true, by getting  
rid of the malloc call that was formerly involved in initializing  
an emulated mutex.  We can define an extra state for the spinlock  
field instead.  
  
Also, replace the similar code in ecpglib/misc.c with this version.  
While ecpglib's version at least had a POSIX-compliant API, it  
also had the potential of failing during mutex init (but here,  
because of CreateMutex failure rather than malloc failure).  Since  
all of misc.c's callers ignore failures, it seems like a wise idea  
to avoid failures here too.  
  
A further improvement in this area could be to unify libpq's and  
ecpglib's implementations into a src/port/pthread-win32.c file.  
But that doesn't seem like a bug fix, so I'll desist for now.  
  
In preparation for the aforementioned bug fix, back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpg-pthread-win32.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/pthread-win32.c
M src/port/pthread-win32.h

Refactor pipe_read_line to return the full line

commit   : 5c7038d70bb9c4d28a80b0a2051f73fafab5af3f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 9 Feb 2024 15:03:16 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 9 Feb 2024 15:03:16 +0100    

Click here for diff

Commit 5b2f4afffe6 refactored find_other_exec() and in the process  
created pipe_read_line() into a static routine for reading a single  
line of output, aimed at reading version numbers.  Commit a7e8ece41  
later exposed it externally in order to read a postgresql.conf GUC  
using "postgres -C ..".  Further, f06b1c598 also made use of it for  
reading a version string much like find_other_exec().  The internal  
variable remained "pgver", even when used for other purposes.  
  
Since the function requires passing a buffer and its size, and at  
most size - 1 bytes will be read via fgets(), there is a truncation  
risk when using this for reading GUCs (like how pg_rewind does,  
though the risk in this case is marginal).  
  
To keep this as generic functionality for reading a line from a pipe,  
this refactors pipe_read_line() into returning an allocated buffer  
containing all of the line to remove the risk of silent truncation.  
  
Reviewed-by: Heikki Linnakangas <[email protected]>  
Reviewed-by: Álvaro Herrera <[email protected]>  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/exec.c
M src/common/exec.c
M src/include/port.h

Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkeys()

commit   : c01f6ef46c8f0ab3faa54e8f040da6e9ddc7fe5b    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 9 Feb 2024 12:56:26 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 9 Feb 2024 12:56:26 +0200    

Click here for diff

group_keys_reorder_by_pathkeys() function searched for matching pathkeys  
within root->group_pathkeys.  That could lead to picking an aggregate pathkey  
and using its pathkey->pk_eclass->ec_sortref as an argument of  
get_sortgroupref_clause_noerr().  Given that ec_sortref of an aggregate pathkey  
references aggregate targetlist not query targetlist, this leads to incorrect  
query optimization.  
  
Fix this by looking for matching pathkeys only within the first  
num_groupby_pathkeys pathkeys.  
  
Reported-by: David G. Johnston  
Discussion: https://postgr.es/m/CAKFQuwY3Ek%3DcLThgd8FdaSc5JRDVt0FaV00gMcWra%2BTAR4gGUw%40mail.gmail.com  
Author: Andrei Lepikhov, Alexander Korotkov  

M src/backend/optimizer/path/pathkeys.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Fix propagation of persistence to sequences in ALTER TABLE / ADD COLUMN

commit   : 6743c5ae64e3c957ef8bd4f8a0daa2ba9959b0b3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 9 Feb 2024 07:57:31 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 9 Feb 2024 07:57:31 +0100    

Click here for diff

Fix for 344d62fb9a9: That commit introduced unlogged sequences and  
made it so that identity/serial sequences automatically get the  
persistence level of their owning table.  But this works only for  
CREATE TABLE and not for ALTER TABLE / ADD COLUMN.  The latter would  
always create the sequence as logged (default), independent of the  
persistence setting of the table.  This is fixed here.  
  
Note: It is allowed to change the persistence of identity sequences  
directly using ALTER SEQUENCE.  So mistakes in existing databases can  
be fixed manually.  
  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/c4b6e2ed-bcdf-4ea7-965f-e49761094827%40eisentraut.org  

M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Add previous commit to .git-blame-ignore-revs

commit   : 3c44746fdb5d5603f6bc4645c78bca6c702fc920    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:06:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:06:32 +0900    

Click here for diff

M .git-blame-ignore-revs

Fix indentation of copyto.c

commit   : 49e7c6f78ed608c5d5454080ae19c0e7f1b09a04    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:05:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 11:05:01 +0900    

Click here for diff

Issue introduced by b619852086ed.  
  
Per buildfarm member koel.  

M src/backend/commands/copyto.c

Improve COPY TO performance when server and client encodings match

commit   : b619852086ed2b5df76631f5678f60d3bebd3745    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 09:30:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 9 Feb 2024 09:30:53 +0900    

Click here for diff

This commit fixes an oversight introduced in c61a2f58418e, where COPY TO  
would attempt to do encoding conversions even if the encodings of the  
client and the server matched for multi-byte encodings.  All conversions  
go through pg_any_to_server() that makes the conversion a no-op when the  
encodings of the client and the server match, even for multi-byte  
encodings.  
  
The logic was fine, but setting CopyToStateData->need_transcoding would  
cause strlen() to be called for nothing for each attribute of all the  
rows copied, and that was showing high in some profiles (more attributes  
make that easier to reach).  This change improves the runtime of some  
worst-case COPY TO queries by 15%~ (number present at least here).  
  
This is a performance improvement, so no backpatch is done out of  
caution as this is not a regression.  
  
Reported-by: Andres Freund  
Analyzed-by: Andres Freund  
Author: Michael Paquier  
Reviewed-by: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Apply pg_dump test cleanups to test_pg_dump as well

commit   : a89fa007142ea3a02fd26f9ad980e11cae718e60    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 21:19:03 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 21:19:03 +0100    

Click here for diff

Apply the changes from 41a284411e0 to the test_pg_dump module as well.  
Here, we just apply the new test consistency checks, but we don't need  
to fix any existing tests.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/test/modules/test_pg_dump/t/001_base.pl

Fix gcc >= 10 warning

commit   : d859fdb36fcdf7cf01fcda0c9ea87865e13ddc1f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 21:59:28 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 21:59:28 +0200    

Click here for diff

Reported-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACVQoFXxFm2kCmhHcdM7DjA84_bOjoM8HVAKHbE%2BKrZ1uA%40mail.gmail.com  

M src/backend/commands/dbcommands.c

doc: Remove superfluous bracket in synopsis

commit   : fdfb92c0307c95eba10854196628d88e6708901e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Feb 2024 12:19:34 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 8 Feb 2024 12:19:34 +0100    

Click here for diff

Commit 9c08aea6a30 accidentally added one too many end brackets  
in the synopsis for CREATE DATABASE .. strategy = strat. Fix by  
removing. Backpatch to v15 where it was introduced.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v15  

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

Fix wrong logic in TransactionIdInRecentPast()

commit   : 165d921c9a883814a35e8161fc692793e9c945a4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 12:45:26 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 8 Feb 2024 12:45:26 +0200    

Click here for diff

The TransactionIdInRecentPast() should return false for all the transactions  
older than TransamVariables->oldestClogXid.  However, the function contains  
a bug in comparison FullTransactionId to TransactionID allowing full  
transactions between nextXid - 2^32 and oldestClogXid - 2^31.  
  
This commit fixes TransactionIdInRecentPast() by turning the oldestClogXid into  
FullTransactionId first, then performing the comparison.  
  
Backpatch to all supported versions.  
  
Reported-by: Egor Chindyaskin  
Bug: 18212  
Discussion: https://postgr.es/m/18212-547307f8adf57262%40postgresql.org  
Author: Karina Litskevich  
Reviewed-by: Kyotaro Horiguchi  
Backpatch-through: 12  

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

Fix documentation build with older docbook-xsl

commit   : 5869aef9a15d5dc0b4de3d63d1ae360a6f34afb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 11:37:11 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 11:37:11 +0100    

Click here for diff

Commit b0f0a9432d0 backpatched some code from upstream DocBook XSL to  
our customization layer.  It turned out that this failed to work with  
anything but the latest DocBook XSL upstream version (1.79.*), because  
the backpatched code references an XSLT parameter (autolink.index.see)  
that is not defined in earlier versions (because the feature it is  
used for did not exist yet).  
  
There is no way in XSLT to test whether a parameter is declared before  
the stylesheet processor tries and fails to access it.  So the  
possibilities to fix this would be to either remove the code that uses  
the parameter (and thus give up on the feature it is used for) or  
declare the parameter in our customization layer.  The latter seems  
easier, and with a few more lines of code we can backport the entire  
autolink.index.see feature, so let's do that.  (If we didn't, then  
with older stylesheets the parameter will appear as on, but it won't  
actually do anything, because of the way the stylesheets are laid out,  
so it's less confusing to just make it work.)  
  
With this, the documentation build should work again with docbook-xsl  
versions 1.77.*, 1.78.*, and 1.79.* (which already worked before).  
Version 1.76.1 already didn't work before all this, so was not  
considered here.  
  
Reported-by: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/stylesheet-common.xsl
M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet-html-common.xsl

Update comment

commit   : 254361cf1aec4570a7022160f20fa505a876ed0e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 10:18:50 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 8 Feb 2024 10:18:50 +0100    

Click here for diff

The documentation output format htmlhelp is no longer supported, but a  
comment still mentioned it.  

M doc/src/sgml/stylesheet-common.xsl

Fix meson installation of xid_wraparound test.

commit   : 1aa67a5ea6870d42410cc2a3a0f9dcf6bd6bc1f5    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 8 Feb 2024 17:03:59 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 8 Feb 2024 17:03:59 +0900    

Click here for diff

Fix for e255b646a, to prevent installation of xid_wraparound test  
module during main install.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/84cd416a-0e37-4019-8380-1c8a3cdd8c5c%40eisentraut.org  

M src/test/modules/xid_wraparound/meson.build

Fix warnings in cpluspluscheck

commit   : 25799850867292efecf34da73db4ea1ad1aad573    
  
author   : John Naylor <[email protected]>    
date     : Thu, 8 Feb 2024 10:04:57 +0700    
  
committer: John Naylor <[email protected]>    
date     : Thu, 8 Feb 2024 10:04:57 +0700    

Click here for diff

Various int variables were compared to macros that are of type size_t,  
which caused -Wsign-compare warnings in cpluspluscheck.  Change those  
to size_t, which also better describes their purpose.  
  
Per report from Peter Eisentraut  
  
Discussion: https://postgr.es/m/486847dc-6de5-464a-938e-bac98ec2438b%40eisentraut.org  

M src/include/common/hashfn_unstable.h

Rename static function to avoid conflicting names

commit   : a4012a697e806708172ce23be14c6ffebdf8e460    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 7 Feb 2024 22:16:21 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 7 Feb 2024 22:16:21 +0100    

Click here for diff

Commit a4fd3aa719e moved setup_cancel_handler out of psql and  
exporeted it as a global function.  While pg_dump isn't using  
the header it's exported in,  having a conflicting name still  
risks causing confusion when grepping the code for callsites,  
so rename the static function in pg_dump to avoid this.  
  
Author: Yugo Nagata <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pg_dump/parallel.c

Remove Start* macros in postmaster.c.

commit   : 1e285a5e137ed033d45c63364d90565a3c013b3f    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 7 Feb 2024 12:50:48 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 7 Feb 2024 12:50:48 -0600    

Click here for diff

These macros are just shorthands for calling StartChildProcess()  
with the appropriate process type, and they arguably make the code  
harder to understand.  
  
Suggested-by: Andres Freund  
Author: Reid Thompson  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/e88934c02a5c66f5e8caab2025f85da6b9026d0b.camel%40crunchydata.com  

M src/backend/postmaster/postmaster.c

Update PQparameterStatus and ParameterStatus docs

commit   : a39f1a365a3b99149ba0038ef7e39d6bff2560c9    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 7 Feb 2024 19:25:07 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 7 Feb 2024 19:25:07 +0100    

Click here for diff

Cover scram_iterations, which was added in commit b577743000cd.  While  
at it, turn the list into a <simplelist> with 2 columns, which is much  
nicer to read.  
  
In master, remove mentions of antediluvian versions before which some  
parameters were not reported.  
  
Noticed while investigating a question by Maiquel Grassi.  
  
Backpatch to 16.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml

Adjust reltarget assignment for UPPERREL_PARTIAL_DISTINCT rel

commit   : 902900b308fb38543b95526b1f384bf3cce2f514    
  
author   : David Rowley <[email protected]>    
date     : Wed, 7 Feb 2024 21:22:34 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 7 Feb 2024 21:22:34 +1300    

Click here for diff

A comment in grouping_planner() claimed that the PlannerInfo  
upper_targets array was not used in core code.  However, the code that  
generated the paths for the UPPERREL_PARTIAL_DISTINCT rel made that  
comment untrue.  
  
Here we adjust the create_distinct_paths() function signature to pass  
down the PathTarget the same as is done for create_grouping_paths(),  
thus making the aforementioned comment true again.  
  
In passing adjust the order of the upper_targets[] assignments.  These  
seem to be following the reverse enum order apart from  
UPPERREL_PARTIAL_DISTINCT.  
  
Also, update the header comment for generate_gather_paths() to mention  
the function is also used to create gather paths for partial distinct  
paths.  
  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAMbWs48u9VoVOouJsys1qOaC9WVGVmBa+wT1dx8KvxF5GPzezA@mail.gmail.com  

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

Set LSN for wbuf in _hash_freeovflpage() iff wbuf is modified.

commit   : aa5edbe379d645e980f927b01379bdad9bc6c295    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 11:10:12 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 11:10:12 +0530    

Click here for diff

Commit 861f86beea used REGBUF_NO_CHANGE at one of the places in the hash  
index to register the clean buffers but forgot to avoid setting LSN in  
that case.  
  
Reported-by: Michael Paquier  
Author: Kuroda Hayato  
Reviewed-by: Amit Kapila, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/hash/hashovfl.c

Clean-ups for 776621a5e4 and 7329240437.

commit   : 22f7e61a63306873211e26c7bac9c68631309aef    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 10:04:04 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 7 Feb 2024 10:04:04 +0530    

Click here for diff

Following are a few clean-ups related to failover option support in slots:  
1. Improve the documentation in create_subscription.sgml.  
2. Remove the spurious blank line in subscriptioncmds.c.  
3. Remove the NOTICE for alter_replication_slot in subscriptioncmds.c as  
we would sometimes print it even when nothing has changed. One can find  
the change by enabling log_replication_commands on the publisher.  
4. Optimize ReplicationSlotAlter() function to prevent disk flushing when  
the slot's data remains unchanged.  
  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OS0PR01MB57164904651FB588A518E98894472@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/slot.c

Simplify signature of CopyAttributeOutCSV() in copyto.c

commit   : b9d6038d7048ddb837aa1d286fb8f5ca0e9b3a83    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 12:28:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 12:28:55 +0900    

Click here for diff

This has come up in 2889fd23be56, reverted later on, and is still useful  
on its own to reduce a bit the differences between the code paths  
dedicated to CSV and text.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Revert "Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY TO"

commit   : 1aa8324b81fa4979ffdc6ccf81d560eac9446948    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 08:04:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 7 Feb 2024 08:04:26 +0900    

Click here for diff

This reverts commit 2889fd23be56, following a discussion with Andres  
Freund as this callback, being called once per attribute when sending a  
relation's row, can involve a lot of indirect function calls (more  
attributes to deal with means more impact).  The effects of a dispatch  
at this level would become more visible when improving the per-row code  
execution of COPY TO, impacting future potential performance  
improvements.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Change initial use of pg_atomic_write_u64 to init

commit   : e4b27b53552c19c50b3ca00b697a1f745c247d0d    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 12:08:39 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 12:08:39 +0100    

Click here for diff

This only matters when using atomics emulation with semaphores.  
  
Per buildfarm member rorqual.  

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

Use atomic access for SlruShared->latest_page_number

commit   : d172b717c6f436738cc8383a4e9f611ae227fd93    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 10:54:10 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 6 Feb 2024 10:54:10 +0100    

Click here for diff

The new concurrency model proposed for slru.c to improve performance  
does not include any single lock that would coordinate processes  
doing concurrent reads/writes on SlruShared->latest_page_number.  
We can instead use atomic reads and writes for that variable.  
  
Author: Dilip Kumar <[email protected]>  
Reviewed-by: Andrey M. Borodin <[email protected]>  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/include/access/slru.h

Further cosmetic review of hashfn_unstable.h

commit   : b83033c3cff556d520281aaec399e47b4f11edbe    
  
author   : John Naylor <[email protected]>    
date     : Tue, 6 Feb 2024 13:09:03 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 6 Feb 2024 13:09:03 +0700    

Click here for diff

In follow-up to e97b672c8,  
* Flesh out comments explaining the incremental interface  
* Clarify detection of zero bytes when hashing aligned C strings  
  
The latter was suggested and reviewed by Jeff Davis  
  
Discussion: https://postgr.es/m/48e8f8bbe0be9c789f98776c7438244ab7a7cc63.camel%40j-davis.com  

M src/include/common/hashfn_unstable.h

Simplify initialization of incremental hash state

commit   : 9ed3ee5001b6a2d4cb0166eb8f12a457f30aaca4    
  
author   : John Naylor <[email protected]>    
date     : Sun, 21 Jan 2024 19:19:14 +0700    
  
committer: John Naylor <[email protected]>    
date     : Sun, 21 Jan 2024 19:19:14 +0700    

Click here for diff

The standalone functions fasthash{32,64} use length for two purposes:  
how many bytes to hash, and how to perturb the internal seed.  
  
Developers using the incremental interface may not know the length  
ahead of time (e.g. for C strings). In this case, it's advised to  
pass length to the finalizer, but initialization still needed some  
length up front, in the form of a placeholder macro.  
  
Separate the concerns by having the standalone functions perturb the  
internal seed themselves from their own length parameter, allowing  
to remove "len" from fasthash_init(), as well as the placeholder macro.  
  
Discussion: https://postgr.es/m/CANWCAZbTUk2LOyhsFo33gjLyLAHZ7ucXCi5K9u%3D%2BPtnTShDKtw%40mail.gmail.com  

M src/backend/catalog/namespace.c
M src/include/common/hashfn_unstable.h

doc: Spell I/O consistently

commit   : 1f61680327c962d5bafdbf6a04ad9bb0f7232f92    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 6 Feb 2024 13:29:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 6 Feb 2024 13:29:22 +0900    

Click here for diff

The pg_stat_io and pg_stat_copy_progress view docs spelled "I/O" as "IO"  
or even "io" in some places when not referring to literal names or  
string values.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/monitoring.sgml

Fix meson installation of new generated files

commit   : 1ae5ace7558ea949d2f94af2fd5eb145d5558659    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 5 Feb 2024 15:45:29 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 5 Feb 2024 15:45:29 +0100    

Click here for diff

Fix for 9b1a6f50b9: We want to install catalog/syscache_ids.h but not  
catalog/syscache_info.h.  The meson code has this backwards.  The  
makefiles are ok.  
  
Reported-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CAJ7c6TMDGmAiozDjJQ3%3DP3cd-1BidC_GpitcAuU0aqq-r1eSoQ%40mail.gmail.com  

M src/include/catalog/meson.build

Fix assertion if index is dropped during REFRESH CONCURRENTLY

commit   : b96115acb8a0e08a46877c2b8ef2a7b5560b371b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:30 +0200    

Click here for diff

When assertions are disabled, the built SQL statement is invalid and  
you get a "syntax error". So this isn't a serious problem, but let's  
avoid the assertion failure.  
  
Backpatch to all supported versions.  
  
Reviewed-by: Noah Misch  

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

Run REFRESH MATERIALIZED VIEW CONCURRENTLY in right security context

commit   : 5a9167c3971211d6fe65ecdd83025625e4af0b8b    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:23 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 5 Feb 2024 11:01:23 +0200    

Click here for diff

The internal commands in REFRESH MATERIALIZED VIEW CONCURRENTLY are  
correctly executed in SECURITY_RESTRICTED_OPERATION mode, except for  
creating the temporary "diff" table, because you cannot create  
temporary tables in SRO mode. But creating the temporary "diff" table  
is a pretty complex CTAS command that selects from another temporary  
table created earlier in the command. If you can cajole that CTAS  
command to execute code defined by the table owner, the table owner  
can run code with the privileges of the user running the REFRESH  
command.  
  
The proof-of-concept reported to the security team relied on CREATE  
RULE to convert the internally-built temp table to a view. That's not  
possible since commit b23cd185fd, and I was not able to find a  
different way to turn the SELECT on the temp table into code  
execution, so as far as I know this is only exploitable in v15 and  
below. That's a fiddly assumption though, so apply this patch to  
master and all stable versions.  
  
Thanks to Pedro Gallegos for the report.  
  
Security: CVE-2023-5869  
Reviewed-by: Noah Misch  

M src/backend/commands/matview.c

Enhance libpqrcv APIs to support slot synchronization.

commit   : dafbfed9efbe3d166f25df7e564bad716e9f8bfc    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 10:45:34 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 10:45:34 +0530    

Click here for diff

This patch provides support for regular (non-replication) connections in  
libpqrcv_connect(). This can be used to execute SQL statements on the  
primary server without starting a walsender.  
  
A new API libpqrcv_get_dbname_from_conninfo() is also added to extract the  
database name from the given connection-info.  
  
Note that this patch doesn't change any existing functionality but later  
patches implementing the slot synchronization will use this functionality  
to connect to the primary server to fetch required slot information.  
  
Author: Shveta Malik, Hou Zhijie, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Improve the comments in 004_subscription.pl.

commit   : a17aa50d67bad4ee39a94988c679d2c2fed0e934    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 08:51:33 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 5 Feb 2024 08:51:33 +0530    

Click here for diff

It was not clear whether the subscriptions in the upgraded instance were  
the ones that retained the previous subscription's properties.  
  
Author: Peter Smith  
Reviewed-by: Vignesh C, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHut+Pu1usLPHRySPTacY1K_Q-ddSRXNFhmj_2u1NfqBC1ytng@mail.gmail.com  

M src/bin/pg_upgrade/t/004_subscription.pl

Refactor CopyAttributeOut{CSV,Text}() to use a callback in COPY TO

commit   : 2889fd23be565155c8cd96a8c5a07ac971261515    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 11:12:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 11:12:37 +0900    

Click here for diff

These routines are used by the text and CSV formats to send an output  
representation of a string, applying quotes if required.  This is  
similar to 95fb5b49024a, reducing the number of "if" branches that need  
to be checked on a per-row basis when sending representation of fields  
in text or CSV mode.  
  
While on it, this simplifies the signature of CopyAttributeOutCSV() as  
it is possible to know that an attribute is alone on a line thanks to  
CopyToState.  Headers should not use quotes, even if forced at query  
level.  
  
Extracted from a larger patch by the same author.  
  
Author: Sutou Kouhei  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyto.c

Refactor CopyReadAttributes{CSV,Text}() to use a callback in COPY FROM

commit   : 95fb5b49024aa51310f91aba669aaf0bb3227932    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 09:46:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 5 Feb 2024 09:46:02 +0900    

Click here for diff

CopyReadAttributes{CSV,Text}() are used to parse lines for text and CSV  
format.  This reduces the number of "if" branches that need to be  
checked when parsing fields in CSV and text mode when dealing with a  
COPY FROM, something that can become more noticeable with more  
attributes and more lines to process.  
  
Extracted from a larger patch by the same author.  
  
Author: Sutou Kouhei  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copyfrom_internal.h

libpq: Change some static functions to extern

commit   : 774bcffe4a9853a24e61d758637c0aad2871f1fb    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:35:16 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:35:16 +0100    

Click here for diff

This is in preparation of a follow up commit that starts using these  
functions from fe-cancel.c.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

libpq: Add pqReleaseConnHosts function

commit   : 53747f722228d2cd4d7054c4d509b27dc89306ae    
  
author   : Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:19:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Sun, 4 Feb 2024 16:19:20 +0100    

Click here for diff

In a follow up commit we'll need to free this connhost field in a  
function defined in fe-cancel.c, so here we extract the logic to a  
dedicated extern function.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h

pg_basebackup: Fix check for MINIMUM_VERSION_FOR_WAL_SUMMARIES

commit   : c717525035d36e10d27ca045887bbfcc57e98e9e    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 4 Feb 2024 10:51:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 4 Feb 2024 10:51:53 +0900    

Click here for diff

MINIMUM_VERSION_FOR_WAL_SUMMARIES is used to check if the directory  
pg_wal/summaries/ should be created in a base backup, but its condition  
was reversed: pg_wal/summaries/ would be created when taking base  
backups from backends of v16 and older versions, but it should be  
created in base backups taken from backends of v17 and newer versions.  
  
Author: Artur Zakirov  
Reviewed-by: Yugo Nagata, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/CAKNkYnzkkQ0gb_ZmLTY0r2-qV1q6imXgcCWxdA6UoA6yJkujGg@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c

Improve documentation for COPY ... ON_ERROR ...

commit   : 40bbc8cf0a753f08f0c26e6c2f8c959f3b9ef8c0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 3 Feb 2024 01:49:51 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 3 Feb 2024 01:49:51 +0200    

Click here for diff

Discussion: https://postgr.es/m/20240126112829.d420b28859fbe84379fdb7ad%40sraoss.co.jp  
Author: Yugo Nagata  
Reviewed-by: Masahiko Sawada, David G. Johnston, Atsushi Torikoshi  

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

Fix typo in comments

commit   : 18dd9d2ed978547ecc4c9195e2f5d3b80cc79bde    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 3 Feb 2024 00:18:21 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 3 Feb 2024 00:18:21 +0200    

Click here for diff

Backpatch-through: v16  

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

Translate ENOMEM to ERRCODE_OUT_OF_MEMORY in errcode_for_file_access().

commit   : e4e63cd9863480698ef97009f132c9854cce8407    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2024 15:34:29 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 2 Feb 2024 15:34:29 -0500    

Click here for diff

Previously you got ERRCODE_INTERNAL_ERROR, which seems inappropriate,  
especially given that we're trying to avoid emitting that in reachable  
cases.  
  
Alexander Kuzmenkov  
  
Discussion: https://postgr.es/m/CALzhyqzgQph0BY8-hFRRGdHhF8CoqmmDHW9S=hMZ-HMzLxRqDQ@mail.gmail.com  

M src/backend/utils/error/elog.c

Fix bug in bulk extending temp relation after failure

commit   : d212957254de85aad934e2601e5a07661db268fb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Feb 2024 21:12:30 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 2 Feb 2024 21:12:30 +0200    

Click here for diff

A ResourceOwnerEnlarge() call was missing. That led to an error:  
  
ERROR:  ResourceOwnerRemember called but array was full  
  
and an assertion failure, if you tried to extend a temp relation again  
after a failure. Alexander's test case used running out of disk space  
to trigger the original failure.  
  
This bug was introduced in the large ResourceOwner rewrite commit  
b8bff07daa. Before that, the UnpinLocalBuffer() call guaranteed that  
the subsequent PinLocalBuffer() will succeed, but after the rewrite,  
releasing an old resource doesn't guarantee that there is space for a  
new one.  
  
Add a comment explaining why the UnpinBuffer + PinBuffer calls in  
BufferAlloc(), with no ResourceOwnerEnlarge() in between, are safe.  
  
Reported-by: Alexander Lakhin  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/storage/buffer/localbuf.c
M src/backend/utils/resowner/resowner.c

Allow Gather Merge in more cases for parallel DISTINCT

commit   : 7e0ade0ffe0a76b1926a4af39ecdf799c96ef1ba    
  
author   : David Rowley <[email protected]>    
date     : Sat, 3 Feb 2024 00:20:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 3 Feb 2024 00:20:18 +1300    

Click here for diff

Here we adjust the partial path generation for parallel DISTINCT queries  
to add Sort nodes on top of any unsorted partial distinct paths.  
  
This increases the likelihood of the planner pushing a Sort below a Gather  
Merge which enables the final phase of the parallel distinct to be  
implemented using a Unique node in more cases.  
  
Sorting the partial distinct paths is particularly useful when the  
DISTINCT query has an ORDER BY and LIMIT clause as this can allow cheaper  
plans by having the workers Hash Aggregate then Sort before feeding the  
results into the Gather Merge.  The non-parallel portion of the plan then  
becomes very cheap as it leaves only Unique and Limit to do in the leader  
process.  
  
Author: Richard Guo  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAMbWs48u9VoVOouJsys1qOaC9WVGVmBa+wT1dx8KvxF5GPzezA@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_distinct.out

Sync PG_VERSION file in CREATE DATABASE.

commit   : 0b6517a3b79ae02fb95731d8b1dc70b10cf7b532    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    

Click here for diff

An OS crash could leave PG_VERSION empty or missing.  The same symptom  
appeared in a backup by block device snapshot, taken after the next  
checkpoint and before the OS flushes the PG_VERSION blocks.  Device  
snapshots are not a documented backup method, however.  Back-patch to  
v15, where commit 9c08aea6a3090a396be334cc58c511edab05776a introduced  
STRATEGY=WAL_LOG and made it the default.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c
M src/backend/utils/activity/wait_event_names.txt

Handle interleavings between CREATE DATABASE steps and base backup.

commit   : df220714e50f2e924c57f4a8d9f578cf6c92a73f    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 1 Feb 2024 13:44:19 -0800    

Click here for diff

Restoring a base backup taken in the middle of CreateDirAndVersionFile()  
or write_relmap_file() would lose the function's effects.  The symptom  
was absence of the database directory, PG_VERSION file, or  
pg_filenode.map.  If missing the directory, recovery would fail.  Either  
missing file would not fail recovery but would render the new database  
unusable.  Fix CreateDirAndVersionFile() with the transam/README "action  
first and then write a WAL entry" strategy.  That has a side benefit of  
moving filesystem mutations out of a critical section, reducing the ways  
to PANIC.  Fix the write_relmap_file() call with a lock acquisition, so  
it interacts with checkpoints like non-CREATE DATABASE calls do.  
Back-patch to v15, where commit 9c08aea6a3090a396be334cc58c511edab05776a  
introduced STRATEGY=WAL_LOG and made it the default.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/dbcommands.c
M src/backend/utils/cache/relmapper.c

Update time zone data files to tzdata release 2024a.

commit   : 272a7c3034925162deb4395bf925bcf60dc2d061    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 1 Feb 2024 15:57:53 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 1 Feb 2024 15:57:53 -0500    

Click here for diff

DST law changes in Ittoqqortoormiit, Greenland (America/Scoresbysund),  
Kazakhstan (Asia/Almaty and Asia/Qostanay) and Palestine; as well as  
updates for the Antarctic stations Casey and Vostok.  
  
Historical corrections for Vietnam, Toronto, and Miquelon.  

M src/timezone/data/tzdata.zi

Avoid package qualification of $windows_os

commit   : 2e7061431b8b52163012164bd5464d2363f903c7    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 1 Feb 2024 15:17:41 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 1 Feb 2024 15:17:41 -0500    

Click here for diff

Further fallout from commit 6ee26c6a4b. To keep code in sync and avoid  
issues on older releases with different package names, simply use the  
unqualified name like many other places in our code.  

M src/bin/pg_rewind/t/003_extrafiles.pl

Continue my quest to make 002_blocks.pl pass reliably.

commit   : 19a829a3270fb083b3d6ae967cd3b3c02a170a38    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2024 11:46:30 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 1 Feb 2024 11:46:30 -0500    

Click here for diff

The latest buildfarm failures show that after the insert, we don't  
actually wait long enough for WAL summarization to catch up, apparently  
because the on disk state gets updated before the in-memory state, and  
so by checking the on disk state to see whether we're caught up and then  
the in-memory state to see where exactly how far we've progressed, we  
can, if unlucky, derive an older value of summarized_lsn, messing up  
the rest of the test.  
  
Attempt to fix this by using pg_available_wal_summaries() everywhere in  
the test and pg_get_wal_summarizer_state() nowhere.  
  
Per buildfarm.  

M src/bin/pg_walsummary/t/002_blocks.pl

doc: improve role option documentation

commit   : 21912e3c0262e2cfe64856e028799d6927862563    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2024 06:11:53 -0500    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 1 Feb 2024 06:11:53 -0500    

Click here for diff

Role option management was changed in Postgres 16.  This patch improves  
the docs around these changes, including CREATE ROLE's INHERIT option,  
inheritance handling, and grant's ability to change role options.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Co-authored-by: David G. Johnston  
  
Backpatch-through: 16  

M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/user-manag.sgml

doc: remove incorrect grammar for ALTER EVENT TRIGGER

commit   : 16a80e8912bb98c1a7763f6f6a29e23f43783f9d    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 10:45:37 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 10:45:37 +0100    

Click here for diff

The Parameters subsection had an extra TRIGGER in the grammar  
for DISABLE/ENABLE which is incorrect.  Backpatch down to all  
supported versions since it's been like this all along.  
  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/ref/alter_event_trigger.sgml

doc: Fix incorrect openssl option

commit   : 0293f8579c4d2e9219faa06e5cb8c8d31cf06fbc    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 09:36:34 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 1 Feb 2024 09:36:34 +0100    

Click here for diff

The openssl command for displaying the DN of a client certificate was  
using --subject and not the single-dash option -subject. While recent  
versions of openssl handles double dash options,  earlier does not so  
fix by using just -subject  (which is per the openssl documentation).  
  
Backpatch to v14 where this was introduced.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v14  

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

Fix stats_fetch_consistency with stats for fixed-numbered objects

commit   : 235c09efbb306d6263e904e484abdf44866beb5e    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 1 Feb 2024 17:12:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 1 Feb 2024 17:12:50 +0900    

Click here for diff

This impacts the statistics retrieved in transactions for the following  
views when updating the value of stats_fetch_consistency, leading to  
behaviors contrary to what is documented since 605994651b6a as an update  
of this parameter should discard all statistics snapshot data:  
- pg_stat_archiver  
- pg_stat_bgwriter  
- pg_stat_checkpointer  
- pg_stat_io  
- pg_stat_slru  
- pg_stat_wal  
  
For example, updating stats_fetch_consistency from "snapshot" to "cache"  
in a transaction did not re-fetch any fresh data, using data cached from  
the time when "snapshot" was in use.  
  
Author: Shinya Kato  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Fix copy&paste typo in comment

commit   : 402388946fb3ac54f0fd5944d7e177ef7737eab2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 23:11:53 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 23:11:53 +0100    

Click here for diff

M src/backend/storage/lmgr/lwlock.c

Exclude Threadsanitizer instrumentation in exit check

commit   : 936f56988741f17cce8731cfa6150fad96e571e9    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Jan 2024 22:54:45 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 31 Jan 2024 22:54:45 +0100    

Click here for diff

When building libpq there is a check to ensure that we're not  
linking against code that calls exit(). This check is using a  
heuristic grep with exclusions for known false positives. The  
Threadsanitizer library instrumentation for function exits is  
named such that it triggers the check, so add an exclusion.  
  
This fix is only applied to the Makefile since the meson build  
files don't yet have this check.  Adding the check to meson is  
outside the scope of this patch though.  
  
Reported-by: Roman Lozko <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CAEhC_BmNGKgj2wKArH2EAU11BsaHYgLnrRFJGRm5Vs8WJzyiQA@mail.gmail.com  

M src/interfaces/libpq/Makefile

Fix costing bug in MergeAppend

commit   : 9d1a5354f58cf61d9be6733d5ad0b36936af5af3    
  
author   : David Rowley <[email protected]>    
date     : Thu, 1 Feb 2024 09:48:26 +1300    
  
committer: David Rowley <[email protected]>    
date     : Thu, 1 Feb 2024 09:48:26 +1300    

Click here for diff

When building a MergeAppendPath which has child paths that are not  
sorted correctly for the MergeAppend's sort order, we apply the cost of  
sorting those paths to the MergeAppendPath costs.  
  
Here we fix a bug where the number of tuples specified that needed to be  
sorted was effectively pg_class.reltuples rather than the number of  
expected row in the subpath.  This effectively penalizes MergeAppend  
plans any time any filter is present on the MergeAppend subpath as the  
sort cost added is to sort all tuples in the table rather than just the  
ones expected the path to return.  
  
This did not affect UNION ALL type queries as the RelOptInfo tuples is  
set from the subquery's path rows.  It does affect MergeAppends uses for  
inheritance and partitioned tables.  
  
This is a long-standing bug introduced when MergeAppend was first added  
in 11cad29c9.  No backpatch as this could result in plan changes.  
  
Author: Alexander Kuzmenkov  
Reviewed-by: Ashutosh Bapat, Aleksander Alekseev, David Rowley  
Discussion: https://postgr.es/m/CALzhyqyhoXQDR-Usd_0HeWk%3DuqNLzoVeT8KhRoo%3DpV_KzgO3QQ%40mail.gmail.com  

M src/backend/optimizer/util/pathnode.c
M src/test/regress/expected/inherit.out
M src/test/regress/sql/inherit.sql

Clean pg_walsummary's tmp_check directory.

commit   : 9589b038d3203cd5ba708fb4f5c23182c88ad0b3    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 31 Jan 2024 11:50:35 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 31 Jan 2024 11:50:35 -0500    

Click here for diff

Oversight similar to ba08c10fc.  

M src/bin/pg_walsummary/Makefile

In 002_blocks.pl, try to prevent a HOT update.

commit   : b6ee30ec0866619eafc10cf43c4714ed1b89fec6    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 11:35:41 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 11:35:41 -0500    

Click here for diff

Make the new tuple larger than the old one so that it, hopefully, won't  
manage to squeeze into leftover freespace on the same page. The test  
is trying to verify that the UPDATE touches 2 pages, but if a HOT  
update happens, then it doesn't.  
  
Per buildfarm.  

M src/bin/pg_walsummary/t/002_blocks.pl

commit   : f0106b6d2dc28660d9ecba3de77cee14de921c94    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 16:29:22 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 31 Jan 2024 16:29:22 +0100    

Click here for diff

M src/bin/pg_walsummary/Makefile
M src/bin/pg_walsummary/meson.build
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/pg_walsummary/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl

Revise pg_walsummary's 002_blocks test to avoid spurious failures.

commit   : ea18eb7d625573dc369df619f7ff3b9e60e47531    
  
author   : Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 10:12:53 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Wed, 31 Jan 2024 10:12:53 -0500    

Click here for diff

Analysis of buildfarm results showed that the code that was intended  
to wait for the inserts performed by this test to complete did not  
actually do so. Try to make that logic more robust.  
  
Improve error checking elsewhere in the script, too, so that we  
don't miss things like poll_query_until failing.  
  
Along the way, fix a bit of pgindent damage introduced by commit  
5ddf9973477729cf161b4ad0a1efd52f4fea9c88, which aimed to help us  
debug the failures that this commit is trying to fix. It's making  
the buildfarm sad.  
  
Discussion: http://postgr.es/m/CA+TgmobWFb8NqyfC31YnKAbZiXf9tLuwmyuvx=iYMXMniPQ4nw@mail.gmail.com  

M src/backend/backup/walsummary.c
M src/bin/pg_walsummary/t/002_blocks.pl

doc: Document more that relations share a namespace

commit   : d0283387d358e5e0a64a439b7fe906399b59fdd9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jan 2024 11:53:56 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 31 Jan 2024 11:53:56 +0100    

Click here for diff

This was already documented in the CREATE INDEX reference, but not in  
the introductory "Data Definition" chapter.  Also, document that the  
index that implements a constraint has the same name as the  
constraint.  
  
Author: Laurenz Albe <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Reviewed-by: David G. Johnston <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFG682tYcP9aH_F-jrqq5End8MHZR77zcp1%3DDUrEsSu1Q%40mail.gmail.com  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_table.sgml

Give SMgrRelation pointers a well-defined lifetime.

commit   : 21d9c3ee4ef74e2229341d39811c97f85071c90a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 12:31:02 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 12:31:02 +0200    

Click here for diff

After calling smgropen(), it was not clear how long you could continue  
to use the result, because various code paths including cache  
invalidation could call smgrclose(), which freed the memory.  
  
Guarantee that the object won't be destroyed until the end of the  
current transaction, or in recovery, the commit/abort record that  
destroys the underlying storage.  
  
smgrclose() is now just an alias for smgrrelease(). It closes files  
and forgets all state except the rlocator, but keeps the SMgrRelation  
object valid.  
  
A new smgrdestroy() function is used by rare places that know there  
should be no other references to the SMgrRelation.  
  
The short version:  
  
 * smgrclose() is now just an alias for smgrrelease(). It releases  
   resources, but doesn't destroy until EOX  
 * smgrdestroy() now frees memory, and should rarely be used.  
  
Existing code should be unaffected, but it is now possible for code that  
has an SMgrRelation object to use it repeatedly during a transaction as  
long as the storage hasn't been physically dropped.  Such code would  
normally hold a lock on the relation.  
  
This also replaces the "ownership" mechanism of SMgrRelations with a  
pin counter.  An SMgrRelation can now be "pinned", which prevents it  
from being destroyed at end of transaction.  There can be multiple pins  
on the same SMgrRelation.  In practice, the pin mechanism is only used  
by the relcache, so there cannot be more than one pin on the same  
SMgrRelation.  Except with swap_relation_files XXX  
  
Author: Thomas Munro, Heikki Linnakangas  
Reviewed-by: Robert Haas <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA@mail.gmail.com  

M src/backend/access/transam/xlogutils.c
M src/backend/commands/cluster.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/include/storage/smgr.h
M src/include/utils/rel.h
M src/include/utils/relcache.h

Remove some obsolete smgrcloseall() calls.

commit   : 6a8ffe812d194ba6f4f26791b6388a4837d17d6c    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 11:40:29 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 31 Jan 2024 11:40:29 +0200    

Click here for diff

Before the advent of PROCSIGNAL_BARRIER_SMGRRELEASE, we didn't have a  
comprehensive way to deal with Windows file handles that get in the way  
of unlinking directories.  We had smgrcloseall() calls in a few places  
to try to mitigate.  
  
It's still a good idea for bgwriter and checkpointer to do that once per  
checkpoint so they don't accumulate unbounded SMgrRelation objects, but  
there is no longer any reason to close them at other random places such  
as the error path, and the explanation as given in the comments is now  
obsolete.  
  
Author: Thomas Munro  
Reviewed-by: Heikki Linnakangas, Robert Haas  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGJ8NTvqLHz6dqbQnt2c8XCki4r2QvXjBQcXpVwxTY_pvA@mail.gmail.com  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c

Add .gitignore to src/test/modules/gin/

commit   : 0fda3921380798897b6faca5e4fdcdc22f950f12    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:12:22 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:12:22 +0900    

Click here for diff

This has been forgotten in 6a1ea02c491d.  

A src/test/modules/gin/.gitignore

Add tests for int4_bool() in int.c

commit   : 5f19412e4eae6468361f24fd20e05fb433da5538    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:02:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 15:02:28 +0900    

Click here for diff

This cast was previously not covered at all by the regression tests.  
  
Author: Christoph Berg  
Discussion: https://postgr.es/m/[email protected]  

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

Consider the "LIMIT 1" optimization with parallel DISTINCT

commit   : b588cad688823b1e996ce05af4d88a954c005a3a    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 17:22:02 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 17:22:02 +1300    

Click here for diff

Similar to what was done in 5543677ec for non-parallel DISTINCT, apply  
the same optimization when the distinct_pathkeys are empty for the  
partial paths too.  
  
This can be faster than the non-parallel version when the first row  
matching the WHERE clause of the query takes a while to find.  Parallel  
workers could speed that process up considerably.  
  
Author: Richard Guo  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAMbWs49JC0qvfUbzs-TVzgMpSSBiMJ_6sN=BaA9iohBgYkr=LA@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_distinct.out
M src/test/regress/sql/select_distinct.sql

Fix various issues with ALTER TEXT SEARCH CONFIGURATION

commit   : 3e91dba8b079c02dc5204108c7e797b402c75779    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 13:15:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 31 Jan 2024 13:15:21 +0900    

Click here for diff

This commit addresses a set of issues when changing token type mappings  
in a text search configuration when using duplicated token names:  
- ADD MAPPING would fail on insertion because of a constraint failure  
after inserting the same mapping.  
- ALTER MAPPING with an "overridden" configuration failed with "tuple  
already updated by self" when the token mappings are removed.  
- DROP MAPPING failed with "tuple already updated by self", like  
previously, but in a different code path.  
  
The code is refactored so the token names (with their numbers) are  
handled as a List with unique members rather than an array with numbers,  
ensuring that no duplicates mess up with the catalog inserts, updates  
and deletes.  The list is generated by getTokenTypes(), with the same  
error handling as previously while duplicated tokens are discarded from  
the list used to work on the catalogs.  
  
Regression tests are expanded to cover much more ground for the cases  
fixed by this commit, as there was no coverage for the code touched in  
this commit.  A bit more is done regarding the fact that a token name  
not supported by a configuration's parser should result in an error even  
if IF EXISTS is used in a DROP MAPPING clause.  This is implied in the  
code but there was no coverage for that, and it was very easy to miss.  
  
These issues exist since at least their introduction in core with  
140d4ebcb46e, so backpatch all the way down.  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M src/backend/commands/tsearchcmds.c
M src/test/regress/expected/tsdicts.out
M src/test/regress/sql/tsdicts.sql
M src/tools/pgindent/typedefs.list

Fix 003_extrafiles.pl test for the Windows

commit   : 6ee26c6a4bafabbd22a85f575d2446fd5ec6ad0d    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 30 Jan 2024 17:09:44 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 30 Jan 2024 17:09:44 -0500    

Click here for diff

File::Find converts backslashes to slashes in the newer Perl versions.  
See: https://github.com/Perl/perl5/commit/414f14df98cb1c9a20f92c5c54948b67c09f072d  
  
So, do the same conversion for Windows before comparing paths. To  
support all Perl versions, always convert them on Windows regardless of  
the Perl's version.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
  
Backpatch to all live branches  

M src/bin/pg_rewind/t/003_extrafiles.pl

Simplify partial path generation in GROUP BY/ORDER BY

commit   : 8ee9c250875157d42f7ed53508e239d23ce514fb    
  
author   : David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 10:10:59 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 31 Jan 2024 10:10:59 +1300    

Click here for diff

Here we consolidate the generation of partial sort and partial incremental  
sort paths in a similar way to what was done in 4a29eabd1.  Since the cost  
penalty for incremental sort was removed by that commit, there's no  
point in creating a sort path on the cheapest partial path if an  
incremental sort could be done instead.  
  
This has the added benefit of reducing the amount of code required to  
build these paths.  
  
Author: Richard Guo  
Reviewed-by: Etsuro Fujita, Shubham Khanna, David Rowley  
Discussion: https://postgr.es/m/CAMbWs49PaKxBZU9cN7k3DKB7id+YfGfOfS9H_Fo5tkqPMt=fDg@mail.gmail.com  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/select_parallel.out
M src/test/regress/sql/select_parallel.sql

Split use of SerialSLRULock, creating SerialControlLock

commit   : 7b745d85b80d4492c4df8d9769592c7aad1f63d2    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jan 2024 18:11:17 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 30 Jan 2024 18:11:17 +0100    

Click here for diff

predicate.c has been using SerialSLRULock (the control lock for its SLRU  
structure) to coordinate access to SerialControlData, another of its  
numerous shared memory structures; this is unnecessary and confuses  
further SLRU scalability work.  Create a separate LWLock to cover  
SerialControlData.  
  
Extracted from a larger patch from the same author, and some additional  
changes by Álvaro.  
  
Author: Dilip Kumar <[email protected]>  
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=ExGXz6gdyjtzGixKSqs0mKHMmaQ8sOSEFZ33A@mail.gmail.com  

M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/wait_event_names.txt

Add a failover option to subscriptions.

commit   : 776621a5e4796fa214b6b29a7ca134f6c138572a    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 30 Jan 2024 16:31:09 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 30 Jan 2024 16:31:09 +0530    

Click here for diff

This commit introduces a new subscription option named 'failover', which  
provides users with the ability to set the failover property of the  
replication slot on the publisher when creating or altering a  
subscription.  
  
This uses the replication commands introduced by commit 7329240437 to  
enable the failover option for a logical replication slot.  
  
If the failover option is set to true, the associated replication slots  
(i.e. the main slot and the table sync slots) in the upstream database are  
enabled to be synchronized to the standbys. Note that the capability to  
sync the replication slots will be added in subsequent commits.  
  
Thanks to Masahiko Sawada for the design inputs.  
  
Author: Shveta Malik, Hou Zhijie, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/recovery/meson.build
A src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

pgcrypto: Fix check for buffer size

commit   : b527ebc1d37aa82b771dc9c76111bed1bce35a05    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Jan 2024 11:15:46 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 30 Jan 2024 11:15:46 +0100    

Click here for diff

The code copying the PGP block into the temp buffer failed to  
account for the extra 2 bytes in the buffer which are needed  
for the prefix. If the block was oversized, subsequent checks  
of the prefix would have exceeded the buffer size.  Since the  
block sizes are hardcoded in the list of supported ciphers it  
can be verified that there is no live bug here. Backpatch all  
the way for consistency though, as this bug is old.  
  
Author: Mikhail Gribkov <[email protected]>  
Discussion: https://postgr.es/m/CAMEv5_uWvcMCMdRFDsJLz2Q8g16HEa9xWyfrkr+FYMMFJhawOw@mail.gmail.com  
Backpatch-through: v12  

M contrib/pgcrypto/pgp-decrypt.c

Fix incorrect format placeholders for Oid

commit   : 4c48c0fe561c2b07831c2a296da637401cb953c6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2024 09:11:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 30 Jan 2024 09:11:41 +0100    

Click here for diff

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

Delay build of Memoize hash table until executor run

commit   : 57f59396bb51953bb7b957780c7f1b7f67602125    
  
author   : David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 12:37:03 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 12:37:03 +1300    

Click here for diff

Previously this hash table was built during executor startup.  This  
could cause long delays in EXPLAIN (without ANALYZE) when the planner  
opts to use a large Memoize hash table.  
  
No backpatch for now due to lack of complaints.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvoJktJ5XL=Kjh2a2TFr64R-7eQZV-+jcJrUwoES2GLiWg@mail.gmail.com  

M src/backend/executor/nodeMemoize.c

Doc: mention foreign keys can reference unique indexes

commit   : c85977d8fef7b18f69e0be72923ddb8dcc8165b5    
  
author   : David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 10:15:17 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 30 Jan 2024 10:15:17 +1300    

Click here for diff

We seem to have only documented a foreign key can reference the columns of  
a primary key or unique constraint.  Here we adjust the documentation  
to mention columns in a non-partial unique index can be mentioned too.  
  
The header comment for transformFkeyCheckAttrs() also didn't mention  
unique indexes, so fix that too.  In passing make that header comment  
reflect reality in the various other aspects where it deviated from it.  
  
Bug: 18295  
Reported-by: Gilles PARC  
Author: Laurenz Albe, David Rowley  
Discussion: https://www.postgresql.org/message-id/18295-0ed0fac5c9f7b17b%40postgresql.org  
Backpatch-through: 12  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/commands/tablecmds.c

Move is_valid_ascii() to ascii.h.

commit   : 97287bdfae41b8ea16b27dccb63771fcc196a55a    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 29 Jan 2024 12:08:57 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 29 Jan 2024 12:08:57 -0600    

Click here for diff

This function requires simd.h, which is a rather large dependency  
for a widely-used header file like pg_wchar.h.  Furthermore, there  
is a report of a third-party tool that is struggling to use  
pg_wchar.h due to its dependence on simd.h (presumably because  
simd.h uses several intrinsics).  Moving the function to the much  
less popular ascii.h resolves these issues for now.  
  
This commit is back-patched for the benefit of the aforementioned  
third-party tool.  The simd.h dependency was only added in v16,  
but we've opted to back-patch to v15 so that is_valid_ascii() lives  
in the same file for all versions where it exists.  This could  
break existing third-party code that uses the function, but we  
couldn't find any examples of such code.  It should be possible to  
fix any code that this commit breaks by including ascii.h in the  
file that uses is_valid_ascii().  
  
Author: Jubilee Young  
Reviewed-by: Tom Lane, John Naylor, Andres Freund, Eric Ridge  
Discussion: https://postgr.es/m/CAPNHn3oKJJxMsYq%2BqLYzVJOFrUcOr4OF1EC-KtFT-qh8nOOOtQ%40mail.gmail.com  
Backpatch-through: 15  

M src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/include/utils/ascii.h

Fix incompatibilities with libxml2 >= 2.12.0.

commit   : 400928b83bd254d20f0790d467f221bb52707e6e    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2024 12:06:07 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 29 Jan 2024 12:06:07 -0500    

Click here for diff

libxml2 changed the required signature of error handler callbacks  
to make the passed xmlError struct "const".  This is causing build  
failures on buildfarm member caiman, and no doubt will start showing  
up in the field quite soon.  Add a version check to adjust the  
declaration of xml_errorHandler() according to LIBXML_VERSION.  
  
2.12.x also produces deprecation warnings for contrib/xml2/xpath.c's  
assignment to xmlLoadExtDtdDefaultValue.  I see no good reason for  
that to still be there, seeing that we disabled external DTDs (at a  
lower level) years ago for security reasons.  Let's just remove it.  
  
Back-patch to all supported branches, since they might all get built  
with newer libxml2 once it gets a bit more popular.  (The back  
branches produce another deprecation warning about xpath.c's use of  
xmlSubstituteEntitiesDefault().  We ought to consider whether to  
back-patch all or part of commit 65c5864d7 to silence that.  It's  
less urgent though, since it won't break the buildfarm.)  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M src/backend/utils/adt/xml.c

Add EXPLAIN (MEMORY) to report planner memory consumption

commit   : 5de890e3610d5a12cdaea36413d967cf5c544e20    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 17:53:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 17:53:03 +0100    

Click here for diff

This adds a new "Memory:" line under the "Planning:" group (which  
currently only has "Buffers:") when the MEMORY option is specified.  
  
In order to make the reporting reasonably accurate, we create a separate  
memory context for planner activities, to be used only when this option  
is given.  The total amount of memory allocated by that context is  
reported as "allocated"; we subtract memory in the context's freelists  
from that and report that result as "used".  We use  
MemoryContextStatsInternal() to obtain the quantities.  
  
The code structure to show buffer usage during planning was not in  
amazing shape, so I (Álvaro) modified the patch a bit to clean that up  
in passing.  
  
Author: Ashutosh Bapat  
Reviewed-by: David Rowley, Andrey Lepikhov, Jian He, Andy Fan  
Discussion: https://www.postgresql.org/message-id/CAExHW5sZA=5LJ_ZPpRO-w09ck8z9p7eaYAqq3Ks9GDfhrxeWBw@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/commands/prepare.c
M src/backend/utils/mmgr/mcxt.c
M src/include/commands/explain.h
M src/include/utils/memutils.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Fix locking when fixing an incomplete split of a GIN internal page

commit   : 6a1ea02c491d16474a6214603dce40b5b122d4d1    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jan 2024 13:46:22 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 29 Jan 2024 13:46:22 +0200    

Click here for diff

ginFinishSplit() expects the caller to hold an exclusive lock on the  
buffer, but when finishing an earlier "leftover" incomplete split of  
an internal page, the caller held a shared lock. That caused an  
assertion failure in MarkBufferDirty(). Without assertions, it could  
lead to corruption if two backends tried to complete the split at the  
same time.  
  
On master, add a test case using the new injection point facility.  
  
Report and analysis by Fei Changhong. Backpatch the fix to all  
supported versions.  
  
Reviewed-by: Fei Changhong, Michael Paquier  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/gin/ginbtree.c
M src/test/modules/Makefile
A src/test/modules/gin/Makefile
A src/test/modules/gin/expected/gin_incomplete_splits.out
A src/test/modules/gin/meson.build
A src/test/modules/gin/sql/gin_incomplete_splits.sql
M src/test/modules/meson.build

commit   : 6d4565a05f3fb9b7a439e7ecfc2be68bf4dabf48    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 10:53:34 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 29 Jan 2024 10:53:34 +0100    

Click here for diff

In follow up commits we'll add more functions related to query  
cancellations.  This groups those all together instead of mixing them  
with the other functions in fe-connect.c.  
  
The formerly static parse_int_param() function had to be exported to  
other libpq users, so it's been renamed pqParseIntParam() and moved to a  
more reasonable place within fe-connect.c (rather than randomly between  
various keepalive-related routines).  
  
Author: Jelte Fennema-Nio <[email protected]>  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/interfaces/libpq/Makefile
A src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build

Doc: Fix incorrect reference to conflicting column in pg_replication_slots.

commit   : cf765ff824b8fef31f3c6b5489d2f9985909f6a9    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 12:13:39 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 12:13:39 +0530    

Click here for diff

Commit 007693f2a3 changes the existing 'conflicting' field to  
'conflict_reason' in pg_replication_slots but missed updating one of its  
existing references.  
  
Author: Hou Zhijie  
Discussion: https://postgr.es/m/OS0PR01MB571690299199ACA80F602D97947E2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Remove make function vpathsearch

commit   : 54fac0e50502765f66a9fad1ca8169b1cb75498e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2024 07:22:43 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 29 Jan 2024 07:22:43 +0100    

Click here for diff

This function served to support having prebuilt files in the source  
tree for vpath builds.  This is no longer possible (since  
721856ff24b); all built files are now always in the build tree.  The  
invocations of this function are no longer required.  

M doc/src/sgml/Makefile
M src/Makefile.global.in
M src/backend/catalog/Makefile

Fix comments in ReplicationSlotAcquire().

commit   : a9a47fb6d99785d5d272b408d251dca28b0879e3    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 10:12:58 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 10:12:58 +0530    

Click here for diff

They were incorrectly referring to a slot parameter in  
ReplicationSlotAcquire() which is not passed to the API.  
  
Author: Wang Wei  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/OS3PR01MB6275E3CE4DC15FF8B8B80D3A9E7A2@OS3PR01MB6275.jpnprd01.prod.outlook.com  

M src/backend/replication/slot.c

Allow setting failover property in the replication command.

commit   : 73292404370c9900a96e2bebdc7144f7010339cf    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 09:10:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 29 Jan 2024 09:10:00 +0530    

Click here for diff

This commit implements a new replication command called  
ALTER_REPLICATION_SLOT and a corresponding walreceiver API function named  
walrcv_alter_slot. Additionally, the CREATE_REPLICATION_SLOT command has  
been extended to support the failover option.  
  
These new additions allow the modification of the failover property of a  
replication slot on the publisher. A subsequent commit will make use of  
these commands in subscription commands and will add the tests as well to  
cover the functionality added/changed by this commit.  
  
Author: Hou Zhijie, Shveta Malik  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda, Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/protocol.sgml
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/nodes/replnodes.h
M src/include/replication/slot.h
M src/include/replication/walreceiver.h
M src/tools/pgindent/typedefs.list

Remove ReorderBufferTupleBuf structure.

commit   : 08e6344fd6423210b339e92c069bb979ba4e7cd6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Mon, 29 Jan 2024 10:37:16 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Mon, 29 Jan 2024 10:37:16 +0900    

Click here for diff

Since commit a4ccc1cef, the 'node' and 'alloc_tuple_size' fields of  
the ReorderBufferTupleBuf structure are no longer used. This leaves  
only the 'tuple' field in the structure. Since keeping a single-field  
structure makes little sense, the ReorderBufferTupleBuf is removed  
entirely. The code is refactored accordingly.  
  
No back-patching since these are ABI changes in an exposed structure  
and functions, and there would be some risk of breaking extensions.  
  
Author: Aleksander Alekseev  
Reviewed-by: Amit Kapila, Masahiko Sawada, Reid Thompson  
Discussion: https://postgr.es/m/CAD21AoCvnuxiXXfRecp7g9+CeC35POQfhuQeJFr7_9u_Q5jc_Q@mail.gmail.com  

M contrib/test_decoding/test_decoding.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list

Fix DROP ROLE when specifying duplicated roles

commit   : 50b797dc99ec3bf97ea5d0955a3b42d356c1522d    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 29 Jan 2024 08:05:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 29 Jan 2024 08:05:59 +0900    

Click here for diff

This commit fixes failures with "tuple already updated by self" when  
listing twice the same role and in a DROP ROLE query.  
  
This is an oversight in 6566133c5f52, that has introduced a two-phase  
logic in DropRole() where dependencies of all the roles to drop are  
removed in a first phase, with the roles themselves removed from  
pg_authid in a second phase.  
  
The code is simplified to not rely on a List of ObjectAddress built in  
the first phase used to remove the pg_authid entries in the second  
phase, switching to a list of OIDs.  Duplicated OIDs can be simply  
avoided in the first phase thanks to that.  Using ObjectAddress was not  
necessary for the roles as they are not used for anything specific to  
dependency.c, building all the ObjectAddress in the List with  
AuthIdRelationId as class ID.  
  
In 15 and older versions, where a single phase is used, DROP ROLE with  
duplicated role names would fail on "role \"blah\" does not exist" for  
the second entry after the CCI() done by the first deletion.  This is  
not really incorrect, but it does not seem worth changing based on a  
lack of complaints.  
  
Reported-by: Alexander Lakhin  
Reviewed-by: Tender Wang  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/backend/commands/user.c
M src/test/regress/expected/create_role.out
M src/test/regress/sql/create_role.sql

Attempt to fix newly added Memoize regression test

commit   : a3a836fb5e51183eae624d43225279306c2285b8    
  
author   : David Rowley <[email protected]>    
date     : Sat, 27 Jan 2024 11:17:35 +1300    
  
committer: David Rowley <[email protected]>    
date     : Sat, 27 Jan 2024 11:17:35 +1300    

Click here for diff

Both drongo and fairywren seem not to like a new regression test added  
by 2cca95e17.  These machines show a different number of actual rows in  
the EXPLAIN ANALYZE output.  Since the number of actual rows is divided by  
the number of loops, I suspect this might be due to some platform  
dependant rounding behavior as the total row count is 5 and the number of  
loops is 2.  drongo and fairywren seem to be calculating that 5.0 / 2.0 is  
3, whereas most other machines think the answer is 2.  
  
Here we tweak the test query's WHERE clause so it's 4.0 / 2.0 instead.  
There shouldn't be too much wiggle room for platform dependant-behavior to  
be a factor with those numbers.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/1035225.1706301718%40sss.pgh.pa.us  

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

Compare varnullingrels too in assign_param_for_var().

commit   : 5e444a2526cc6f4052ce0004e1df69135c47338a    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 15:54:17 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 15:54:17 -0500    

Click here for diff

Oversight in 2489d76c4.  Preliminary analysis suggests that the  
problem may be unreachable --- but if we did have instances of  
the same column with different varnullingrels, we'd surely need  
to treat them as different Params.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Detect Julian-date overflow in timestamp[tz]_pl_interval.

commit   : 25cd2d64021ae081cbcef1592e0ee04ddda2e975    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 13:39:37 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 26 Jan 2024 13:39:37 -0500    

Click here for diff

We perform addition of the days field of an interval via  
arithmetic on the Julian-date representation of the timestamp's date.  
This step is subject to int32 overflow, and we also should not let  
the Julian date become very negative, for fear of weird results from  
j2date.  (In the timestamptz case, allow a Julian date of -1 to pass,  
since it might convert back to zero after timezone rotation.)  
  
The additions of the months and microseconds fields could also  
overflow, of course.  However, I believe we need no additional  
checks there; the existing range checks should catch such cases.  
The difficulty here is that j2date's magic modular arithmetic could  
produce something that looks like it's in-range.  
  
Per bug #18313 from Christian Maurer.  This has been wrong for  
a long time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/timestamp.c
M src/test/regress/expected/horology.out
M src/test/regress/sql/horology.sql

Temporary patch to help debug pg_walsummary test failures.

commit   : 5ddf9973477729cf161b4ad0a1efd52f4fea9c88    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 13:25:19 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 13:25:19 -0500    

Click here for diff

The tests in 002_blocks.pl are failing in the buildfarm from time to  
time, but we don't know how to reproduce the failure elsewhere. The  
most obvious explanation seems to be the unexpected disappearance of a  
WAL summary file, so bump up the logging level in  
RemoveWalSummaryIfOlderThan to try to help us spot such problems, and  
print the cutoff time in addition to the removed filename. Also  
adjust 002_blocks.pl to dump out a directory listing of the relevant  
directory at various points.  
  
This patch should be reverted once we sort out what's happening here.  
  
Patch by me, reviewed by Nathan Bossart, who also reported the issue.  
  
Discussion: http://postgr.es/m/20240124170846.GA2643050@nathanxps13  

M src/backend/backup/walsummary.c
M src/bin/pg_walsummary/t/002_blocks.pl

Combine FSM updates for prune and no-prune cases.

commit   : 5eafacd2797dc0b04a0bde25fbf26bf79903e7c2    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 11:40:16 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 26 Jan 2024 11:40:16 -0500    

Click here for diff

lazy_scan_prune() and lazy_scan_noprune() update the freespace map  
with identical conditions; combine them. This consolidation is easier  
now that cb970240f13df2b63f0410f81f452179a2b78d6f moved visibility map  
updates into lazy_scan_prune().  
  
While combining the FSM updates, simplify the logic for calling  
lazy_scan_new_or_empty() and lazy_scan_noprune().  
  
Also update a few comemnts in this part of the code to make them,  
hopefully, clearer.  
  
Melanie Plageman and Robert Haas  
  
Discussion: https://postgr.es/m/CA%2BTgmoaLTvipm%3Dxx4rJLr07m908PCu%3DQH3uCjD1UOn8YaEuO2g%40mail.gmail.com  

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

Split some code out from MergeAttributes()

commit   : f7cf9494bad3aef1b2ba1cd84376a1e71797ac50    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 13:52:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 13:52:05 +0100    

Click here for diff

- Separate function to merge a child attribute into matching inherited  
  attribute: The logic to merge a child attribute into matching  
  inherited attribute in MergeAttribute() is only applicable to  
  regular inheritance child.  The code is isolated and coherent enough  
  that it can be separated into a function of its own.  
  
- Separate function to merge next parent attribute: Partitions inherit  
  from only a single parent.  The logic to merge an attribute from the  
  next parent into the corresponding attribute inherited from previous  
  parents in MergeAttribute() is only applicable to regular  
  inheritance children.  This code is isolated enough that it can be  
  separate into a function by itself.  
  
These separations makes MergeAttribute() more readable by making it  
easier to follow high level logic without getting entangled into  
details.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Make spelling of cancelled/cancellation consistent

commit   : 8c9da1441df18bd609f025778e8349873a3e9bbd    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jan 2024 12:38:15 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 26 Jan 2024 12:38:15 +0100    

Click here for diff

This fixes places where words derived from cancel were not using their  
common en-US ugly^H^H^H^Hspelling.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Reported-by: Thomas Munro <[email protected]>  
Discussion: https://postgr.es/m/CA+hUKG+Lrq+ty6yWXF5572qNQ8KwxGwG5n4fsEcCUap685nWvQ@mail.gmail.com  

M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/libpq.sgml
M src/backend/storage/lmgr/proc.c
M src/test/isolation/specs/detach-partition-concurrently-4.spec
M src/test/recovery/t/001_stream_rep.pl

MergeAttributes code deduplication

commit   : 64444ce071f6b04d3fc836f436fa08108a6d11e2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 09:04:27 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 26 Jan 2024 09:04:27 +0100    

Click here for diff

The code handling NOT NULL constraints is duplicated in blocks merging  
the attribute definition incrementally.  Deduplicate that code.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Reindex toast before its main relation in reindex_relation()

commit   : f2bf8fb04886e3ea82e7f7f86696ac78e06b7e60    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 17:39:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 17:39:58 +0900    

Click here for diff

This commit changes the order of reindex on a relation so as a toast  
relation is processed before its main relation.  
  
The original order, where a rebuild was first done for the indexes on  
the main table, could be a problem in the event of a corruption of a  
toast index, because, as scans of a toast index may be required to  
rebuild the indexes on the main relation, this could lead to failures  
with REINDEX TABLE without being able to fix anything.  
  
Rebuilding corrupted toast indexes before this change was possible but  
troublesome, as it was necessary to issue a REINDEX on the toast  
relation first, followed by a REINDEX on the main relation.  Changing  
the order of these operations should make things easier when rebuilding  
corrupted indexes, as toast indexes would be rebuilt before they are  
used for the indexes on the main relation.  
  
Per request from Richard Vesely.  
  
Author: Gurjeet Singh  
Reviewed-by: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c

De-dupicate Memoize cache keys

commit   : bc397e5cdb31c399392d693cbc5909341d21235a    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 20:51:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 20:51:36 +1300    

Click here for diff

It was possible when determining the cache keys for a Memoize path that  
if the same expr appeared twice in the parameterized path's ppi_clauses  
and/or in the Nested Loop's inner relation's lateral_vars.  If this  
happened the Memoize node's cache keys would contain duplicates.  This  
isn't a problem for correctness, all it means is that the cache lookups  
will be suboptimal due to having redundant work to do on every hash table  
lookup and insert.  
  
Here we adjust paraminfo_get_equal_hashops() to look for duplicates and  
ignore them when we find them.  
  
Author: David Rowley  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/422277.1706207562%40sss.pgh.pa.us  

M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/memoize.out

Fix comment in index.c

commit   : bd5760df38c0032bb94eb73df8a18ef74c4eff57    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 14:08:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 14:08:04 +0900    

Click here for diff

Extracted from a larger patch by the same author.  
  
Author: Gurjeet Singh  
Discussion: https://postgr.es/m/CABwTF4WX=m5pQvKXvLFJoEH=hSd6O=iZSqxVqHKjFm+iL-AO=w@mail.gmail.com  

M src/backend/catalog/index.c

Improve NestLoopParam generation for lateral subqueries

commit   : 2cca95e175463a7af95164498b889b1ea118583d    
  
author   : David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 16:18:58 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 26 Jan 2024 16:18:58 +1300    

Click here for diff

It was possible in cases where we had a LATERAL joined subquery that  
when the same Var is mentioned in both the lateral references and in the  
outer Vars of the scan clauses that the given Var wouldn't be assigned  
to the same NestLoopParam.  
  
This could cause issues in Memoize as the cache key would reference the  
Var for the scan clauses but when the parameter for the lateral references  
changed some code in Memoize would see that some other parameter had  
changed that's not part of the cache key and end up purging the entire  
cache as a result, thinking the cache had become stale.  This could  
result in a Nested Loop -> Memoize plan being quite inefficient as, in  
the worst case, the cache purging could result in never getting a cache  
hit.  In no cases could this problem lead to incorrect query results.  
  
Here we switch the order of operations so that we create NestLoopParam  
for the lateral references first before doing replace_nestloop_params().  
replace_nestloop_params() will find and reuse the existing NestLoopParam  
in cases where the Var exists in both locations.  
  
Author: Richard Guo  
Reviewed-by: Tom Lane, David Rowley  
Discussion: https://postgr.es/m/CAMbWs48XHJEK1Q1CzAQ7L9sTANTs9W1cepXu8%3DKc0quUL%2Btg4Q%40mail.gmail.com  

M src/backend/optimizer/plan/createplan.c
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql

Revert "Add support for parsing of large XML data (>= 10MB)"

commit   : f2743a7d70e7b2891277632121bb51e739743a47    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 10:15:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 26 Jan 2024 10:15:32 +0900    

Click here for diff

This reverts commit 2197d06224a1, following a discussion over a Coverity  
report where issues like the "Billion laugh attack" could cause the  
backend to waste CPU and memory even if a client applied checks on the  
size of the data given in input, and libxml2 does not offer guarantees  
that input limits are respected under XML_PARSE_HUGE.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/utils/adt/xml.c

Update comment, generation mem contexts have a "keeper" block

commit   : 376c216138c75e161d39767650ea30536f23b482    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jan 2024 01:04:58 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 26 Jan 2024 01:04:58 +0200    

Click here for diff

The keeper block was introduced in commit 1b0d9aa4f7, but it forgot  
to update this comment.  

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

Support TZ and OF format codes in to_timestamp().

commit   : 8ba6fdf905d0f5aef70ced4504c6ad297bfe08ea    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 17:47:08 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 17:47:08 -0500    

Click here for diff

Formerly, these were only supported in to_char(), but there seems  
little reason for that restriction.  We should at least have enough  
support to permit round-tripping the output of to_char().  
  
In that spirit, TZ accepts either zone abbreviations or numeric  
(HH or HH:MM) offsets, which are the cases that to_char() can output.  
In an ideal world we'd make it take full zone names too, but  
that seems like it'd introduce an unreasonable amount of ambiguity,  
since the rules for POSIX-spec zone names are so lax.  
  
OF is a subset of this, accepting only HH or HH:MM.  
  
One small benefit of this improvement is that we can simplify  
jsonpath's executeDateTimeMethod function, which no longer needs  
to consider the HH and HH:MM cases separately.  Moreover, letting  
it accept zone abbreviations means it will accept "Z" to mean UTC,  
which is emitted by JSON.stringify() for example.  
  
Patch by me, reviewed by Aleksander Alekseev and Daniel Gustafsson  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/datetime.h
M src/test/regress/expected/horology.out
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/sql/horology.sql
M src/test/regress/sql/jsonb_jsonpath.sql

Clean up a bug in sql/json items commit 66ea94e8e6

commit   : 06a66d87dbc7e06581af6765131ea250063fb4ac    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 16:21:57 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 16:21:57 -0500    

Click here for diff

Remove a buggy and unnecessary test, along with an unnecessary pstrdup()  
and a line of dead code.  
  
Per report, diagnosis and fix from Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

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

Doc: improve documentation for jsonpath behavior.

commit   : 7014c9a4bba2d1b67d60687afb5b2091c1d07f73    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 11:32:18 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 25 Jan 2024 11:32:18 -0500    

Click here for diff

Clarify the behavior of jsonpath operators and functions by  
describing their two different modes of operation explicitly.  
In addition to the SQL-spec behavior, where a path returns  
a list of matching items, we have a "predicate check" form  
that always returns a single boolean result.  That was mentioned  
in only one place, but it seems better to annotate each operator  
and function as to which form(s) it takes.  Also improve the  
examples by converting them into actual executable SQL with  
results, and do a bunch of incidental wordsmithing.  
  
David Wheeler, reviewed by Erik Wienhold, Jian He, and myself  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M doc/src/sgml/json.sgml

Implement various jsonpath methods

commit   : 66ea94e8e606529bb334515f388c62314956739e    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 10:15:43 -0500    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 25 Jan 2024 10:15:43 -0500    

Click here for diff

This commit implements ithe jsonpath .bigint(), .boolean(),  
.date(), .decimal([precision [, scale]]), .integer(), .number(),  
.string(), .time(), .time_tz(), .timestamp(), and .timestamp_tz()  
methods.  
  
.bigint() converts the given JSON string or a numeric value to  
the bigint type representation.  
  
.boolean() converts the given JSON string, numeric, or boolean  
value to the boolean type representation.  In the numeric case, only  
integers are allowed. We use the parse_bool() backend function  
to convert a string to a bool.  
  
.decimal([precision [, scale]]) converts the given JSON string  
or a numeric value to the numeric type representation.  If precision  
and scale are provided for .decimal(), then it is converted to the  
equivalent numeric typmod and applied to the numeric number.  
  
.integer() and .number() convert the given JSON string or a  
numeric value to the int4 and numeric type representation.  
  
.string() uses the datatype's output function to convert numeric  
and various date/time types to the string representation.  
  
The JSON string representing a valid date/time is converted to the  
specific date or time type representation using jsonpath .date(),  
.time(), .time_tz(), .timestamp(), .timestamp_tz() methods.  The  
changes use the infrastructure of the .datetime() method and perform  
the datatype conversion as appropriate.  Unlike the .datetime()  
method, none of these methods accept a format template and use ISO  
DateTime format instead.  However, except for .date(), the  
date/time related methods take an optional precision to adjust the  
fractional seconds.  
  
Jeevan Chalke, reviewed by Peter Eisentraut and Andrew Dunstan.  

M doc/src/sgml/func.sgml
M src/backend/catalog/sql_features.txt
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/include/utils/jsonpath.h
M src/test/regress/expected/jsonb_jsonpath.out
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql

Add a const decoration

commit   : 924d046dcf55887c98a1628675a30f4b0eebe556    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 13:34:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 13:34:49 +0100    

Click here for diff

Useful for a subsequent patch.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/parse_type.c
M src/include/parser/parse_type.h

Remove dummy_spinlock

commit   : 55627ba2d334ce98e1f5916354c46472d414bda6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:43:47 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:43:47 +0100    

Click here for diff

It's been unused since 1b468a131bd2 (2015).  

M src/backend/main/main.c
M src/backend/storage/lmgr/s_lock.c
M src/include/storage/s_lock.h

MergeAttributes: convert pg_attribute back to ColumnDef before comparing

commit   : 4d969b2f85e1fd00e860366f101fd3e3160aab41    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 10:54:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 10:54:35 +0100    

Click here for diff

MergeAttributes() has a loop to merge multiple inheritance parents  
into a column column definition.  The merged-so-far definition is  
stored in a ColumnDef node.  If we have to merge columns from multiple  
inheritance parents (if the name matches), then we have to check  
whether various column properties (type, collation, etc.) match.  The  
current code extracts the pg_attribute value of the  
currently-considered inheritance parent and compares it against the  
merged-so-far ColumnDef value.  If the currently considered column  
doesn't match any previously inherited column, we make a new ColumnDef  
node from the pg_attribute information and add it to the column list.  
  
This patch rearranges this so that we create the ColumnDef node first  
in either case.  Then the code that checks the column properties for  
compatibility compares ColumnDef against ColumnDef (instead of  
ColumnDef against pg_attribute).  This makes the code more symmetric  
and easier to follow.  Also, later in MergeAttributes(), there is a  
similar but separate loop that merges the new local column definition  
with the combination of the inheritance parents established in the  
first loop.  That comparison is already ColumnDef-vs-ColumnDef.  With  
this change, both of these can use similar-looking logic.  (A future  
project might be to extract these two sets of code into a common  
routine that encodes all the knowledge of whether two column  
definitions are compatible.  But this isn't currently straightforward  
because we want to give different error messages in the two cases.)  
Furthermore, by avoiding the use of Form_pg_attribute here, we make it  
easier to make changes in the pg_attribute layout without having to  
worry about the local needs of tablecmds.c.  
  
Because MergeAttributes() is hugely long, it's sometimes hard to know  
where in the function you are currently looking.  To help with that, I  
also renamed some variables to make it clearer where you are currently  
looking.  The first look is "prev" vs. "new", the second loop is "inh"  
vs. "new".  
  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Fix s_lock_test compile

commit   : 46778187f5373f6072b58d5e4c298b775333a37c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:13:38 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 25 Jan 2024 11:13:38 +0100    

Click here for diff

This is a mostly unused tool, but I discovered while nosing around the  
Makefile that it hasn't been kept in line with other changes.  Fix it.  
  
Backpatching doesn't appear to be necessary.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/Makefile
M src/backend/storage/lmgr/s_lock.c

Silence compiler warning introduced in 1edb3b491b

commit   : fba2112b1569fd001a9e54dfdd73fd3cb8f16140    
  
author   : Amit Langote <[email protected]>    
date     : Thu, 25 Jan 2024 17:11:27 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Thu, 25 Jan 2024 17:11:27 +0900    

Click here for diff

Reported-by: Richard Guo <[email protected]>  
Discussion: https://postgr.es/m/CAMbWs48qEoe9Du5tuUxrkGQ6VC9oy+tQOORQ6jpob14-E1Z+jg@mail.gmail.com  

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

Add more LOG messages when starting and ending recovery from a backup

commit   : 1d35f705e191581784e9df89bb69b7867ac9c342    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 25 Jan 2024 17:07:56 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 25 Jan 2024 17:07:56 +0900    

Click here for diff

Three LOG messages are added in the recovery code paths, providing  
information that can be useful to track corruption issues depending on  
the state of the cluster, telling that:  
- Recovery has started from a backup_label.  
- Recovery is restarting from a backup start LSN, without a  
backup_label.  
- Recovery has completed from a backup.  
  
Author: Andres Freund  
Reviewed-by: David Steele, Laurenz Albe, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Allow to enable failover property for replication slots via SQL API.

commit   : c393308b69d229b664391ac583b9e07418d411b6    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 25 Jan 2024 12:15:46 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 25 Jan 2024 12:15:46 +0530    

Click here for diff

This commit adds the failover property to the replication slot. The  
failover property indicates whether the slot will be synced to the standby  
servers, enabling the resumption of corresponding logical replication  
after failover. But note that this commit does not yet include the  
capability to sync the replication slot; the subsequent commits will add  
that capability.  
  
A new optional parameter 'failover' is added to the  
pg_create_logical_replication_slot() function. We will also enable to set  
'failover' option for slots via the subscription commands in the  
subsequent commits.  
  
The value of the 'failover' flag is displayed as part of  
pg_replication_slots view.  
  
Author: Hou Zhijie, Shveta Malik, Ajin Cherian  
Reviewed-by: Peter Smith, Bertrand Drouvot, Dilip Kumar, Masahiko Sawada, Nisha Moond, Kuroda, Hayato, Amit Kapila  
Discussion: https://postgr.es/m/[email protected]  

M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/sql/slot.sql
M doc/src/sgml/func.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Fix comment on gist_stratnum_btree

commit   : 86232a49a4373013056e8d38118339b8e7675ea0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 07:25:10 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 25 Jan 2024 07:25:10 +0100    

Click here for diff

We give results for <, <=, =, >=, and >, not just =. Because why not?  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/btree_gist.c

Remove redundant HandleWalWriterInterrupts().

commit   : a044e61f1b97ceb80a198c0ae22c07c35dda39eb    
  
author   : Fujii Masao <[email protected]>    
date     : Thu, 25 Jan 2024 12:50:08 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Thu, 25 Jan 2024 12:50:08 +0900    

Click here for diff

Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()  
became the same as HandleMainLoopInterrupts(). So this commit removes  
HandleWalWriterInterrupts() and makes walwriter use  
HandleMainLoopInterrupts() for improved code simplicity.  
  
Author: Fujii Masao  
Reviewed-by: Bharath Rupireddy, Nathan Bossart  
Discussion: https://postgr.es/m/CAHGQGwHUtwCsB4DnqFLiMiVzjcA=zmeCKf9_pgQM-yJopydatw@mail.gmail.com  

M src/backend/postmaster/walwriter.c

jit: Require at least LLVM 10.

commit   : 820b5af73dcc6a5d0db6a98a62a6b859e5d107b6    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 15:23:04 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 15:23:04 +1300    

Click here for diff

Remove support for older LLVM versions.  The default on common software  
distributions will be at least LLVM 10 when PostgreSQL 17 ships.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com  

M config/llvm.m4
M configure
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/include/jit/llvmjit.h
M src/include/pg_config.h.in

Add progress reporting of skipped tuples during COPY FROM.

commit   : 729439607ad210dbb446e31754e8627d7e3f7dda    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 25 Jan 2024 10:57:41 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 25 Jan 2024 10:57:41 +0900    

Click here for diff

9e2d870119 enabled the COPY command to skip malformed data, however  
there was no visibility into how many tuples were actually skipped  
during the COPY FROM.  
  
This commit adds a new "tuples_skipped" column to  
pg_stat_progress_copy view to report the number of tuples that were  
skipped because they contain malformed data.  
  
Bump catalog version.  
  
Author: Atsushi Torikoshi  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/d12fd8c99adcae2744212cb23feff6ed%40oss.nttdata.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/copyfrom.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out

Track LLVM 18 changes.

commit   : d282e88e50521a457fa1b36e55f43bac02a3167f    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 10:37:35 +1300    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 25 Jan 2024 10:37:35 +1300    

Click here for diff

A function was given a newly standard name from C++20 in LLVM 16.  Then  
LLVM 18 added a deprecation warning for the old name, and it is about to  
ship, so it's time to adjust that.  
  
Back-patch to all supported releases.  
  
Discussion: https://www.postgresql.org/message-id/CA+hUKGLbuVhH6mqS8z+FwAn4=5dHs0bAWmEMZ3B+iYHWKC4-ZA@mail.gmail.com  

M src/backend/jit/llvm/llvmjit_inline.cpp

Rename index "abc" in aggregates.sql

commit   : b91f918708283c1dc3dba8ff301f7d4b63c32e66    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 24 Jan 2024 21:41:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 24 Jan 2024 21:41:17 +0200    

Click here for diff

In order to prevent name collision with table "abc" in namespace.sql.  
  
Reported-by: Nathan Bossart  
Discussion: https://postgr.es/m/20240124173735.GA2708416%40nathanxps13  

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

Add temporal PRIMARY KEY and UNIQUE constraints

commit   : 46a0cd4cefb4d9b462d8cc4df5e7ecdd190bea92    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 24 Jan 2024 15:43:41 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 24 Jan 2024 15:43:41 +0100    

Click here for diff

Add WITHOUT OVERLAPS clause to PRIMARY KEY and UNIQUE constraints.  
These are backed by GiST indexes instead of B-tree indexes, since they  
are essentially exclusion constraints with = for the scalar parts of  
the key and && for the temporal part.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/Makefile
A contrib/btree_gist/expected/without_overlaps.out
M contrib/btree_gist/meson.build
A contrib/btree_gist/sql/without_overlaps.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/gist/gistutil.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/access/gist.h
M src/include/catalog/catversion.h
M src/include/catalog/index.h
M src/include/catalog/pg_constraint.h
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
A src/test/regress/expected/without_overlaps.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/without_overlaps.sql

Improve notation of BuiltinTrancheNames

commit   : 74a73063106583b1f49274a2cd1df42e35107361    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jan 2024 15:01:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 24 Jan 2024 15:01:30 +0100    

Click here for diff

Use C99 designated initializer syntax for array elements, instead of  
writing the position in a comment.  This is less verbose and much more  
readable.  Akin to cc150596341e.  
  
One disadvantage is that the BuiltinTrancheNames array now has a hole of  
51 NULLs -- previously, the array elements were shifted 51 elements  
 downward to avoid this.  This can be fixed by merging the  
IndividualLWLockNames array into BuiltinTrancheNames, which would occupy  
those 51 pointers, but because it requires some arguably ugly Meson  
hackery, it's left for later.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/storage/lmgr/lwlock.c

pgbench: Add \syncpipeline

commit   : 94edfe250c6a200d2067b0debfe00b4122e9b11e    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 16:55:19 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 16:55:19 +0900    

Click here for diff

This change adds a new meta-command called \syncpipeline to pgbench,  
able to send a sync message without flushing using the new libpq  
function PQsendPipelineSync().  
  
This meta-command is available within a block made of \startpipeline and  
\endpipeline.  
  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAO6_XqpcNhW6LZHLF-2NpPzdTbyMm4-RVkr3+AP5cOKSm9hrWA@mail.gmail.com  

M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Refactor code used by jsonpath executor to fetch variables

commit   : faa2b953ba3be0fac9af614ac14e34cf3a0a2c46    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:36 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:36 +0900    

Click here for diff

Currently, getJsonPathVariable() directly extracts a named  
variable/key from the source Jsonb value.  This commit puts that  
logic into a callback function called by getJsonPathVariable().  
Other implementations of the callback may accept different forms  
of the source value(s), for example, a List of values passed from  
outside jsonpath_exec.c.  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

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

Adjust populate_record_field() to handle errors softly

commit   : 1edb3b491bee373bdfcbfc1c2707b5428c2023b9    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:28 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:28 +0900    

Click here for diff

This adds a Node *escontext parameter to it and a bunch of functions  
downstream to it, replacing any ereport()s in that path by either  
errsave() or ereturn() as appropriate.  This also adds code to those  
functions where necessary to return early upon encountering a soft  
error.  
  
The changes here are mainly intended to suppress errors in the  
functions of jsonfuncs.c.  Functions in any external modules, such as  
arrayfuncs.c, that those functions may in turn call are not changed  
here based on the assumption that the various checks in jsonfuncs.c  
functions should ensure that only values that are structurally valid  
get passed to the functions in those external modules.  An exception  
is made for domain_check() to allow handling domain constraint  
violation errors softly.  
  
For testing, this adds a function jsonb_populate_record_valid(),  
which returns true if jsonb_populate_record() would finish without  
causing an error for the provided JSON object, false otherwise.  Note  
that jsonb_populate_record() internally calls populate_record(),  
which in turn uses populate_record_field().  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/utils/builtins.h
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Add soft error handling to some expression nodes

commit   : aaaf9449ec6be62cb0d30ed3588dc384f56274bf    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:22 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 24 Jan 2024 13:35:22 +0900    

Click here for diff

This adjusts the code for CoerceViaIO and CoerceToDomain expression  
nodes to handle errors softly.  
  
For CoerceViaIo, this adds a new ExprEvalStep opcode  
EEOP_IOCOERCE_SAFE, which is implemented in the new accompanying  
function ExecEvalCoerceViaIOSafe().  The only difference from  
EEOP_IOCOERCE's inline implementation is that the input function  
receives an ErrorSaveContext via the function's  
FunctionCallInfo.context, which it can use to handle errors softly.  
  
For CoerceToDomain, this simply entails replacing the ereport() in  
ExecEvalConstraintNotNull() and ExecEvalConstraintCheck() by  
errsave() passing it the ErrorSaveContext passed in the expression's  
ExprEvalStep.  
  
In both cases, the ErrorSaveContext to be used is passed by setting  
ExprState.escontext to point to it before calling ExecInitExprRec()  
on the expression tree whose errors are to be handled softly.  
  
Note that there's no functional change as of this commit as no call  
site of ExecInitExprRec() has been changed.  This is intended for  
implementing new SQL/JSON expression nodes in future commits.  
  
Extracted from a much larger patch to add SQL/JSON query functions.  
  
Author: Nikita Glukhov <[email protected]>  
Author: Teodor Sigaev <[email protected]>  
Author: Oleg Bartunov <[email protected]>  
Author: Alexander Korotkov <[email protected]>  
Author: Andrew Dunstan <[email protected]>  
Author: Amit Langote <[email protected]>  
  
Reviewers have included (in no particular order) Andres Freund,  
Alexander Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers,  
Zihong Yu, Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby,  
Álvaro Herrera, Jian He, Peter Eisentraut  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  
Discussion: https://postgr.es/m/CA+HiwqHROpf9e644D8BRqYvaAPmgBZVup-xKMDPk-nd4EpgzHw@mail.gmail.com  
Discussion: https://postgr.es/m/CA+HiwqE4XTdfb1nW=Ojoy_tQSRhYt-q_kb6i5d4xcKyrLC1Nbg@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h

Fix ALTER TABLE .. ADD COLUMN with complex inheritance trees

commit   : bb812ab0917e153f11bf449d7cb996815c07e387    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 14:20:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 24 Jan 2024 14:20:01 +0900    

Click here for diff

This command, when used to add a column on a parent table with a complex  
inheritance tree, tried to update multiple times the same tuple in  
pg_attribute for a child table when incrementing attinhcount, causing  
failures with "tuple already updated by self" because of a missing  
CommandCounterIncrement() between two updates.  
  
This exists for a rather long time, so backpatch all the way down.  
  
Reported-by: Alexander Lakhin  
Author: Tender Wang  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

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

Fix crash in autoprewarm.

commit   : bcd5b4bcbefc8b99be3678cf9c6c990a0c28f68e    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 23 Jan 2024 14:20:14 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 23 Jan 2024 14:20:14 -0600    

Click here for diff

Commit abb0b4fc03 moved the shared state for autoprewarm to a  
dynamic shared memory (DSM) segment, but it left apw_detach_shmem()  
in the on_shmem_exit callback list for the autoprewarm leader  
process.  This is a problem because shmem_exit() detaches all the  
DSM segments prior to calling the on_shmem_exit callbacks, thus  
producing segfaults in the exit path for the autoprewarm leader  
process.  
  
To fix, move apw_detach_shmem() to the before_shmem_exit callback  
list.  This commit also adds a check to pg_prewarm's test that the  
server shut down normally.  It might be worth making this a common  
check for all shutdowns in TAP tests, but that is left as a future  
exercise.  
  
Reported-by: Andres Freund  
Reviewed-by: Andres Freund, Álvaro Herrera  
Discussion: https://postgr.es/m/20240122204117.swton324xcoodnyi%40awork3.anarazel.de  

M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/t/001_basic.pl

Support shared libraries on Android (using make)

commit   : 79b03dbb3304539c6599593397c6a6b63b6a6ad9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:37:49 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:37:49 +0100    

Click here for diff

While the rest of the make build system maps Android to Linux, Android  
uses unversioned shared libraries (like "libpq.so").  This patch makes  
it so.  (Meson already supported it.)  
  
Reported-by: Matthias Kuhn <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M src/Makefile.shlib

meson: Map host_system android to linux

commit   : f4447af5b1a644af89e065410cdb12fe776cac47    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:07:05 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 20:07:05 +0100    

Click here for diff

This appears to be what is missing to support builds on Android (with  
meson).  
  
Author: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M meson.build

Fix makefiles for newly added files

commit   : 6eb6086faa3842c2a38a1ee2f97bf9a42ce27610    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 16:33:26 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 16:33:26 +0100    

Click here for diff

The new files added in 9b1a6f50b9 need to be mentioned in a few more  
places in the makefiles.  
  
Discussion: https://www.postgresql.org/message-id/flat/E1rSAY2-002hIk-4y%40gemulon.postgresql.org  

M src/include/Makefile

doc: Add acronym and glossary term for Access Method

commit   : 68387f9bdc82a56bf56945da3883a993bc40e2a5    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 23 Jan 2024 13:20:15 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 23 Jan 2024 13:20:15 +0100    

Click here for diff

AM was used throughout the documentation to denote Access Method, but  
the acronym was not described.  This adds an acronym entry as well as  
a glossary term which the acronym links to.  Each page which describe  
AMs have the first occurrence with <acronym> markup.  
  
Reported-by: [email protected]  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/btree.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/tableam.sgml

meson: portname was set too early

commit   : 4b4b3467ee36d11b6bf791731532ab962b0379be    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 12:15:21 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 12:15:21 +0100    

Click here for diff

portname is set to host_system, but host_system might still be changed  
later in the file.  As a consequence, platforms where host_system is  
changed later wouldn't find some of their platform-specific files  
(driven by portname), and the build would fail.  Move the assignment  
of portname further down after the last change of host_system (but  
before further overriding assignments to portname).  
  
Discussion: https://www.postgresql.org/message-id/flat/CAC7zN94TdsHhY88XkroJzSMx7E%3DBQpV9LKKjNSEnTM04ihoWCA%40mail.gmail.com  

M meson.build

Revert "libpqwalreceiver: Convert to libpq-be-fe-helpers.h"

commit   : 21ef4d4d897563adb2f7920ad53b734950f1e0a4    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jan 2024 10:38:07 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 23 Jan 2024 10:38:07 +0200    

Click here for diff

This reverts commit 728f86fec65537eade8d9e751961782ddb527934.  
  
The signal handling was a few bricks shy of a load in that commit,  
which made the walreceiver non-responsive to SIGTERM while it was  
waiting for the connection to be established. That prevented a standby  
from being promoted.  
  
Since it was non-essential refactoring, let's revert it to make v16  
work the same as earlier releases. I reverted it in 'master' too, to  
keep the branches in sync. The refactoring was a good idea as such,  
but it needs a bit more work. Once we have developed a complete patch  
with this issue fixed, let's re-apply that to 'master'.  
  
Reported-by: Kyotaro Horiguchi  
Backpatch-through: 16  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Generate syscache info from catalog files

commit   : 9b1a6f50b91dca6610932650c8c81a3c924259f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 07:13:38 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 23 Jan 2024 07:13:38 +0100    

Click here for diff

Add a new genbki macros MAKE_SYSCACHE that specifies the syscache ID  
macro, the underlying index, and the number of buckets.  From that, we  
can generate the existing tables in syscache.h and syscache.c via  
genbki.pl.  
  
Reviewed-by: John Naylor <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/catalog/.gitignore
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/genbki.pl
M src/backend/utils/cache/syscache.c
M src/include/catalog/.gitignore
M src/include/catalog/genbki.h
M src/include/catalog/meson.build
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/utils/syscache.h
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Improve stability of recovery test 035_standby_logical_decoding

commit   : 46d8587b504170ca14f064890bc7ccbbd7523f81    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 14:46:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 14:46:01 +0900    

Click here for diff

This commit tweaks a couple of things in 035_standby_logical_decoding to  
hopefully stabilize it:  
- Autovacuum is now disabled, as it could hold a global xmin with a  
transaction.  
- Conflicts are generated with command sequences that removed rows (on  
catalogs, shared or non-shared, or just plain relations) followed by a  
VACUUM.  This was unstable because these did not check that the horizon  
moved between the SQL commands and the VACUUM.  The logic is refactored  
as follows, to ensure that VACUUM removes dead rows before testing for  
slot invalidation on a standby (idea suggested by Andres Freund):  
-- Grab the current horizon.  
-- Launch SQL commands removing rows.  
-- Check that the snapshot horizon has been updated.  
-- Launch VACUUM on the relation whose rows have been removed by the  
first step.  
  
Note that there are still some issues because of standby snapshot WAL  
records generated by the bgwriter, but this makes the test much more  
stable.  
  
Per reports from buildfarm members dikkop and skink, with analysis and  
tests from Alexander Lakhin.  
  
While on it, fix a couple of incorrect comments.  
  
Author: Bertrand Drouvot  
Reviewed-by: Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/OSZPR01MB6310ED3CEDB531BCEDBC6AF2FD479@OSZPR01MB6310.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M src/test/recovery/t/035_standby_logical_decoding.pl

Add better handling of redundant IS [NOT] NULL quals

commit   : b262ad440edecda0b1aba81d967ab560a83acb8a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 23 Jan 2024 18:09:18 +1300    
  
committer: David Rowley <[email protected]>    
date     : Tue, 23 Jan 2024 18:09:18 +1300    

Click here for diff

Until now PostgreSQL has not been very smart about optimizing away IS  
NOT NULL base quals on columns defined as NOT NULL.  The evaluation of  
these needless quals adds overhead.  Ordinarily, anyone who came  
complaining about that would likely just have been told to not include  
the qual in their query if it's not required.  However, a recent bug  
report indicates this might not always be possible.  
  
Bug 17540 highlighted that when we optimize Min/Max aggregates the IS NOT  
NULL qual that the planner adds to make the rewritten plan ignore NULLs  
can cause issues with poor index choice.  That particular case  
demonstrated that other quals, especially ones where no statistics are  
available to allow the planner a chance at estimating an approximate  
selectivity for can result in poor index choice due to cheap startup paths  
being prefered with LIMIT 1.  
  
Here we take generic approach to fixing this by having the planner check  
for NOT NULL columns and just have the planner remove these quals (when  
they're not needed) for all queries, not just when optimizing Min/Max  
aggregates.  
  
Additionally, here we also detect IS NULL quals on a NOT NULL column and  
transform that into a gating qual so that we don't have to perform the  
scan at all.  This also works for join relations when the Var is not  
nullable by any outer join.  
  
This also helps with the self-join removal work as it must replace  
strict join quals with IS NOT NULL quals to ensure equivalence with the  
original query.  
  
Author: David Rowley, Richard Guo, Andy Fan  
Reviewed-by: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAApHDvqg6XZDhYRPz0zgOcevSMo0d3vxA9DvHrZtKfqO30WTnw@mail.gmail.com  
Discussion: https://postgr.es/m/17540-7aa1855ad5ec18b4%40postgresql.org  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/planmain.h
M src/test/regress/expected/equivclass.out
M src/test/regress/expected/join.out
A src/test/regress/expected/predicate.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/predicate.sql

ci: Enable injection points in builds

commit   : 183b6f73b04e41cd8468eab74ab191602c66617b    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 12:01:18 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 12:01:18 +0900    

Click here for diff

--enable-injection-points and -Dinjection_points=true are now given to  
the commands triggered by the tasks where assertions are enabled,  
providing coverage for injection points or any test using them.  
  
Author: Heikki Linnakangas  
Discussion: https://postgr.es/m/[email protected]  

M .cirrus.tasks.yml

Fix possible NULL pointer dereference in GetNamedDSMSegment().

commit   : 4372adfa24f2f5ddc587317d634b5389bd764106    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 22 Jan 2024 20:44:38 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 22 Jan 2024 20:44:38 -0600    

Click here for diff

GetNamedDSMSegment() doesn't check whether dsm_attach() returns  
NULL, which creates the possibility of a NULL pointer dereference  
soon after.  To fix, emit an ERROR if dsm_attach() returns NULL.  
This shouldn't happen, but it would be nice to avoid a segfault if  
it does.  In passing, tidy up the surrounding code.  
  
Reported-by: Tom Lane  
Reviewed-by: Michael Paquier, Bharath Rupireddy  
Discussion: https://postgr.es/m/3348869.1705854106%40sss.pgh.pa.us  

M src/backend/storage/ipc/dsm_registry.c

Fix ERROR message in injection_point.c

commit   : cdd863480c27b406ac14e94f1fe122b98ea562b4    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 10:45:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 23 Jan 2024 10:45:00 +0900    

Click here for diff

This commit fixes an error message that failed to show the correct  
function and library names when a function cannot be loaded.  
  
While on it, adjust the call to load_external_function() so as this  
ERROR can be reached, by making load_external_function() return NULL  
rather than fail if a function cannot be found for a given injection  
point.  
  
Thinkos in d86d20f0ba79.  

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

Fix two memcpy() bugs in the new injection point code

commit   : 0eb23285a2579591c09a591e5a52829f65665341    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Jan 2024 20:55:45 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 22 Jan 2024 20:55:45 +0200    

Click here for diff

1. The memcpy()s in InjectionPointAttach() would copy garbage from  
beyond the end of input string to the buffer in shared memory. You  
won't usually notice, but if there is not enough valid mapped memory  
beyond the end of the string, the read of unmapped memory will  
segfault. This was flagged by the Cirrus CI build with address  
sanitizer enabled.  
  
2. The memcpy() in injection_point_cache_add() failed to copy the NULL  
terminator.  
  
Discussion: https://www.postgresql.org/message-id/0615a424-b726-4157-afa7-4245629f9512%40iki.fi  

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

Abort pgbench if script end is reached with an open pipeline

commit   : 49f7c6c44a5f6a7f7b39d140e490c9c627511893    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:48:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:48:30 +0100    

Click here for diff

When a pipeline is opened with \startpipeline and not closed, pgbench  
will either error on the next transaction with a "already in pipeline  
mode" error or successfully end if this was the last transaction --  
despite not sending anything that was piped in the pipeline.  
  
Make it an error to reach end of script is reached while there's an  
open pipeline.  
  
Backpatch to 14, where pgbench got support for pipelines.  
  
Author: Anthonin Bonnefoy <[email protected]>  
Reported-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Test EXPLAIN (FORMAT JSON) ... XMLTABLE

commit   : 752533d40fd50de0b09d4b956cc32c38f5df2f05    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:14:19 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 22 Jan 2024 17:14:19 +0100    

Click here for diff

Also, add an alias to the XMLTABLE expression in an existing test.  This  
covers some code in explain.c that wasn't previously covered.  
  
I patched xml_2.out blindly :-(  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xml_2.out
M src/test/regress/sql/xml.sql

Make documentation builds reproducible

commit   : b0f0a9432d0b6f53634a96715f2666f6d4ea25a1    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2024 10:41:33 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 22 Jan 2024 10:41:33 +0100    

Click here for diff

Currently, the documentation builds are not fully reproducible (in the  
sense of https://reproducible-builds.org/).  A fix is available  
upstream (https://github.com/docbook/xslt10-stylesheets/issues/54) but  
not released.  This commit patches the upstream fix into our  
customization layer.  
  
This patch addresses both the HTML and the FO output.  The man output  
is already reproducible.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/stylesheet-fo.xsl
M doc/src/sgml/stylesheet-html-common.xsl

Re-disallow Memoize for parameterized nested loops with join filters

commit   : 2bcf0785cd1080b85f0d2ccd595b195970730491    
  
author   : David Rowley <[email protected]>    
date     : Mon, 22 Jan 2024 22:45:02 +1300    
  
committer: David Rowley <[email protected]>    
date     : Mon, 22 Jan 2024 22:45:02 +1300    

Click here for diff

This was previously fixed in 9e215378d but got broken again as a result  
of 2489d76c4.  It seems that commit causes ppi_clauses to contain  
duplicate clauses and it's no longer safe to check the list_length of  
that list to determine if there are join conditions other than what's  
mentioned in ppi_clauses.  
  
Here we adjust the check to count the distinct rinfo_serial mentioned in  
ppi_clauses.  We expect that extra->restrictlist won't have duplicate  
rinfo_serials.  
  
Reported-by: Amadeo Gallardo  
Author: Richard Guo  
Discussion: https://postgr.es/m/CADFREbW-BLJd7-a5J%2B5wjVumeFG1ByXiSOFzMtkmY_SDWckTxw%40mail.gmail.com  
Backpatch-through: 16, where 2489d76c4 was introduced.  

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

Fix some typos

commit   : b199eb89c67d737ced55721590f7fc8ff585e837    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:55:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:55:25 +0900    

Click here for diff

Author: Yongtao Huang  
Discussion: https://postgr.es/m/CAOe1Go1F99o5JsphtXdDC5bxm7AzetU8q3AxLh4AAVGKu1AzEQ@mail.gmail.com  

M src/backend/access/index/indexam.c
M src/backend/commands/explain.c
M src/backend/replication/logical/worker.c
M src/backend/utils/activity/wait_event.c
M src/test/modules/test_ginpostinglist/expected/test_ginpostinglist.out
M src/test/modules/test_ginpostinglist/sql/test_ginpostinglist.sql

Add test module injection_points

commit   : 49cd2b93d7dbceefdf9a71cc301d284a2dd234c3    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:32:28 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 13:32:28 +0900    

Click here for diff

This provides basic coverage for injection points within a single  
process, while providing some callbacks that can be used for other  
tests.  There are plans to extend this module later with more  
advanced capabilities for tests.  
  
Author: Michael Paquier, with comment fixes from Ashutosh Bapat.  
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip  
Kumar, Amul Sul, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/Makefile
A src/test/modules/injection_points/.gitignore
A src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/injection_points.out
A src/test/modules/injection_points/injection_points–1.0.sql
A src/test/modules/injection_points/injection_points.c
A src/test/modules/injection_points/injection_points.control
A src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/sql/injection_points.sql
M src/test/modules/meson.build

Add backend support for injection points

commit   : d86d20f0ba79451f19782dbb5fbf206746aaffd1    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 10:15:50 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 22 Jan 2024 10:15:50 +0900    

Click here for diff

Injection points are a new facility that makes possible for developers  
to run custom code in pre-defined code paths.  Its goal is to provide  
ways to design and run advanced tests, for cases like:  
- Race conditions, where processes need to do actions in a controlled  
ordered manner.  
- Forcing a state, like an ERROR, FATAL or even PANIC for OOM, to force  
recovery, etc.  
- Arbitrary sleeps.  
  
This implements some basics, and there are plans to extend it more in  
the future depending on what's required.  Hence, this commit adds a set  
of routines in the backend that allows developers to attach, detach and  
run injection points:  
- A code path calling an injection point can be declared with the macro  
INJECTION_POINT(name).  
- InjectionPointAttach() and InjectionPointDetach() to respectively  
attach and detach a callback to/from an injection point.  An injection  
point name is registered in a shmem hash table with a library name and a  
function name, which will be used to load the callback attached to an  
injection point when its code path is run.  
  
Injection point names are just strings, so as an injection point can be  
declared and run by out-of-core extensions and modules, with callbacks  
defined in external libraries.  
  
This facility is hidden behind a dedicated switch for ./configure and  
meson, disabled by default.  
  
Note that backends use a local cache to store callbacks already loaded,  
cleaning up their cache if a callback has found to be removed on a  
best-effort basis.  This could be refined further but any tests but what  
we have here was fine with the tests I've written while implementing  
these backend APIs.  
  
Author: Michael Paquier, with doc suggestions from Ashutosh Bapat.  
Reviewed-by: Ashutosh Bapat, Nathan Bossart, Álvaro Herrera, Dilip  
Kumar, Amul Sul, Nazir Bilal Yavuz  
Discussion: https://postgr.es/m/[email protected]  

M configure
M configure.ac
M doc/src/sgml/installation.sgml
M doc/src/sgml/xfunc.sgml
M meson.build
M meson_options.txt
M src/Makefile.global.in
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/misc/Makefile
A src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/meson.build
M src/include/pg_config.h.in
A src/include/utils/injection_point.h
M src/makefiles/meson.build
M src/tools/pgindent/typedefs.list

Fix table name collision in tests in 0452b461bc

commit   : c03d91d9be378975bcdbfa3e5d40e17288e6f13f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 23:26:41 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 23:26:41 +0200    

Click here for diff

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

Explore alternative orderings of group-by pathkeys during optimization.

commit   : 0452b461bc405e6d35d8a14c02813c15e28ae516    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:21:36 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:21:36 +0200    

Click here for diff

When evaluating a query with a multi-column GROUP BY clause, we can minimize  
sort operations or avoid them if we synchronize the order of GROUP BY clauses  
with the ORDER BY sort clause or sort order, which comes from the underlying  
query tree. Grouping does not imply any ordering, so we can compare  
the keys in arbitrary order, and a Hash Agg leverages this. But for Group Agg,  
we simply compared keys in the order specified in the query. This commit  
explores alternative ordering of the keys, trying to find a cheaper one.  
  
The ordering of group keys may interact with other parts of the query, some of  
which may not be known while planning the grouping. For example, there may be  
an explicit ORDER BY clause or some other ordering-dependent operation higher up  
in the query, and using the same ordering may allow using either incremental  
sort or even eliminating the sort entirely.  
  
The patch always keeps the ordering specified in the query, assuming the user  
might have additional insights.  
  
This introduces a new GUC enable_group_by_reordering so that the optimization  
may be disabled if needed.  
  
Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru  
Author: Andrei Lepikhov, Teodor Sigaev  
Reviewed-by: Tomas Vondra, Claudio Freire, Gavin Flower, Dmitry Dolgov  
Reviewed-by: Robert Haas, Pavel Borisov, David Rowley, Zhihong Yu  
Reviewed-by: Tom Lane, Alexander Korotkov, Richard Guo, Alena Rybakina  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/aggregates.sql
M src/tools/pgindent/typedefs.list

Generalize the common code of adding sort before processing of grouping

commit   : 7ab80ac1caf9f48064190802e1068ef89e2883c4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:19:47 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 21 Jan 2024 22:19:47 +0200    

Click here for diff

Extract the repetitive code pattern into a new function make_ordered_path().  
  
Discussion: https://postgr.es/m/CAPpHfdtzaVa7S4onKy3YvttF2rrH5hQNHx9HtcSTLbpjx%2BMJ%2Bw%40mail.gmail.com  
Author: Andrei Lepikhov  

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

Add hint about not qualifying UPDATE...SET target with relation name.

commit   : 58447e31890ace0d552a4bf693744bef3a5335e6    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 17:54:14 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 17:54:14 -0500    

Click here for diff

Target columns in UPDATE ... SET must not be qualified with the target  
table; we disallow this because it'd create ambiguity about which name  
is the column name in case of field-qualified names.  However, newbies  
have been seen to expect that they could qualify a target name just  
like other names.  The error message when they do is confusing:  
"column "foo" of relation "foo" does not exist".  To improve matters,  
issue a HINT if the invalid name is qualified and matches the  
relation's alias.  
  
James Coleman (editorialized a bit by me)  
  
Discussion: https://postgr.es/m/CAAaqYe8S2Qa060UV-YF5GoSd5PkEhLV94x-fEi3=TOtpaXCV+w@mail.gmail.com  

M src/backend/parser/analyze.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/update.out
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/update.sql

Add planner support functions for range operators <@ and @>.

commit   : 075df6b2080b13e0a5adc88737b7c24417a873c1    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 13:57:54 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 20 Jan 2024 13:57:54 -0500    

Click here for diff

These support functions will transform expressions with constant  
range values into direct comparisons on the range bound values,  
which are frequently better-optimizable.  The transformation is  
skipped however if it would require double evaluation of a  
volatile or expensive element expression.  
  
Along the way, add the range opfamily OID to range typcache entries,  
since load_rangetype_info has to compute that anyway and it seems  
silly to duplicate the work later.  
  
Kim Johan Andersson and Jian He, reviewed by Laurenz Albe  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/cache/typcache.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/typcache.h
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/rangetypes.sql

Teach autoprewarm to use the dynamic shared memory registry.

commit   : abb0b4fc03fcf5a0ca786bd88c357bf9213aa6e1    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:43:59 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:43:59 -0600    

Click here for diff

Besides showcasing the DSM registry, this prevents pg_prewarm from  
stealing from the main shared memory segment's extra buffer space  
when autoprewarm_start_worker() and autoprewarm_dump_now() are used  
without loading the module via shared_preload_libraries.  
  
Suggested-by: Michael Paquier  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M contrib/pg_prewarm/autoprewarm.c

Introduce the dynamic shared memory registry.

commit   : 8b2bcf3f287c79eaebf724cba57e5ff664b01e06    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:24:36 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 14:24:36 -0600    

Click here for diff

Presently, the most straightforward way for a shared library to use  
shared memory is to request it at server startup via a  
shmem_request_hook, which requires specifying the library in  
shared_preload_libraries.  Alternatively, the library can create a  
dynamic shared memory (DSM) segment, but absent a shared location  
to store the segment's handle, other backends cannot use it.  This  
commit introduces a registry for DSM segments so that these other  
backends can look up existing segments with a library-specified  
string.  This allows libraries to easily use shared memory without  
needing to request it at server startup.  
  
The registry is accessed via the new GetNamedDSMSegment() function.  
This function handles allocating the segment and initializing it  
via a provided callback.  If another backend already created and  
initialized the segment, it simply attaches the segment.  
GetNamedDSMSegment() locks the registry appropriately to ensure  
that only one backend initializes the segment and that all other  
backends just attach it.  
  
The registry itself is comprised of a dshash table that stores the  
DSM segment handles keyed by a library-specified string.  
  
Reviewed-by: Michael Paquier, Andrei Lepikhov, Nikita Malakhov, Robert Haas, Bharath Rupireddy, Zhang Mingli, Amul Sul  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/Makefile
A src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/utils/activity/wait_event_names.txt
A src/include/storage/dsm_registry.h
M src/include/storage/lwlock.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_dsm_registry/.gitignore
A src/test/modules/test_dsm_registry/Makefile
A src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
A src/test/modules/test_dsm_registry/meson.build
A src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
A src/test/modules/test_dsm_registry/test_dsm_registry–1.0.sql
A src/test/modules/test_dsm_registry/test_dsm_registry.c
A src/test/modules/test_dsm_registry/test_dsm_registry.control
M src/tools/pgindent/typedefs.list

doc: Reorganize section for shared memory and LWLocks.

commit   : 964152c476f25ada4c5832a014999ec2d2980358    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 11:18:32 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 19 Jan 2024 11:18:32 -0600    

Click here for diff

Presently, this section meanders through a few different features,  
and the text itself is terse.  This commit attempts to improve  
matters by splitting the section into smaller sections and by  
expanding the text for clarity.  This is preparatory work for a  
follow-up commit that will introduce a way for libraries to use  
shared memory without needing to request it at startup time.  
  
Reviewed-by: Aleksander Alekseev, Bharath Rupireddy, Abhijit Menon-Sen  
Discussion: https://postgr.es/m/20240112041430.GA3557928%40nathanxps13  
Discussion: https://postgr.es/m/20231205034647.GA2705267%40nathanxps13  

M doc/src/sgml/xfunc.sgml

Fix name collision in c64086b79dba

commit   : 448a3331d9ab3094183cea59f601b6f2f7f7c48a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 18:13:33 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 18:13:33 +0200    

Click here for diff

Reported-by: Erik Rijkers, Tom Lane  
Discussion: https://postgr.es/m/E1rQqeS-002A0s-Qm%40gemulon.postgresql.org  

M src/backend/storage/ipc/procarray.c

doc: Update compiler for FreeBSD specific instructions

commit   : b2a296b0cf731b5a26a784cefaed7f013ed3d6e7    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Jan 2024 16:27:27 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Fri, 19 Jan 2024 16:27:27 +0100    

Click here for diff

FreeBSD has since v13 switched to Clang from GCC, so update our  
instructions to cc instead of gcc to reflect that.  
  
Reported-by: [email protected]  
Discussion: https://postgr.es/m/CAJR80-xzR49jEkAC98Yo-wuSdFDV2=2H4j9Z2AukSVU=-UpynA@mail.gmail.com  

M doc/src/sgml/dfunc.sgml

Reorder actions in ProcArrayApplyRecoveryInfo()

commit   : c64086b79dbad19e4ee0af8d19e835111aa87bd5    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 17:19:17 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 17:19:17 +0200    

Click here for diff

Since 5a1dfde8334b, 2PC filenames use FullTransactionId.  Thus, it needs to  
convert TransactionId to FullTransactionId in StandbyTransactionIdIsPrepared()  
using TransamVariables->nextXid.  However, ProcArrayApplyRecoveryInfo()  
first releases locks with usage StandbyTransactionIdIsPrepared(), then advances  
TransamVariables->nextXid.  This sequence of actions could cause errors.  
This commit makes ProcArrayApplyRecoveryInfo() advance  
TransamVariables->nextXid before releasing locks.  
  
Reported-by: Thomas Munro, Michael Paquier  
Discussion: https://postgr.es/m/CA%2BhUKGLj_ve1_pNAnxwYU9rDcv7GOhsYXJt7jMKSA%3D5-6ss-Cw%40mail.gmail.com  
Discussion: https://postgr.es/m/Zadp9f4E1MYvMJqe%40paquier.xyz  

M src/backend/storage/ipc/procarray.c

Add stratnum GiST support function

commit   : 6db4598fcb82a87a683c4572707e522504830a2b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2024 15:41:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 19 Jan 2024 15:41:44 +0100    

Click here for diff

This is support function 12 for the GiST AM and translates  
"well-known" RT*StrategyNumber values into whatever strategy number is  
used by the opclass (since no particular numbers are actually  
required).  We will use this to support temporal PRIMARY  
KEY/UNIQUE/FOREIGN KEY/FOR PORTION OF functionality.  
  
This commit adds two implementations, one for internal GiST opclasses  
(just an identity function) and another for btree_gist opclasses.  It  
updates btree_gist from 1.7 to 1.8, adding the support function for  
all its opclasses.  
  
Author: Paul A. Jungwirth <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.7–1.8.sql
M contrib/btree_gist/btree_gist.c
M contrib/btree_gist/btree_gist.control
A contrib/btree_gist/expected/stratnum.out
M contrib/btree_gist/meson.build
A contrib/btree_gist/sql/stratnum.sql
M doc/src/sgml/gist.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvalidate.c
M src/include/access/gist.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Rename COPY option from SAVE_ERROR_TO to ON_ERROR

commit   : b725b7eec431f7394d63abe621170efe3fcdcda4    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 15:08:40 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 19 Jan 2024 15:08:40 +0200    

Click here for diff

The option names now are "stop" (default) and "ignore".  The future options  
could be "file 'filename.log'" and "table 'tablename'".  
  
Discussion: https://postgr.es/m/20240117.164859.2242646601795501168.horikyota.ntt%40gmail.com  
Author: Jian He  
Reviewed-by: Atsushi Torikoshi  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list

Fixed misspelled byteswap function for big endian machines

commit   : dd0a0cfc81fecacf2aed41b9eb138f850e43aab6    
  
author   : John Naylor <[email protected]>    
date     : Fri, 19 Jan 2024 13:26:18 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 19 Jan 2024 13:26:18 +0700    

Click here for diff

Per members lora and mamba  

M src/include/common/hashfn_unstable.h

Add optimized C string hashing

commit   : 0aba2554409ee3251d7558567edd114d8ed36dcc    
  
author   : John Naylor <[email protected]>    
date     : Tue, 16 Jan 2024 16:32:48 +0700    
  
committer: John Naylor <[email protected]>    
date     : Tue, 16 Jan 2024 16:32:48 +0700    

Click here for diff

Given an already-initialized hash state and a NUL-terminated string,  
accumulate the hash of the string into the hash state and return the  
length for the caller to (optionally) save for the finalizer. This  
avoids a strlen call.  
  
If the string pointer is aligned, we can use a word-at-a-time  
algorithm for NUL lookahead. The aligned case is only used on 64-bit  
platforms, since it's not worth the extra complexity for 32-bit.  
  
Handling the tail of the string after finishing the word-wise loop  
was inspired by NetBSD's strlen(), but no code was taken since that  
is written in assembly language.  
  
As demonstration, use this in the search path cache. This brings the  
general case performance closer to the special case optimization done  
in commit a86c61c9ee. There are other places that could benefit, but  
that is left for future work.  
  
Jeff Davis and John Naylor  
Reviewed by Heikki Linnakangas, Jian He, Junwang Zhao  
  
Discussion: https://postgr.es/m/3820f030fd008ff14134b3e9ce5cc6dd623ed479.camel%40j-davis.com  
Discussion: https://postgr.es/m/b40292c99e623defe5eadedab1d438cf51a4107c.camel%40j-davis.com  

M src/backend/catalog/namespace.c
M src/include/common/hashfn_unstable.h

Add inline incremental hash functions for in-memory use

commit   : e97b672c88f6e5938a2b81021bd4b590b013976f    
  
author   : John Naylor <[email protected]>    
date     : Mon, 27 Nov 2023 17:03:38 +0700    
  
committer: John Naylor <[email protected]>    
date     : Mon, 27 Nov 2023 17:03:38 +0700    

Click here for diff

It can be useful for a hash function to expose separate initialization,  
accumulation, and finalization steps.  In particular, this is useful  
for building inline hash functions for simplehash.  Instead of trying  
to whack around hash_bytes while maintaining its current behavior on  
all platforms, we base this work on fasthash (MIT licensed) which  
is simple, faster than hash_bytes for inputs over 12 bytes long,  
and also passes the hash function testing suite SMHasher.  
  
The fasthash functions have been reimplemented using our added-on  
incremental interface to validate that this method will still give  
the same answer, provided we have the input length ahead of time.  
  
This functionality lives in a new header hashfn_unstable.h. The name  
implies we have the freedom to change things across versions that  
would be unacceptable for our other hash functions that are used for  
e.g. hash indexes and hash partitioning. As such, these should only  
be used for in-memory data structures like hash tables. There is also  
no guarantee of being independent of endianness or pointer size.  
  
As demonstration, use fasthash for pgstat_hash_hash_key.  Previously  
this called the 32-bit murmur finalizer on the three elements,  
then joined them with hash_combine(). The new function is simpler,  
faster and takes up less binary space. While the collision and bias  
behavior were almost certainly fine with the previous coding, now we  
have objective confidence of that.  
  
There are other places that could benefit from this, but that is left  
for future work.  
  
Reviewed by Jeff Davis, Heikki Linnakangas, Jian He, Junwang Zhao  
Credit to Andres Freund for the idea  
  
Discussion: https://postgr.es/m/20231122223432.lywt4yz2bn7tlp27%40awork3.anarazel.de  

A src/include/common/hashfn_unstable.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

psql: Add ignore_slash_options in bind's inactive branch

commit   : 04c0897d3bcafe4ca61967d5ab1b5669f3cbe80b    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 14:18:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 14:18:20 +0900    

Click here for diff

All commands accepting arguments, handling them with OT_NORMAL, OT_SQLID  
or OT_SQLIDHACK, should call ignore_slash_options() in inactive branch  
to scan and discard extra arguments.  All the backslash commands that  
handle arguments do so, except \bind.  
  
This commit adds the missing ignore_slash_options to \bind's inactive  
branch.  This inconsistency is a logic bug, however the behavior happens  
to be unchanged as any extra arguments are discarded later in  
HandleSlashCmds(), so no backpatch is done.  
  
While on it, this adds \bind to the list of backslash commands where  
inactive \if branches are checked in the tests for psql.  
  
Reported-by: Jelte Fennema-Nio  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAGECzQR1+udGKz+FbHiCQ7CWDiF1fCGi2xYuvQUODdMAfJbaLA@mail.gmail.com  

M src/bin/psql/command.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Fix incorrect placeholder in walreceiver.c

commit   : 3ada0d2cae4d9d3e045c72e3ee0b37ccb6e13902    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 13:20:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 19 Jan 2024 13:20:49 +0900    

Click here for diff

Author: Yongtao Huang  
Discussion: https://postgr.es/m/CAOe1Go3H7CgrSceO+HBhnoptk-mJhii-YT8D19CikKintjwumQ@mail.gmail.com  

M src/backend/replication/walreceiver.c

Improve some documentation about the bootstrap superuser.

commit   : d891dcc065a2b590102ec75121828fed97acf9ba    
  
author   : Nathan Bossart <[email protected]>    
date     : Thu, 18 Jan 2024 21:39:51 -0600    
  
committer: Nathan Bossart <[email protected]>    
date     : Thu, 18 Jan 2024 21:39:51 -0600    

Click here for diff

This commit adds some notes about the inability to remove superuser  
privileges from the bootstrap superuser.  This has been blocked  
since commit e530be2c5c, but it wasn't intended be a supported  
feature before that, either.  
  
In passing, change "bootstrap user" to "bootstrap superuser" in a  
couple places.  
  
Author: Yurii Rashkovskii  
Reviewed-by: Vignesh C, David G. Johnston  
Discussion: https://postgr.es/m/CA%2BRLCQzSx_eTC2Fch0EzeNHD3zFUcPvBYOoB%2BpPScFLch1DEQw%40mail.gmail.com  

M doc/src/sgml/glossary.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/commands/user.c

Fix buildfarm error from commit 5c31669058.

commit   : dd3ca8cbb0141f158545e9ecdd12c89279942e36    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 18 Jan 2024 14:59:59 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 18 Jan 2024 14:59:59 -0800    

Click here for diff

Skip test when not using unix domain sockets.  
  
Discussion: https://postgr.es/m/CALDaNm29-8OozsBWo9H6DN_Tb_3yA1QjRJput-KhaN8ncDJtJA@mail.gmail.com  
Backpatch-through: 16  

M src/test/subscription/t/027_nosuperuser.pl

Fix broken Bitmapset optimization in DiscreteKnapsack()

commit   : 4b310636439da432c473e0e85de661b3342bb745    
  
author   : David Rowley <[email protected]>    
date     : Fri, 19 Jan 2024 10:44:36 +1300    
  
committer: David Rowley <[email protected]>    
date     : Fri, 19 Jan 2024 10:44:36 +1300    

Click here for diff

Some code in DiscreteKnapsack() attempted to zero all words in a  
Bitmapset by performing bms_del_members() to delete all the members from  
itself before replacing those members with members from another set.  
When that code was written, this was a valid way to manipulate the set  
in such a way to save from palloc having to be called to allocate a new  
Bitmapset.  However, 00b41463c modified Bitmapsets so that an empty set is  
*always* represented as NULL and this breaks the optimization as the  
Bitmapset code will always pfree the memory when the set becomes empty.  
  
Since DiscreteKnapsack() has been coded to avoid as many unneeded  
allocations as possible, it seems risky to not fix this.  Here we add  
bms_replace_members() to effectively perform an in-place copy of another  
set, reusing the memory of the existing set, when possible.  
  
This got broken in v16, but no backpatch for now as there've been no  
complaints.  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/CAApHDvoTCBkBU2PJghNOFUiO0q=QP4WAWHi5sJP6_4=b2WodrA@mail.gmail.com  

M src/backend/lib/knapsack.c
M src/backend/nodes/bitmapset.c
M src/include/nodes/bitmapset.h

Fix plpgsql to allow new-style SQL CREATE FUNCTION as a SQL command.

commit   : 57b440ec115f57ff6e6a3f0df26063822e3123d2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2024 16:10:57 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 18 Jan 2024 16:10:57 -0500    

Click here for diff

plpgsql fails on new-style CREATE FUNCTION/PROCEDURE commands within  
a routine or DO block, because make_execsql_stmt believes that a  
semicolon token always terminates a SQL command.  Now, that's actually  
been wrong since the day it was written, because CREATE RULE has long  
allowed multiple rule actions separated by semicolons.  But there are  
few enough people using multi-action rules that there was never an  
attempt to fix it.  New-style SQL functions, though, are popular.  
  
psql has this same problem of "does this semicolon really terminate  
the command?".  It deals with CREATE RULE by counting parenthesis  
nesting depth: a semicolon within parens doesn't end a command.  
Commits e717a9a18 and 029c5ac03 created a similar heuristic to count  
matching BEGIN/END pairs (but only within CREATEs, so as not to be  
fooled by plain BEGIN).  That's survived several releases now without  
trouble reports, so let's just absorb those heuristics into plpgsql.  
  
Per report from Samuel Dussault.  Back-patch to v14 where new-style  
SQL function syntax came in.  
  
Discussion: https://postgr.es/m/YT2PR01MB88552C3E9AD40A6C038774A781722@YT2PR01MB8855.CANPRD01.PROD.OUTLOOK.COM  

M src/pl/plpgsql/src/Makefile
A src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_gram.y
A src/pl/plpgsql/src/sql/plpgsql_misc.sql

Remove LVPagePruneState.

commit   : e313a611370410f4efe4e816767759870b69dfa6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 15:17:09 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 15:17:09 -0500    

Click here for diff

Commit cb970240f13df2b63f0410f81f452179a2b78d6f moved some code from  
lazy_scan_heap() to lazy_scan_prune(), and now some things that used to  
need to be passed back and forth are completely local to lazy_scan_prune().  
Hence, this struct is mostly obsolete.  The only thing that still  
needs to be passed back to the caller is has_lpdead_items, and that's  
also passed back by lazy_scan_noprune(), so do it the same way in both  
cases.  
  
Melanie Plageman, reviewed and slightly revised by me.  
  
Discussion: http://postgr.es/m/CAAKRu_aM=OL85AOr-80wBsCr=vLVzhnaavqkVPRkFBtD0zsuLQ@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/tools/pgindent/typedefs.list

Move VM update code from lazy_scan_heap() to lazy_scan_prune().

commit   : cb970240f13df2b63f0410f81f452179a2b78d6f    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 14:44:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 14:44:57 -0500    

Click here for diff

Most of the output parameters of lazy_scan_prune() were being  
used to update the VM in lazy_scan_heap(). Moving that code into  
lazy_scan_prune() simplifies lazy_scan_heap() and requires less  
communication between the two.  
  
This change permits some further code simplification, but that  
is left for a separate commit.  
  
Melanie Plageman, reviewed by me.  
  
Discussion: http://postgr.es/m/CAAKRu_aM=OL85AOr-80wBsCr=vLVzhnaavqkVPRkFBtD0zsuLQ@mail.gmail.com  

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

Clarify language in incremental backup glossary entry.

commit   : 0a157a4d441586a0e590e2f8a3839114e01df4b7    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:09:38 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:09:38 -0500    

Click here for diff

These changes were intended to be included in commit  
7b1dbf0a8d1d4e1e6d01a76dc45a3216e8a16d94, but I goofed.  

M doc/src/sgml/glossary.sgml

Optimize vacuuming of relations with no indexes.

commit   : c120550edb86b8e0d785063501c259e29aa80eb6    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:03:42 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 10:03:42 -0500    

Click here for diff

If there are no indexes on a relation, items can be marked LP_UNUSED  
instead of LP_DEAD when pruning. This significantly reduces WAL  
volume, since we no longer need to emit one WAL record for pruning  
and a second to change the LP_DEAD line pointers thus created to  
LP_UNUSED.  
  
Melanie Plageman, reviewed by Andres Freund, Peter Geoghegan, and me  
  
Discussion: https://postgr.es/m/CAAKRu_bgvb_k0gKOXWzNKWHt560R0smrGe3E8zewKPs8fiMKkw%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

More documentation updates for incremental backup.

commit   : 7b1dbf0a8d1d4e1e6d01a76dc45a3216e8a16d94    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 09:25:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 18 Jan 2024 09:25:28 -0500    

Click here for diff

Add new terms to glossary. Add a reference to walsummarizer  
to monitoring.sgml.  
  
Matthias van de Meent and Robert Haas  
  
Discussion: http://postgr.es/m/CAEze2WjhdVCqEe_qqEok3NA6DwUdOGSBjAxzmYdAqiaaH1uRcg@mail.gmail.com  

M doc/src/sgml/glossary.sgml
M doc/src/sgml/monitoring.sgml

Rework text in replication slots documentation

commit   : 27d04ed5310ad33dd3364322ae53ea685b28a8b6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 18 Jan 2024 11:30:53 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 18 Jan 2024 11:30:53 +0100    

Click here for diff

This is cosmetic, so no backpatch.  
  
Reviewed-by: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/high-availability.sgml

Error message capitalisation

commit   : ed1e0a65127a61f7c9497aac6016324f250bc0e9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 09:35:12 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 09:35:12 +0100    

Click here for diff

per style guidelines  
  
Author: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPtzstExQ4%3DvFH%2BWzZ4g4xEx2JA%3DqxussxOdxVEwJce6bw%40mail.gmail.com  

M contrib/pg_surgery/heap_surgery.c
M src/backend/commands/event_trigger.c
M src/backend/storage/file/fd.c
M src/backend/tcop/postgres.c
M src/backend/utils/error/elog.c
M src/bin/pgbench/t/001_pgbench_with_server.pl

Fix an issue in PostgreSQL::Test::Cluster:psql()

commit   : 686db12de3a01222de6bce56f40f4fb9259f7b37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 08:46:42 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 18 Jan 2024 08:46:42 +0100    

Click here for diff

Due to the commit c5385929 which made all Perl warnings to fatal, use  
of PostgreSQL::Test::Cluster:psql() and safe_psql() with timeout  
started to fail with the following error:  
  
Use of uninitialized value $ret in bitwise and (&) at  
..src/test/perl/PostgreSQL/Test/Cluster.pm line 2015.  
  
Fix that by placing $ret conversion code in psql() in an if (defined  
$ret) block.  
  
With this change, the behavior of psql() becomes same as before, that  
is, the whole function returns undef on timeout, which is usefully  
different from returning 0.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org  

M src/test/perl/PostgreSQL/Test/Cluster.pm

Improve handling of dropped partitioned indexes for REINDEX INDEX

commit   : 0ae3b466210316ebedbe123b64b46ac2dc1fc04f    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 16:30:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 16:30:11 +0900    

Click here for diff

A REINDEX INDEX done on a partitioned index builds a list of the indexes  
to work on before processing its partitions in individual transactions.  
When combined with a DROP of the partitioned index, there was a window  
where it was possible to see some unexpected "could not open relation  
with OID", synonym of relation lookup error.  The code was robust enough  
to handle the case where the parent relation is missing, but not the  
case where an index would be gone missing.  
  
This is similar to 1d65416661bb.  
  
Support for REINDEX on partitioned relations has been introduced in  
a6642b3ae060, so backpatch down to 14.  
  
Author: Fei Changhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/catalog/index.c

Add try_index_open(), conditional variant of index_open()

commit   : 8013850c853db67ee753e5b730231cfad846b806    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 15:04:24 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 15:04:24 +0900    

Click here for diff

try_index_open() is able to open an index if its relkind fits, except  
that it would return NULL instead of generated an error if the relation  
does not exist.  This new routine will be used by an upcoming patch to  
make REINDEX on partitioned relations more robust when an index in a  
partition tree is dropped.  
  
Extracted from a larger patch by the same author.  
  
Author: Fei Changhong  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 14  

M src/backend/access/index/indexam.c
M src/include/access/genam.h

seg: Add test "security" in meson.build

commit   : 2f35c14cfb3dadede883a7d8f458e5a15f13a97b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 10:12:44 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 18 Jan 2024 10:12:44 +0900    

Click here for diff

Oversight in 681d9e4621aa where the test has been added.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

M contrib/seg/meson.build

Remove the flaky check in event_trigger_login regression test

commit   : 4b885d01f9676f62d8b8156e45282c631181369f    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 23:16:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 23:16:53 +0200    

Click here for diff

The query checks that pg_database.dathasloginevt is unset on connect when  
there are no event triggers.  However, unsetting this flag is implemented in  
a non-blocking way, so a concurrent autovacuum connection breaks this check.  
It doesn't seem we can do much with this, at least within a regression test.  
So, remove it.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/44807d19-81a6-3884-3e0f-22dd99aac3ed%40gmail.com  

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

Fix spelling in notice

commit   : 58fbbc9d683cc7a79a790fe9f17dd374c56445cc    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 22:59:09 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 22:59:09 +0200    

Click here for diff

Reported-by: Atsushi Torikoshi  
Discussion: https://postgr.es/m/762d7dd4d5aa9e5ecffec2ae6a255a28%40oss.nttdata.com  

M src/backend/commands/copyfrom.c

Fix incorrect comment on how BackendStatusArray is indexed

commit   : 2b53a462cff0074f5bf1675ad58ca95190c4bcd0    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Jan 2024 15:44:10 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 17 Jan 2024 15:44:10 +0200    

Click here for diff

The comment was copy-pasted from the call to ProcSignalInit() in  
AuxiliaryProcessMain(), which uses a similar scheme of having reserved  
slots for aux processes after MaxBackends slots for backends. However,  
ProcSignalInit() indexing starts from 1, whereas BackendStatusArray  
starts from 0. The code is correct, but the comment was wrong.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Backpatch-through: v14  

M src/backend/utils/activity/backend_status.c

Close socket in case of errors in setting non-blocking

commit   : 7cfa154d15c4a98bea0cfe26b2c78094a094650f    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Jan 2024 11:24:11 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 17 Jan 2024 11:24:11 +0100    

Click here for diff

If configuring the newly created socket non-blocking fails we  
error out and return INVALID_SOCKET, but the socket that had  
been created wasn't closed. Fix by issuing closesocket in the  
errorpath.  
  
Backpatch to all supported branches.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://postgr.es/m/CAEudQApmU5CrKefH85VbNYE2y8H=-qqEJbg6RAPU65+vCe+89A@mail.gmail.com  
Backpatch-through: v12  

M src/backend/port/win32/socket.c

Fix description of DecodeInsert() in decode.c

commit   : 44ad5129ce19d22afe757a6b56e41eaa91304869    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 17:03:02 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 17:03:02 +0900    

Click here for diff

This incorrectly referred to deletes.  
  
Author: Yongtao Huang  
Reviewed-by: Richard Guo  
Description: https://postgr.es/m/CAOe1Go0Czgvo9eiDqeFpaABwJu=gBK6qjrYzZGZLn=tKDX8AUw@mail.gmail.com  

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

commit   : 061cc7eacac15c4bcd4447a238e16a6e0ea9c6bb    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 15:53:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 15:53:59 +0900    

Click here for diff

These comments explained how these functions behave internally, and the  
equivalent is described in the documentation section dedicated to the  
pipeline mode of libpq.  Let's remove these comments, getting rid of the  
duplication with the docs.  
  
Reported-by: Álvaro Herrera  
Reviewed-by: Álvaro Herrera  
Discussion: https://postgr.es/m/[email protected]  

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

Add support for parsing of large XML data (>= 10MB)

commit   : 2197d06224a14dba544e05e3df1efcca83bdd9ef    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 14:03:55 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 14:03:55 +0900    

Click here for diff

This commit adds XML_PARSE_HUGE to the libxml2 functions used in core  
for the parsing of XML objects, raising up the original limit of 10MB  
supported by libxml2.  
  
In most code paths of upstream, XML_MAX_TEXT_LENGTH (10^7) is the  
historical limit that gets upgraded to XML_MAX_HUGE_LENGTH (10^9) once  
XML_PARSE_HUGE is given to the parser calls.  These are still limited by  
any palloc() calls for text, up to 1GB.  
  
This offers the possibility to handle within the backend XML objects  
larger than 10MB in general, with also a higher depth limit.  This  
change affects the contrib module xml2, the xml data type and SQL/XML.  
  
Author: Dmitry Koval  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
M src/backend/utils/adt/xml.c

commit   : 65c5864d7fac46516f17ee89085e349a87ee5bd7    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 08:53:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 17 Jan 2024 08:53:16 +0900    

Click here for diff

Some functions are used in the tree and are currently marked as  
deprecated by upstream.  This commit refreshes the code to use the  
recommended functions, leading to the following changes:  
- xmlSubstituteEntitiesDefault() is gone, and needs to be replaced with  
XML_PARSE_NOENT for the paths doing the parsing.  
- xmlParseMemory() -> xmlReadMemory().  
  
These functions, as well as more functions setting global states, have  
been officially marked as deprecated by upstream in August 2022.  Their  
replacements exist since the 2001-ish area, as far as I have checked,  
so that should be safe.  
  
Author: Dmitry Koval  
Discussion: https://postgr.es/m/[email protected]  

M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c

Fix format specifier for NOTICE in copyfrom.c

commit   : 8ad1f7db87f0375cfd7c6ae24aa13bdbdff2477a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 00:59:44 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Wed, 17 Jan 2024 00:59:44 +0200    

Click here for diff

It's incorrect to use %lz for 64-bit numbers on 32-bit machine.  

M src/backend/commands/copyfrom.c

Add new COPY option SAVE_ERROR_TO

commit   : 9e2d8701194fa1d280b73c024759950c74c1c637    
  
author   : Alexander Korotkov <[email protected]>    
date     : Tue, 16 Jan 2024 23:08:53 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Tue, 16 Jan 2024 23:08:53 +0200    

Click here for diff

Currently, when source data contains unexpected data regarding data type or  
range, the entire COPY fails. However, in some cases, such data can be ignored  
and just copying normal data is preferable.  
  
This commit adds a new option SAVE_ERROR_TO, which specifies where to save the  
error information. When this option is specified, COPY skips soft errors and  
continues copying.  
  
Currently, SAVE_ERROR_TO only supports "none". This indicates error information  
is not saved and COPY just skips the unexpected data and continues running.  
  
Later works are expected to add more choices, such as 'log' and 'table'.  
  
Author: Damir Belyalov, Atsushi Torikoshi, Alex Shulgin, Jian He  
Discussion: https://postgr.es/m/87k31ftoe0.fsf_-_%40commandprompt.com  
Reviewed-by: Pavel Stehule, Andres Freund, Tom Lane, Daniel Gustafsson,  
Reviewed-by: Alena Rybakina, Andy Fan, Andrei Lepikhov, Masahiko Sawada  
Reviewed-by: Vignesh C, Atsushi Torikoshi  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/bin/psql/tab-complete.c
M src/include/commands/copy.h
M src/include/commands/copyfrom_internal.h
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list

Fix REALLOCATE_BITMAPSETS code

commit   : c7e5e994b2eb07cd0f3d5f0bb320e981bf1aae6e    
  
author   : David Rowley <[email protected]>    
date     : Wed, 17 Jan 2024 09:30:21 +1300    
  
committer: David Rowley <[email protected]>    
date     : Wed, 17 Jan 2024 09:30:21 +1300    

Click here for diff

7d58f2342 added a compile-time option to have bitmapset.c reallocate the  
set before returning when a set is modified.  That commit failed to do  
its job in various cases and returned the input set when it shouldn't  
have in these cases.  Here we fix those missing cases.  
  
This commit also adds some documentation about what  
REALLOCATE_BITMAPSETS is for.  This is important as future functions  
that go inside bitmapset.c need to know if they need to do anything  
special when this compile-time option is defined.  
  
Also, between 71a3e8c43 and 7d58f2342 some Asserts seem to have become  
duplicated.  Tidy these up.  Rather than having the Assert check each  
aspect of what makes a set invalid, here we introduce a helper function  
which returns false when a set is invalid and have the Asserts use this  
instead.  
  
Also, make a pass on improving the comments in bitmapset.c.  Various  
comments mentioned the input sets being "recycled".  This could be  
interpreted to mean that the output set will always point to the same  
memory as the given input parameter.  Here we try to make it clear that  
this must not be relied upon and that callers must ensure that all  
references to a given set are updated on each modification.  
  
In passing, improve comments for bms_union(), bms_intersect() and  
bms_difference() to detail what they do.  I (David) have too often had to  
remind myself by reading the code each time to find out if I need, for  
example, to use bms_union() or bms_join().  I also removed some  
low-value comments that were trying to convey information about "these  
operations" without mentioning which operations it was talking about.  
It seems better to document these things in the function header comment  
instead.  
  
Author: Richard Guo, David Rowley  
Discussion: https://postgr.es/m/CAMbWs4-djy9qYux2gZrtmxA0StrYXJjvB-oqLxn-d7J88t=PQQ@mail.gmail.com  

M src/backend/nodes/bitmapset.c

Be more consistent about whether to update the FSM while vacuuming.

commit   : 45d395cd75ffc5b4c824467140127a5d11696d4c    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 16 Jan 2024 14:16:57 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 16 Jan 2024 14:16:57 -0500    

Click here for diff

Previously, when lazy_scan_noprune() was called and returned true, we would  
update the FSM immediately if the relation had no indexes or if the page  
contained no dead items. On the other hand, when lazy_scan_prune() was  
called, we would update the FSM if either of those things was true or  
if index vacuuming was disabled. Eliminate that behavioral difference by  
considering vacrel->do_index_vacuuming in both cases.  
  
Also, make lazy_scan_heap() responsible for deciding whether to update  
the FSM, instead of doing it inside lazy_scan_noprune(). This is  
more consistent with the lazy_scan_prune() case. lazy_scan_noprune()  
still needs an output parameter for whether there are LP_DEAD items  
on the page, but the real decision-making now happens in the caller.  
  
Patch by me, reviewed by Peter Geoghegan and Melanie Plageman.  
  
Discussion: http://postgr.es/m/CA+TgmoaOzvN1TcHd9iej=PR3fY40En1USxzOnXSR2CxCLaRM0g@mail.gmail.com  

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

Support identity columns in partitioned tables

commit   : 699586315704a8268808e3bdba4cb5924a038c49    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 17:16:14 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 17:16:14 +0100    

Click here for diff

Previously, identity columns were disallowed on partitioned tables.  
(The reason was mainly that no one had gotten around to working  
through all the details to make it work.)  This makes it work now.  
  
Some details on the behavior:  
  
* A newly created partition inherits identity property  
  
  The partitions of a partitioned table are integral part of the  
  partitioned table.  A partition inherits identity columns from the  
  partitioned table.  An identity column of a partition shares the  
  identity space with the corresponding column of the partitioned  
  table.  In other words, the same identity column across all  
  partitions of a partitioned table share the same identity space.  
  This is effected by sharing the same underlying sequence.  
  
  When INSERTing directly into a partition, the sequence associated  
  with the topmost partitioned table is used to calculate the value of  
  the corresponding identity column.  
  
  In regular inheritance, identity columns and their properties in a  
  child table are independent of those in its parent tables.  A child  
  table does not inherit identity columns or their properties  
  automatically from the parent.  (This is unchanged.)  
  
* Attached partition inherits identity column  
  
  A table being attached as a partition inherits the identity property  
  from the partitioned table.  This should be fine since we expect  
  that the partition table's column has the same type as the  
  partitioned table's corresponding column.  If the table being  
  attached is a partitioned table, the identity properties are  
  propagated down its partition hierarchy.  
  
  An identity column in the partitioned table is also marked as NOT  
  NULL.  The corresponding column in the partition needs to be marked  
  as NOT NULL for the attach to succeed.  
  
* Drop identity property when detaching partition  
  
  A partition's identity column shares the identity space  
  (i.e. underlying sequence) as the corresponding column of the  
  partitioned table.  If a partition is detached it can longer share  
  the identity space as before.  Hence the identity columns of the  
  partition being detached loose their identity property.  
  
  When identity of a column of a regular table is dropped it retains  
  the NOT NULL constraint that came with the identity property.  
  Similarly the columns of the partition being detached retain the NOT  
  NULL constraints that came with identity property, even though the  
  identity property itself is lost.  
  
  The sequence associated with the identity property is linked to the  
  partitioned table (and not the partition being detached).  That  
  sequence is not dropped as part of detach operation.  
  
* Partitions with their own identity columns are not allowed.  
  
* The usual ALTER operations (add identity column, add identity  
  property to existing column, alter properties of an indentity  
  column, drop identity property) are supported for partitioned  
  tables.  Changing a column only in a partitioned table or a  
  partition is not allowed; the change needs to be applied to the  
  whole partition hierarchy.  
  
Author: Ashutosh Bapat <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/ddl.sgml
M src/backend/commands/tablecmds.c
M src/backend/rewrite/rewriteHandler.c
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/identity.out
M src/test/regress/sql/identity.sql

Decorate WITH with literal markup tags

commit   : 7bcf57a0ca6601163c441270d031bb52e6abc9d2    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Jan 2024 13:51:15 +0100    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 16 Jan 2024 13:51:15 +0100    

Click here for diff

One instance of "WITH clause" was not using <literal> tags around  
WITH, while others were, so add markup to the last one to ensure  
consistency.  Backpatch to v15 where MERGE was added.  
  
Reported-by: jian he <[email protected]>  
Discussion: https://postgr.es/m/CACJufxGJKY9ZCPV2WDM6xFsXq9C8r7r3vU6AkScN+p9k6CEpMw@mail.gmail.com  
Backpatch-through: v15  

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

Add missing PGDLLIMPORT markings

commit   : c6b86eaa55ff225a7a4aa23c13e42edc4d996a44    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Jan 2024 13:53:28 +0200    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 16 Jan 2024 13:53:28 +0200    

Click here for diff

Since commit 8ec569479f, we have a policy of marking all backend  
variables with PGDLLIMPORT.  
  
Reported-by: Anton A. Melnikov  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/include/postmaster/walsummarizer.h
M src/include/storage/buf_internals.h

struct XmlTableRoutine: use C99 designated initializers

commit   : 585025397337281cdce31bf1df2e0868cfbd0b92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:48:30 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:48:30 +0100    

Click here for diff

As in c27f8621eed et al.  
  
Not as critical as other cases we've handled, but I figure if we're  
going to add JsonbTableRoutine using TableFuncRoutine, this makes it  
easier to jump around the code.  

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

Don't test already-referenced pointer for nullness

commit   : c6605c1bdf07e8fc026bf857d37628cbb5746bb8    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:27:52 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 16 Jan 2024 12:27:52 +0100    

Click here for diff

Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer  
returned by pqPrepareAsyncResult(), before some other code that was  
already testing that pointer for nullness.  But since commit  
618c16707a6d (in Postgres 15), pqPrepareAsyncResult() doesn't ever  
return NULL (a statically-allocated result is returned if OOM).  So in  
branches 15 and up, we can remove the redundant pointer check with no  
harm done.  
  
However, in branch 14, pqPrepareAsyncResult() can indeed return NULL if  
it runs out of memory.  Fix things there by adding a null pointer check  
before dereferencing the pointer.  This should hint Coverity that the  
preexisting check is not redundant but necessary.  
  
Backpatch to 14, like b8ba7344e9eb.  
  
Per Coverity.  

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

doc: Add Identity Column section under Data Definition chapter

commit   : a37bb7c13995b834095d9d064cad1023a6f99b10    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 09:42:40 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 09:42:40 +0100    

Click here for diff

This seems to be missing since identity column support was added.  Add  
the same.  This gives a place to document various pieces of  
information in one place that are currently distributed over several  
command reference pages or just not documented (e.g., inheritance  
behavior).  
  
Author: Ashutosh Bapat <[email protected]>  
Author: Peter Eisentraut <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/ddl.sgml

Assert that partition inherits from only one parent in MergeAttributes()

commit   : d22d98c341713a260c1d821a62e83c19e27defa0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:57:35 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:57:35 +0100    

Click here for diff

A partition inherits only from one partitioned table and thus inherits  
a column definition only once.  Assert the same in MergeAttributes()  
and simplify a condition accordingly.  
  
Similar definition exists about line 3068 in the same function.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M src/backend/commands/tablecmds.c

doc: Decorate PostgreSQL with productname tag

commit   : 58b20e6d75e5ccaba8bd8a8b1c09f90e4a371b63    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:56:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 16 Jan 2024 08:56:00 +0100    

Click here for diff

... in the section about Generated Columns.  
  
Author: Ashutosh Bapat <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5uOykuTC+C6R1yDSp=o8Q83jr8xJdZxgPkxfZ1Ue5RRGg@mail.gmail.com  

M doc/src/sgml/ddl.sgml

libpq: Add PQsendPipelineSync()

commit   : 4794c2d31714235700ed68edafa10d1928c9bbb2    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 10:13:42 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 10:13:42 +0900    

Click here for diff

This new function is equivalent to PQpipelineSync(), except that it does  
not flush anything to the server except if the size threshold of the  
output buffer is reached; the user must subsequently call PQflush()  
instead.  
  
Its purpose is to reduce the system call overhead of pipeline mode, by  
giving to applications more control over the timing of the flushes when  
manipulating commands in pipeline mode.  
  
Author: Anton Kirilov  
Reviewed-by: Jelte Fennema-Nio, Robert Haas, Álvaro Herrera, Denis  
Laxalde, Michael Paquier  
Discussion: https://postgr.es/m/CACV6eE5arHFZEA717=iKEa_OewpVFfWJOmsOdGrqqsr8CJVfWQ@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/libpq-fe.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/multi_pipelines.trace

commit   : 83eb244e419efd43959fdd544ff8c30e175565ef    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 09:17:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 16 Jan 2024 09:17:51 +0900    

Click here for diff

Noticed while reviewing the area for a different patch.  This is  
cosmetic, so no backpatch is done.  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c

Fix typos.

commit   : 237d01139b8a2ad26036d9025ae8e8e99b53e08c    
  
author   : Robert Haas <[email protected]>    
date     : Mon, 15 Jan 2024 11:50:44 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Mon, 15 Jan 2024 11:50:44 -0500    

Click here for diff

Alexander Lakhin  
  
Discussion: http://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/bin/pg_walsummary/t/002_blocks.pl

Fix 'negative bitmapset member' error

commit   : fe093994db4dc5dcc239f8839b094c0b75de00cf    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 15 Jan 2024 17:45:16 +0200    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 15 Jan 2024 17:45:16 +0200    

Click here for diff

When removing a useless join, we'd remove PHVs that are not used at join  
partner rels or above the join.  A PHV that references the join's relid  
in ph_eval_at is logically "above" the join and thus should not be  
removed.  We have the following check for that:  
  
    !bms_is_member(ojrelid, phinfo->ph_eval_at)  
  
However, in the case of SJE removing a useless inner join, 'ojrelid' is  
set to -1, which would trigger the "negative bitmapset member not  
allowed" error in bms_is_member().  
  
Fix it by skipping examining ojrelid for inner joins in this check.  
  
Reported-by: Zuming Jiang  
Bug: #18260  
Discussion: https://postgr.es/m/18260-1b6a0c4ae311b837%40postgresql.org  
Author: Richard Guo  
Reviewed-by: Andrei Lepikhov  

M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Avoid useless ReplicationOriginExitCleanup locking

commit   : aa817c7496575b37fde6ea5e0cd65b26f29ea532    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 15 Jan 2024 13:02:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 15 Jan 2024 13:02:03 +0100    

Click here for diff

When session_replication_state is NULL, we can know there's nothing to  
do with no lock acquisition.  Do that.  
  
Author: Bharath Rupireddy <[email protected]>  
Discussion: https://postgr.es/m/CALj2ACX+YaeRU5xJqR4C7kLsTO_F7DBRNF8WgeHvJZcKtNuK_A@mail.gmail.com  

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

Reduce dependency to money data type in main regression test suite

commit   : 31acee4b66f9f88ad5c19c1276252688bdaa95c9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 15 Jan 2024 09:30:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 15 Jan 2024 09:30:16 +0900    

Click here for diff

Most of these tests have been introduced in 6dd8b0080787, to check for  
behaviors related to hashing and hash plans, and money is a data type  
with btree support but no hash functions.  These tests are switched to  
use varbit instead, to provide the same coverage.  
  
Some other tests historically used money but don't really need it for  
what they wanted to test (see rules.sql).  Plans and coverage are  
unchanged after the modifications done here.  
  
Support for money may be removed a a later point, but this needs more  
discussion.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/expected/hash_func.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/union.out
M src/test/regress/expected/with.out
M src/test/regress/sql/hash_func.sql
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/stats_ext.sql
M src/test/regress/sql/union.sql
M src/test/regress/sql/with.sql

Prevent access to an unpinned buffer in BEFORE ROW UPDATE triggers.

commit   : 6545ba96cb7a98506627554a33bc7e39c88f9b76    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 14 Jan 2024 12:38:41 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 14 Jan 2024 12:38:41 -0500    

Click here for diff

When ExecBRUpdateTriggers switches to a new target tuple as a result  
of the EvalPlanQual logic, it must form a new proposed update tuple.  
Since commit 86dc90056, that tuple (the result of  
ExecGetUpdateNewTuple) has been a virtual tuple that might contain  
pointers to by-ref fields of the new target tuple (in "oldslot").  
However, immediately after that we materialize oldslot, causing it to  
drop its buffer pin, whereupon the by-ref pointers are unsafe to use.  
This is a live bug only when the new target tuple is in a different  
page than the original target tuple, since we do still hold a pin on  
the original one.  (Before 86dc90056, there was no bug because the  
EPQ plantree would hold a pin on the new target tuple; but now that's  
not assured.)  To fix, forcibly materialize the new tuple before we  
materialize oldslot.  This costs nothing since we would have done that  
shortly anyway.  
  
The real-world impact of this is probably minimal.  A visible failure  
could occur if the new target tuple's buffer were recycled for some  
other page in the short interval before we materialize newslot within  
the trigger-calling loop; but that's quite unlikely given that we'd  
just touched that page.  There's a larger hazard that some other  
process could prune and repack that page within the window.  We have  
lock on the new target tuple, but that wouldn't prevent it being moved  
on the page.  
  
Alexander Lakhin and Tom Lane, per bug #17798 from Alexander Lakhin.  
Back-patch to v14 where 86dc90056 came in.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/trigger.c

pg_dump: Remove obsolete trigger support

commit   : 15235abbf34f6b246f7681e88dccf8c2796a245b    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:53:59 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:53:59 +0100    

Click here for diff

Remove for dumping triggers from pre-9.2 servers.  This should have  
been removed as part of 30e7c175b81.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/56c8f5bf-de47-48c1-a592-588fb526e9e6%40eisentraut.org  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

doc: Update catalog documentation for attstattarget nullable

commit   : 556799660fc4dc23e187994ae5ea622933ea720f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:46:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:46:01 +0100    

Click here for diff

Fixup for 4f622503d6.  

M doc/src/sgml/catalogs.sgml

Remove useless Assert

commit   : e3aa802e6f843fc8df793d2dccdafecc32fe2cfc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:29:45 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sun, 14 Jan 2024 07:29:45 +0100    

Click here for diff

It's already included in the subsequent intVal() call.  Fixup for  
4f622503d6.  

M src/backend/commands/tablecmds.c

Escape output of pg_amcheck test

commit   : 6a3631e251d1390673aee469c0cd672cac6195ef    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 20:29:01 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 20:29:01 +0100    

Click here for diff

The pg_amcheck test reports a skip message if the layout of the index  
does not match expectations.  That message includes the bytes that  
were expected and the ones that were found.  But the found ones are  
arbitrary bytes, which can have funny effects on the terminal when  
they are printed.  To avoid that, escape non-word characters before  
printing.  
  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/3f96f079-64e5-468a-8a19-cb481f0d31e5%40eisentraut.org  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Add previous commit to .git-blame-ignore-revs.

commit   : 36578fa049421429c99bc9a0f06344dc8b4b5152    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:56:46 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:56:46 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

M .git-blame-ignore-revs

Re-pgindent catcache.c after previous commit.

commit   : 96c019ffa3f883d139709ea0cfe76dc1bce0f1f8    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:54:11 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:54:11 -0500    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

M src/backend/utils/cache/catcache.c

Cope with catcache entries becoming stale during detoasting.

commit   : ad98fb14226ae6456fbaed7990ee7591cbe5efd2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:46:27 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 13 Jan 2024 13:46:27 -0500    

Click here for diff

We've long had a policy that any toasted fields in a catalog tuple  
should be pulled in-line before entering the tuple in a catalog cache.  
However, that requires access to the catalog's toast table, and we'll  
typically do AcceptInvalidationMessages while opening the toast table.  
So it's possible that the catalog tuple is outdated by the time we  
finish detoasting it.  Since no cache entry exists yet, we can't  
mark the entry stale during AcceptInvalidationMessages, and instead  
we'll press forward and build an apparently-valid cache entry.  The  
upshot is that we have a race condition whereby an out-of-date entry  
could be made in a backend's catalog cache, and persist there  
indefinitely causing indeterminate misbehavior.  
  
To fix, use the existing systable_recheck_tuple code to recheck  
whether the catalog tuple is still up-to-date after we finish  
detoasting it.  If not, loop around and restart the process of  
searching the catalog and constructing cache entries from the top.  
The case is rare enough that this shouldn't create any meaningful  
performance penalty, even in the SearchCatCacheList case where  
we need to tear down and reconstruct the whole list.  
  
Indeed, the case is so rare that AFAICT it doesn't occur during  
our regression tests, and there doesn't seem to be any easy way  
to build a test that would exercise it reliably.  To allow  
testing of the retry code paths, add logic (in USE_ASSERT_CHECKING  
builds only) that randomly pretends that the recheck failed about  
one time out of a thousand.  This is enough to ensure that we'll  
pass through the retry paths during most regression test runs.  
  
By adding an extra level of looping, this commit creates a need  
to reindent most of SearchCatCacheMiss and SearchCatCacheList.  
I'll do that separately, to allow putting those changes in  
.git-blame-ignore-revs.  
  
Patch by me; thanks to Alexander Lakhin for having built a test  
case to prove the bug is real, and to Xiaoran Wang for review.  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com  

M src/backend/utils/cache/catcache.c

Make attstattarget nullable

commit   : 4f622503d6de975ac87448aea5cea7de4bc140d5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 18:14:53 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Sat, 13 Jan 2024 18:14:53 +0100    

Click here for diff

This changes the pg_attribute field attstattarget into a nullable  
field in the variable-length part of the row.  If no value is set by  
the user for attstattarget, it is now null instead of previously -1.  
This saves space in pg_attribute and tuple descriptors for most  
practical scenarios.  (ATTRIBUTE_FIXED_PART_SIZE is reduced from 108  
to 104.)  Also, null is the semantically more correct value.  
  
The ANALYZE code internally continues to represent the default  
statistics target by -1, so that that code can avoid having to deal  
with null values.  But that is now contained to the ANALYZE code.  
Only the DDL code deals with attstattarget possibly null.  
  
For system columns, the field is now always null.  The ANALYZE code  
skips system columns anyway.  
  
To set a column's statistics target to the default value, the new  
command form ALTER TABLE ... SET STATISTICS DEFAULT can be used.  (SET  
STATISTICS -1 still works.)  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/access/common/tupdesc.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/cache/lsyscache.c
M src/bin/pg_dump/pg_dump.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_attribute.h
M src/include/commands/vacuum.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/create_index.out

Fix memory leak in connection string validation.

commit   : 45da69371ebfc4d6982695e58791989660c1cc33    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 21:38:16 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 21:38:16 -0800    

Click here for diff

Introduced in commit c3afe8cf5a.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Nathan Bossart, Tom Lane  
Backpatch-through: 16  

M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Add empty placeholder LINGUAS file for pg_walsummary

commit   : 2f696d5a2902333329a95fd80e351e4e6ecf8d4a    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 23:20:03 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 23:20:03 +0100    

Click here for diff

Like bbf1f1340800.  

A src/bin/pg_walsummary/po/LINGUAS

Re-validate connection string in libpqrcv_connect().

commit   : 5c31669058b5550b4b3d623c07bc4203c11b8316    
  
author   : Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 13:41:36 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Fri, 12 Jan 2024 13:41:36 -0800    

Click here for diff

A superuser may create a subscription with password_required=true, but  
which uses a connection string without a password.  
  
Previously, if the owner of such a subscription was changed to a  
non-superuser, the non-superuser was able to utilize a password from  
another source (like a password file or the PGPASSWORD environment  
variable), which should not have been allowed.  
  
This commit adds a step to re-validate the connection string before  
connecting.  
  
Reported-by: Jeff Davis  
Author: Vignesh C  
Reviewed-by: Peter Smith, Robert Haas, Amit Kapila  
Discussion: https://www.postgresql.org/message-id/flat/e5892973ae2a80a1a3e0266806640dae3c428100.camel%40j-davis.com  
Backpatch-through: 16  

M doc/src/sgml/ref/create_subscription.sgml
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/test/subscription/t/027_nosuperuser.pl

Refactor ATExecAddColumn() to use BuildDescForRelation()

commit   : a1604237a6ffee70b171bacd5f36b0e380afd33a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 12 Jan 2024 16:05:15 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 12 Jan 2024 16:05:15 +0100    

Click here for diff

BuildDescForRelation() has all the knowledge for converting a  
ColumnDef into pg_attribute/tuple descriptor.  ATExecAddColumn() can  
make use of that, instead of duplicating all that logic.  We just pass  
a one-element list of ColumnDef and we get back exactly the data  
structure we need.  Note that we don't even need to touch  
BuildDescForRelation() to make this work.  
  
Reviewed-by: Alvaro Herrera <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Fix typo.

commit   : 882887e9b458f533b301c36951c93dfdd37dccfc    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 12 Jan 2024 09:46:46 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 12 Jan 2024 09:46:46 -0500    

Click here for diff

Noriyoshi Shinoda  
  
Discussion: http://postgr.es/m/DM4PR84MB17347D9466419413698105D8EE6F2@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/pg_walsummary.sgml

Added literal tag for RETURNING

commit   : 6780b79d5c580586ae6feb37b9c8b8bf33367886    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 12:44:20 +0100    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jan 2024 12:44:20 +0100    

Click here for diff

This is an old mistake (92e38182d7c8); backpatch all the way back.  
  
Author: Atsushi Torikoshi <[email protected]>  
Reviewed-by: Ashutosh Bapat <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Fix pg_walsummary's .gitignore

commit   : 278972f5933679e06e7d71d2060c1867f5aa4ebe    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 13:40:58 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 13:40:58 +0900    

Click here for diff

It missed a entry for tmp_check/ generated by the tests.  While on it,  
append a slash at the beginning of "pg_walsummary" to restrict its check  
to the current directory, like anywhere else.  
  
Oversights in ee1bfd168390.  

M src/bin/pg_walsummary/.gitignore

Refactor code checking for file existence

commit   : e72a37528ddaadd796be73fe9b0a0c08b18476d2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 12:04:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 12:04:51 +0900    

Click here for diff

jit.c and dfgr.c had a copy of the same code to check if a file exists  
or not, with a twist: jit.c did not check for EACCES when failing the  
stat() call for the path whose existence is tested.  This refactored  
routine will be used by an upcoming patch.  
  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/jit/jit.c
M src/backend/storage/file/fd.c
M src/backend/utils/fmgr/dfmgr.c
M src/include/storage/fd.h

Rework how logirep launchers are stopped during pg_upgrade

commit   : 08c3ad27eb5348d0cbffa843a3edb11534f9904a    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 08:23:07 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jan 2024 08:23:07 +0900    

Click here for diff

This is a rework of 7021d3b17664, where we relied on forcing  
max_logical_replication_workers to 0 in the postgres command.  This  
commit now prevents logical replication launchers to start using -b and  
a backend-side check based on IsBinaryUpgrade, effective when upgrading  
from 17 and newer versions.  
  
This commit improves the comments explaining why this restriction is  
necessary.  
  
This discussion was on hold until we were sure how to add support for  
subscribers in pg_upgrade, something now done thanks to 9a17be1e244a.  
  
Reviewed-by: Álvaro Herrera, Amit Kapila, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/replication/logical/launcher.c
M src/bin/pg_upgrade/server.c

Fix some inconsistent whitespace in Perl file

commit   : 7786af4d74182ddd32e00f694bba741ee5d33efa    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 22:23:44 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 22:23:44 +0100    

Click here for diff

M src/test/modules/test_pg_dump/t/001_base.pl

Fix incorrect format placeholder

commit   : 35bc310c04a477376778f437a56f0fcfb504c9c3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 21:49:00 +0100    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 11 Jan 2024 21:49:00 +0100    

Click here for diff

M src/bin/pg_upgrade/info.c

Cleanup for unicode-update build target and test.

commit   : cf64d4e99f6480ad6d73af82bfbbf2b2e637a7ec    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 11 Jan 2024 12:20:25 -0800    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 11 Jan 2024 12:20:25 -0800    

Click here for diff

In preparation for adding more Unicode tables.  
  
Discussion: https://postgr.es/m/[email protected]  
Reviewed-by: Jeremy Schneider  

M src/common/unicode/Makefile
M src/common/unicode/category_test.c
M src/common/unicode/meson.build

Allow subquery pullup to wrap a PlaceHolderVar in another one.

commit   : 29f114b6ff0c4ccad29b3a3707ab2c299647d450    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2024 15:28:13 -0500    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jan 2024 15:28:13 -0500    

Click here for diff

The code for wrapping subquery output expressions in PlaceHolderVars  
believed that if the expression already was a PlaceHolderVar, it was  
never necessary to wrap that in another one.  That's wrong if the  
expression is underneath an outer join and involves a lateral  
reference to outside that scope: failing to add an additional PHV  
risks evaluating the expression at the wrong place and hence not  
forcing it to null when the outer join should do so.  This is an  
oversight in commit 9e7e29c75, which added logic to forcibly wrap  
lateral-reference Vars in PlaceHolderVars, but didn't see that the  
adjacent case for PlaceHolderVars needed the same treatment.  
  
The test case we have for this doesn't fail before 4be058fe9, but now  
that I see the problem I wonder if it is possible to demonstrate  
related errors before that.  That's moot though, since all such  
branches are out of support.  
  
Per bug #18284 from Holger Reise.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Try to fix pg_walsummary buildfarm failures.

commit   : a7097ca630a25dd2248229f21ebce4968d85d10a    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 15:01:51 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 15:01:51 -0500    

Click here for diff

Apparently the new tuple isn't guaranteed to end up at the end of  
the relation, so make the test not depend on that happening.  

M src/bin/pg_walsummary/t/002_blocks.pl

Remove hastup from LVPagePruneState.

commit   : e2d5b3b9b643739bd83e42769b44005dfd2bbb90    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:22:04 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:22:04 -0500    

Click here for diff

Instead, just have lazy_scan_prune() and lazy_scan_noprune() update  
LVRelState->nonempty_pages directly. This makes the two functions  
more similar and also removes makes lazy_scan_noprune need one fewer  
output parameters.  
  
Melanie Plageman, reviewed by Andres Freund, Michael Paquier, and me  
  
Discussion: http://postgr.es/m/CAAKRu_btji_wQdg=ok-5E4v_bGVxKYnnFFe7RA6Frc1EcOwtSg@mail.gmail.com  

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

Reindent after commit d9ef650fca7bc574586f4171cd929cfd5240326e.

commit   : 5faffa0434b484772782ff4763c0b2080222dde0    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:24:35 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:24:35 -0500    

Click here for diff

M src/backend/postmaster/walsummarizer.c

Repair various defects in dc212340058b4e7ecfc5a7a81ec50e7a207bf288.

commit   : 3d5c332a3d6002c5c95cb238e2164ae054c8e805    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:06:10 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 13:06:10 -0500    

Click here for diff

pg_combinebackup had various problems:  
  
* strncpy was used in various places where strlcpy should be used  
  instead, to avoid any possibility of the result not being  
  \0-terminated.  
* scan_for_existing_tablespaces() failed to close the directory,  
  and an error when opening the directory was reported with the  
  wrong pathname.  
* write_reconstructed_file() contained some redundant and therefore  
  dead code.  
* flush_manifest() didn't check the result of pg_checksum_update()  
  as we do in other places, and misused a local pathname variable  
  that shouldn't exist at all.  
  
In pg_basebackup, the wrong variable name was used in one place,  
due to a copy and paste that was not properly adjusted.  
  
In blkreftable.c, the loop incorrectly doubled chunkno instead of  
max_chunks. Fix that. Also remove a nearby assertion per repeated  
off-list complaints from Tom Lane.  
  
Per Coverity and subsequent code inspection by me and by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/write_manifest.c
M src/common/blkreftable.c

Add new pg_walsummary tool.

commit   : ee1bfd168390bc843c6704d16e909692c0a79f27    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:47:28 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:47:28 -0500    

Click here for diff

This can dump the contents of the WAL summary files found in  
pg_wal/summaries. Normally, this shouldn't really be something anyone  
needs to do, but it may be needed for debugging problems with  
incremental backup, or could possibly be useful to external tools.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/pg_walsummary.sgml
M doc/src/sgml/reference.sgml
M src/bin/Makefile
M src/bin/meson.build
A src/bin/pg_walsummary/.gitignore
A src/bin/pg_walsummary/Makefile
A src/bin/pg_walsummary/meson.build
A src/bin/pg_walsummary/nls.mk
A src/bin/pg_walsummary/pg_walsummary.c
A src/bin/pg_walsummary/t/001_basic.pl
A src/bin/pg_walsummary/t/002_blocks.pl
M src/tools/pgindent/typedefs.list

Add new function pg_get_wal_summarizer_state().

commit   : d9ef650fca7bc574586f4171cd929cfd5240326e    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:41:18 -0500    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 11 Jan 2024 12:41:18 -0500    

Click here for diff

This makes it possible to access information about the progress  
of WAL summarization from SQL. The previously-added functions  
pg_available_wal_summaries() and pg_wal_summary_contents() only  
examine on-disk state, but this function exposes information from  
the server's shared memory.  
  
Discussion: http://postgr.es/m/CA+Tgmobvqqj-DW9F7uUzT-cQqs6wcVb-Xhs=w=hzJnXSE-kRGw@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/backup/walsummaryfuncs.c
M src/backend/postmaster/walsummarizer.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/postmaster/walsummarizer.h

Clarify which xml tools are missing in meson error message

commit   : 544bcb5a5e778e8ef8d784de611c5f85bc33433c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:55:43 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:55:43 +0100    

Click here for diff

M meson.build

Fix omission in partitioning limitation documentation

commit   : ba2d2784f3f83277de6f9c17505229fa3f2f6d5c    
  
author   : Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:27:10 +0100    
  
committer: Magnus Hagander <[email protected]>    
date     : Thu, 11 Jan 2024 14:27:10 +0100    

Click here for diff

UNIQUE and PRIMARY KEY constraints can be created on ONLY the  
partitioned table.  We already had an example demonstrating that,  
but forgot to mention it in the documentation of the limits of  
partitioning.  
  
Author: Laurenz Albe  
Reviewed-By: shihao zhong, Shubham Khanna, Ashutosh Bapat  
Backpatch-through: 12  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ddl.sgml

Fix an intermetant BF failure in 003_logical_slots.

commit   : 6f97ef05d62a9c4ed5c53e98ac8a44cf3e0a2780    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 11 Jan 2024 08:56:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 11 Jan 2024 08:56:27 +0530    

Click here for diff

During upgrade, when pg_restore performs CREATE DATABASE, bgwriter or  
checkpointer may flush buffers and hold a file handle for pg_largeobject,  
so later TRUNCATE pg_largeobject command will fail if OS (such as older  
Windows versions) doesn't remove an unlinked file completely till it's  
open. The probability of seeing this behavior is higher in this test  
because we use wal_level as logical via allows_streaming => 'logical'  
which in turn set shared_buffers as 1MB and make it more probable for  
bgwriter to hold the file handle.  
  
Diagnosed-by: Alexander Lakhin  
Author: Hayato Kuroda, Amit Kapila  
Reviewed-by: Alexander Lakhin  
Discussion: https://postgr.es/m/TYAPR01MB5866AB7FD922CE30A2565B8BF5A8A@TYAPR01