PostgreSQL 19.0 (upcoming) commit log

Update expected regression test output for xml_2.out

commit   : 0b74df66f08f474aa2225553b8d38704ae844797    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 12:37:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 12:37:21 +0900    

Click here for diff

This one has been forgotten in 8bf257aebac1.  Per report from buildfarm  
member massasauga.  
  
Backpatch-through: 14  

M src/test/regress/expected/xml_2.out

Fix second race with timeline selection during promotion

commit   : a8ee70bd5e0069c5550b0b0c5418638507fa0ed7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 11:44:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 11:44:11 +0900    

Click here for diff

read_local_xlog_page_guts has the same race as logical_read_xlog_page:  
RecoveryInProgress() can return true during promotion, impacting the  
availability of the operations doing WAL page reads with this callback.  
  
This problem is similar to eb4e7224a1c6 that has addressed the issue for  
logical replication, impacting more areas of the code where this WAL  
page callback can be used (same narrow window during promotion, same  
availability issue):  
- pg_walinspect.  
- Slot advance (SQL function).  
- Slot creation.  
  
Repack workers (v19~) and 2PC files (since forever) can also use this  
callback, but they are irrelevant as far as I know.  A test is added  
with the SQL lookup functions.  This part relies on injection points,  
and is backpatched down to v18, like the test added for eb4e7224a1c6.  
  
This issue could probably be fixed as well in v14 and v15 for  
pg_walinspect.  However, I also feel that there is a conservative  
argument about consistency here due to the support of logical decoding  
on standbys, so let's limit ourselves to v16 for now.  pg_walinspect is  
used less in the field compared to the two other operations, making  
addressing this problem less attractive in these two older branches.  
  
Reported-by: Xuneng Zhou <xunengzhou@gmail.com>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/7daef094-abf3-4672-bc23-3df4763b16a3%40gmail.com  
Backpatch-through: 16  

M src/backend/access/transam/xlogutils.c
M src/test/recovery/t/035_standby_logical_decoding.pl

Confine RI fast-path batching to the top transaction level

commit   : 4113873a5ab0fb83a6f772f455b2842359d5ec50    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 12 Jun 2026 11:05:25 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 12 Jun 2026 11:05:25 +0900    

Click here for diff

The FK fast-path batching added in b7b27eb41a5 buffers rows in a  
transaction-lived cache (ri_fastpath_cache) keyed by constraint OID.  
Running user-defined cast and equality functions during a batch flush,  
together with the cache's lifetime and iteration, exposed two defects  
reachable by an unprivileged table owner.  
  
First, on subtransaction abort ri_FastPathSubXactCallback discarded the  
entire cache.  An entry's batch holds rows buffered by the enclosing  
transaction, not just the aborting subxact -- the cache is keyed by  
constraint, so a single entry can mix rows from multiple subxact levels.  
An internal subxact abort during after-trigger firing (e.g. a PL/pgSQL  
BEGIN ... EXCEPTION block) therefore dropped buffered rows of the outer  
transaction without running their FK checks, letting orphan rows commit  
behind a constraint that still reported itself valid.  The discard also  
left relations opened by the batch unclosed, producing "resource was not  
closed" warnings.  
  
Second, ri_FastPathEndBatch flushes by iterating the cache with  
hash_seq_search.  If flush-time user code inserts into a different  
fast-path FK table, a new entry is added to the cache mid-scan; it may  
land in a bucket the scan has already passed and never be reached, and  
ri_FastPathTeardown then destroys the cache without flushing it,  
silently dropping that check.  
  
Cleanly unwinding the cache on subxact abort would require tracking the  
originating subxact of each buffered row, since rows from different  
levels share an entry (the cache is keyed by constraint) and deferred  
constraints cannot be flushed early at a subxact boundary.  Rather than  
add that bookkeeping, confine batching to the top transaction level: in  
RI_FKey_check, when GetCurrentTransactionNestLevel() > 1, use the  
per-row fast path (ri_FastPathCheck) instead of buffering.  Rows checked  
inside a subtransaction are then verified immediately and roll back  
cleanly with their subtransaction, and the cache only ever holds  
top-level rows.  With the cache confined to the top level, a  
subtransaction abort has nothing of its own to discard, so  
ri_FastPathSubXactCallback is removed along with its registration.  
  
For the second defect, add a cache-wide flag (ri_fastpath_flushing) set  
while ri_FastPathEndBatch iterates the cache.  A re-entrant FK check  
arriving while the flag is set takes the per-row path rather than adding  
an entry to the cache being scanned, so no entry can be missed and torn  
down unflushed.  The flag is cleared in a PG_FINALLY so a flush that  
throws (a reported violation or an error from user code) does not leave  
it stuck.  As defensive insurance it is also cleared in  
ri_FastPathXactCallback() at transaction end.  
  
The per-row fast path still bypasses SPI and stays well ahead of the  
pre-19 SPI-based check.  A fuller fix that preserves batching across  
subtransactions -- whether by tracking the originating subxact of each  
buffered row or by per-subxact cache stacks merged into the parent on  
commit -- is left for a future release.  
  
The subtransaction-abort case is covered by a new regression test.  The  
mid-scan cross-table case depends on hash bucket placement and so is not  
reliably reproducible in a portable test, but the flag prevents it by  
construction.  
  
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>  
Reviewed-by: Nikolay Samokhvalov <nik@postgres.ai>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CAM527d9exRCdWrhJOnAxk_vACg7sr_yPoaJp_+uCFY0qP8v=aw@mail.gmail.com  

M src/backend/utils/adt/ri_triggers.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

doc: fix reference for finding replication slots to drop

commit   : 67bd944c0e61baf01eae61fcf54cc96011455ebb    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 11:08:33 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 11:08:33 +0900    

Click here for diff

Commit a70bce43fb added instructions on how to recover if PostgreSQL  
refuses to issue new transaction IDs because of imminent wraparound,  
but when describing how to find replication slots that should be dropped,  
it referred to pg_stat_replication where it should have referenced  
pg_replication_slots.  
  
In passing, decorate references to views with <structname> tags.  
  
Backpatch to all supported versions.  
  
Reported-By: Sanjaya Waruna <sanjaya.waruna@gmail.com>  
Author: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/176767268098.1084085.10345048667224193115@wrigleys.postgresql.org  
Backpatch-through: 14  

M doc/src/sgml/maintenance.sgml

Fix out-of-bounds write in RI fast-path batch on re-entry

commit   : 0e47bb5fbeec64d776d49dee242bac39d4616f8b    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 12 Jun 2026 10:36:45 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 12 Jun 2026 10:36:45 +0900    

Click here for diff

The FK fast-path batching added in b7b27eb41a5 wrote the incoming row  
into the batch array before checking whether the array was full:  
  
    fpentry->batch[fpentry->batch_count] = ExecCopySlotHeapTuple(newslot);  
    fpentry->batch_count++;  
    if (fpentry->batch_count >= RI_FASTPATH_BATCH_SIZE)  
        ri_FastPathBatchFlush(fpentry, fk_rel, riinfo);  
  
batch_count is reset to zero only at the end of ri_FastPathBatchFlush(),  
so it remains at RI_FASTPATH_BATCH_SIZE throughout a full-batch flush.  
A flush runs user-defined cast functions and equality operators; if that  
user code performs DML on the same FK table, ri_FastPathBatchAdd()  
re-enters with batch_count == RI_FASTPATH_BATCH_SIZE and writes one past  
the end of the array, corrupting the adjacent batch_count field.  This  
is reachable by an unprivileged table owner via an implicit cast with a  
PL/pgSQL function and causes a SIGSEGV in assert-enabled builds.  
  
Fix by bounds-checking the write into the batch array so a re-entrant  
add can never write past the end, and by adding a "flushing" flag to  
RI_FastPathEntry that routes re-entrant ri_FastPathBatchAdd() calls on  
a busy entry to the per-row path (ri_FastPathCheck) instead of touching  
the mid-flush batch array.  The flag is set around the probe in  
ri_FastPathBatchFlush() and cleared in a PG_FINALLY, which also resets  
batch_count, so the entry is left empty and reusable if a flush error  
(including a reported FK violation) is caught by a savepoint.  
  
Add regression tests for both the re-entrant flush and reuse of an entry  
after a flush error caught by a savepoint.  
  
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>  
Reviewed-by: Nikolay Samokhvalov <nik@postgres.ai>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CAM527d9exRCdWrhJOnAxk_vACg7sr_yPoaJp_+uCFY0qP8v=aw@mail.gmail.com  

M src/backend/utils/adt/ri_triggers.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix handling of namespace nodes in xpath() (xml)

commit   : 8bf257aebac12791dc78a599e4f7dc225893d45e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 10:25:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 12 Jun 2026 10:25:45 +0900    

Click here for diff

xpath() attempted to call xmlCopyNode() and xmlNodeDump() on a  
XML_NAMESPACE_DECL, finishing with a confusing error:  
=# SELECT xpath('//namespace::foo', '<root xmlns:foo="http://127.0.0.1"/>');  
ERROR:  53200: could not copy node  
CONTEXT:  SQL function "xpath" statement 1  
  
xpath() is changed so as it goes through xmlXPathCastNodeToString()  
instead, that is able to handle namespace nodes.  xml2 uses the same  
solution.  This issue has been discovered while digging into  
9d33a5a804db.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aioT7ui_ZJ9RMlfM@paquier.xyz  
Backpatch-through: 14  

M src/backend/utils/adt/xml.c
M src/test/regress/expected/xml.out
M src/test/regress/expected/xml_1.out
M src/test/regress/sql/xml.sql

amcheck: Fix missing allequalimage corruption report

commit   : 389bd4c5b93426e6616a0be7cff9cf91179c16e7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 09:35:27 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 09:35:27 +0900    

Click here for diff

When amcheck validates that a B-Tree metapage's allequalimage flag  
matches _bt_allequalimage(), it could fail to report corruption  
unless one of the index key columns used interval_ops. As a result,  
pg_amcheck could silently miss this corruption on other opclasses,  
incorrectly reporting the index as valid.  
  
The mistake was that bt_index_check_callback() kept ereport(ERROR)  
inside the loop that scans key attributes for INTERVAL_BTREE_FAM_OID,  
even though that loop is only needed to decide whether to add  
the interval-specific hint. This commit moves ereport() out of the loop  
so allequalimage mismatches are always reported, while still emitting  
the hint for affected interval indexes.  
  
Back-patch to v18, where d70b17636dd introduced this regression  
while moving the check into bt_index_check_callback().  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/011ACC9C-CB87-4160-ACE7-4ED57AB86E15@gmail.com  
Backpatch-through: 18  

M contrib/amcheck/verify_nbtree.c

Fix md5_password_warnings for role and database settings

commit   : 44196fd4f378d776c4cd7282256f4d6df03b5734    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 08:32:39 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 12 Jun 2026 08:32:39 +0900    

Click here for diff

MD5 authentication warnings are queued during authentication, before  
startup options and role/database settings have been applied. The code  
checked md5_password_warnings at queue time, so settings such as  
ALTER ROLE ... SET md5_password_warnings = off did not suppress the  
warning, even though the established session showed the GUC as off.  
  
Keep the connection-warning infrastructure generic by allowing each  
queued warning to carry an optional filter callback. Evaluate that  
callback when warnings are emitted, after startup options and  
role/database settings have been processed.  
  
Use this for MD5 authentication warnings, while leaving password  
expiration warnings unchanged. Add test coverage for an MD5-authenticated  
role with md5_password_warnings disabled.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/AE46E42D-5966-4D76-9E64-95EAB01B9FB5@gmail.com  

M src/backend/libpq/crypt.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h
M src/test/authentication/t/001_password.pl
M src/tools/pgindent/typedefs.list

Fix type confusion in AddRelsyncInvalidationMessage

commit   : 99db753c656946bfd1d4ddd3978ebfcee6fb86c0    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 11 Jun 2026 15:55:44 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 11 Jun 2026 15:55:44 -0400    

Click here for diff

Since this is trying to add a SharedInvalRelSyncMsg rather than  
a SharedInvalRelcacheMsg, it should use rs rather than rc.  
  
This makes no difference as things stand, because the two structure  
definitions are identical (except for the capitalization of "relid"),  
but it's still a good idea to fix it.  
  
Co-authored-by: Stolpovskikh Danil <d.stolpovskikh@ftdata.ru>  
Co-authored-by: Robert Haas <rhaas@postgresql.org>  
Discussion: http://postgr.es/m/bd6a5735b72b4afe99af49c3c62901d6@localhost.localdomain  

M src/backend/utils/cache/inval.c

Fix translatable string construction

commit   : 3692a622d3fdf8a44af0c0b541a51163ead314f1    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Jun 2026 18:29:36 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Jun 2026 18:29:36 +0200    

Click here for diff

In a few places, we were constructing translatable strings consisting of  
elements list by adding one element at a time and separately a comma.  
This is not great from a translation point of view, so rewrite to append  
the comma together with the corresponding element in one go.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAHut+Pvp7jYcaiZ3pXedXgLcWZWDBLXFUK05JtZpGv3Mj=UOjw@mail.gmail.com  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/relation.c

IS JSON/JSON(): Protect against expressions uncoercible to text

commit   : 7dd15325952fe85521b1fefea3ad39cf1b46e0c8    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Jun 2026 16:17:58 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Jun 2026 16:17:58 +0200    

Click here for diff

transformJsonParseArg() was not careful enough on generation of  
transformed expressions when starting from expressions that are not  
coercible to text but are in the string type category: it failed to  
verify that coerce_to_target_type() succeeds, and returned a NULL  
pointer.  This leads to a later NULL dereference and crash at executor  
time.  
  
This escaped noticed because it cannot happen for built-in types, all of  
which have casts to text.  Only user-created types are potentially  
problematic.  
  
Fix by raising an error when a cast to text doesn't exist.  
  
This mistake came in with commit 6ee30209a6f1.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reported-by: Chi Zhang <798604270@qq.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Backpatch-through: 16  
Discussion: https://postgr.es/m/19491-7aafc221ec63f288@postgresql.org  

M src/backend/nodes/makefuncs.c
M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix parsing of parenthesised OLD/NEW in RETURNING list.

commit   : 79c65b9d97fe92ea2792be09479cf4bbea7cefe1    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 11 Jun 2026 12:08:47 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 11 Jun 2026 12:08:47 +0100    

Click here for diff

When parsing expressions like (old).colname and (old).* in a RETURNING  
list, the parser would lose track of the intended varreturningtype,  
and therefore return incorrect results.  
  
The root cause was code using GetNSItemByRangeTablePosn() to find a  
namespace item from its rtindex and levelsup, without taking into  
account returningtype, which would return the wrong namespace item.  
Fix by adding a new function GetNSItemByVar() that does take  
returningtype into account.  
  
Backpatch to v18, where support for RETURNING OLD/NEW was added.  
  
Bug: #19516  
Reported-by: Marko Grujic <markoog@gmail.com>  
Author: Marko Grujic <markoog@gmail.com>  
Suggested-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/CAOvwyF2cO_5mAt=w=y-dFnaG5UkZ+3H8nSDoKF_iuWZHsU2ARg@mail.gmail.com  
Backpatch-through: 18  

M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_relation.h
M src/test/regress/expected/returning.out
M src/test/regress/sql/returning.sql

seg: Fix seg_out() to preserve the upper boundary's certainty indicator

commit   : 0e1f1ed157e90741e12a3715909e1b2d71ff9344    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Jun 2026 12:33:48 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Jun 2026 12:33:48 +0300    

Click here for diff

When printing the upper boundary of a seg interval, seg_out() decided  
whether to emit the certainty indicator ('<', '>' or '~') by testing the  
upper indicator (u_ext) for '<' and '>', but mistakenly tested the lower  
indicator (l_ext) for '~'.  This is a copy-and-paste slip from the  
symmetric code that prints the lower boundary a few lines above.  
  
The consequences for valid input were:  
  
  * A '~' on the upper boundary was dropped on output, e.g.  
    '1.5 .. ~2.5'::seg printed as '1.5 .. 2.5'.  
  
  * When the lower boundary carried '~' but the upper boundary had no  
    indicator, the wrong test matched and sprintf(p, "%c", seg->u_ext)  
    wrote a NUL byte (u_ext == '\0'), which truncated the result string  
    and silently lost the entire upper boundary, e.g.  
    '~6.5 .. 8.5'::seg printed as '~6.5 .. '.  
  
Certainty indicators are documented to be preserved on output (they are  
ignored by the operators, but kept as comments), so this broke the  
input/output round-trip for the affected values.  
  
The bug has existed since seg was added.  It went unnoticed because the  
existing regression tests only exercised certainty indicators on  
single-point segs, which are printed by a different branch of seg_out().  
Add tests that place indicators on both boundaries of an interval.  
  
Author: Ewan Young <kdbase.hack@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAON2xHPYeRRCEVAv8XfE18KsEsEHCiYcJ5fOsoxFuMEfpxF1=g@mail.gmail.com  
Backpatch-through: 14  

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

Fix race with timeline selection in logical decoding during promotion

commit   : eb4e7224a1c6f0058d708cdfda7326bbf884a871    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Jun 2026 17:28:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Jun 2026 17:28:57 +0900    

Click here for diff

During promotion, there is a window where RecoveryInProgress() returns  
true but the WAL segments of the old timeline have already been removed.  
A logical decoding could pick up the old timeline in this window when  
reading a page, failing with the following error:  
ERROR: requested WAL segment ... has already been removed  
  
This issue does not lead to any data correctness issue, as retrying to  
decode the data works in follow-up decoding attempts.  It impacts  
availability, though.  Other WAL page read callbacks have a similar  
issue, this commit takes care of what should be the noisiest code path:  
logical decoding with START_REPLICATION in a WAL sender.  
  
A TAP test, based on an injection point waiting in the startup process  
after the segments have been removed/recycled, is added.  This part is  
backpatched down to v17.  
  
This issue has been causing sporadic failures in the buildfarm, and  
was reproducible manually.  This issue happens since logical decoding on  
standbys exists, down to v16.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/7daef094-abf3-4672-bc23-3df4763b16a3@gmail.com  
Backpatch-through: 16  

M src/backend/access/transam/xlog.c
M src/backend/replication/walsender.c
M src/test/recovery/t/035_standby_logical_decoding.pl

Disallow negative values for max_retention_duration.

commit   : 987440b33a511482232c59a190cc16ae4feff9aa    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 11 Jun 2026 11:17:54 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 11 Jun 2026 11:17:54 +0530    

Click here for diff

The subscription option max_retention_duration accepts an integer value  
representing a timeout in milliseconds, where zero means unlimited  
retention (no timeout).  Negative values have no useful meaning, but were  
silently accepted and stored in the subscription catalog.  
  
A negative value causes should_stop_conflict_info_retention() to always  
return true, because TimestampDifferenceExceeds() treats a negative  
threshold as already exceeded.  This stops dead tuple retention  
immediately rather than honoring the configured timeout.  
  
Fix by rejecting negative values for max_retention_duration during CREATE  
SUBSCRIPTION and ALTER SUBSCRIPTION.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/9232401A-DEEE-49E1-9D11-D14A776DB82B@gmail.com  

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

xml2: Fix crash with namespace nodes in xpath_nodeset()

commit   : 9d33a5a804db48b254de7a0ad2fde03152f378e3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Jun 2026 14:29:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Jun 2026 14:29:18 +0900    

Click here for diff

pgxmlNodeSetToText() passed nodeTab[i]->doc to xmlNodeDump() without  
checking the node type, which could cause a crash as a  
XML_NAMESPACE_DECL maps to a xmlNs struct.  The passed-in code would  
then be dereferenced in xmlNodeDump().  
  
This commit switches the code to render XML_NAMESPACE_DECL nodes with  
xmlXPathCastNodeToString(), like xpath_table().  Some tests are added,  
written by me.  
  
Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/20260611031436.5afde3cb@andrnote  
Backpatch-through: 14  

M contrib/xml2/expected/xml2.out
M contrib/xml2/expected/xml2_1.out
M contrib/xml2/sql/xml2.sql
M contrib/xml2/xpath.c

Undo thinko in commit e78d1d6d4.

commit   : 9d141466ff087230571e9c9dfd720deb94977253    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Jun 2026 17:01:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Jun 2026 17:01:45 -0400    

Click here for diff

In pursuit of removing a Valgrind-detected leak, I inserted  
"pfree(pq_mq_handle);" into mq_putmessage's recursion-trouble-recovery  
code path, failing to notice that shm_mq_detach would have pfree'd  
that block just before (i.e., this particular code path did not leak).  
So now that was a double pfree.  We didn't notice because the  
recursion scenario isn't exercised in our regression tests, but  
Alexander Lakhin found it via code fuzzing.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/b8b40954-e155-41b3-9af8-ad4f261a1b64@gmail.com  

M src/backend/libpq/pqmq.c

Fix MarkBufferDirtyHint() to not call GetBufferDescriptor() for local buffers

commit   : e18b0cb7344cb4bd28468f6c0aeeb9b9241d30aa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jun 2026 13:49:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jun 2026 13:49:26 +0900    

Click here for diff

GetBufferDescriptor() was called before checking if the buffer is local.  
Such buffers have a negative ID, meaning that we could call  
GetBufferDescriptor() with a wrapped-around uint32 value causing a  
potential out-of-bound access to the BufferDescriptors array.  
  
This is harmless in the existing code for the current uses of  
MarkBufferDirtyHint(), but the author has found a way to make that  
buggy while working on a different patch set, and the order of the  
operations is wrong.  
  
Oversight in 82467f627bd4.  No backpatch is required, as this is new to  
v19.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://postgr.es/m/CAExHW5uzRMYVZsXXS3HXXT0fG_sNrpUhUqwP4NorhaCqH9JDhA@mail.gmail.com  

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

pg_buffercache: restore rowtype verification in pg_buffercache_pages()

commit   : b70d5672d0c5d4310965fcbc1c846c9d111a3046    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 10 Jun 2026 12:32:59 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 10 Jun 2026 12:32:59 +0900    

Click here for diff

Commit 257c8231bf9 changed pg_buffercache_pages() to materialize its output  
directly into a tuplestore. As a result, the function ended up trusting  
a caller-supplied RECORD descriptors. That could lead to crashes  
if the supplied row definition did not match the actual returned values,  
for example by passing bool Datums to tuplestore_putvalues() with  
an incompatible descriptor.  
  
Fix this by constructing the correct tuple descriptor for  
pg_buffercache_pages() and assigning it to  
rsinfo->setDesc after InitMaterializedSRF(). This restores the executor's  
tupledesc_match() verification, so incompatible caller-supplied  
row definitions are rejected with an error, as before commit 257c8231bf9.  
  
Bug: #19508  
Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>  
Discussion: https://postgr.es/m/19508-e5f188183279219b@postgresql.org  

M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql

psql: Add some missing schema qualifications in describe.c

commit   : bf5206f007732c64f857e6bc214f77b5f31efc6a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jun 2026 10:56:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Jun 2026 10:56:23 +0900    

Click here for diff

These schema qualifications have been missed by 2f094e7a (recent),  
8185bb53 (recent) and 923def9a533a (much older, down to v15).  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Tingchuan Sun <suntingchuan1996@163.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/C809E3C7-2437-486E-B626-0BE5F40BBB6C@gmail.com  

M src/bin/psql/describe.c

Fix race when logical decoding activation is concurrently interrupted.

commit   : 93a3e6839bf8d2e0498291335191b57ddf458b48    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Jun 2026 11:19:27 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Jun 2026 11:19:27 -0700    

Click here for diff

EnableLogicalDecoding() sets xlog_logical_info to true, emits a  
procsignal barrier, sets logical_decoding_enabled to true, and then  
writes a WAL record. If the activating backend is interrupted between  
these steps, a PG_ENSURE_ERROR_CLEANUP() callback runs to undo the  
partial activation.  
  
The previous callback asserted that logical_decoding_enabled was still  
false and then cleared xlog_logical_info. Both actions were unsafe  
when a second backend was concurrently activating: the peer backend  
might have already observed xlog_logical_info as true, set  
logical_decoding_enabled to true, and written the activation WAL  
record before our callback fired, causing the first backend to hit the  
assertion failure.  
  
Fix this by having the abort callback call  
RequestDisableLogicalDecoding(), allowing the checkpointer to undo the  
partial activation in the same manner as a normal deactivation. This  
simplifies the logic by unifying the activation abort and deactivation  
paths. While this approach now wakes up the checkpointer when an  
activation is interrupted, this should not be a serious issue in  
practice since such interruptions are rare.  
  
Add a test case to 051_effective_wal_level.pl.  
  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/788B5B8A-BC22-48D8-818E-7B00416CF84E@gmail.com  

M src/backend/replication/logical/logicalctl.c
M src/test/recovery/t/051_effective_wal_level.pl

Disallow direct use of the pgrepack logical decoding plugin

commit   : cd7b204b2df99516a48a738e662d8512e706b519    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 9 Jun 2026 20:12:55 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 9 Jun 2026 20:12:55 +0200    

Click here for diff

Nothing is to be gained from using pgrepack outside of REPACK  
(CONCURRENTLY), and it leads to assertion failures in assertion-enabled  
builds, and to crashes due to bogus memory lifetime in production  
builds.  Reject attempts to do that with a clean error report.  
  
Clean up the nearby code a tad while at it.  The only functional changes  
in that are that the output_writer_private context is allocated and  
partially filled by the pgrepack output plugin; and that ->relid therein  
is now always present (rather than only in assertion-enabled builds).  
Other than that it's just minor code rearrangement and added comments.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru>  
Suggested-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Antonin Houska <ah@cybertec.at> (older version)  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com> (older version)  
Discussion: https://postgr.es/m/19500-38a02529a69353a5@postgresql.org  

M contrib/test_decoding/expected/repack.out
M contrib/test_decoding/sql/repack.sql
M src/backend/commands/repack_worker.c
M src/backend/replication/pgrepack/pgrepack.c
M src/include/commands/repack_internal.h

Record dependencies on graph labels and properties

commit   : 9d8cdcbe0c8aee743e29079bdb2e4b5eeae4c70e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Jun 2026 12:55:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Jun 2026 12:55:47 +0200    

Click here for diff

A view definition with GRAPH_TABLE depends upon the property graph it  
references as well as the properties and labels referenced in it.  We  
recorded the dependency on the property graph, but did not record  
dependency on labels and properties.  This allowed properties or  
labels referenced by a view to be dropped, resulting in a cache lookup  
error when such a view was accessed.  Fix this bug by handling  
GraphPropertyRef and GraphLabelRef in find_expr_references_walker().  
The dependency on the data type of property does not need to be  
recorded separately as it is recorded indirectly via a dependency on  
the property graph property itself.  
  
Note that a property or a label associated with individual elements  
can still be dropped as long as there are other elements that are  
associated with that property or label, since they do not lead to  
dropping the property or the label from the property graph altogether.  
  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/tencent_43D9888041FA4FDE498C7BF1%40qq.com  

M src/backend/catalog/dependency.c
M src/include/catalog/catversion.h
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Use correct type for catalog_xmin

commit   : bd4bd30ce6a7f08e95390c3fa068f2bfbe9fcee8    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 9 Jun 2026 08:18:41 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 9 Jun 2026 08:18:41 +0900    

Click here for diff

Commit 85c17f6 mistakenly declared a variable storing catalog_xmin as  
XLogRecPtr, even though catalog_xmin is a TransactionId.  
  
This caused no functional issue, but the type was clearly incorrect.  
Therefore, this commit fixes it to use the correct type TransactionId  
instead, and backpatch to v17 where the issue was introduced.  
  
Author: Imran Zaheer <imran.zhir@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CA+UBfa=mNeLt-4BFjEP4tqdDsnq+oMqqPr7fd9Wji2_9YXmQdA@mail.gmail.com  

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

Guard against uninitialized default locale.

commit   : 1c77203c15e43d4ae9a8fed67ce89eeeca54af8f    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 Jun 2026 13:10:40 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 Jun 2026 13:10:40 -0700    

Click here for diff

No known problem today, but defend against issues like dbf217c1c7 in  
the future.  
  
Discussion: https://postgr.es/m/d080287d8d2d14c246c86be2e9eb611fb6b27b11.camel@j-davis.com  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Backpatch-through: 17  

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

ci: Improve ccache handling

commit   : f52c44ce48a61dd99d8ea545a57da95e62b084e4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Jun 2026 15:26:47 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Jun 2026 15:26:47 -0400    

Click here for diff

There previously were a number of issues:  
  
- We'd upload the cache even if we already had a high hit rate. That means we  
  churn through the available cache space very quickly.  
  
  For this we now check if the cache hit ratio is already high, and skip  
  uploading a new cache in that case.  
  
- We'd generate per-branch caches, even if master's already would suffice,  
  because the branch doesn't change much  
  
  This is solved indirectly by the above.  
  
- The cache key allowed prefix matches based on the branch,  
  e.g. master-pending would always use master's branch  
  
  Replace the cache key element separator of - with :, which is not a valid  
  part of a branch name.  
  
- When rebasing a feature branch, we'd start with just that branch's cache,  
  rather than also having the newer cache of master available  
  
  This is solved by downloading by master's and the feature branch's cache,  
  simply overlaying both. That's possible because ccache is content addressed.  
  
- The size of a cache would increase to the max, even though there likely will  
  be no benefit from old cache entries.  
  
  Address this by explicitly evicting old data and also recompressing the  
  cache before uploading it.  
  
In my testing this utilizes the available cache space (10GB for personal  
accounts) much more effectively than before.  
  
The not entirely trivial determination of whether it's worth uploading a cache  
entry is moved to a python script.  I first had it as shell, but that gets  
awkward.  This way it'd also be more viable to use ccache for msvc at some  
point.  
  
The per-job redundancies are a bit annoying. There's a way around that, by  
using composite actions, but I think that might be harder to understand,  
without all that much of an improvement.  
  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/7eugqon2ilnaq6yimtq7prtl5wlia43mhpmwlydzlw4u4wonaz@hh2fagz5bjuu  

M .github/workflows/pg-ci.yml
A src/tools/ci/gha_ccache_decide.py

Remove inappropriate translation marker in getObjectIdentityParts().

commit   : 4b1e18b0573b6630feb3d794930be1005016077d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Jun 2026 15:23:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Jun 2026 15:23:48 -0400    

Click here for diff

Strings built by this function are not supposed to be subject to  
NLS translation, but commit 6566133c5 missed that memo, so that  
object identities like "membership of role %s in role %s" were  
translated.  

M src/backend/catalog/objectaddress.c

dict_synonym.c: remove incorrect outlen.

commit   : 9234e333711ef9875a4cef31889e88439421c396    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 Jun 2026 11:47:53 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 Jun 2026 11:47:53 -0700    

Click here for diff

Previously, outlen was miscalculated if case_sensitive was false and  
str_tolower() changed the byte length of the string. If outlen was too  
large, pnstrdup() would stop at the NUL terminator, preventing  
overrun. But if outlen was too small, it would cause truncation.  
  
Fix by just removing outlen. It was only used in a single site, which  
could just as well use pstrdup().  
  
Discussion: https://postgre.es/m/1101e1a3afbbabb503317069c40374b82e6f4cac.camel@j-davis.com  
Reviewed-by: Tristan Partin <tristan@partin.io>  
Backpatch-through: 14  

M src/backend/tsearch/dict_synonym.c

Revert "Enable fast default for domains with non-volatile constraints"

commit   : a0354e29c41a9fb7491b3c7c23f079b1923c045a    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 8 Jun 2026 13:42:50 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 8 Jun 2026 13:42:50 -0400    

Click here for diff

This reverts commit a0b6ef29a51818a4073a5f390ed10ef6453d5c11, along with  
its follow-up 2e123e3c2bd34f2377212a4e7cfcdbf9e2d9c7ff ("Silence compiler  
warning from older compilers"), which only adjusted code introduced by  
the former.  
  
The change failed with an empty table and an invalid default, and the  
best way to deal with that will involve an addition to the TAM API, so  
it's not ready for relese 19 now.  
  
Discussion: https://postgr.es/m/7033D663-DDB4-4B35-922C-F33DE53B1502@gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/include/executor/executor.h
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Fix syslogger NULL-pointer-dereference in EXEC_BACKEND

commit   : fb23cc7e81db181bfb3dcfed6ad0731a3473d4e1    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Jun 2026 19:49:54 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Jun 2026 19:49:54 +0200    

Click here for diff

Commit 0c8e082fba8d changed the time at which MyBackendType is assigned,  
breaking a careful choreography in syslogger to decide when to write  
messages to its own log files.  Fix by flipping a boolean at the  
(approximate) location where previously MyBackendType was set, instead  
of depending on MyBackendType directly.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reported-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/ahP-JT4ZRPyobnLb@paquier.xyz  

M src/backend/postmaster/syslogger.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/include/postmaster/syslogger.h

Fix FOR PORTION OF for inheritance children

commit   : 7d13b03a2e677b78047cf537e519166dcbafa117    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jun 2026 19:18:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jun 2026 19:18:58 +0200    

Click here for diff

ExecForPortionOfLeftovers() assumed that any result relation with  
ri_RootResultRelInfo should reinsert temporal leftovers through the  
root relation.  That is correct for partitioned tables, where tuple  
routing is needed, but it is wrong for plain inheritance.  
  
When UPDATE/DELETE FOR PORTION OF is run on an inheritance parent and  
a child row is split, the leftover rows must be inserted back into the  
child relation.  Reinserting through the parent can lose child-only  
columns and place the leftover rows in the wrong relation.  
  
Fix this by distinguishing partitioned-table routing from plain  
inheritance.  For partitioned tables, keep using the root leftover  
slot and insert through the root relation.  For plain inheritance  
children, use a leftover slot matching the child relation and insert  
directly into the child.  Also keep translating the application-time  
column attno for child relations, so multiple-inheritance cases with  
different attribute numbers are handled correctly.  
  
Added an ExecInitForPortionOf function to set up the ForPortionOfState  
for each child table, which keeps most of these decisions localized  
instead of spread out through ExecForPortionOfLeftovers.  Incidentally  
clarified a comment about the rangetype stored in ForPortionOfState.  
  
Add regression tests for UPDATE and DELETE FOR PORTION OF on  
inheritance children, including a multiple-inheritance case where the  
range column has a different attnum in the parent and child.  
  
Author: jian he <jian.universality@gmail.com>  
Co-authored-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://www.postgresql.org/message-id/flat/4245F94D-84F1-4E05-BF81-C458A6CF9901%40gmail.com  

M src/backend/executor/nodeModifyTable.c
M src/include/nodes/execnodes.h
M src/test/regress/expected/for_portion_of.out
M src/test/regress/sql/for_portion_of.sql

Fix missed checks for hashability of container-type equality.

commit   : 06e94eccfd910225a78f3510700bc89c1d88782f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Jun 2026 11:48:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Jun 2026 11:48:07 -0400    

Click here for diff

The operators for array_eq, record_eq, range_eq, and multirange_eq  
are all marked oprcanhash, but there's a pitfall: their hash functions  
can fail at runtime if the contained type(s) are not hashable.  
Therefore, the planner has to check hashability of the contained types  
before deciding it can use hashing in these cases.  Not every place  
had gotten this memo, and noplace at all had considered the issue  
for ranges or multiranges.  In particular we could attempt to use  
hashing for a ScalarArrayOpExpr on a container type when it won't  
actually work, leading to "could not identify a hash function ..."  
runtime failures.  
  
For the most part we should fix this in the lookup functions provided  
by lsyscache.c, to wit get_op_hash_functions and op_hashjoinable.  
But there's a problem: get_op_hash_functions is not passed the input  
data type it would need to check.  We mustn't change the API of that  
exported function in a back-patched fix, and even if we wanted to,  
its call sites in the executor mostly don't have easy access to the  
required data type OID.  Fortunately, the executor call sites don't  
actually need fixing, because it's expected that the planner verified  
hashability before building a plan that requires it.  Therefore,  
leave get_op_hash_functions as-is and invent a wrapper function  
get_op_hash_functions_ext that does the additional checking needed  
in the planner's uses.  
  
We also need to fix hash_ok_operator (extending the fix in 647889667).  
  
While at it, neaten up a couple of places in lookup_type_cache where  
relevant code for multirange cases was written differently from the  
code for other container types.  
  
Note: while this touches pg_operator.dat, it's only to add oid_symbol  
macros.  So there's no on-disk data change and no need for a  
catversion bump.  
  
Reported-by: Andrei Lepikhov <lepihov@gmail.com>  
Author: Andrei Lepikhov <lepihov@gmail.com>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/ed221f95-f09b-4a9c-b05b-e1fed621ec87@gmail.com  
Backpatch-through: 14  

M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/typcache.c
M src/include/catalog/pg_operator.dat
M src/include/utils/lsyscache.h

doc: Expand on proper use of refint.

commit   : 1541d91d1ccad2f1ac735574fabbacebf9ecbfa5    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 8 Jun 2026 10:33:52 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 8 Jun 2026 10:33:52 -0500    

Click here for diff

The security team has received a couple of reports about potential  
SQL injection via refint's trigger arguments.  We discussed this  
while preparing CVE-2026-6637 and concluded that forcibly quoting  
these arguments is more likely to break working code than to  
prevent exploits.  Unlike data values, the table/column names come  
from trigger arguments, and there is little reason for a trigger  
author to put hostile inputs into those arguments.  So, let's  
document it accordingly.  
  
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>  
Reported-by: Alex Young <alex000young@gmail.com>  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Suggested-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>  
Reviewed-by: Christoph Berg <myon@debian.org>  
Reviewed-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/ahXP7z7nsfGPOZ3T%40nathan  
Backpatch-through: 14  

M doc/src/sgml/contrib-spi.sgml

doc: Fix spelling for CHECKPOINT reference page

commit   : f58623faa856cfac67f1ff54b951f82f81fa1f59    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 8 Jun 2026 11:03:54 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 8 Jun 2026 11:03:54 +0200    

Click here for diff

Fixing incorrect spelling and breaking up a long sentence.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Thom Brown <thom@linux.com>  
Discussion: https://postgr.es/m/CAA-aLv5pZNZbdhPG2Wu0fzyKCjn9TTzN9QZ=JONPyqZQKhBV=g@mail.gmail.com  

M doc/src/sgml/ref/checkpoint.sgml

ecpg: Reject multiple header items in GET/SET DESCRIPTOR

commit   : 4484165b0712f09ca369ed497fc6f504b718abac    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 8 Jun 2026 17:07:48 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 8 Jun 2026 17:07:48 +0900    

Click here for diff

Previously, ecpg accepted multiple descriptor header items in GET DESCRIPTOR  
and SET DESCRIPTOR, but generated broken C code when they were used.  
Although the grammar allowed this syntax, the implementation did not actually  
support it.  
  
This commit tightens the ecpg grammar so the header form of GET/SET DESCRIPTOR  
accepts only a single header item, matching the implementation and preventing  
generation of broken C code.  
  
Also update the documentation synopsis accordingly.  
  
Backpatch to all supported versions.  
  
Author: Masashi Kamura <kamura.masashi@fujitsu.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Lakshmi G <lakshmigcdac@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/OS9PR01MB13174AD7D1829D0644B6BB90E9447A@OS9PR01MB13174.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M doc/src/sgml/ecpg.sgml
M src/interfaces/ecpg/preproc/ecpg.trailer

pg_createsubscriber: Fix duplicate publication name rejection.

commit   : 6ce035ffff444479e63ea6276d56e33cc8b991d9    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 12:19:29 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 12:19:29 +0530    

Click here for diff

pg_createsubscriber rejected duplicate --publication values while parsing  
command-line options, even when the duplicate names referred to  
publications in different databases. Since publication names are  
database-local objects, the same name is perfectly valid across multiple  
databases.  
  
This restriction was not a practical problem before commit 85ddcc2f4c,  
which added support for reusing pre-existing publications. After that  
change, users who have identically-named publications in multiple  
databases (a common convention) could not use the feature without renaming  
their publications.  
  
The analogous restriction on --subscription names is intentionally kept as  
they are reused as replication slot names, which are cluster-global, so  
allowing duplicate subscription names without additional guards could  
cause a slot-name collision. That work is left for a future release.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/B08A7C89-B3DE-4C1D-A671-32AD8BAB7E22@gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

Fix memory leak in pgstat_progress_parallel_incr_param()

commit   : b20c952ce70370b22ea7a206d7b674a322397d28    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jun 2026 15:29:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jun 2026 15:29:16 +0900    

Click here for diff

When called from a parallel worker, this function calls initStringInfo()  
and pq_beginmessage(), causing a StringInfo allocation to happen twice.  
pq_endmessage() frees only the second allocation, with each call leaking  
~1 kB into the per-worker memory context.  This could cause a few  
hundred megabytes worth of memory to pile up until the worker exits (the  
message allocations happen in the parallel worker context), with the  
situation being worse the longer a parallel worker runs.  
  
Oversight in f1889729dd3.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Tristan Partin <tristan@partin.io>  
Discussion: https://postgr.es/m/CA+fm-RMopta1Dmq8udiU5sp+zwTvhUf4+xfbr3rZDfczH+p-xw@mail.gmail.com  
Backpatch-through: 17  

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

Fix incorrect format placeholders

commit   : a450dd7ad4ff80c65f565f1a2bd24be8ff0bf3e3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jun 2026 07:55:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Jun 2026 07:55:01 +0200    

Click here for diff

M src/test/modules/test_bitmapset/test_bitmapset.c

Doc: Add missing SGML markup in alter_publication.sgml.

commit   : da51d9154deba7907062206d190dcd5730fe77f2    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 11:26:25 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 11:26:25 +0530    

Click here for diff

Author: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pu7Zxm3oU7OyK3FVXRuDO+V6143adGUC6nnSrhqizYqQQ@mail.gmail.com  

M doc/src/sgml/ref/alter_publication.sgml

psql: Fix expanded aligned output

commit   : 3d0d6741d810fbab894905b4945f4dc4e827c4ff    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jun 2026 14:37:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Jun 2026 14:37:51 +0900    

Click here for diff

When a table's columns are narrower than the record header line, the  
expanded aligned format produced misaligned output because the data  
column width was not adjusted to match the record header width, leading  
to output like:  
+-[ RECORD 1 ]-+  
| a | 10 |  
| b | 20 |  
+---+----+  
  
This commit adjusts the output so as the column width match with the  
header line, giving:  
+-[ RECORD 1 ]-+  
| a | 10       |  
| b | 20       |  
+---+----------+  
  
Author: Pavel Stehule <pavel.stehule@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAFj8pRCzGpsr9zTHbtTd4mGh2YPJqOEgLgt8JLiopuYA9_1xGw@mail.gmail.com  
Backpatch-through: 14  

M src/fe_utils/print.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Fix publisher retain_dead_tuples check when also changing origin.

commit   : 75dcc63dac0ef183774ec22a6557174ee36db601    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 10:59:05 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Jun 2026 10:59:05 +0530    

Click here for diff

In AlterSubscription(), when the SET clause includes both  
retain_dead_tuples and origin options, the origin branch was using  
assignment (=) rather than bitwise-or assignment (|=) when setting  
check_pub_rdt. This meant that if retain_dead_tuples had already set the  
flag to true in the same command, the origin branch would silently  
overwrite it. As a result, the publisher-side retain_dead_tuples check  
could be incorrectly skipped.  
  
Fix by changing the assignment to |= so that the flag accumulates across  
both option branches within the same ALTER SUBSCRIPTION command.  
  
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDfe7WPOhVGKzv83ZB+BmXM88r=KPQn1sa_ZXMMChcNo=A@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

doc PG 19 relnotes: improve awkward or confusing wording

commit   : eb77a521996f6b7900dc0dfe6346f7e3c88455bb    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 7 Jun 2026 23:27:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 7 Jun 2026 23:27:28 -0400    

Click here for diff

Reported-by: Álvaro Herrera  
  
Discussion: https://postgr.es/m/aiQPgZtALNqj4npv@alvherre.pgsql  

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

Fix tuple deforming with virtual generated columns

commit   : 89eafad297a9b01ad77cfc1ab93a433e0af894b0    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 6 Jun 2026 16:45:29 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 6 Jun 2026 16:45:29 +1200    

Click here for diff

TupleDescFinalize() failed to take into account virtual generated  
columns, which are always stored as NULL in tuples.  TupleDescFinalize()  
didn't check for this, and that could result in attcacheoff being set for  
and beyond virtual generated columns.  Also, the TupleDesc's  
firstNonGuaranteedAttr could also be set incorrectly, which could result  
in the tuple deformation function deforming without checking for NULLs,  
and deforming using incorrectly cached offsets.  
  
This could result in tuples being deformed incorrectly, which could  
result in incorrect results, ERRORs or possibly a crash.  
  
This has been broken since c456e39113.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/A4BC563C-0CA3-4EF3-952A-EA41F9E5BF1E%40gmail.com  

M src/backend/access/common/tupdesc.c
M src/backend/executor/execTuples.c

pg_surgery: Fix off-by-one bug with heap offset

commit   : 193a4ded94741ba9c24509540a5d586c11761e37    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Jun 2026 08:16:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Jun 2026 08:16:36 +0900    

Click here for diff

heap_force_common() declared a boolean array indexed with an  
OffsetNumber for a size of MaxHeapTuplesPerPage.  OffsetNumbers are  
1-based, so an input TID whose offset number equals MaxHeapTuplesPerPage  
wrote one byte past the end of the stack array, crashing the server.  
  
Like heapam_handler.c, this commit changes the array so as it uses a  
0-based index, substracting one from the OffsetNumbers.  
  
Reported-by: Wang Yuelin <violin0613@tju.edu.cn>  
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>  
Discussion: https://postgr.es/m/20260604002256.40f1fd544@smtp.qiye.163.com  
Backpatch-through: 14  

M contrib/pg_surgery/heap_surgery.c

doc: Clarify OAuth validator authn_id logging

commit   : 4cb2e2fe0aa8251bef8c2e2351cd5a062c105c0a    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 6 Jun 2026 00:18:30 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 6 Jun 2026 00:18:30 +0200    

Click here for diff

Document that OAuth validators can return an authenticated identity  
in the authn_id member.  The server records the identity value before  
checking if the connection is authorized, so it may appear in  
connection-authentication logs (even if the connection later fails  
authorization).  
  
Also remove outdated wording saying that all result parameters are  
ignored when a validator returns false since validators may provide  
error_detail.  
  
Patch by Chao Li with some additional wordsmithing by me.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reported-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/0281836A-F5FF-41A5-9EE1-656C1FAAC6B2@gmail.com  

M doc/src/sgml/oauth-validators.sgml

doc: Use groups instead of curves in TLS documentation

commit   : 55136e378c6bfc2240043d0edee6f92924e2c9fd    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 22:16:42 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 22:16:42 +0200    

Click here for diff

With TLS 1.3 the concept of curves was renamed to groups.  Update  
our wording to use groups instead of curves to make it clear what  
the underlying GUC can support.  
  
This was extracted from a slightly larger patch which also renamed  
variables to match the new terminology.  Given that we are in beta  
this portion was however left as a future excercise.  
  
Author: Evan Si <evsi@amazon.com>  
Reviewed-by: Ewan Young <kdbase.hack@gmail.com>  
Discussion: https://postgr.es/m/23C40DD6-1C47-46FC-A746-8A1D8530AD3E@amazon.com  
Backpatch-through: 18  

M doc/src/sgml/config.sgml

doc PG 19 relnotes: update to current, merge items

commit   : 4ebae546accf6ff0daee2f171f5d6907771b76f6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 5 Jun 2026 14:05:01 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 5 Jun 2026 14:05:01 -0400    

Click here for diff

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

refint: Remove plan cache.

commit   : 1fbe2066dcc882321e87fdac43b942b890338f34    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 5 Jun 2026 12:08:05 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 5 Jun 2026 12:08:05 -0500    

Click here for diff

Presently, refint stores plans in a per-backend cache to avoid  
re-preparing in each call.  This has a few problems.  For one,  
check_foreign_key() embeds the new key values in its cascade-UPDATE  
queries, so a cached plan reuses the values from preparation.  
Also, the cache is never invalidated, so it can return stale  
entries that cause other problems.  There may very well be more  
bugs lurking.  
  
We could spend a lot of time trying to address all these problems,  
but this module is primarily intended as sample code, and by all  
indications, it sees minimal use.  Furthermore, there is a growing  
consensus for removing refint in v20.  However, since we'll need to  
support it on the back-branches for a while longer, it probably  
still makes sense to fix some of the more egregious bugs.  
  
Therefore, let's just remove refint's plan cache entirely.  That  
means we'll re-prepare on every call, but that seems quite unlikely  
to bother anyone.  On v17 and older versions, the regression test  
for triggers fails after this change, so I've borrowed pieces of  
commit 8cfbdf8f4d to fix it.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com  
Backpatch-through: 14  

M contrib/spi/refint.c

doc PG 19 relnotes: add more markup, move some items to sysviews

commit   : b45137f315bb49fa4f50ae9cc16fda0a49196610    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 5 Jun 2026 11:38:34 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 5 Jun 2026 11:38:34 -0400    

Click here for diff

Also remove duplicate psql tab completion authors.  
  
Reported-by: duplicates reported by Yugo Nagata  

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

Reword activity message to avoid truncation

commit   : e5e1f6dc795da65d430d59a813643739bed6cadb    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 17:25:56 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 17:25:56 +0200    

Click here for diff

The message sent to pg_stat_activity when waiting for transactions to  
end was long enough that it could get truncated when the xid included  
in the string grew large. Fix by rewording to avoid truncation, using  
a similar message in the logical replication code as inspiration.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: ChangAo Chen <cca5507@qq.com>  
Discussion: https://postgr.es/m/tencent_47CA9CE2F91FF4D81D875E162AD69AA4900A@qq.com  

M src/backend/postmaster/datachecksum_state.c

Fix LATERAL references in GRAPH_TABLE with multi-label pattern

commit   : 4cb2a9863d89b320f37eb1bd76822f6f65e59311    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jun 2026 09:27:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jun 2026 09:27:31 +0200    

Click here for diff

When rewriting a GRAPH_TABLE into a subquery,  
replace_property_refs_mutator() bumps levelsup of lateral references  
by one so that they reference outside the subquery.  This works for  
path patterns that result in only one path query.  Patterns that  
produce multiple path queries are rewritten as a UNION of path  
queries.  Since every path query becomes a subquery of the UNION  
statement, the levelsup of lateral references in those path queries  
need an additional bump.  This adjustment was missing resulting in the  
lateral references being interpreted as references in the UNION query  
itself.  This caused different symptoms like a crash in  
create_lateral_join_info() or error "plan should not reference  
subplan's variable".  The symptoms varied depending on the number of  
RangeTblEntries in the UNION statement.  
  
This commit adds the missing adjustment.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Author: Satya Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDfnLzsgjaQ_CiKSpP4JH3MKOiwoawEcCzXa9uYr45yiWw%40mail.gmail.com  

M src/backend/rewrite/rewriteGraphTable.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Handle element label and label property objects in object address functions

commit   : 72498a86989e3491228ba09be43eab778a3ac943    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jun 2026 08:59:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 Jun 2026 08:59:05 +0200    

Click here for diff

getObjectTypeDescription() and getObjectIdentityParts() do not handle  
objects in pg_propgraph_element_label and pg_propgraph_label_property  
catalogs.  These functions when called for handling DDL that affects  
these objects cause an "unsupported object class" error.  An error is  
reported when these functions are called via pg_identify_object() and  
pg_identify_object_as_address() with objects from the said catalogs.  
  
The objects in these catalogs do not have a (user-given) name but they  
can be manipulated individually through ALTER PROPERTY GRAPH  
sub-commands.  Hence they need to be accessible to the event triggers.  
Handle these catalogs in the respective functions.  
  
Reported-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/aej1DkLwhyZWmtxJ@bdtpg  

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

xml2: Fix stylesheet document leak in xslt_process()

commit   : 9ec568b3eb6a8e8aad9041078e4c7bfedf293ca8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jun 2026 14:29:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jun 2026 14:29:27 +0900    

Click here for diff

xslt_process() parses the stylesheet text into an xmlDoc before passing it  
to xsltParseStylesheetDoc().  On success, the returned stylesheet owns  
that document and frees it through xsltFreeStylesheet(), calling  
xmlFreeDoc() at its end.  On failure, libxslt leaves the caller  
responsible for the xmlDoc.  In xml2, this would cause the memory  
allocated for the xmlDoc to pile up across calls of xslt_process() when  
failing to create a sheet.  
  
While on it, I have double-checked the code of xml2 with libxslt, and it  
seems that we are in the clear now, hopefully..  This leak exists for a  
long time.  732061150b0 has made the fix introduced in this commit  
easier to implement.  
  
Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>  
Discussion: https://postgr.es/m/20260605024642.5a1b6518@andrnote  

M contrib/xml2/xslt_proc.c

Fix pg_subscription column privileges for subwalrcvtimeout

commit   : 1a5b19e447aa6c2743371dc559f697cf63c7ba82    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 5 Jun 2026 09:51:55 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 5 Jun 2026 09:51:55 +0900    

Click here for diff

The subwalrcvtimeout column was added by commit fb80f38, but the  
column-level privileges on pg_subscription were not updated. As a  
result, non-superusers cannot read the column, unlike the other  
publicly readable pg_subscription columns.  
  
This commit grants SELECT privilege on subwalrcvtimeout to PUBLIC.  
  
Bump catalog version.  
  
Author: Nisha Moond <nisha.moond412@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CABdArM4uA=6nA0BunJwudiEoY1BcWUS_oj_2pkEq_d-YdiBJhw@mail.gmail.com  

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

Fix off-by-one with NFC recomposition for Hangul U+11A7 (TBASE)

commit   : f2ff15e4c37190e677437ecb76f706a05a645c6b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jun 2026 07:50:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Jun 2026 07:50:08 +0900    

Click here for diff

The NFC recomposition incorrectly included TBASE as a valid T syllable,  
which is incorrect based on the Unicode specification (TBASE is one  
below the start of the range, range beginning at U+11A8).  
  
This would cause the TBASE to be silently swallowed in the  
normalization, leading to an incorrect result.  
  
A couple of regression tests are added to check more patterns with  
Hangul recomposition and decomposition, on top of a test to check the  
problem with TBASE.  Diego has submitted the code fix, and I have  
written the tests.  
  
Author: Diego Frias <mail@dzfrias.dev>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/B92ED640-7D4A-4505-B09F-3548F58CBB16@dzfrias.dev  
Backpatch-through: 14  

M src/common/unicode_norm.c
M src/test/regress/expected/unicode.out
M src/test/regress/sql/unicode.sql

doc: Mention online checksum enabling in pg_checksums docs

commit   : 4ae3e98c02cf57ba5e1d29e914a3b2e4d15f066f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 00:12:33 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 5 Jun 2026 00:12:33 +0200    

Click here for diff

The documentation for bin/pg_checksums refered to online processing only  
in passing, this extends the documentation to list online checksums as as  
alternative as well as providing a link to the new Data Checksums section.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Bruce Momjian <bruce@momjian.us>  
Reported-by: Bruce Momjian <bruce@momjian.us>  
Discussion: https://postgr.es/m/aiHKJWa1k28fFTqf@momjian.us  

M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/wal.sgml

ci: Remove support for cirrus-ci based CI

commit   : 68c8a365d4dcefd7ec60f7a99a7ab7b557c36357    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 4 Jun 2026 14:55:57 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 4 Jun 2026 14:55:57 -0400    

Click here for diff

As mentioned in the earlier commit, cirrus-ci has shut down. Therefore remove  
all files related to running CI via cirrus. Also update comments / code that  
were referencing cirrus-ci.  
  
Discussion: https://postgr.es/m/3ydjipcr7kbss57nvi67noplncqhesl5eyb6wgol4ccjxynspv%40yatlykpribmm  

D .cirrus.star
D .cirrus.tasks.yml
D .cirrus.yml
M src/bin/pg_combinebackup/t/010_hardlink.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/ci/ci_macports_packages.sh
D src/tools/ci/gcp_ram_disk.sh

ci: Add GitHub Actions based CI

commit   : 9c126063b19adc53a0ce15ac1ae1a70979e3c12e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 4 Jun 2026 14:55:57 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 4 Jun 2026 14:55:57 -0400    

Click here for diff

Cirrus CI, which the project used for CI until now, has shut down on June 1,  
2026. Replace it with GitHub Actions. GitHub Actions was selected because it  
has unlimited runner time for public repositories.  
  
The GitHub Actions based CI currently covers:  
  
- SanityCheck  
- Linux - Autoconf  
- Linux - Meson, (32-bit and 64-bit)  
- macOS - Meson  
- Windows (Visual Studio + Meson and MinGW + Meson)  
- CompilerWarnings  
  
BSD coverage is left for later, as it requires more work.  
  
Note that, for performance reasons, use of address sanitizer was moved to the  
Linux - Meson (64-bit) task.  
  
While Actions workflows in new forks are disabled by default, existing forks  
that pull new changes into the repository will automatically start running  
CI. That may not be desired. There however is no way native to Actions to  
prevent this.  
  
To avoid that, each repository that wants real CI to run needs to explicitly  
opt into doing so, by creating the 'PG_CI_ENABLED' repository variable with  
the value 1.  
  
To make that less confusing, emit a summary whenever we skip running CI, with  
a message explaining how to enable CI.  
  
The remaining cirrus-ci support will be removed in a subsequent commit, to  
make review easier.  
  
Back-branches will be updated later, after being sure that workflow runs  
correctly on master.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/3ydjipcr7kbss57nvi67noplncqhesl5eyb6wgol4ccjxynspv%40yatlykpribmm  

A .github/workflows/pg-ci.yml
M src/tools/ci/README
M src/tools/ci/ci_macports_packages.sh

doc PG 19 relnotes: various fixes reported via email

commit   : 7598b5383b16a562bd7e7732eda7d783b34f4615    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 4 Jun 2026 12:26:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 4 Jun 2026 12:26:38 -0400    

Click here for diff

M doc/src/sgml/config.sgml
M doc/src/sgml/release-19.sgml

Improve reporting of invalid weight symbols in setweight() et al.

commit   : ce6bf3cd17d1f96c9c40d2915ef25580fbbc8be7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 12:24:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 12:24:51 -0400    

Click here for diff

This commit addresses two related issues:  
  
tsvector_filter() assumed it could print an incorrect weight value  
with %c.  This could result in an invalidly-encoded error message  
if the database encoding is multibyte and the char value has its  
high bit set.  Weight values that are ASCII control characters  
could render illegibly too.  Fix by printing such values in octal  
(\ooo), similarly to how charout() would render them.  
  
tsvector_setweight() and tsvector_setweight_by_filter() reported  
the same unrecognized-weight error condition with elog(), as though  
it were an internal error.  That'd not translate, would produce an  
unwanted XX000 SQLSTATE code, and also reported the bad value as a  
decimal integer which seems unhelpful.  Fix by refactoring so that  
all three functions share one copy of the code that interprets a  
weight argument.  
  
The invalid-encoding aspect seems to me (tgl) to justify  
back-patching.  
  
Author: Ewan Young <kdbase.hack@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com  
Backpatch-through: 14  

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

Fix another case of indirectly casting away const.

commit   : c35f85ac02a1c19dbb40382a8098846ffc3b368b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 11:37:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 11:37:43 -0400    

Click here for diff

Like 8f1791c61, this fixes a case of implicitly casting away  
const by not treating the result of strrchr() on a const pointer  
as const.  This was missed at the time because the machines  
reporting those warnings weren't building with --with-llvm.  
  
While here, clean up another infelicity: in the probably-  
impossible case that the input string contains only one dot,  
this function would call pnstrdup() with a length of -1  
and thereby emit a module name equal to the function name.  
It seems to me we should emit modname = NULL instead.  
  
Also remove a useless Assert and two redundant assignments.  
  
Back-patch, as 8f1791c61 was, so that users of back branches  
don't see this warning when building with late-model gcc.  
  
Reported-by: hubert depesz lubaczewski <depesz@depesz.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/aiGNJ89PBqvq2Yyz@depesz.com  
Backpatch-through: 14  

M src/backend/jit/llvm/llvmjit.c

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

commit   : 4dce650cc1bb48d6a65503f17dff87085728e08b    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Jun 2026 10:16:21 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Jun 2026 10:16:21 -0500    

Click here for diff

M .git-blame-ignore-revs

Re-pgindent nodeModifyTable.c after commit 993a7aa0e4.

commit   : bd57abbb1910e51e45761b59985745d094ae9e03    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Jun 2026 10:15:37 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Jun 2026 10:15:37 -0500    

Click here for diff

M src/backend/executor/nodeModifyTable.c

Ensure USE_AVX... symbols are not defined if not building for x86_64.

commit   : e88bd2736f86d66dc75ad8b2f7edd799d20b7d53    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 10:37:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 Jun 2026 10:37:25 -0400    

Click here for diff

Various code assumed this was true already, and usually it is.  
However, it emerges that in a "universal" (multi-architecture)  
macOS build, configure will define USE_AVX2_WITH_RUNTIME_CHECK  
if the build host is x86_64, and then the arm64 half of the  
build fails.  
  
Ideally we'd get pg_config.h to define this symbol conditionally  
depending on defined(__x86_64__), but I don't see any way to  
persuade Autoconf to do that.  Instead, clean up the mess by  
#undef'ing it again in c.h for not-x86_64 builds.  
  
For consistency I made c.h also #undef the USE_AVX512... symbols.  
Those are not actively broken, but it seems only happenstance  
that configure's tests for them fail in a universal build.  
Down the road we may have occasion to add more #undef's here.  
  
This problem is new in v19, so no need for back-patch.  
  
Reported-by: Sandeep Thakkar <sandeep.thakkar@enterprisedb.com>  
Reported-by: Tobias Bussmann <t.bussmann@gmx.net>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/15574903-87C9-478A-B2D7-CC8F4C275DBB@gmx.net  

M src/include/c.h

Small terminology fixes in comments

commit   : f0aedc7cb0ed82d4cca48332dc0852c767514558    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:57:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:57:55 +0200    

Click here for diff

Author: jian he <jian.universality@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDcd%3Dt69gLf9yQexO07EJ2mx0Z70NFHo6h94X1EDA%3DhM0g%40mail.gmail.com  

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

Require UPDATE permission on FOR PORTION OF column

commit   : 7ac030d5b152475275e84e0abe0b3628700fbeda    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:30:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:30:41 +0200    

Click here for diff

It seems like the SQL standard does require this after all, and it  
makes sense because these columns get changed.  (This is not to be  
confused with *not* requiring INSERT permission to add the temporal  
leftovers.)  
  
Adding the column to RTEPermissionInfo->updatedCols also fixes a  
couple outstanding bugs from other (non-permission) features using  
that bitmapset to detect changes: GENERATED columns and UPDATE OF  
triggers.  This patch includes test cases to exercise those scenarios,  
including on partitioned tables.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDcd%3Dt69gLf9yQexO07EJ2mx0Z70NFHo6h94X1EDA%3DhM0g%40mail.gmail.com  

M src/backend/parser/analyze.c
M src/test/regress/expected/for_portion_of.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/for_portion_of.sql
M src/test/regress/sql/privileges.sql

Fix cross-leftover pollution in FOR PORTION OF insert triggers

commit   : 993a7aa0e4af0922ac86d8914e0e78fc38fb0daf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:12:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Jun 2026 11:12:58 +0200    

Click here for diff

When we insert temporal leftovers after an UPDATE FOR PORTION OF, we  
must make a new copy of the tuple before each insert.  Otherwise, if  
an insert trigger assigns to attributes of NEW, the second leftover  
sees those changes.  
  
Author: Sergei Patiakin <sergei.patiakin@enterprisedb.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://www.postgresql.org/message-id/flat/CANE55rCqcse_pwXBMWhbj3_7XROb8Dks6%3DOLFmKy3bO3zDsCsg%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c
M src/test/regress/expected/for_portion_of.out
M src/test/regress/sql/for_portion_of.sql

libpq: Fix "servicefile" after fallback to system service file

commit   : 90354030b8fceecef9a1908fdefcccf0e02823fb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jun 2026 15:12:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 4 Jun 2026 15:12:11 +0900    

Click here for diff

When "servicefile" is specified in a connection string but the requested  
service is not found in this file, libpq falls back to a default file,  
pg_service.conf in PGSYSCONFDIR.  The "servicefile" option was missing  
an update in this case, causing an incorrect value to be reported,  
impacting SERVICEFILE in psql, for example.  
  
An extra update of the option is added in this commit, based on the  
actual file where the service name has been found.  A test is added to  
cover this problem.  
  
Oversight in 092f3c63efc6.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/59DD1652-4EB5-449B-8DE3-959F06561A96@gmail.com  

M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/t/006_service.pl

doc PG 19 relnotes: merge pg_upgrade LO metadata items

commit   : 378668d50b44afb52688988de6651aa8585f3f5c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 3 Jun 2026 14:21:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 3 Jun 2026 14:21:05 -0400    

Click here for diff

Also fix commit message cut/paste mistake, and add "tar" markup.  

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

doc PG 19 relnotes: reordering, rewording, added markup

commit   : 41ddb9c33eadc7fec0745b86943c87f3a465cd40    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 3 Jun 2026 13:48:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 3 Jun 2026 13:48:02 -0400    

Click here for diff

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

pg_dump: scope indAttNames per index in getIndexes()

commit   : 298bdd379552148f6043b4595374a7a6fbdd13c3    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 3 Jun 2026 11:33:35 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 3 Jun 2026 11:33:35 +0300    

Click here for diff

getIndexes() declared indAttNames and nindAttNames in the outer  
per-table loop, so the names collected for an index on expressions  
were carried over to the next plain index in the same table.  
  
This is an internal inconsistency rather than a user-facing bug.  
dumpRelationStats_dumper() only walks indexes that have pg_statistic  
rows, and ANALYZE only creates those for indexes with expressions,  
so the second index in the affected pair is not visited and the stale  
array is never consulted.  
  
Fix by moving the two variables into the inner per-index loop so each  
iteration starts with a clean slate.  
  
Author: Maksim Melnikov <m.melnikov@postgrespro.ru>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/be5fc489-587e-421f-bbb8-adb43cfd50f4@postgrespro.ru  
Backpatch-through: 17  

M src/bin/pg_dump/pg_dump.c

Fix race in ReplicationSlotRelease() for ephemeral slots

commit   : f2081a7800f1696cb0415bacd655cb41b7b9ca63    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 3 Jun 2026 18:44:56 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 3 Jun 2026 18:44:56 +0900    

Click here for diff

When releasing an ephemeral replication slot, ReplicationSlotRelease()  
drops the slot via ReplicationSlotDropAcquired().  
  
However, after dropping the slot, ReplicationSlotRelease() continued  
to use its local "slot" pointer, which still referenced the dropped  
slot's former shared-memory entry. It could then update fields such as  
effective_xmin in that entry.  
  
Once an ephemeral slot has been dropped (via ReplicationSlotDropAcquired()),  
its slot array entry can be reused immediately by another backend  
creating a new slot. As a result, those updates could corrupt  
the state of an unrelated replication slot.  
  
Fix by skipping those shared-memory updates for phemeral slots and  
performing them only for non-ephemeral slots, whose shared-memory  
entries remain valid after release.  
  
Backpatch to all supported versions.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Masao Fujii <masao.fujii@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/TY4PR01MB177184FF9EE916F577E1F554194082@TY4PR01MB17718.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

M src/backend/replication/slot.c

Improve overflow/underflow handling in regr_intercept().

commit   : eb8e76e130fd8bd42982d597f5a66f08b13380c0    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 3 Jun 2026 09:20:21 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 3 Jun 2026 09:20:21 +0100    

Click here for diff

As with corr() and regr_r2(), improve regr_intercept()'s final  
function to cope with overflow/underflow in the final calculation.  
Here, instead of using sqrt(), we use frexp() and ldexp() to recover,  
if an overflow or underflow is detected, so that the multiplication  
and division steps operate on normalised mantissas, and cannot  
overflow or underflow.  
  
As with 6498287696d, and the previous commit improving regr_r2(), this  
is arguably a bug fix, but given the lack of prior complaints, refrain  
from back-patching.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Chengpeng Yan <chengpeng_yan@outlook.com>  
Discussion: https://postgr.es/m/33E01656-BB3B-46E9-A41F-24A01A7C35F4@outlook.com  

M src/backend/utils/adt/float.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Improve overflow/underflow handling in regr_r2().

commit   : d58ec50e0faae364fa59cdb88eba7e23b55ab583    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 3 Jun 2026 09:01:13 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 3 Jun 2026 09:01:13 +0100    

Click here for diff

Commit 6498287696d improved corr()'s final function to cope with  
overflow/underflow in the final calculation, and clamped its result to  
[-1, 1] in case of roundoff error. Improve regr_r2() in a similar way,  
clamping its result to [0, 1].  
  
Arguably this is a bug fix, but given the lack of prior complaints,  
refrain from back-patching, as we did with 6498287696d.  
  
Reported-by: Chengpeng Yan <chengpeng_yan@outlook.com>  
Author: Chengpeng Yan <chengpeng_yan@outlook.com>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/33E01656-BB3B-46E9-A41F-24A01A7C35F4@outlook.com  

M src/backend/utils/adt/float.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

vacuumdb: Fix --analyze-in-stages skipping partitioned tables

commit   : 95b6ec52e684e5de743e5bf4a2303f6cac466682    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 3 Jun 2026 16:53:16 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 3 Jun 2026 16:53:16 +0900    

Click here for diff

Commit 6429e5b77 changed vacuumdb to process partitioned tables when  
--analyze-only or --analyze-in-stages is specified, matching the  
documented behavior of analyzing regular tables, partitioned tables,  
and materialized views.  
  
Later, commit c4067383cb2 accidentally changed this behavior so that  
partitioned tables were processed for --analyze-only, but skipped for  
--analyze-in-stages.  
  
As a result, vacuumdb --analyze-in-stages no longer matched its  
documentation. Partitioned tables were skipped, leaving parent-table  
statistics outdated even though users running vacuumdb  
--analyze-in-stages after pg_upgrade, restore, or bulk loading would  
expect statistics to be rebuilt for the database.  
  
Fix this issue by making --analyze-in-stages process partitioned  
tables again.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/EDFF0AFB-050F-4FBF-8D4F-B44DC454D957@gmail.com  

M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuuming.c

Fix copy-paste error in hash_record_extended()

commit   : 273a3c77615e793089b2f41b666b6fcaa970a0c9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 12:47:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 12:47:22 +0900    

Click here for diff

The code failed to initialize the second isnull argument passed to  
FunctionCallInvoke().  This is harmless for existing in-core extended  
hash support functions, since FunctionCallInvoke() does not use the  
value (note that all the in-core extended hash functions are strict),  
examining only the argument values.  However, extension-provided  
extended hash functions could be affected if they inspect  
PG_ARGISNULL(1).  
  
Oversight in 01e658fa74cb.  
  
Author: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/tencent_7818173C01E01836109848C3@qq.com  
Backpatch-through: 14  

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

Fix eager aggregation for semi/antijoin inner rels

commit   : ffeda04259bb0b78e901c61e4b9d0ad86e786f4f    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 3 Jun 2026 10:12:40 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 3 Jun 2026 10:12:40 +0900    

Click here for diff

Eager aggregation pushes a partial aggregate down to a base or join  
relation, to be finalized after that relation is joined with the rest  
of the query.  eager_aggregation_possible_for_relation() already  
refuses to do this for a relation on the nullable side of an outer  
join, but it failed to also refuse it for a relation on the inner side  
of a semijoin or antijoin.  
  
Such a join does not emit its inner rows, so a partial aggregate  
computed on the inner side does not survive the join and cannot be  
combined by the final aggregation.  This can happen only for an  
aggregate that references no table column, such as count(*): it is  
considered computable on any relation, including the inner one,  
whereas an aggregate that references a column is anchored to the outer  
side and never reaches the inner relation.  
  
The existing outer-join check did not catch this because it consults  
nulling_relids, which only tracks joins that null-extend their inner  
side.  Semijoins and antijoins formed from EXISTS, IN, NOT EXISTS, or  
NOT IN sublinks do not null-extend and carry no ojrelid, so they are  
invisible to that check.  
  
Fix by additionally rejecting any relation that includes inner-side  
relations of a semijoin or antijoin but not the join's outer side.  
Pushing a partial aggregate to the outer side of such a join, grouped  
by the join key, remains valid and is still allowed.  
  
Reported-by: Radim Marek <radim@boringsql.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAJgoLk+d_P5sKrx-SZt01Acm_j0QnWn6aKJzFJ=waRu_3C8AoQ@mail.gmail.com  

M src/backend/optimizer/README
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/eager_aggregate.out
M src/test/regress/sql/eager_aggregate.sql

Fix wrong unsafe-flag test in check_output_expressions()

commit   : ee2fa291c8b2f8abdbad57024b92652ac4a640ff    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 3 Jun 2026 09:36:52 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 3 Jun 2026 09:36:52 +0900    

Click here for diff

The check for window functions (point 4) guarded on the wrong bit: it  
tested UNSAFE_NOTIN_DISTINCTON_CLAUSE while setting  
UNSAFE_NOTIN_PARTITIONBY_CLAUSE.  Each check in this loop guards on  
the same bit it is about to set, as an idempotency optimization, since  
unsafeFlags[] is accumulated across the arms of a set operation and  
there is no point recomputing a column's status once its bit is  
present.  
  
This is not a live bug.  When UNSAFE_NOTIN_PARTITIONBY_CLAUSE is  
already set but UNSAFE_NOTIN_DISTINCTON_CLAUSE is not, the guard fails  
to skip targetIsInAllPartitionLists() and recomputes it, but setting  
the same bit again changes nothing.  When  
UNSAFE_NOTIN_DISTINCTON_CLAUSE is already set, point 4 is skipped and  
UNSAFE_NOTIN_PARTITIONBY_CLAUSE is left unset; but such a column is  
already unsafe for pushdown via UNSAFE_NOTIN_DISTINCTON_CLAUSE, so the  
outcome is unchanged.  
  
To fix, test UNSAFE_NOTIN_PARTITIONBY_CLAUSE, matching the bit being  
set and the pattern of the surrounding checks.  
  
Back-patch to v15, where the buggy check was introduced.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49Q_xnF_P2QSUyDzJ34MnrO7dh-cUAaK2HJPgSgh88NcA@mail.gmail.com  
Backpatch-through: 15  

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

psql: Fix issues with deferred errors in pipelines

commit   : d21604e17e491eef39626a2eff518b9731fefb91    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 08:58:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 08:58:26 +0900    

Click here for diff

When an error is raised while processing a Sync message in a pipeline,  
like a deferred constraint violation, the error was not associated with  
the piped command and was not counted in available_results.  This caused  
assertion failures in discardAbortedPipelineResults(), keeping an  
incorrect state at pipeline exit, because the code assumed that the  
number of available and requested results would always be positive,  
expecting all the counters to be 0 at the end of a pipeline.  
  
This commit switches discardAbortedPipelineResults() and  
ExecQueryAndProcessResults() to take a softer approach when consuming  
and draining the results after an error.  If there are still piped syncs  
in the pipeline when it ends, we now attempt to consume them before  
leaving the pipeline mode.  
  
Alexander has been able to reach two assertion failures through his  
testing.  While investigating more this issue, I have bumped into two  
more.  Most of these cases are covered by the regression tests added in  
this commit, plus some cases with mixes of pipelines, deferred errors  
and results fetched.  Some of the tests discussed (like the backend  
termination one) could not be included in this commit but have been  
tested manually.  Another test scenario discussed involved the injection  
of an error state in the backend, that was able to trick libpq  
internally and put its queue out of sync.  This scenario is not going to  
happen in practice, but if we were to do something about it we would  
need to make libpq understand that it needs to fail in some cases but  
not block.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/19494-97a86d84fee71c47@postgresql.org  
Backpatch-through: 18  

M src/bin/psql/common.c
M src/test/regress/expected/psql_pipeline.out
M src/test/regress/sql/psql_pipeline.sql

xml2: Fix more memory leaks with libxml2 and XPath evaluations

commit   : a77bdb11e6ba47f1a3e8363411b84c7f35f676e2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 08:16:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 3 Jun 2026 08:16:42 +0900    

Click here for diff

Several objects were allocated by libxml2 and never released in some  
error or even success paths, leading to some memory leaks that would  
stack across SQL calls:  
- In pgxml_xpath(), the result of xmlXPathCompiledEval() could leak.  
This now uses a TRY/CATCH block to ensure a correct cleanup of a  
workspace on failure.  
- In xpath_table() missed some objects not freed on failure.  Some  
xmlFree() calls were missing for the results copied after a success.  
- In pgxmlNodeSetToText(), xmlXPathCastNodeToString() allocates a result  
that the caller is responsible for freeing.  It was not freed.  
  
Most of the work of this commit stands on top of 732061150b0, that has  
refactored xml2 to make the handling of such leaks easier.  The leaks  
fixed here are more ancient than the commit mentioned above, and we have  
never bothered doing something about them in older stable branches.  
  
Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/20260601010124.5edf9a20@andrnote  

M contrib/xml2/xpath.c

Stamp 19beta1.

commit   : 4b0bf0788b066a4ca1d4f959566678e44ec93422    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jun 2026 16:02:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 1 Jun 2026 16:02:13 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Translation updates

commit   : ef6a95c7c64de07dff4dd1f1da88ffae7b086ef3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jun 2026 12:13:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 1 Jun 2026 12:13:54 +0200    

Click here for diff

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

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

commit   : 78ec4b69a0dc064fc8c65bf0711db5a32d030237    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 23:19:18 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 23:19:18 -0400    

Click here for diff

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

doc PG 19 relnotes: first phase of markup additions

commit   : 4ff61509881b708a96e7c0055038b46071f4b8b5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 22:54:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 22:54:03 -0400    

Click here for diff

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

doc: add missing xreflabel to debug_print_raw_parse

commit   : 39343218347b4bbd41bb8b4bbdac595695d59000    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 16:17:49 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 31 May 2026 16:17:49 -0400    

Click here for diff

M doc/src/sgml/config.sgml

doc relnote markup: allow period in <command> regex for ellipses

commit   : 21298c2cd0cd8fe83e567f3f3f16475bd3934124    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 30 May 2026 17:49:26 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 30 May 2026 17:49:26 -0400    

Click here for diff

M doc/src/sgml/release.sgml

doc PG 19 relnotes: adjust pg_read_all_data & pg_write_all_data

commit   : 3e744cc745b894b3712990b84729f805e4333147    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 30 May 2026 14:55:32 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 30 May 2026 14:55:32 -0400    

Click here for diff

These were previously marked as functions, not roles, and were in the  
wrong section.  
  
Reported-by: 彭冲 <chong.peng@enmotech.com>  
  
Discussion: https://postgr.es/m/tencent_5468291122A490C6578D9467@qq.com  

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

Avoid leaking system path from pg_available_extensions

commit   : db5ed03217b9c238703df8b4b286115d6e940488    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 20 May 2026 08:49:15 +0800    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 20 May 2026 08:49:15 +0800    

Click here for diff

The documentation says that when extension_control_path is set to an  
empty string, the default '$system' path is still assumed.  However,  
get_extension_control_directories() added the system extension directory  
with a NULL macro in that case.  As a result, pg_available_extensions  
could expose the expanded system directory path instead of reporting  
'$system' as the location.  
  
Record the implicitly-added system directory with the '$system' macro, so  
pg_available_extensions reports the documented symbolic location and does  
not leak the actual system path.  
  
Update the extension_control_path TAP test to check the reported location  
directly.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Lu Feng <fnlo1995@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Discussion: https://postgr.es/m/357C774A-ECE9-4455-B641-315205D4D9A1@gmail.com  

M src/backend/commands/extension.c
M src/test/modules/test_extensions/t/001_extension_control_path.pl

Apply encoding conversion in COPY TO FORMAT JSON

commit   : 7dc5bbcf220be05786a08aad2455c61b6dbd4b78    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 20 Apr 2026 11:16:36 +0530    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 20 Apr 2026 11:16:36 +0530    

Click here for diff

CopyToJsonOneRow() sent the output of composite_to_json() directly  
via CopySendData() without encoding conversion.  The text and CSV  
paths convert per-attribute via pg_server_to_any() when  
need_transcoding is true, but the JSON path skipped this entirely.  
  
This meant COPY ... TO ... WITH (FORMAT json, ENCODING 'LATIN1') on  
a UTF-8 server silently produced UTF-8 output, and COPY TO STDOUT  
with a non-UTF-8 client_encoding would send unconverted bytes to  
the client.  
  
Apply pg_server_to_any() to the whole JSON buffer after  
composite_to_json() returns, converting to the requested file  
encoding when it differs from the server encoding.  Tests cover  
both the explicit ENCODING option and the implicit case where  
file_encoding is inherited from client_encoding.  
  
Introduced by 7dadd38cda9 (json format for COPY TO).  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CAJTYsWX-jsLzxGRAb-dWnEpGYRPbDYHwce8LctVE92LiDfM2Jw@mail.gmail.com  

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

Allow old WAL recycling during REPACK CONCURRENTLY

commit   : 45b02984e2fa9ee7bd83f7e58797b160baf0cc13    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 30 May 2026 00:23:25 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 30 May 2026 00:23:25 +0200    

Click here for diff

During REPACK CONCURRENTLY, logical decoding keeps replication  
slot.restart_lsn pinned behind the oldest running transaction, which is  
often the long-lived REPACK transaction itself. As a result, old WAL  
segments are retained longer than necessary.  
  
This commit advances the replication slot each time WAL insertion  
crosses a segment boundary, so obsolete WAL files can be recycled while  
REPACK is still running.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
  
Discussion: https://postgr.es/m/TY4PR01MB17718B44164522D0798F8E898940A2@TY4PR01MB17718.jpnprd01.prod.outlook.com  

M src/backend/commands/repack_worker.c

doc: Correct the timeline for OAuth's shutdown_cb

commit   : 08127c641c099b21480d4cd47c2706fe64ca1820    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 14:40:20 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 14:40:20 -0700    

Click here for diff

During original feature development, the OAuth validator shutdown  
callback was invoked via before_shmem_exit(). That was changed to use a  
reset callback before commit, but I forgot to update the documentation  
for validator developers.  
  
Correct this and backport to 18, where OAuth was introduced. The  
callback is invoked whenever the server is "finished" with token  
validation. (We make no stronger guarantees here, in the hopes that this  
API might successfully navigate future multifactor authentication  
support and/or changes to the server threading model.)  
  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAN4CZFOuMb_gnLvCwRdMybg_k8WRNJTjcij%2BPoQkuQHDUzxGWg%40mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/oauth-validators.sgml

Fix compilation with OpenSSL 4

commit   : 89d243d52189ad426538012e0db9aad441240e68    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:52:35 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:52:35 +0200    

Click here for diff

OpenSSL 4.0.0 changed some parameters and returnvalues to const, so  
we need to update our declarations and subsequently cast away const-  
ness from a few callsites to make libpq build without warnings. This  
is tested with OpenSSL 1.1.1 through 4.0.0 as well as with LibreSSL.  
No functional change is introduced, this commit only allows postgres  
to be compiled against OpenSSL 4.0.0 without warnings.  
  
There is also an errormessage change in OpenSSL 4.0.0 which needed  
to be covered by our testharness.  
  
This will be backpatched to all supported branches since they are  
all equally likely to be built against OpenSSL 4.0.0 as it becomes  
available in distributions.  Backpatching will be done once it has  
been in master for a few days without issues.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/066B07BB-85FA-487C-BE8C-40F791CFC3C4@yesql.se  
Backpatch-through: 14  

M contrib/sslinfo/sslinfo.c
M src/backend/libpq/be-secure-openssl.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/001_ssltests.pl

Constistent naming for datacheckusms processes

commit   : 5ab239c9a908ba5d8614d23fcdc425859a2fed3c    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:25 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:25 +0200    

Click here for diff

The launcher and worker for enabling/disabling checksums were named  
"datachecksum worker|launcher" but using the plural form makes more  
sense given the underlying GUC name data_checksums.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20260528.121622.1662808269492494574.horikyota.ntt@gmail.com  

M src/backend/postmaster/datachecksum_state.c
M src/include/postmaster/proctypelist.h
M src/test/modules/test_checksums/t/002_restarts.pl
M src/test/modules/test_checksums/t/003_standby_restarts.pl
M src/test/modules/test_checksums/t/DataChecksums/Utils.pm
M src/test/regress/expected/stats.out

Use correct datatype for PID

commit   : 0ca1b3010597231b474d94d877ecc8266a473537    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:23 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:23 +0200    

Click here for diff

The datachecksums launcher was using int for storing a PID, but  
the correct type is pid_t (which is defined to be a signed int).  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/f1281cf3-89a3-4936-9bc5-2a5a6291229f@vondra.me  

M src/backend/postmaster/datachecksum_state.c

Improve comments in online checksums code

commit   : cd857dec0e0ae63dabf548d51fddb27c45561086    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:21 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:21 +0200    

Click here for diff

Spelling fixes and rewording outdated information.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/f1281cf3-89a3-4936-9bc5-2a5a6291229f@vondra.me  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/datachecksum_state.c
M src/backend/utils/init/postinit.c

Fix checksum state transition during promotion

commit   : 5fee7cab1b8746c9e1bc25b20158cb074c7a76da    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:18 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 29 May 2026 21:26:18 +0200    

Click here for diff

When a standby is promoted to primary during checksum enabling when the  
state is inprogress-on, the standby shall revert the state to off since  
checksums weren't fully enabled at the time of the crash.  Consider the  
following scenario:  
  
  1) primary/standby cluster has checksums off  
  2) primary starts enabling checksums  
  3) primary moves to inprogress-on  
  4) standby receives that and moves to inprogress-on too  
  5) primary crashes  
  6) standby gets promoted, and does the StartupXLOG thing  
  7) standby moves from inprogress-on back to off  
  
Any processes in the standby need to be informed at step 6 to change  
state with a procsignalbarrier, else they will stay in inprogress-on  
while new backends will see the state as off.  StartupXLOG failed to  
emit a procsignalbarrier which caused inconsistent state in the node  
promoted to primary.  
  
Fixed by emitting a procsignalbarrier during promotion, and adding a  
new test for this scenario.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/f1281cf3-89a3-4936-9bc5-2a5a6291229f@vondra.me  

M src/backend/access/transam/xlog.c
M src/test/modules/test_checksums/t/003_standby_restarts.pl

Advance restart_lsn more eagerly in LogicalConfirmReceivedLocation

commit   : 38470c2c1ea7dc0971d7abf65ef1dde80824ef43    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 21:10:01 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 21:10:01 +0200    

Click here for diff

The existing logic computed an updated replicationSlotMinLSN from all  
slots' restart_lsn only when catalog_xmin also advanced.  This is not a  
problem in normal (non-repack) cases, because catalog_xmin changes  
pretty frequently, so the recomputation is triggered frequently enough.  
However, REPACK does not currently change its catalog snapshot, so that  
doesn't work very well if no other replication slot is being used.  
  
(After this commit, we still don't recycle WAL properly for REPACK,  
because its background worker is not advancing its restart_lsn either;  
that will be fixed in a separate commit.  However, this preexisting  
problem in older code is logically separate from that one.)  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/TY4PR01MB17718B44164522D0798F8E898940A2@TY4PR01MB17718.jpnprd01.prod.outlook.com  

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

Remove unnecessary signal handler change

commit   : 5d48d3b14e0e3a46e93b9f71b47205bebaab4b0e    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 20:53:06 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 20:53:06 +0200    

Click here for diff

In reality, this changes nothing, since the signal handler in bgworkers  
is already die() since commit d62dca3b2974.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/e60318b8-be75-4bfd-82f0-0829f51fa839@gmail.com  

M src/backend/commands/repack_worker.c

libpq: Send users to the wiki during grease failures

commit   : 2368c14e9e205c5ee3cf0106bde028f2914f188a    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 11:34:12 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 11:34:12 -0700    

Click here for diff

The existing documentation link for grease errors is fine, but something  
a little more user-friendly and updatable would be ideal, since the  
campaign won't last very long. The page  
  
    https://wiki.postgresql.org/wiki/Grease  
  
has been added for this purpose. (It's admin-protected, to avoid making  
it a spam target).  
  
Discussion: https://postgr.es/m/CAOYmi%2BkVfqgPAaR1QuY7%3DRPBYR6MsA3V3_f5%2BH-75uC06YCDDA%40mail.gmail.com  

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

libpq: Fix grease error message style

commit   : 5ca41e4125e9822816a8c1fb79ec19077360b861    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 11:34:03 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 29 May 2026 11:34:03 -0700    

Click here for diff

Double-quote the protocol extension name, and move it out of line with a  
%s specifier, to help with translation. Fixes up 4966bd3ed.  
  
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Suggested-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20260528.121622.1662808269492494574.horikyota.ntt%40gmail.com  

M src/interfaces/libpq/fe-protocol3.c

pg_plan_advice: DO_NOT_SCAN is a simple tag, not a generic one.

commit   : b1901e2895e08f57a5fedfd27375babd6c633893    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 29 May 2026 13:51:09 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 29 May 2026 13:51:09 -0400    

Click here for diff

Generic tags allow sublists, e.g. MERGE_JOIN((x y)), but simple  
tags do not, e.g. SEQ_SCAN(x) is valid but SEQ_SCAN((x)) is not.  
DO_NOT_SCAN was intended to be simple tag, but was accidentally  
implemented as a generic one. This could result in assertion  
failures. Repair.  
  
Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru>  
Analyzed-by: Tender Wang <tndrwang@gmail.com>  
Analyzed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: http://postgr.es/m/19493-5878eac7a2525c23@postgresql.org  

M contrib/pg_plan_advice/expected/syntax.out
M contrib/pg_plan_advice/pgpa_parser.y
M contrib/pg_plan_advice/pgpa_scanner.l
M contrib/pg_plan_advice/sql/syntax.sql

pg_stash_advice: Reject overlong stash names in dump file.

commit   : 878839bafe259e6df355e7adc5a040a1541b63b8    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 29 May 2026 13:25:20 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 29 May 2026 13:25:20 -0400    

Click here for diff

Otherwise, the server will crash. This can only happen if the dump  
file has been corrupted or manually altered, but we should still  
defend against it.  
  
Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Co-authored-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Co-authored-by: Robert Haas <rhaas@postgresql.org>  
Discussion: http://postgr.es/m/CAJTYsWWYhcEx1YqC=B331-Df9EpD8MxzwswWL0okz9LLCUUpBA@mail.gmail.com  

M contrib/pg_stash_advice/stashpersist.c

Cover additional errors and corner conditions in repack.c

commit   : 2670cc298f42cd7b1c426bf7ccfb0652d8e0b347    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 11:54:00 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 29 May 2026 11:54:00 +0200    

Click here for diff

The coverage report shows that some error cases were not being tested;  
add test cases for them.  
  
While at it, move some recently added ones to the test_decoding suite:  
the preventative check added in 43649b6a53e9 now causes servers with  
wal_level=minimal to error out earlier than before.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Baji Shaik <baji.pgdev@gmail.com>  
Discussion: https://postgr.es/m/ahiwD29RNfVT4tjQ@alvherre.pgsql  

M contrib/test_decoding/expected/repack.out
M contrib/test_decoding/sql/repack.sql
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Use term "referenced" rather than "dependent" in dependency locking

commit   : e2b35735b00181ba098d102d6504978a61fab983    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 28 May 2026 21:38:21 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 28 May 2026 21:38:21 +0300    

Click here for diff

Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://www.postgresql.org/message-id/20260528.114608.488039299811669368.horikyota.ntt@gmail.com  
Backpatch-through: 14  

M src/backend/catalog/pg_depend.c
M src/test/isolation/expected/ddl-dependency-locking.out

Improve REPACK (CONCURRENTLY) error messages some more

commit   : 378dffaf8c80f07f2226538669da4d98ffaecefa    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 20:29:20 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 20:29:20 +0200    

Click here for diff

We had discussed changing the wording of messages from "cannot repack  
table X" to "cannot execute REPACK on table X", so that translators  
don't have to figure out how to translate REPACK as a verb in their  
language.  We already do that for VACUUM and others and it's not very  
nice.  Also remove extra double-quotes in a message of that form which I  
mistakenly added in commit 43649b6a53e9.  
  
While at it, add specific error messages for the cases of a table with a  
deferrable primary key, and of REPLICA IDENTITY FULL; otherwise the user  
gets a message that the table doesn't have an identity index and it's  
not clear why that is.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Discussion: https://postgr.es/m/CA+fm-ROdgh0rEVuXoViBk4TVgjodrN=MTR_RYuOuKLZ9voX4YA@mail.gmail.com  
Discussion: https://postgr.es/m/CABV9wwOo=wvq1hwTRK6HgBWUB=ekzsEebY30EWoc1V9UJQrrrw@mail.gmail.com  

M src/backend/commands/repack.c
M src/test/regress/expected/cluster.out

Make stack depth check work with asan's use-after-return

commit   : 659701788171a5899119a6ddd98771371b355437    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 28 May 2026 11:34:11 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 28 May 2026 11:34:11 -0400    

Click here for diff

With address sanitizer's stack-use-after-return check, stack variables are  
moved to heap allocations, to allow to detect references to the memory at a  
later time. That broke our stack-depth check, which is why we had to disable  
detect_stack_use_after_return in CI. Luckily __builtin_frame_address() works  
correctly, even under asan, so use that.  
  
We started using __builtin_frame_address() with de447bb8e6fb, however as of  
that commit we just used it for the stack base address, not for the value to  
compare to the base address.  Now we use it for both.  
  
When building without __builtin_frame_address() support, we continue to use  
stack variables for the stack depth determination.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/2kk4z4odvuyrg7qlwjd7ft4eron4cle4btb33v4qatgsdkayir@gj6e62rgsel4  
Backpatch-through: 14  

M .cirrus.tasks.yml
M src/backend/utils/misc/stack_depth.c

Fix some minor issues in repack ereport()s

commit   : 497e92dce9b4c094fc6cee0ab37e6b9d65e67046    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 16:46:12 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 16:46:12 +0200    

Click here for diff

A few of them were missing errcode(), and a couple could use some  
wordsmithing.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CA+fm-ROdgh0rEVuXoViBk4TVgjodrN=MTR_RYuOuKLZ9voX4YA@mail.gmail.com  

M src/backend/commands/repack.c
M src/backend/commands/repack_worker.c

Improve REPACK (CONCURRENTLY) error when wal_level < replica

commit   : 43649b6a53e9b3964e921cc962f5c977bce688fd    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 15:04:36 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 28 May 2026 15:04:36 +0200    

Click here for diff

The error emitted when REPACK (CONCURRENTLY) is run with too low a  
wal_level is thrown by CheckSlotRequirements(), which is a bit  
mysterious when the user doesn't know what's up.  Add an upfront check  
in check_concurrent_repack_requirements() for a more explicit, REPACK-  
centered report, which is easier to understand -- this also saves  
starting the worker just to have it die immediately.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CA+fm-ROdgh0rEVuXoViBk4TVgjodrN=MTR_RYuOuKLZ9voX4YA@mail.gmail.com  

M src/backend/commands/repack.c

postgres_fdw: Fix whitespace violation in connection.c

commit   : af23353a73d5b890181f8fc3d2c20ff35b655af0    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 28 May 2026 21:53:26 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 28 May 2026 21:53:26 +0900    

Click here for diff

Previously a continuation line in the call to libpqsrv_connect_params_start()  
in postgres_fdw/connection.c was indented with spaces, violating  
the PostgreSQL project's whitespace rules for C files and triggering  
git show --check.  
  
This commit reformats the code to avoid that layout and use indentation  
consistent with project style. No functional change.  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Author: Chao Li <lic@highgo.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/2620a664-7b44-48b2-9aa8-5f0131702d9c@eisentraut.org  

M contrib/postgres_fdw/connection.c

commit   : 8a86aa313a714adc56c74e4b08793e4e6102b5ca    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 28 May 2026 20:58:08 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 28 May 2026 20:58:08 +0900    

Click here for diff

The use_scram_passthrough option in postgres_fdw and dblink accepts  
only boolean values. However, unlike other boolean options such as  
keep_connections, its value was not previously validated.  
  
As a result, commands such as  
"CREATE SERVER ... OPTIONS (use_scram_passthrough 'invalid')"  
could succeed unexpectedly.  
  
This commit updates postgres_fdw and dblink to validate that  
use_scram_passthrough is assigned a valid boolean value, and throw an  
error for invalid input.  
  
Backpatch to v18, where use_scram_passthrough was introduced.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwF+-k-Ehsu5W94ZP7GxS3wiBd+mi0PfGTdJ_i2Yr0zR3g@mail.gmail.com  
Backpatch-through: 18  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/option.c

Fix race between ProcSignalInit() and EmitProcSignalBarrier().

commit   : d79bf7612a07a6f053f4122a8bf88754217cd1c9    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 27 May 2026 16:25:56 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 27 May 2026 16:25:56 -0700    

Click here for diff

Previously, ProcSignalInit() read the global barrier generation before  
publishing its PID into pss_pid. This created a race condition: a  
process could initialize its local generation with an older global  
value, while a concurrent EmitProcSignalBarrier() might skip that  
process because its pss_pid was still zero. This resulted in  
WaitForProcSignalBarrier() hanging indefinitely.  
  
Fix this by publishing pss_pid before reading psh_barrierGeneration  
with a memory barrier so that the store to pss_pid is ordered before  
the load. A concurrent EmitProcSignalBarrier() then either observes  
the published PID and signals this slot, or completes its generation  
increment before we load it.  
  
While this race has become more visible due to recent features using  
signal barriers in more places (such as online wal_level changes), the  
issue is theoretically present since signal barriers were introduced  
to release smgr caches (e.g., in DROP DATABASE). v14 has the  
procsiangl barrier infrastricutre but no in-tree caller that actually  
emits a barrier, so the case is unreachable there.  
  
This issue was also reported by buildfarm member flaviventris.  
  
Reported-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/CAEze2WgAJmWReDN7Chtba8Er2YBvKCoa0KVN25-1evnTrHsLyA@mail.gmail.com  
Backpatch-through: 15  

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

Fix 051_effective_wal_level.pl on builds without injection points.

commit   : 47ad2233fad4335fdd866c8ad55941706ae1661d    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 27 May 2026 15:52:30 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 27 May 2026 15:52:30 -0700    

Click here for diff

Commit 2af1dc89282 placed the new "logical decoding disabled after  
REPACK (CONCURRENTLY)" check at the end of  
051_effective_wal_level.pl. That placement assumed the logical slot  
"test_slot" no longer existed when the check ran, but the assumption  
only holds on builds with injection points: the earlier  
injection-point-driven tests drop "test_slot" as a side effect, while  
on builds without injection points the slot persists.  When  
"test_slot" still exists, logical decoding remains enabled and the new  
check fails on those buildfarm members.  
  
Move the REPACK test earlier in the script, ensuring that the test  
starts with logical decoding disabled.  
  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAD21AoBmdmBQ-+Jga+jSKKq5OPGEP1pEjSJfRPT6MCwVHLD6og@mail.gmail.com  

M src/test/recovery/t/051_effective_wal_level.pl

Disable logical decoding after REPACK (CONCURRENTLY)

commit   : 2af1dc89282bea681201cf66e2bb32537294e623    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 27 May 2026 20:11:21 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 27 May 2026 20:11:21 +0200    

Click here for diff

REPACK (CONCURRENTLY) uses a temporary logical replication slot, which  
is dropped once done, but it wasn't calling RequestDisableLogicalDecoding(),  
leaving effective_wal_level stuck at 'logical'.  
  
Fix by adding a Boolean flag to ReplicationSlotDropAcquired() to have it  
request to disable logical decoding, and passing it as true on REPACK.  
Other callers of that function preserve their existing behavior.  
  
Author: Imran Zaheer <imran.zhir@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Discussion: https://postgr.es/m/CA+UBfaktds57dw2M8BEv_kS-=ixph3w+3MxKixtaDQMi_k7Ybg@mail.gmail.com  

M src/backend/commands/repack_worker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
M src/test/recovery/t/051_effective_wal_level.pl

Fix NOTIFY wakeups for pre-commit LISTEN entries.

commit   : 0f24332aeb4f43409c2a7bec9fef1e3317689bc5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 27 May 2026 12:23:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 27 May 2026 12:23:35 -0400    

Click here for diff

Commit 282b1cde9 made SignalBackends() ignore ListenerEntry entries  
whose "listening" flag said that the listener was not yet committed.  
That will be true for a new listener that has already registered its  
queue position, but has not yet reached AtCommit_Notify().  If another  
backend notifies the same channel in that window, SignalBackends()  
would directly advance the new listener's queue position, causing it  
to miss message(s).  Really this is a definitional question: is a new  
listener active as of PreCommit, or as of AtCommit?  But it seems to  
make more sense to expect that the new listener will see all messages  
after its initially-registered queue position, especially since the  
direct-advance logic is supposed to be an optimization that doesn't  
affect semantics.  
  
Fix this by treating all channel entries as valid wakeup targets.  
Rename the "listening" flag to removeOnAbort to reflect its remaining  
purpose: identifying staged LISTEN entries that abort cleanup must  
remove.  
  
While we're here, remove an obsolete test case added by 282b1cde9.  
The check for "ChannelHashAddListener array growth" was meant to  
exercise code that never made it into the committed patch, so now  
it's just a waste of test cycles.  
  
Author: Joel Jacobson <joel@compiler.org>  
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/9835b0a4-9121-47ac-9c44-427b8b1a7f1b@app.fastmail.com  
Discussion: https://postgr.es/m/6fe5ee75-537d-4d4f-909a-b21303c3ce75@app.fastmail.com  

M src/backend/commands/async.c
M src/test/isolation/expected/async-notify.out
M src/test/isolation/specs/async-notify.spec

Avoid orphaned objects dependencies

commit   : 2fbb21170e9053720c2c374b21eb650a22b8aaea    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 27 May 2026 18:35:58 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 27 May 2026 18:35:58 +0300    

Click here for diff

Concurrent DDL can leave behind objects referencing other objects that  
no longer exist. This can happen if an object is dropped, while a new  
object that depends on it is created concurrently. For example:  
  
session 1: BEGIN; CREATE FUNCTION myschema.myfunc() ...;  
session 2: DROP SCHEMA myschema;  
session 1: COMMIT;  
  
DROP SCHEMA does check that there are no objects dependending on the  
schema being dropped, but it does not see objects being concurrently  
created by other sessions. Even if it did, this scenario would still  
fail:  
  
session 1: BEGIN: DROP SCHEMA myschema;  
session 2: CREATE FUNCTION myschema.myfunc() ...;  
session 1: COMMIT;  
  
When the DROP SCHEMA runs, the schema was empty, but the new function  
is created in it before the dropping transaction completes. The CREATE  
FUNCTION does not see that the schema is concurrently being dropped.  
  
In both of these scenarios, the function is left behind in the schema  
that no longer exists.  
  
To fix, acquire AccessShareLock on all referenced objects when  
recording dependencies. This conflicts with the AccessExclusiveLock  
taken by DROP, preventing the race. After acquiring the lock, verify  
that the object still exists, and if it was dropped concurrently,  
report an error. We already had such a mechanism for shared  
dependencies, but for some reason we didn't do it for in-database  
dependendies.  
  
Ideally the locks would be acquired much earlier when creating a new  
object, but that will require modifying a lot of callers. This check  
while recording the dependency is a nice wholesale protection, and  
even if we change all the CREATE commands to acquire locks earlier,  
it's still good to have this as a backstop to catch any cases where we  
forgot to do so.  
  
The patch adds a few tests for some cases that left behind orphaned  
objects before this. It also adds a test for roles, which already had  
such protection, although that test is partially disabled because the  
error message includes an OID which is not predictable.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>  
Discussion: https://postgr.es/m/ZiYjn0eVc7pxVY45@ip-10-97-1-34.eu-west-3.compute.internal  
Backpatch-through: 14  

M src/backend/catalog/pg_depend.c
A src/test/isolation/expected/ddl-dependency-locking.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/ddl-dependency-locking.spec
M src/test/regress/expected/alter_table.out

Don't try to record dependency on a dropped column's datatype

commit   : fd93ee100830a1c0f4d292addd0a460cb48106a0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 27 May 2026 18:35:55 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 27 May 2026 18:35:55 +0300    

Click here for diff

When creating a relation with a dropped column, we called  
recordDependencyOn() also on the datatype of the dropped column, which  
is always InvalidOid. In versions 15 and above, that was harmless  
because recordDependencyOn() considers InvalidOid as a pinned object,  
and skips over it. On version 14, isPinnedObject() does not consider  
InvalidOid as pinned, so we created a bogus pg_depend entry with  
refobjectid == 0.  
  
As far as I can tell, the only case when AddNewAttributeTuples() is  
called with dropped columns is when performing a table-rewriting ALTER  
TABLE command. That temporarily creates a new relation with the same  
columns, including dropped ones, then swaps the relations, and drops  
the newly created table again. So even on version 14, the bogus  
pg_depend entry was only on the transient relation that was dropped at  
the end of the ALTER TABLE command, which was harmless.  
  
Even though this is harmless, let's be tidy, similar to commit  
713bce9484. The reason I noticed this now and why I backported this,  
is because the next commit will add code to acquire locks on the  
referenced objects, and we don't want to acquire a lock on InvalidOid.  
  
Discussion: https://postgr.es/m/ZiYjn0eVc7pxVY45@ip-10-97-1-34.eu-west-3.compute.internal  
Backpatch-through: 14  

M src/backend/catalog/heap.c

Use strtoi64 instead of strtoll

commit   : ee31868a535d1fbe0ddbb698c9c947a2067c2b6f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 May 2026 17:12:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 May 2026 17:12:27 +0200    

Click here for diff

This is mostly for notational consistency, since the result is stored  
in a variable of type int64.  

M contrib/pg_stash_advice/stashpersist.c

Remove incorrect OpenSSL feature guards

commit   : c71b94f03304954e4352f96595254622b64f851c    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 27 May 2026 12:58:56 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 27 May 2026 12:58:56 +0200    

Click here for diff

Commit 316472146 introduced support for ECDH key exchange with an ifdef  
guard to ensure support in the underlying OpenSSL installation.  Commit  
10bf4fc2c3 in OpenSSL removed this guard in 2015 which effectively made  
our check a no-op.  There has been no complaints that this doesn't work  
and OpenSSL installations without ECDH support are likely very rare, so  
remove the checks rather than re-implementing support.  Not backpatched  
since this fix doesn't alter functionality.  
  
Also fix a typo introduced in the original commit which had survived  
till this day.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Discussion: https://postgr.es/m/1787BA9F-A11C-4A7A-9252-94C470D5CBE3@yesql.se  

M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c

Fix procLatch ownership race in ProcKill()

commit   : 84b9d6bceab6e6ec4ff49fa52a7fc90d85e3798c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 27 May 2026 17:19:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 27 May 2026 17:19:20 +0900    

Click here for diff

DisownLatch() was executed after the PGPROC entry of the process  
terminated is pushed back into a freelist.  A newly-forked backend that  
recycles the slot could call OwnLatch() and PANIC with a "latch already  
owned by PID", taking down the server.  
  
There were two scenarios related to lock groups where this issue could  
be reached:  
* A follower pushes the leader's PGPROC back to the freelist while the  
leader has not yet called DisownLatch() in its own ProcKill().  
* A leader outliving all its followers pushes its own PGPROC onto the  
freelist before reaching DisownLatch(), which would be the most common  
scenario.  
  
This issue is fixed by calling SwitchBackToLocalLatch() and  
DisownLatch() at an earlier phase of ProcKill(), before any freelist  
manipulation happens, so that the slot of the backend terminated is  
never exposed as owning a latch.  
  
Note that pgstat_reset_wait_event_storage() is kept at a later stage.  
An upcoming commit will take advantage of that by introducing a test  
able to check the original PANIC scenario.  
  
Author: Vlad Lesin <vladlesin@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/d2983796-2603-41b7-a66e-fc8489ddb954@gmail.com  
Backpatch-through: 14  

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

Fix race conditions in ProcKill()'s lock-group freelist handling

commit   : 56310452318cee4bb8c291be126ce0c2b2affa5f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 27 May 2026 14:48:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 27 May 2026 14:48:56 +0900    

Click here for diff

This commit fixes two bugs in ProcKill()'s lock-group teardown freelist  
publication:  
* a double push of the leader's PGPROC that corrupts the freelist.  
* a leak of the last follower's PGPROC slot.  
  
ProcKill()'s lock-group teardown had two PGPROC freelist updates  
scattered through the function, done under two separate freeProcsLock  
acquisitions:  
* A follower's push of the leader's PGPROC, done when a follower is the  
last group member exiting.  
* Every backend's self-push at the bottom of the function.  
  
The two freelist updates were coordinated only by inspecting  
proc->lockGroupLeader, which a follower could clear as a side effect of  
pushing the leader.  This coordination was broken.  For example, with  
two concurrent backends:  
* The follower clears leader->lockGroupLeader and pushes the leader's  
PGPROC under leader_lwlock.  
* The follower does not clear its own proc->lockGroupLeader, being  
skipped.  
* When the leader reaches the bottom of ProcKill(), it sees a NULL  
proc->lockGroupLeader (the follower cleared it) and pushes itself,  
causing a second dlist_push_tail() of the same node onto the same  
freelist.  
* The follower at the bottom sees its own proc->lockGroupLeader being  
not NULL (never cleared) and skips its own push, causing its own slot  
to leak.  
  
This commit refactors the freelist manipulation to be done in two  
distinct phases, each step using its own lock acquisition to ensure that  
each freelist operation happens in an isolated manner for each backend  
(follower or leader):  
- First, under a single leader_lwlock acquisition, check the state of  
the lock-group.  Depending on if we are dealing with a follower and/or a  
leader, and if the leader has exited before a follower, then set some  
state booleans that define which actions should be taken with the  
freelist.  
- Second, under a single freeProcsLock acquisition, perform the cleanup  
actions, self-push of a backend and/or push of the leader back to the  
freelist.  
  
This is an old issue, dating back to 9.6 where parallel workers and lock  
grouping has been added.  
  
Author: Vlad Lesin <vladlesin@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/d2983796-2603-41b7-a66e-fc8489ddb954@gmail.com  
Backpatch-through: 14  

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

pg_createsubscriber: Fix cleanup of publisher-side objects after errors

commit   : 12d0004889e56d9883fafafc95c73a802307aaa7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 27 May 2026 10:34:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 27 May 2026 10:34:17 +0900    

Click here for diff

When pg_createsubscriber fails after creating logical replication  
objects, it should remove the publication and replication slot that  
it created on the publisher.  
  
Previously, if dropping subscriber-side objects failed,  
pg_createsubscriber reset its internal cleanup state too early. As a  
result, the exit-time cleanup could skip removing the publication or  
replication slot on the publisher.  
  
This could leave pg_createsubscriber-created objects behind on  
the publisher after a failed run. That can make a retry harder,  
because the leftover publication or replication slot may need to be  
removed manually before running pg_createsubscriber again.  
In the case of a replication slot, leaving it behind can also retain  
WAL files longer than expected.  
  
The cause of this issue was that the flags made_publication and  
made_replslot tracking whether pg_createsubscriber created  
a publication or replication slot on the primary were incorrectly  
reset to false when failures occurred while dropping objects  
on the subscriber.  
  
This commit fixes the issue by preventing those cleanup flags from  
being reset even when failures occurred while dropping objects  
on the subscriber, ensuring proper cleanup of primary objects  
before exit on failure.  
  
Backpatch to v17, where pg_createsubscriber was added.  
  
Author: Nisha Moond <nisha.moond412@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/CABdArM5V9QKK1PkLY9dpgAcZa3kUp84-wPqPovxvdLOri4=69w@mail.gmail.com  
Backpatch-through: 17  

M src/bin/pg_basebackup/pg_createsubscriber.c

doc: add comma to UPDATE docs, for consistency

commit   : 9a41b34a28702a71cc0a0e77dd80ca80366d12fb    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 20:17:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 20:17:40 -0400    

Click here for diff

Reported-by: X-MAN  
  
Author: X-MAN  
  
Discussion: https://postgr.es/m/tencent_90A64D807DE3586650CF3426C28BB599D30A@qq.com  

M doc/src/sgml/ref/update.sgml

Clean up 019_replslot_limit.pl comments

commit   : 0b866bb90368ba18a97772c21cd2e0952a16835d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 03:07:45 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 03:07:45 +0300    

Click here for diff

Update stale comments and test names in 019_replslot_limit.pl to match  
the actual WAL advancement and wal_status checks.  Remove a redundant  
standby stop in the inactive_since coverage.  
  
Discussion: https://postgr.es/m/CABPTF7XxDonXAcz6DsN6AUJB3swYrZkJHq3UCDaD3Q2H%2Bj0gUA%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/test/recovery/t/019_replslot_limit.pl

Stabilize 019_replslot_limit.pl: wait on slot restart_lsn

commit   : cdb1d1cf1de63b5dfecd5ebb23fd277b0e767f57    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 02:54:04 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 02:54:04 +0300    

Click here for diff

wait_for_catchup() has "wait for the standby to reach the target LSN"  
semantics.  However, the previous polling implementation actually waited for  
the primary to observe that position via pg_stat_replication.  
7e8aeb9e483 introduced the new WAIT FOR LSN-based implementation, which  
just probes the standby.  
  
019_replslot_limit.pl relied on the old side effect: its  
"slot state changes to extended/unreserved" subtests inspect  
primary-side pg_replication_slots, whose wal_status depends on  
restart_lsn, which only advances after the walsender processes a  
standby reply.  Make the test wait on what it actually needs by  
replacing each wait_for_catchup() with  
wait_for_slot_catchup('rep1', 'restart', primary->lsn('write')).  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/63f6abc9-c0ae-465d-a4e6-667eca6ea008@gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Author: Alexander Korotkov <aekorotkov@gmail.com>  

M src/test/recovery/t/019_replslot_limit.pl

Skip pg_database.dathasloginevt cleanup on standby

commit   : bec61f59354e652598b4c8b52b4c022ebb616230    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 02:26:50 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 27 May 2026 02:26:50 +0300    

Click here for diff

EventTriggerOnLogin() tries to clear pg_database.dathasloginevt when  
the database no longer has any login event triggers but the flag is  
still set.  To make that safe against concurrent flag setters, it  
takes a conditional AccessExclusiveLock on the database object.  
  
On a hot standby, that lock acquisition fails outright with  
  
  FATAL:  cannot acquire lock mode AccessExclusiveLock on database  
          objects while recovery is in progress  
  
because LockAcquireExtended() refuses locks stronger than  
RowExclusiveLock on database objects during recovery.  The standby  
already replays the flag's value from the primary, so the dangling  
flag is the result of replaying a state in which the primary had  
already dropped its login event triggers but not yet run a login  
event trigger pass to clear the flag.  Any session connecting to the  
standby in that window therefore fails to connect.  
  
Skip the cleanup on a standby.  The flag will be cleared via WAL  
replay once the primary clears it on its side.  
  
Add a recovery TAP test that reproduces the original report: create  
and drop a login event trigger on the primary in one session, wait  
for the standby to replay, then verify that a fresh connection to  
the standby succeeds.  
  
Backpatch to v17, where the login event triggers were introduced.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reported-by: Egor Chindyaskin <kyzevan23@mail.ru>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/19488-d7ccfca2bf6b74b0%40postgresql.org  
Backpatch-through: 17  

M src/backend/commands/event_trigger.c
M src/test/recovery/meson.build
A src/test/recovery/t/053_standby_login_event_trigger.pl

Fix memory accumulation in pg_sync_replication_slots() during retries.

commit   : 490259d0729007c40aff1f5255550154fb7afcbc    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 26 May 2026 15:16:12 -0700    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 26 May 2026 15:16:12 -0700    

Click here for diff

Unlike the slotsync worker, whose retry cycles are separated by  
transaction boundaries, pg_sync_replication_slots() retries within a  
single SQL function call. Per-cycle allocations for slot names, plugin  
names, database names, and auxiliary list containers get accumulated  
across retries until the function returned. Memory growth is proportional  
to the number of retries and remote slots, and the function may wait an  
extended period between cycles when slots are slow to persist.  
  
Fix by running each retry cycle in a short-lived memory context  
(sync_retry_ctx) that is reset before the next attempt. Additionally,  
release tuple slots created with MakeSingleTupleTableSlot() before  
clearing the walreceiver result.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VVPxgfYyr8Kyi=+JACjckQ6NpniV9eRtHboj2hMn0REw@mail.gmail.com  

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

doc PG 19 relnotes: more fixes

commit   : 8656ba7f71878eb16b2bcd6ec5d448dfb402bcfa    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 17:49:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 17:49:31 -0400    

Click here for diff

Reported-by: Thom Brown  
  
Author: Thom Brown  
  
Discussion: https://postgr.es/m/CAA-aLv7B7M9s5fZgCoWzXqer5RJ9jqG_k0h8t5QHFW=Qbxa=Eg@mail.gmail.com  

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

doc PG 19 relnotes: various corrections

commit   : 1d751b4b6b0165f122cd14ff84e556e2d2ebcb1e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 16:31:58 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 16:31:58 -0400    

Click here for diff

Reported-by: Thom Brown  
  
Author: Thom Brown  
  
Discussion: https://postgr.es/m/CAA-aLv7w1wwucet76yAW0yq3-LrN5wL81uRrnpT3Tyxh7dmyTw@mail.gmail.com  

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

Add stack depth check to QueueFKConstraintValidation().

commit   : 61ea5cc6a61ff9eb8b3d7b055e507a726e5856c7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 26 May 2026 11:58:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 26 May 2026 11:58:25 -0400    

Click here for diff

QueueFKConstraintValidation() recurses through the partition hierarchy  
to queue child constraint validations and to mark child rows as  
validated.  With a sufficiently deep partition tree, this can result  
in a stack-overflow crash.  Defend against that as we do elsewhere.  
  
Bug: #19482  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19482-4cc37cbf52d55235@postgresql.org  
Backpatch-through: 18  

M src/backend/commands/tablecmds.c

Restructure repack worker teardown

commit   : 1588d89af22f292e9ba44eaa33a14122e0754c3a    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 26 May 2026 17:24:06 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 26 May 2026 17:24:06 +0200    

Click here for diff

The original code would leave a shared memory segment unreleased if we  
fail partway through initialization.  Change the shutdown order so that  
we always free it.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Antonin Houska <ah@cybertec.at>  
Discussion: https://postgr.es/m/agtNn6ZCmdI2KJFn@alvherre.pgsql  

M src/backend/commands/repack.c

doc PG 19 relnotes: adjust item to mention pg_replication_slots

commit   : cfedd45133574df0328bc02a2486d969e91d1556    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 10:59:30 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 26 May 2026 10:59:30 -0400    

Click here for diff

Reported-by: Chong Peng  
  
Author: Chong Peng  
  
Discussion: https://postgr.es/m/CC2712F9-8457-4733-AA9D-7D7C9843B590@gmail.com  

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

Fix calculation of members_size in pg_get_multixact_stats()

commit   : 6aa26be288fa811270dfc1e39c015c23a97688b4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 May 2026 13:49:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 May 2026 13:49:04 +0900    

Click here for diff

pg_get_multixact_stats() uses members_size to report the amount of  
storage used by the currently retained multixact members.  However,  
MultiXactOffsetStorageSize() divided the member count by the number of  
members per storage group before multiplying by the group size, so it  
was rounding down its result and incorrectly reported zero when there  
were few retained members.  The calculation is changed to calculate the  
same based on the member count.  
  
While on it, this fixes a different issue in the isolation test  
multixact-stats.  Three fields were defined for checks related to the  
oldest offset values, but were not used.  The offsets existed in an  
older version of the patch than what has been committed.  These are  
replaced by checks for members_size, checking the new calculation  
formula.  
  
Thinkos introduced in 97b101776ce2.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/819AC1B2-1A71-4244-B081-3ADD85D1725D@gmail.com  

M src/include/access/multixact_internal.h
M src/test/isolation/expected/multixact-stats.out
M src/test/isolation/specs/multixact-stats.spec

Adjust some error hints

commit   : d40aed554227e5f8203798fda25b936a264638ec    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 May 2026 08:13:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 May 2026 08:13:22 +0900    

Click here for diff

The wording of two error hints is tweaked in this commit:  
- Import of extended statistics, where the value of an array element is  
not a NULL or a string.  
- Online data checksum switch, where a period was missing.  
  
Author:  Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CA+fm-RMrKbyky_+vi5SDdAVnFVjWh7zW3GoDAVnrp5OpDnW6tw@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out

Fix missed ReleaseVariableStats() in intarray's _int_matchsel().

commit   : 524cc0f638745489f55bafa12f3f93fe8944e027    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 25 May 2026 18:15:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 25 May 2026 18:15:49 -0400    

Click here for diff

Given a WHERE clause like "int[] @@ query_int" or "query_int ~~ int[]"  
where the query_int side is a table column having statistics,  
_int_matchsel() exited without remembering to free the statistics  
tuple.  This would typically lead to warnings about cache refcount  
leakage, like  
  WARNING:  resource was not closed: cache pg_statistic (73), tuple 42/12 has count 1  
It's been wrong since this code was added, in commit c6fbe6d6f.  
  
Bug: #19492  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Author: Man Zeng <zengman@halodbtech.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19492-ddcd0e22399ef85a@postgresql.org  
Backpatch-through: 14  

M contrib/intarray/_int_selfuncs.c

commit   : e2b8813403b19609a3f194b1d4cdb88df5aa4c7d    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 01:07:24 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 01:07:24 +0900    

Click here for diff

Previously, dblink accepted the use_scram_passthrough option on  
foreign-data wrappers via ALTER FOREIGN DATA WRAPPER dblink_fdw  
OPTIONS, even though the setting had no effect there.  
  
use_scram_passthrough should be only meaningful for foreign servers  
and user mappings, so this commit updates dblink to accept the option  
only in those contexts.  
  
Backpatch to v18, where use_scram_passthrough was introduced.  
  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEJ8rZjmbOvCicyr4vbuLio082bNTde0WNoSWaWr9wVcg@mail.gmail.com  
Backpatch-through: 18  

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

commit   : 5f5165e2fe193cc2c9e9078992cdb277013e8dec    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 00:51:18 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 00:51:18 +0900    

Click here for diff

Commit 97f6fc10fff changed postgres_fdw so that user-mapping settings  
override foreign server settings for use_scram_passthrough. This commit  
applies the same behavior to dblink.  
  
Backpatch to v18, where use_scram_passthrough was introduced.  
  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEJ8rZjmbOvCicyr4vbuLio082bNTde0WNoSWaWr9wVcg@mail.gmail.com  
Backpatch-through: 18  

M contrib/dblink/dblink.c
M contrib/dblink/t/001_auth_scram.pl
M doc/src/sgml/dblink.sgml

postgres_fdw: Give user mapping precedence for use_scram_passthrough

commit   : 97f6fc10fff0e42d08d78ce7f2a5b116e7f8d9b2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 00:46:31 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 26 May 2026 00:46:31 +0900    

Click here for diff

Previously, when use_scram_passthrough was specified on both a foreign server  
and a user mapping, the server-level setting took precedence over the  
user-mapping setting. This was inconsistent with the usual semantics of  
postgres_fdw options, where foreign server options provide shared defaults  
and user mapping options override them on a per-user basis.  
  
This commit updates postgres_fdw so that the user-mapping setting takes  
precedence when use_scram_passthrough is specified in both places. This  
matches the behavior of other connection options such as sslcert and sslkey.  
  
Backpatch to v18, where use_scram_passthrough was introduced. In v18,  
this only affects limited configurations that specify conflicting values  
at both the foreign server and user-mapping levels. In such cases, users  
would naturally expect the user-mapping setting to override the server-level  
setting, so changing the behavior should be minimally disruptive.  
Also keeping v18 as the only branch with different semantics for  
use_scram_passthrough would be unnecessarily confusing, so backpatch  
this fix to v18.  
  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEJ8rZjmbOvCicyr4vbuLio082bNTde0WNoSWaWr9wVcg@mail.gmail.com  
Backpatch-through: 18  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/t/001_auth_scram.pl
M doc/src/sgml/postgres-fdw.sgml

doc: Clarify CHECKPOINT handling of unlogged buffers

commit   : 377cc45194f4f1bd6eb68bd6eb42402e46e326d7    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 25 May 2026 12:15:29 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 25 May 2026 12:15:29 +0200    

Click here for diff

The CHECKPOINT reference page still described checkpoints as flushing  
all data files, which could be misleading as it depends on the value  
of FLUSH_UNLOGGED option.  Update the description to make it clearer  
that only data files of permanent relations are flushed by default.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/4855807D-F1CA-44E6-9B58-406691832848@gmail.com  

M doc/src/sgml/ref/checkpoint.sgml

psql: Tab completion for CHECKPOINT FLUSH_UNLOGGED boolean options

commit   : 7e5d8bd013e1fa3502d58de399815dedb81807c6    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 25 May 2026 11:57:14 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 25 May 2026 11:57:14 +0200    

Click here for diff

Tab completion for CHECKPOINT options contained FLUSH_UNLOGGED, but  
the boolean value was not part of the completion.  Fix to make this  
consistent with other boolean values.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/4855807D-F1CA-44E6-9B58-406691832848@gmail.com  

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

Reject degenerate SPLIT PARTITION with DEFAULT partition

commit   : e64a9ba2b4fcd8956369ac6e2146ac816e590df2    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 25 May 2026 11:57:42 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 25 May 2026 11:57:42 +0300    

Click here for diff

ALTER TABLE ... SPLIT PARTITION allows a DEFAULT partition to be created  
as one of the replacement partitions when the parent table does not  
already have one.  However, it should not allow the degenerate case where  
a non-DEFAULT partition keeps exactly the same bound as the split  
partition and the command merely adds a DEFAULT partition through the  
SPLIT PARTITION path.  
  
Detect that case by comparing the bound of the split partition with the  
bound of the only non-DEFAULT replacement partition, and raise an error  
when they are the same.  Users should add a DEFAULT partition directly  
with CREATE TABLE ... PARTITION OF ... DEFAULT or ALTER TABLE ... ATTACH  
PARTITION ... DEFAULT instead.  
  
The comparison goes through the partition operator family rather than  
byte equality so that values which are binary-different but compare  
equal under the partition key's comparator are treated as the same  
bound.  The corresponding regression test uses a float8 LIST partition  
with -0.0 and 0.0 -- they have different bit patterns but are equal  
under float8 -- to verify that a datumIsEqual()-based check would let  
the degenerate split through while the partsupfunc-based check  
correctly rejects it.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_split.sql

Fix size check in statext_dependencies_deserialize()

commit   : 0b8fa5fd37b193c46a03aa5d2838f2c6af973782    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 May 2026 14:38:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 25 May 2026 14:38:02 +0900    

Click here for diff

The check for the minimum expected bytea size of a MVDependencies object  
was using SizeOfItem() for its calculation.  This macro uses the number  
of attributes in a single dependency.  
  
This minimum size calculation should be based on MinSizeOfItems(), that  
computes the minimum expected size as the header plus the  
minimally-sized number of dependency items.  
  
Oversight in d08c44f7a4ec.  
  
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>  
Discussion: https://postgr.es/m/4b8d299d-2505-4c30-bf80-0f697410db35@tantorlabs.com  
Backpatch-through: 14  

M src/backend/statistics/dependencies.c

Revert "Allow logical replication snapshots to be database-specific"

commit   : 01a80f062146af1b17b411c35cb8d992c487fa7c    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 23 May 2026 21:33:19 -0700    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 23 May 2026 21:33:19 -0700    

Click here for diff

This reverts commit 0d3dba38c777, which was determined to have  
fundamental flaws.  This restricts REPACK (CONCURRENTLY) so that only  
one process can run it concurrently on different tables and even on  
different databases; we'll lift that restriction in another way during  
the next development cycle.  
  
Reported-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAA4eK1Jg21ODQ7fS2fvN5W_S5kDRhAP5inj3XMRQaa=s-GbYhw@mail.gmail.com  

M contrib/pg_visibility/pg_visibility.c
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/index/genam.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/bgwriter.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/pgrepack/pgrepack.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/access/xlog_internal.h
M src/include/miscadmin.h
M src/include/replication/output_plugin.h
M src/include/replication/snapbuild.h
M src/include/storage/procarray.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h

psql: Add missing IO option to EXPLAIN tab completion

commit   : 2c4bd2bf5700db98be0602854a8b7fa2c16b5f4a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Sat, 23 May 2026 09:39:58 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Sat, 23 May 2026 09:39:58 +0900    

Click here for diff

Commit 681daed9316 added EXPLAIN (IO) as a boolean option, but did  
not update psql's tab completion to include it. Add IO to both the  
option keyword list and the boolean ON/OFF completion.  
  
Author: Afrah Razzak <mypg.afrah@gmail.com>  
Reviewed-by: Zhenwei Shang <a934172442@gmail.com>  
Discussion: https://postgr.es/m/CAAJ6gzGi9gK6nGjsGCch0nFPdd2+odWatTS1uAGwRDPbHkmSVQ@mail.gmail.com  

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

Avoid exposing WAL receiver raw conninfo during timeline jumps

commit   : c37b38806a1f7269a25caa9d90d67bf2da363842    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 23 May 2026 08:10:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 23 May 2026 08:10:07 +0900    

Click here for diff

When reusing an existing WAL receiver after it has reached  
WALRCV_WAITING for new instructions, RequestXLogStreaming() copied  
PrimaryConnInfo into WalRcv->conninfo before switching the state to  
WALRCV_RESTARTING.  At that point ready_to_display could still be true,  
so pg_stat_wal_receiver could expose the raw connection string,  
including sensitive fields, but it should only show the user-displayable  
version of the connection string.  
  
WALRCV_RESTARTING does not establish a new connection.  The waiting WAL  
receiver reuses its existing connection and only needs a new startpoint  
and timeline, so there is no need to copy the raw connection string into  
shared memory again.  Let's only copy conninfo when launching a new WAL  
receiver after WALRCV_STOPPED, not while waiting for instructions.  
  
This commit adds coverage for the case fixed by this commit to the  
timeline-switch test by verifying that the WAL receiver conninfo remains  
consistent across the jump.  
  
Backpatch all the way down, as this issue is possible since  
pg_stat_wal_receiver has been introduced.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/EF91FF76-1E2B-4F3B-9162-290B4DC517FF@gmail.com  
Backpatch-through: 14  

M src/backend/replication/walreceiverfuncs.c
M src/test/recovery/t/004_timeline_switch.pl

Improve pg_stat_wal_receiver for CONNECTING status

commit   : 7f469097c72e6f8988024eb9bc1b417bfeb29fd9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 23 May 2026 04:04:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 23 May 2026 04:04:26 +0900    

Click here for diff

Commit a36164e7465 added a CONNECTING status for the WAL receiver, but  
pg_stat_wal_receiver returned no information while the connection to the  
primary was attempted, limiting the usability of the feature in  
high-latency environments where the connection attempt to the primary  
could take time.  
  
This commit improves the report of the status by splitting the way the  
shared memory state of the WAL receiver is filled before and after the  
connection to the primary is attempted with walrcv_connect():  
- Before the attempt, reset all the connection fields, switch  
ready_to_display to true.  
- After the attempt, fill in the connection fields.  
  
This change means two spinlock acquisitions instead of one, but at least  
monitoring tools can know about the connection attempt before its  
completion, enlarging the usability of the feature.  This code path is  
taken only once when a WAL receiver is spawned, so the extra acquisition  
does not matter performance-wise.  
  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/EF91FF76-1E2B-4F3B-9162-290B4DC517FF@gmail.com  

M src/backend/replication/walreceiver.c

Set notice receiver before libpq connection startup completes

commit   : 06a5c3cdef024630aef0992bb7b471459aa2b70f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Sat, 23 May 2026 00:25:48 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Sat, 23 May 2026 00:25:48 +0900    

Click here for diff

Commit 112faf1378e added custom notice receivers for replication,  
postgres_fdw, and dblink so that remote NOTICE, WARNING, and similar  
messages are reported via ereport(). However, those notice receivers were  
installed only after libpqsrv_connect() and libpqsrv_connect_params()  
returned, by which point libpq connection startup had already completed.  
As a result, messages emitted during connection establishment could be  
missed.  
  
This commit fixes the issue by splitting libpqsrv_connect() and  
libpqsrv_connect_params() into separate start and complete phases:  
libpqsrv_connect_start(), libpqsrv_connect_params_start(), and  
libpqsrv_connect_complete(). This allows callers to perform  
per-connection setup, such as installing a notice receiver, after the  
connection has been started but before startup completes.  
  
Note that callers of libpqsrv_connect_start() and  
libpqsrv_connect_params_start() must still call  
libpqsrv_connect_complete(), even if the start function returns NULL, so  
that any external FDs reserved during startup are released properly.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Vignesh C <vignesh21@gmail.com>  
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>  
Discussion: https://postgr.es/m/A2B8B7DE-C119-492F-A9FA-14CF86849777@gmail.com  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/libpq/libpq-be-fe-helpers.h

Prevent setting NO INHERIT on partitioned NOT NULL constraints

commit   : d8b5d87e545c340b129150d7214bff15275e2634    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 22 May 2026 23:59:04 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 22 May 2026 23:59:04 +0900    

Click here for diff

The documentation states that NOT NULL constraints on partitioned tables  
are always inherited by all partitions, and therefore cannot be declared  
NO INHERIT. While a check already existed to reject creating such  
constraints with NO INHERIT, previously the same check was missing for  
ALTER TABLE ... ALTER CONSTRAINT ... NO INHERIT.  
  
This commit adds the missing check so that attempting to set NO INHERIT  
on a partitioned NOT NULL constraint now fails.  
  
Backpatch to v18, where ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT  
was added.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/ecc985ad-6ec1-4094-a315-317943ca5f3f@proxel.se  
Backpatch-through: 18  

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

Revert "Reject degenerate SPLIT PARTITION with DEFAULT partition"

commit   : 0392fb900eb89f52988cccd33046443c39c70d1c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 May 2026 23:23:49 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 May 2026 23:23:49 +0300    

Click here for diff

This reverts commit d8af73010033cb8ad6c941942d6b03d74d7e4f7e.  Per buildfarm  
failures.  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_split.sql

Reject degenerate SPLIT PARTITION with DEFAULT partition

commit   : d8af73010033cb8ad6c941942d6b03d74d7e4f7e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 May 2026 14:32:57 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 20 May 2026 14:32:57 +0300    

Click here for diff

ALTER TABLE ... SPLIT PARTITION allows a DEFAULT partition to be created  
as one of the replacement partitions when the parent table does not  
already have one.  However, it should not allow the degenerate case where  
a non-DEFAULT partition keeps exactly the same bound as the split  
partition and the command merely adds a DEFAULT partition through the  
SPLIT PARTITION path.  
  
Detect that case by comparing the bound of the split partition with the  
bound of the only non-DEFAULT replacement partition, and raise an error  
when they are the same.  Users should add a DEFAULT partition directly  
with CREATE TABLE ... PARTITION OF ... DEFAULT or ALTER TABLE ... ATTACH  
PARTITION ... DEFAULT instead.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_split.sql

pg_recvlogical: Add tests for output file permissions

commit   : d6a72bbe00254139b2a8cbec15eaf576f7b5d358    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 20 May 2026 16:01:56 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 20 May 2026 16:01:56 +0900    

Click here for diff

Commit 263d1e6dfee changed pg_recvlogical to honor source cluster file  
permissions when creating output files. This commit adds tests verifying  
that output files are created with mode 0600 when the source cluster is  
initialized without group access, and with mode 0640 when group access is  
enabled.  
  
Author: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwHhpizYzMo3nFP4GkNMueSNMY3QfC-gBN1VTXtuiANDvw@mail.gmail.com  

M src/bin/pg_basebackup/t/030_pg_recvlogical.pl

pg_recvlogical: Honor source cluster file permissions for output files

commit   : 263d1e6dfeec5e573db4f78e6dac4bb17259c482    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 20 May 2026 15:54:13 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 20 May 2026 15:54:13 +0900    

Click here for diff

Commit c37b3d08ca6 attempted to preserve group permissions on pg_recvlogical  
output files when group access was enabled on the source cluster. However,  
the output files were still created with a fixed S_IRUSR | S_IWUSR mode,  
preventing group-read permissions from being applied.  
  
This commit fixes the issue by creating output files with pg_file_create_mode  
instead of a hard-coded mode. This allows pg_recvlogical to correctly preserve  
group permissions from the source cluster.  
  
Backpatch to all supported branches.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwHhpizYzMo3nFP4GkNMueSNMY3QfC-gBN1VTXtuiANDvw@mail.gmail.com  
Backpatch-through: 14  

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

Fix REPACK decoding worker not cleaned up on FATAL exit

commit   : 0160143ad9a686a7e705348da1f90e63a2a31536    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 19 May 2026 11:37:46 -0700    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 19 May 2026 11:37:46 -0700    

Click here for diff

When the launching backend of REPACK (CONCURRENTLY) is terminated via  
pg_terminate_backend(), ProcDiePending causes ereport(FATAL) which  
bypasses PG_FINALLY blocks.  As a result, stop_repack_decoding_worker()  
is never called, leaving the decoding worker running indefinitely and  
holding its temporary replication slot.  
  
Fix by using PG_ENSURE_ERROR_CLEANUP, which handles both ERROR and  
FATAL exits.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CA+fm-RNoPxL2N7db_A0anMXV_aDu6jWj4PNOPtMtBUAPDPvSXQ@mail.gmail.com  

M src/backend/commands/repack.c

Clarify SPLIT PARTITION bound requirements in docs

commit   : 83df16f1fa5ccce72534ddad51fd0109da1e49e2    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:39:53 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:39:53 +0300    

Click here for diff

The documentation said that the bounds of new partitions should not  
overlap and that their combined bounds should equal the bounds of the  
split partition.  That is misleading when a new DEFAULT partition is  
specified, because the explicit partitions may cover only part of the  
split partition while the DEFAULT partition covers the rest.  
  
Clarify that new non-DEFAULT partition bounds must not overlap with  
other new or existing partitions and must be contained within the bounds  
of the split partition.  Also state that the combined bounds must exactly  
match the split partition only when no new DEFAULT partition is specified.  
  
While here, improve nearby wording about hash-partitioned target tables  
and splitting a DEFAULT partition with the same partition name.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com  

M doc/src/sgml/ref/alter_table.sgml

Fix SPLIT PARTITION hint for DEFAULT partition bounds

commit   : 971017c49599b6666029ca46ee00378d8836f336    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:39:39 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:39:39 +0300    

Click here for diff

When ALTER TABLE ... SPLIT PARTITION specifies a DEFAULT partition, the  
explicit partitions do not need to cover the split partition's bound  
exactly.  They may cover only part of it, with the DEFAULT partition  
covering the remaining range.  
  
However, the existing hint said that the combined bounds of the new  
partitions must exactly match the bound of the split partition, which is  
misleading for this case and inconsistent with the code comment.  
  
Fix the hint to state the actual requirement: explicit partition bounds  
must stay within the bounds of the split partition when a DEFAULT  
partition is specified.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_split.out

Fix SPLIT PARTITION range bound validation with DEFAULT

commit   : 9354896920e4b2efd3b1b88caaea4e0c9071acb2    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:38:55 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 19 May 2026 13:38:55 +0300    

Click here for diff

When splitting a range partition and defining a new DEFAULT partition, the  
validation checked the lower bound of the first explicit partition and the  
upper bound of explicit partitions only when they were not first.  If there  
was exactly one explicit non-DEFAULT partition, its upper bound was therefore  
not checked.  
  
This could allow the replacement partition to extend beyond the upper bound  
of the partition being split, potentially overlapping another existing  
partition.  
  
Fix this by checking the upper bound whenever the explicit partition is the  
last one.  Add a regression test covering the single explicit partition plus  
DEFAULT case.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Zhenwei Shang <a934172442@gmail.com>  
Reviewed-by: Dmitry Koval <d.koval@postgrespro.ru>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com  

M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_split.sql

Fix COPY FROM ON_ERROR SET_NULL with selective column list

commit   : 1164a822729a496baedfc4068a6c86e247d5934e    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 19 May 2026 10:11:41 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 19 May 2026 10:11:41 +0900    

Click here for diff

When using COPY FROM ... ON_ERROR SET_NULL with a selective column list, the  
domain_with_constraint array was incorrectly allocated based on the length of  
the target column list. While the array was populated sequentially,  
CopyFromTextLikeOneRow attempted to access it using the physical attribute  
index (attnum - 1). This mismatch caused out-of-bounds reads when targeting  
high-numbered columns, allowing NULL values to bypass NOT NULL domain checks  
and be silently inserted.  
  
Fix by allocating the array to match the total number of physical attributes  
(num_phys_attrs) and indexing via attnum - 1, bringing it into alignment with  
other per-column arrays in BeginCopyFrom.  
  
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDdej0c0gWJi2FnbirzhgzyZNPiTwC1P5B_-dSNCzq-91A@mail.gmail.com  

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

Remove support for 8 byte tear free read/write on 32-bit

commit   : 801b9962e787b4159b38defee3458738e0349d96    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:59:59 -0700    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:59:59 -0700    

Click here for diff

The macro for enabling single-copy atomicity on i586+ when using  
GCC has been incorrect since 2017 (commit e8fdbd58f) without any  
complaints, and getting it to work is non-trivial.  
  
Getting this to work reliably require C11 atomics, which in turn  
also bumps the required MSVC version. For now, simply remove the  
attempted support which doesn't work anyways.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reported-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAKZiRmycHOOJyEPc9FUss1_69_U62WoSx32jT7wyES-YkStZKA@mail.gmail.com  
Discussion: https://posrgr.es/m/CA+hUKGKFvu3zyvv3aaj5hHs9VtWcjFAmisOwOc7aOZNc5AF3NA@mail.gmail.com  

M src/include/port/atomics/arch-x86.h

Remove obsolete comment in AtEOXact_Inval

commit   : 15b140d465b6cd3380ca58d1d9b878a6a94f94d8    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:43:12 -0700    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:43:12 -0700    

Click here for diff

This comment was originally added to RegisterInvalid() in POSTGRES before  
Postgres95, and came in via the Postgres95 import.  It has been obsolote  
for quite some time so remove.  
  
Author: Steven Niu <niushiji@highgo.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/MN2PR15MB30219837B2381AE2518A4C45A7FCA@MN2PR15MB3021.namprd15.prod.outlook.com  

M src/backend/utils/cache/inval.c

psql: Make ParseVariableDouble reject values above max

commit   : e04910a9a2a3f20c8139efd4fa4a6cdf00f3d3bd    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:33:36 -0700    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:33:36 -0700    

Click here for diff

ParseVariableDouble missed returning false after logging an error when  
the parsed value exceeded max, making the value assigned rather than  
rejected.  Backpatch down to v18 where this was introduced as part of  
the \WATCH_INTERVAL.  
  
Author: Sven Klemm <sven@tigerdata.com>  
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAMCrgp31p_5SDVi7dwnP39tTW5icQ0MWHA+N4kJdXgkL0PEy8w@mail.gmail.com  
Backpatch-through: 18  

M src/bin/psql/t/001_basic.pl
M src/bin/psql/variables.c

oauth: Fix missing quote in errormessage

commit   : aa7eb23aca31dbf0263e32c4fbf85ad824a642df    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:03:09 -0700    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 18 May 2026 08:03:09 -0700    

Click here for diff

The error message for incorrect oauth validator configuration was missing  
a quote character. OAuth was introduced in v18 but there is no need for a  
backpatch since this was introduced in 22f9207aaa37.  
  
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/ff9b84b9e6d5a3fef1f320ee5d63ec7dae722739.camel@gmail.com  

M src/backend/libpq/auth-oauth.c

Fix issues with handling of expressions in extended stats restore

commit   : a28fa2947d2a507089605c47bbfa9016d457208c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 May 2026 13:18:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 May 2026 13:18:35 +0900    

Click here for diff

This commit addresses some defects with the handling of expressions in  
pg_restore_extended_stats() and pg_clear_extended_stats():  
- Misleading WARNING for an incorrect number of expressions, where the  
number of required expressions was reported as the number of elements  
given in input rather than the actual number of expressions expected by  
the extstats object definition.  
- Incorrect matching of expression names, where a key name was  
considered as valid as long as it matched with the prefix of a legit key  
name.  For example "correlatio" given in input would match with  
"correlation", and be considered valid.  The consequence of this bug was  
a silent discard of the input data, where the operation would be  
considered a success.  The value associated to the prefixed key was not  
inserted in the catalogs, just ignored.  pg_dump would not generate such  
input data patterns, but a user doing manual stats injection could.  
- Missing heap_freetuple() in pg_clear_extended_stats(), for the case  
where the extstats object in input does not match with its parent  
relation.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/A7C11B83-7534-4A09-9071-FBD09175CFC8@gmail.com  

M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Fix parsing of REPACK options

commit   : a120ecf549853da9fda32e4f80ecd8060531d7b5    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 18 May 2026 13:14:49 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 18 May 2026 13:14:49 +0900    

Click here for diff

Previously, REPACK option parsing had two bugs.  
  
First, REPACK (CONCURRENTLY OFF) failed with:  
  
    ERROR:  unrecognized REPACK option "concurrently"  
  
while CONCURRENTLY ON was accepted correctly.  
  
Second, when the same option was specified multiple times, the last value  
specified was not always honored. If any occurrence set the option to ON,  
the option was treated as enabled even when the final setting was OFF.  
  
This commit fixes these issues by correctly accepting CONCURRENTLY  
regardless of its value, and by making the last specified value take precedence  
when an option appears multiple times.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAHGQGwGAY4kfDtC4i+hAOX-a3u0yOA6__6EDTQz-ytsDHgh-yQ@mail.gmail.com  

M src/backend/commands/repack.c

Fix IGNORE NULLS nullness cache for volatile window arguments.

commit   : 26269fe3c83beed1601e3bd156a98cf7696e9e08    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Mon, 18 May 2026 12:09:37 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Mon, 18 May 2026 12:09:37 +0900    

Click here for diff

The IGNORE NULLS implementation caches whether a window function argument  
evaluated to NULL or NOT NULL for a given partition row.  That is safe for  
ordinary expressions, but not for volatile expressions, where evaluating the  
same argument on the same row can produce a different NULL/NOT NULL result  
later.  
  
This could produce wrong results in two ways.  A row previously cached as  
NULL could be skipped even though a later evaluation would return NOT NULL.  
Conversely, a row cached as NOT NULL could be chosen as the target row, then  
re-evaluated to fetch the actual value and return NULL.  
  
Make the nullness cache conditional per argument.  Do not use it for  
arguments containing volatile functions or subplans, following the same  
conservative approach used for moving window aggregates.  Also avoid  
re-evaluating non-cacheable partition arguments after the scan has already  
found the target row.  
  
Add regression tests covering volatile arguments and subplan arguments with  
IGNORE NULLS.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>  
Discussion: https://postgr.es/m/42B42506-6972-4266-8422-FB73E61D9DA7@gmail.com  

M src/backend/executor/nodeWindowAgg.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

injection_points: Move some structs to new header injection_points.h

commit   : e7b416b2fa444ca93d0ef1bd22b02747255733f7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 May 2026 11:11:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 May 2026 11:11:40 +0900    

Click here for diff

This commit moves the definitions of InjectionPointConditionType and  
InjectionPointCondition into a new header local to the test module  
injection_points.h, so as these can be shared across more files in the  
module.  A patch for a bug fix is under discussion, whose proposed test  
will benefit from this refactoring.  
  
Backpatch down to where the module exists, as this should be useful for  
future bug fixes, even cases unrelated to the thread where this change  
has been discussed.  
  
Author: Andrey Borodin <x4mmm@yandex-team.ru>  
Author: Vlad Lesin <vladlesin@gmail.com>  
Discussion: https://postgr.es/m/d2983796-2603-41b7-a66e-fc8489ddb954@gmail.com  
Backpatch-through: 17  

M src/test/modules/injection_points/injection_points.c
A src/test/modules/injection_points/injection_points.h

Use ereport(ERROR), not Assert(), for publisher tuples missing columns.

commit   : bf7d19be9b18f6f78bd95052a2704259021e6806    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 16 May 2026 18:01:35 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 16 May 2026 18:01:35 -0700    

Click here for diff

Three locations use Assert() to guard against a mismatch between the  
number of columns advertised in the RELATION message and the number  
actually received in the subsequent INSERT/UPDATE tuple message. Since  
these values originate from the publisher, the check must survive into  
production builds.  
  
A malicious or buggy publisher can send a RELATION claiming N columns  
and an INSERT claiming M < N columns. The subscriber's apply worker  
indexes into colvalues[]/colstatus[] using column indices from the  
RELATION message's attribute map, causing a heap out-of-bounds read when  
the tuple's column array is smaller than expected. We've looked, without  
success, for a scenario in which the publisher holds sufficient control  
over these out-of-bounds bytes to exploit this or even to reach a  
SIGSEGV. Despite not finding one, the code has been fragile. Back-patch  
to v14 (all supported versions).  
  
Reported-by: Varik Matevosyan <varikmatevosyan@gmail.com>  
Author: Varik Matevosyan <varikmatevosyan@gmail.com>  
Discussion: https://postgr.es/m/CA+bBoog3cCogktzfLb9bppUByu-10B3CFp8u=iKXG_OvtAguCw@mail.gmail.com  
Backpatch-through: 14  

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

Simplify signature of ProcessStartupPacket()

commit   : 3dcd85d1b96151529718cc195d85d4ce4e0c1ccb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 17 May 2026 07:44:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 17 May 2026 07:44:17 +0900    

Click here for diff

There is now only one caller of ProcessStartupPacket().  Let's simplify  
the routine so as the GSS and SSL states are tracked inside it.   If  
future callers are added, there is less guessing to do.  
  
Suggested-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/aga7lCWluyc5zLb5@paquier.xyz  

M src/backend/tcop/backend_startup.c

doc: Fix example of pg_restore_extended_stats()

commit   : 4111b91ab3d5ad3afc22370168fcb3622de8a098    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 17 May 2026 07:36:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 17 May 2026 07:36:04 +0900    

Click here for diff

Oversight in ba97bf9cb7b4, probably due to an incorrect rebase.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/8A72720A-55AC-4D41-B9DF-5610307600E6@gmail.com  

M doc/src/sgml/func/func-admin.sgml

pg_test_timing: Show additional TSC clock source debug info

commit   : 5ba34f6dc838a1bc4415dc179be5bb2cf3b6d549    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 16 May 2026 11:51:34 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 16 May 2026 11:51:34 -0400    

Click here for diff

In some cases its necessary to understand whether TSC frequency data was  
sourced from CPUID, and which of the registers. Show this debug info at  
the end of pg_test_timing, and rework TSC functions to support that.  
  
This would have helped debug the buildfarm report fixed in 7fc36c5db550  
and is likely going to aid in any TSC-related issues reported during the  
beta period or later.  
  
Additionally, emit a warning if TSC frequency from calibration differs  
by more than 10% from the TSC frequency in use, and suggest the use  
of timing_clock_source = 'system'.  
  
In passing, add an explicit early return in the output function if the  
loop count is zero. This can't happen in practice, but coverity complained  
because we unconditionally call output for the fast TSC measurement.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (coverity fix only)  
Discussion: https://postgr.es/m/CAP53Pkw3Gzb+KTF5pu_o7tzbfZ7+qm2m6uDWuGtTJjZpV9yNpg@mail.gmail.com  

M doc/src/sgml/ref/pgtesttiming.sgml
M src/bin/pg_test_timing/pg_test_timing.c
M src/common/instr_time.c
M src/include/port/pg_cpu.h
M src/include/portability/instr_time.h
M src/port/pg_cpu_x86.c
M src/tools/pgindent/typedefs.list

postgres_fdw: Replace buffers in RemoteAttributeMapping with pointers.

commit   : aa1f93a3387ad619c14cea2b8ed01e6f49cb6600    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Sat, 16 May 2026 17:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Sat, 16 May 2026 17:55:00 +0900    

Click here for diff

Commit 28972b6fc ("Add support for importing statistics from remote  
servers.") stored the names of local/remote columns for a foreign table  
into the buffers of NAMEDATALEN bytes in this structure, without  
accounting for the possibility that the remote column name in particular  
could be longer than NAMEDATALEN - 1.  If it was longer than that, this  
would leave it unterminated/truncated in the buffer, invoking undefined  
behavior when match_attrmap() processes it, which assumes that it's  
fully-contained/terminated in the buffer.  
  
To fix, replace the buffers with char pointers, pstrdup the local/remote  
column names, and store the results into the pointers.  This commit also  
adds a function to clean up the nested data structure.  
  
Per Coverity and Tom Lane.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Discussion: https://postgr.es/m/342868.1776017700%40sss.pgh.pa.us  

M contrib/postgres_fdw/postgres_fdw.c

Check retain_dead_tuples for ALTER SUBSCRIPTION ... SERVER.

commit   : 8eba2edb80102ac7d16c0335caca62e11adc8072    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 15 May 2026 15:52:33 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 15 May 2026 15:52:33 -0700    

Click here for diff

Previously, the subscription setting retain_dead_tuples didn't cause  
ALTER SUBSCRIPTION ... SERVER to check the publisher. And if the  
publisher was checked for some other reason, then it would use the old  
conninfo.  
  
Fix ALTER SUBSCRIPTION ... SERVER to always check the publisher when  
retain_dead_tuples is set, and to use the new connection info, like  
ALTER SUBSCRIPTION ... CONNECTION.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/f13a8e29410bbbf9999290f2c04513a8884fa51c.camel@j-davis.com  

M src/backend/commands/subscriptioncmds.c

Don't accept length of -1 in pg_locale.h APIs.

commit   : 6d22c67c3bf5b50565062a35cbfc46075fb9c276    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 15 May 2026 11:09:15 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 15 May 2026 11:09:15 -0700    

Click here for diff

Reverts ac30021356. Per discussion, that commit interfered with useful  
tooling, and was not worth the special cases.  
  
Suggested-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/s32n3tm2mjh247f3xkkxkdk7cf77hglbr3ia3hrsdjylajou7y@nlldpag3tjd5  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/common/unicode/case_test.c
M src/common/unicode_case.c
M src/include/common/unicode_case.h
M src/include/utils/pg_locale.h

doc PG 19 relnotes: remove "Add fake LSN support to hash index"

commit   : 41b60bf172efb552eaa437b90327ef1c626587e6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 15 May 2026 13:26:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 15 May 2026 13:26:50 -0400    

Click here for diff

Also add missing commit link to json_array() item.  
  
Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-Wzm1UAuv9ih6_ATbwbmrmusKPoJ2qSo3HBF-JaUEkVYUPg@mail.gmail.com  

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

Re-add regression tests for ltree and intarray

commit   : 27bdae84137f35af42ca5ae4f0507dfb8c69db60    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 15 May 2026 14:27:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 15 May 2026 14:27:30 +0900    

Click here for diff

These tests have been removed by 906ea101d0d5, due to some of them being  
unstable in the buildfarm with low max_stack_depth values.  They are now  
reworked so as they should be more portable.  
  
The tests to cover the findoprnd() overflows use a balanced tree to  
avoid using too much stack, per a suggestion and an investigation by Tom  
Lane.  
  
Note: This is initially applied only on HEAD; a backpatch will follow  
should the buildfarm be fine with the situation.  
  
Discussion: https://postgr.es/m/agZc6XecyE7E7fep@paquier.xyz  
Backpatch-through: 14  

M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M contrib/ltree/expected/ltree.out
M contrib/ltree/sql/ltree.sql

psql: Fix tab completion for REPACK boolean options

commit   : e5035950dab7fdce23185f21e96b4cc8f16d58e6    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 15 May 2026 14:24:45 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 15 May 2026 14:24:45 +0900    

Click here for diff

Previously, tab completion for REPACK parenthesized boolean options  
(ANALYZE, CONCURRENTLY, and VERBOSE) did not suggest the boolean values  
ON and OFF, unlike VACUUM.  
  
This commit fixes the issue by adding ON/OFF completion for those options.  
  
Author: Baji Shaik <baji.pgdev@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CA+fm-RNZpy7MAceR9gSyy833H_uL-fTx0LxO73RnvwEaprpuRA@mail.gmail.com  

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

doc PG 19 relnotes: update to current

commit   : 6b48f5d1a74168c78badfb2e59ef788bb8eb396e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 14 May 2026 16:37:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 14 May 2026 16:37:28 -0400    

Click here for diff

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

refint: Fix segfault in check_foreign_key().

commit   : 611756948eef3a3a1babc3418fc254077528b679    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 14 May 2026 13:11:49 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 14 May 2026 13:11:49 -0500    

Click here for diff

When an UPDATE statement triggers check_foreign_key() with the  
action set to "cascade", it generates more UPDATE statements to  
modify the key values in referencing relations.  If a new key value  
is NULL, SPI_getvalue() returns a NULL pointer, which is  
subsequently passed to quote_literal_cstr(), causing a segfault.  
To fix, skip quoting when a new key value is NULL and insert an  
unquoted NULL keyword instead.  
  
Oversight in commit 260e97733b.  While the refint documentation  
recommends marking primary key columns NOT NULL, the aforementioned  
scenario accidentally worked on platforms where snprintf()  
substitutes "(null)" for NULL pointers.  Note that for  
character-type columns, the old code quoted "(null)" as a string  
literal, so this didn't always produce correct results.  But it  
still seems better to fix this than to reject cases that previously  
worked.  
  
Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru>  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Pierre Forstmann <pierre.forstmann@gmail.com>  
Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org  
Backpatch-through: 14  

M contrib/spi/refint.c

Fix attribute mapping for COPY TO on partitioned tables.

commit   : 82f0135a2630cc4465a8a424e38faf0f4e92f421    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 14 May 2026 10:32:34 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 14 May 2026 10:32:34 -0700    

Click here for diff

Commit 4bea91f21f61 enabled COPY TO on a partitioned table to read  
tuples from its partitions and mapped them to the root table's tuple  
descriptor before output. However, it incorrectly built the attribute  
map from the root table to the partition.  
  
This commit fixes by building the attribute map from the partition to  
the root table, ensuring that partition attributes are correctly  
mapped to their corresponding root attributes.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/85EA70F3-C3DB-477B-B856-EA569FDAAE7C@gmail.com  

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

Prevent access to other sessions' temp tables

commit   : ce146621f7860d2e19c509f1466feca3bf777678    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 14 May 2026 12:25:19 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 14 May 2026 12:25:19 +0300    

Click here for diff

Commit b7b0f3f2724 ("Use streaming I/O in sequential scans") routed  
sequential scans through read_stream_next_buffer(), bypassing the  
RELATION_IS_OTHER_TEMP() check in ReadBufferExtended().  As a result,  
a superuser can attempt to read or modify temp tables of other  
sessions through the read-stream path.  When the query plan uses no index,  
SELECT/UPDATE/DELETE/MERGE silently see no rows / report zero affected rows,  
and COPY produces an empty output -- because the buffer manager has no  
visibility into the owning session's local buffers and silently returns  
nothing.  Any query plan that uses, for instance, a btree index  
still errors out via the existing check in ReadBufferExtended(), which  
is reached from hio.c and nbtree respectively, but this is incidental.  
  
Fix by enforcing RELATION_IS_OTHER_TEMP() at the three additional  
buffer-manager entry points:  
  
- read_stream_begin_impl() rejects the read at stream setup time,  
  covering sequential and bitmap scans that go through the  
  read-stream path.  
- ReadBuffer_common() becomes the canonical place for the check,  
  consolidating the existing one previously kept in  
  ReadBufferExtended().  All ReadBufferExtended() callers go through  
  ReadBuffer_common(), so the consolidation is behavior-preserving.  
- StartReadBuffersImpl() catches direct callers of StartReadBuffers()  
  that bypass both of the above.  This is currently defense-in-depth,  
  but documents the contract for future code.  
  
The companion test in src/test/modules/test_misc was added in the  
preceding commit; this commit updates the assertions for SELECT,  
UPDATE, DELETE, MERGE, and COPY (which previously documented the  
bug as silent success) to expect the new error.  
  
Author: Jim Jones <jim.jones@uni-muenster.de>  
Author: Daniil Davydov <3danissimo@gmail.com>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAJDiXghdFcZ8%3Dnh4G69te7iRr3Q0uFyXxb3ZdG09_GTNZXwH0g%40mail.gmail.com  
Backpatch-through: 17  

M src/backend/storage/aio/read_stream.c
M src/backend/storage/buffer/bufmgr.c
M src/include/utils/rel.h
M src/test/modules/test_misc/t/013_temp_obj_multisession.pl

Add tests for cross-session temp table access

commit   : 1fee0e857e330d148cf14b8d6027d02111841cf8    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 14 May 2026 12:21:03 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 14 May 2026 12:21:03 +0300    

Click here for diff

Add a TAP test in src/test/modules/test_misc that documents what  
happens when one session attempts to read or modify another session's  
temporary table.  This commit only adds tests; it does not change  
backend behavior, so the assertions reflect current behavior:  
  
- SELECT, UPDATE, DELETE, MERGE, COPY on a table without an index  
  silently succeed with no error and zero rows / zero affected rows.  
  These commands run through the read-stream path, which currently  
  bypasses the RELATION_IS_OTHER_TEMP() check.  This is the  
  underlying bug to be fixed in a follow-up.  
- INSERT errors with "cannot access temporary tables of other  
  sessions" because hio.c calls ReadBufferExtended() to find a page  
  with free space and is caught by the existing check there.  
- Index scan errors via the same existing check, reached through  
  nbtree -> ReadBuffer -> ReadBufferExtended.  
- TRUNCATE / ALTER TABLE / ALTER INDEX / CLUSTER fail with their  
  command-specific error messages.  
- VACUUM is silently skipped to avoid noise during database-wide  
  VACUUM (vacuum_rel() returns without warning).  
- DROP TABLE is intentionally allowed: DROP does not touch the  
  table's contents, and autovacuum relies on this to clean up  
  temp relations orphaned by a crashed backend.  
- ALTER FUNCTION / DROP FUNCTION on an owner-created function over  
  its own temp row type work as catalog operations -- they don't  
  read the underlying data.  
- CREATE FUNCTION from a separate session, using another session's  
  temp row type as an argument, is allowed but emits a NOTICE: the  
  function is moved into the creator's pg_temp namespace with an  
  auto-dependency on the borrowed type, so it disappears together  
  with the session that created it.  
- A bare DROP TABLE on a temp table that has a cross-session  
  dependent function fails with a catalog-level dependency error.  
- LOCK TABLE in ACCESS SHARE mode on another session's temp table  
  succeeds and properly blocks the owner's session-exit cleanup  
  (which acquires AccessExclusiveLock via findDependentObjects).  
  This exercises the same LockRelationOid path used by autovacuum  
  when cleaning up orphaned temp relations.  
- When the owner session ends, the normal session-exit cleanup  
  cascades through DEPENDENCY_NORMAL and removes both the temp  
  objects and any cross-session functions that depended on them.  
  
Also, document the contract for RELATION_IS_OTHER_TEMP() so that  
future buffer-access entry points enforce the same rule.  
  
Backpatch this through PostgreSQL 17, where b7b0f3f27241 introduces a code  
path bypassing this check.  
  
Author: Jim Jones <jim.jones@uni-muenster.de>  
Author: Daniil Davydov <3danissimo@gmail.com>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAJDiXghdFcZ8%3Dnh4G69te7iRr3Q0uFyXxb3ZdG09_GTNZXwH0g%40mail.gmail.com  
Backpatch-through: 17  

M src/include/utils/rel.h
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/013_temp_obj_multisession.pl

postgres_fdw: Fix deparsing of remote column names in stats import.

commit   : 5107398e6d5ecad96f3d1c0efcfc9aa02b9cdff9    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 14 May 2026 17:05:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 14 May 2026 17:05:00 +0900    

Click here for diff

build_remattrmap() deparses a list of remote column names for a query  
that retrieves attribute stats for them from the remote server.  
Previously, it did so by using the array-literal syntax with each column  
name individually quoted by quote_identifier(), causing the query to  
fail on the remote server with a syntax error or no results when that  
column name included a single quote or backslash, as quote_identifier()  
doesn't escape those characters, making the query invalid or incorrect.  
Fix by switching from the array-literal syntax to the ARRAY constructor  
syntax with each column name individually quoted by  
deparseStringLiteral().  
  
Oversight in commit 28972b6fc.  
  
Reported-by: Satya Narlapuram <satyanarlapuram@gmail.com>  
Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Alex Guo <guo.alex.hengchen@gmail.com>  
Reviewed-by: Zhenwei Shang <a934172442@gmail.com>  
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Discussion: https://postgr.es/m/CAHg%2BQDc9%3DWtYi%3DJW6QUL6ASOJc6PcGPTuxoMkhnkQ7oi7j5atg%40mail.gmail.com  
Discussion: https://postgr.es/m/CAJTYsWWGhVDFjr%2BsmdYdU-Q_TT9YMzXA4QcLCr7rizDOyrEEow%40mail.gmail.com  

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

Fix jsonpath .split_part() to honor silent mode

commit   : 954e57708ea6996e8948ccb820ed03d0262fc2d2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 May 2026 16:02:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 May 2026 16:02:07 +0900    

Click here for diff

The jsonpath .split_part() method passed its field-position argument  
through numeric_int4(), that can fail hard if called directly.  
  
This commit switches the code to use numeric_int4_safe() with an error  
context for soft reporting, so as the overflow and zero field-position  
cases can be handled in silent mode.  
  
Oversight in bd4f879a9cdd.  
  
Author:  Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/FCF996D0-580B-431C-8DE1-A540C58E444C@gmail.com  

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

pgbench: fix verbose error message corruption with multiple threads

commit   : 61f8a85a577fd0ea0bf924a88064187bed31eb48    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 14 May 2026 12:30:34 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 14 May 2026 12:30:34 +0900    

Click here for diff

When pgbench runs with multiple threads and verbose error reporting is  
enabled (--verbose-errors), multiple clients can build verbose error  
messages concurrently. Previously, a function-local static  
PQExpBuffer was used for these messages, causing the buffer to be  
shared across threads. This was not thread-safe and could result in  
corrupted or incorrect log output.  
  
Fix this by using a local PQExpBufferData instead of a static buffer.  
This keeps verbose error messages correct during concurrent execution.  
  
Backpatch to v15, where this issue was introduced.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Alex Guo <guo.alex.hengchen@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwER1AjGXpkKB9t9820NBhMQ_Ghv7=HsKeodUr3=SZsF4g@mail.gmail.com  
Backpatch-through: 15  

M src/bin/pgbench/pgbench.c

Add several commits to .git-blame-ignore-revs.

commit   : 0c025ab347dc37c93620ad3d040227d9ac0e32b2    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 13 May 2026 14:53:48 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 13 May 2026 14:53:48 -0500    

Click here for diff

M .git-blame-ignore-revs

Fix style in a few REPACK ereports

commit   : 3bf63730cb041a834c618082ba3d5e8bf96a31a5    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 13 May 2026 18:28:31 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 13 May 2026 18:28:31 +0200    

Click here for diff

Use consistent "REPACK (CONCURRENTLY)" naming in errhint messages,  
matching the actual command syntax and the errmsg text used elsewhere  
in the same file.  Also improve the ereport() after XLogReadRecord  
failure to be like others in the tree.  
  
While at it, remove direct mentions of the DDL in the translatable  
strings, both in the same errhint() calls as well as some errmsg()  
calls.  Add periods where missing.  
  
There are all oversights in 28d534e2ae0a.  
  
Reported-by: Baji Shaik <baji.pgdev@gmail.com>  
Discussion: https://postgr.es/m/CA+fm-RPxX1xTcYY4qQGPRDXB2-Fy2SDNdZi=zVjr0j=MPg2PaA@mail.gmail.com  

M src/backend/commands/repack.c
M src/backend/commands/repack_worker.c
M src/test/regress/expected/cluster.out

Use "grep -E" not "egrep".

commit   : 2122281672b4505c6fa391899d8af2318770a102    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 12:07:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 12:07:19 -0400    

Click here for diff

"egrep" has never been in POSIX; the standard way to access this  
functionality is "grep -E".  Recent versions of GNU grep have  
started to warn about this, so stop using "egrep".  
  
This could be back-patched, but I see little need to do so  
because the affected places are not code that runs during  
normal builds.  (Perhaps src/backend/port/aix/mkldexport.sh  
is an exception, but let's wait to see if any AIX users  
complain before touching that.)  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/473272.1778685870@sss.pgh.pa.us  

M doc/src/sgml/func/func-matching.sgml
M src/backend/port/aix/mkldexport.sh
M src/tools/find_typedef
M src/tools/perlcheck/find_perl_files

Pre-beta updates: run src/tools/copyright.pl.

commit   : b94989e73d570587dc67a49f1f8c485e3ff240d0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 11:01:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 11:01:57 -0400    

Click here for diff

As usual, post-1-Jan patches missed some copyright-year updates.  

M src/test/modules/test_aio/t/003_initdb.pl
M src/test/modules/test_aio/t/TestAio.pm
M src/test/ssl/t/004_sni.pl

Do pre-release housekeeping on catalog data.

commit   : c7cb8e5b73c6d090f60320ddd7e15f6aeda180c1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:54:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:54:44 -0400    

Click here for diff

Run renumber_oids.pl to move high-numbered OIDs down, as per pre-beta  
tasks specified by RELEASE_CHANGES.  For reference, the command was  
  
./renumber_oids.pl --first-mapped-oid 8000 --target-oid 6400  
  
(but there were already some used OIDs at 6400, so the first one  
actually assigned was 6434).  

M src/include/catalog/catversion.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_propgraph_element.h
M src/include/catalog/pg_propgraph_element_label.h
M src/include/catalog/pg_propgraph_label.h
M src/include/catalog/pg_propgraph_label_property.h
M src/include/catalog/pg_propgraph_property.h
M src/include/catalog/pg_type.dat

Add preceding commits to .git-blame-ignore-revs.

commit   : 652ae1a520dbf4c213008c88a168abacf5f2a4e4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:44:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:44:36 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification, step 3: run reformat-dat-files.

commit   : 719fe0779d8d116bf8ee06056fed4c1257f1744c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:41:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:41:33 -0400    

Click here for diff

M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_type.dat

Pre-beta mechanical code beautification, step 2: run pgperltidy.

commit   : 736a97bddd16f0511dc62b7e4770376a34f10114    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:37:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:37:42 -0400    

Click here for diff

It's as opinionated as ever.  

M contrib/auto_explain/t/001_auto_explain.pl
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_stash_advice/t/001_persist.pl
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/bin/pg_combinebackup/t/011_ib_truncation.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pg_upgrade/t/006_transfer_modes.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/psql/t/001_basic.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/interfaces/libpq/t/006_service.pl
M src/test/authentication/t/001_password.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_aio/t/002_io_workers.pl
M src/test/modules/test_cloexec/t/001_cloexec.pl
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_misc/t/010_index_concurrently_upsert.pl
M src/test/modules/test_misc/t/012_ddlutils.pl
M src/test/modules/test_plan_advice/t/001_replan_regress.pl
M src/test/modules/test_shmem/t/001_late_shmem_alloc.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/postmaster/t/003_start_stop.pl
M src/test/postmaster/t/004_negotiate.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/recovery/t/046_checkpoint_logical_slot.pl
M src/test/recovery/t/051_effective_wal_level.pl
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/035_conflicts.pl
M src/test/subscription/t/036_sequences.pl
M src/tools/add_commit_links.pl

Pre-beta mechanical code beautification, step 1: run pgindent.

commit   : 020794ee42a3413b416898e7931a8a3a5b43e9ab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:34:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:34:17 -0400    

Click here for diff

Update typedefs.list from the buildfarm, and run pgindent.  
The changes from the new typedefs list are pretty minimal,  
since we'd been pretty good (not perfect) about updating  
typedefs.list by hand.  But the pgindent behavior changes  
installed by a3e6beba6, b518ba4af, and 60f9467c3 add up  
to make this a relatively sizable diff.  

M contrib/amcheck/verify_common.c
M contrib/btree_gist/btree_gist.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/daitch_mokotoff.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_int_op.c
M contrib/intarray/_intbig_gist.c
M contrib/isn/isn.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/pgcrypto/crypt-blowfish.c
M contrib/pgcrypto/crypt-gensalt.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
M contrib/postgres_fdw/postgres_fdw.c
M contrib/seg/seg.c
M contrib/spi/moddatetime.c
M contrib/xml2/xpath.c
M src/backend/access/gin/gininsert.c
M src/backend/access/index/amvalidate.c
M src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/walsummary.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/heap.c
M src/backend/commands/analyze.c
M src/backend/commands/copyto.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/lib/rbtree.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/pqformat.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_mutation.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/geqo/geqo_recombination.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_relation.c
M src/backend/partitioning/partbounds.c
M src/backend/port/win32/signal.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/cash.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/ddlutils.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/slab.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/filter.c
M src/bin/pg_dump/filter.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/common.c
M src/bin/psql/large_obj.c
M src/bin/psql/startup.c
M src/bin/psql/stringutils.h
M src/bin/psql/tab-complete.in.c
M src/common/jsonapi.c
M src/common/logging.c
M src/common/percentrepl.c
M src/common/psprintf.c
M src/common/sha2.c
M src/common/stringinfo.c
M src/common/wchar.c
M src/fe_utils/option_utils.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/backup/walsummary.h
M src/include/catalog/pg_db_role_setting.h
M src/include/common/blkreftable.h
M src/include/common/fe_memutils.h
M src/include/common/hashfn_unstable.h
M src/include/common/logging.h
M src/include/common/parse_manifest.h
M src/include/common/percentrepl.h
M src/include/executor/tuptable.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/option_utils.h
M src/include/fmgr.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/stringinfo.h
M src/include/libpq/pg-gssapi.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/port.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/palloc.h
M src/include/utils/tuplestore.h
M src/interfaces/ecpg/compatlib/informix.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/include/ecpgerrno.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/descriptor.c
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/preproc/util.c
M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_elog.h
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpython_system.h
M src/port/dirmod.c
M src/port/inet_aton.c
M src/port/open.c
M src/port/pqsignal.c
M src/port/snprintf.c
M src/port/strlcat.c
M src/port/strsep.c
M src/port/win32security.c
M src/test/locale/test-ctype.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/test_tidstore/test_tidstore.c
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/timezone/localtime.c
M src/timezone/zic.c
M src/tools/pgindent/typedefs.list
M src/tutorial/complex.c

pgindent: improve formatting of multiline comments.

commit   : 60f9467c38348e06ad96815d4394651dd02a0389    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:21:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:21:54 -0400    

Click here for diff

Enforce this standard formatting of multiline comments that start  
in column 1:  
  
/*  
 * line 1  
 * line 2  
 */  
  
Unlike indented comments, we don't reconsider line breaks, except  
for forcing the initial /* and trailing */ onto their own lines.  
We do make each line start with " *", with some whitespace following.  
  
We preserve pgindent's existing behavior of not touching comments  
that begin with /**... or /*-...  Also, if the first line looks like  
/* === or /* ---, we don't split that line; similarly for the last  
line.  
  
The vast majority of multiline comments in our tree already look  
like this, but this change will clean up some stragglers.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Reported-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAJ7c6TPQ0kkHQG-AqeAJ3PV_YtmDzcc7s%2B_V4%3Dt%2BxgSnZm1cFw%40mail.gmail.com  
Discussion: https://postgr.es/m/EB0141C5-ACC2-4F0B-85EA-0E3AFBCE322F@umbc.edu  

M src/tools/pgindent/pgindent

Make pg_bsd_indent add a space between comma and period.

commit   : b518ba4affed8d3a47944d769d33b7814d88ddb2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:17:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 May 2026 10:17:57 -0400    

Click here for diff

Formatting of variadic functions and struct literals with named fields  
used to be ugly due to pg_bsd_indent treating period as always being a  
binary operator.  After a comma, it's not that, so insert a space.  
  
Bump pg_bsd_indent's version so that people who use out-of-tree  
copies will know they need to update.  (This also covers the other  
pg_bsd_indent behavioral change introduced in a3e6beba6.)  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/c3327be8-09e2-46a1-88b4-228a339d6916@proxel.se  

M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/indent.c
M src/tools/pg_bsd_indent/tests/declarations.0.stdout
M src/tools/pg_bsd_indent/tests/struct.0
M src/tools/pg_bsd_indent/tests/struct.0.stdout
M src/tools/pgindent/pgindent

pgindent: Fix spacing after != when member name matches typedef.

commit   : a3e6beba60ec4e6804e91200e407d046414f18de    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 13 May 2026 09:10:50 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 13 May 2026 09:10:50 -0500    

Click here for diff

When a struct member name matches a registered typedef, pgindent  
removes the space after "!=" (and some other operators), like so:  
  
    entry->dsh.dsa_handle !=DSA_HANDLE_INVALID  
  
The problem is that the related code in lexi.c sets last_u_d to  
true before jumping to found_typename, causing the next operator to  
be classified as unary and suppressing the following space.  This  
is correct for type names, but not for struct members.  For  
example, "Datum *x" needs "*" to be unary to suppress the space  
before "x".  To fix, only set last_u_d before jumping to  
found_typename if the typedef name doesn't appear after "." or  
"->".  
  
Note that this does not bump INDENT_VERSION.  We'll do that just  
once after some other changes to pg_bsd_indent are committed.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/aS9hkwnkWf3dZIA_%40nathan  

M src/tools/pg_bsd_indent/lexi.c

Fix FOR PORTION OF with non-updatable view columns

commit   : 7ca8c9429675b34600e679525da6b5280c1cafa5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 13 May 2026 13:34:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 13 May 2026 13:34:09 +0200    

Click here for diff

Both UPDATE and DELETE were failing to test that the application-time  
column was updatable.  The column is not part of  
perminfo->updatedCols, because it should not be checked for  
permissions.  And it needs to be checked in the DELETE case as well,  
since we might insert leftovers with a value for that column.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Co-authored-by: jian he <jian.universality@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CACJufxFRqg8%3DgbZ-Q6ZS_UQ%2BYdwfZpk%2B9rf7jgWrk8m4RMUm%3DA%40mail.gmail.com  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/updatable_views.sql

pg_stat_statements: Set PlannedStmt to NULL after nested utility execution

commit   : 66366217822e23a00251f6ba3743d8e5675fcfc2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 May 2026 15:39:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 May 2026 15:39:44 +0900    

Click here for diff

As mentioned in 8268e41aca23, pgss_ProcessUtility() may free the  
PlannedStmt after an internal ROLLBACK.  This commit sets the  
PlannedStmt "pstmt" to NULL once it is no longer safe to rely on it,  
making bugs similar to the one fixed by the previous commit easier to  
detect.  
  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/0A9A8DAC-BC3C-4C7A-9504-2C6050405544@anarazel.de  

M contrib/pg_stat_statements/pg_stat_statements.c

Add more tests for corrupted data with pglz_decompress()

commit   : 900c07b854a7d7549ea4116aaafbb02bc610553a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 May 2026 14:43:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 May 2026 14:43:42 +0900    

Click here for diff

Two cases fixed by 2b5ba2a0a141 were not covered, to emulate the  
handling of corrupted data, for:  
- set control bit with a valid 2-byte match tag where offset is 0.  
- set control bit with a valid 2-byte match tag where offset exceeds  
output written.  
  
Oversight in 67d318e70402.  
  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/agF4xkIdRcrCIprs@paquier.xyz  
Backpatch-through: 14  

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

Fix stale COPY progress during logical replication table sync

commit   : 422e54e3092afd09997d27cc7c99598f91075b0d    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 13 May 2026 11:44:31 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 13 May 2026 11:44:31 +0900    

Click here for diff

Previously, pg_stat_progress_copy in the subscriber could continue to show  
the initial COPY operation for logical replication table synchronization as  
active even after the data copy had finished. The stale progress entry  
remained visible until synchronization caught up with the publisher.  
  
This happened because the table synchronization code called BeginCopyFrom()  
and CopyFrom(), but failed to call EndCopyFrom() afterward.  
  
This commit fixes the issue by adding the missing EndCopyFrom() call so that  
the COPY progress state in the subscriber is cleared as soon as the initial  
data copy completes.  
  
Backpatch to all supported branches.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurQKuy3RiPkd=25PEwEzaqHuGvEOf=X7vaVzhgNjaukYzA@mail.gmail.com  
Backpatch-through: 14  

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

psql: save/restore truePrint/falsePrint printQueryOpt values

commit   : 34be85f65746da83cebaf874f236605c28ec0fe5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 18:28:20 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 18:28:20 -0400    

Click here for diff

Reported-by: a.kozhemyakin  
  
Author: David G. Johnston  
  
Discussion: https://postgr.es/m/83e247ed-0b2d-4aba-bc42-e7bbc20be0d6@postgrespro.ru  

M src/bin/psql/command.c

doc PG 19 relnotes: add two optimizer hooks

commit   : cac0f24eb57f628c59e026e5b924f9d9ee4d7353    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 16:16:14 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 16:16:14 -0400    

Click here for diff

Reported-by: Jian He  
  
Discussion: https://postgr.es/m/CACJufxE8Ew_DCXtd1VZSC=pNPHqZRa4RJkbCr7z6ZPJJ3o3hGQ@mail.gmail.com  

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

De-obfuscate the comment in tsrank.c's calc_rank_or().

commit   : 163f20ca12a9f83aff68c47e9ab94f0856800dd5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 May 2026 15:04:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 May 2026 15:04:42 -0400    

Click here for diff

Oleg's original comment was intelligible only to him.  
Aleksander has reverse-engineered what seems like a plausible  
explanation of what the code is trying to do, so replace the  
comment with that.  (Also, re-order the final expression to  
match the new comment.)  
  
In passing, this makes the comment satisfy our usual formatting  
conventions.  pgindent has let it pass as-is so far, but planned  
changes would mess it up without some sort of intervention.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAJ7c6TO0xvunpeOv89i1eKQBhKF9=GEETkTz+yAGs1xGYH25MQ@mail.gmail.com  

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

doc PG 19 relnotes: remove "Optionally" for CPU optimizations

commit   : 06fccab4c61b4c3555fbbdb9da1290bcde1ddb50    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 15:13:46 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 12 May 2026 15:13:46 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CANWCAZZWfdoMcemSaTMon+e6aCkSABN3+sco0aStC90cFPVE4A@mail.gmail.com  

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

Add psql tab completion for FOR PORTION OF clause

commit   : 7b22f15a015ff57507cd9c8cfa0b9741b33cc0bd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 May 2026 17:19:15 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 May 2026 17:19:15 +0200    

Click here for diff

Add tab completion support in psql for the FOR PORTION OF clause  
used in UPDATE and DELETE statements with temporal tables.  
  
For both UPDATE and DELETE, completion now guides users through:  
  <table> FOR -> PORTION -> OF -> <column> -> FROM  
  
Author: Kiran Kaki <itskkpg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAD0dvCQLqLzPrQJRjjA2qXDH%3DD%2BXShcxhbSPxNhVruC8HGhkbQ%40mail.gmail.com  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/tab-complete.in.c

pg_stat_statements: Fix potential use-after-free of PlannedStmt

commit   : 8268e41aca23ae3414360b0a1dc6ae99ea7b43f4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 May 2026 13:36:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 May 2026 13:36:38 +0900    

Click here for diff

pgss_ProcessUtility() included a reference to a portion of a PlannedStmt  
after the point where this data's structure could have been freed,  
causing an incorrect memory access.  There was a comment documenting  
this requirement, missed in 3357471cf9f5.  
  
This commit includes a test able to make valgrind complain with a  
PlannedStmt freed by an internal ROLLBACK query.  Similarly to what is  
mentioned in 495e73c2079e, this can be triggered by using the extended  
query protocol, something that can be now tested thanks to the recent  
meta-command additions in psql.  This commit mentions potential other  
cases, but as far as I can see the extended protocol case with an  
internal ROLLBACK is the only problematic pattern reachable in practice.  
  
Issue introduced by 3357471cf9f5, gone unnoticed due to a lack of test  
coverage.  The fix is authored by Chao, my contribution being the new  
test.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/2F91906A-F2B5-4A6B-9695-D136957D4545@gmail.com  

M contrib/pg_stat_statements/expected/plancache.out
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/plancache.sql

doc PG 19 relnotes: adjustments/removal of items

commit   : 8974a7c433d363b729c5b2379ff849e2e60dffbe    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 11 May 2026 17:43:15 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 11 May 2026 17:43:15 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CANWCAZZWfdoMcemSaTMon+e6aCkSABN3+sco0aStC90cFPVE4A@mail.gmail.com  

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

Use palloc_array() in a few more places to avoid overflow

commit   : c3f7dde39e940c86cccc179e8cbe188966e4e3ec    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 11 May 2026 21:18:06 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 11 May 2026 21:18:06 +0300    

Click here for diff

These could overflow on 32-bit systems.  
  
Backpatch-through: 14  
Security: CVE-2026-6473  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c

Fix REPACK with WITHOUT OVERLAPS replica identity indexes

commit   : 36f52a59b31502213a01fb4b0a89afc0f3bfd21d    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 11 May 2026 18:17:46 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 11 May 2026 18:17:46 +0200    

Click here for diff

REPACK replay builds scan keys for the replica identity index, but it  
hard-coded BTEqualStrategyNumber when looking up the equality operator.  
That is not correct for non-btree identity indexes, such as the GiST  
indexes created for WITHOUT OVERLAPS primary keys.  In addition,  
find_target_tuple() accepted the first tuple returned by the identity  
index scan, which is unsafe for lossy index scans because the index AM may  
return false positives with xs_recheck set.  
  
Fix this by using IndexAmTranslateCompareType() to translate COMPARE_EQ  
to the equality strategy number for the index AM, and by continuing the  
scan when recheck is required until a candidate tuple matches the locator  
tuple on all replica identity key columns.  
  
The recheck uses the same equality operator functions as the identity  
index scan keys, preserving ScanKey argument ordering.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/7B0EC0EC-5461-41EF-9B31-F9BBE608DEA5@gmail.com  

M src/backend/commands/repack.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/repack_temporal.out
A src/test/modules/injection_points/expected/repack_temporal_multirange.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/repack_temporal.spec
A src/test/modules/injection_points/specs/repack_temporal_multirange.spec

Remove test cases for field overflows in intarray and ltree.

commit   : 906ea101d0d58a0b78bbe67be5fe54976c0a21e6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 12:12:03 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 12:12:03 -0400    

Click here for diff

These checks are failing in the buildfarm, reporting stack overflows  
rather than the expected errors, though seemingly only on ppc64 and  
s390x platforms.  Perhaps there is something off about our tests  
for stack depth on those architectures?  But there's no time to  
debug that right now, and surely these tests aren't too essential.  
Revert for now and plan to revisit after the release dust settles.  
  
Backpatch-through: 14  
Security: CVE-2026-6473  

M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M contrib/ltree/expected/ltree.out
M contrib/ltree/sql/ltree.sql

refint: Fix SQL injection and buffer overruns.

commit   : 260e97733bf09acc448faea24fc6210411892b1a    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

Maliciously crafted key value updates could achieve SQL injection  
within check_foreign_key().  To fix, ensure new key values are  
properly quoted and escaped in the internally generated SQL  
statements.  While at it, avoid potential buffer overruns by  
replacing the stack buffers for internally generated SQL statements  
with StringInfo.  
  
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Security: CVE-2026-6637  
Backpatch-through: 14  

M contrib/spi/refint.c

Mark PQfn() unsafe and fix overrun in frontend LO interface.

commit   : bd48114937c8af9cb86972e2b576924a761359cf    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

When result_is_int is set to 0, PQfn() cannot validate that the  
result fits in result_buf, so it will write data beyond the end of  
the buffer when the server returns more data than requested.  Since  
this function is insecurable and obsolete, add a warning to the top  
of the pertinent documentation advising against its use.  
  
The only in-tree caller of PQfn() is the frontend large object  
interface.  To fix that, add a buf_size parameter to  
pqFunctionCall3() that is used to protect against overruns, and use  
it in a private version of PQfn() that also accepts a buf_size  
parameter.  
  
Reported-by: Yu Kunpeng <yu443940816@live.com>  
Reported-by: Martin Heistermann <martin.heistermann@unibe.ch>  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Security: CVE-2026-6477  
Backpatch-through: 14  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h

Fix integer overflow in array_agg(), when the array grows too large

commit   : 6d68fcb28f9180289d1910d3fa7fca2d32021730    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

If you accumulate many arrays full of NULLs, you could overflow  
'nitems', before reaching the MaxAllocSize limit on the allocations.  
Add an explicit check that the number of items doesn't grow too large.  
With more than MaxArraySize items, getting the final result with  
makeArrayResultArr() would fail anyway, so better to error out early.  
  
Reported-by: Xint Code  
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Backpatch-through: 14  
Security: CVE-2026-6473  

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

commit   : b2869ebc43bd0ce7c0e73a15730d77644aebaf8e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

pg_locale_icu.c was full of places where a very long input string  
could cause integer overflow while calculating a buffer size,  
leading to buffer overruns.  
  
It also was cavalier about using char-type local arrays as buffers  
holding arrays of UChar.  The alignment of a char[] variable isn't  
guaranteed, so that this risked failure on alignment-picky platforms.  
The lack of complaints suggests that such platforms are very rare  
nowadays; but it's likely that we are paying a performance price on  
rather more platforms.  Declare those arrays as UChar[] instead,  
keeping their physical size the same.  
  
pg_locale_libc.c's strncoll_libc_win32_utf8() also had the  
disease of assuming it could double or quadruple the input  
string length without concern for overflow.  
  
Reported-by: Xint Code  
Reported-by: Pavel Kohout <pavel.kohout@aisle.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c

Prevent path traversal in pg_basebackup and pg_rewind

commit   : a1063eecedf379de5dad73f9bd6e856ad5c114fb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

pg_rewind and pg_basebackup could be fed paths from rogue endpoints that  
could overwrite the contents of the client when received, achieving path  
traversal.  
  
There were two areas in the tree that were sensitive to this problem:  
- pg_basebackup, through the astreamer code, where no validation was  
performed before building an output path when streaming tar data.  This  
is an issue in v15 and newer versions.  
- pg_rewind file operations for paths received through libpq, for all  
the stable branches supported.  
  
In order to address this problem, this commit adds a helper function in  
path.c, that reuses path_is_relative_and_below_cwd() after applying  
canonicalize_path().  This can be used to validate the paths received  
from a connection point.  A path is considered invalid if any of the two  
following conditions is satisfied:  
- The path is absolute.  
- The path includes a direct parent-directory reference.  
  
Reported-by: XlabAI Team of Tencent Xuanwu Lab  
Reported-by: Valery Gubanov <valerygubanov95@gmail.com>  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Backpatch-through: 14  
Security: CVE-2026-6475  

M src/bin/pg_rewind/file_ops.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_tar.c
M src/include/port.h
M src/port/path.c

Avoid overflow in size calculations in formatting.c.

commit   : 6a985e71e9213420b5ebd388b20b2d3180ce0468    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

A few functions in this file were incautious about multiplying a  
possibly large integer by a factor more than 1 and then using it as  
an allocation size.  This is harmless on 64-bit systems where we'd  
compute a size exceeding MaxAllocSize and then fail, but on 32-bit  
systems we could overflow size_t, leading to an undersized  
allocation and buffer overrun.  To fix, use palloc_array() or  
mul_size() instead of handwritten multiplication.  
  
Reported-by: Sven Klemm <sven@tigerdata.com>  
Reported-by: Xint Code  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>  
Security: CVE-2026-6473  
Backpatch-through: 14  

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

Check CREATE privilege on multirange type schema in CREATE TYPE.

commit   : 4793fc41f82893b059bd59739bdcbe3d58c4df7e    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

This omission allowed roles to create multirange types in any  
schema, potentially leading to privilege escalations.  Note that  
when a multirange type name is not specified in CREATE TYPE, it is  
automatically placed in the range type's schema, which is checked  
at the beginning of DefineRange().  
  
Reported-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Security: CVE-2026-6472  
Backpatch-through: 14  

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

pg_createsubscriber: Obstruct SQL injection via subscription names.

commit   : d389415ffad509f0de1342e6ebbb5d5c62dbedef    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 11 May 2026 05:13:47 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:47 -0700    

Click here for diff

drop_existing_subscription() neglected to escape the subscription  
name when generating its query string.  To fix, use  
PQescapeIdentifier() to construct a properly escaped name, and use  
it in the ALTER SUBSCRIPTION and DROP SUBSCRIPTION commands.  
  
Reported-by: Yu Kunpeng <yu443940816@live.com>  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Security: CVE-2026-6476  
Backpatch-through: 17  

M src/bin/pg_basebackup/pg_createsubscriber.c

Fix MCV input array checks in statistics restore functions

commit   : 6d6348f0329dd50ba9f954df28c2ffa88a15df07    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

The SQL functions for the restore of attribute and expression statistics  
accept "most_common_vals" and "most_common_freqs" as independent arrays.  
The planner assumes these have the same number of elements, but it was  
possible to insert in the catalogs data that would cause an over-read  
when the catalog data is loaded in the planner.  
  
There were two holes in the stats restore logic:  
- Both arrays should match in size.  
- The input array must be one-dimensional, and it should match with what  
is delivered by pg_dump when scanning the pg_stats catalogs.  
  
The multivariate extended statistics MCV path (import_mcv) already  
validated these inputs via check_mcvlist_array(), and is not affected.  
These problems exist in v18 and newer versions for the restore of  
attribute statistics.  These problems affect only HEAD for the restore  
of the expression statistics.  
  
Reported-by: Jeroen Gui <jeroen.gui1@proton.me>  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Security: CVE-2026-6575  
Backpatch-through: 18  

M src/backend/statistics/attribute_stats.c
M src/backend/statistics/extended_stats_funcs.c
M src/backend/statistics/stat_utils.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Guard against unsafe conditions in usage of pg_strftime().

commit   : ec8ded4b327f9d121811f43bf0177d0f289c3949    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

Although pg_strftime() has defined error conditions, no callers bother  
to check for errors.  This is problematic because the output string is  
very likely not null-terminated if an error occurs, so that blindly  
using it is unsafe.  Rather than trusting that we can find and fix all  
the callers, let's alter the function's API spec slightly: make it  
guarantee a null-terminated result so long as maxsize > 0.  
  
Furthermore, if we do get an error, let's make that null-terminated  
result be an empty string.  We could instead truncate at the buffer  
length, but that risks producing mis-encoded output if the tz_name  
string contains multibyte characters.  It doesn't seem reasonable for  
src/timezone/ to make use of our encoding-aware truncation logic.  
Also, the only really likely source of a failure is a user-supplied  
timezone name that is intentionally trying to overrun our buffers.  
I don't feel a need to be particularly friendly about that case.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Backpatch-through: 14  
Security: CVE-2026-6474  

M src/timezone/strftime.c

Avoid passing unintended format codes to snprintf().

commit   : 76ab76f875a85d51da91dca18d64a6b717533ad9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

timeofday() assumed that the output of pg_strftime() could not contain  
% signs, other than the one it explicitly asks for with %%.  However,  
we don't have that guarantee with respect to the time zone name (%Z).  
A crafted time zone setting could abuse the subsequent snprintf()  
call, resulting in crashes or disclosure of server memory.  
  
To fix, split the pg_strftime() call into two and then treat the  
outputs as literal strings, not a snprintf format string.  The  
extra pg_strftime() call doesn't really cost anything, since the  
bulk of the conversion work was done by pg_localtime().  
  
Also, adjust buffer widths so that we're not risking string truncation  
during the snprintf() step, as that would create a hazard of producing  
mis-encoded output.  
  
This also fixes a latent portability issue: the format string expects  
an int, but tp.tv_usec is long int on many platforms.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Backpatch-through: 14  
Security: CVE-2026-6474  

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

Fix SQL injection in logical replication origin checks.

commit   : 46b4f5c11b0f2f6e6db834ffafc0d1a01a0373c1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

ALTER SUBSCRIPTION ... REFRESH PUBLICATION interpolates schema and  
relation names into SQL without quoting them.  A crafted subscriber  
relation name can inject arbitrary SQL on the publisher.  Test such a  
name.  Back-patch to v16, where commit  
875693019053b8897ec3983e292acbb439b088c3 first appeared.  
  
Reported-by: Pavel Kohout <pavel.kohout@aisle.com>  
Author: Pavel Kohout <pavel.kohout@aisle.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Backpatch-through: 16  
Security: CVE-2026-6638  

M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/030_origin.pl

Apply timingsafe_bcmp() in authentication paths

commit   : 5924e256c499c010dd369984498c8d5a4ee17894    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

This commit applies timingsafe_bcmp() to authentication paths that  
handle attributes or data previously compared with memcpy() or strcmp(),  
which are sensitive to timing attacks.  
  
The following data is concerned by this change, some being in the  
backend and some in the frontend:  
- For a SCRAM or MD5 password, the computed key or the MD5 hash compared  
with a password during a plain authentication.  
- For a SCRAM exchange, the stored key, the client's final nonce and the  
server nonce.  
- RADIUS (up to v18), the encrypted password.  
- For MD5 authentication, the MD5(MD5()) hash.  
  
Reported-by: Joe Conway <mail@joeconway.com>  
Security: CVE-2026-6478  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Backpatch-through: 14  

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

Guard against overflow in "left" fields of query_int and ltxtquery.

commit   : 43451a7a2b3305571e7f8ed56d053e97acca1d1d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

contrib/intarray's query_int type uses an int16 field to hold the  
offset from a binary operator node to its left operand.  However, it  
allows the number of nodes to be as much as will fit in MaxAllocSize,  
so there is a risk of overflowing int16 depending on the precise shape  
of the tree.  Simple right-associative cases like "a | b | c | ..."  
work fine, so we should not solve this by restricting the overall  
number of nodes.  Instead add a direct test of whether each individual  
offset is too large.  
  
contrib/ltree's ltxtquery type uses essentially the same logic and  
has the same 16-bit restriction.  
  
(The core backend's tsquery.c has a variant of this logic too, but  
in that case the target field is 32 bits, so it is okay so long  
as varlena datums are restricted to 1GB.)  
  
In v16 and up, these types support soft error reporting, so we have  
to complicate the recursive findoprnd function's API a bit to allow  
the complaint to be reported softly.  v14/v15 don't need that.  
  
Undocumented and overcomplicated code like this makes my head hurt,  
so add some comments and simplify while at it.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M contrib/intarray/_int_bool.c
M contrib/intarray/expected/_int.out
M contrib/intarray/sql/_int.sql
M contrib/ltree/expected/ltree.out
M contrib/ltree/ltxtquery_io.c
M contrib/ltree/sql/ltree.sql

Fix unbounded recursive handling of SSL/GSS in ProcessStartupPacket()

commit   : b63f25bddfebc67b1e78f86341a6aecb0e9fe576    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

The handling of SSL and GSS negotiation messages in  
ProcessStartupPacket() could cause a recursion of the backend,  
ultimately crashing the server as the negotiation attempts were not  
tracked across multiple calls processing startup packets.  
  
A malicious client could therefore alternate rejected SSL and GSS  
requests indefinitely, each adding a stack frame, until the backend  
crashed with a stack overflow, taking down a server.  
  
This commit addresses this issue by modifying ProcessStartupPacket() so  
as processed negotiation attempts are tracked, preventing infinite  
recursive attempts.  A TAP test is added to check this problem, where  
multiple SSL and GSS negotiated attempts are stacked.  
  
Reported-by: Calif.io in collaboration with Claude and Anthropic  
Research  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Security: CVE-2026-6479  
Backpatch-through: 14  

M src/backend/tcop/backend_startup.c
M src/test/postmaster/meson.build
A src/test/postmaster/t/004_negotiate.pl

Fix assorted places that need to use palloc_array().

commit   : c55cea5290647c8d3e571893078664bbca955017    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

multirange_recv and BlockRefTableReaderNextRelation were incautious  
about multiplying a possibly-large integer by a factor more than 1  
and then using it as an allocation size.  This is harmless on 64-bit  
systems where we'd compute a size exceeding MaxAllocSize and then  
fail, but on 32-bit systems we could overflow size_t leading to an  
undersized allocation and buffer overrun.  
  
Fix these places by using palloc_array() instead of a handwritten  
multiplication.  (In HEAD, some of them were fixed already, but  
none of that work got back-patched at the time.)  
  
In addition, BlockRefTableReaderNextRelation passes the same value  
to BlockRefTableRead's "int length" parameter.  If built for  
64-bit frontend code, palloc_array() allows a larger array size  
than it otherwise would, potentially allowing that parameter to  
overflow.  Add an explicit check to forestall that and keep the  
behavior the same cross-platform.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M src/backend/utils/adt/multirangetypes.c
M src/common/blkreftable.c

Prevent buffer overrun in unicode_normalize().

commit   : 066b7b144f33819b0f4efa6b24ec638974c79a8a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

Some UTF8 characters decompose to more than a dozen codepoints.  
It is possible for an input string that fits into well under  
1GB to produce more than 4G decomposed codepoints, causing  
unicode_normalize()'s decomp_size variable to wrap around to a  
small positive value.  This results in a small output buffer  
allocation and subsequent buffer overrun.  
  
To fix, test after each addition to see if we've overrun MaxAllocSize,  
and break out of the loop early if so.  In frontend code we want to  
just return NULL for this failure (treating it like OOM).  In the  
backend, we can rely on the following palloc() call to throw error.  
  
I also tightened things up in the calling functions in varlena.c,  
using size_t rather than int and allocating the input workspace  
with palloc_array().  These changes are probably unnecessary  
given the knowledge that the original input and the normalized  
output_chars array must fit into 1GB, but it's a lot easier to  
believe the code is safe with these changes.  
  
Reported-by: Xint Code  
Reported-by: Bruce Dang <bruce@calif.io>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Co-authored-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Backpatch-through: 14  
Security: CVE-2026-6473  

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

Harden our regex engine against integer overflow in size calculations.

commit   : 0dc1fdc75ebbad9419ac5e313064be0fcf092543    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

The number of NFA states, number of NFA arcs, and number of colors  
are all bounded to reasonably small values.  However, there are  
places where we try to allocate arrays sized by products of those  
quantities, and those calculations could overflow, enabling  
buffer-overrun attacks.  In practice there's no problem on 64-bit  
machines, but there are some live scenarios on 32-bit machines.  
  
A related problem is that citerdissect() and creviterdissect()  
allocate arrays based on the length of the input string, which  
potentially could overflow.  
  
To fix, invent MALLOC_ARRAY and REALLOC_ARRAY macros that rely on  
palloc_array_extended and repalloc_array_extended with the NO_OOM  
option, similarly to the existing MALLOC and REALLOC macros.  
(Like those, they'll throw an error not return a NULL result for  
oversize requests.  This doesn't really fit into the regex code's  
view of error handling, but it'll do for now.  We can consider  
whether to change that behavior in a non-security follow-up patch.)  
  
I installed similar defenses in the colormap construction code.  
It's not entirely clear whether integer overflow is possible  
there, but analyzing the behavior in detail seems not worth  
the trouble, as the risky spots are not in hot code paths.  
  
I left a bunch of calls as-is after verifying that they can't  
overflow given reasonable limits on nstates and narcs.  Those  
limits were enforced already via REG_MAX_COMPILE_SPACE, but  
add commentary to document the interactions.  
  
In passing, also fix a related edge case, which is that the  
special color numbers used in LACON carcs could overflow the  
"color" data type, if ncolors is close to MAX_COLOR.  
  
In v14 and v15, the regex engine calls malloc() directly instead  
of using palloc(), so MALLOC_ARRAY and REALLOC_ARRAY do likewise.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M src/backend/regex/regc_color.c
M src/backend/regex/regc_cvec.c
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/include/regex/regcustom.h
M src/include/regex/regguts.h

Make palloc_array() and friends safe against integer overflow.

commit   : 46593aea0a5ca7ead0876833d99639c9a4bb5a9d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

Sufficiently large "count" arguments could result in undetected  
overflow, causing the allocated memory chunk to be much smaller  
than what the caller will subsequently write into it.  This is  
unlikely to be a hazard with 64-bit size_t but can sometimes  
happen on 32-bit builds, primarily where a function allocates  
workspace that's significantly larger than its input data.  
Rather than trying to patch the at-risk callers piecemeal,  
let's just redefine these macros so that they always check.  
  
To do that, move the longstanding add_size() and mul_size() functions  
into palloc.h and mcxt.c, and adjust them to not be specific to  
shared-memory allocation.  Then invent palloc_mul(), palloc0_mul(),  
palloc_mul_extended() to use these functions.  Actually, the latter  
use inlined copies to save one function call.  repalloc_array() gets  
similar treatment.  I didn't bother trying to inline the calls for  
repalloc0_array() though.  
  
In v14 and v15, this also adds repalloc_extended(), which previously  
was only available in v16 and up.  
  
We need copies of all this in fe_memutils.[hc] as well, since that  
module also provides palloc_array() etc.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M src/backend/storage/ipc/shmem.c
M src/backend/utils/mmgr/mcxt.c
M src/common/fe_memutils.c
M src/include/common/fe_memutils.h
M src/include/storage/shmem.h
M src/include/utils/memutils.h
M src/include/utils/palloc.h

Fix overflows with ts_headline()

commit   : d388e1d7f0468db8d046f9101f972d1fa988b19a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

The options "StartSel", "StopSel" and "FragmentDelimiter" given by a  
caller of the SQL function ts_headline() have their lengths stored as  
int16.  When providing values larger than PG_INT16_MAX, it was possible  
to overflow the length values stored, leading to incorrect behaviors in  
generateHeadline(), in most cases translating to a crash.  
  
Attempting to use values for these options larger than PG_INT16_MAX is  
now blocked.  Some test cases are added to cover our tracks.  
  
Reported-by: Xint Code  
Author: Michael Paquier <michael@paquier.xyz>  
Backpatch-through: 14  
Security: CVE-2026-6473  

M src/backend/tsearch/wparser_def.c
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

ltree: Fix overflows with lquery parsing

commit   : 2f1b16e867e78cdd899fa7df3acb5f6e616a9371    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 May 2026 05:13:46 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 11 May 2026 05:13:46 -0700    

Click here for diff

The lquery parser in contrib/ltree/ had two overflow problems:  
- A single lquery level with many OR-separated variants (e.g.,  
'label1|label2|...'), could cause an overflow of totallen, this being  
stored as a uint16, meaning a maximum value of UINT16_MAX or 65k.  Each  
variant contributes MAXALIGN(LVAR_HDRSIZE + len) bytes.  With enough  
long variants, the value would wraparound.  This would corrupt the data  
written by LQL_NEXT(), leading to a stack corruption, most likely  
translating into a crash, but it would allow incorrect memory access.  
- numvar, labelled as a uint16, counts the number of OR-variants in a  
single level, and it is incremented without bounds checking.  With more  
than PG_UINT16_MAX (65k) variants in a single level, and a minimum of  
131kB of input data, it would wrap to 0.  When a (wildcard) '*' is  
used, this would change the query results silently.  
  
For both issues, a set of overflows checks are added to guard against  
these problematic patterns.  
  
The first issue has been reported by the three people listed below,  
affecting v16 and newer versions due to b1665bf01e5f.  Its coding was  
still unsafe in v14 and v15.  The second issue affects all the stable  
branches; I have bumped into while reviewing the code of the module.  
  
Reported-by: Vergissmeinnicht <vergissmeinnichtzh@gmail.com>  
Reported-by: A1ex <alex000young@gmail.com>  
Reported-by: Jihe Wang <wangjihe.mail@gmail.com>  
Author: Michael Paquier <michael@paquier.xyz>  
Security: CVE-2026-6473  
Backpatch-through: 14  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_io.c
M contrib/ltree/sql/ltree.sql

pg_upgrade: Message improvements

commit   : c1fe2d1a3837bdb3b5476cb85d59bed5ddfe485b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 May 2026 11:38:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 May 2026 11:38:20 +0200    

Click here for diff

M src/bin/pg_upgrade/check.c

Fix universal builds on MacOS

commit   : 901ed9b352b41f034e17bc540725082a488fce31    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Fri, 8 May 2026 16:44:25 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Fri, 8 May 2026 16:44:25 +0700    

Click here for diff

Commit 16743db06 assumed that the CPUID instruction was always  
available when the usual x86 symbols were defined. That is not the  
case, so zero out the info rather than error out.  
  
Reported-by: Jakob Egger <jakob@eggerapps.at>  
Reported-by: Tobias Bussmann <t.bussmann@gmx.net>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/223EA201-A0E8-4A13-B220-EB903E8DF817@eggerapps.at  

M src/port/pg_cpu_x86.c

Enforce RETURNING typmod for empty-set JSON_ARRAY(query)

commit   : 9d124a14b3d4803afee5efc4f794dfb72016cb88    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 17:21:48 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 17:21:48 +0900    

Click here for diff

Commit 8d829f5a0 introduced a COALESCE wrapper around the  
JSON_ARRAYAGG subquery so that JSON_ARRAY(query) returns '[]' rather  
than NULL when the subquery yields no rows, per the SQL/JSON standard.  
  
The empty-array Const used as the COALESCE fallback was, however,  
built with typmod -1 and the type input function was likewise invoked  
with typmod -1.  As a result, any length restriction from the  
RETURNING clause was silently bypassed on the empty-set path, while  
the non-empty path enforced it via the JSON_ARRAYAGG coercion.  
  
Build the empty-array Const using the typmod of the COALESCE's  
non-empty argument, and pass that typmod to OidInputFunctionCall as  
well so the value is length-checked at parse time.  This makes the  
empty-set and non-empty-set paths behave consistently.  
  
Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAJTYsWXPYqa58YXrU+SQMVonsAhjLS46HNUMU=wO5zm9MgY3_g@mail.gmail.com  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Use schema-qualified names in EXCEPT clause error messages.

commit   : a49b9cfd72d89a8fd68c90e84c38aa7e2ada756b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 8 May 2026 10:00:26 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 8 May 2026 10:00:26 +0530    

Click here for diff

Error messages in check_publication_add_relation() previously reported  
only the relation name when a table in an EXCEPT clause could not be  
processed, which is ambiguous when the same name exists in multiple  
schemas. Use schema-qualified names instead, consistent with other error  
messages that reference relation names.  
  
Author: Dilip Kumar <dilipbalaut@gmail.com>  
Author: vignesh C <vignesh21@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/CAFiTN-scG7b11Jsp+VoDRT8ZFE84eSKLcDsSB18dZ8AaP=R-mw@mail.gmail.com  

M src/backend/catalog/pg_publication.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/include/utils/lsyscache.h
M src/include/utils/relcache.h
M src/test/regress/expected/publication.out

postgres_fdw: Fix syntax error in fetch_attstats().

commit   : 3f7a1afbaef06a7af93223cf2a653f2ec5740590    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 8 May 2026 13:15:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 8 May 2026 13:15:00 +0900    

Click here for diff

When importing remote stats for a foreign table backed by a pre-v17  
remote server, the query built/executed in this function has three NULL  
placeholders for the range stats supported in v17 at the end of the  
SELECT list.  Previously, it included a trailing comma after the last  
NULL, like "SELECT ..., NULL, NULL, NULL, FROM pg_catalog.pg_stats ...",  
causing a syntax error on the remote server.  Fix by removing the comma.  
  
Oversight in commit 28972b6fc.  
  
Author: Satya Narlapuram <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/CAHg%2BQDdEE7wp1S60Fn9Kmna8KfdMo5Tu6dROLpMn_-EOUBKmWQ%40mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c

Consider opfamily and collation when removing redundant GROUP BY columns

commit   : a1b754558ae87ceb1a44c34dc540f9128f6472eb    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 12:45:51 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 12:45:51 +0900    

Click here for diff

remove_useless_groupby_columns() uses a relation's unique indexes to  
prove that some GROUP BY columns are functionally dependent on others,  
and so can be dropped from the GROUP BY clause.  The match between  
index columns and GROUP BY columns was done by attno alone, ignoring  
two equality-relation issues.  
  
A type may belong to multiple btree opfamilies whose notions of  
equality differ.  The record type, for instance, has record_ops  
(per-field equality) and record_image_ops (bytewise equality).  A  
unique index under one opfamily does not prove uniqueness under the  
equality used by GROUP BY when the SortGroupClause's eqop comes from a  
different opfamily.  
  
Likewise, since nondeterministic collations were introduced in PG 12,  
two collations may disagree on equality, and a unique index under one  
collation does not prove uniqueness under another.  
  
In either case, rows that the index considers distinct can collapse  
into a single GROUP BY group, taking ungrouped columns of differing  
values with them, so the planner drops a column that is not in fact  
functionally dependent and produces wrong results.  
  
Fix by requiring, for each unique-index key column, that some GROUP BY  
item on the same column has an eqop in the index's opfamily and a  
collation that agrees on equality with the index's collation.  This  
mirrors the combined check relation_has_unique_index_for() applies to  
join clauses.  
  
This is a v18 regression: commit bd10ec529 extended  
remove_useless_groupby_columns() from primary-key constraints to  
arbitrary unique indexes.  Before that, the function consulted only  
primary keys, whose enforcement index is required by parse_utilcmd.c  
to use the default opclass and the column's declared collation, so  
neither mismatch could arise.  Back-patch to v18 only.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49t6uArWoTT-cHY+nhsi23nJJKcF9Xb9cYGzaZ9kNJ98g@mail.gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/collate.icu.utf8.sql
M src/tools/pgindent/typedefs.list

Fix HAVING-to-WHERE pushdown for simple-CASE form

commit   : ba82de48e62c633f5ad5e9dc9e6f2f3e8455a09f    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 10:57:50 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 8 May 2026 10:57:50 +0900    

Click here for diff

Commit f76686ce7 added a walker that detects when a HAVING clause uses  
a collation that conflicts with the GROUP BY's nondeterministic  
collation, keeping such clauses in HAVING.  The walker uses  
exprInputCollation() to identify each ancestor's comparison collation,  
but missed the simple-CASE case: parse analysis builds each WHEN as  
OpExpr(CaseTestExpr op val), where CaseTestExpr is a placeholder for  
the arg, while the actual arg expression sits at cexpr->arg, outside  
the OpExpr that carries the comparison's inputcollid.  A GROUP Var at  
cexpr->arg was therefore visited with the WHEN's inputcollid absent  
from the ancestor stack, the conflict went undetected, and the clause  
was wrongly pushed to WHERE.  
  
Fix by handling simple CASE explicitly: before walking cexpr->arg,  
push every WHEN's inputcollid onto the ancestor stack so a GROUP Var  
at the arg is checked against the same collations the WHEN comparisons  
would apply.  Then walk the WHEN bodies and defresult under the  
unchanged stack, where their own collation contexts are picked up by  
the default path.  
  
Back-patch to v18 only; this fix extends the walker added by commit  
f76686ce7 and inherits its dependency on the v18 RTE_GROUP mechanism.  
  
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDcqPdd=2V0PQ_oNYj50OUeqSqznqFaYtP3RdokLBDXBqw@mail.gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

doc PG 19 relnotes: add UTF-8 case folding performance item

commit   : 12ca57bf346f1be0986f360d147bbe1a46d682db    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 20:53:22 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 20:53:22 -0400    

Click here for diff

Reported-by: Andreas Karlsson  
  
Discussion: https://postgr.es/m/9dae1593-4441-4a20-a1ab-ce5018db9878@proxel.se  

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

Fix use-after-free of qs in AfterTriggerEndQuery.

commit   : 4b1b2be22f2588f00dfd330886c1ca949f7dd938    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 8 May 2026 08:26:04 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 8 May 2026 08:26:04 +0900    

Click here for diff

afterTriggerInvokeEvents() may repalloc afterTriggers.query_stack  
while firing trigger events, leaving any precomputed entry pointer  
dangling.  The loop body in AfterTriggerEndQuery() recomputes qs  
after each afterTriggerInvokeEvents() call for that reason, but the  
"all fired" break path exits without the recompute, and the  
subsequent FireAfterTriggerBatchCallbacks(qs->batch_callbacks)  
dereferences the freed pointer.  
  
Fix by recomputing qs immediately before  
FireAfterTriggerBatchCallbacks(), as the loop body already does  
after each afterTriggerInvokeEvents() call.  
  
The hazard was introduced in 34a30786293, which added the  
qs->batch_callbacks dereference at this site.  
  
Reported-by: Amul Sul <sulamul@gmail.com>  
Author: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/CAAJ_b95p6-qiVpE2Gpr=bUsNAqTcejD_rPgLnfjx9m=fo3Rf3Q@mail.gmail.com  

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

doc PG 19 relnotes: correct two items

commit   : 2d773a9f005fa555eb9fa35157b96f48d6ea8b53    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 20:21:16 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 20:21:16 -0400    

Click here for diff

Reported-by: jian he  
  
Discussion: https://postgr.es/m/CACJufxG_ZTCTtFMxKiVji-s10jHt99krfH+Kn+Ww2prF=X6g6Q@mail.gmail.com  

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

doc PG 19 relnotes: add missing commits and details

commit   : 4c0f1e4910184a7427ab133f1b233aa0ab5c26ec    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 18:02:02 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 7 May 2026 18:02:02 -0400    

Click here for diff

Reported-by: Xuneng Zhou  
  
Discussion: https://postgr.es/m/CABPTF7VxrFB_4Qoo2=PyrczGyq8CqOpQ5D5yye3DyxDC=so_0Q@mail.gmail.com  

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

Fix race condition in XLogLogicalInfo and ProcSignal initialization.

commit   : b384cdb2745b56121426605d985210896555fc05    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 7 May 2026 10:09:42 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 7 May 2026 10:09:42 -0700    

Click here for diff

Previously, InitializeProcessXLogLogicalInfo() was called before  
ProcSignalInit(). This created a window where a process could miss a  
signal barrier if it was issued between these two calls. As a result,  
the process could fail to update its local XLogLogicalInfo cache,  
leading to an inconsistent logical decoding state.  
  
This commit fixes this by moving InitializeProcessXLogLogicalInfo()  
after ProcSignalInit(). This ensures that the process is registered to  
participate in signal barriers before its state is initialized,  
preventing it from missing any state changes propagated during the  
startup sequence.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoBzdeSyLSSPM5E6ysN1r8qzp8u_BRmnLvuAp_S8QxS_fQ@mail.gmail.com  
Discussion: https://postgr.es/m/CAD21AoBj+zKvgw_Q8gjr4YbKccW_uMe3OFQ5+KT246FHUuNXSQ@mail.gmail.com  

M src/backend/postmaster/auxprocess.c
M src/backend/utils/init/postinit.c

Rationalize error comments in partition split/merge tests

commit   : ecb2508aaf9b978871734ea2fdf701ab7d593d0a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 7 May 2026 19:10:51 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 7 May 2026 19:10:51 +0700    

Click here for diff

The regression tests had a copy of the full error, detail, and hint  
text in comments above each failing statement in the .sql files. This  
is a maintenance hazard, so simplify to "-- ERROR", in line with  
other tests.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZap26BRLwtd+A7GFDSD6-+C3F0NVdUGUAu2LUfvpOTy=w@mail.gmail.com  

M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_merge.sql
M src/test/regress/sql/partition_split.sql

Message corrections for partition split/merge commands

commit   : 52e629be95fc2ff52eabdae5b72c8eb6d8eef38d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 7 May 2026 19:10:35 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 7 May 2026 19:10:35 +0700    

Click here for diff

Fix spelling and grammar, turn an accidental duplicate errmsg into  
errdetail, and remove an errposition that was not pointing at anything  
relevant to the error.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Yuchen Li <liyuchen_xyz@163.com> (earlier version)  
Discussion: https://postgr.es/m/CAJTYsWUvMT5uKOasPnm6-o9CrdXbRONiAYHTKJb7wx66LB8S1A@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out

pg_createsubscriber: Message improvements and corrections

commit   : 43fc1dc7527c4213c4d48a96bf98738df0acb71a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 May 2026 11:19:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 May 2026 11:19:55 +0200    

Click here for diff

M src/bin/pg_basebackup/pg_createsubscriber.c

Fix typo in error message

commit   : 5778fb3eafd05c562af5d4585baf0e3ac57d07e0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 May 2026 10:36:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 May 2026 10:36:59 +0200    

Click here for diff

Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAJTYsWXFy1j_T82%2BM_S9kFxU414tQYnZQD-b82%3DoL_LbG_5fPQ%40mail.gmail.com  

M src/backend/commands/propgraphcmds.c
M src/test/regress/expected/create_property_graph.out

Simplify code in objectaddress.c for some property graph objects

commit   : 6827de95ee094f8a2cb892a40e6f154491e78496    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 May 2026 10:18:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 May 2026 10:18:49 +0900    

Click here for diff

Property graph element labels and label properties relied on a direct  
systable scan when retrieving their object descriptions.  These can be  
simplified with get_catalog_object_by_oid().  This offers the benefit to  
do a direct syscache lookup, if available.  
  
The same logic will be used in a follow-up patch when retrieving the  
object identity parts, applying the same rule across the board for these  
object types.  
  
Extracted from a larger patch by the author.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Alex Guo <guo.alex.hengchen@gmail.com>  
Discussion: https://postgr.es/m/aej1DkLwhyZWmtxJ@bdtpg  

M src/backend/catalog/objectaddress.c

Fix WAIT FOR LSN cleanup on subtransaction abort

commit   : 5cdec423193cb99b502816197395637120256f0d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 6 May 2026 13:32:18 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 6 May 2026 13:32:18 +0300    

Click here for diff

WAIT FOR LSN registers the current backend in shared memory before entering an  
interruptible wait loop.  Top-level abort and backend exit already call  
WaitLSNCleanup(), but subtransaction abort did not.  If an interrupt, such as  
statement_timeout, occurred while waiting inside a savepoint, rolling back to  
the savepoint left the backend marked as present in the WAIT FOR LSN heap.  
  
Clean up WAIT FOR LSN state from AbortSubTransaction() as well, and add  
a TAP test covering reuse of WAIT FOR LSN after a savepoint rollback.  
  
Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAJTYsWXDRwo-RVRaQgwxVcXgURVFeX8BKnijQrPiPcSCkDDX9A%40mail.gmail.com  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogwait.c
M src/test/recovery/t/049_wait_for_lsn.pl

Fix regex searching for page verification failures in tests

commit   : 486b9a9b9eb45f48be183f0fc3cf3dc657026438    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:15 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:15 +0200    

Click here for diff

The test for finding page verification failures in the logfiles  
were missing the /m modifier to make sure it anchors to every  
newline in the search space buffer, and not just the last one.  
  
Spotted while adding a test for the recently reported issue with  
excessive WAL for unlogged relations.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDeGrpZbNZdLjd_T4b43xKEEXZN0HGhkFm-1bkBdyzK7AQ@mail.gmail.com  

M src/test/modules/test_checksums/t/006_pgbench_single.pl
M src/test/modules/test_checksums/t/007_pgbench_standby.pl
M src/test/modules/test_checksums/t/008_pitr.pl
M src/test/modules/test_checksums/t/009_fpi.pl

Apply data-checksum worker throttling parameters

commit   : 9a39056c418c83f164a25c8c2ee34600da99bfc7    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:12 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:12 +0200    

Click here for diff

The DataChecksumsWorker accepts cost_delay and cost_limit parameters  
from pg_enable_data_checksums() so users can throttle the I/O caused  
by enabling checksums.  Due to the API for setting the cost parameters  
changing between when the code was written, and when it was committed  
the new cost update function call was omitted and thus the parameters  
were silently ignored.  
  
Fix by calling VacuumUpdateCosts() after assigning the parameters  
(both during worker startup and on the runtime cost-update path), and  
by leaving the page-cost weights at their GUC-controlled defaults.  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDeevH6aTyWdXYBJW0wOmfoZy66gDi5TfinK_dXeCrHQLg@mail.gmail.com  

M src/backend/postmaster/datachecksum_state.c

Skip WAL for unlogged main fork during online checksum enable

commit   : 2018bd6167909f3de7405774527d1230397950e0    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:01 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 6 May 2026 12:38:01 +0200    

Click here for diff

ProcessSingleRelationFork() unconditionally generated an FPI WAL  
record for every page of every relation when enabling checksums.  
Unlogged relations, which by definition never generate WAL for  
data changes, were not exempt which generated excessive WAL to  
be emitted.  
  
Fix by guarding the FPI WAL record call with RelationNeedsWAL()  
to avoid emitting WAL for unlogged main forks.  Unlogged pages  
are still dirtied to ensure the checksum is written to disk at  
the next checkpoint.  The init fork remains WAL-logged even for  
unlogged relations, as it's needed on the standby to materialize  
the relation after promotion (see ResetUnloggedRelations()).  
Skipping init-fork WAL would leave the standby with a stale init  
fork that, once copied to the main fork on promotion, would fail  
checksum verification on every read of the unlogged relation.  
  
A test which creates an unlogged table with an index, enables  
checksums, promotes the standby, and verifies that the unlogged  
relation and its indexes are still readable post-promotion has  
been added.  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDeGrpZbNZdLjd_T4b43xKEEXZN0HGhkFm-1bkBdyzK7AQ@mail.gmail.com  

M src/backend/postmaster/datachecksum_state.c
M src/test/modules/test_checksums/t/003_standby_restarts.pl

Document deprecated --wal-directory option for pg_verifybackup

commit   : 43dc21f76fff67c481b1d208f9ee81a28972a158    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 May 2026 10:40:45 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 May 2026 10:40:45 +0200    

Click here for diff

Commit b3cf461b3cf renamed --wal-directory to --wal-path but retained  
the former as a silent alias.  Per project policy, all options,  
including deprecated ones, should be documented to assist users  
transitioning between versions.  
  
This patch restores --wal-directory to the documentation and --help  
output.  
  
Author: Amul Sul <sulamul@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/E1w3fZp-000gje-31%40gemulon.postgresql.org  

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

Skip other sessions' temp tables in REPACK, CLUSTER, and VACUUM FULL

commit   : a0a0c0c20ec5f8787bb1be5f476c4e59f6810634    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 5 May 2026 16:20:26 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 5 May 2026 16:20:26 +0200    

Click here for diff

get_tables_to_repack() and get_all_vacuum_rels() were including other  
sessions' temporary tables in their output work list, causing REPACK,  
CLUSTER and VACUUM FULL (when executed without a table list) to attempt  
to acquire AccessExclusiveLock on them, potentially blocking for an  
extended time.  Fix by skipping other-session temp tables early, before  
they are added to the list.  
  
This issue is ancient, but there have been no complaints about it that I  
know of, so I'm opting for not backpatching at present.  
  
Author: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/0b555318-2bf2-46df-9377-09629a2a59db@uni-muenster.de  

M src/backend/commands/repack.c
M src/backend/commands/vacuum.c

Add missing guard for __builtin_constant_p

commit   : 6766264262851686481dee4401541ee8cd874c2a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 5 May 2026 18:51:07 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 5 May 2026 18:51:07 +0700    

Click here for diff

Oversight in commit e2809e3a1. While at it, use pg_integer_constant_p  
in master.  
  
Discussion: https://postgr.es/m/CANWCAZbOha-x5MCreQn3TRA56VdKWNMAKMy3fAV1kJSw9Vp4pw@mail.gmail.com  
Backpatch-through: 18  

M src/include/port/pg_crc32c.h

postgres_fdw: Fix handling of abort-cleanup-failed connections.

commit   : 648818ba3876fb3e43faffea729eccba969eefab    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 5 May 2026 18:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Tue, 5 May 2026 18:55:00 +0900    

Click here for diff

As connections that failed abort cleanup can't safely be further used,  
if a remote query tries to get such a connection, we reject it.  
Previously, this rejection involved dropping the connection if it was  
open, without accounting for the possibility of open cursors using it,  
causing a server crash when such an open cursor tried to use an  
already-dropped connection, as a cursor-handling function  
(create_cursor, fetch_more_data, or close_cursor) was called on a freed  
PGconn.  To fix, delay dropping failed connections until abort cleanup  
of the main transaction, to ensure open cursors using such a connection  
can safely refer to the PGconn for it.  
  
Oversight in commit 8bf58c0d9.  
  
Reported-by: Zhibai Song <songzhibai1234@gmail.com>  
Diagnosed-by: Zhibai Song <songzhibai1234@gmail.com>  
Author: Etsuro Fujita <etsuro.fujita@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAPmGK176y6JP017-Cn%2BhS9CEJx_6iVhRoYbAqzuLU4d8-XPPNg%40mail.gmail.com  
Backpatch-through: 14  

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

doc: Clean up title case use

commit   : d0ed9ad8b07d716b1b8caae3d1eb370571a0a6f3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 11:24:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 11:24:16 +0200    

Click here for diff

M doc/src/sgml/appendix-obsolete-auth-radius.sgml
M doc/src/sgml/runtime.sgml
M doc/src/sgml/wal.sgml
M doc/src/sgml/xfunc.sgml

Message style improvements (oauth related)

commit   : 22f9207aaa37fe418055f7a1ad6e681c021f70b0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:59:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:59:49 +0200    

Click here for diff

M src/backend/libpq/auth-oauth.c
M src/interfaces/libpq-oauth/oauth-curl.c
M src/test/modules/oauth_validator/t/001_server.pl

Don't lose column values on REPACK

commit   : eb2e2eb4d4cf31808f67a3f9cee77548308a4700    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 5 May 2026 10:24:49 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 5 May 2026 10:24:49 +0200    

Click here for diff

Commit 28d534e2ae0a introduced reform_tuple() with a fast path that  
returns the source tuple verbatim when no dropped columns require fixing  
up.  I (Álvaro) failed to realize that this broke handling of columns  
with a 'missingval' defined: after a VACUUM FULL, CLUSTER, or REPACK  
operation, the catalogued missingval is thrown away, so the tuples are  
no longer correct.  
  
Fix by forcing the rewrite when the tuple is shorter than the tuple  
descriptor.  
  
Author: Satya Narlapuram <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDeoccU5CudrJpmSKZfKZ1gRMNY=5BxSC=JpHgkonzgcOw@mail.gmail.com  

M contrib/test_decoding/expected/repack.out
M contrib/test_decoding/sql/repack.sql
M src/backend/access/heap/heapam_handler.c
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Make spelling consistent

commit   : d0eac3cafb0130b6da1eff03f2fd3afc448801c8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:36:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:36:54 +0200    

Click here for diff

"vertexes" -> "vertices"  
  
Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAJTYsWXFy1j_T82%2BM_S9kFxU414tQYnZQD-b82%3DoL_LbG_5fPQ%40mail.gmail.com  

M src/backend/commands/propgraphcmds.c
M src/backend/rewrite/rewriteGraphTable.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

doc: Small synopsis wording change for consistency

commit   : 1190f858eaf2483768248ad65c04ec99864be351    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:27:32 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 5 May 2026 09:27:32 +0200    

Click here for diff

M doc/src/sgml/ref/create_property_graph.sgml

Consider collation when proving subquery uniqueness

commit   : 574581b50ac9c63dd9e4abebb731a3b67e5b50f6    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 5 May 2026 10:23:31 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 5 May 2026 10:23:31 +0900    

Click here for diff

rel_is_distinct_for()'s RTE_SUBQUERY branch passed only the equality  
operator from each join clause to query_is_distinct_for(), discarding  
the operator's input collation.  query_is_distinct_for() then verified  
opfamily compatibility but never checked collations, so a DISTINCT /  
GROUP BY / set-op operating under one collation was trusted to prove  
uniqueness for a comparison performed under an unrelated collation.  
As with the recent fix in relation_has_unique_index_for(), this is  
unsound for nondeterministic collations and yields wrong query results  
in any optimization that consumes the proof.  
  
Fix by carrying each clause's operator input collation into  
query_is_distinct_for() and validating it at every check-site against  
the subquery target expression's collation.  
  
Back-patch to all supported branches.  query_is_distinct_for() is  
declared in an installed header, so on stable branches the existing  
two-list signature is retained as a thin wrapper that forwards to a  
new collation-aware entry point; external callers continue to receive  
the historical collation-blind answer.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAMbWs4_XUUSTyzCaRjUeeahWNqi=8ZOA5Q4coi8zUVEDSBkM6A@mail.gmail.com  
Backpatch-through: 14  

M src/backend/optimizer/plan/analyzejoins.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/planmain.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/tools/pgindent/typedefs.list

Consider collation when proving uniqueness from unique indexes

commit   : 5a55ea507a2d9a3fb2d004d64a994ead2ff7cf51    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 5 May 2026 10:22:53 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 5 May 2026 10:22:53 +0900    

Click here for diff

relation_has_unique_index_for() has long had an XXX noting that it  
doesn't check collations when matching a unique index's columns  
against equality clauses.  This was benign as long as all collations  
in play reduced to the same notion of equality, but has been incorrect  
since nondeterministic collations were introduced in PG 12: a unique  
index under a deterministic collation does not prove uniqueness under  
a nondeterministic collation, nor vice versa.  
  
The consequence is wrong query results for any planner optimization  
that consumes the faulty proof, including inner-unique join execution  
(which stops the inner search after the first match per outer row),  
useless-left-join removal, semijoin-to-innerjoin reduction, and  
self-join elimination.  
  
Fix by requiring the index's collation to agree on equality with the  
clause's input collation.  Two collations agree on equality if either  
is InvalidOid (denoting a non-collation-sensitive operation, which  
cannot conflict with the other side), if they have the same OID, or if  
both are deterministic: by definition a deterministic collation treats  
two strings as equal iff they are byte-wise equal (see CREATE  
COLLATION), so any two deterministic collations share the same  
equality relation and the uniqueness proof carries over.  Any mismatch  
involving a nondeterministic collation is rejected.  
  
Back-patch to all supported branches; the bug has existed since  
nondeterministic collations were introduced in PG 12.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAMbWs4_XUUSTyzCaRjUeeahWNqi=8ZOA5Q4coi8zUVEDSBkM6A@mail.gmail.com  
Backpatch-through: 14  

M src/backend/optimizer/path/indxpath.c
M src/backend/utils/cache/lsyscache.c
M src/include/utils/lsyscache.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Declare load_hosts() as returning HostsFileLoadResult.

commit   : 93da29736649f8f7ecb0787f233a28a02a9738db    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 May 2026 18:33:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 May 2026 18:33:06 -0400    

Click here for diff

This function returns some value of enum HostsFileLoadResult,  
but for reasons lost in the development process was declared to  
return "int".  Fix that, for clarity and so that our typedefs  
collection tooling sees the typedef as used.  Also fix the  
variable that the sole call assigns into.  Move the typedef  
to the header file that declares load_hosts() to avoid creating  
header dependency problems.  
  
Discussion: https://postgr.es/m/359138.1777922557@sss.pgh.pa.us  

M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-openssl.c
M src/include/libpq/hba.h
M src/include/libpq/libpq.h

Add ORDER BY to test query to stabilize test

commit   : f6edd8ed708fe9e37742886916406ce52f2d3a84    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 20:59:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 20:59:16 +0200    

Click here for diff

for commit dc9e7c9ed93  

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

Fix off-by-one in repack index loop

commit   : b5f92b8eb4398e747cd438c259e54f8f540f778c    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 4 May 2026 20:01:19 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 4 May 2026 20:01:19 +0200    

Click here for diff

A blunder of mine (Álvaro) in commit 28d534e2ae0a.  
  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CA+3i_M9ytFufvD8Tm0rhpfxuC4XrpgQDBHxM7NJQYxv488JW7w@mail.gmail.com  

M src/backend/commands/repack.c

Handle nodes that may appear in GraphPattern expression trees

commit   : dc9e7c9ed9389c081f6dd5164b802f8b328f4baf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 17:30:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 17:30:56 +0200    

Click here for diff

expression_tree_mutator_impl() did not handle T_GraphPattern,  
T_GraphElementPattern, and T_GraphPropertyRef.  The corresponding  
expression_tree_walker_impl() already handles all three node types.  
This causes an "unrecognized node type" error whenever a GRAPH_TABLE  
appeared in an expression tree.  
  
While at it, also update raw_expression_tree_walker() and  
expression_tree_walker() to handle missing nodes that may appear in  
GraphPattern expression trees.  When raw_expression_tree_walker() is  
called, GraphElementPattern::labelexpr contains ColumnRefs instead of  
GraphLabelRefs.  Hence those are not handled in  
raw_expression_tree_walker().  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDc97WFTSkXg%3Dg_ZAH8GnY2gJrvq72cs%2BYjqEAuZgXnkAQ%40mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Do not define type for a property graph

commit   : 891a57c73945c0dcf942810f604bbd90d724b9ed    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 15:45:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 15:45:56 +0200    

Click here for diff

Even though a property graph is defined in pg_class it does not  
contain any rows by itself and need not have a type defined. Avoid  
creating a type for it.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAExHW5ucu7ZTgYkO6rB_1ShJP3e%3DGAT2T3CP4XWN8rUVEsiJoA%40mail.gmail.com  

M src/backend/catalog/heap.c
M src/include/catalog/catversion.h
M src/test/regress/expected/create_property_graph.out

Fix options listing of pg_restore --no-globals

commit   : abff4492d0246a3de9053b3cb60a7076c3800dba    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 12:00:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 12:00:22 +0200    

Click here for diff

The new pg_restore option --no-globals (commit 3c19983cc08) appeared  
out of order in the documentation and help output.  Fix that.  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_restore.c

Add missing serial commas

commit   : b83a94a73bc3488119bb2517b0c1406be8a50545    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 11:53:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 11:53:04 +0200    

Click here for diff

M src/backend/statistics/extended_stats_funcs.c
M src/backend/utils/adt/pg_dependencies.c
M src/test/regress/expected/pg_dependencies.out
M src/test/regress/expected/stats_import.out

doc: Fix up spacing around verbatim DocBook elements

commit   : 2fcc8aaeb23a387b22e7abde61b2c7943cd0a4a6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 09:45:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 May 2026 09:45:21 +0200    

Click here for diff

M doc/src/sgml/func/func-admin.sgml
M doc/src/sgml/func/func-window.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/pgplanadvice.sgml

Simplify translatable messages for tuple value details in conflict.c.

commit   : bf3ead60751488f5c65434fa7ea770a9f6031db0    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 4 May 2026 12:06:41 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 4 May 2026 12:06:41 +0530    

Click here for diff

append_tuple_value_detail() constructed user-visible messages using  
separately translated fragments such as ": ", ", ", and ".",. This  
makes correct translation difficult or impossible in some languages.  
  
Refactor append_tuple_value_detail() to move all punctuation and  
sentence construction to the callers, which now use a single  
translatable string with a %s placeholder for the tuple data.  
  
Reported-by: David Rowley <dgrowleyml@gmail.com>  
Author: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/227279.1775956328%40sss.pgh.pa.us#8f3a5f50543556c60cc5a13270cb7ba4  
Discussion: https://postgr.es/m/CAApHDvohYOdrvhVxXzCJNX_GYMSWBfjTTtB6hgDauEtZ8Nar2A@mail.gmail.com  

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

Mark modified the FSM buffer as dirty during recovery

commit   : c06d1a4ba6b26eef27b04074683cccade6c277ee    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 20:23:50 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 20:23:50 +0300    

Click here for diff

The XLogRecordPageWithFreeSpace function updates the freespace map (FSM) data  
while replaying data-level WAL records during the recovery. If the FSM block  
is updated, it needs to be marked as modified. Currently, this is done with  
the MarkBufferDirtyHint call (as in all other cases for modifying FSM data).  
However, in the recovery context, this function will actually do nothing if  
checksums are enabled. It's assumed that the page should not be dirtied  
during recovery while modifying hints to protect against torn pages, since no  
new WAL data can be generated at this point to store FPI.  
  
Such logic does not seem fully aligned with the FSM case, as its blocks could  
be simply zeroed if a checksum mismatch is detected. Currently, changes to an  
FSM block could be lost if each change to that block occurs infrequently  
enough to allow it to be evicted from the cache. To persist the change, the  
modification needs to be performed while the FSM block is still kept in  
buffers and marked as dirty after receiving its FPI. If the block has already  
been cleaned, the change won't be persisted, so stored FSM blocks may remain  
in an obsolete state.  
  
If a large number of discrepancies between the data in leaf FSM blocks and the  
actual data blocks accumulate on the replica server, this could cause  
significant delays in insert operations after switchover. Such an insert  
operation may need to visit many data blocks marked as having sufficient  
space in the FSM, only to discover that the information is incorrect and the  
FSM records need to be corrected. In a heavily trafficked insert-only table  
with many concurrent clients performing inserts, this has been observed to  
cause several-second stalls, causing visible application malfunction. The  
desire to avoid such cases was the reason behind the commit ab7dbd681, which  
introduced an update of FSM data during the heap_xlog_visible invocation.  
However, an update to the FSM data on the standby side could be lost due to a  
missing 'dirty' flag, so there is still a possibility that a large number of  
FSM records will contain incorrect data. Note that having a zeroed FSM page  
in such a case (due to a checksum mismatch) is preferable, as a zero value  
will be interpreted as an indication of full data blocks, and the inserter  
will be routed to the next FSM block or to the end of the table.  
  
Given that FSM is ready to handle torn page writes and  
XLogRecordPageWithFreeSpace is called only during the recovery, there seems  
to be no reason to use MarkBufferDirtyHint here instead of a regular  
MarkBufferDirty call.  
  
Discussion: https://postgr.es/m/596c4f1c-f966-4512-b9c9-dd8fbcaf0928%40postgrespro.ru  
Author: Alexey Makhmutov <a.makhmutov@postgrespro.ru>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/backend/storage/freespace/freespace.c

Document that WAIT FOR LSN is timeline-blind

commit   : 21d290161b11adc92a49da8e71fda69c20032618    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:20:41 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:20:41 +0300    

Click here for diff

WAIT FOR LSN compares only the numeric LSN and has no notion of which  
timeline a WAL record belongs to.  There are many possible scenarios when  
timeline-switching can break read-your-writes consistency.  The proper  
analysis and timeline support is possible in the next major release.  Yet  
just document the current behaviour.  
  
Reported-by: Xuneng Zhou <xunengzhou@gmail.com>  
Author: Alexander Korotkov <aekorotkov@gmail.com>  

M doc/src/sgml/ref/wait_for.sgml

Improve WAIT FOR LSN test coverage

commit   : cb096e6d6981e0a4b25beb46ab0cf9154971123a    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:20:16 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:20:16 +0300    

Click here for diff

Add regression coverage for several WAIT FOR LSN edge cases.  
  
First, cover fresh walreceiver shared-memory initialization after a  
standby restart.  Restart the standby while its upstream is down, so  
RequestXLogStreaming() seeds writtenUpto/flushedUpto to the  
segment-aligned receiveStart and the walreceiver cannot immediately  
advance them.  Verify that the seeded flush position is segment-aligned,  
that replay can be ahead of it, and that standby_write/standby_flush  
still succeed for an already-replayed LSN via the replay-position floor  
in GetCurrentLSNForWaitType().  
  
Second, add fencepost checks for the target <= currentLSN predicate.  
With replay paused and walreceiver stopped, verify exact boundaries for  
standby_replay using pg_last_wal_replay_lsn(), and for standby_flush  
using pg_last_wal_receive_lsn().  Also verify that a waiter for  
current + 1 sleeps while replay is paused and wakes with success once  
new WAL is delivered and replay advances.  
  
Finally, add a cascading-standby timeline-switch test.  Start a waiter  
on the downstream standby, promote its upstream, generate WAL on the new  
timeline, and verify that the cascade follows the new timeline and the  
wait completes successfully once replay reaches the target LSN.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/1957514.1775526774%40sss.pgh.pa.us  
Author: Alexander Korotkov <aekorotkov@gmail.com>  
Author: Xuneng Zhou <xunengzhou@gmail.com>  

M src/test/recovery/t/049_wait_for_lsn.pl

Wake standby_write/standby_flush waiters from the WAL replay loop

commit   : e7cd592174d94f9aea197edc5f0c6f708df27271    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:19:00 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:19:00 +0300    

Click here for diff

The startup process only woke STANDBY_REPLAY waiters after replaying  
each WAL record. STANDBY_WRITE and STANDBY_FLUSH waiters depended only  
on walreceiver write/flush callbacks. As a result, replay progress alone  
did not wake those waiters, and in pure archive recovery (where no  
walreceiver exists) they could sleep until timeout.  
  
Fix by also calling WaitLSNWakeup() for STANDBY_WRITE and  
STANDBY_FLUSH after each replay. For the replay-floor semantics used by  
GetCurrentLSNForWaitType(), replay progress is a valid lower bound for  
both modes: WAL cannot be replayed unless it has already been written  
and flushed locally.  
  
This works together with the replay-position floor in  
GetCurrentLSNForWaitType(). The getter ensures that a waiter woken by  
replay can recheck successfully; the replay-side wakeups ensure that a  
waiter already asleep is notified when replay reaches its target.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1957514.1775526774%40sss.pgh.pa.us  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/t/049_wait_for_lsn.pl

Use replay position as floor for WAIT FOR LSN standby_(write|flush)

commit   : cba67b5b87f9e7a576a99d00c0cd60f7ea529ba3    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:18:30 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:18:30 +0300    

Click here for diff

GetCurrentLSNForWaitType() for standby_write and standby_flush modes  
returned only the walreceiver position, which may lag behind WAL  
already present on the standby from a base backup, archive restore,  
or prior streaming.  This could cause unnecessary blocking if the  
target LSN falls between the walreceiver's tracked position and the  
replay position.  
  
Fix by returning the maximum of the walreceiver position and the  
replay position.  WAL up to the replay point is physically on disk  
regardless of its origin, so there is no reason to wait for the  
walreceiver to re-receive it.  
  
This complements 29e7dbf5e4d, which seeded writtenUpto to  
receiveStart in RequestXLogStreaming() to fix the most common  
hang scenario.  The getter-level floor handles the remaining edge  
cases: targets between receiveStart and the replay position, and  
standbys running with archive recovery only (no walreceiver).  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1957514.1775526774%40sss.pgh.pa.us  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M doc/src/sgml/ref/wait_for.sgml
M src/backend/access/transam/xlogwait.c
M src/test/recovery/t/049_wait_for_lsn.pl

Remove redundant WAIT FOR LSN caller-side pre-checks

commit   : df9f938ca2ec30e1018a76d80ccc77c7073d7acf    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:17:32 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:17:32 +0300    

Click here for diff

All five wakeup call sites duplicate WaitLSNWakeup()'s internal  
fast-path minWaitedLSN check and add an unnecessary NULL check  
on waitLSNState.  
  
Remove the inline pre-checks and call WaitLSNWakeup() directly.  
The fast-path check inside WaitLSNWakeup() already returns early  
when no waiter's target has been reached, so there is no  
performance difference.  
  
The waitLSNState NULL checks are also unnecessary: shared memory  
is fully initialized before any backend or auxiliary process  
starts, so waitLSNState is always non-NULL at these call sites.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/jzq5shdewncpxc35r3s2mcfsmo4bjovkza5mnqf5bdfumhfi3g%40bglckf7dxmw5  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

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

Fix memory ordering in WAIT FOR LSN wakeup mechanism

commit   : a80a593ab63696a0ad0e5c10b9e1b99aaa98032e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:16:30 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:16:30 +0300    

Click here for diff

WAIT FOR LSN uses a Dekker-style handshake: the waker stores an LSN  
position then reads minWaitedLSN; the waiter stores its target into  
minWaitedLSN then reads the position.  Without a barrier between each  
side's store and load, a CPU may satisfy the load before the store  
becomes globally visible, causing either side to miss a concurrent  
update.  The result is a missed wakeup: the waiter sleeps indefinitely  
until the next unrelated event.  
  
Fix by embedding the required barriers into the atomic operations on  
minWaitedLSN:  
  
- In updateMinWaitedLSN(), use pg_atomic_write_membarrier_u64() so the  
  waiter's preceding heap update is visible before the new minWaitedLSN  
  value is published.  
  
- In WaitLSNWakeup(), use pg_atomic_read_membarrier_u64() in the  
  fast-path check so the waker's preceding position store is globally  
  visible before minWaitedLSN is read.  
  
The waiter side is also covered by the barrier semantics already present  
in GetCurrentLSNForWaitType(): GetWalRcvWriteRecPtr() uses an explicit  
read barrier (from patch 0001), while the remaining getters acquire a  
spinlock, which implies the same ordering.  
  
Also call ResetLatch() unconditionally after WaitLatch(), following the  
standard latch loop pattern.  WaitLatch() does not guarantee that all  
simultaneously true wake conditions are reported in one return, so a  
timeout can race with SetLatch().  If we skip ResetLatch() on a timeout  
return, the code performs further asynchronous-state checks before  
consuming the latch, violating the latch API's required wait/reset  
pattern.  That can leave the latch set across loop exit and cause a  
later unrelated WaitLatch() in the same backend to return immediately.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/zqbppucpmkeqecfy4s5kscnru4tbk6khp3ozqz6ad2zijz354k%40w4bdf4z3wqoz  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

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

Use barrier semantics when reading/writing writtenUpto

commit   : dfb690dd52375517138ce1ee0f20a831d9585778    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:21:25 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 3 May 2026 16:21:25 +0300    

Click here for diff

The walreceiver publishes its write position lock-free via writtenUpto.  
On weakly-ordered architectures (ARM, PowerPC), both sides of this  
handshake need explicit barriers so that the lock-less reader sees a  
consistent state.  
  
Use pg_atomic_write_membarrier_u64() at both write sites and  
pg_atomic_read_membarrier_u64() in GetWalRcvWriteRecPtr().  This matches  
the barrier semantics that GetWalRcvFlushRecPtr() and other LSN-position  
functions get implicitly from their spinlock acquire/release, and  
protects from bugs caused by expectations of similar barrier guarantees  
from different LSN-position functions.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/zqbppucpmkeqecfy4s5kscnru4tbk6khp3ozqz6ad2zijz354k%40w4bdf4z3wqoz  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c

Add missing connection validation in ECPG

commit   : c34a280c85b39b6e875afa56542a055d2b90b640    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 1 May 2026 15:12:28 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 1 May 2026 15:12:28 -0400    

Click here for diff

ECPGdeallocate_all(), ECPGprepared_statement(), ECPGget_desc(), and  
ecpg_freeStmtCacheEntry() could crash with a SIGSEGV when called  
without an established connection (for example, when EXEC SQL CONNECT  
was forgotten or a non-existent connection name was used), because  
they dereferenced the result of ecpg_get_connection() without first  
checking it for NULL.  
  
Each site is fixed in the style of the surrounding code.  
  
New tests are added for these conditions.  
  
Author: Shruthi Gowda <gowdashru@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Mahendra Singh Thalor <mahi6run@gmail.com>  
Reviewed-by: Nishant Sharma <nishant.sharma@enterprisedb.com>  
Discussion: https://postgr.es/m/3007317.1765210195@sss.pgh.pa.us  
Backpatch-through: 14  

M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/interfaces/ecpg/test/connect/.gitignore
M src/interfaces/ecpg/test/connect/Makefile
M src/interfaces/ecpg/test/connect/meson.build
A src/interfaces/ecpg/test/connect/test6.pgc
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/connect-test6.c
A src/interfaces/ecpg/test/expected/connect-test6.stderr
A src/interfaces/ecpg/test/expected/connect-test6.stdout

Only show signal-sender PID/UID detail in server log

commit   : b772f3fcad1870731020dbe56713c616abc5dc26    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 1 May 2026 11:52:14 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 1 May 2026 11:52:14 -0400    

Click here for diff

The errdetail() added in 55890a91945 (and reworked in 3e2a1496bae)  
exposed the operating-system PID and UID of whoever sent the  
termination signal directly to the affected client.  
  
Discussion suggested this should not be sent to the client, but only  
recorded in the server log where the admin can use it for diagnosis.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Discussion: https://postgr.es/m/E5CA274C-74BD-4067-8B73-A3AD8C080EFA@gmail.com  

M src/backend/replication/syncrep.c
M src/backend/tcop/postgres.c
M src/bin/psql/t/001_basic.pl

Fix BF failure introduced in commit 2bf6c9ff71.

commit   : f67dbd8398c060362802cb559261893881c21cbe    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 1 May 2026 14:35:26 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 1 May 2026 14:35:26 +0530    

Click here for diff

The sequence subscription test switches regress_seq_sub to connect to the  
publisher as regress_seq_repl (a non-superuser) when checking behavior  
with insufficient sequence privileges but 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.  
  
Reported-by: Ajin Cherian <itsajin@gmail.com>  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/CAFPTHDad911HUMkHgD1KZk+WOvTopiBcYf4C_8Fqj1-sZk3xgw@mail.gmail.com  

M src/test/subscription/t/036_sequences.pl

doc: Mention validation attempt during ALTER INDEX .. ATTACH PARTITION

commit   : 0916282a0606fb788634738bab5b9f0bbde2aa08    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 May 2026 13:10:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 May 2026 13:10:35 +0900    

Click here for diff

Since 9d3e094f12, the command tries to validate the parent index of the  
named index, if invalid.  The documentation did not mention this  
behavior, which could be confusing.  
  
Author: Mohamed ALi <moali.pg@gmail.com>  
Discussion: https://postgr.es/m/CAGnOmWpHu25_LpT=zv7KtetQhqV1QEZzFYLd_TDyOLu1Od9fpw@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/alter_index.sgml

Avoid blocking indefinitely while finishing walsender shutdown

commit   : c0b24b32b0d3776435923d55396cc43fc657ecc5    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 1 May 2026 12:12:44 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 1 May 2026 12:12:44 +0900    

Click here for diff

When walsender finishes streaming during shutdown, it sends a  
CommandComplete message to tell the receiver that WAL streaming is done.  
Previously, that path used EndCommand() followed by pq_flush().  
  
Those functions can block indefinitely waiting for the socket to become  
writeable. As a result, even when wal_sender_shutdown_timeout is set,  
walsender could remain stuck while sending the final completion message,  
and the shutdown timeout would not be enforced.  
  
Fix this by introducing EndCommandExtended(), which allows  
CommandComplete to be queued with pq_putmessage_noblock(), and by  
using the walsender nonblocking flush path instead of pq_flush(), so  
the shutdown timeout continues to be checked while pending output is  
flushed.  
  
Per CI testing on FreeBSD.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/vwlugmsogfn36jhm56zwrgd7m6xe6ircltvfh3kzt6kldvbtht@f45dgow5uhnx  

M src/backend/replication/walsender.c
M src/backend/tcop/dest.c
M src/include/tcop/dest.h

Fix HAVING-to-WHERE pushdown with nondeterministic collations

commit   : f76686ce7f77e57456ad3644f2f6b4280181d1f4    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 1 May 2026 11:13:50 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 1 May 2026 11:13:50 +0900    

Click here for diff

When GROUP BY uses a nondeterministic collation, the planner's  
optimization of moving HAVING clauses to WHERE can produce incorrect  
query results.  The HAVING clause may apply a stricter collation that  
distinguishes values the GROUP BY considers equal.  Pushing such a  
clause to WHERE causes it to filter individual rows before grouping,  
potentially eliminating group members and changing aggregate results.  
  
Fix this by detecting collation conflicts before flatten_group_exprs,  
while the HAVING clause still contains GROUP Vars (Vars referencing  
RTE_GROUP).  At that point, each GROUP Var directly carries the GROUP  
BY collation as its varcollid, making it straightforward to compare  
against the operator's inputcollid.  A mismatch where the GROUP BY  
collation is nondeterministic means the clause is unsafe to push down.  
RowCompareExpr is treated specially, since it carries per-column  
inputcollids[] rather than a single inputcollid.  
  
The conflicting clause indices are recorded in a Bitmapset and  
consulted during the existing HAVING-to-WHERE loop, so that only  
affected clauses are kept in HAVING; other safe clauses in the same  
query are still pushed.  
  
Back-patch to v18 only.  The fix relies on the RTE_GROUP mechanism  
introduced in v18 (commit 247dea89f), which is what lets us identify  
grouping expressions and their resolved collations via GROUP Vars on  
pre-flatten havingQual.  Pre-v18 branches lack that machinery, so a  
back-patch there would need a different approach.  Given the absence  
of field reports of this bug on back branches, the risk of carrying a  
different fix on stable branches is not justified.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs48Dn2wW6XM94GZsoyMiH42=KgMo+WcobPKuWvGYnWaPOQ@mail.gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/tools/pgindent/typedefs.list

Use "concurrent delete" in serialization error for TM_Deleted cases

commit   : 410013d2a5917ee8978c944e582e323acc9ebdcf    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 1 May 2026 09:56:10 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 1 May 2026 09:56:10 +0900    

Click here for diff

In ExecLockRows() and ri_LockPKTuple(), the TM_Deleted code path was  
using the same "could not serialize access due to concurrent update"  
message as the TM_Updated path.  Use "concurrent delete" instead, since  
the tuple was deleted, not updated.  The ExecLockRows() instance was  
likely a copy-paste error per Andres; the ri_LockPKTuple() instance  
was carried over from the same pattern in commit 2da86c1ef9.  
  
Update affected isolation test expected files accordingly and add  
a new test to fk-concurrent-pk-upd.spec with concurrent delete of the  
PK row.  
  
The ExecLockRows() change is master-only for lack of user complaints  
and to avoid breaking anything that might match on the error text.  
  
Reported-by: Jian He <jian.universality@gmail.com>  
Author: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CACJufxEG1JTCq4A1gnNAu-bGAq9Xn=Xkf7kC3TRWFz6iuUOuRA@mail.gmail.com  

M src/backend/executor/nodeLockRows.c
M src/backend/utils/adt/ri_triggers.c
M src/test/isolation/expected/fk-concurrent-pk-upd.out
M src/test/isolation/expected/fk-partitioned-2.out
M src/test/isolation/expected/fk-snapshot-2.out
M src/test/isolation/expected/fk-snapshot-3.out
M src/test/isolation/specs/fk-concurrent-pk-upd.spec

Fix JSON_ARRAY(query) empty set handling and view deparsing

commit   : 8d829f5a0203ed4395e2d4d3931cd225a00c1b14    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 1 May 2026 09:42:00 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 1 May 2026 09:42:00 +0900    

Click here for diff

According to the SQL/JSON standard, JSON_ARRAY(query) must return an  
empty JSON array ('[]') when the subquery returns zero rows.  
  
Previously, the parser rewrote JSON_ARRAY(query) into a JSON_ARRAYAGG  
aggregate function.  Because this aggregate evaluates to NULL over an  
empty set without a GROUP BY clause, the constructor erroneously  
returned NULL.  Additionally, this premature rewrite baked physical  
implementation details into the catalog, preventing ruleutils.c from  
deparsing the original syntax for views.  
  
This patch resolves both issues by introducing a new  
JSCTOR_JSON_ARRAY_QUERY constructor type.  The parser builds the  
executable form --- a COALESCE-wrapped JSON_ARRAYAGG subquery --- from  
raw parse nodes via transformExprRecurse, and stores it in the func  
field.  The original transformed Query is kept in a new orig_query  
field so that ruleutils.c can deparse the original syntax for views.  
During planning, eval_const_expressions replaces the node with the  
pre-built func expression.  
  
The deparsing issue was reported by Tom Lane.  
  
Bump catalog version.  
  
Bug: #19418  
Reported-by: Lukas Eder <lukas.eder@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/19418-591ba1f29862ef5b@postgresql.org  

M doc/src/sgml/func/func-json.sgml
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/primnodes.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

REPACK CONCURRENTLY: fix processing of toasted tuples

commit   : 6ca631b9901264b97c5b165e66edd3a85847ee0b    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 28 Apr 2026 16:02:27 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 28 Apr 2026 16:02:27 +0200    

Click here for diff

In order to process tuples inserted or updated while REPACK executes, we  
write those tuples to disk and later restore them; however, some forms  
of toasted tuples were not being processed correctly.  Fix that.  
  
Also expand the tests a bit for better coverage.  
  
Author: Satya Narlapuram <satyanarlapuram@gmail.com>  
Author: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDeXb9HM2VGKXQedyCp52GzajJK5KOUdNi6oLjsS0nerQw@mail.gmail.com  

M src/backend/commands/repack.c
M src/test/modules/injection_points/expected/repack_toast.out
M src/test/modules/injection_points/specs/repack_toast.spec

Remove working test that was supposed to fail

commit   : 2fd787d0aac1cb00a42ebce92ebb1d7534035ee3    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 30 Apr 2026 22:57:24 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 30 Apr 2026 22:57:24 +0200    

Click here for diff

I evidently failed to review the expected output in commit 832e220d99af  
carefully enough.  Per complaint from Tom Lane.  
  
Discussion: https://postgr.es/m/769631.1777575242@sss.pgh.pa.us  

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

Fix attnum remapping in generateClonedExtStatsStmt()

commit   : 6cf49e804c9b4ac24046a48541810d1fed33fec3    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 30 Apr 2026 11:04:57 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 30 Apr 2026 11:04:57 -0400    

Click here for diff

When cloning extended statistics via CREATE TABLE ... LIKE ... INCLUDING  
STATISTICS, stxkeys holds attribute numbers from the source (parent)  
table, but get_attname() was being called with the child relation's  
OID.  If the parent has dropped columns, the child's attribute numbers  
are renumbered sequentially and no longer match, so the lookup either  
returns the wrong column name (silent corruption) or errors out when  
the attnum does not exist in the child.  
  
Fix it by remapping the parent attnum through attmap before the lookup,  
consistent with how expression statistics are already handled a few  
lines below.  
  
Add a regression test covering both manifestations: a 3-column parent  
where the stale attnum refers to no child column (cache-lookup error),  
and a 4-column parent where the stale attnum silently refers to the  
wrong child column.  
  
Author: Julien Tachoires <julmon@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Discussion: https://postgr.es/m/20260415105718.tomuncfbmlt67oel@poseidon.home.virt  
Backpatch-through: 14  

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

Avoid SIGSEGV in pg_get_database_ddl() on NULL tablespace

commit   : 5642a0367c2fe69684800c5d5c5929c20d99ef72    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 30 Apr 2026 10:14:52 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 30 Apr 2026 10:14:52 -0400    

Click here for diff

There is a narrow race in which a concurrent ALTER DATABASE ... SET  
TABLESPACE moves the database off the tablespace and a DROP TABLESPACE  
removes it between the syscache lookup and the catalog scan. If that  
happens, output an error.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Jack Bonatakis <jack@bonatak.is>  
Reviewed-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Discussion: https://postgr.es/m/573E45C1-31A4-4885-A00C-1A2171159A2A@gmail.com  

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

Fix data_checksum GUC show_hook

commit   : 75152c5dc5d38929ddf82f65d5c59eb5a628ab38    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:57 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:57 +0200    

Click here for diff

Commit f19c0eccae erroneously omitted the show_hook for the  
data_checksum GUC.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

M src/backend/utils/misc/guc_parameters.dat

Improve database detection logic in datachecksumsworker

commit   : 1df361e3d82c5eddccdb10f10dbaf611f752e1b9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:55 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:55 +0200    

Click here for diff

The worker need to know whether a database which failed checksum  
processing still exists, or has been dropped.  This improves the  
detection logic by checking for being partially dropped.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

M src/backend/postmaster/datachecksum_state.c

Improve handling of concurrent checksum requests

commit   : bf25e5571b325875e0e48bac2e59a820918f2d6a    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:53 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:53 +0200    

Click here for diff

When pg_{enable|disable}_data_checksums is called while checksums are  
being enabled or disabled, the already running launcher is detected  
and the new desired state is recorded.  Processing will then pick up  
the new state and change its operation to fulfill the new request.  
If the same state is requested but with different cost values, the  
new cost values will take effect on the next relation processed.  
  
The previous coding had a complex logic of starting a new launcher  
for this, which is now avoided with the shared mem structure instead  
used to signal current processing.  
  
This makes the logic more robust, and fixes a bug where the launcher  
would erroneously revert back to the "off" state.  
  
Access to the shared memory is also protected with LWLocks in all  
cases.  Since the shmem structure is used for signalling between  
the worker and the launcher, and there can be only one of each,  
there were no concurrency issues detected but it's better to stick  
to proper locking protocol should this ever be updated to handle  
multiple workers.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/datachecksum_state.c
M src/include/access/xlog.h

Typo and spelling fixups for online checksums

commit   : 381d19da1536bdbddb2f7ea1649b2f88933b8f1f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:50 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:50 +0200    

Click here for diff

A collection of spelling, wording and punctuation fixups for the code  
documentation from postcommit review.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

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

Fix invalid checksum state transition in checkpoints

commit   : 25b922ec5825e6938c28cdae718aa70b8f11fd50    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:48 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:48 +0200    

Click here for diff

Commit 78e950cb8 added checksum state handling to all XLOG_CHECKPOINT  
records which caused unnecessary state transitions and emission of  
procsignal barriers.  Remove as only the _REDO record need to handle  
checksum state.  Barrier emission is also consistently made after  
controlfile updates to avoid race conditions.  
  
Additionally, interrupts are held between calling ProcSignalInit and  
InitLocalDataChecksumState to remove a window where otherwise invalid  
state transitions can happen.  
  
Also remove a pointless assertion on Controlfile which will never hit.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/datachecksum_state.c
M src/backend/utils/init/postinit.c

Handle data_checksum state changes during launcher_exit

commit   : 8fb8ded8895620809bb71188476fbc2aec0f419d    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:46 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:46 +0200    

Click here for diff

When erroring out from the datachecksums launcher during data checksum  
enabling, before state has transitioned to "on", we revert back to the  
"off" state.  Since checksums weren't enabled, there is no use staying  
in an inprogress state since the checksum launcher currently doesn't  
support restarting from where it left off.  Should restartability get  
added in the future, this would need to be revisited.  This state  
transition was however missing from the allowed transitions in the  
statemachine causing an error.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

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

Test improvements for online checksums

commit   : a0d8f4c1ae16ca2c12e208c660f97666be809700    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:43 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:43 +0200    

Click here for diff

This includes a number of smaller fixups to the online checksums test  
module which were found during postcommit review and stabilization  
work.  
  
 * Fix scope increase for PG_TEST_EXTRA: The online checksums tests  
   have two levels of PG_TEST_EXTRA, checksum and checksums_extended  
   for extra test runs and test runs with increased randomization.  
   The logic for increasing the number of test iterations was however  
   backwards.  
 * Change stopmode for PITR test: The pitr suite used immediate stop  
   mode which caused problems on slower machines where the sigquit  
   would interrupt archive commands leaving partial WAL files behind.  
   This would then prevent restart.  Fix by using fast mode which is  
   the appropriate mode for the test at hand.  Also increase timeouts  
   to help slower test systems since an expired timeout will incur  
   the same effect as an immediate standby with a partial WAL left  
   behind.  This issue was observed when running the test suites on  
   a Raspberry Pi 4 machine.  
 * Improve logging: The test suite for data checksums use a set of  
   helper functions in a Perl module to avoid repeating code, this  
   makes sure that the helper functions do a better job of logging  
   their test output to make debug easier.  
 * Remove unused code: wait_for_cluster_crash was used during the  
   development of online checksums but was never used in any test  
   which shipped, so remove the function.  
 * Standby fixes: Ensure no vacuum on pgbench init on standby with  
   -n to avoid bogus error message in the log, and enable  
   hot_standby_feedback to prevent queries from getting cancelled  
   due to recovery on slower systems.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/9197F930-DDEB-4CAC-82A2-16FEC715CCE8@yesql.se  

M src/test/modules/test_checksums/t/007_pgbench_standby.pl
M src/test/modules/test_checksums/t/008_pitr.pl
M src/test/modules/test_checksums/t/DataChecksums/Utils.pm

Prevent pg_enable/disable_data_checksums() on standby

commit   : b120358c612dce62b493da7682b4df90a10783c9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:41 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Apr 2026 13:41:41 +0200    

Click here for diff

These functions missed a RecoveryInProgress() check, allowing them to  
be called on a hot standby.  Enabling, or disabling, checksums on the  
standby only would cause the cluster to get out of sync and replaying  
checksum transitions to fail.  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAHg+QDfRk4-S7DMmdbXJnQ-xF=sUpMAKuh8b83ObLqYVKx5QLA@mail.gmail.com  

M src/backend/postmaster/datachecksum_state.c

Fix double table_close of sequence_rel in copy_sequences().

commit   : 2bf6c9ff71c976d0a9fb6c31d6e1da02550b5278    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 30 Apr 2026 16:27:11 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 30 Apr 2026 16:27:11 +0530    

Click here for diff

sequence_rel was declared at batch scope, so when a row is skipped due to  
concurrent drop or insufficient privileges, the end-of-row cleanup closes  
the stale pointer from the previous row, tripping the relcache refcount  
assertion.  
  
Move sequence_rel inside the per-row loop.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/CAJTYsWWOuw-yfmzotV4jCJ6LLxEsb=STLcGtDYXOxRcU9Te3Pw@mail.gmail.com  

M src/backend/replication/logical/sequencesync.c
M src/test/subscription/t/036_sequences.pl

Fix errno check based on EINTR in pg_flush_data()

commit   : 5941e7f092233adb5415b2a12addea48a97a6618    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 18:44:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 18:44:38 +0900    

Click here for diff

Upon a failure of sync_file_range(), EINTR was checked based on the  
returned result of the routine rather than its errno.  sync_file_range()  
returns -1 on failure, making the check a no-op, invalidating the retry  
attempt in this case.  
  
Oversight in 0d369ac65004.  
  
Author: DaeMyung Kang <charsyam@gmail.com>  
Discussion: https://postgr.es/m/20260429151811.1810874-1-charsyam@gmail.com  
Backpatch-through: 16  

M src/backend/storage/file/fd.c

Adjust some incorrect *GetDatum() macros

commit   : ac59a90bef4527961ce205c9f890bf3ef0672c7d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 13:10:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 13:10:19 +0900    

Click here for diff

This reverts portions of commit 6dcfac9696cb, which is wrong in trying  
to use a *GetDatum() that matches with the C types of the values read.  
*GetDatum() should match with the output argument types of the SQL  
functions.  
  
The portions of 6dcfac9696cb that are right regarding this rule are:  
- gistget.c, where the GiST support functions use DatumGetUInt16() to  
retrieve the strategy number.  
- The BRIN code for strategynum, used in syscache lookups.  
  
The adjustments done in this commit are for pageinspect, pg_buffercache  
and pg_lock_status().  
  
While double-checking the whole state of the tree regarding non-matching  
pairs of DatumGet*() and *GetDatum(), I have found much more code paths  
that are incorrect, unrelated to 6dcfac9696cb.  These may be adjusted in  
the future, in a different patch (perhaps not for v19, as we are already  
past feature freeze).  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/97f9375a-be61-4272-a44d-408337fe8fa6@eisentraut.org  
Discussion: https://postgr.es/m/CAJ7c6TMcGu8qmRe1gZfJ-gOzVnZq-t=fwn-UuyStx1w6ZyydMw@mail.gmail.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/utils/adt/lockfuncs.c

Fix error of pg_stat_reset_shared()

commit   : 4bfd0f1b769eca345072ea4da646a0d46a49960c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 11:12:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 30 Apr 2026 11:12:56 +0900    

Click here for diff

"lock" a values is supported since 4019f725f5d4, but the error message  
of the function used when specifying an incorrect value forgot about it.  
  
Author: Maksim Logvinenko <logvinenko-ms@yandex.ru>  
Discussion: https://postgr.es/m/433431777389005@mail.yandex.ru  

M src/backend/utils/adt/pgstatfuncs.c
M src/test/regress/expected/stats.out

Suppress "has no symbols" linker warnings on macOS.

commit   : 3dd42ee97b812c0711b4d18e9cab069065367dca    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 29 Apr 2026 12:25:09 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 29 Apr 2026 12:25:09 -0500    

Click here for diff

After a recent macOS update, building Postgres produces warnings  
that look like this:  
  
    ranlib: warning: 'libpgport_shlib.a(pg_cpu_x86.c.o)' has no symbols  
    ranlib: warning: 'libpgport_shlib.a(pg_popcount_x86.c.o)' has no symbols  
  
To fix, add a dummy symbol to files that may otherwise have none.  
Per project policy, this is a candidate for back-patching into  
out-of-support branches: it suppresses annoying compiler warnings  
but changes no behavior.  
  
Reported-by: Zhang Mingli <zmlpostgres@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/229aaaf3-f529-44ed-8e50-00cb6909af21%40Spark  
Backpatch-through: 13  

M src/port/pg_cpu_x86.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c

test_tidstore: Stabilize regression tests by sorting offsets.

commit   : a424e31b16ba9f52f4a8a0569daf47e287198404    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 29 Apr 2026 09:10:04 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 29 Apr 2026 09:10:04 -0700    

Click here for diff

TidStoreSetBlockOffsets() requires its offsets array to be strictly  
ascending and asserts this precondition. In test_tidstore, we were  
passing random offset numbers deduplicated by a DISTINCT clause in an  
array_agg() call directly to the do_set_block_offsets() test  
harness. However, DISTINCT without an ORDER BY clause does not  
guarantee sorted results according to the SQL standard.  
  
Fix this by sorting the offsets in-place inside do_set_block_offsets()  
before calling TidStoreSetBlockOffsets().  
  
While this assertion failure is not observed during regular regression  
tests because they use queries simple enough that the optimizer  
consistently chooses plans yielding sorted results, it makes sense to  
stabilize the test. The failure could theoretically occur depending on  
the optimizer's plan choice, and has been reported when experimenting  
with certain third-party extensions.  
  
Backpatch to v17, where test_tidstore was introduced, to ensure  
extension development on stable branches does not hit this assertion.  
  
Reported-by: Andrei Lepikhov <lepihov@gmail.com>  
Author: Andrei Lepikhov <lepihov@gmail.com>  
Discussion: https://postgr.es/m/b97f1850-fc7b-43c4-9b04-4e97bb9e7dc0@gmail.com  
Backpatch-through: 17  

M src/test/modules/test_tidstore/test_tidstore.c

Fix timezone dependence in test_misc/012_ddlutils.pl

commit   : df1bac400fb4877ba9f4bda2a29adaf8b40b4bd3    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 29 Apr 2026 11:58:15 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 29 Apr 2026 11:58:15 -0400    

Click here for diff

The tests introduced in c529ee38b9e are timezone sensitive.  
  
Pin the cluster's timezone to UTC at init time so timestamptz output  
is deterministic regardless of the host's local timezone.  

M src/test/modules/test_misc/t/012_ddlutils.pl

Convert ddlutils regression tests to TAP tests.

commit   : c529ee38b9eb26527da05b85dee087676dd8fe37    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 29 Apr 2026 11:10:23 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 29 Apr 2026 11:10:23 -0400    

Click here for diff

The regression tests for pg_get_role_ddl(), pg_get_database_ddl(),  
and pg_get_tablespace_ddl() created databases and tablespaces, which  
are heavyweight operations.  As noted by Andres Freund, this is  
wasteful in the core regression suite which gets run repeatedly.  
  
Convert the three test files (role_ddl.sql, database_ddl.sql,  
tablespace_ddl.sql) into a single TAP test that runs once, covering  
all the same functionality: basic DDL generation, pretty-printing,  
option handling, error cases, permission checks, and edge cases like  
quoted names and role memberships.  
  
Discussion: https://postgr.es/m/5c67dc79-909a-4e17-8606-6686667da6c6@dunslane.net  

M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/012_ddlutils.pl
D src/test/regress/expected/database_ddl.out
D src/test/regress/expected/role_ddl.out
D src/test/regress/expected/tablespace_ddl.out
M src/test/regress/parallel_schedule
D src/test/regress/sql/database_ddl.sql
D src/test/regress/sql/role_ddl.sql
D src/test/regress/sql/tablespace_ddl.sql

Fix nbtree skip array parallel alloc accounting.

commit   : 748d871b7cb08302ef312b665bd64012f19fc16c    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 29 Apr 2026 11:22:23 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 29 Apr 2026 11:22:23 -0400    

Click here for diff

btestimateparallelscan neglected to add btps_arrElems[] space overhead  
for skip array scan keys that were later output by nbtree preprocessing.  
Skip arrays don't actually need to use this space, but a scan with a  
subsequent SAOP array will need to subscript btps_arrElems[] using a  
simple so->arrayKeys[]-wise offset.  so->arrayKeys[] has entries for  
both kinds of arrays.  
  
As a result of this oversight, it was possible for an index scan with a  
skip array and a lower-order SAOP array to write past the allocated  
shared memory boundary when storing the SAOP array's cur_elem.  In  
practice the problem seems to be limited to scans with many skipped  
index columns, since our general approach to estimating the amount of  
shared memory that will be required is fairly conservative.  
  
To fix, have btestimateparallelscan request an extra sizeof(int) space  
for key columns that might require a skip array later on.  
  
Oversight in commit 92fe23d9, which added the nbtree skip scan  
optimization.  
  
Author: Siddharth Kothari <sidkot@google.com>  
Discussion: https://postgr.es/m/CAGCUe0Lwk3C0qdkBa+OLpYc7yXwW=pbaz8Sju4xMXEQAmyp+5g@mail.gmail.com  
Backpatch-through: 18  

M src/backend/access/nbtree/nbtree.c

Cosmetic fixes for radix sort

commit   : ca9807dfec5b70751c3524de264e4a16afb2a94a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 29 Apr 2026 16:14:25 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 29 Apr 2026 16:14:25 +0700    

Click here for diff

Do minor comment fixes and remove implicit cast to Datum.  
  
While here, let's prefer crashing instead of entering an infinite  
loop in case of future programming mistakes when computing next_level,  
suggested by ChangAo Chen.  
  
Discussion: https://postgr.es/m/tencent_49E3F11E74D8A584A2144ED532A490CBC40A@qq.com  

M src/backend/utils/sort/tuplesort.c

Remove unused ByteaSortSupport.abbreviate field

commit   : a0302eac784d170497eca3184d246f945b2e3a7f    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 29 Apr 2026 13:57:07 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 29 Apr 2026 13:57:07 +0700    

Click here for diff

Oversight in commit 9303d62c6.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://postgr.es/m/CAJ7c6TOsKmmgyA6EwxKVsNeHFHrWXYdgZivgjo_ujf890BpeeA@mail.gmail.com  

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

Fix xid_advance_interval when max_retention_duration is 0.

commit   : c210647aeb17692c138014235c7e7a2d9af73b87    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 28 Apr 2026 14:51:38 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 28 Apr 2026 14:51:38 +0530    

Click here for diff

When a subscription has retain_dead_tuples enabled and maxretention is  
zero (unlimited), adjust_xid_advance_interval() mistakenly caps  
xid_advance_interval to zero.  
  
This zero interval forces get_candidate_xid() to evaluate  
TimestampDifferenceExceeds() as always true, causing the apply worker to  
call GetOldestActiveTransactionId() for every WAL message. This  
leads to unnecessary ProcArrayLock acquisitions.  
  
Fix this by only capping the interval when maxretention > 0, allowing  
the exponential back-off to function properly.  
  
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDdKVnCLHot=AcoPpEiSyDzGz7wGYjAFHVOw57oDtmUDWQ@mail.gmail.com  

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

Fix wrong datum conversion for subretentionactive in CreateSubscription.

commit   : 7424aac088e1c4356b92d2673378dbdd50d1c888    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 28 Apr 2026 12:51:25 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 28 Apr 2026 12:51:25 +0530    

Click here for diff

Use BoolGetDatum() instead of Int32GetDatum() when storing the boolean  
subretentionactive column in pg_subscription. This was an oversight in  
a850be2fe6.  
  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>  
Discussion: https://postgr.es/m/CA+3i_M98-XjE-_fw0p+8xOnw64y2_YLtJfcwvCfsVMn-z2ZjGg@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

REPACK CONCURRENTLY: Don't use deferrable primary keys

commit   : 832e220d99afa241d80cd3334eb78439719fe744    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 27 Apr 2026 18:22:03 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 27 Apr 2026 18:22:03 +0200    

Click here for diff

Similarly to logical replication, REPACK CONCURRENTLY needs to ability  
to reliably locate a tuple based on an identity.  A replica identity  
index is okay.  Primary keys normally also are, except when they are  
deferrable, because a tuple being modified might not yet be indexed,  
causing REPACK to fail.  
  
Change the REPACK CONCURRENTLY code to use GetRelationIdentityOrPK(),  
similar to what the logical replication code does.  (Though we don't yet  
support locating tuples based on arbitrary indexes for replica identity  
FULL.)  
  
While at it, add a few more test cases for situations that aren't  
supported by REPACK, to improve coverage.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Yuchen Li <liyuchen_xyz@163.com>  
Discussion: https://postgr.es/m/10DD5E13-B45D-44F1-BE08-C63E00ABCAC0@gmail.com  

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

Fix DELETE/UPDATE FOR PORTION OF with rules

commit   : 33db6c4baf17e0fdf2ac08f7d050155985c0d7e3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 27 Apr 2026 10:29:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 27 Apr 2026 10:29:21 +0200    

Click here for diff

Previously, these test cases would give internal errors or crash.  The  
fix is to add some missing fields of ForPortionOfExpr to  
expression_tree_walker.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://postgr.es/m/CACJufxHs1Hs00EqsZ4NbuAjmYzMzjJyP1sAj12Ne=cBsEVmQOA@mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/test/regress/expected/for_portion_of.out
M src/test/regress/sql/for_portion_of.sql

doc: Fix grammar in some logical replication pages

commit   : 31b9d90f15a57bca72128d512ae7ae624e6b1c93    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 27 Apr 2026 16:17:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 27 Apr 2026 16:17:04 +0900    

Click here for diff

Author: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/CAHut+PuvY_wYLPJ4DTs7NE9Lu2ty4d-OgZAOJC-NvCM=2wwcQQ@mail.gmail.com  
Backpatch-through: 14  

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

Fix bogus calls in remove_self_join_rel()

commit   : c66d6d19eb1a7bde17acaab421158be9cc94add8    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 27 Apr 2026 10:40:37 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 27 Apr 2026 10:40:37 +0900    

Click here for diff

remove_self_join_rel() called adjust_relid_set() on all_result_relids  
and leaf_result_relids but threw away the return value.  Since  
adjust_relid_set() returns a freshly-built Relids and does not modify  
the input in place, the calls did nothing.  This has been the case  
since the SJE feature went in (commit fc069a3a6).  
  
There has been no observable misbehavior, because the relid being  
passed is guaranteed not to be a member of either set.  At the point  
remove_self_join_rel() runs, those sets contain only resultRelation;  
inheritance children have not been added yet, as that happens later in  
query_planner(), in expand_single_inheritance_child() called from  
add_other_rels_to_query().  And remove_self_joins_recurse() rejects  
parse->resultRelation as an SJE candidate to preserve the EvalPlanQual  
mechanism.  Even with the result assigned, the calls would be no-ops  
in practice.  
  
Rather than make the calls do the cleanup they pretend to do, replace  
them with assertions of the invariant.  Any future loosening of the  
SJE candidate filter -- for instance to allow eliminating a result  
relation under provable conditions -- will trip the assertion and  
force whoever does it to revisit this code.  
  
Additionally, decorate adjust_relid_set() with pg_nodiscard so that  
any future accidental discard of its return value is caught at compile  
time.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49fYQcqJfJ_Gtn8r1GFNoYtb1=2AUab4ieuqY4Zid9ocQ@mail.gmail.com  

M src/backend/optimizer/plan/analyzejoins.c
M src/include/rewrite/rewriteManip.h

Fix some memory leaks in the WAL receiver

commit   : b801d5eef17fde6d1311eaefa0f125c55731e30c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 27 Apr 2026 10:32:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 27 Apr 2026 10:32:45 +0900    

Click here for diff

These are old leaks, that can pile up if a WAL receiver stays alive,  
waiting for new WAL data after the sender has switched to a new  
timeline.  
  
While this is technically a bug, the impact is minimal and would only  
become noticeable if the WAL sender handles a lot of timeline switches,  
so no backpatch is done.  Note that in most cases, primary_conninfo  
would be updated in a standby to point to a new sender, meaning a  
restart of the WAL receiver.  Let's be clean on HEAD, though.  
  
Author: DaeMyung Kang <charsyam@gmail.com>  
Discussion: https://postgr.es/m/20260426170100.847923-1-charsyam@gmail.com  
Discussion: https://postgr.es/m/20260426170219.849330-1-charsyam@gmail.com  

M src/backend/replication/walreceiver.c

Fix new test with comma in build directory.

commit   : f9c638054c5b29d519bc8530f95da8a74b47af51    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 26 Apr 2026 15:03:51 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 26 Apr 2026 15:03:51 -0700    

Click here for diff

Quote pg_hosts.conf fields derived from the build directory, since  
hba.c:next_token() treats a comma as a token separator.  Commit  
4f433025f666fa4a6209f0e847715767fb1c7ace introduced pg_hosts.conf and  
this test.  A build directory name containing a comma worked before that  
commit.  A build directory name containing a quote character has not  
worked, so don't handle that.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20260426213252.7a@rfd.leadboat.com  

M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl

Don't use INT64_FORMAT in translatable string

commit   : 7d7e58feef21e7781e8e99a960fae4d6d5a2a927    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 25 Apr 2026 20:23:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 25 Apr 2026 20:23:03 +0200    

Click here for diff

Use PRId64 instead.  

M src/bin/pg_test_timing/pg_test_timing.c

Update time zone data files to tzdata release 2026b.

commit   : f64f62f5bedaf005ab1a0f20426dd870cd142e4a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2026 12:28:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 24 Apr 2026 12:28:35 -0400    

Click here for diff

British Columbia (America/Vancouver) moved to permanent UTC-07 on  
2026-03-09, which will affect their clocks beginning on 2026-11-01.  
For lack of any clarity on the point, assume their TZ abbreviation  
will be MST from that time forward.  
  
Moldova (Europe/Chisinau) has followed EU DST transition times since  
2022.  
  
Backpatch-through: 14  

M src/timezone/data/tzdata.zi

meson: Differentiate top-level and custom targets

commit   : 3b28dad70e2fa57a973697d51242c284d475c7df    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 09:51:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 09:51:09 +0200    

Click here for diff

We need to create top-level targets to run targets with the ninja  
command like `ninja <target_name>`.  
  
Some targets (man, html, ...) have the same target name on both  
top-level and custom target.  This creates a confusion for the meson  
build:  
  
$ meson compile -C build html  
  
```  
ERROR: Can't invoke target `html`: ambiguous name. Add target type  
and/or path:  
- ./doc/src/sgml/html:custom  
- ./doc/src/sgml/html:alias  
```  
  
Solve that problem by adding '-custom' suffix to these problematic  
targets' custom target names.  Top-level targets can be called with  
both meson and ninja now:  
  
$ meson compile -C build html  
$ ninja -C build html  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Suggested-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/5508e572-79ae-4b20-84d0-010a66d077f2%40eisentraut.org  

M doc/src/sgml/meson.build

pg_get_viewdef() and lateral references in COLUMNS of GRAPH_TABLE

commit   : 9d2979dd6856e160f35544d79eb11f2c68c30985    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 09:12:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 09:12:03 +0200    

Click here for diff

Expressions in GRAPH_TABLE COLUMNS list may have lateral references.  
get_rule_expr() requires lateral namespaces to deparse such  
references.  get_from_clause_item() does not pass them when processing  
the expressions in COLUMNS list causing ERROR "bogus varlevelsup: 0  
offset 0".  Fix get_from_clause_item() to pass input deparse_context  
containing lateral namespaces to get_rule_expr() instead of the dummy  
context.  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHg%2BQDcLVa2iBnggkHxY4itZbXtDMfsYHEjnCUYe9hNbnxDi-w%40mail.gmail.com  

M src/backend/utils/adt/ruleutils.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Fix collation of expressions in GRAPH_TABLE COLUMNS clause

commit   : ac3bcc041c5cc2b7ce522d4ce6e6c4653f1263ea    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:43:26 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:43:26 +0200    

Click here for diff

GRAPH_TABLE clause is converted into a rangetable entry, which is  
ignored by assign_query_collations().  Hence we assign collations  
while transforming its parts.  But expressions in COLUMNS clause  
missed that treatment, so fix that.  
  
While at it, also add comments about collation assignment to the parts  
of GRAPH_TABLE clause, and also fix a small grammar issue.  
  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAHg+QDc4aaiufYSgrwMMPMMRTPtQ66SghcrPFbWJFZMqNaG+BA@mail.gmail.com  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_graphtable.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Fix typos and grammar in graph table rewrite code

commit   : 9082680c34e987d51f84c217e1dbd140d4a4517b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:27:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:27:04 +0200    

Click here for diff

Reported-by: Lakshmi N <lakshmin.jhs@gmail.com>  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CA+3i_M9gpUGjH-BkJk=UFjK16jq9fEQHpmZ1cxpJO+xM4hWC+A@mail.gmail.com  

M src/backend/commands/propgraphcmds.c
M src/backend/rewrite/rewriteGraphTable.c

Check for stack overflow when rewriting graph queries

commit   : 2ff289d03939498a656a0c6cf2da08623f8357b4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:18:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 24 Apr 2026 08:18:21 +0200    

Click here for diff

generate_queries_for_path_pattern_recurse() and  
generate_setop_from_pathqueries() are recursive functions.  For a  
property graph with hundreds of tables, a graph pattern with a handful  
element patterns can cause stack overflow.  Fix it by calling  
check_stack_depth() at the beginning of these functions.  
  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAHg+QDfgK0xddH8f3eAb+UVn7sBDOnv8RvM6OkP4HtHAt6aD7w@mail.gmail.com  

M src/backend/rewrite/rewriteGraphTable.c

pg_test_timing: store timing deltas in int64

commit   : 863c4b827d92879dbd526a43a23c33fa9bd23b4f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 24 Apr 2026 12:11:40 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 24 Apr 2026 12:11:40 +0900    

Click here for diff

Commit 0b096e379e6 changed pg_test_timing to measure timing  
differences in nanoseconds instead of microseconds, but the resulting  
deltas continued to be stored in int32.  
  
That can overflow for large gaps (for example, values greater than about  
2.14 seconds in nanoseconds), leading to truncation or incorrect output.  
  
This commit fixes the issue by storing measured timing deltas in int64.  
This prevents overflow for large values and better matches  
nanosecond-resolution measurements.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/F780CEEB-A237-4302-9F55-60E9D8B6533D@gmail.com  

M src/bin/pg_test_timing/pg_test_timing.c

Fix incorrect logic for hashed IN / NOT IN with non-strict operators

commit   : 94219a73f79d49c0f3576af57fa8241fbf230395    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 24 Apr 2026 14:03:12 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 24 Apr 2026 14:03:12 +1200    

Click here for diff

ExecEvalHashedScalarArrayOp(), when using a strict equality function,  
performs a short-circuit when looking up NULL values.  When the function  
is non-strict, the code incorrectly looked up the hash table for a  
zero-valued Datum, which could have resulted in an accidental true  
return if the hash table contained zero valued Datum, or could result  
in a crash for non-byval types.  
  
Here we fix this by adding an extra step when we build the hash table to  
check what the result of a NULL lookup would be.  This requires looping  
over the array and checking what the non-hashed version of the code  
would do.  We cache the results of that in the expression so that we can  
reuse the result any time we're asked to search for a NULL value.  
  
It's important to note that non-strict equality functions are free to  
treat any NULL value as equal to any non-NULL value.  For example,  
someone may wish to design a type that treats an empty string and NULL  
as equal.  
  
All built-in types have strict equality functions, so this could affect  
custom / user-defined types.  
  
Author: Chengpeng Yan <chengpeng_yan@outlook.com>  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: ChangAo Chen <cca5507@qq.com>  
Discussion: https://postgr.es/m/A16187AE-2359-4265-9F5E-71D015EC2B2D@outlook.com  
Backpatch-through: 14  

M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql

pg_test_timing: fix unit in backward-clock warning

commit   : 019cc9962bdbe2a3aaeb1f384d7a0b0d494fc311    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 24 Apr 2026 08:59:14 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 24 Apr 2026 08:59:14 +0900    

Click here for diff

pg_test_timing reports timing differences in nanoseconds in master, and  
in microseconds in v14 through v18, but previously the backward-clock  
warning incorrectly labeled the value as milliseconds.  
  
This commit fixes the warning message to use "ns" in master and  
"us" in v14 through v18, matching the actual unit being reported.  
  
Backpatch to all supported versions.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/F780CEEB-A237-4302-9F55-60E9D8B6533D@gmail.com  
Backpatch-through: 14  

M src/bin/pg_test_timing/pg_test_timing.c

Add missing source files to several nls.mk

commit   : aa27a3331abb704756b4433fecca0f41c3cd2700    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 23 Apr 2026 21:52:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 23 Apr 2026 21:52:02 +0200    

Click here for diff

M src/bin/pg_basebackup/nls.mk
M src/bin/pg_checksums/nls.mk
M src/bin/pg_combinebackup/nls.mk
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_waldump/nls.mk

Don't call CheckAttributeType() with InvalidOid on dropped cols

commit   : 713bce9484dea8bce93ec7abacd0e47ddf30dcf5    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 23 Apr 2026 21:05:27 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 23 Apr 2026 21:05:27 +0300    

Click here for diff

If CheckAttributeType() is called with InvalidOid, it performs a bunch  
of pointless, futile syscache lookups with InvalidOid, but ultimately  
tolerates it and has no effect. We were calling it with InvalidOid on  
dropped columns, but it seems accidental that it works, so let's stop  
doing it.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/93ce56cd-02a6-4db1-8224-c8999372facc@iki.fi  
Backpatch-through: 14  

M src/backend/catalog/heap.c

Don't allow composite type to be member of itself via multirange

commit   : dd4069197650d5c6d1d6385ceccc43ae2ccffc67    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 23 Apr 2026 21:28:11 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 23 Apr 2026 21:28:11 +0300    

Click here for diff

CheckAttributeType() checks that a composite type is not made a member  
of itself with ALTER TABLE ADD COLUMN or ALTER TYPE ADD ATTRIBUTE,  
even indirectly via a domain, array, another composite type or a range  
type. But it missed checking for multiranges. That was a simple  
oversight when multiranges were added.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/93ce56cd-02a6-4db1-8224-c8999372facc@iki.fi  
Backpatch-through: 14  

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

Move REPACK (CONCURRENTLY) test out of stock regression tests

commit   : 4b2aa4b39cbac71d9795ff760af3991a681eae00    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 23 Apr 2026 12:34:41 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 23 Apr 2026 12:34:41 +0200    

Click here for diff

These tests sometimes run with wal_level=minimal, which does not allow  
to run REPACK (CONCURRENTLY).  Move them to test_decoding, which is  
ensured to run with high enough wal_level.  
  
Discussion: https://postgr.es/m/260901.1776696126@sss.pgh.pa.us  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/repack.out
M contrib/test_decoding/meson.build
A contrib/test_decoding/sql/repack.sql
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

commit   : 2e1d4fdb10e6636a7ab64f801d880b4d326ab822    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 23 Apr 2026 14:10:03 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 23 Apr 2026 14:10:03 +0530    

Click here for diff

The psql describe (`\d`) footer titles were previously unintuitive when  
listing publications that included or excluded specific tables. Even  
though the tag for included publications was pre-existing, it is better  
to update it to "Included in publications:" to match the phrasing of  
the "Excluded from publications:" tag.  
  
Footer titles for sequence and schema descriptions have been updated  
similarly to maintain consistency.  
  
Reported-by: Álvaro Herrera <alvherre@kurilemu.de>  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Yuchen Li <liyuchen_xyz@163.com>  
Discussion: https://postgr.es/m/aeDs7iZUox1bbKAK%40alvherre.pgsql  

M doc/src/sgml/logical-replication.sgml
M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Avoid casting void * function arguments

commit   : 71123a5454fbb0cf7f44ef1151e32d650be4cc31    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 23 Apr 2026 08:08:57 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 23 Apr 2026 08:08:57 +0200    

Click here for diff

Like commit c3c240537f6, but for newly added code.  

M contrib/pg_trgm/trgm_op.c

Fix new-to-v19 -Wshadow warnings

commit   : 4f0cbc6fb5df6dec84482d0bf0ff2d2d4be58132    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 23 Apr 2026 16:49:29 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 23 Apr 2026 16:49:29 +1200    

Click here for diff

There's some talk about upgrading our current -Wshadow=compatible-local  
up to -Wshadow.  There's some pending questions as to whether the churn  
and extra backpatching pain are worthwhile for doing all of them.  We  
can't use the latter argument for ones that are new to v19, providing we  
fix them now.  So let's fix those ones so that the problem is not any  
worse for if we decide to fix the remainder for v20.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Yuchen Li <liyuchen_xyz@163.com>  
Discussion: https://postgr.es/m/CAApHDvp=rx5GxM=yW8QhFF3noXtYt7LkOxJ7zkaPOzpti4Gm8w@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/commands/wait.c
M src/backend/postmaster/datachecksum_state.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/describe.c

catcache.c: use C_COLLATION_OID for texteqfast/texthashfast.

commit   : dbf217c1c7c2744a18db489c255255e07cfbb110    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 22 Apr 2026 10:22:44 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 22 Apr 2026 10:22:44 -0700    

Click here for diff

The problem report was about setting GUCs in the startup packet for a  
physical replication connection. Setting the GUC required an ACL  
check, which performed a lookup on pg_parameter_acl.parname. The  
catalog cache was hardwired to use DEFAULT_COLLATION_OID for  
texteqfast() and texthashfast(), but the database default collation  
was uninitialized because it's a physical walsender and never connects  
to a database. In versions 18 and later, this resulted in a NULL  
pointer dereference, while in version 17 it resulted in an ERROR.  
  
As the comments stated, using DEFAULT_COLLATION_OID was arbitrary  
anyway: if the collation actually mattered, it should have used the  
column's actual collation. (In the catalog, some text columns are the  
default collation and some are "C".)  
  
Fix by using C_COLLATION_OID, which doesn't require any initialization  
and is always available. When any deterministic collation will do,  
it's best to consistently use the simplest and fastest one, so this is  
a good idea anyway.  
  
Another problem was raised in the thread, which this commit doesn't  
fix (see second discussion link).  
  
Reported-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/D18AD72A-5004-4EF8-AF80-10732AF677FA@yandex-team.ru  
Discussion: https://postgr.es/m/4524ed61a015d3496fc008644dcb999bb31916a7.camel%40j-davis.com  
Backpatch-through: 17  

M src/backend/utils/cache/catcache.c

pg_upgrade: Fix detection of invalid logical replication slots.

commit   : e471dc59121932d669d69d0683c71d5df3b527e3    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 22 Apr 2026 09:59:46 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 22 Apr 2026 09:59:46 -0700    

Click here for diff

Commit 7a1f0f8747a optimized the slot verification query but  
overlooked cases where all logical replication slots are already  
invalidated. In this scenario, the CTE returns no rows, causing the  
main query (which used a cross join) to return an empty result even  
when invalid slots exist.  
  
This commit fixes this by using a LEFT JOIN with the CTE, ensuring  
that slots are properly reported even if the CTE returns no rows.  
  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CA+3i_M8eT6j8_cBHkYykV-SXCxbmAxpVSKptjDVq+MFtpT-Paw@mail.gmail.com  

M src/bin/pg_upgrade/info.c

Harmonize function parameter names for Postgres 19.

commit   : d14f69a32a17924d93838491bc8e78a1a9b46807    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 22 Apr 2026 12:47:19 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 22 Apr 2026 12:47:19 -0400    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in a few places.  Most of  
these inconsistencies were introduced during Postgres 19 development.  
  
This commit was written with help from clang-tidy, by mechanically  
applying the same rules as similar clean-up commits (the earliest such  
commit was commit 035ce1fe).  

M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/sepgsql/sepgsql.h
M src/backend/access/heap/pruneheap.c
M src/backend/commands/propgraphcmds.c
M src/backend/commands/repack.c
M src/backend/parser/gram.y
M src/backend/replication/logical/conflict.c
M src/backend/replication/pgrepack/pgrepack.c
M src/backend/rewrite/rewriteGraphTable.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_upgrade/multixact_read_v18.h
M src/include/commands/repack.h
M src/include/executor/executor.h
M src/include/postmaster/datachecksum_state.h
M src/include/replication/syncrep.h
M src/include/tsearch/ts_locale.h
M src/pl/plperl/plperl.c
M src/timezone/localtime.c

Guard against overly-long numeric formatting symbols from locale.

commit   : a50777680f6678bae39ffa04d01633bd023a5f48    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 12:41:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 12:41:00 -0400    

Click here for diff

to_char() allocates its output buffer with 8 bytes per formatting  
code in the pattern.  If the locale's currency symbol, thousands  
separator, or decimal or sign symbol is more than 8 bytes long,  
in principle we could overrun the output buffer.  No such locales  
exist in the real world, so it seems sufficient to truncate the  
symbol if we do see it's too long.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/638232.1776790821@sss.pgh.pa.us  
Backpatch-through: 14  

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

Prevent some buffer overruns in spell.c's parsing of affix files.

commit   : d7970e7e951bb39b0d5d7ae633fc7f1af54aa932    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 12:02:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 12:02:15 -0400    

Click here for diff

parse_affentry() and addCompoundAffixFlagValue() each collect fields  
from an affix file into working buffers of size BUFSIZ.  They failed  
to defend against overlength fields, so that a malicious affix file  
could cause a stack smash.  BUFSIZ (typically 8K) is certainly way  
longer than any reasonable affix field, but let's fix this while  
we're closing holes in this area.  
  
I chose to do this by silently truncating the input before it can  
overrun the buffer, using logic comparable to the existing logic in  
get_nextfield().  Certainly there's at least as good an argument for  
raising an error, but for now let's follow the existing precedent.  
  
Reported-by: Igor Stepansky <igor.stepansky@orca.security>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/864123.1776810909@sss.pgh.pa.us  
Backpatch-through: 14  

M src/backend/tsearch/spell.c

Prevent buffer overrun in spell.c's CheckAffix().

commit   : 844bb90d49f78c44c6ed395d245ff8a500b16395    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 10:47:56 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 22 Apr 2026 10:47:56 -0400    

Click here for diff

This function writes into a caller-supplied buffer of length  
2 * MAXNORMLEN, which should be plenty in real-world cases.  
However a malicious affix file could supply an affix long  
enough to overrun that.  Defend by just rejecting the match  
if it would overrun the buffer.  I also inserted a check of  
the input word length against Affix->replen, just to be sure  
we won't index off the buffer, though it would be caller error  
for that not to be true.  
  
Also make the actual copying steps a bit more readable, and remove  
an unnecessary requirement for the whole input word to fit into the  
output buffer (even though it always will with the current caller).  
  
The lack of documentation in this code makes my head hurt, so  
I also reverse-engineered a basic header comment for CheckAffix.  
  
Reported-by: Xint Code  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/641711.1776792744@sss.pgh.pa.us  
Backpatch-through: 14  

M src/backend/tsearch/spell.c

Preserve extension dependencies on indexes during partition merge/split

commit   : 713e553e3213d53f4ba25dcb7a8c41994b7cab9d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 22 Apr 2026 14:32:57 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 22 Apr 2026 14:32:57 +0300    

Click here for diff

When using ALTER TABLE ... MERGE PARTITIONS or ALTER TABLE ... SPLIT  
PARTITION, extension dependencies on partition indexes were being lost.  
This happened because the new partition indexes are created fresh from  
the parent partitioned table's indexes, while the old partition indexes  
(with their extension dependencies) are dropped.  
  
Fix this by collecting extension dependencies from source partition  
indexes before detaching them, then applying those dependencies to the  
corresponding new partition indexes after they're created.  The mapping  
between old and new indexes is done via their common parent partitioned  
index.  
  
For MERGE operations, all source partition indexes sharing a parent  
partitioned index must have the same extension dependencies; if they  
differ, an error naming both conflicting partition indexes is raised.  
The check is implemented by collecting one entry per partition index,  
sorting by parent index OID, and comparing adjacent entries in a single  
pass.  This is order-independent: the same set of partitions produces  
the same decision regardless of the order they are listed in the MERGE  
command, and subset mismatches are caught in both directions.  
  
For SPLIT operations, the new partition indexes simply inherit all  
extension dependencies from the source partition's index.  
  
The regression tests exercising this feature live under  
src/test/modules/test_extensions, where the test_ext3 and test_ext5  
extensions are available; core regression tests cannot assume any  
particular extension is installed.  
  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reported-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Dmitry Koval <d.koval@postgrespro.ru>  
Discussion: https://www.postgresql.org/message-id/CALdSSPjXtzGM7Uk4fWRwRMXcCczge5uNirPQcYCHKPAWPkp9iQ%40mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/test/modules/test_extensions/expected/test_extdepend.out
M src/test/modules/test_extensions/sql/test_extdepend.sql
M src/tools/pgindent/typedefs.list

Fix UPDATE/DELETE ... WHERE CURRENT OF on a table with virtual columns.

commit   : 5548a969b65d4e0d5045d9db0bcac062a9a3e3c7    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 22 Apr 2026 11:50:17 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 22 Apr 2026 11:50:17 +0100    

Click here for diff

Formerly, attempting to use WHERE CURRENT OF to update or delete from  
a table with virtual generated columns would fail with the error  
"WHERE CURRENT OF on a view is not implemented".  
  
The reason was that the check preventing WHERE CURRENT OF from being  
used on a view was in replace_rte_variables_mutator(), which presumed  
that the only way it could get there was as part of rewriting a query  
on a view. That is no longer the case, since replace_rte_variables()  
is now also used to expand the virtual generated columns of a table.  
  
Fix by doing the check for WHERE CURRENT OF on a view at parse time.  
This is safe, since it is no longer possible for the relkind to change  
after the query is parsed (as of b23cd185f).  
  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDc_TwzSgb=B_QgNLt3mvZdmRK23rLb+RkanSQkDF40GjA@mail.gmail.com  
Backpatch-through: 18  

M src/backend/parser/analyze.c
M src/backend/rewrite/rewriteManip.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/portals.out
M src/test/regress/sql/generated_virtual.sql
M src/test/regress/sql/portals.sql

Fix expansion of EXCLUDED virtual generated columns.

commit   : 783425175809c91f702dec72b0d52cab7692f1a9    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 22 Apr 2026 09:03:44 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 22 Apr 2026 09:03:44 +0100    

Click here for diff

If the SET or WHERE clause of an INSERT ... ON CONFLICT command  
references EXCLUDED.col, where col is a virtual generated column, the  
column was not properly expanded, leading to an "unexpected virtual  
generated column reference" error, or incorrect results.  
  
The problem was that expand_virtual_generated_columns() would expand  
virtual generated columns in both the SET and WHERE clauses and in the  
targetlist of the EXCLUDED pseudo-relation (exclRelTlist). Then  
fix_join_expr() from set_plan_refs() would turn the expanded  
expressions in the SET and WHERE clauses back into Vars, because they  
would be found to match the expression entries in the indexed tlist  
produced from exclRelTlist.  
  
To fix this, arrange for expand_virtual_generated_columns() to not  
expand virtual generated columns in exclRelTlist. This forces  
set_plan_refs() to resolve generation expressions in the query using  
non-virtual columns, as required by the executor.  
  
In addition, exclRelTlist now always contains only Vars. That was  
something already claimed in a couple of existing comments in the  
planner, which relied on that fact to skip some processing, though  
those did not appear to constitute active bugs.  
  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDf7wTLz_vqb1wi1EJ_4Uh+Vxm75+b4c-Ky=6P+yOAHjbQ@mail.gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_virtual.sql

Fix some const qualifier use in ri_triggers.c

commit   : 1b9dc2cb75745329fc133953a6e86f17ff472d36    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Wed, 22 Apr 2026 09:33:10 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Wed, 22 Apr 2026 09:33:10 +0900    

Click here for diff

The ri_FetchConstraintInfo() and ri_LoadConstraintInfo() functions  
were declared to return const RI_ConstraintInfo *, but callers  
sometimes need to modify the struct, requiring casts to drop the  
const.  Remove the misapplied const qualifiers and the casts that  
worked around them.  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Author: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/548600ed-8bbb-4e50-8fc3-65091b122276@eisentraut.org  

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

Allow ALTER INDEX .. ATTACH PARTITION to validate a parent index

commit   : 9d3e094f12cce57a477c3df92f411b2fae816b60    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 22 Apr 2026 10:32:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 22 Apr 2026 10:32:10 +0900    

Click here for diff

This commit tweaks ALTER INDEX .. ATTACH PARTITION to attempt a  
validation of a parent index in the case where an index is already  
attached but the parent is not yet valid.  This occurs in cases where a  
parent index was created invalid such as with CREATE INDEX ONLY, but was  
left invalid after an invalid child index was attached (partitioned  
indexes set indisvalid to false if at least one partition is  
!indisvalid, indisvalid is true in a partitioned table iff all  
partitions are indisvalid).  This could leave a partition tree in a  
situation where a user could not bring the parent index back to valid  
after fixing the child index, as there is no built-in mechanism to do  
so.  This commit relies on the fact that repeated ATTACH PARTITION  
commands on the same index silently succeed.  
  
An invalid parent index is more than just a passive issue.  It causes  
for example ON CONFLICT on a partitioned table if the invalid parent  
index is used to enforce a unique constraint.  
  
Some test cases are added to track some of problematic patterns, using a  
set of partition trees with combinations of invalid indexes and ATTACH  
PARTITION.  
  
Reported-by: Mohamed Ali <moali.pg@gmail.com>  
Author: Sami Imseih <sanmimseih@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Discussion: http://postgr.es/m/CAGnOmWqi1D9ycBgUeOGf6mOCd2Dcf=6sKhbf4sHLs5xAcKVCMQ@mail.gmail.com  
Backpatch-through: 14  

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

Fix not-quite-right Makefile for src/test/modules/test_checksums.

commit   : 64b2b4212486406771089aff7ba015c650334f66    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 18:29:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 18:29:24 -0400    

Click here for diff

This neglected to set TAP_TESTS = 1, and partially compensated  
for that by writing duplicative hand-made rules for check and  
installcheck.  That's not really sufficient though.  The way  
I noticed the error was that "make distclean" didn't clean out  
the tmp_check subdirectory, and there might be other consequences.  
Do it the standard way instead.  

M src/test/modules/test_checksums/Makefile

bufmgr: use I/O stats arguments in FlushUnlockedBuffer()

commit   : 31b0544b32bc9e08c8c6775aed7ca2b808390f80    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 17:47:22 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 17:47:22 -0400    

Click here for diff

FlushUnlockedBuffer() accepted io_object and io_context arguments but  
hardcoded IOOBJECT_RELATION and IOCONTEXT_NORMAL when calling  
FlushBuffer(). Pass them through instead. Also fix FlushBuffer() to use  
its io_object parameter for I/O timing stats rather than hardcoding  
IOOBJECT_RELATION.  
  
Not actively broken since all current callers pass IOOBJECT_RELATION and  
IOCONTEXT_NORMAL, so not backpatched.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/BC97546F-5C15-42F2-AD57-CFACDB9657D0@gmail.com  

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

Stabilize btree_gist test against on-access VM setting

commit   : 62407d26b7c9e619ed696fced88fdacc5d1ae522    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 17:32:45 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 17:32:45 -0400    

Click here for diff

The btree_gist enum test expects a bitmap heap scan. Since b46e1e54d07  
enabled setting the VM during on-access pruning and 378a21618 set  
pd_prune_xid on INSERT, scans of enumtmp may set pages all-visible.  
If autovacuum or autoanalyze then updates pg_class.relallvisible, the  
planner could choose an index-only scan instead.  
  
Make the enumtmp a temp table to exclude it from autovacuum/autoanalyze.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/46733d68-aec0-4d09-8120-4c66b87047a4%40gmail.com  

M contrib/btree_gist/expected/enum.out
M contrib/btree_gist/sql/enum.sql

Stabilize plancache test against on-access VM setting

commit   : 85ae8ab05334f335e3b97d4a4b6309f926eda39c    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 14:36:59 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 14:36:59 -0400    

Click here for diff

Since b46e1e54d07 allowed setting the VM on-access and 378a21618 set  
pd_prune_xid on INSERT, the testing of generic/custom plans in  
src/test/regress/sql/plancache.sql was destabilized.  
  
One of the queries of test_mode could have set the pages all-visible and  
if autovacuum/autoanalyze ran and updated pg_class.relallvisible, it  
would affect whether we got an index-only or sequential scan.  
  
Preclude this by disabling autovacuum and autoanalyze for test_mode and  
carefully sequencing when ANALYZE is run.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/71277259-264e-4983-a201-938b404049d7%40gmail.com  

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

Make local buffers pin limit more conservative

commit   : da6874635db2e8ab95150481c992f03ec6094805    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 11:01:57 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 21 Apr 2026 11:01:57 -0400    

Click here for diff

GetLocalPinLimit() and GetAdditionalLocalPinLimit(), currently in use  
only by the read stream, previously allowed a backend to pin all  
num_temp_buffers local buffers. This meant that the read stream could  
use every available local buffer for read-ahead, leaving none for other  
concurrent pin-holders like other read streams and related buffers like  
the visibility map buffer needed during on-access pruning.  
  
This became more noticeable since b46e1e54d07, which allows on-access  
pruning to set the visibility map, which meant that some scans also  
needed to pin a page of the VM. It caused a test in  
src/test/regress/sql/temp.sql to fail in some cases.  
  
Cap the local pin limit to num_temp_buffers / 4, providing some  
headroom. This doesn't guarantee that all needed pins will be available  
— for example, a backend can still open more cursors than there are  
buffers — but it makes it less likely that read-ahead will exhaust the  
pool.  
  
Note that these functions are not limited by definition to use in the  
read stream; however, this cap should be appropriate in other contexts.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/97529f5a-ec10-46b1-ab50-4653126c6889%40gmail.com  

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

Remove gen_node_support.pl's ad-hoc ABI stability check.

commit   : 1cd3cd372ae497f3134126edc96aa56352e7f4a0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 10:58:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 10:58:00 -0400    

Click here for diff

We installed this in commit eea9fa9b2 to protect against foreseeable  
mistakes that would break ABI in stable branches by renumbering  
NodeTag enum entries.  However, we now have much more thorough  
ABI stability checks thanks to buildfarm members using libabigail  
(see the .abi-compliance-history mechanism).  So this incomplete,  
single-purpose check seems like an anachronism.  I wouldn't object  
to keeping it were it not that it requires an additional manual step  
when making a new stable git branch.  That seems like something easy  
to screw up, so let's get rid of it.  
  
This patch just removes the logic that checks for changes in the last  
auto-assigned NodeTag value.  We still need eea9fa9b2's cross-check  
on the supplied list of header files, to prevent divergence between  
the makefile and meson build systems.  We'll also sometimes need the  
nodetag_number() infrastructure for hand-assigning new NodeTags in  
stable branches.  
  
Discussion: https://postgr.es/m/1458883.1776143073@sss.pgh.pa.us  

M src/backend/nodes/gen_node_support.pl
M src/tools/RELEASE_CHANGES

Make plpgsql_trap test more robust and less resource-intensive.

commit   : 81c082f51ad8834d28fdfc83b1fbe67ec4e51246    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 10:54:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 21 Apr 2026 10:54:39 -0400    

Click here for diff

We were using "select count(*) into x from generate_series(1,  
1_000_000_000_000)" to waste one second waiting for a statement  
timeout trap.  Aside from consuming CPU to little purpose, this could  
easily eat several hundred MB of temporary file space, which has been  
observed to cause out-of-disk-space errors in the buildfarm.  
Let's just use "pg_sleep(10)", which is far less resource-intensive.  
  
Also update the "when others" exception handler so that if it does  
ever again trap an error, it will tell us what error.  The cause of  
these intermittent buildfarm failures had been obscure for awhile.  
  
Discussion: https://postgr.es/m/557992.1776779694@sss.pgh.pa.us  
Backpatch-through: 14  

M src/pl/plpgsql/src/expected/plpgsql_trap.out
M src/pl/plpgsql/src/sql/plpgsql_trap.sql

Fix a set of typos and grammar issues across the tree

commit   : d3bba041543593eb5341683107d899734dc8e73e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Apr 2026 14:46:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Apr 2026 14:46:22 +0900    

Click here for diff

This batch is similar to 462fe0ff6215 and addresses a variety of code  
style issues, including grammar mistakes, typos, inconsistent variable  
names in function declarations, and incorrect function names in comments  
and documentation.  These fixes have accumulated on the community  
mailing lists since the commit mentioned above.  
  
Notably, Alexander Lakhin previously submitted a patch identifying many  
of the trivial typos and grammar issues that had been reported on  
pgsql-hackers.  His patch covered a somewhat large portion of the issues  
addressed here, though not all of them.  
  
The documentation changes only affect HEAD.  

M contrib/btree_gist/btree_utils_var.h
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_plan_advice/pgpa_ast.c
M contrib/pg_plan_advice/pgpa_ast.h
M contrib/pg_plan_advice/pgpa_identifier.c
M contrib/pg_plan_advice/pgpa_join.c
M contrib/pg_plan_advice/pgpa_output.c
M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_stash_advice/stashfuncs.c
M contrib/pg_stash_advice/stashpersist.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/pgstashadvice.sgml
M doc/src/sgml/ref/alter_property_graph.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/release-19.sgml
M src/backend/access/common/indextuple.c
M src/backend/access/common/tidstore.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/explain_state.c
M src/backend/commands/repack.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeModifyTable.c
M src/backend/lib/hyperloglog.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/optimizer/path/indxpath.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_graphtable.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/datachecksum_state.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteGraphTable.c
M src/backend/statistics/extended_stats_funcs.c
M src/backend/storage/aio/method_worker.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/error/elog.c
M src/bin/pg_combinebackup/t/011_ib_truncation.pl
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/common/wchar.c
M src/include/access/tableam.h
M src/include/postmaster/datachecksum_state.h
M src/interfaces/libpq/fe-protocol3.c
M src/test/modules/test_checksums/t/003_standby_restarts.pl
M src/test/modules/test_checksums/t/005_injection.pl
M src/test/modules/test_checksums/test_checksums.c
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql
M src/tools/pg_bsd_indent/indent.c
M src/tools/pg_bsd_indent/io.c
M src/tools/pg_bsd_indent/pr_comment.c

Fix incorrect NEW references to generated columns in rule rewriting

commit   : c6a79be3f3c78a1ab2b4ae8842451c72e0a8e6f3    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 21 Apr 2026 14:28:26 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 21 Apr 2026 14:28:26 +0900    

Click here for diff

When a rule action or rule qualification references NEW.col where col  
is a generated column (stored or virtual), the rewriter produces  
incorrect results.  
  
rewriteTargetListIU removes generated columns from the query's target  
list, since stored generated columns are recomputed by the executor  
and virtual ones store nothing.  However, ReplaceVarsFromTargetList  
then cannot find these columns when resolving NEW references during  
rule rewriting.  For UPDATE, the REPLACEVARS_CHANGE_VARNO fallback  
redirects NEW.col to the original target relation, making it read the  
pre-update value (same as OLD.col).  For INSERT,  
REPLACEVARS_SUBSTITUTE_NULL replaces it with NULL.  Both are wrong  
when the generated column depends on columns being modified.  
  
Fix by building target list entries for generated columns from their  
generation expressions, pre-resolving the NEW.attribute references  
within those expressions against the query's targetlist, and passing  
them together with the query's targetlist to ReplaceVarsFromTargetList.  
  
Back-patch to all supported branches.  Virtual generated columns were  
added in v18, so the back-patches in pre-v18 branches only handle  
stored generated columns.  
  
Reported-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDexGTmCZzx=73gXkY2ZADS6LRhpnU+-8Y_QmrdTS6yUhA@mail.gmail.com  
Backpatch-through: 14  

M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql

Fix orphaned processes when startup process fails during PM_STARTUP

commit   : 9b43e6793b0f9dcd2c3935af020cf96cd7b05ec2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Apr 2026 09:39:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 21 Apr 2026 09:39:59 +0900    

Click here for diff

When the startup process exists with a FATAL error during PM_STARTUP,  
the postmaster called ExitPostmaster() directly, assuming that no other  
processes are running at this stage.  Since 7ff23c6d277d, this  
assumption is not true, as the checkpointer, the background writer, the  
IO workers and bgworkers kicking in early would be around.  
  
This commit removes the startup-specific shortcut happening in  
process_pm_child_exit() for a failing startup process during PM_STARTUP,  
falling down to the existing exit() flow to signal all the started  
children with SIGQUIT, so as we have no risk of creating orphaned  
processes.  
  
This required an extra change in HandleFatalError() for v18 and newer  
versions, as an assertion could be triggered for PM_STARTUP.  It is now  
incorrect.  In v17 and older versions, HandleChildCrash() needs to be  
changed to handle PM_STARTUP so as children can be waited on.  
  
While on it, fix a comment at the top of postmaster.c.  It was claiming  
that the checkpointer and the background writer were started after  
PM_RECOVERY.  That is not the case.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAJTYsWVoD3V9yhhqSae1_wqcnTdpFY-hDT7dPm5005ZFsL_bpA@mail.gmail.com  
Backpatch-through: 15  

M src/backend/postmaster/postmaster.c

doc: Use "integer" for some I/O worker GUC type descriptions

commit   : 8155581ec695095711a5abd903a95236fbdfb823    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:50:10 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:50:10 +0900    

Click here for diff

The documentation previously described the io_max_workers,  
io_worker_idle_timeout, and io_worker_launch_interval GUCs as  
type "int". However, the documentation consistently uses "integer"  
for parameters of this type.  
  
This commit updates these parameter descriptions to use "integer"  
for consistency.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAHGQGwEpMDpB-K8SSUVRRHg6L6z3pLAkekd9aviOS=ns0EC=+Q@mail.gmail.com  

M doc/src/sgml/config.sgml

doc: Correct context description for some JIT support GUCs

commit   : 524cbb515549b82d7d9458be6d81c945af2bc1e2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:44:19 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:44:19 +0900    

Click here for diff

The documentation for jit_debugging_support and jit_profiling_support  
previously stated that these parameters can only be set at server start.  
  
However, both parameters use the PGC_SU_BACKEND context, meaning they  
can be set at session start by superusers or users granted the appropriate  
SET privilege, but cannot be changed within an active session.  
  
This commit updates the documentation to reflect the actual behavior.  
  
Backpatch to all supported versions.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAHGQGwEpMDpB-K8SSUVRRHg6L6z3pLAkekd9aviOS=ns0EC=+Q@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/config.sgml

plsample: Use TextDatumGetCString() for text-to-CString conversion

commit   : f1cfb48efb086f99f6995f5d4b8a7c3ee289d1f0    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:37:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 21 Apr 2026 08:37:17 +0900    

Click here for diff

Replace the outdated DatumGetCString(DirectFunctionCall1(textout, ...))  
pattern with TextDatumGetCString(). The macro is the modern, more  
efficient way to convert a text Datum to a C string as it avoids  
unnecessary function call machinery and handles detoasting internally.  
  
Since plsample serves as reference code for extension authors, it  
should follow current idiomatic practices.  
  
Author: Amul Sul <sulamul@gmail.com>  
Discussion: https://postgr.es/m/CAAJ_b95-xMvUN1PEqxv8y6g-A-8k+fSgyv20kSZc9eF1wZAUPg@mail.gmail.com  

M src/test/modules/plsample/plsample.c

Fix relid-set clobber during join removal.

commit   : f0ac6d494b56b83cf49d328ee0c5dd20df937fce    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 19:24:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 19:24:46 -0400    

Click here for diff

Commit cfcd57111 et al fell over under Valgrind testing.  
(It seems to be enough to #define USE_VALGRIND, you don't actually  
need to run it under Valgrind to see failures.)  The cause is that  
remove_rel_from_eclass updates each EquivalenceMember's em_relids,  
and those can be aliases of the left_relids or right_relids of some  
RestrictInfo in ec_sources.  If the update made em_relids empty then  
bms_del_member will have pfree'd the relid set, so that the subsequent  
attempt to clean up ec_sources accesses already-freed memory.  
  
We missed seeing ill effects before cfcd57111 because (a) if the  
pfree happens then we will remove the EquivalenceMember altogether,  
making the source RestrictInfo no longer of use, and (b) the  
cleanup of ec_sources didn't touch left/right_relids before that.  
  
I'm unclear though on how cfcd57111 managed to pass non-USE_VALGRIND  
testing.  Apparently we managed to store another Bitmapset into the  
freed space before trying to access it, but you'd not think that would  
happen 100% of the time.  I think what USE_VALGRIND changes is that it  
makes list.c much more memory-hungry, so that the freed space gets  
claimed by some List node before a Bitmapset can be put there.  
  
This failure can be seen in v16, v17, and master, but oddly enough not  
v18.  That's because the SJE patch replaced the simple bms_del_members  
calls used here with adjust_relid_set, which is careful not to  
scribble on its input.  But commit 20efbdffe just recently put back  
the old coding and thus resurrected the problem.  
  
Discussion: https://postgr.es/m/458729.1776724816@sss.pgh.pa.us  
Backpatch-through: 16, 17, master  

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

Fix callers of unicode_strtitle() using srclen == -1.

commit   : bdcb85b56ac4e0594e3c3402545a4c87712ce461    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 20 Apr 2026 14:44:08 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 20 Apr 2026 14:44:08 -0700    

Click here for diff

Currently, only called that way in tests, which failed to fail.  
  
Discussion: https://postgr.es/m/581a72ff452bb045ba83bbe3c6cf4467702d4f0f.camel@j-davis.com  
Backpatch-through: 18  

M src/backend/utils/adt/pg_locale_builtin.c
M src/common/unicode/case_test.c

style: define parameterless functions as foo(void).

commit   : 59919ec7761fbe0d1592ca73cde1715aee60706e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 20 Apr 2026 14:42:54 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 20 Apr 2026 14:42:54 -0700    

Click here for diff

Avoids warning in 'update-unicode' build target. Similar to  
11171fe1fc.  
  
Discussion: https://postgr.es/m/581a72ff452bb045ba83bbe3c6cf4467702d4f0f.camel@j-davis.com  

M src/common/unicode/case_test.c
M src/common/unicode/category_test.c

doc: Fix missing role attribute in pg_get_tablespace_ddl() description.

commit   : 79fba6ebaba4f6cd46fd80b55c891bb2ba734119    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 20 Apr 2026 13:31:13 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 20 Apr 2026 13:31:13 -0700    

Click here for diff

The second function signature entry for pg_get_tablespace_ddl() was  
missing the role="func_signature" attribute. This commit adds the  
missing attribute to ensure consistent formatting with other function  
entries.  
  
Author: Tatsuya Kawata <kawatatatsuya0913@gmail.com>  
Discussion: https://postgr.es/m/CAHza6qcSgwdh+f41zEm6NSaGHvs5_cwjVu22+KTic=TfnonrFA@mail.gmail.com  

M doc/src/sgml/func/func-info.sgml

Clean up all relid fields of RestrictInfos during join removal.

commit   : cfcd5711160a42249def8f781bae197829cf44c7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 14:48:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 14:48:23 -0400    

Click here for diff

The original implementation of remove_rel_from_restrictinfo()  
thought it could skate by with removing no-longer-valid relid  
bits from only the clause_relids and required_relids fields.  
This is quite bogus, although somehow we had not run across a  
counterexample before now.  At minimum, the left_relids and  
right_relids fields need to be fixed because they will be  
examined later by clause_sides_match_join().  But it seems  
pretty foolish not to fix all the relid fields, so do that.  
  
This needs to be back-patched as far as v16, because the  
bug report shows a planner failure that does not occur  
before v16.  I'm a little nervous about back-patching,  
because this could cause unexpected plan changes due to  
opening up join possibilities that were rejected before.  
But it's hard to argue that this isn't a regression.  Also,  
the fact that this changes no existing regression test results  
suggests that the scope of changes may be fairly narrow.  
I'll refrain from back-patching further though, since no  
adverse effects have been demonstrated in older branches.  
  
Bug: #19460  
Reported-by: François Jehl <francois.jehl@pigment.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/19460-5625143cef66012f@postgresql.org  
Backpatch-through: 16  

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

Make ExecForPortionOfLeftovers() obey SRF protocol.

commit   : 207cb2abcba00f78d57cdaca896f41c9453b0f2f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 10:21:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 20 Apr 2026 10:21:52 -0400    

Click here for diff

Before each call to the SRF, initialize isnull and isDone, as per the  
comments for struct ReturnSetInfo.  This fixes a Coverity warning  
about rsi.isDone not being initialized.  The built-in  
{multi,}range_minus_multi functions don't return without setting it,  
but a user-supplied function might not be as accommodating.  
  
We also add statistics tracking around the function call, which  
will be expected once user-defined withoutPortionProcs functions  
are supported, and a cross-check on rsi.returnMode just for  
paranoia's sake.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Co-authored-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://postgr.es/m/4126231.1776622202@sss.pgh.pa.us  

M src/backend/executor/nodeModifyTable.c

REPACK: do not require REPLICATION or LOGIN

commit   : 5dbb63fc82b72ccc6f9e7be0361efdeee5deeb50    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 20 Apr 2026 15:44:23 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 20 Apr 2026 15:44:23 +0200    

Click here for diff

Although REPACK (CONCURRENTLY) uses replication slots, there is no  
concern that the slot will leak data of other users, because the  
MAINTAIN privilege on the table is required anyway; requiring  
REPLICATION is user-unfriendly without providing any actual protection.  
  
A related aspect is that the REPLICATION attribute is not needed to  
prevent REPACK from stealing slots from logical replication, since  
commit e76d8c749c31 made REPACK use a separate pool of replication  
slots.  
  
Similarly, there's no reason to require that the table owner has the  
LOGIN privilege.  Bypass the default behavior in the background worker  
launch sequence.  
  
Because there are now successful concurrent repack runs in the  
regression tests, we're forced to run test_plan_advice under  
wal_level=replica, so add that.  Also, move the cluster.sql test to a  
different parallel group in parallel_schedule: apparently the use of the  
repack worker causes it to exceed the maximum limit of processes in some  
runs (the actual limit reached is the number of XIDs in a snapshot's xip  
array).  
  
Author: Antonin Houska <ah@cybertec.at>  
Reported-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Chao Li <lic@highgo.com>  
Discussion: https://postgr.es/m/aeJHPNmL4vVy3oPw@pryzbyj2023  

M src/backend/commands/repack_worker.c
M src/test/modules/test_plan_advice/t/001_replan_regress.pl
M src/test/regress/expected/cluster.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/cluster.sql

doc PG 19 relnotes: fix typo, "date" -> "data"

commit   : 158d8fadd79f90935cb9bc1ae0bec366cbf09f42    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 20 Apr 2026 07:15:06 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 20 Apr 2026 07:15:06 -0400    

Click here for diff

Reported-by: shammat@gmx.net  
  
Discussion: https://postgr.es/m/c0d3dfe1-d3e1-45ff-bcdd-40ded5d37ada@gmx.net  

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

049_wait_for_lsn.pl: create function and procedure at once

commit   : 23cbadeeb4738b8f5e615f0c5a2ef7af6111d512    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 20 Apr 2026 13:05:55 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 20 Apr 2026 13:05:55 +0300    

Click here for diff

Create the PL/pgSQL function and procedure for the top-level WAIT FOR  
checks in a single transaction, then wait once for standby replay before  
running both tests.  Also revise some surrounding comments.  
  
This avoids an extra 'wait_for_catchup()' on the delayed standby without  
changing the test coverage.  
  
Discussion: https://postgr.es/m/CABPTF7WZ1yuYz8V%3Dxsbghg8e7qaAm5MpyNw6BthWcbN7%2BP6biw%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/test/recovery/t/049_wait_for_lsn.pl

Clean up remove_rel_from_query() after self-join elimination commit

commit   : 20efbdffeb6418afa13d6c8457054735d11c7e3a    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 20 Apr 2026 17:00:22 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 20 Apr 2026 17:00:22 +0900    

Click here for diff

The self-join elimination (SJE) commit grafted self-join removal onto  
remove_rel_from_query(), which was originally written for left-join  
removal only.  This resulted in several issues:  
  
- Comments throughout remove_rel_from_query() still assumed only  
  left-join removal, making the code misleading.  
  
- ChangeVarNodesExtended was called on phv->phexpr with subst=-1  
  during left-join removal, which is pointless and confusing since any  
  surviving PHV shouldn't reference the removed rel.  
  
- phinfo->ph_lateral was adjusted for left-join removal, which is  
  unnecessary since the removed relid cannot appear in ph_lateral for  
  outer joins.  
  
- The comment about attr_needed reconstruction was in  
  remove_rel_from_query(), but the actual rebuild is performed by the  
  callers.  
  
- EquivalenceClass processing in remove_rel_from_query() is redundant  
  for self-join removal, since the caller (remove_self_join_rel)  
  already handles ECs via update_eclasses().  
  
- In remove_self_join_rel(), ChangeVarNodesExtended was called on  
  root->processed_groupClause, which contains SortGroupClause nodes  
  that have no Var nodes to rewrite.  The accompanying comment  
  incorrectly mentioned "HAVING clause".  
  
This patch fixes all these issues, clarifying the separation between  
left-join removal and self-join elimination code paths within  
remove_rel_from_query().  The resulting code is also better structured  
for adding new types of join removal (such as inner-join removal) in  
the future.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs48JC4OVqE=3gMB6se2WmRNNfMyFyYxm-09vgpm+Vwe8Hg@mail.gmail.com  

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

Add missing Datum conversions

commit   : 04f9ea372a20c0346ad6d78de348543375761aaa    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 Apr 2026 07:22:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 Apr 2026 07:22:16 +0200    

Click here for diff

Similar to commit ff89e182d42, for new code added since.  

M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/datachecksum_state.c
M src/backend/utils/cache/lsyscache.c

Fix incorrect format placeholders

commit   : 5936afe1ee83aea739163edf30349b63bc620c0a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 Apr 2026 07:09:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 20 Apr 2026 07:09:13 +0200    

Click here for diff

M src/backend/storage/ipc/shmem.c
M src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/pg_waldump.c

Flush statistics during idle periods in parallel apply worker.

commit   : 090c4297e40977bc35e59faeb0a003561a4a5c7c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 20 Apr 2026 10:31:11 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 20 Apr 2026 10:31:11 +0530    

Click here for diff

Parallel apply workers previously failed to report statistics while  
waiting for new work in the main loop. This resulted in the stats from the  
most recent transaction remaining unbuffered, leading to arbitrary  
reporting delays—particularly when streamed transactions were infrequent.  
  
This commit ensures that statistics are explicitly flushed when the worker  
is idle, providing timely visibility into accumulated worker activity.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Backpatch-through: 16, where it was introduced  
Discussion: https://postgr.es/m/TYRPR01MB1419579F217CC4332B615589594202@TYRPR01MB14195.jpnprd01.prod.outlook.com  

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

Meson: Fix check_header() for readline and gssapi

commit   : 63a116a96e7377ffb385f394655a387021d4b75b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 20 Apr 2026 12:36:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 20 Apr 2026 12:36:14 +0900    

Click here for diff

Since f039c2244110, the minimum version of meson supported is 0.57.2,  
meaning that it is possible to use the result of declare_dependency()  
when checking for headers with check_header().  There were two TODOs for  
readline and gssapi to change declare_dependency() after upgrading to at  
least 0.57.0, which were not addressed yet.  
  
While on it, this fixes a comment related to str.replace().  The  
function has been introduced in meson 0.58.0, not 0.56.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Tristan Partin <tristan@partin.io>  
Discussion: https://postgr.es/m/00cd2e0c-85df-4cf9-a889-125d85e66980@proxel.se  

M meson.build

Minor fixes for test_bitmapset.c

commit   : 5142f0093e648d1a32fdcc7c835d17fa103e1239    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 20 Apr 2026 09:58:40 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 20 Apr 2026 09:58:40 +1200    

Click here for diff

1. Make it so test_random_operations() can accept a NULL to have the  
   function select a random seed.  
2. Widen the seed parameter of test_random_operations() to bigint.  
   Without that, it'll be impossible to run the function with a seed  
   which was selected by GetCurrentTimestamp(), and if a randomly  
   selected seed ever results in a failure, we'll likely want to run  
   with the same seed to debug the issue.  
3. Report the seed in the error messages in test_random_operations().  
   If the buildfarm were ever to fail there, we'd certainly want to know  
   what this was.  
4. Add CHECK_FOR_INTERRUPTS() to test_random_operations().  Someone might  
   run with a large num_ops and they'd have no way to cancel the query.  
5. Minor cosmetic fixes; header order and whitespace issue.  
  
To allow #1, the STRICT modifier had to be removed.  The additional  
prechecks were added as I didn't see how else to handle someone passing  
those parameters as NULL.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Discussion: https://postgr.es/m/CAApHDvrDW9W72vAr7h7XeCu7+Qz-_Vff02Q+RPPuVeM0Qf0MCw@mail.gmail.com  

M src/test/modules/test_bitmapset/expected/test_bitmapset.out
M src/test/modules/test_bitmapset/sql/test_bitmapset.sql
M src/test/modules/test_bitmapset/test_bitmapset–1.0.sql
M src/test/modules/test_bitmapset/test_bitmapset.c

Fix 64-bit shifting in dynahash.c

commit   : 9018c7d37bb464cd53567c0b553a6f49b50bec78    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 19 Apr 2026 12:57:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 19 Apr 2026 12:57:41 +0200    

Click here for diff

The switch from long to int64 in commit 13b935cd521 was incomplete.  
It was shifting the constant 1L, which is not always 64 bit.  Fix by  
using an explicit int64 constant.  
  
MSVC warning:  
  
../src/backend/utils/hash/dynahash.c(1767): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)  
  
Also add the corresponding warning to the standard warning set on  
MSVC, to help catch similar issues in the future.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/1142ad86-e475-41b3-aeee-c6ad913064fa%40eisentraut.org  

M meson.build
M src/backend/utils/hash/dynahash.c

pg_plan_advice: pgindent

commit   : 228a1f9542792c6533ef74c2e7aefad0da1d9a7a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 17 Apr 2026 17:45:50 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 17 Apr 2026 17:45:50 -0400    

Click here for diff

Per buildfarm member koel.  

M contrib/pg_plan_advice/pgpa_planner.c

Change PointerGetDatum() back to a macro

commit   : d65995cbc6e1644b5514d28f07c89f68fa690e53    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 17 Apr 2026 22:14:40 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 17 Apr 2026 22:14:40 +0300    

Click here for diff

The argument was marked as "const void *X", but that might rightly  
give the compiler the idea that *X cannot be modified through the  
resulting Datum, and make incorrect optimizations based on that. Some  
functions use pointer Datums to pass output arguments, like GIN  
support functions. Coverity started to complain after commit  
6f5ad00ab7 that there's dead code in ginExtractEntries(), because it  
didn't see that it passes PointerGetDatum(&nentries) to a function  
that sets it.  
  
This issue goes back to commit c8b2ef05f481 (version 16), which  
changed PointerGetDatum() from a macro to a static inline function.  
This commit changes it back to a macro, but uses a trick with a dummy  
conditional expression to still produce a compiler error if you try to  
pass a non-pointer as the argument.  
  
Even though this goes back to v16, I'm only committing this to  
'master' for now, to verify that this silences the Coverity warning.  
If this works, we might want to introduce separate const and non-const  
versions of PointerGetDatum() instead of this, but that's a bigger  
patch.  It's also not decided yet whether to back-patch this (or some  
other fix), given that we haven't yet seen any hard evidence of  
compilers actually producing buggy code because of this.  
  
Discussion: https://www.postgresql.org/message-id/342012.1776017102@sss.pgh.pa.us  

M src/include/postgres.h

pg_plan_advice: Fix another unique-semijoin bug.

commit   : 4321dcad475bc7cbb4efe18c0b0652a0506e8348    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 17 Apr 2026 14:08:37 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 17 Apr 2026 14:08:37 -0400    

Click here for diff

This one occurs when an outer join appears beneath the made-unique  
side of a semijoin. The issue is that join RTEs are not featured  
out of sj_unique_rels entries. Fix, and add a test case.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Analyzed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: http://postgr.es/m/c0c63979-43c2-4424-8fe8-56949934c9d8@gmail.com  

M contrib/pg_plan_advice/expected/semijoin.out
M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/sql/semijoin.sql

Doc: Improve the wording of logical slot prerequisites.

commit   : f3ae1ec7295b6c4d54974eea14bef4b917dc2c7e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 17 Apr 2026 15:02:15 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 17 Apr 2026 15:02:15 +0530    

Click here for diff

Replace the previous negative phrasing such as "there are no slots whose  
... is not true" with a direct expression that all slots must have  
conflicting = false.  
  
Similarly, reword the requirement on the new cluster to state that it must  
not have any permanent logical slots, clarifying that any existing logical  
slots must have temporary set to true.  
  
These changes improve readability without altering the meaning.  
  
Reported-by: <mimidatabase@gmail.com>  
Author: Vignesh C <vignesh21@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/177609278737.403059.14174275013090471947%40wrigleys.postgresql.org  

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

doc: Improve description of pg_ctl -l log file permissions

commit   : 950f50d5d49bcb55865582e8c5b12068533f6664    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 17 Apr 2026 15:30:59 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 17 Apr 2026 15:30:59 +0900    

Click here for diff

The documentation stated only that the log file created by pg_ctl -l is  
inaccessible to other users by default. However, since commit c37b3d0,  
the actual behavior is that only the cluster owner has access by default,  
but users in the same group as the cluster owner may also read the file  
if group access is enabled in the cluster.  
  
This commit updates the documentation to describe this behavior  
more clearly.  
  
Backpatch to all supported versions.  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/OS9PR01MB1214959BE987B4839E3046050F54BA@OS9PR01MB12149.jpnprd01.prod.outlook.com  
Backpatch-through: 14  

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

psql: Fix incorrect tab completion after CREATE PUBLICATION ... EXCEPT (...)

commit   : 4e0e1f3b2704e04768a4bccb7102450d74730a50    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 17 Apr 2026 14:31:05 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 17 Apr 2026 14:31:05 +0900    

Click here for diff

Previously, tab completion after EXCEPT (...) always suggested FROM SERVER.  
This was correct for IMPORT FOREIGN SCHEMA ... EXCEPT (...), but became  
incorrect once commit fd366065e06 added CREATE PUBLICATION ... EXCEPT (...).  
  
This commit updates tab completion so FROM SERVER is no longer suggested  
after CREATE PUBLICATION ... EXCEPT (...), while preserving the existing  
behavior for IMPORT FOREIGN SCHEMA ... EXCEPT (...).  
  
Author: Vignesh C <vignesh21@gmail.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm1-Fx6Msw6zcRuSjgQdw6asdTyp2DwP-4TCKGYAT+ndsA@mail.gmail.com  

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

Reject invalid databases in pg_get_database_ddl()

commit   : cda0c4c5d6f581cddaa24cde02c583d1c8f5521d    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 17 Apr 2026 13:19:56 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 17 Apr 2026 13:19:56 +0900    

Click here for diff

An invalid database has datconnlimit set to -2.  pg_get_database_ddl()  
emits this verbatim as CONNECTION LIMIT = -2, which ALTER DATABASE  
rejects.  Error out early instead.  
  
Reported-by: Lakshmi N <lakshmin.jhs@gmail.com>  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Hu Xunqi <huxunqi.08@gmail.com>  
Discussion: https://postgr.es/m/CA+3i_M8m1k2gFch+tU0JmAQh9FRV+pFrfTXDrJo+BqmwsTmOhg@mail.gmail.com  

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

doc PG 19 relnotes: change "free space map" to "visibility map"

commit   : f3c28c2f2b77479e0afc49b5e6e64a6f7dedfd3d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 17:23:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 17:23:55 -0400    

Click here for diff

Reported-by: Melanie Plageman  
  
Author: Melanie Plageman  

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

Make psql DETAIL line test unconditionally optional.

commit   : 446c400fd89b46ac6e71fb01604ffd830f12c9e9    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 15 Apr 2026 14:41:33 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 15 Apr 2026 14:41:33 -0400    

Click here for diff

Commit 3e2a1496bae6 made the psql TAP test require the DETAIL line on  
platforms with SA_SIGINFO, rather than making it optional. This  
unexpectedly blew up on OpenBSD buildfarm members, because OpenBSD does  
not set si_pid for SIGTERM signals even though it has SA_SIGINFO  
defined.  
  
So revert to the test as it was in commit 55890a919454, where the detail  
line being missing never causes an error.  
  
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/2007157.1776269052%40sss.pgh.pa.us  

M src/bin/psql/t/001_basic.pl

Add missing initialization

commit   : 05c401d5786a05ea630e884ffa492aa01683d15b    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 16 Apr 2026 22:27:04 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 16 Apr 2026 22:27:04 +0200    

Click here for diff

The backend running REPACK can check DecodingWorkerShared->initialized  
before the worker could have the chance to initialize it, possibly  
leading to wrong behavior.  
  
While at it, remove DecodingWorkerShared->worker_dsm_segment, because  
that doesn't actually need to be in shared memory; a simple local-memory  
global variable is enough.  
  
Oversights in commit 28d534e2ae0a.  
  
Author: Antonin Houska <ah@cybertec.at>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/18181295-8375-4789-ad32-269d78d6001e@gmail.com  

M src/backend/commands/repack.c
M src/backend/commands/repack_worker.c
M src/include/commands/repack_internal.h

doc PG 19 relnotes: add author and move items

commit   : 191a037d4f2d0a028c19e9ca29da72bc79d2236e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 12:45:40 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 12:45:40 -0400    

Click here for diff

Reported-by: Richard Guo  
  
Author: Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4_etzZZPMEzte8hJv2f4Tn6dGskg8v1R_N9uCd2of0kMQ@mail.gmail.com  

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

Update FSM during prune/freeze replay even if freespace is zero

commit   : b4c1b2be300e619aebc3a2c00198009af256bfee    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 16 Apr 2026 12:10:47 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 16 Apr 2026 12:10:47 -0400    

Click here for diff

add323da40a started updating the visibility map in the same WAL record  
as pruning and freezing. This included updating the freespace map during  
replay of a record setting the VM, which we've done since ab7dbd681.  
  
add323da40a, however, conditioned doing so on there being > 0 freespace  
on the page, which differed from the previous state for records updating  
the VM.  
  
The FSM is not WAL-logged and is instead updated heuristically on  
standbys. In rare cases, this heuristic could lead to pages with 0  
freespace having outdated entries in the FSM. If the standby is later  
promoted and vacuum skips these pages because they are marked  
all-visible/all-frozen, overly optimistic values would be propagated up  
the FSM tree, causing slowness when searching for freespace for new  
tuples.  
  
Fix it by always updating the FSM during replay when setting VM bits.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: Alexey Makhmutov <a.makhmutov@postgrespro.ru>  
Discussion: https://postgr.es/m/ead2f110-c736-48f5-99e1-023dc9acbf0b%40postgrespro.ru  

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

doc PG 19 relnotes: update author

commit   : af1ed03739fb4f7bf11a55971ff1377d7ebf6d2d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 11:23:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 11:23:55 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Author: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoCLCZnzEFam8H07qq-=fUpDwmTmV7+4RPnT2x_xoJBrgg@mail.gmail.com  

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

doc PG 19 relnotes: corrections reported to me privately

commit   : 2dc34eaa07fcfbc63c9b2dafde317a85383b01d4    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 10:43:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 16 Apr 2026 10:43:17 -0400    

Click here for diff

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

Use XLogRecPtrIsValid() consistently for WAL position checks

commit   : 2fd84e2226e2e1e13f5ad57bec3465488d67e944    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 16 Apr 2026 23:02:34 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 16 Apr 2026 23:02:34 +0900    

Click here for diff

Commit a2b02293bc6 switched various checks to use XLogRecPtrIsValid(),  
but later changes reintroduced XLogRecPtrIsInvalid() and direct comparisons  
with InvalidXLogRecPtr.  
  
This commit replaces those uses with XLogRecPtrIsValid() for better  
readability and consistency.  
  
Author: Vignesh C <vignesh21@gmail.com>  
Reviewed-by: Xiaopeng Wang <wxp_728@163.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm16knMFtcqyAG3XYSkyagmVXfhaR0T=hau8UTAU0+eLQQ@mail.gmail.com  

M src/backend/commands/repack_worker.c
M src/backend/replication/walreceiver.c
M src/bin/pg_waldump/archive_waldump.c

doc: Add missing GUCs to SSL SNI docs

commit   : 4abcdc1bbebfaeffc072296711e8a2af8d7d7cdf    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 16 Apr 2026 11:18:57 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 16 Apr 2026 11:18:57 +0200    

Click here for diff

The ssl_sni and hosts_file GUCs were missing from the configuration  
section of the documentation, they were only described in the main  
SSL SNI subsection.  This adds the GUCs to the relevant sections as  
well as rewords the existing SSL SNI documentation to refer to the  
settings along with a few smaller fixups.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwESD2Pty+J1kP3mXmWwMKZ5uJmknZdJsSGrMSRR6CQBmw@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/runtime.sgml

MSVC: Turn missing function declaration into an error

commit   : 1a51ec16db7aa1688d0083911db78e17ff7f26ba    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 16 Apr 2026 09:53:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 16 Apr 2026 09:53:03 +0200    

Click here for diff

Calling an undeclared function should be an error as of C99, and GCC  
and Clang do that, but MSVC doesn't even warn about it in the default  
warning level.  (Commit c86d2ccdb35 fixed an instance of this  
problem.)  This turns on this warning and makes it an error by  
default, to match other compilers.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/1142ad86-e475-41b3-aeee-c6ad913064fa%40eisentraut.org  

M meson.build

Add missing include

commit   : c86d2ccdb35544590531f5431606db46b57730a8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 16 Apr 2026 09:35:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 16 Apr 2026 09:35:05 +0200    

Click here for diff

"utils/pg_locale.h" is needed when under MSVC for wchar2char(),  
introduced by commit 65707ed9afc.  Surprisingly, MSVC doesn't warn by  
default about calling undeclared functions.  This will be addressed in  
a separate commit.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/1142ad86-e475-41b3-aeee-c6ad913064fa%40eisentraut.org  

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

Fix comments for Korean encodings in encnames.c

commit   : 9a618901a476ea168278414592d8a9818252dff3    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 16 Apr 2026 18:17:05 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 16 Apr 2026 18:17:05 +1200    

Click here for diff

  * JOHAB: replace the incorrect "simplified Chinese" description with  
    a correct one that identifies it as the Korean combining (Johab)  
    encoding standardized in KS X 1001 annex 3.  
  
  * EUC_KR: drop a stray space before the comma in the existing  
    comment, and note that the encoding covers the KS X 1001  
    precomposed (Wansung) form.  
  
  * UHC: spell out "Unified Hangul Code", clarify that it is  
    Microsoft Windows CodePage 949, and describe its relationship to  
    EUC-KR (superset covering all 11,172 precomposed Hangul syllables).  
  
Backpatch-through: 14  
Author: Henson Choi <assam258@gmail.com>  
Discussion: https://postgr.es/m/CAAAe_zAFz1v-3b7Je4L%2B%3DwZM3UGAczXV47YVZfZi9wbJxspxeA%40mail.gmail.com  

M src/common/encnames.c

Fix pg_overexplain to emit valid output with RANGE_TABLE option.

commit   : 059cf7f58d23fc53423e4e58feaaa717faef53c5    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Thu, 16 Apr 2026 13:47:07 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Thu, 16 Apr 2026 13:47:07 +0900    

Click here for diff

overexplain_range_table() emitted the "Unprunable RTIs" and "Result  
RTIs" properties before closing the "Range Table" group.  In the JSON  
and YAML formats the Range Table group is rendered as an array of RTE  
objects, so emitting key/value pairs inside it produced structurally  
invalid output.  The XML format had a related oddity, with these  
elements nested inside <Range-Table> rather than appearing as its  
siblings.  
  
These fields are properties of the PlannedStmt as a whole, not of any  
individual RTE, so close the Range Table group before emitting them.  
They now appear as siblings of "Range Table" in the parent Query  
object, which is what was intended.  
  
Also add a test exercising FORMAT JSON with RANGE_TABLE so that any  
future regression in the output structure is caught.  
  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDdDrdqMr98a_OBYDYmK3RaT7XwCEShZfvDYKZpZTfOEjQ@mail.gmail.com  
Backpatch-through: 18  

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

Fix incorrect comment in JsonTablePlanJoinNextRow()

commit   : b5062a4e57fcdd51949a046314ec90731bdbf92c    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Thu, 16 Apr 2026 13:45:33 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Thu, 16 Apr 2026 13:45:33 +0900    

Click here for diff

The comment on the return-false path when both UNION siblings are  
exhausted said "there are more rows," which is the opposite of what  
the code does. The code itself is correct, returning false to signal  
no more rows, but the misleading comment could tempt a reader into  
"fixing" the return value, which would cause UNION plans to loop  
indefinitely.  
  
Back-patch to 17, where JSON_TABLE was introduced.  
  
Author: Chuanwen Hu <463945512@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/tencent_4CC6316F02DECA61ACCF22F933FEA5C12806@qq.com  
Backpatch-through: 17  

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

Use proc_exit() for walreceiver exit in WalRcvWaitForStartPosition()

commit   : ee550254a29a4ccd3852f14b1806b8ffe26b7454    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 16 Apr 2026 12:33:17 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 16 Apr 2026 12:33:17 +0900    

Click here for diff

Previously, when the walreceiver exited from WalRcvWaitForStartPosition()  
at the startup process's request, it called exit(1) directly. This could  
skip cleanup performed by the callback functions.  
  
This commit makes the walreceiver to use proc_exit() instead, ensuring  
normal cleanup is executed on exit.  
  
Also this commit updates comments describing walreceiver termination.  
  
Apply to master only, as this has not caused practical issues so far.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/74381238-4E8A-4621-B794-57025DCCE0BA@gmail.com  

M src/backend/replication/walreceiver.c

doc PG 19 relnotes: remove doc author from "Allow autovacuum"

commit   : 7102ce9823ed6f1d1568b82d170aaa9bd973ef6e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:58:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:58:11 -0400    

Click here for diff

Reported-by: Aleksander Alekseev  
  
Discussion: https://postgr.es/m/CAJ7c6TO-FHg4SGF48PJ9dnV3cg1-_xW9=P4t8-cd-+JWvZAPyQ@mail.gmail.com  

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

doc PG 19 relnotes: add free space map all-visible item

commit   : be324941262b06f4275ac19768b1a8a024960687    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:52:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:52:17 -0400    

Click here for diff

Reported-by: Melanie Plageman  
  
Discussion: https://postgr.es/m/CAAKRu_bzN6ioG+h7agjCF847whVpS2WEiJB3UXAtkJ3WVXOZwA@mail.gmail.com  

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

doc PG 19 relnotes: fixes for commands and authors

commit   : 3837e72757347cb9749f46e01e9f86e18e3e5d61    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:18:51 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 16:18:51 -0400    

Click here for diff

Reported-by: jian he  
  
Discussion: https://postgr.es/m/CANzqJaCKn_AahetGkZWKJVi6MKyGKqr1JrziquyHt1-SRwQpSw@mail.gmail.com  

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

doc PG 19 relnotes: remove "Lakshmi N" as author of checksums

commit   : 75693dc5b72e7e8a9759ff86489f325a22ab06c5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:43:36 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:43:36 -0400    

Click here for diff

Reported-by: Daniel Gustafsson  
  
Discussion: https://postgr.es/m/762DAF2F-7055-4F52-9DF7-23C4A19478A0@yesql.se  

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

doc PG 19 relnotes: fix "now targets"

commit   : caebf165098f356f8ade0146035b908f8eb573ef    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:37:00 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:37:00 -0400    

Click here for diff

Reported-by: Laurenz Albe  
  
Discussion: https://postgr.es/m/27be2ef070e3a0ca55b478e0493fac0124d4f95e.camel@cybertec.at  

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

doc PG 19 relnotes: addjust CREATE/ALTER PUBLICATION "EXCEPT"

commit   : 57f768816dcd0095bc330cf113eaf2f52a525da9    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:35:23 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 15:35:23 -0400    

Click here for diff

Reported-by: Peter Smith  
  
Backpatch-through: CAHut+Psb41Lou8+BS4ZYmZJFG8pF99wEr+xcP17PCZP1MaY_+Q@mail.gmail.com  

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

doc PG 19 relnotes: add missing March 16 autovacuum score item

commit   : 23ec74c8a85245e379ef2eb515e3e6e7f2381655    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 14:42:57 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 14:42:57 -0400    

Click here for diff

Also fix "deformed" tuples.  
  
Reported-by: David Rowley  
  
Backpatch-through: CAApHDvrsyD3QKBO=dypNkyFzYOzQEbgy+xJLwn=y+h+bLSDd-g@mail.gmail.com  

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

doc PG 19 relnotes: adjust ShmemRequestStruct item

commit   : e70ac90d95a2e0ba95b5b6b02ae9b7f6607bf4db    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 13:03:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 15 Apr 2026 13:03:29 -0400    

Click here for diff

Reported-by: Ashutosh Bapat  
  
Author: Ashutosh Bapat  
  
Discussion: https://postgr.es/m/CAExHW5vjpd=mWauQZsTbKX9QqD8yxDUABBGQAT5n+CT+nr8QHw@mail.gmail.com  

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

Fix COPY TO FORMAT JSON to exclude generated columns.

commit   : f30d0c720f2ec979ab1b5b44b1f9f201d6efdf8c    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 15 Apr 2026 07:47:12 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 15 Apr 2026 07:47:12 -0400    

Click here for diff

COPY TO with FORMAT json was including generated columns in the  
output, unlike TEXT and CSV formats.  Virtual generated columns  
appeared as null, and stored ones showed their computed values.  
  
The JSON code path only built a restricted TupleDesc when an explicit  
column list was given (attnamelist != NIL), but CopyGetAttnums()  
also excludes generated columns from the default list.  Fix by  
checking whether the attnumlist is shorter than the full TupleDesc  
instead.  
  
Bug introduced in 7dadd38cda9.  
  
Author: Satya Narlapuram <satya.narlapuram@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDcfpGDoPL3fvfjXRtfn=fny6DdJR6BAy6TpS1Xj2EZfXA@mail.gmail.com  

M src/backend/commands/copyto.c
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql

Rework signal handler infrastructure to pass sender info as argument.

commit   : 3e2a1496bae628c379ca0a11ef5f5ba666f24ae8    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 14 Apr 2026 16:13:08 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 14 Apr 2026 16:13:08 -0400    

Click here for diff

Commit 095c9d4cf06 added errdetail() reporting of the PID and UID of  
the process that sent a termination signal.  However, as noted by  
Andres Freund, the implementation had architectural problems:  
  
1. wrapper_handler() in pqsignal.c contained SIGTERM-specific logic  
   (setting ProcDieSenderPid/Uid), violating its role as a generic  
   signal dispatch wrapper.  
  
2. Using globals to pass sender info between wrapper_handler and the  
   real handler is unsafe when signals nest on some platforms.  
  
3. The syncrep.c errdetail used psprintf() to conditionally embed  
   text via %s, breaking translatability.  
  
Adopt the approach proposed by Andres Freund: introduce a  
pg_signal_info struct that is passed as an argument to all signal  
handlers via the SIGNAL_ARGS macro.  wrapper_handler populates it  
from siginfo_t when SA_SIGINFO is available, or with zeros otherwise.  
This keeps wrapper_handler fully generic and avoids any globals for  
passing signal metadata.  
  
Since pqsigfunc now has a different signature from the system's  
signal handler type, SIG_IGN and SIG_DFL can no longer be passed  
directly to pqsignal().  Introduce PG_SIG_IGN and PG_SIG_DFL macros  
that cast to the new pqsigfunc type, and update all call sites.  
The legacy pqsignal() in libpq retains its original signature via  
a local typedef.  
  
Only die() reads pg_siginfo today, copying the sender PID/UID into  
ProcDieSenderPid/Uid for later use by ProcessInterrupts().  Only the  
first SIGTERM's sender info is recorded.  
  
Also fix the syncrep.c translatability issue by using separate ereport  
calls with complete, independently translatable errdetail strings.  
  
Also make the psql TAP test require the DETAIL line on platforms with  
SA_SIGINFO, rather than making it unconditionally optional.  
  
On Windows, pg_signal_info uses uint32_t for pid and uid fields  
since pid_t/uid_t are not available early enough in the include  
chain.  The Windows signal dispatch in pgwin32_dispatch_queued_signals()  
passes a zeroed pg_signal_info to handlers.  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/cwyyryh2veejuxbj5ifzyaejw7jhhqc5mrdeq56xckknsdecn2@6hzfcxde2nm5  
Discussion: https://postgr.es/m/jygesyr7mwg7ovdbxpmjvvbi3hccptpkcreqb645h7f56puwbz@hmkkwi3melfe  

M src/backend/bootstrap/bootstrap.c
M src/backend/port/win32/signal.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/datachecksum_state.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/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/aio/method_worker.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/tcop/postgres.c
M src/bin/initdb/initdb.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/parallel.c
M src/bin/psql/t/001_basic.pl
M src/fe_utils/print.c
M src/include/c.h
M src/include/port.h
M src/interfaces/libpq/legacy-pqsignal.c
M src/port/pqsignal.c
M src/test/regress/pg_regress.c
M src/tools/pgindent/typedefs.list

doc: first draft of PG 19 release notes

commit   : 972c14fb9134fdfd76ea6ebcf98a55a945bbc988    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Apr 2026 21:06:07 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 14 Apr 2026 21:06:07 -0400    

Click here for diff

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

Fix var_is_nonnullable() to handle invalid NOT NULL constraints

commit   : 363af93bdd24c37064d94bd4e637827442594d53    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 15 Apr 2026 09:38:56 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 15 Apr 2026 09:38:56 +0900    

Click here for diff

The NOTNULL_SOURCE_SYSCACHE code path in var_is_nonnullable() used  
get_attnotnull() to check pg_attribute.attnotnull, which is true for  
both valid and invalid (NOT VALID) NOT NULL constraints.  An invalid  
constraint does not guarantee the absence of NULLs, so this could lead  
to incorrect results.  For example, query_outputs_are_not_nullable()  
could wrongly conclude that a subquery's output is non-nullable,  
causing NOT IN to be incorrectly converted to an anti-join.  
  
Fix by checking the attnullability field in the relation's tuple  
descriptor instead, which correctly distinguishes valid from invalid  
constraints, consistent with what the NOTNULL_SOURCE_HASHTABLE code  
path already does.  
  
While at it, rename NOTNULL_SOURCE_SYSCACHE to NOTNULL_SOURCE_CATALOG  
to reflect that this code path no longer uses a syscache lookup, and  
remove the now-unused get_attnotnull() function.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs48ALW=mR0ydQ62dGS-Q+3D7WdDSh=EWDezcKp19xi=TUA@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/backend/utils/cache/lsyscache.c
M src/include/optimizer/optimizer.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl().

commit   : 1f108fc02ece09da5773ece74e25812cb952ebfc    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 14 Apr 2026 18:25:36 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 14 Apr 2026 18:25:36 -0400    

Click here for diff

DatumGetArrayTypeP() can return a pointer into the tuple when the  
datum is stored as a short varlena, so pfree() on the result crashes.  
Use DatumGetArrayTypePCopy() to always get a palloc'd copy.  
  
Bug introduced in 76e514ebb4b and a4f774cf1c7.  
  
Reported-by: Jeff Davis <pgsql@j-davis.com>  
Author: Satya Narlapuram <satya.narlapuram@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDdWtv9PKtPZEokwGCNtbv4MVnfYw5wMZrsEj4xizSNe5Q@mail.gmail.com  

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

Check for unterminated strings when calling uloc_getLanguage().

commit   : dacd8fa6f259e25f747d6d71290d9d5ed86095df    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 14 Apr 2026 12:06:02 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 14 Apr 2026 12:06:02 -0700    

Click here for diff

Missed by commit 1671f990dd66.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://postgr.es/m/118ca69e-47eb-42e1-83e9-72ccf40dd6fd@proxel.se  
Backpatch-through: 16  

M src/bin/initdb/initdb.c

Add tests for low-level PGLZ [de]compression routines

commit   : 67d318e70402b0eb450c7e20c0378b88e5a6df1d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 15 Apr 2026 05:09:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 15 Apr 2026 05:09:05 +0900    

Click here for diff

The goal of this module is to provide an entry point for the coverage of  
the low-level compression and decompression PGLZ routines.  The new test  
is moved to a new parallel group, with all the existing  
compression-related tests added to it.  
  
This includes tests for the cases detected by fuzzing that emulate  
corrupted compressed data, as fixed by 2b5ba2a0a141:  
- Set control bit with read of a match tag, where no data follows.  
- Set control bit with read of a match tag, where 1 byte follows.  
- Set control bit with match tag where length nibble is 3 bytes  
(extended case).  
  
While on it, some tests are added for compress/decompress roundtrips,  
and for check_complete=false/true.  Like 2b5ba2a0a141, backpatch to all  
the stable branches.  
  
Discussion: https://postgr.es/m/adw647wuGjh1oU6p@paquier.xyz  
Backpatch-through: 14  

A src/test/regress/expected/compression_pglz.out
M src/test/regress/parallel_schedule
M src/test/regress/regress.c
A src/test/regress/sql/compression_pglz.sql

Replace deprecated StaticAssertStmt() with StaticAssertDecl()

commit   : 66ad764c8d517f59577d41ac3dad786729c9e10e    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 Apr 2026 12:03:30 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 14 Apr 2026 12:03:30 +0300    

Click here for diff

Commit 6f5ad00ab763 added another use of StaticAssertStmt(), but it  
was marked as deprecated in commit d50c86e74375.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/gin/ginutil.c

Add missing period to HINT messages.

commit   : fce3f7d267777402b5a9b32db254982f2d75c4aa    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 14 Apr 2026 09:37:18 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 14 Apr 2026 09:37:18 +0530    

Click here for diff

Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Discussion: https://postgr.es/m/CAHut+PvikGr4AtoFSs=jq=hmTybVF2NCMEZ57-sjwbGudfuqsQ@mail.gmail.com  

M contrib/pgcrypto/crypt-sha.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_split.sql

Fix overrun when comparing with unterminated ICU language string.

commit   : 06ce97b9994eca91250d7c28f0df9b1ae7829f36    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 13 Apr 2026 11:19:04 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 13 Apr 2026 11:19:04 -0700    

Click here for diff

The overrun was introduced in commit c4ff35f10.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/96d80a47-f17f-42fa-82b1-2908efbd6541@gmail.com  
Backpatch-through: 18  

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

doc: Remove stray word from pg_stash_advice docs.

commit   : e89f98ff035fa56ff288ff2407f3eceddf187d70    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 12:51:04 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 12:51:04 -0400    

Click here for diff

Commit c10edb102ada607eb054bc9e23690109d86849ef left behind the  
word "both" where it no longer makes sense.  
  
Reported-by: Erik Rijkers <er@xs4all.nl>  
Discussion: http://postgr.es/m/8912b2e5-ccad-4cbd-ab53-869b0b9ecec5@xs4all.nl  

M doc/src/sgml/pgstashadvice.sgml

doc: Fix a couple of mistakes in pgplanadvice.sgml

commit   : f4a4f1a7e6285c846a4c2662d8ce5246a6bcb7e7    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 12:45:57 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 12:45:57 -0400    

Click here for diff

It said FOREIGN_SCAN where it should say FOREIGN_JOIN.  
  
NESTED_LOOP_MEMOIZE was mistakenly omitted from the list of join  
methods.  
  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: jie wang <jugierwang@gmail.com>  
Discussion: http://postgr.es/m/CA+3i_M-mo7Of=Pn8WzRfJLt=fc=gDTn1oOdj8v8BEtgXh9ZMCg@mail.gmail.com  

M doc/src/sgml/pgplanadvice.sgml

commit   : c644aca24089ce001c46029f9e2144789ada165b    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 11:47:40 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 11:47:40 -0400    

Click here for diff

It turns out that our main regression test suite queries tables upon  
which concurrent DDL is occurring, which can, rarely, cause  
test_plan_advice failures. We're not quite ready to fix that problem  
just yet, because we want to gather some more information about how  
often it actually happens first. But, our plan is going to require  
test_plan_advice to access a few bits of pg_plan_advice that have  
been considered internal up until now, so this commit rejiggers  
things to expose those bits.  
  
First, test_plan_advice is going to need to be able to interpret  
the PGPA_TE_* constants which have been declared in pgpa_trove.h.  
The "TE" stands for "trove entry" but that's kind of a silly name;  
change the naming to "FB" (for "feedback") and move the declarations  
to pg_plan_advice.h, which is a header file that's already installed.  
This has the side benefit of making these constants available to any  
other extensions that may want to examine plan advice feedback.  
  
Second, test_plan_advice is going to call pgpa_planner_feedback_warning,  
so make that function non-static and mark it PGDLLEXPORT.  
  
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com  

M contrib/pg_plan_advice/pg_plan_advice.h
M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/pgpa_planner.h
M contrib/pg_plan_advice/pgpa_trove.c
M contrib/pg_plan_advice/pgpa_trove.h

pg_plan_advice: Fix a bug when a subquery is pruned away entirely.

commit   : 0f93ebb3112d562fe54b685d0ca08c5ba1b41467    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 10:34:09 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 10:34:09 -0400    

Click here for diff

If a subquery is proven empty, and if that subquery contained a  
semijoin, and if making one side or the other of that semijoin  
unique and performing an inner join was a possible strategy, then  
the previous code would fail with ERROR: no rtoffset for plan %s  
when attempting to generate advice. Fix that.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com  

M contrib/pg_plan_advice/expected/semijoin.out
M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/sql/semijoin.sql

pg_plan_advice: Add alternatives test to Makefile.

commit   : 1faf9dfa4796a05b68c59194b8da9b0f57ed9889    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 10:09:20 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 10:09:20 -0400    

Click here for diff

Oversight in commit 6455e55b0da47255f332a96f005ba0dd1c7176c2.  
  
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com  

M contrib/pg_plan_advice/Makefile

pg_plan_advice: Handle non-repeatable TABLESAMPLE scans.

commit   : 3311ccc3d24bf83fb26a8af81ea68a8fcc295c26    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 08:46:25 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 13 Apr 2026 08:46:25 -0400    

Click here for diff

When a tablesample routine says that it is not repeatable across  
scans, set_tablesample_rel_pathlist will (usually) materialize it,  
confusing pg_plan_advice's plan walker machinery. To fix, update that  
machinery to view such Material paths as essentially an extension of  
the underlying scan.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com  

M contrib/pg_plan_advice/Makefile
M contrib/pg_plan_advice/expected/scan.out
M contrib/pg_plan_advice/pgpa_join.c
M contrib/pg_plan_advice/pgpa_scan.c
M contrib/pg_plan_advice/pgpa_walker.c
M contrib/pg_plan_advice/pgpa_walker.h
M contrib/pg_plan_advice/sql/scan.sql

Explicitly forbid non-top-level WAIT FOR execution

commit   : a8b61c23c5ff980312026a05cab5502aa31fd710    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 13 Apr 2026 14:04:52 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 13 Apr 2026 14:04:52 +0300    

Click here for diff

Previously we were relying on a snapshot-based check to detect invalid  
execution contexts.  However, when WAIT FOR is wrapped into a stored  
procedure or a DO block, it could pass this check, causing an error  
elsewhere.  
  
This commit implements an explicit isTopLevel check to reject WAIT FOR  
when called from within a function, procedure, or DO block.  The  
isTopLevel check catches these cases early with a clear error message,  
matching the pattern used by other utility commands like VACUUM and  
REINDEX.  The snapshot check is retained for the remaining case:  
top-level execution within a transaction block using an isolation level  
higher than READ COMMITTED.  
  
Also adds tests for WAIT FOR LSN wrapped in a procedure and DO block,  
complementing the existing test that uses a function wrapper.  Relevant  
documentation paragraph is also added.  
  
Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Discussion: https://postgr.es/m/CAHg%2BQDcN-n3NUqgRtj%3DBQb9fFQmH8-DeEROCr%3DPDbw_BBRKOYA%40mail.gmail.com  
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  

M doc/src/sgml/ref/wait_for.sgml
M src/backend/commands/wait.c
M src/backend/tcop/utility.c
M src/include/commands/wait.h
M src/test/recovery/t/049_wait_for_lsn.pl

Update Unicode data to CLDR 48.2

commit   : b47854b6992d6155861da709c0f846073a401f61    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 11:12:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 11:12:35 +0200    

Click here for diff

No actual changes result.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M src/Makefile.global.in
M src/common/unicode/meson.build

pg_createsubscriber: Don't use MAXPGPATH

commit   : 99b726ac4894cf40957ca6bd5473d7dfb9c36a9b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:59:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:59:08 +0200    

Click here for diff

Use dynamic allocation instead.  Using MAXPGPATH is unnecessary in new  
code like this..  
  
Discussion: https://www.postgresql.org/message-id/flat/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc%2BG%2Bf4oSUHw%40mail.gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

pg_createsubscriber: Remove separate logfile_open() function

commit   : f5528b90b411e0ba365f9cf42e97aa9b1c47cffa    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:52:19 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:52:19 +0200    

Click here for diff

This seems like an excessive indirection.  
  
Discussion: https://www.postgresql.org/message-id/flat/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc%2BG%2Bf4oSUHw%40mail.gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

pg_createsubscriber: Use logging.c log file callback

commit   : 847336ba53af2d140563cdf9f2b0c4f678378a54    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:44:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:44:14 +0200    

Click here for diff

This reverts commit 6b5b7eae3ae, where a new logging API layer was  
introduced locally in pg_createsubscriber.  Instead, use the log file  
callback introduced in logging.c.  This new approach is simpler,  
eliminates code duplication, and doesn't require any caller changes or  
NLS updates (which the previous commit missed).  
  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc%2BG%2Bf4oSUHw%40mail.gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

Add log file support to logging.c

commit   : 41237556f8c554f691968dbdce5fa6f4012e8036    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:44:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 13 Apr 2026 10:44:02 +0200    

Click here for diff

This adds the ability for users of logging.c to provide a file handle  
for a log file, where log messages are also written in addition to  
stderr.  
  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc%2BG%2Bf4oSUHw%40mail.gmail.com  

M src/common/logging.c
M src/include/common/logging.h

Fix capitalization in publication describe output.

commit   : 8f81c923516237fe842f800a77d4556f9dc35fe5    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Apr 2026 10:54:16 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Apr 2026 10:54:16 +0530    

Click here for diff

Consistent with existing psql metadata display conventions, update the  
description tags for EXCEPT publications to use lowercase for the second  
word (e.g., "Except tables" instead of "Except Tables"). This aligns the  
output style with other publication describe commands.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pt3t_tCYwDStkj5fG4Z=YXrHvPBA7iGdh745QipC5zKeg@mail.gmail.com  

M src/bin/psql/describe.c
M src/test/regress/expected/publication.out

Fix excessive logging in idle slotsync worker.

commit   : 85c17f612af7b9c47a9828805686f0dd2433cdf1    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Apr 2026 10:06:50 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 13 Apr 2026 10:06:50 +0530    

Click here for diff

The slotsync worker was incorrectly identifying no-op states as successful  
updates, triggering a busy loop to sync slots that logged messages every  
200ms. This patch corrects the logic to properly classify these states,  
enabling the worker to respect normal sleep intervals when no work is  
performed.  
  
Reported-by: Fujii Masao <masao.fujii@gmail.com>  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Backpatch-through: 17, where it was introduced  
Discussion: https://postgr.es/m/CAHGQGwF6zG9Z8ws1yb3hY1VqV-WT7hR0qyXCn2HdbjvZQKufDw@mail.gmail.com  

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

Improve various new-to-v19 appendStringInfo calls

commit   : 49ce41810faca2722424b3d8fabda79bf4902339    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 13:16:48 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 13:16:48 +1200    

Click here for diff

Similar to 928394b66 and 8461424fd, here we adjust a few new locations  
which were not using the most suitable appendStringInfo* or  
appendPQExpBuffer* function for the intended purpose.  
  
Author: David Rowley <drowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvohYOdrvhVxXzCJNX_GYMSWBfjTTtB6hgDauEtZ8Nar2A@mail.gmail.com  

M contrib/pg_plan_advice/pg_plan_advice.c
M contrib/pg_plan_advice/pgpa_output.c
M contrib/pg_plan_advice/pgpa_trove.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/slotsync.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/describe.c
M src/test/modules/test_escape/test_escape.c

test_saslprep: Fix issue with copy of input bytea

commit   : 5d35531af1840fdd8debfc1ff657643ddba029ab    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 Apr 2026 09:06:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 13 Apr 2026 09:06:17 +0900    

Click here for diff

The data given in input of the function may not be null-terminated,  
causing strlcpy() to complain with an invalid read.  
  
Issue spotted using valgrind.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/09df9d75-13e7-45fe-89af-33fe118e797b@gmail.com  

M src/test/modules/test_saslprep/test_saslprep.c

Fix unlikely overflow bug in bms_next_member()

commit   : e3e26d04bd52795083b3947151c5c71e989a01f8    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 11:39:15 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 11:39:15 +1200    

Click here for diff

... and bms_prev_member().  
  
Both of these functions won't work correctly when given a prevbit of  
INT_MAX and would crash when operating on a Bitmapset that happened to  
have a member with that value.  
  
Here we fix that by using an unsigned int to calculate which member to  
look for next.  
  
I've also adjusted bms_prev_member() to check for < 0 rather than == -1  
for starting the loop.  This was done as it's safer and comes at zero  
extra cost.  
  
With our current use cases, it's likely impossible to have a Bitmapset  
with an INT_MAX member, so no backpatch here.  I only noticed this issue  
when working on a bms function to bitshift a Bitmapset.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvr1B2gbf6JF69QmueM2QNRvbQeeKLxDnF=w9f9--022uA@mail.gmail.com  

M src/backend/nodes/bitmapset.c

Use stack-allocated StringInfoDatas, where possible

commit   : a63bbc811d41b3567eb37fe2636e660a852dbbf2    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 10:43:19 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 13 Apr 2026 10:43:19 +1200    

Click here for diff

6d0eba662 already did most of the changes, but some new ones snuck in  
just prior to that commit, so these got missed.  
  
Having these short-lived StringInfoDatas on the stack rather than having  
them get palloc'd by makeStringInfo() is simply for performance as it  
saves doing a 2nd palloc.  
  
Since this code is new to v19, it makes sense to improve it now rather  
than wait until we branch as having v19 and v20 differ here just makes it  
harder to backpatch fixes in this area.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/adt4wpj4FZwR+S7I@ip-10-97-1-34.eu-west-3.compute.internal  

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

Doc: use "an SQL" consistently rather than "a SQL"

commit   : a78cf591a3f5288aa5ae96902a36e342a3178b79    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 12 Apr 2026 22:49:27 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 12 Apr 2026 22:49:27 +1200    

Click here for diff

Per the precedent set by 04539e73f, adjust article prefixes for "SQL" to  
use "an" consistently rather than "a", i.e., "an es-que-ell" rather than  
"a sequel".  
  
Also see b51f86e49, b1b13d2b5, d866f0374 and 7bdd489d3.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvp3osQwQam+wNTp9BdhP+QfWO6aY6ZTixQQMfM-UArKCw@mail.gmail.com  

M doc/src/sgml/xfunc.sgml

Honor passed-in database OIDs in pgstat_database.c

commit   : 80156cee06b9d257251d72379ac43f9b88bd13e1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 11 Apr 2026 17:02:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 11 Apr 2026 17:02:52 +0900    

Click here for diff

Three routines in pgstat_database.c incorrectly ignore the database OID  
provided by their caller, using MyDatabaseId instead:  
- pgstat_report_connect()  
- pgstat_report_disconnect()  
- pgstat_reset_database_timestamp()  
  
The first two functions, for connection and disconnection, each have a  
single caller that already passes MyDatabaseId.  This was harmless,  
still incorrect.  
  
The timestamp reset function also has a single caller, but in this case  
the issue has a real impact: it fails to reset the timestamp for the  
shared-database entry (datid=0) when operating on shared objects.  This  
situation can occur, for example, when resetting counters for shared  
relations via pg_stat_reset_single_table_counters().  
  
There is currently one test in the tree that checks the reset of a  
shared relation, for pg_shdescription, we rely on it to check what is  
stored in pg_stat_database.  As stats_reset may be NULL, two resets are  
done to provide a baseline for comparison.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Dapeng Wang <wangdp20191008@gmail.com>  
Discussion: https://postgr.es/m/ABBD5026-506F-4006-A569-28F72C188693@gmail.com  
Backpatch-through: 15  

M src/backend/utils/activity/pgstat_database.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix estimate_array_length error with set-operation array coercions

commit   : 77d0e82e58854cfa5e2c4f365a97f16c0d91c394    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Sat, 11 Apr 2026 16:38:47 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Sat, 11 Apr 2026 16:38:47 +0900    

Click here for diff

When a nested set operation's output type doesn't match the parent's  
expected type, recurse_set_operations builds a projection target list  
using generate_setop_tlist with varno 0.  If the required type  
coercion involves an ArrayCoerceExpr, estimate_array_length could be  
called on such a Var, and would pass it to examine_variable, which  
errors in find_base_rel because varno 0 has no valid relation entry.  
  
Fix by skipping the statistics lookup for Vars with varno 0.  
  
Bug introduced by commit 9391f7152.  Back-patch to v17, where  
estimate_array_length was taught to use statistics.  
  
Reported-by: Justin Pryzby <pryzby@telsasoft.com>  
Author: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/adjW8rfPDkplC7lF@pryzbyj2023  
Backpatch-through: 17  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

read_stream: Remove obsolete comment.

commit   : b2a17ba7a5d00071f433d3ef60ddd2356679aad7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 11 Apr 2026 11:23:26 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 11 Apr 2026 11:23:26 +1200    

Click here for diff

This comment was describing the v17 implementation (or io_method=sync).  
  
Backpatch-through: 18  

M src/backend/storage/aio/read_stream.c

Fix unstable log verification in test_autovacuum.

commit   : c22d115f1d13d7c1b89ec20abaa02ebeb811b9dd    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 10 Apr 2026 16:01:42 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 10 Apr 2026 16:01:42 -0700    

Click here for diff

The test in test_autovacuum was unstable because it called  
log_contains() immediately after verifying autovacuum_count in  
pg_stat_user_tables. This created a race condition where the  
statistics could be updated before the autovacuum logs were fully  
flushed to disk.  
  
This commit replaces log_contains() with wait_for_log() to ensure the  
test waits for the parallel vacuum messages to appear. Additionally,  
remove the checks of the autovacuum count. Verifying the log messages  
is sufficient to confirm parallel autovacuum behavior, as logging is  
only enabled for the specific table under test.  
  
Per report from buildfarm member flaviventris.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/525d0f48-93f7-493f-a988-f39b460a79bc@gmail.com  

M src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl

doc: Improve consistency of parallel vacuum description.

commit   : 2a3d2f9f68da0c430c497bf29f60373f5214307d    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 10 Apr 2026 10:59:24 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 10 Apr 2026 10:59:24 -0700    

Click here for diff

Use consistent phrasing for parallel vacuum descriptions between  
manual VACUUM and autovacuum. Specifically, clarify that the parallel  
worker count is limited by the respective options only if they are  
explicitly specified.  
  
Also, fix a typo in the parallel vacuum section.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://postgr.es/m/CAJ7c6TPcSqzhbhrsiCMmVwmE8F7pwS7i9J49SP1zPKS_ER+vcA@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

Adjust log level of logical decoding messages by context

commit   : de74d1e9a5453b8efe2eda2afebcf8218a503184    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 10 Apr 2026 22:59:34 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 10 Apr 2026 22:59:34 +0900    

Click here for diff

Commit 21b018e7eab lowered some logical decoding messages from LOG to DEBUG1.  
However, per discussion on pgsql-hackers, messages from background activity  
(e.g., walsender or slotsync worker) should remain at LOG, as they are less  
frequent and more likely to indicate issues that DBAs should notice.  
  
For foreground SQL functions (e.g., pg_logical_slot_peek_binary_changes()),  
keep these messages at DEBUG1 to avoid excessive log noise. They can still be  
enabled by lowering client_min_messages or log_min_messages for the session.  
  
This commit updates logical decoding to log these messages at LOG for  
background activity and at DEBUG1 for foreground execution.  
  
Suggested-by: Robert Haas <robertmhaas@gmail.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CA+TgmoYsu2+YAo9eLGkDp5VP-pfQ-jOoX382vS4THKHeRTNgew@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/logical.h
M src/test/recovery/t/038_save_logical_slots_shutdown.pl

Revert "Add built-in fuzzing harnesses for security testing."

commit   : eec8e234bdcbe43e0407b03c44484bf75423d515    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 10 Apr 2026 09:53:58 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 10 Apr 2026 09:53:58 -0400    

Click here for diff

This reverts commit 4a18907b412e77684bf888ad6d1b4844d220196a.  
  
inadvertenly pushed, mea culpa  

M meson_options.txt
D src/test/fuzzing/fuzz_b64decode.c
D src/test/fuzzing/fuzz_conninfo.c
D src/test/fuzzing/fuzz_json.c
D src/test/fuzzing/fuzz_json_incremental.c
D src/test/fuzzing/fuzz_parsepgarray.c
D src/test/fuzzing/fuzz_pgbench_expr.c
D src/test/fuzzing/fuzz_pglz.c
D src/test/fuzzing/fuzz_rawparser.c
D src/test/fuzzing/fuzz_regex.c
D src/test/fuzzing/fuzz_saslprep.c
D src/test/fuzzing/fuzz_typeinput.c
D src/test/fuzzing/fuzz_unescapebytea.c
D src/test/fuzzing/meson.build
M src/test/meson.build

Use size_t instead of Size in pg_waldump

commit   : 3f8913f683ba99e7135d374541f52c626fcc6eec    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 10 Apr 2026 09:29:00 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 10 Apr 2026 09:29:00 -0400    

Click here for diff

In commit b15c1513984 I missed the memo about not using Size in new  
code.  
  
Per complaint from Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGJkeTVuq5u5WKJm6xkwmW577UuQ7fA=PyBCSR3h9g2GtQ@mail.gmail.com  

M src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/pg_waldump.h

Add built-in fuzzing harnesses for security testing.

commit   : 4a18907b412e77684bf888ad6d1b4844d220196a    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 14:20:40 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 14:20:40 -0400    

Click here for diff

Add 12 libFuzzer-compatible fuzzing harnesses behind a new -Dfuzzing=true  
meson option.  Each harness implements LLVMFuzzerTestOneInput() and can  
also be built in standalone mode (reading from files) when no fuzzer  
engine is detected.  
  
Frontend targets (no backend dependencies):  
  fuzz_json            - non-incremental JSON parser (pg_parse_json)  
  fuzz_json_incremental - incremental/chunked JSON parser  
  fuzz_conninfo        - libpq connection string parser (PQconninfoParse)  
  fuzz_pglz            - PGLZ decompressor (pglz_decompress)  
  fuzz_unescapebytea   - libpq bytea unescape (PQunescapeBytea)  
  fuzz_b64decode       - base64 decoder (pg_b64_decode)  
  fuzz_saslprep        - SASLprep normalization (pg_saslprep)  
  fuzz_parsepgarray    - array literal parser (parsePGArray)  
  fuzz_pgbench_expr    - pgbench expression parser (via Bison/Flex)  
  
Backend targets (link against postgres_lib):  
  fuzz_rawparser       - SQL raw parser (raw_parser)  
  fuzz_regex           - regex engine (pg_regcomp/pg_regexec)  
  fuzz_typeinput       - type input functions (numeric/date/timestamp/interval)  

M meson_options.txt
A src/test/fuzzing/fuzz_b64decode.c
A src/test/fuzzing/fuzz_conninfo.c
A src/test/fuzzing/fuzz_json.c
A src/test/fuzzing/fuzz_json_incremental.c
A src/test/fuzzing/fuzz_parsepgarray.c
A src/test/fuzzing/fuzz_pgbench_expr.c
A src/test/fuzzing/fuzz_pglz.c
A src/test/fuzzing/fuzz_rawparser.c
A src/test/fuzzing/fuzz_regex.c
A src/test/fuzzing/fuzz_saslprep.c
A src/test/fuzzing/fuzz_typeinput.c
A src/test/fuzzing/fuzz_unescapebytea.c
A src/test/fuzzing/meson.build
M src/test/meson.build

Fix heap-buffer-overflow in pglz_decompress() on corrupt input.

commit   : 2b5ba2a0a141f621f61cb732d776dc78269f879b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 11:48:55 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 11:48:55 -0400    

Click here for diff

When decoding a match tag, pglz_decompress() reads 2 bytes (or 3  
for extended-length matches) from the source buffer before checking  
whether enough data remains.  The existing bounds check (sp > srcend)  
occurs after the reads, so truncated compressed data that ends  
mid-tag causes a read past the allocated buffer.  
  
Fix by validating that sufficient source bytes are available before  
reading each part of the match tag.  The post-read sp > srcend  
check is no longer needed and is removed.  
  
Found by fuzz testing with libFuzzer and AddressSanitizer.  

M src/common/pg_lzcompress.c

Fix incremental JSON parser numeric token reassembly across chunks.

commit   : 2478bd5db0aad3599802636201af7adc170ba280    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 07:57:07 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 9 Apr 2026 07:57:07 -0400    

Click here for diff

When the incremental JSON parser splits a numeric token across chunk  
boundaries, it accumulates continuation characters into the partial  
token buffer.  The accumulator's switch statement unconditionally  
accepted '+', '-', '.', 'e', and 'E' as valid numeric continuations  
regardless of position, which violated JSON number grammar  
(-? int [frac] [exp]).  For example, input "4-" fed in single-byte  
chunks would accumulate the '-' into the numeric token, producing an  
invalid token that later triggered an assertion failure during  
re-lexing.  
  
Fix by tracking parser state (seen_dot, seen_exp, prev character)  
across the existing partial token and incoming bytes, so that each  
character class is accepted only in its grammatically valid position.  

M src/common/jsonapi.c

Add test case for same-type reordered FK columns

commit   : 009ea1b08d7b8843435bd0f1137fa3df09aac79f    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 17:44:06 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 17:44:06 +0900    

Click here for diff

The test added in 980c1a85d819 covered reordered FK columns with  
different types, which triggered an "operator not a member of opfamily"  
error in the fast-path prior to that commit.  Add a test for the  
same-type case, which is also fixed by that commit but where the wrong  
scan key ordering instead produced a spurious FK violation without any  
internal error.  
  
Reported-by: Fredrik Widlert <fredrik.widlert@digpro.se>  
Discussion: https://postgr.es/m/CADfhSr8hYc-4Cz7vfXH_oV-Jq81pyK9W4phLrOGspovsg2W7Kw@mail.gmail.com  

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

Move afterTriggerFiringDepth into AfterTriggersData

commit   : d6e96bacd3c05f1a2c1e350d04cc450e91311299    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 16:16:07 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 16:16:07 +0900    

Click here for diff

The static variable afterTriggerFiringDepth introduced by commit  
5c54c3ed1b9 is logically part of the after-trigger state and in  
hindsight should have been a field in AfterTriggersData alongside  
query_depth and the other per-transaction after-trigger state.  
Move it there as firing_depth.  Also update its comment to  
accurately reflect its sole remaining purpose: signaling to  
AfterTriggerIsActive() that after-trigger firing is active.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CA+HiwqFt4NGTNk7BinOsHHM48E9zGAa852vCfGoSe1bbL=JNFQ@mail.gmail.com  

M src/backend/commands/trigger.c

Fix var_is_nonnullable() to account for varreturningtype

commit   : f6936bf9da58afd167787635863bae387ae5ba35    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 10 Apr 2026 15:51:00 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 10 Apr 2026 15:51:00 +0900    

Click here for diff

var_is_nonnullable() failed to consider varreturningtype, which meant  
it could incorrectly claim a Var is non-nullable based on a column's  
NOT NULL constraint even when the Var refers to a non-existent row.  
Specifically, OLD.col is NULL for INSERT (no old row exists) and  
NEW.col is NULL for DELETE (no new row exists), regardless of any NOT  
NULL constraint on the column.  
  
This caused the planner's constant folding in eval_const_expressions  
to incorrectly simplify IS NULL / IS NOT NULL tests on such Vars.  For  
example, "old.a IS NULL" in an INSERT's RETURNING clause would be  
folded to false when column "a" has a NOT NULL constraint, even though  
the correct result is true.  
  
Fix by returning false from var_is_nonnullable() when varreturningtype  
is not VAR_RETURNING_DEFAULT, since such Vars can be NULL regardless  
of table constraints.  
  
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAHg+QDfaAipL6YzOq2H=gAhKBbcUTYmfbAv+W1zueOfRKH43FQ@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/returning.out
M src/test/regress/sql/returning.sql

Assert index_attnos[0] == 1 in ri_FastPathFlushArray()

commit   : 155c03ee9d449589fa93aabcac41d643d03875b9    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 15:24:38 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 15:24:38 +0900    

Click here for diff

ri_FastPathFlushArray() handles single-column FKs only, so  
index_attnos[0] is always 1.  Add an Assert to make this invariant  
explicit, as a followup to 980c1a85d819.  
  
Suggested-by: Junwang Zhao <zhjwpku@gmail.com> (offlist)  
Discussion: https://www.postgresql.org/message-id/CADfhSr-pCkbDxmiOVYSAGE5QGjsQ48KKH_W424SPk%2BpwzKZFaQ%40mail.gmail.com  

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

Fix FK fast-path scan key ordering for mismatched column order

commit   : 980c1a85d819edc72c866001b9ca4fba454900fe    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 13:33:55 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 13:33:55 +0900    

Click here for diff

The fast-path foreign key check introduced in 2da86c1ef9b assumed that  
constraint key positions directly correspond to index column positions.  
This is not always true as a FK constraint can reference PK columns in a  
different order than they appear in the PK's unique index.  
  
For example, if the PK is (a, b, c) and the FK references them as  
(a, c, b), the constraint stores keys in the FK-specified order, but  
the index has columns in PK order. The buggy code used the constraint  
key index to access rd_opfamily[i], which retrieved the wrong operator  
family when columns were reordered, causing "operator X is not a member  
of opfamily Y" errors.  
  
After fixing the opfamily lookup, a second issue started to happen:  
btree index scans require scan keys to be ordered by attribute number.  
The code was placing scan keys at array position i with attribute number  
idx_attno, producing out-of-order keys when columns were swapped. This  
caused "btree index keys must be ordered by attribute" errors.  
  
The fix adds an index_attnos array to FastPathMeta that maps each  
constraint key position to its corresponding index column position.  
In ri_populate_fastpath_metadata(), we search indkey to find the actual  
index column for each pk_attnums[i] and use that position for the  
opfamily lookup. In build_index_scankeys(), we place each scan key at  
the array position corresponding to its index column  
(skeys[idx_attno-1]) rather than at the constraint key position,  
ensuring scan keys are properly ordered by attribute number as btree  
requires.  
  
Reported-by: Fredrik Widlert <fredrik.widlert@digpro.se>  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CADfhSr-pCkbDxmiOVYSAGE5QGjsQ48KKH_W424SPk%2BpwzKZFaQ%40mail.gmail.com  

M src/backend/utils/adt/ri_triggers.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix typo left by 34a30786293

commit   : 03029409b409ffd5c7f2eab9acb13d2fa76fa4bd    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 13:32:38 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 13:32:38 +0900    

Click here for diff

Reported-by: jie wang <jugierwang@gmail.com>  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAJnZyeDyaS=X-eYN=9rDYqK=6ma1gMLa0qDgfNbZKK0e0+q99Q@mail.gmail.com  

M src/backend/commands/trigger.c

Fix RI fast-path crash under nested C-level SPI

commit   : 34a307862930056e1976471d6d81a5e2efc148df    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 12:40:09 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 10 Apr 2026 12:40:09 +0900    

Click here for diff

When a C-language function uses SPI_connect/SPI_execute/SPI_finish to  
INSERT into a table with FK constraints, the FK AFTER triggers fire  
and schedule ri_FastPathEndBatch via  
RegisterAfterTriggerBatchCallback(), opening PK relations under  
CurrentResourceOwner at the time of the SPI call.  The query_depth > 0  
guard in FireAfterTriggerBatchCallbacks suppresses the callback at  
that nesting level, deferring teardown to the outer query's  
AfterTriggerEndQuery. By then the resource owner active during the SPI  
call may have been released, decrementing the cached relations'  
refcounts to zero. ri_FastPathTeardown, running under the outer  
query's resource owner, then crashes in assert builds when it attempts  
to close relations whose refcounts are already zero:  
  
  TRAP: failed Assert("rel->rd_refcnt > 0")  
  
Fix by storing batch callbacks at the level where they should fire:  
in AfterTriggersQueryData.batch_callbacks for immediate constraints  
(fired by AfterTriggerEndQuery) and in AfterTriggersData.batch_callbacks  
for deferred constraints (fired by AfterTriggerFireDeferred and  
AfterTriggerSetState).  RegisterAfterTriggerBatchCallback() routes the  
callback to the current query-level list when query_depth >= 0, and to  
the top-level list otherwise.  FireAfterTriggerBatchCallbacks() takes a  
list parameter and simply iterates and invokes it; memory cleanup is  
handled by the caller.  This replaces the query_depth > 0 guard with  
list-level scoping.  Note that deferred constraints are unaffected by  
this bug: their callbacks fire at commit via AfterTriggerFireDeferred,  
under the outer transaction's resource owner, which remains valid  
throughout.  
  
Also add firing_batch_callbacks to AfterTriggersData to enforce that  
callbacks do not register new callbacks during  
FireAfterTriggerBatchCallbacks(), which would be unsafe as it could  
modify the list being iterated.  An Assert in  
RegisterAfterTriggerBatchCallback() enforces this discipline for  
future callers.  The flag is reset at transaction and subtransaction  
boundaries to handle cases where an error thrown by a callback is  
caught and the subtransaction is rolled back.  
  
While at it, ensure callbacks are properly accounted for at all  
transaction boundaries, as cleanup of b7b27eb41a5c: discard any  
remaining top-level callbacks on both commit and abort in  
AfterTriggerEndXact(), and clean up query-level callbacks in  
AfterTriggerFreeQuery().  
  
Note that ri_PerformCheck() calls SPI with fire_triggers=false, which  
skips AfterTriggerBeginQuery/EndQuery for that SPI command.  Any  
triggers queued during that SPI command are not fired immediately but  
deferred to the outer query level.  Since the fast-path check for  
those triggers runs under the outer query's resource owner rather than  
a nested SPI resource owner, and ri_PerformCheck() does not create  
a dedicated child resource owner, the bug described above does not  
apply.  
  
Reported-by: Evan Montgomery-Recht <montge@mianetworks.net>  
Reported-by: Sandro Santilli <strk@kbt.io>  
Analyzed-by: Evan Montgomery-Recht <montge@mianetworks.net>  
Author: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEg7pwcKf01FmDqFAf-Hzu_pYnMYScY_Otid-pe9uw3BJ6gq9g@mail.gmail.com  

M src/backend/commands/trigger.c

Document new catalog columns, missed in commit 8185bb5347.

commit   : 90630ec42939d074ecc7b6b959b48252eed32646    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 9 Apr 2026 20:29:42 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 9 Apr 2026 20:29:42 -0700    

Click here for diff

Reported-by: "Shinoda, Noriyoshi (PSD Japan FSI)" <noriyoshi.shinoda@hpe.com>  
Co-authored-by: "Shinoda, Noriyoshi (PSD Japan FSI)" <noriyoshi.shinoda@hpe.com>  
Discussion: https://postgr.es/m/LV8PR84MB3787135EBDBF7747A05731F3EE592@LV8PR84MB3787.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

Zero-fill private_data when attaching an injection point

commit   : 5b5bf51e435304b2043db46b65455747de2af1f5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Apr 2026 11:17:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 10 Apr 2026 11:17:09 +0900    

Click here for diff

InjectionPointAttach() did not initialize the private_data buffer of the  
shared memory entry before (perhaps partially) overwriting it.  When the  
private data is set to NULL by the caler, the buffer was left  
uninitialized.  If set, it could have stale contents.  
  
The buffer is initialized to zero, so as the contents recorded when a  
point is attached are deterministic.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0tsGHu2h6YLnVu4HiK05q+gTE_9WVUAqihW2LSscAYS-g@mail.gmail.com  
Backpatch-through: 17  

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

Fix double-free in pg_stat_autovacuum_scores.

commit   : 71ff232a5bc40f36365be985da72b8b6fa275811    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 9 Apr 2026 13:07:06 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 9 Apr 2026 13:07:06 -0500    

Click here for diff

Presently, relation_needs_vacanalyze() unconditionally frees the  
pgstat entry returned by pgstat_fetch_stat_tabentry_ext().  This  
behavior was first added by commit 02502c1bca to avoid memory  
leakage in autovacuum.  While this is fine for autovacuum since it  
forces stats_fetch_consistency to "none", it is not okay for other  
callers that use "cache" or "snapshot".  This manifests as a  
double-free when pg_stat_autovacuum_scores is called multiple times  
in the same transaction.  
  
To fix, add a "bool *may_free" parameter to  
pgstat_fetch_stat_tabentry_ext() that returns whether it is safe  
for the caller to explicitly pfree() the result.  If a caller would  
rather leave it to the memory context machinery to free the result,  
it can pass NULL as the "may_free" argument (or just ignore its  
value).  
  
Oversight in commit 87f61f0c82.  
  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAHewXNkJKdwb3D5OnksrdOqzqUnXUEMpDam1TPW0vfUkW%3D7jUw%40mail.gmail.com  
Discussion: https://postgr.es/m/5684f479-858e-4c5d-b8f5-bcf05de1f909%40gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_subscription.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/test/modules/test_custom_stats/test_custom_var_stats.c

Remove an unstable wait from parallel autovacuum regression test.

commit   : 8030b839d3d2be1038297db852dbe0578c1b46ce    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 9 Apr 2026 09:13:32 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 9 Apr 2026 09:13:32 -0700    

Click here for diff

The test 001_parallel_autovacuum.pl verified that vacuum delay  
parameters are propagated to parallel vacuum workers by using  
injection points. It previously waited for autovacuum to complete on  
the test_autovac table. However, since injection points are  
cluster-wide, an autovacuum worker could be triggered on tables in  
other databases (e.g., template1) and get stuck at the same injection  
point. This could lead to a timeout when the test waits for the  
expected table's autovacuum to finish.  
  
This commit removes the wait for autovacuum completion from this  
specific test case. Since the primary goal is to verify the  
propagation of parameter updates, which is already confirmed via log  
messages, waiting for the entire vacuum process to finish is  
unnecessary and prone to instability in concurrent test environments.  
  
Author:	Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s+kZZRMSF4HW7tZ9W2jS1o4B+Fg8dr5a-T6mANX+mdQA@mail.gmail.com  

M src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl

instrumentation: Avoid CPUID 0x15/0x16 for Hypervisor TSC frequency

commit   : 7fc36c5db55016f7a1d89b5e2efd82fe6fd39632    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 9 Apr 2026 11:50:24 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 9 Apr 2026 11:50:24 -0400    

Click here for diff

This restricts the retrieval of the TSC frequency whilst under a Hypervisor to  
either Hypervisor-specific CPUID registers (0x40000010), or TSC  
calibration. We previously allowed retrieving from the traditional CPUID  
registers for TSC frequency (0x15/0x16) like on bare metal, but it turns out  
that they are not trustworthy when virtualized and can report wildly incorrect  
frequencies, like 7 kHz when the actual calibrated frequencty is 2.5 GHz.  
  
Per report from buildfarm member drongo.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/jr4hk2sxhqcfpb67ftz5g4vw33nm67cgf7go3wwmqsafu5aclq%405m67ukuhyszz  

M src/port/pg_cpu_x86.c

Add LOG_NEVER error level code.

commit   : 60165db6e1f21ec6cbfce4fd8fd1e521a043d954    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 9 Apr 2026 10:18:15 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 9 Apr 2026 10:18:15 -0500    

Click here for diff

This logging level means not to emit the log, which is useful for  
functions like relation_needs_vacanalyze().  This function accepts  
a log level argument but not all callers want it to emit logs.  
  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3101163.1775676098%40sss.pgh.pa.us  

M src/backend/postmaster/autovacuum.c
M src/include/utils/elog.h

Fix integer overflow in nodeWindowAgg.c

commit   : 8b6c89e377b545ddb04fc09eecf89cd52be89e07    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Thu, 9 Apr 2026 19:28:33 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Thu, 9 Apr 2026 19:28:33 +0900    

Click here for diff

In nodeWindowAgg.c, the calculations for frame start and end positions  
in ROWS and GROUPS modes were performed using simple integer addition.  
If a user-supplied offset was sufficiently large (close to INT64_MAX),  
adding it to the current row or group index could cause a signed  
integer overflow, wrapping the result to a negative number.  
  
This led to incorrect behavior where frame boundaries that should have  
extended indefinitely (or beyond the partition end) were treated as  
falling at the first row, or where valid rows were incorrectly marked  
as out-of-frame.  Depending on the specific query and data, these  
overflows can result in incorrect query results, execution errors, or  
assertion failures.  
  
To fix, use overflow-aware integer addition (ie, pg_add_s64_overflow)  
to check for overflows during these additions.  If an overflow is  
detected, the boundary is now clamped to INT64_MAX.  This ensures the  
logic correctly treats the boundary as extending to the end of the  
partition.  
  
Bug: #19405  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/19405-1ecf025dda171555@postgresql.org  
Backpatch-through: 14  

M src/backend/executor/nodeWindowAgg.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Update config.guess and config.sub

commit   : 11d6042337fc064e245081671c47cd9c1ac0d772    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 Apr 2026 11:26:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 9 Apr 2026 11:26:14 +0200    

Click here for diff

M config/config.guess
M config/config.sub

Strip PlaceHolderVars from partition pruning operands

commit   : c1408956e393958cc93ef0dd622de406c7f3b8da    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Thu, 9 Apr 2026 16:41:31 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Thu, 9 Apr 2026 16:41:31 +0900    

Click here for diff

When pulling up a subquery, its targetlist items may be wrapped in  
PlaceHolderVars to enforce separate identity or as a result of outer  
joins.  This causes any upper-level WHERE clauses referencing these  
outputs to contain PlaceHolderVars, which prevents partprune.c from  
recognizing that they match partition key columns, defeating partition  
pruning.  
  
To fix, strip PlaceHolderVars from operands before comparing them to  
partition keys.  A PlaceHolderVar with empty phnullingrels appearing  
in a relation-scan-level expression is effectively a no-op, so  
stripping it is safe.  This parallels the existing treatment in  
indxpath.c for index matching.  
  
In passing, rename strip_phvs_in_index_operand() to strip_noop_phvs()  
and move it from indxpath.c to placeholder.c, since it is now a  
general-purpose utility used by both index matching and partition  
pruning code.  
  
Back-patch to v18.  Although this issue exists before that, changes in  
that version made it common enough to notice.  Given the lack of field  
reports for older versions, I am not back-patching further.  In the  
v18 back-patch, strip_phvs_in_index_operand() is retained as a thin  
wrapper around the new strip_noop_phvs() to avoid breaking third-party  
extensions that may reference it.  
  
Reported-by: Cándido Antonio Martínez Descalzo <candido@ninehq.com>  
Diagnosed-by: David Rowley <dgrowleyml@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAH5YaUwVUWETTyVECTnhs7C=CVwi+uMSQH=cOkwAUqMdvXdwWA@mail.gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/placeholder.c
M src/backend/partitioning/partprune.c
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Add nkeys parameter to recheck_matched_pk_tuple()

commit   : e1cc57fabd6c32fcb740d62da90443f8c708951e    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Thu, 9 Apr 2026 14:45:31 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Thu, 9 Apr 2026 14:45:31 +0900    

Click here for diff

The function looped over ii_NumIndexKeyAttrs elements of the skeys  
array, but one caller (ri_FastPathFlushArray) passes a one-element  
array since it only handles single-column FKs.  The function  
signature did not communicate this constraint, which static analysis  
flags as a potential out-of-bounds read.  
  
Add an nkeys parameter and assert that it matches  
ii_NumIndexKeyAttrs, then use it in the loop.  The call sites  
already know the key count.  
  
Reported-by: Evan Montgomery-Recht <montge@mianetworks.net>  
Discussion: https://postgr.es/m/CAEg7pwcKf01FmDqFAf-Hzu_pYnMYScY_Otid-pe9uw3BJ6gq9g@mail.gmail.com  

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

Reduce presence of syscache.h in src/include/

commit   : e0fa5bd146564d9d05cac15bdcba65b7860d2b91    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 9 Apr 2026 08:49:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 9 Apr 2026 08:49:36 +0900    

Click here for diff

ee642cccc43c has added syscache.h in inval.h and objectaddress.h,  
enlarging by a lot the footprint of this header, particularly via  
objectaddress.h.  A change in syscache.h would cause a lot more files to  
be recompiled.  
  
This commit reduces the presence of syscache.h by switching to a direct  
use of syscache_ids.h in inval.h and objectaddress.h, where the enum  
SysCacheIdentifier is defined.  genbki.pl gains an #ifndef block for  
this header, so as its inclusion is more controlled.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/vlcexdcimsmvu3aplt2yxpfndkgtuvjsrms2fdl46rbw3k2kug@drspkoxlaije  

M src/backend/catalog/genbki.pl
M src/include/catalog/objectaddress.h
M src/include/utils/inval.h

Simplify declaration of memcpy target

commit   : 2cff363715efe3fd2dfbb04f9aa52fd5638f8f0d    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 8 Apr 2026 22:58:56 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 8 Apr 2026 22:58:56 +0200    

Click here for diff

The existing one is understandable failing on (some?) 32-bit platforms.  
  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1c197f2d-49a2-4830-8dde-55867218b62d@vondra.me  

M src/backend/commands/repack.c

doc: Fix data_checksums data type

commit   : b364828f825a5914a21140145186365021ac0bc4    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 8 Apr 2026 22:53:43 +0300    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 8 Apr 2026 22:53:43 +0300    

Click here for diff

Commit f19c0eccae96 changed the data_checksums GUC datatype from a  
boolean to an enum.  This updates the documentation to accurately  
reflect its new type and document the new possible states: 'on',  
'off', 'inprogress-on', and 'inprogress-off'.  
  
Also update the xref for more information to point to the section  
on data checksums rather than the initdb checksum option.  
  
Author: Lakshmi N <lakshmin.jhs@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CA+3i_M-AtTnqTB2KLBTpu-c-jvnTuy7bGxyxs80rgiQLxWrRUQ@mail.gmail.com  

M doc/src/sgml/config.sgml

Add a couple of commits to .git-blame-ignore-revs.

commit   : e0851bded6412641ada14f36072b82d81906ee29    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 8 Apr 2026 13:41:22 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 8 Apr 2026 13:41:22 -0500    

Click here for diff

M .git-blame-ignore-revs

Add missing PGDLLIMPORT markings

commit   : f8eec1ced6979157cbf517b5bbf617b82a01a397    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Apr 2026 15:49:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 8 Apr 2026 15:49:33 +0200    

Click here for diff

M src/include/miscadmin.h
M src/include/portability/instr_time.h

Remove RADIUS support.

commit   : a1643d40b308911cc725e62d3c5f7904b426aa09    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 22:38:43 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 22:38:43 +1200    

Click here for diff

Our RADIUS implementation supported only the deprecated RADIUS/UDP  
variant, without the recommended Message-Authenticator attribute to  
mitigate against the Blast-RADIUS vulnerability.  By now, popular RADIUS  
servers are expected to generate loud warnings or reject our  
authentication attempts outright.  
  
Since there have been no user reports about this, it seems unlikely that  
there are users.  
  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Michael Banck <mbanck@gmx.net>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BSH309V8KECU5%3DxuLP9Dks0v9f9UVS2W74fPAE5O21dg%40mail.gmail.com  

A doc/src/sgml/appendix-obsolete-auth-radius.sgml
M doc/src/sgml/appendix-obsolete.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/filelist.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/libpq/pg_hba.conf.sample
M src/backend/utils/adt/hbafuncs.c
M src/include/libpq/hba.h
M src/tools/pgindent/typedefs.list

Add support for importing statistics from remote servers.

commit   : 28972b6fc3dcd1296e844246b635eddfa29c38e1    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 8 Apr 2026 19:15:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 8 Apr 2026 19:15:00 +0900    

Click here for diff

Add a new FDW callback routine that allows importing remote statistics  
for a foreign table directly to the local server, instead of collecting  
statistics locally.  The new callback routine is called at the beginning  
of the ANALYZE operation on the table, and if the FDW failed to import  
the statistics, the existing callback routine is called on the table to  
collect statistics locally.  
  
Also implement this for postgres_fdw.  It is enabled by "restore_stats"  
option both at the server and table level.  Currently, it is the user's  
responsibility to ensure remote statistics to import are up-to-date, so  
the default is false.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Discussion: https://postgr.es/m/CADkLM%3DchrYAx%3DX2KUcDRST4RLaRLivYDohZrkW4LLBa0iBhb5w%40mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/commands/analyze.c
M src/backend/statistics/extended_stats.c
M src/include/commands/vacuum.h
M src/include/foreign/fdwapi.h
M src/include/statistics/statistics.h
M src/tools/pgindent/typedefs.list

aio: Adjust I/O worker pool automatically.

commit   : d1c01b79d4ae90e52bf9db9c05c9de17b7313e85    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 19:06:14 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 19:06:14 +1200    

Click here for diff

The size of the I/O worker pool used to implement io_method=worker was  
previously controlled by the io_workers setting, defaulting to 3.  It  
was hard to know how to tune it effectively.  That is replaced with:  
  
  io_min_workers=2  
  io_max_workers=8 (up to 32)  
  io_worker_idle_timeout=60s  
  io_worker_launch_interval=100ms  
  
The pool is automatically sized within the configured range according to  
recent variation in demand.  It grows when existing workers detect that  
latency might be introduced by queuing, and shrinks when the  
highest-numbered worker is idle for too long.  Work was already  
concentrated into low-numbered workers in anticipation of this logic.  
  
The logic for waking extra workers now also tries to measure and reduce  
the number of spurious wakeups, though they are not entirely eliminated.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKG%2Bm4xV0LMoH2c%3DoRAdEXuCnh%2BtGBTWa7uFeFMGgTLAw%2BQ%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/aio/method_worker.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/io_worker.h
M src/include/storage/lwlocklist.h
M src/include/storage/pmsignal.h
M src/test/modules/test_aio/t/002_io_workers.pl
M src/tools/pgindent/typedefs.list

Exit early from pg_comp_crc32c_pmull for small inputs

commit   : 948ef7cdc499b5226784a45ef1187ff554bf692a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 8 Apr 2026 13:52:14 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 8 Apr 2026 13:52:14 +0700    

Click here for diff

The vectorized path in commit fbc57f2bc had a side effect of putting  
more branches in the path taken for small inputs. To reduce risk  
of regressions, only proceed with the vectorized path if we can  
guarantee that the remaining input after the alignment preamble is  
greater than 64 bytes. That also allows removing length checks in  
the alignment preamble.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZZ48GuLYhJCcTy8TXysjrMVJL6n1n7NP94=iG+t80YKPw@mail.gmail.com  

M src/port/pg_crc32c_armv8.c

pg_upgrade: Check for unsupported encodings.

commit   : ce11e63f812f987a9d6256b81cd4af91921a5a39    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 17:45:09 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 17:45:09 +1200    

Click here for diff

Since we have dropped MULE_INTERNAL, add a check that all encodings used  
in the source cluster are still supported according to  
PG_ENCODING_BE_VALID().  This is done generically, in case we decide to  
drop another encoding some day.  
  
Suggested-by: Jeff Davis <pgsql@j-davis.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA%2BhUKGKXDXh-FdU0orjfv%2BF08f%3DD91BhV3Ra-4zL-q%2BJmGYqTA%40mail.gmail.com  

M src/bin/pg_upgrade/check.c

Remove MULE_INTERNAL encoding.

commit   : 77645d44e3552ca0690e158ce5c51dc75c4934a4    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 17:40:06 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 8 Apr 2026 17:40:06 +1200    

Click here for diff

This was useful before widespread Unicode adoption, and was based on the  
internal encoding Emacs used to mix multiple sub-encodings.  Emacs  
itself has stopped using it, and our implementation hadn't been updated  
with modern underlying standards.  It is thought to be very unlikely  
that anyone is still using it in the field.  Since such a complex  
encoding comes with costs and risks, we agreed to drop support.  
  
Any existing database using this encoding would need to be dumped and  
restored with a new encoding to upgrade to PostgreSQL 19, most likely  
UTF8, since pg_upgrade would fail.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>  
Reviewed-by: Jeff Davis <pgsql@j-davis.com>  
Discussion: https://postgr.es/m/CA%2BhUKGKXDXh-FdU0orjfv%2BF08f%3DD91BhV3Ra-4zL-q%2BJmGYqTA%40mail.gmail.com  

M doc/src/sgml/charset.sgml
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
R057 src/backend/utils/mb/conversion_procs/latin_and_mic/Makefile src/backend/utils/mb/conversion_procs/cyrillic/Makefile
R080 src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c src/backend/utils/mb/conversion_procs/cyrillic/cyrillic.c
D src/backend/utils/mb/conversion_procs/cyrillic_and_mic/Makefile
D src/backend/utils/mb/conversion_procs/euc_cn_and_mic/Makefile
D src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
D src/backend/utils/mb/conversion_procs/euc_kr_and_mic/Makefile
D src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
D src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/mbutils.c
M src/common/encnames.c
M src/common/wchar.c
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_proc.dat
M src/include/mb/pg_wchar.h
M src/pl/plpython/plpy_util.c
D src/test/mb/expected/mule_internal.out
M src/test/mb/mbregress.sh
D src/test/mb/sql/mule_internal.sql
M src/test/modules/test_escape/test_escape.c
M src/test/regress/expected/conversion.out
M src/test/regress/expected/encoding.out
M src/test/regress/expected/object_address.out
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/regress.c
M src/test/regress/sql/conversion.sql
M src/test/regress/sql/encoding.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/xml.sql

instrumentation: Allocate query level instrumentation in ExecutorStart

commit   : 2c16deee2f7d52d6567dcbad046f74a8e880ee52    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 8 Apr 2026 00:02:26 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 8 Apr 2026 00:02:26 -0400    

Click here for diff

Until now extensions that wanted to measure overall query execution could  
create QueryDesc->totaltime, which the core executor would then start and  
stop.  That's a bit odd and composes badly, e.g. extensions always had to use  
INSTRUMENT_ALL, because otherwise another extension might not get what they  
need.  
  
Instead this introduces a new field, QueryDesc->query_instr_options, that  
extensions can use to indicate whether they need query level instrumentation  
populated, and with which instrumentation options. Extensions should take care  
to only add options they need, instead of replacing the options of others.  
  
The prior name of the field, totaltime, sounded like it would only measure  
time, but these days the instrumentation infrastructure can track more  
resources.  The secondary benefit is that this will make it obvious to  
extensions that they may not create the Instrumentation struct themselves  
anymore (often extensions build only against a postgres build without  
assertions).  
  
Adjust pg_stat_statements and auto_explain to match, and lower the  
requested instrumentation level for auto_explain to INSTRUMENT_TIMER,  
since the summary instrumentation it needs is only runtime.  
  
The reason to push this now, rather in the PG 20 cycle, is that 5a79e78501f  
already required extensions using query level instrumentations to adjust their  
code, and it seemed undesirable to require them to do so again for 20.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53Pkyqsht+exJQYRsjhSWYKu+vFGHhPub7m6PmFD6Or0=p1g@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/executor/execMain.c
M src/backend/tcop/pquery.c
M src/include/executor/execdesc.h

Fix slotsync worker blocking promotion when stuck in wait

commit   : db93032a7cbd30199429167e649e22fab89327ed    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 8 Apr 2026 11:22:21 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 8 Apr 2026 11:22:21 +0900    

Click here for diff

Previously, on standby promotion, the startup process sent SIGUSR1 to  
the slotsync worker (or a backend performing slot synchronization) and  
waited for it to exit. This worked in most cases, but if the process was  
blocked waiting for a response from the primary (e.g., due to a network  
failure), SIGUSR1 would not interrupt the wait. As a result, the process  
could remain stuck, causing the startup process to wait for a long time  
and delaying promotion.  
  
This commit fixes the issue by introducing a new procsignal reason,  
PROCSIG_SLOTSYNC_MESSAGE. On promotion, the startup process  
sends this signal, and the handler sets interrupt flags so the process  
exits (or errors out) promptly at CHECK_FOR_INTERRUPTS(), allowing  
promotion to complete without delay.  
  
Backpatch to v17, where slotsync was introduced.  
  
Author: Nisha Moond <nisha.moond412@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFzNYroAxSoyJhqTU-pH=t4Ej6RyvhVmBZ91Exj_TPMMQ@mail.gmail.com  
Backpatch-through: 17  

M src/backend/replication/logical/slotsync.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/include/replication/slotsync.h
M src/include/storage/procsignal.h

instrumentation: Move ExecProcNodeInstr to allow inlining

commit   : 544000288ec8f7dc6a1e0285821adc47324ecd33    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 21:36:07 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 21:36:07 -0400    

Click here for diff

This moves the implementation of ExecProcNodeInstr, the ExecProcNode variant  
that gets used when instrumentation is on, to be defined in instrument.c  
instead of execProcNode.c, and marks functions it uses as inline.  
  
This allows compilers to generate an optimized implementation, and shows a 4  
to 12% reduction in instrumentation overhead for queries that move lots of  
rows.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com  

M src/backend/executor/execProcnode.c
M src/backend/executor/instrument.c
M src/include/executor/executor.h

Add EXPLAIN (IO) instrumentation for TidRangeScan

commit   : e157fe6f76e0be4f05a725b3099cf53949a2c2af    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 23:25:01 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 23:25:01 +0200    

Click here for diff

Adds support for EXPLAIN (IO) instrumentation for TidRange scans. This  
requires adding shared instrumentation for parallel scans, using the  
separate DSM approach introduced by dd78e69cfc33.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeTidrangescan.c
M src/include/executor/instrument_node.h
M src/include/executor/nodeTidrangescan.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

pg_test_timing: Also test RDTSC[P] timing, report time source, TSC frequency

commit   : 16fca482548382c8d6255319b1c6e5de4afff7f1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 17:08:32 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 17:08:32 -0400    

Click here for diff

This adds support to pg_test_timing for the different timing sources added by  
294520c4448.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Author: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> (in an earlier version)  
Discussion: https://www.postgresql.org/message-id/flat/20200612232810.f46nbqkdhbutzqdg%40alap3.anarazel.de  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/pgtesttiming.sgml
M src/bin/pg_test_timing/pg_test_timing.c
M src/include/portability/instr_time.h

Add EXPLAIN (IO) instrumentation for SeqScan

commit   : 3b1117d6e2e47d86cdbd978b79434c630cb0ef52    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 23:06:43 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 23:06:43 +0200    

Click here for diff

Adds support for EXPLAIN (IO) instrumentation for sequential scans. This  
requires adding shared instrumentation, using the separate DSM approach  
introduced by dd78e69cfc33.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeSeqscan.c
M src/include/executor/instrument_node.h
M src/include/executor/nodeSeqscan.h
M src/include/nodes/execnodes.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql
M src/tools/pgindent/typedefs.list

Suppress unused-variable warning.

commit   : b268928f932cdfb899e96ab28badfe716298483e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2026 17:03:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2026 17:03:20 -0400    

Click here for diff

x86 machines lacking HAVE__CPUIDEX saw a complaint about  
"unused variable 'reg'", per buildfarm as well as local  
experience.  Oversight in bcb2cf41f.  

M src/port/pg_cpu_x86.c

auto_explain: Add new GUC auto_explain.log_io

commit   : 61c36a34a4196bfe1ce80b376e5979020bc571b2    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:49:42 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:49:42 +0200    

Click here for diff

Allows enabling the new EXPLAIN "IO" option for auto_explain.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M contrib/auto_explain/auto_explain.c
M doc/src/sgml/auto-explain.sgml

Add EXPLAIN (IO) infrastructure with BitmapHeapScan support

commit   : 681daed93169ff5bed2796dd5c8c76ee2fae1ebd    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:33:32 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:33:32 +0200    

Click here for diff

Allows collecting details about AIO / prefetch for scan nodes backed by  
a ReadStream. This may be enabled by a new "IO" option in EXPLAIN, and  
it shows information about the prefetch distance and I/O requests.  
  
As of this commit this applies only to BitmapHeapScan, because that's  
the only scan node using a ReadStream and collecting instrumentation  
from workers in a parallel query. Support for SeqScan and TidRangeScan,  
the other scan nodes using ReadStream, will be added in subsequent  
commits.  
  
The stats are collected only when required by EXPLAIN ANALYZE, with the  
IO option (disabled by default). The amount of collected statistics is  
very limited, but we don't want to clutter EXPLAIN with too much data.  
  
The IOStats struct is stored in the scan descriptor as a field, next to  
other fields used by table AMs. A pointer to the field is passed to the  
ReadStream, and updated directly.  
  
It's the responsibility of the table AM to allocate the struct (e.g. in  
ambeginscan) whenever the flag SO_SCAN_INSTRUMENT flag is passed to the  
scan, so that the executor and ReadStream has access to it.  
  
The collected stats are designed for ReadStream, but are meant to be  
reasonably generic in case a TAM manages I/Os in different ways.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M doc/src/sgml/ref/explain.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/explain.c
M src/backend/commands/explain_state.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/storage/aio/read_stream.c
M src/include/access/relscan.h
M src/include/access/tableam.h
M src/include/commands/explain_state.h
M src/include/executor/instrument.h
M src/include/executor/instrument_node.h
M src/include/storage/read_stream.h
M src/tools/pgindent/typedefs.list

Switch EXPLAIN to unaligned output for json/xml/yaml

commit   : 10d5a12a93150deb15f600492bbd4e46a2212b3b    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:12:26 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 22:12:26 +0200    

Click here for diff

Use unaligned output for multiple EXPLAIN queries using non-text format  
in regression tests. With aligned output adding/removing explain fields  
can be very disruptive, as it often modifies the whole block because of  
padding. Unaligned output does not have this issue.  
  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

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

Fix WITHOUT OVERLAPS' interaction with domains.

commit   : 4edd6036d69ce42ac1af236f659f20daed65c8d4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2026 14:45:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 7 Apr 2026 14:45:33 -0400    

Click here for diff

UNIQUE/PRIMARY KEY ... WITHOUT OVERLAPS requires the no-overlap  
column to be a range or multirange, but it should allow a domain  
over such a type too.  This requires minor adjustments in both  
the parser and executor.  
  
In passing, fix a nearby break-instead-of-continue thinko in  
transformIndexConstraint.  This had the effect of disabling  
parse-time validation of the no-overlap column's type in the context  
of ALTER TABLE ADD CONSTRAINT, if it follows a dropped column.  
We'd still complain appropriately at runtime though.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CACJufxGoAmN_0iJ=hjTG0vGpOSOyy-vYyfE+-q0AWxrq2_p5XQ@mail.gmail.com  
Backpatch-through: 18  

M src/backend/executor/execIndexing.c
M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/without_overlaps.out
M src/test/regress/sql/without_overlaps.sql

instrumentation: Use Time-Stamp Counter on x86-64 to lower overhead

commit   : 294520c44487ecaade7a6ea8781b973f9ed03909    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    

Click here for diff

This allows the direct use of the Time-Stamp Counter (TSC) value retrieved  
from the CPU using RDTSC/RDTSCP instructions, instead of APIs like  
clock_gettime() on POSIX systems.  
  
This reduces the overhead of EXPLAIN with ANALYZE and TIMING ON. Tests showed  
that the overhead on top of actual runtime when instrumenting queries moving  
lots of rows through the plan can be reduced from 2x as slow to 1.2x as slow  
compared to the actual runtime. More complex workloads such as TPCH queries  
have also shown ~20% gains when instrumented compared to before.  
  
To control use of the TSC, the new "timing_clock_source" GUC is introduced,  
whose default ("auto") automatically uses the TSC when reliable, for example  
when running on modern Intel CPUs, or when running on Linux and the system  
clocksource is reported as "tsc". The use of the operating system clock source  
can be enforced by setting "system", or on x86-64 architectures the use of TSC  
can be enforced by explicitly setting "tsc".  
  
In order to use the TSC the frequency is first determined by use of CPUID, and  
if not available, by running a short calibration loop at program start,  
falling back to the system clock source if TSC values are not stable.  
  
Note, that we split TSC usage into the RDTSC CPU instruction which does not  
wait for out-of-order execution (faster, less precise) and the RDTSCP  
instruction, which waits for outstanding instructions to retire. RDTSCP is  
deemed to have little benefit in the typical InstrStartNode() /  
InstrStopNode() use case of EXPLAIN, and can be up to twice as slow. To  
separate these use cases, the new macro INSTR_TIME_SET_CURRENT_FAST() is  
introduced, which uses RDTSC.  
  
The original macro INSTR_TIME_SET_CURRENT() uses RDTSCP and is supposed to be  
used when precision is more important than performance. When the system timing  
clock source is used both of these macros instead utilize the system  
APIs (clock_gettime / QueryPerformanceCounter) like before.  
  
Additional users of interval timing, such as track_io_timing and  
track_wal_io_timing could also benefit from being converted to use  
INSTR_TIME_SET_CURRENT_FAST() but are left for future changes.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com> (in an earlier version)  
Reviewed-by: Maciek Sakrejda <m.sakrejda@gmail.com> (in an earlier version)  
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (in an earlier version)  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com> (in an earlier version)  
Discussion: https://postgr.es/m/20200612232810.f46nbqkdhbutzqdg@alap3.anarazel.de  

M doc/src/sgml/config.sgml
M src/backend/executor/instrument.c
M src/backend/postmaster/launch_backend.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/common/instr_time.c
M src/include/portability/instr_time.h
M src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/tools/pgindent/typedefs.list

Allow retrieving x86 TSC frequency/flags from CPUID

commit   : bcb2cf41f964e9ed4d27abe4dee8daa249f659bb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    

Click here for diff

This adds additional x86 specific CPUID checks for flags needed for  
determining whether the Time-Stamp Counter (TSC) is usable on a given system,  
as well as a helper function to retrieve the TSC frequency from CPUID.  
  
This is intended for a future patch that will utilize the TSC to lower the  
overhead of timing instrumentation.  
  
In passing, always make pg_cpuid_subleaf reset the variables used for its  
result, to avoid accidentally using stale results if __get_cpuid_count errors  
out and the caller doesn't check for it.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Author: David Geier <geidav.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: John Naylor <john.naylor@postgresql.org>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com> (in an earlier version)  
Discussion: https://www.postgresql.org/message-id/flat/20200612232810.f46nbqkdhbutzqdg%40alap3.anarazel.de  

M src/include/port/pg_cpu.h
M src/port/pg_cpu_x86.c

instrumentation: Standardize ticks to nanosecond conversion method

commit   : 0022622c93d9e6419cb47110c58af87a74994ea6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 12:48:07 -0400    

Click here for diff

The timing infrastructure (INSTR_* macros) measures time elapsed using  
clock_gettime() on POSIX systems, which returns the time as nanoseconds,  
and QueryPerformanceCounter() on Windows, which is a specialized timing  
clock source that returns a tick counter that needs to be converted to  
nanoseconds using the result of QueryPerformanceFrequency().  
  
This conversion currently happens ad-hoc on Windows, e.g. when calling  
INSTR_TIME_GET_NANOSEC, which calls QueryPerformanceFrequency() on every  
invocation, despite the frequency being stable after program start,  
incurring unnecessary overhead. It also causes a fractured implementation  
where macros are defined differently between platforms.  
  
To ease code readability, and prepare for a future change that intends  
to use a ticks-to-nanosecond conversion on x86-64 for TSC use, introduce  
new pg_ticks_to_ns() / pg_ns_to_ticks() functions that get called from  
INSTR_* macros on all platforms.  
  
These functions rely on a separately initialized ticks_per_ns_scaled  
value, that represents the conversion ratio. This value is initialized  
from QueryPerformanceFrequency() on Windows, and set to zero on x86-64  
POSIX systems, which results in the ticks being treated as nanoseconds.  
Other architectures always directly return the original ticks.  
  
To support this, pg_initialize_timing() is introduced, and is now  
mandatory for both the backend and any frontend programs to call before  
utilizing INSTR_* macros.  
  
In passing, fix variable names in comment documenting INSTR_TIME_ADD_NANOSEC().  
  
Author: Lukas Fittl <lukas@fittl.com>  
Author: David Geier <geidav.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://www.postgresql.org/message-id/flat/20200612232810.f46nbqkdhbutzqdg%40alap3.anarazel.de  

M src/backend/postmaster/postmaster.c
M src/bin/pg_test_timing/pg_test_timing.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/startup.c
M src/common/Makefile
A src/common/instr_time.c
M src/common/meson.build
M src/include/portability/instr_time.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/pg_regress.c
M src/test/regress/regress.c
M src/test/regress/sql/misc_functions.sql

oauth: Allow validators to register custom HBA options

commit   : b977bd308a09e8a70db1776db80e8abd84ca2b7e    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 7 Apr 2026 08:15:19 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 7 Apr 2026 08:15:19 -0700    

Click here for diff

OAuth validators can already use custom GUCs to configure behavior  
globally. But we currently provide no ability to adjust settings for  
individual HBA entries, because the original design focused on a world  
where a provider covered a "single audience" of users for one database  
cluster. This assumption does not apply to multitenant use cases, where  
a single validator may be controlling access for wildly different user  
groups.  
  
To improve this use case, add two new API calls for use by validator  
callbacks: RegisterOAuthHBAOptions() and GetOAuthHBAOption().  
Registering options "foo" and "bar" allows a user to set "validator.foo"  
and "validator.bar" in an oauth HBA entry. These options are stringly  
typed (syntax validation is solely the responsibility of the defining  
module), and names are restricted to a subset of ASCII to avoid tying  
our hands with future HBA syntax improvements.  
  
Unfortunately, we can't check the custom option names during a reload of  
the configuration, like we do with standard HBA options, without  
requiring all validators to be loaded via shared_preload_libraries.  
(I consider this to be a nonstarter: most validators should probably use  
session_preload_libraries at most, since requiring a full restart just  
to update authentication behavior will be unacceptable to many users.)  
Instead, the new validator.* options are checked against the registered  
list at connection time.  
  
Multiple alternatives were proposed and/or prototyped, including  
extending the GUC system to allow per-HBA overrides, joining forces with  
recent refactoring work on the reloptions subsystem, and giving the  
ability to customize HBA options to all PostgreSQL extensions. I  
personally believe per-HBA GUC overrides are the best option, because  
several existing GUCs like authentication_timeout and pre_auth_delay  
would fit there usefully. But the recent addition of SNI per-host  
settings in 4f433025f indicates that a more general solution is needed,  
and I expect that to take multiple releases' worth of discussion.  
  
This compromise patch, then, is intentionally designed to be an  
architectural dead end: simple to describe, cheap to maintain, and  
providing just enough functionality to let validators move forward for  
PG19. The hope is that it will be replaced in the future by a solution  
that can handle per-host, per-HBA, and other per-context configuration  
with the same functionality that GUCs provide today. In the meantime,  
the bulk of the code in this patch consists of strict guardrails on the  
simple API, to try to ensure that we don't have any reason to regret its  
existence during its unknown lifespan.  
  
I owe particular thanks here to Zsolt Parragi, who prototyped several  
approaches that guided the final design.  
  
Suggested-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Suggested-by: VASUKI M <vasukianand0119@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAN4CZFM3b8u5uNNNsY6XCya257u%2BDofms3su9f11iMCxvCacag%40mail.gmail.com  

M doc/src/sgml/client-auth.sgml
M doc/src/sgml/oauth-validators.sgml
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h
M src/include/libpq/oauth.h
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/validator.c

libpq: Split PGOAUTHDEBUG=UNSAFE into multiple options

commit   : 6d00fb9048fe61381c9f4d542cfd2bc767d95a3b    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 7 Apr 2026 08:15:14 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 7 Apr 2026 08:15:14 -0700    

Click here for diff

PGOAUTHDEBUG is a blunt instrument: you get all the debugging features,  
or none of them. The most annoying consequence during manual use is the  
Curl debug trace, which tends to obscure the device flow prompt  
entirely. The promotion of PGOAUTHCAFILE into its own feature in  
993368113 improved the situation somewhat, but there's still the  
discomfort of knowing you have to opt into many dangerous behaviors just  
to get the single debug feature you wanted.  
  
Explode the PGOAUTHDEBUG syntax into a comma-separated list. The old  
"UNSAFE" value enables everything, like before. Any individual unsafe  
features still require the envvar to begin with an "UNSAFE:" prefix, to  
try to interrupt the flow of someone who is about to do something they  
should not.  
  
So now, rather than  
  
    PGOAUTHDEBUG=UNSAFE        # enable all the unsafe things  
  
a developer can say  
  
    PGOAUTHDEBUG=call-count    # only show me the call count. safe!  
    PGOAUTHDEBUG=UNSAFE:trace  # print secrets, but don't allow HTTP  
  
To avoid adding more build system scaffolding to libpq-oauth, implement  
this entirely in a small private header. This unfortunately can't be  
standalone, so it needs a headerscheck exception.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2B%3DfbZNJSkHVci%3DGpR8XPYObK%3DH%2B2ERRha0LDTS%2BifsWnw%40mail.gmail.com  
Discussion: https://postgr.es/m/CAN4CZFMmDZMH56O9vb_g7vHqAk8ryWFxBMV19C39PFghENg8kA%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq-oauth/oauth-utils.c
M src/interfaces/libpq-oauth/oauth-utils.h
M src/interfaces/libpq-oauth/test-oauth-curl.c
M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h
A src/interfaces/libpq/oauth-debug.h
M src/test/modules/oauth_validator/t/001_server.pl
M src/tools/pginclude/headerscheck

Reserve replication slots specifically for REPACK

commit   : e76d8c749c3152657711ed733f0aea61c0e36a91    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 16:55:29 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 16:55:29 +0200    

Click here for diff

Add a new GUC max_repack_replication_slots, which lets the user reserve  
some additional replication slots for concurrent repack (and only  
concurrent repack).  With this, the user doesn't have to worry about  
changing the max_replication_slots in order to cater for use of  
concurrent repack.  
  
(We still use the same pool of bgworkers though, but that's less  
commonly a problem than slots.)  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Discussion: https://postgr.es/m/202604012148.nnnmyxxrr6nh@alvherre.pgsql  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/repack.sgml
M src/backend/commands/repack_worker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/logical.h
M src/include/replication/slot.h

Fix harmless leftover in _hash_kill_items()

commit   : 979387f1885111c72b84af535f23de4e3e913206    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 17:38:11 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 17:38:11 +0300    

Click here for diff

Checking for 'havePin' is sufficient here. An earlier version of the  
patch didn't have the 'havePin' variable and used  
'so->hashso_bucket_buf == so->currPos.buf' as the condition when both  
locking and unlocking the page. The havePin variable was added later  
during development, but the unlocking condition wasn't fully  
updated. Tidy it up.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/b9de8d05-3b02-4a27-9b0b-03972fa4bfd3@iki.fi  

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

Add errdetail() with PID and UID about source of termination signal.

commit   : 55890a919454a2165031a04b175ca92e3ed70e69    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 6 Apr 2026 12:39:14 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 6 Apr 2026 12:39:14 -0400    

Click here for diff

When a backend is terminated via pg_terminate_backend() or an external  
SIGTERM, the error message now includes the sender's PID and UID as  
errdetail, making it easier to identify the source of unexpected  
terminations in multi-user environments.  
  
On platforms that support SA_SIGINFO (Linux, FreeBSD, and most modern  
Unix systems), the signal handler captures si_pid and si_uid from the  
siginfo_t structure.  On platforms without SA_SIGINFO, the detail is  
simply omitted.  
  
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Chao Li <1356863904@qq.com>  
Discussion: https://postgr.es/m/CAKZiRmyrOWovZSdixpLd3PGMQXuQL_zw2Ght5XhHCkQ1uDsxjw@mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/backend/replication/syncrep.c
M src/backend/tcop/postgres.c
M src/backend/utils/init/globals.c
M src/bin/psql/t/001_basic.pl
M src/include/miscadmin.h
M src/include/pg_config.h.in
M src/port/pqsignal.c

pg_stash_advice: Allow stashed advice to be persisted to disk.

commit   : c10edb102ada607eb054bc9e23690109d86849ef    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Apr 2026 10:11:25 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 7 Apr 2026 10:11:25 -0400    

Click here for diff

If pg_stash_advice.persist = true, stashed advice will be written to  
pg_stash_advice.tsv in the data directory, periodically and at  
shutdown. On restart, stash modifications are locked out until this  
file has been reloaded, but queries will not be, so there may be a  
short window after startup during which previously-stashed advice is  
not automatically applied.  
  
Author: Robert Haas <rhaas@postgresql.org>  
Co-authored-by: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/CA+Tgmob87qsWa-VugofU6epuV0H5XjWZGMbQas4Q-ADKmvSyBg@mail.gmail.com  

M contrib/pg_stash_advice/Makefile
M contrib/pg_stash_advice/meson.build
M contrib/pg_stash_advice/pg_stash_advice–1.0.sql
M contrib/pg_stash_advice/pg_stash_advice.c
M contrib/pg_stash_advice/pg_stash_advice.h
M contrib/pg_stash_advice/stashfuncs.c
A contrib/pg_stash_advice/stashpersist.c
A contrib/pg_stash_advice/t/001_persist.pl
M doc/src/sgml/pgstashadvice.sgml
M src/tools/pgindent/typedefs.list

Minimal fix for WAIT FOR ... MODE 'standby_flush'

commit   : 29e7dbf5e4daa8fafc2b18a1551e7b31c8847340    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 09:11:07 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 7 Apr 2026 09:11:07 -0400    

Click here for diff

The investigation into the negative test performance impact of 7e8aeb9e483  
lead to discovering that there are a few issues with WAIT FOR.  
  
This commit is just a minimal fix to prevent hangs in standby_flush mode, due  
to WAIT FOR ... 'standby_flush' seeing a 0 LSN if a newly started walreceiver  
does not receive any writes, because the stanby is already caught up.  
  
There are several other issues and this is isn't necessarily the best fix. But  
this way we get the hangs out of the way.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/zqbppucpmkeqecfy4s5kscnru4tbk6khp3ozqz6ad2zijz354k@w4bdf4z3wqoz  

M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c

doc: Add an example of REPACK (CONCURRENTLY)

commit   : 8fb95a8ab6e511c049066a03fe9b81fe83ff937b    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 15:33:55 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 15:33:55 +0200    

Click here for diff

Suggested-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm3tiKhtegx5Cawi34UjbHmNGEDNAtScGM1RgWRtV-5_0Q@mail.gmail.com  

M doc/src/sgml/ref/repack.sgml

Tidy up #ifdef USE_INJECTION_POINTS guards

commit   : 9480c585df6cdb33c542c4a2cac26a341a54afd4    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 16:18:31 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 16:18:31 +0300    

Click here for diff

Remove unnecessary #ifdef guard around the function prototypes; they  
are already inside a larger #ifdef block. Move #include "subsystems.h"  
inside the USE_INJECTION_POINTS guard; it's needed for  
InjectionPointShmemCallbacks, which is a also inside the guard.  
  
Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Discussion: https://www.postgresql.org/message-id/87y0iz2c1v.fsf@wibble.ilmari.org  

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

Fix tests under wal_level=minimal

commit   : be142fa008ade51bb579a5990b43d55bab743194    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 15:14:32 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 15:14:32 +0200    

Click here for diff

Buildfarm members which have specifically configured to use  
wal_level=minimal fail the repack regression tests, which require  
wal_level=replica.  Add a temp config file to fix that.  

M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/extra.conf
M src/test/modules/injection_points/meson.build

Modernize and optimize pg_buffercache_pages()

commit   : 257c8231bf97a77378f6fedb826b1243f0a41612    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 16:04:48 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 16:04:48 +0300    

Click here for diff

Refactor pg_buffercache_pages() to use SFRM_Materialize mode and  
construct a tuplestore directly. That's simpler and more efficient  
than collecting all the data to a custom array first.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Author: Palak Chaturvedi <chaturvedipalak1911@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5sMsaz1j+hrdhyo-DJp7JCgJx87=q2iJfOc_9mwYWyvmw@mail.gmail.com  

M contrib/pg_buffercache/pg_buffercache_pages.c

Optimize sorting and deduplicating trigrams

commit   : 9f3755ea07aa8858999bdac3d33151e93d2643e2    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 14:11:25 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 14:11:25 +0300    

Click here for diff

Use templated qsort() so that the comparison function can be  
inlined. To speed up qunique(), use a specialized comparison function  
that only checks for equality.  
  
Author: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com  

M contrib/pg_trgm/trgm_op.c

Use add_size/mul_size for index instrumentation size calculations

commit   : 884f9b3c762f987ed6073303b597c110a4102fb7    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 12:47:26 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 12:47:26 +0200    

Click here for diff

Use overflow-safe size arithmetic in the Index[Only]Scan and parallel  
instrumentation functions, consistent with other executor nodes (Hash,  
Sort, Agg, Memoize). This was an oversight in dd78e69cfc3.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c

Fix BitmapHeapScan non-parallel-aware EXPLAIN ANALYZE

commit   : 9c18b47e61071cf1395620f182b07a7ab9aac263    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 12:47:04 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 7 Apr 2026 12:47:04 +0200    

Click here for diff

Allocates shared bitmap table scan instrumentation for all parallel  
scans. Previously, the instrumentation was only allocated for  
parallel-aware scans, other bitmap heap scans in the parallel query had  
no shared instrumentation and EXPLAIN didn't report exact/lossy pages.  
This affected cases like scans on the outside of a parallel join or  
queries run with debug_parallel_query=regress.  
  
Fixed by allocating a separate DSM chunk for shared instrumentation and  
doing so regardless of parallel-awareness. The instrumentation is  
allocated in its own DSM chunk, separate from ParallelBitmapHeapState.  
  
Report an initial patch by me. The approach with a separate DSM was  
proposed and implemented by Melanie.  
  
Not backpatched. The issue affects Postgres 18 (since 5a1e6df3b84c), but  
having multiple DSM chunks is possible only since dd78e69cfc33. If we  
decide to fix this in backbranches too, it will need to be done in a  
less invasive way.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/include/executor/nodeBitmapHeapscan.h

Allow logical replication snapshots to be database-specific

commit   : 0d3dba38c777384a9dd7dffe924355c9683a6b71    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 12:31:18 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 12:31:18 +0200    

Click here for diff

By default, the logical decoding assumes access to shared catalogs, so  
the snapshot builder needs to consider cluster-wide XIDs during startup.  
That in turn means that, if any transaction is already running (and has  
XID assigned), the snapshot builder needs to wait for its completion, as  
it does not know if that transaction performed catalog changes earlier.  
  
A possible problem with this concept is that if REPACK (CONCURRENTLY) is  
running in some database, backends running the same command in other  
databases get stuck until the first one has committed. Thus only a  
single backend in the cluster can run REPACK (CONCURRENTLY) at any time.  
Likewise, REPACK (CONCURRENTLY) can block walsenders starting on behalf  
of subscriptions throughout the cluster.  
  
This patch adds a new option to logical replication output plugin, to  
declare that it does not use shared catalogs (i.e. catalogs that can be  
changed by transactions running in other databases in the cluster). In  
that case, no snapshot the backend will use during the decoding needs to  
contain information about transactions running in other databases. Thus  
the snapshot builder only needs to wait for completion of transactions  
in the current database.  
  
Currently we only use this option in the REPACK background worker. It  
could possibly be used in the plugin for logical replication too,  
however that would need thorough analysis of that plugin.  
  
Bump WAL version number, due to a new field in xl_running_xacts.  
  
Author: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/90475.1775218118@localhost  

M contrib/pg_visibility/pg_visibility.c
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/index/genam.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/postmaster/bgwriter.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/pgrepack/pgrepack.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/access/xlog_internal.h
M src/include/miscadmin.h
M src/include/replication/output_plugin.h
M src/include/replication/snapbuild.h
M src/include/storage/procarray.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h

Avoid different-size pointer-to-integer cast

commit   : a3b069ef90bd3a7278920b4ea5255e019f202d5d    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 12:28:05 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 12:28:05 +0200    

Click here for diff

Buildfarm member mamba is unhappy that I wrote "(Datum) NULL" in commit  
28d534e2ae0a:  
  https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2026-04-07%2005%3A08%3A08  
Use "(Datum) 0" which is what we do everywhere else.  
  
Discussion: https://postgr.es/m/CANWCAZaOs_+WPH13ow33Q==+FwBwVZkqzm4vND=WEB4_NBmv1Q@mail.gmail.com  

M src/backend/commands/repack.c

Optimize sort and deduplication in ginExtractEntries()

commit   : 6f5ad00ab763f9e029ec591f7f650bd09c1e933f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 13:26:39 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 7 Apr 2026 13:26:39 +0300    

Click here for diff

Remove NULLs from the array first, and use qsort to deduplicate only  
the non-NULL items. This simplifies the comparison function. Also  
replace qsort_arg() with a templated version so that the comparison  
function can be inlined. These changes make ginExtractEntries() a  
little faster especially for simple datatypes like integers.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/6d16b6bd-a1ff-4469-aefb-a1c8274e561a@iki.fi  

M src/backend/access/gin/ginutil.c
M src/include/access/gin_private.h

Add isolation tests for UPDATE/DELETE FOR PORTION OF

commit   : b6ccd30d8ff6422ad0f79ce2fc801f2437d90664    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 7 Apr 2026 11:07:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 7 Apr 2026 11:07:59 +0200    

Click here for diff

Add documentation about concurrency issues related to UPDATE/DELETE  
FOR PORTION OF as well as supporting isolation tests.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024%40illuminatedcomputing.com  

M doc/src/sgml/dml.sgml
M doc/src/sgml/images/Makefile
M doc/src/sgml/images/meson.build
A doc/src/sgml/images/temporal-isolation.svg
A doc/src/sgml/images/temporal-isolation.txt
M src/backend/executor/nodeModifyTable.c
A src/test/isolation/expected/for-portion-of.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/for-portion-of.spec

Fix valgrind failure

commit   : 5bcc3fbd196ccbec55c2ce6b58d6946f06cf6213    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 11:13:16 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 7 Apr 2026 11:13:16 +0200    

Click here for diff

Buildfarm member skink reports that the new REPACK code is trying to  
write uninitialized bytes to disk, which correspond to padding space in  
the SerializedSnapshotData struct.  Silence that by initializing the  
memory in SerializeSnapshot() to all zeroes.  
  
Co-authored-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/1976915.1775537087@sss.pgh.pa.us  

M src/backend/commands/repack_worker.c
M src/backend/utils/time/snapmgr.c

Use .h for the file containing the page checksum code fragment

commit   : 8c3e22a8f8b9af94b519b6e223db0912d552093e    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 15:52:55 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 15:52:55 +0700    

Click here for diff

Commit 5e13b0f24 used a .c file for a file containing a code fragment,  
to avoid adding an exception to headerscheck. That turned out to be  
too clever, since it meant installation didn't happen by the usual  
mechanism. Make it look like a normal header and add the requisite  
exception.  
  
Bug: #19450  
Reported-by: RekGRpth <rekgrpth@gmail.com>  
Discussion: https://postgr.es/m/19450-bb0612c50c6786e5@postgresql.org  

M src/backend/storage/page/checksum.c
R088 src/include/storage/checksum_block.inc.c src/include/storage/checksum_block_internal.h
M src/include/storage/checksum_impl.h
M src/tools/pginclude/headerscheck

Simplify SortSupport for the macaddr data type

commit   : 30229be755e703cf23fd73e95c5a515f9011cb5a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 13:29:27 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 13:29:27 +0700    

Click here for diff

As of commit 6aebedc38 Datums are 64-bit values. Since MAC addresses  
have only 6 bytes, the abbreviated key always contains the entire  
MAC address and is thus authoritative (for practical purposes -- the  
tuple sort machinery has no way of knowing that). Abbreviating this  
datatype is cheap, and aborting abbreviation prevents optimizations  
like radix sort, so remove cardinality estimation.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CAJ7c6TMk10rF_LiMz6j9rRy1rqk-5s+wBPuBefLix4cY+-4s1w@mail.gmail.com  

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

Mark JumbleState as a const in the post_parse_analyze hook

commit   : 49cc0d41488b92a1d547e278b459c3b224393c8f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 15:22:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 15:22:49 +0900    

Click here for diff

This commit changes the post_parse_analyze_hook_type() hook to take a  
const JumbleState, to tell external modules that they are not allowed to  
touch the JumbleState that has been compiled by the core code.  This  
fixes a pretty old problem with pg_stat_statements, that had always the  
idea of modifying the lengths of the constants stored in the  
JumbleState.  The previous state could confuse extensions that need to  
look at a JumbleState depending on the loading order, if  
pg_stat_statements is part of the stack loaded.  
  
Another piece included in this commit is the move of the routine  
fill_in_constant_lengths() to queryjumblefuncs.c, to give an option to  
extensions to compile the lengths of the constants, if necessary.  I was  
surprised by the number of external code that carries a copy of this  
routine (see the thread for details).  Previously, this routine modified  
JumbleState.  It now copies the set of LocationLens from JumbleState,  
and fills the constant lengths for separate use.  
  
pg_stat_statements is updated to use the new ComputeConstantLengths().  
JumbleState is now marked with a const in the module, where relevant.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Co-authored-by: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/CAA5RZ0tZp5qU0ikZEEqJnxvdSNGh1DWv80sb-k4QAUmiMoOp_Q@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/nodes/queryjumblefuncs.c
M src/include/nodes/queryjumble.h
M src/include/parser/analyze.h

Split CREATE STATISTICS error reasons out into errdetails

commit   : 51098839cfb40dc496bb48fe4ea14d19170099ac    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 11:37:48 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 7 Apr 2026 11:37:48 +0700    

Click here for diff

Some errmsgs in statscmds.c were phrased as "...cannot be used  
because...". Put the reasons into errdetails. While at it, switch  
from passive voice to "cannot create..." for the errmsg.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZaZeX0omWNh_ZbD_JVujzYQdRUW8UZOQ4dWh9Sg7OcAow@mail.gmail.com  

M src/backend/commands/statscmds.c
M src/test/regress/expected/stats_ext.out

Fix injection point detach timing problem in TAP test for lock stats

commit   : 3284e3f63cf0b42a1c89bb547778754d72aac9e4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 13:17:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 13:17:13 +0900    

Click here for diff

injection_points_detach() could fail because of a concurrent cleanup  
triggered by injection_points_set_local() when a session finishes.  
This problem could be reproduced by adding a hardcoded sleep in  
InjectionPointDetach(), and has been detected by the CI.  
  
As the test is designed so as the injection point is detached before  
being awaken, there is no need for it to be local, similarly to test  
010_index_concurrently_upsert.  This commit removes  
injection_points_set_local(), replacing it with a confirmation that the  
point has been attached in the session expected to block on a lock.  
With this removal, the detach cannot happen concurrently anymore, only  
before when the point is woken up.  
  
Issue introduced by 557a9f1e3e62, where the test has been added.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/rp6wz4lnz5qn4zlh7uxtavzfrmqvycy2g42z4zasfss2gxi54f@zzcsjdvdflwp  

M src/test/modules/test_misc/t/011_lock_stats.pl

Fix shmem allocation of fixed-sized custom stats kind

commit   : 17132f55c5a2c04743edec20655cc7123ce08713    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 11:59:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 11:59:49 +0900    

Click here for diff

StatsShmemSize(), that computes the shmem size needed for pgstats,  
includes the amount of shared memory wanted by all the custom stats  
kinds registered.  However, the shared memory allocation was done by  
ShmemAlloc() in StatsShmemInit(), meaning that the space reserved was  
not used, wasting some memory.  
  
These extra allocations would show up under "<anonymous>" in  
pg_shmem_allocations, as the allocations done by ShmemAlloc() are not  
tracked by ShmemIndexEnt.  
  
Issue introduced by 7949d9594582.  
  
Author: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/04b04387-92f5-476c-90b0-4064e71c5f37@iki.fi  
Backpatch-through: 18  

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

Fix deferred FK check batching introduced by commit b7b27eb41a5

commit   : 5c54c3ed1b934a35a8e9eacff679699ccb3a5070    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Tue, 7 Apr 2026 08:36:49 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Tue, 7 Apr 2026 08:36:49 +0900    

Click here for diff

That commit introduced AfterTriggerIsActive() to detect whether  
we are inside the after-trigger firing machinery, so that RI trigger  
functions can take the batched fast path.  It was implemented using  
query_depth >= 0, which correctly identified immediate trigger firing  
but missed the deferred case where query_depth is -1 at COMMIT via  
AfterTriggerFireDeferred().  This caused deferred FK checks to fall  
back to the per-row fast path instead of the batched path.  
  
The correct check is whether we are inside an after-trigger firing  
loop specifically.  Introduce afterTriggerFiringDepth, a counter  
incremented around the trigger-firing loops in AfterTriggerEndQuery,  
AfterTriggerFireDeferred, and AfterTriggerSetState, and decremented  
after FireAfterTriggerBatchCallbacks() returns.  AfterTriggerIsActive()  
now returns afterTriggerFiringDepth > 0.  
  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Author: Chao Li <li.evan.chao@gmail.com>  
Co-authored-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/C2133B47-79CD-40FF-B088-02D20D654806@gmail.com  

M src/backend/commands/trigger.c

Fix shared memory size of template code for custom fixed-sized pgstats

commit   : 98979578055ffba3bd520adcec00881f72fc2861    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 08:24:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 7 Apr 2026 08:24:32 +0900    

Click here for diff

On HEAD, the template code for custom fixed-sized pgstats is in the test  
module test_custom_stats.  On REL_18_STABLE, this code lives in the test  
module injection_points.  
  
Both cases were underestimating the size of the shared memory area  
required for the storage of the stats data, using a single entry rather  
than the whole area.  This underestimation meant that there was no  
memory allocated for the LWLock required for the stats, and even more.  
This problem would be also misleading for extension developers looking  
at this code.  
  
This issue has been noticed while digging into a different bug reported  
by Heikki Linnakangas, showing that the underestimation was causing  
failures in the TAP tests of the test modules for 32-bit builds.  The  
other issue reported, related to the memory allocation of custom  
fixed-sized pgstats, will be fixed in a follow-up commit.  
  
Discussion: https://postgr.es/m/adMk_lWbnz3HDOA8@paquier.xyz  
Backpatch-through: 18  

M src/test/modules/test_custom_stats/test_custom_fixed_stats.c

Allocate separate DSM chunk for parallel Index[Only]Scan instrumentation

commit   : dd78e69cfc337f93cfc0303ddf660262d7f1237e    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 6 Apr 2026 19:10:19 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 6 Apr 2026 19:10:19 -0400    

Click here for diff

Previously, parallel index and index-only scans packed the parallel scan  
descriptor and shared instrumentation (for EXPLAIN ANALYZE) into a  
single DSM allocation. Since scans may be instrumented without being  
parallel-aware, and vice versa, using separate DSM chunks -- each with  
its own TOC key -- is cleaner. A future commit will extend this pattern  
to other scan node types.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

M src/backend/access/index/indexam.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/include/access/genam.h
M src/include/access/relscan.h
M src/include/executor/instrument_node.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h

Assert no duplicate keys in shm_toc_insert()

commit   : 43222b8e53f49f2cf0849947a02c6fbd74899332    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 6 Apr 2026 18:41:17 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 6 Apr 2026 18:41:17 -0400    

Click here for diff

shm_toc_insert() silently accepts duplicate keys. Since shm_toc_lookup()  
returns the first matching entry, any later entry with the same key  
would be unreachable. Add an assertion to catch this.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me  

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

Add pg_stat_autovacuum_scores system view.

commit   : 87f61f0c82806b7e4201f15bd77920e9e7108b11    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 16:56:33 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 16:56:33 -0500    

Click here for diff

This view contains one row for each table in the current database,  
showing the current autovacuum scores for that specific table.  It  
also shows whether autovacuum would vacuum or analyze the table.  
  
Bumps catversion.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/postmaster/autovacuum.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out

Use PG_DATA_CHECKSUM_OFF instead of hardcoded value

commit   : b3a37ffbc5b94c0214f1f3f1953e800654a1962f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 22:11:53 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 22:11:53 +0200    

Click here for diff

For a long time, the online checksums patchset kept the "off" state as  
literal zero without a label to be consistent with the previous coding  
which only had a label for the "on" state.  Later, when an "off" label  
was made not all uses in the code got the memo.  Fix by setting these  
to PG_DATA_CHECKSUM_OFF.  
  
While there, fix a duplicate word in a comment introduced by the same  
commit.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAJ7c6TPRTnQFXXX1CRcYoTLXw2swtDH==uSz1MYoMKdLrKZHjA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/bootstrap/bootstrap.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/file.c

Add CONCURRENTLY option to REPACK

commit   : 28d534e2ae0ac888b5460f977a10cd9bb017ef98    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 6 Apr 2026 21:55:08 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 6 Apr 2026 21:55:08 +0200    

Click here for diff

When this flag is specified, REPACK no longer acquires access-exclusive  
lock while the new copy of the table is being created; instead, it  
creates the initial copy under share-update-exclusive lock only (same as  
vacuum, etc), and it follows an MVCC snapshot; it sets up a replication  
slot starting at that snapshot, and uses a concurrent background worker  
to do logical decoding starting at the snapshot to populate a stash of  
concurrent data changes.  Those changes can then be re-applied to the  
new copy of the table just before swapping the relfilenodes.  
Applications can continue to access the original copy of the table  
normally until just before the swap, which is the only point at which  
the access-exclusive lock is needed.  
  
There are some loose ends in this commit:  
1. concurrent repack needs its own replication slot in order to apply  
   logical decoding, which are a scarce resource and easy to run out of.  
2. due to the way the historic snapshot is initially set up, only one  
   REPACK process can be running at any one time on the whole system.  
3. there's a danger of deadlocking (and thus abort) due to the lock  
   upgrade required at the final phase.  
  
These issues will be addressed in upcoming commits.  
  
The design and most of the code are by Antonin Houska, heavily based on  
his own pg_squeeze third-party implementation.  
  
Author: Antonin Houska <ah@cybertec.at>  
Co-authored-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/5186.1706694913@antos  
Discussion: https://postgr.es/m/202507262156.sb455angijk6@alvherre.pgsql  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/ref/repack.sgml
M src/Makefile
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/catalog/system_views.sql
M src/backend/commands/Makefile
M src/backend/commands/matview.c
M src/backend/commands/meson.build
M src/backend/commands/repack.c
A src/backend/commands/repack_worker.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/libpq/pqmq.c
M src/backend/meson.build
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/decode.c
A src/backend/replication/pgrepack/Makefile
A src/backend/replication/pgrepack/meson.build
A src/backend/replication/pgrepack/pgrepack.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/wait_event_names.txt
M src/bin/psql/tab-complete.in.c
M src/include/access/heapam_xlog.h
M src/include/access/tableam.h
M src/include/commands/progress.h
M src/include/commands/repack.h
A src/include/commands/repack_internal.h
M src/include/replication/decode.h
M src/include/storage/lockdefs.h
M src/include/storage/procsignal.h
M src/makefiles/Makefile.cygwin
M src/makefiles/Makefile.win32
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/repack.out
A src/test/modules/injection_points/expected/repack_toast.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/repack.spec
A src/test/modules/injection_points/specs/repack_toast.spec
M src/test/regress/expected/cluster.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/cluster.sql
M src/tools/pgindent/typedefs.list

Document that WAIT FOR may be interrupted by recovery conflicts

commit   : 10484c2cc75be3746933d2052b18e8c28512f69e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:42:06 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:42:06 +0300    

Click here for diff

Add a note to the WAIT FOR documentation explaining that sessions  
using this command on a standby server may be interrupted by recovery  
conflicts.  Some conflicts are unavoidable - for example, replaying  
a tablespace drop terminates all backends unconditionally.  
  
Discussion: https://postgr.es/m/CAPpHfds7oSCbZqob7ytT_Lso8fv-NW8LnedUTE4Krde%2B3rkJeA%40mail.gmail.com  
Author: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  

M doc/src/sgml/ref/wait_for.sgml

Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()

commit   : 7e8aeb9e483db48500987da8981a70b491b7844c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:41:02 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:41:02 +0300    

Click here for diff

When the standby is passed as a PostgreSQL::Test::Cluster instance,  
use the WAIT FOR LSN command on the standby server to implement  
wait_for_catchup() for replay, write, and flush modes.  This is more  
efficient than polling pg_stat_replication on the upstream, as the  
WAIT FOR LSN command uses a latch-based wakeup mechanism.  
  
The optimization applies when:  
- The standby is passed as a Cluster object (not just a name string)  
- The mode is 'replay', 'write', or 'flush' (not 'sent')  
  
Rather than pre-checking pg_is_in_recovery() on the standby (which  
would add an extra round-trip on every call), we issue WAIT FOR LSN  
directly and handle the 'not in recovery' result as a signal to fall  
back to polling.  
  
For 'sent' mode, when the standby is passed as a string (e.g., a  
subscription name for logical replication), when the standby has been  
promoted, or when WAIT FOR LSN is interrupted by a recovery conflict,  
the function falls back to the original polling-based approach using  
pg_stat_replication on the upstream.  The recovery conflict fallback  
is necessary because some conflicts are unavoidable - for example,  
ResolveRecoveryConflictWithTablespace() kills all backends  
unconditionally, regardless of what they are doing.  
  
The recovery conflict detection matches the English error message  
"conflict with recovery", which is reliable because the test suite  
runs with LC_MESSAGES=C.  
  
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  

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

Avoid syscache lookup while building a WAIT FOR tuple descriptor

commit   : 834038c1f8d52f51666c60ec774bbbf590f4e8c6    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:27:36 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 6 Apr 2026 22:27:36 +0300    

Click here for diff

Use TupleDescInitBuiltinEntry instead of TupleDescInitEntry when building  
the result tuple descriptor for the WAIT FOR command. This avoids a syscache  
access that could re-establish a catalog snapshot after we've explicitly  
released all snapshots before the wait.  
  
Discussion: https://postgr.es/m/CABPTF7U%2BSUnJX_woQYGe%3D%3DR9Oz%2B-V6X0VO2stBLPGfJmH_LEhw%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  

M src/backend/commands/wait.c

Remove recheck_relation_needs_vacanalyze().

commit   : 775fe51daaef9131c5a00447c0ea9ff36d6a2406    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 14:30:52 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 14:30:52 -0500    

Click here for diff

This function is a thin wrapper around relation_needs_vacanalyze()  
that handles fetching and freeing the pgstat entry for the table.  
Since all callers of relation_needs_vacanalyze() do that anyway, we  
can teach that function to fetch/free the pgstat entry and use it  
instead.  
  
Suggested-by: Álvaro Herrera <alvherre@kurilemu.de>  
Author: Sami Imseih <samimseih@gmail.com>  
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com  

M src/backend/postmaster/autovacuum.c

auto_explain: Add new GUC, auto_explain.log_extension_options.

commit   : e972dff6c30447ebcfa2f8601b67f926247463b6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 15:09:24 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 15:09:24 -0400    

Click here for diff

The associated value should look like something that could be  
part of an EXPLAIN options list, but restricted to EXPLAIN options  
added by extensions.  
  
For example, if pg_overexplain is loaded, you could set  
auto_explain.log_extension_options = 'DEBUG, RANGE_TABLE'.  
You can also specify arguments to these options in the same manner  
as normal e.g. 'DEBUG 1, RANGE_TABLE false'.  
  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: http://postgr.es/m/CA+Tgmob-0W8306mvrJX5Urtqt1AAasu8pi4yLrZ1XfwZU-Uj1w@mail.gmail.com  

M contrib/auto_explain/Makefile
M contrib/auto_explain/auto_explain.c
A contrib/auto_explain/expected/extension_options.out
M contrib/auto_explain/meson.build
A contrib/auto_explain/sql/extension_options.sql
M contrib/auto_explain/t/001_auto_explain.pl
M doc/src/sgml/auto-explain.sgml
M src/tools/pgindent/typedefs.list

Support more object types within CREATE SCHEMA.

commit   : d516974840f4059d331ae6057ede3e4edd3c6747    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 15:16:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 15:16:21 -0400    

Click here for diff

Having rejected the principle that we should know how to re-order  
the sub-commands of CREATE SCHEMA, there is not really anything  
except a little coding to stop us from supporting more object types.  
This patch adds support for creating functions (including procedures  
and aggregates), operators, types (including domains), collations,  
and text search objects.  
  
SQL:2021 specifies that we should allow functions, procedures,  
types, domains, and collations, so this moves us a great deal  
closer to full SQL compatibility of CREATE SCHEMA.  What remains  
missing from their list are casts, transforms, roles, and some  
object types we don't support yet (e.g. CREATE CHARACTER SET).  
Supporting casts or transforms would be problematic because  
they don't have names at all, let alone schema-qualified names,  
so it'd be quite a stretch to say that they belong to a schema.  
Roles likewise are not schema-qualified, plus they are global  
to a cluster, making it even less reasonable to consider them  
as belonging to a schema.  So I don't see us trying to complete  
the list.  
  
User-defined aggregates and operators are outside the spec's ken,  
as are text search objects, so adding them does not do anything for  
spec compatibility.  But they go along with these other object types,  
plus it takes no additional code to support them since they are  
represented as DefineStmts like some variants of CREATE TYPE.  
It would indeed take some effort to reject them.  
  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Author: Jian He <jian.universality@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CALdSSPh4jUSDsWu3K58hjO60wnTRR0DuO4CKRcwa8EVuOSfXxg@mail.gmail.com  

M doc/src/sgml/ref/create_schema.sgml
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/bin/psql/tab-complete.in.c
M src/fe_utils/psqlscan.l
M src/test/modules/test_ddl_deparse/expected/create_schema.out
M src/test/modules/test_ddl_deparse/sql/create_schema.sql
M src/test/regress/expected/create_schema.out
M src/test/regress/sql/create_schema.sql

Execute foreign key constraints in CREATE SCHEMA at the end.

commit   : 404db8f9edbb291bcc31542d488fb20f6a965798    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:52:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:52:28 -0400    

Click here for diff

The previous patch simplified CREATE SCHEMA's behavior to "execute all  
subcommands in the order they are written".  However, that's a bit too  
simple, as the spec clearly requires forward references in foreign key  
constraint clauses to work, see feature F311-01.  (Most other SQL  
implementations seem to read more into the spec than that, but it's  
not clear that there's justification for more in the text, and this is  
the only case that doesn't introduce unresolvable issues.)  We never  
implemented that before, but let's do so now.  
  
To fix it, transform FOREIGN KEY clauses into ALTER TABLE ... ADD  
FOREIGN KEY commands and append them to the end of the CREATE SCHEMA's  
subcommand list.  This works because the foreign key constraints are  
independent and don't affect any other DDL that might be in CREATE  
SCHEMA.  For simplicity, we do this for all FOREIGN KEY clauses even  
if they would have worked where they were.  
  
Author: Jian He <jian.universality@gmail.com>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1075425.1732993688@sss.pgh.pa.us  

M doc/src/sgml/ref/create_schema.sgml
M src/backend/parser/parse_utilcmd.c
M src/test/modules/test_ddl_deparse/expected/create_schema.out
M src/test/modules/test_ddl_deparse/sql/create_schema.sql
M src/test/regress/expected/create_schema.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/create_schema.sql

Don't try to re-order the subcommands of CREATE SCHEMA.

commit   : a9c350d9ee66745aadcf7c0c95a567752a762171    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:42:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:42:55 -0400    

Click here for diff

transformCreateSchemaStmtElements has always believed that it is  
supposed to re-order the subcommands of CREATE SCHEMA into a safe  
execution order.  However, it is nowhere near being capable of doing  
that correctly.  Nor is there reason to think that it ever will be,  
or that that is a well-defined requirement.  (The SQL standard does  
say that it should be possible to do foreign-key forward references  
within CREATE SCHEMA, but it's not clear that the text requires  
anything more than that.)  Moreover, the problem will get worse as  
we add more subcommand types.  Let's just drop the whole idea and  
execute the commands in the order given, which seems like a much  
less astonishment-prone definition anyway.  The foreign-key issue  
will be handled in a follow-up patch.  
  
This will result in a release-note-worthy incompatibility,  
which is that forward references like  
	CREATE SCHEMA myschema  
	    CREATE VIEW myview AS SELECT * FROM mytable  
	    CREATE TABLE mytable (...);  
used to work and no longer will.  Considering how many closely  
related variants never worked, this isn't much of a loss.  
  
Along the way, pass down a ParseState so that we can provide an  
error cursor for "wrong schema name" and related errors, and fix  
transformCreateSchemaStmtElements so that it doesn't scribble  
on the parsetree passed to it.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/1075425.1732993688@sss.pgh.pa.us  

M doc/src/sgml/ref/create_schema.sgml
M src/backend/commands/extension.c
M src/backend/commands/schemacmds.c
M src/backend/parser/parse_utilcmd.c
M src/backend/tcop/utility.c
M src/include/commands/schemacmds.h
M src/include/parser/parse_utilcmd.h
M src/test/regress/expected/create_schema.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/namespace.out
M src/test/regress/sql/create_schema.sql
M src/test/regress/sql/namespace.sql
M src/tools/pgindent/typedefs.list

Allow autovacuum to use parallel vacuum workers.

commit   : 1ff3180ca0169556984ab83759477f593129794d    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 6 Apr 2026 11:48:29 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 6 Apr 2026 11:48:29 -0700    

Click here for diff

Previously, autovacuum always disabled parallel vacuum regardless of  
the table's index count or configuration. This commit enables  
autovacuum workers to use parallel index vacuuming and index cleanup,  
using the same parallel vacuum infrastructure as manual VACUUM.  
  
Two new configuration options control the feature. The GUC  
autovacuum_max_parallel_workers sets the maximum number of parallel  
workers a single autovacuum worker may launch; it defaults to 0,  
preserving existing behavior unless explicitly enabled. The per-table  
storage parameter autovacuum_parallel_workers provides per-table  
limits. A value of 0 disables parallel vacuum for the table, a  
positive value caps the worker count (still bounded by the GUC), and  
-1 (the default) defers to the GUC.  
  
To handle cases where autovacuum workers receive a SIGHUP and update  
their cost-based vacuum delay parameters mid-operation, a new  
propagation mechanism is added to vacuumparallel.c. The leader stores  
its effective cost parameters in a DSM segment. Parallel vacuum  
workers poll for changes in vacuum_delay_point(); if an update is  
detected, they apply the new values locally via VacuumUpdateCosts().  
  
A new test module, src/test/modules/test_autovacuum, is added to  
verify that parallel autovacuum workers are correctly launched and  
that cost-parameter updates are propagated as expected.  
  
The patch was originally proposed by Maxim Orlov, but the  
implementation has undergone significant architectural changes  
since then during the review process.  
  
Author: Daniil Davydov <3danissimo@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/CACG=ezZOrNsuLoETLD1gAswZMuH2nGGq7Ogcc0QOE5hhWaw=cw@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.in.c
M src/include/commands/vacuum.h
M src/include/miscadmin.h
M src/include/utils/rel.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_autovacuum/.gitignore
A src/test/modules/test_autovacuum/Makefile
A src/test/modules/test_autovacuum/meson.build
A src/test/modules/test_autovacuum/t/001_parallel_autovacuum.pl
M src/tools/pgindent/typedefs.list

Rename cluster.c to repack.c (and corresponding .h)

commit   : c0b53ec06309f955455c7d71da277991d0da4ec0    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 6 Apr 2026 19:37:28 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 6 Apr 2026 19:37:28 +0200    

Click here for diff

CLUSTER is no longer the favored way to invoke this functionality, and  
the code is about to shift its focus to the REPACK more ambitiously.  
Rename the file to avoid leaving an unnecessary historical artifact  
around.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/202603271635.owyhm7btgoic@alvherre.pgsql  

M src/backend/commands/Makefile
M src/backend/commands/matview.c
M src/backend/commands/meson.build
R099 src/backend/commands/cluster.c src/backend/commands/repack.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/storage/ipc/procsignal.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
R090 src/include/commands/cluster.h src/include/commands/repack.h

Disallow system columns in COPY FROM WHERE conditions.

commit   : 21c69dc73f9d0af6a11f13ef61522577126a8674    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:05:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 14:05:01 -0400    

Click here for diff

These columns haven't been computed yet when the filtering happens  
(since we've not written the candidate tuple into the table); so  
any check on them is wrong or useless.  Worse, since aa606b931 such a  
reference results in an access off the end of a TupleDesc, potentially  
causing a phony "generated columns are not supported in COPY FROM  
WHERE conditions" error; and since c98ad086a it throws an Assert  
instead.  
  
Actually we could allow tableoid, which has been set to the OID of the  
table named as the COPY target.  However, plausible uses for tests of  
tableoid would involve a partitioned target table, and the user would  
wish it to read as the OID of the destination partition.  There has  
been some discussion of changing things to make it work like that,  
but pending that happening we should just disallow tableoid along  
with other system columns.  
  
It seems best though to install this prohibition only in HEAD.  
In the back branches we'll just guard the unsafe TupleDesc access,  
and people will keep getting whatever semantics they got before.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/6f435023-8ab6-47c2-ba07-035d0c4212f9@gmail.com  

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

Add missing .gitignore files.

commit   : f7da81f68b63430d24caba99c0a95933c10cefcb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 13:25:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 13:25:29 -0400    

Click here for diff

contrib/pg_stash_advice and src/test/modules/test_shmem  
missed these, leading to complaints from git after an  
in-tree check-world run.  
  
Use our standard boilerplate list of ignorable subdirectories,  
although the two modules presently create different subsets  
of that.  

A contrib/pg_stash_advice/.gitignore
A src/test/modules/test_shmem/.gitignore

Fix null-bitmap combining in array_agg_array_combine().

commit   : 6582010c801ff6f54215de45ad1afb3d9fd43bab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 13:14:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 6 Apr 2026 13:14:50 -0400    

Click here for diff

This code missed the need to update the combined state's  
nullbitmap if state1 already had a bitmap but state2 didn't.  
We need to extend the existing bitmap with 1's but didn't.  
This could result in wrong output from a parallelized  
array_agg(anyarray) calculation, if the input has a mix of  
null and non-null elements.  The errors depended on timing  
of the parallel workers, and therefore would vary from one  
run to another.  
  
Also install guards against integer overflow when calculating  
the combined object's sizes, and make some trivial cosmetic  
improvements.  
  
Author: Dmytro Astapov <dastapov@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAFQUnFj2pQ1HbGp69+w2fKqARSfGhAi9UOb+JjyExp7kx3gsqA@mail.gmail.com  
Backpatch-through: 16  

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

Add a guc_check_handler to the EXPLAIN extension mechanism.

commit   : 0442f1c9eff673849664d8ef71c202ad076e72e9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 12:29:59 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 12:29:59 -0400    

Click here for diff

It would be useful to be able to tell auto_explain to set a custom  
EXPLAIN option, but it would be bad if it tried to do so and the  
option name or value wasn't valid, because then every query would fail  
with a complaint about the EXPLAIN option. So add a guc_check_handler  
that auto_explain will be able to use to only try to set option  
name/value/type combinations that have been determined to be legal,  
and to emit useful messages about ones that aren't.  
  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: http://postgr.es/m/CA+Tgmob-0W8306mvrJX5Urtqt1AAasu8pi4yLrZ1XfwZU-Uj1w@mail.gmail.com  

M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_plan_advice/pg_plan_advice.c
M src/backend/commands/explain_state.c
M src/include/commands/explain_state.h

Remove autoanalyze corner case.

commit   : e3481edfd1b6b0a64fef8f43cfa3b48e94c01682    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 11:28:46 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 6 Apr 2026 11:28:46 -0500    

Click here for diff

The restructuring in commit 53b8ca6881 revealed an interesting  
corner case: if a table needs vacuuming for wraparound prevention  
and autovacuum is disabled for it, we might still choose to analyze  
it.  Research seems to indicate this was an accidental addition by  
commit 48188e1621, and further discussion indicates there is  
consensus that it is unnecessary and can be removed.  
  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Discussion: https://postgr.es/m/adB9nSsm_S0D9708%40nathan  

M src/backend/postmaster/autovacuum.c

Expose helper functions scan_quoted_identifier and scan_identifier.

commit   : e0e819cc08d3dc6fe843779c2bb3388135d20d14    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 11:13:25 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 11:13:25 -0400    

Click here for diff

Previously, this logic was embedded within SplitIdentifierString,  
SplitDirectoriesString, and SplitGUCList. Factoring it out saves  
a bit of duplicated code, and also makes it available to extensions  
that might want to do similar things without necessarily wanting to  
do exactly the same thing.  
  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: http://postgr.es/m/CA+Tgmob-0W8306mvrJX5Urtqt1AAasu8pi4yLrZ1XfwZU-Uj1w@mail.gmail.com  

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

Add TAP tests for log_lock_waits

commit   : ca2b5443e2dcfc09692fd7b93753890b0b9633d2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 23:49:40 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 23:49:40 +0900    

Click here for diff

This commit updates 011_lock_stats.pl to verify log_lock_waits behavior.  
  
The tests check that messages are emitted both when a wait occurs and  
when the lock is acquired, and that the "still waiting for" message is logged  
exactly once per wait, even if the backend wakes up during the wait.  
  
The latter covers the behavior introduced by commit fd6ecbfa75f.  
  
Author: Hüseyin Demir <huseyin.d3r@gmail.com>  
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAB5wL7YB1my9W5k5i=SY+=sTjeozyJ0YkvGXrVfeDNzuRkoTPg@mail.gmail.com  

M src/test/modules/test_misc/t/011_lock_stats.pl

Release postmaster working memory context in slotsync worker

commit   : 93dc1ace2007fe7c1103ccda3d7bc13b4eb4352f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 23:04:18 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 23:04:18 +0900    

Click here for diff

Child processes do not need the postmaster's working memory context and  
normally release it at the start of their main entry point. However,  
the slotsync worker forgot to do so.  
  
This commit makes the slotsync worker release the postmaster's working  
memory context at startup, preventing unintended use.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Tiancheng Ge <getiancheng_2012@163.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwHO05JaUpgKF8FBDmPdBUJsK22axRRcgmAUc2Jyi8OK8g@mail.gmail.com  

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

Fix memory leaks introduced by commit 283e823f9dcb

commit   : ed71d7356e3b394f579db87782a41e3d5dfb99ad    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 15:46:03 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 15:46:03 +0300    

Click here for diff

When freeing pending_shmem_requests we should also free the ->options.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://www.postgresql.org/message-id/CAJ7c6TN9tp8MTc0WXM0zfSWqjfBqU8gpe+o5KqHB1-cQ7409Kw@mail.gmail.com  

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

Fix compilation without injection points with some compilers

commit   : 2670a0fcc6a5ee0273b0751dcc18d514735290ad    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 15:46:00 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 15:46:00 +0300    

Click here for diff

Some compilers didn't like the empty initializer when compiled without  
USE_INJECTION_POINTS. Per buildfarm member 'drongo', using Visual  
Studio 2019.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Discussion: https://www.postgresql.org/message-id/adNHcBVJO5gIOp1l@paquier.xyz  

M src/backend/utils/misc/injection_point.c
M src/include/storage/subsystemlist.h

Add pg_stash_advice contrib module.

commit   : e8ec19aa321abc89fb4fd277c994f14680ba17db    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 07:41:28 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 6 Apr 2026 07:41:28 -0400    

Click here for diff

This module allows plan advice strings to be provided automatically  
from an in-memory advice stash. Advice stashes are stored in dynamic  
shared memory and must be recreated and repopulated after a server  
restart. If pg_stash_advice.stash_name is set to the name of an advice  
stash, and if query identifiers are enabled, the query identifier  
for each query will be looked up in the advice stash and the  
associated advice string, if any, will be used each time that query  
is planned.  
  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Discussion: http://postgr.es/m/CA+TgmoaeNuHXQ60P3ZZqJLrSjP3L1KYokW9kPfGbWDyt+1t=Ng@mail.gmail.com  

M contrib/Makefile
M contrib/meson.build
A contrib/pg_stash_advice/Makefile
A contrib/pg_stash_advice/expected/pg_stash_advice.out
A contrib/pg_stash_advice/expected/pg_stash_advice_utf8.out
A contrib/pg_stash_advice/expected/pg_stash_advice_utf8_1.out
A contrib/pg_stash_advice/meson.build
A contrib/pg_stash_advice/pg_stash_advice–1.0.sql
A contrib/pg_stash_advice/pg_stash_advice.c
A contrib/pg_stash_advice/pg_stash_advice.control
A contrib/pg_stash_advice/pg_stash_advice.h
A contrib/pg_stash_advice/sql/pg_stash_advice.sql
A contrib/pg_stash_advice/sql/pg_stash_advice_utf8.sql
A contrib/pg_stash_advice/stashfuncs.c
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/pgstashadvice.sgml
M src/tools/pgindent/typedefs.list

Use single LWLock for lock statistics in pgstats

commit   : 404a17c155ac6e80d990fb0625569a3854f7090d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 14:01:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 14:01:04 +0900    

Click here for diff

Previously, one LWLock was used for each lock type, adding complexity  
without an observable performance benefit as data is gathered only for  
paths involving lock waits, at least currently.  This commit replaces  
the per-type set of LWLocks with a single LWLock protecting the stats  
data of all the lock types, like the stats kinds for SLRU or WAL.  A  
good chunk of the callbacks get simpler thanks to this change.  
  
The previous approach also had one bug in the flush callback when nowait  
was called with "true": a backend iterating over all entries could  
successfully flush some entries while skipping others due to contention,  
then unconditionally reset the pending data.  This would cause some  
stats data loss.  
  
Oversight in 4019f725f5d4.  
  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/1af63e6d-16d5-4d5b-9b03-11472ef1adf9@vondra.me  

M src/backend/utils/activity/pgstat_lock.c
M src/include/utils/pgstat_internal.h

Improve more stability of worker_spi termination test

commit   : 283c5fb22b44562428700284aad23eb5245b19d8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 13:23:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 13:23:28 +0900    

Click here for diff

Alexander Lakhin has noticed that it can be possible on machines with  
slow storage to have the spawned workers be stuck in  
initialize_worker_spi(), before they reach their main loop.  Waiting for  
a flush to happen would block the interrupt attempts done by the  
database commands, causing the test to fail on timeout once the number  
of interrupt attempts is reached in CountOtherDBBackends().  
  
This commit switches the test to wait for the spawned bgworkers to reach  
their main loops before attempting the database commands that would  
trigger the interrupts, napping for a time larger than the default, with  
worker_spi.naptime set at 10 minutes.  Another thing that could be  
attempted is to enforce a larger number of tries in  
CountOtherDBBackends(), if what is done here is not enough.  Let's see  
first if what this commit does is enough for the buildfarm members  
widowbird and jay.  
  
Analyzed-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/f913fba1-da59-404c-9eb3-07c7304be637@gmail.com  

M src/test/modules/worker_spi/t/002_worker_terminate.pl

Simplify redundant current_database() subqueries in stats.sql regression test

commit   : d78a4f0bf058906c5cfd25c815ccbdf18013b312    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 13:19:45 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 13:19:45 +0900    

Click here for diff

Previously the stats.sql regression test used conditions like  
"datname = (SELECT current_database())" to check the current database name.  
  
The subquery is unnecessary, so this commit simplifies these expressions to  
"datname = current_database()".  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/A1535A8F-65AF-4C3D-ACBE-25891CB5D38B@gmail.com  

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

Fix volatile function evaluation in eager aggregation

commit   : 3a08a2a8b4fd36a9fa0da0253d1ca053c19047d5    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 6 Apr 2026 11:54:08 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 6 Apr 2026 11:54:08 +0900    

Click here for diff

Pushing aggregates containing volatile functions below a join can  
violate volatility semantics by changing the number of times the  
function is executed.  
  
Here we check the Aggref nodes in the targetlist and havingQual for  
volatile functions and disable eager aggregation when such functions  
are present.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs48A53PY1Y4zoj7YhxPww9fO1hfnbdntKfA855zpXfVFRA@mail.gmail.com  

M src/backend/optimizer/plan/initsplan.c
M src/test/regress/expected/eager_aggregate.out
M src/test/regress/sql/eager_aggregate.sql

Fix collation handling for grouping keys in eager aggregation

commit   : bd94845e8c90475b8149f6a091876a1827b6b305    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 6 Apr 2026 11:52:33 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 6 Apr 2026 11:52:33 +0900    

Click here for diff

When determining if it is safe to use an expression as a grouping key  
for partial aggregation, eager aggregation relies on the B-tree  
equalimage support function to ensure that equality implies image  
equality.  
  
Previously, the code incorrectly passed the default collation of the  
expression's data type to the equalimage procedure, rather than the  
expression's actual collation.  As a result, if a column used a  
non-deterministic collation but the base type's default collation was  
deterministic, eager aggregation would incorrectly assume that the  
column was safe for byte-level grouping.  This could cause rows to be  
prematurely grouped and subsequently discarded by strict join  
conditions, resulting in incorrect query results.  
  
This patch fixes the issue by passing the expression's actual  
collation to the equalimage procedure.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs48A53PY1Y4zoj7YhxPww9fO1hfnbdntKfA855zpXfVFRA@mail.gmail.com  

M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication

commit   : a8f45dee91768cf1447ffaf2527e499e75a194c3    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 11:35:03 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 6 Apr 2026 11:35:03 +0900    

Click here for diff

Previously, during shutdown, walsenders always waited until all pending data  
was replicated to receivers. This ensures sender and receiver stay in sync  
after shutdown, which is important for physical replication switchovers,  
but it can significantly delay shutdown. For example, in logical replication,  
if apply workers are blocked on locks, walsenders may wait until those locks  
are released, preventing shutdown from completing for a long time.  
  
This commit introduces a new GUC, wal_sender_shutdown_timeout,  
which specifies the maximum time a walsender waits during shutdown for all  
pending data to be replicated. When set, shutdown completes once all data is  
replicated or the timeout expires. A value of -1 (the default) disables  
the timeout.  
  
This can reduce shutdown time when replication is slow or stalled. However,  
if the timeout is reached, the sender and receiver may be left out of sync,  
which can be problematic for physical replication switchovers.  
  
Author: Andrey Silitskiy <a.silitskiy@postgrespro.ru>  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Takamichi Osumi <osumi.takamichi@fujitsu.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Vitaly Davydov <v.davydov@postgrespro.ru>  
Reviewed-by: Ronan Dunklau <ronan@dunklau.fr>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/TYAPR01MB586668E50FC2447AD7F92491F5E89@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/walsender.h
M src/test/subscription/meson.build
A src/test/subscription/t/038_walsnd_shutdown_timeout.pl

Fix unportable use of __builtin_constant_p

commit   : 8194c4a9dd38f7373166ea3fd9243a6e51c0869f    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 6 Apr 2026 09:30:01 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 6 Apr 2026 09:30:01 +0700    

Click here for diff

On MSVC Arm, USE_ARMV8_CRC32C is defined, but __builtin_constant_p  
is not available. Use pg_integer_constant_p and add appropriate  
guards. There is a similar potential hazard for the x86 path, but  
for now let's get the buildfarm green.  
  
Oversight in commit fbc57f2bc, per buildfarm member hoatzin.  

M src/include/port/pg_crc32c.h

Test stabilization for online checksums

commit   : 07009121c235dc1b9338b57b6a85006a5e3b0bd8    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 02:03:10 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 02:03:10 +0200    

Click here for diff

Postcommit review and buildfarm/CI failures revealed a few issues in  
the test code which this commit attempts to resolve.  These failures  
are verified using synthetic means.  
  
  * Wait for launcher exit in enable/disable checksum tests  
  
    When enabling or disabling data checksums in a test with waiting  
    for an end state (on or off), the test typically want to perform  
    more test against the cluster immediately. Make sure to wait for  
    the launcher to exit in these cases before returning in order to  
    know it can immediately be acted on.  This is a more generic way  
    of implementating 0036232ba8f.  
  
  * Refactor injection point tests to use the injection_points test  
    extension. Two injection points added for online checksums were  
    better expressed using the injection_points extension with the  
    test code embedded in datachecksum_state.c.  
  
  * Make tests less timing dependent and allow transitions to "on"  
    and not just "inprogress-on" in case a test manages to finish  
    before it's checked for state.  
  
  * When waiting on a blocking background psql keeping a temporary  
    table open, the test first closed the background session abd  
    then the server.  This could cause data checksums to manage to  
    get enabled in the brief window between dropping the temporary  
    table and closing the server.  Fix by closing the server first  
    before the background session.  
  
  * Remove a few superfluous duplicate checks and general cleanup  
    of comments as well as making LSN logging consistent.  
  
These issues were reported by Andres as well as spotted in the  
buildfarm and on CI.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/92F25C14-801E-4198-994D-D83E31FEB0D8@yesql.se  

M src/backend/postmaster/datachecksum_state.c
M src/test/modules/test_checksums/t/001_basic.pl
M src/test/modules/test_checksums/t/003_standby_restarts.pl
M src/test/modules/test_checksums/t/004_offline.pl
M src/test/modules/test_checksums/t/005_injection.pl
M src/test/modules/test_checksums/t/006_pgbench_single.pl
M src/test/modules/test_checksums/t/007_pgbench_standby.pl
M src/test/modules/test_checksums/t/008_pitr.pl
M src/test/modules/test_checksums/t/DataChecksums/Utils.pm
M src/test/modules/test_checksums/test_checksums–1.0.sql
M src/test/modules/test_checksums/test_checksums.c

Handle checksumworker startup wait race

commit   : d771b0a907e67dc929dbbdebf70ecb006081b629    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 01:55:06 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 6 Apr 2026 01:55:06 +0200    

Click here for diff

If the background worker for processing databases manages to finish  
before the launcher starts waiting for it, the launcher would treat  
it erroneously as an error.  Fix by ensureing to check result state  
in this case.  Identified on CI and synthetically reproduced during  
local testing.  
  
Also while, make sure to properly lock the shared memory structure  
before updating tje result state.  
  
Author: Daniel Gustafsson <daniel@yesql.seA  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/4fxw37ge47v5baeozla5phymi233hxbcjbwwsfwv3mpg3kyl2z@6jk4nkf6jp4  

M src/backend/postmaster/datachecksum_state.c

Add tests for lock statistics, take two

commit   : 557a9f1e3e62894cc3302eda72d9df091d72f37b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 08:51:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 6 Apr 2026 08:51:30 +0900    

Click here for diff

Commit 7c64d56fd976 has removed the isolation test providing coverage  
for lock statistics due to some instability in the CI, where the  
deadlock timeout may not have enough time to process, preventing the  
stats data to be updated.  These also relied on a set of hardcoded  
sleeps.  
  
This commit switches the test suite to TAP, instead, that uses an  
injection point with a wait to avoid the sleeps.  The injection point is  
added in ProcSleep(), once we know that the deadlock timeout has fired  
and that the stats have been updated.  
  
Multiple lock patterns are checked, all rely on the same workflow, with  
two sessions:  
- session 1 holds a given lock type.  
- session 2 attaches to the new injection point with the wait action.  
- session 2 attempts to acquire a lock conflicting with the lock of  
session 1, waiting for the injection point to be reached.  
- session 1 releases its lock, session 2 commits.  
- pg_stat_lock is polled until the counters are updated for the lock  
type.  
  
Bertrand's version of the patch introduced a new routine to  
BackgroundPsql() to detect the blocked background sessions.  I have  
tweaked the test so as we use the same method as some of the other tests  
instead, based on some \echo commands.  This test has been run multiple  
times in the CI, all passing, so I'd like to think that this is more  
stable than the first version attempted.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/acNTR1lLHwQJ0o+P@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/storage/lmgr/proc.c
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/011_lock_stats.pl

Convert all remaining subsystems to use the new shmem allocation API

commit   : 9b5acad3f40fa6015f367fbf887ae5c1a93a3698    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:10 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:10 +0300    

Click here for diff

This removes all remaining uses of ShmemInitStruct() and  
ShmemInitHash() from built-in code.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/access/common/syncscan.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/datachecksum_state.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logicalctl.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/misc/injection_point.c
M src/include/access/nbtree.h
M src/include/access/syncscan.h
M src/include/access/twophase.h
M src/include/access/xlog.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogwait.h
M src/include/pgstat.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/datachecksum_state.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/walsummarizer.h
M src/include/replication/logicalctl.h
M src/include/replication/logicallauncher.h
M src/include/replication/origin.h
M src/include/replication/slot.h
M src/include/replication/slotsync.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/storage/lock.h
M src/include/storage/subsystemlist.h
M src/include/utils/backend_status.h
M src/include/utils/injection_point.h
M src/include/utils/wait_event.h
M src/test/modules/injection_points/injection_points.c
M src/test/modules/test_aio/test_aio.c

Convert buffer manager to use the new shmem allocation functions

commit   : a4b6139dcceb47986577aef36e73f15187ceb727    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:08 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:08 +0300    

Click here for diff

This rectifies the initialization functions a little, making the  
"buffer strategy" stuff in freelist.c and buffer mapping hash table in  
buf_init.c top-level "subsystems" of their own, registered directly in  
subsystemlist.h. Previously they were called indirectly from  
BufferManagerShmemInit() and BufferManagerShmemSize()  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/ipci.c
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/subsystemlist.h

Add alignment option to ShmemRequestStruct()

commit   : dacfe81a0de513308e6753fe3d9b4f3e4811da69    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:06 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:06 +0300    

Click here for diff

The buffer blocks, converted to use ShmemRequestStruct() in the next  
commit, are IO-aligned. This might come handy in other places too, so  
make it an explicit feature of ShmemRequestStruct().  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/storage/ipc/shmem.c
M src/include/storage/shmem.h

Convert AIO to use the new shmem allocation functions

commit   : 58a1573385edb28435913affe626ff7daffba76d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:04 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:04 +0300    

Click here for diff

This replaces the "shmem_size" and "shmem_init" callbacks in the IO  
methods table with the same ShmemCallback struct that we now use in  
other subsystems  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/storage/aio/aio_init.c
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/aio/method_worker.c
M src/backend/storage/ipc/ipci.c
M src/include/storage/aio_internal.h
M src/include/storage/aio_subsys.h
M src/include/storage/subsystemlist.h

Convert SLRUs to use the new shmem allocation functions

commit   : 2e0943a8597e1eeaec184465ba8b1f2f453a69e0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:02 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:02 +0300    

Click here for diff

I replaced the old SimpleLruInit() function without a backwards  
compatibility wrapper, because few extensions define their own SLRUs.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@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/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/pgstat_slru.c
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/storage/predicate.h
M src/include/storage/shmem_internal.h
M src/include/storage/subsystemlist.h
M src/test/modules/test_slru/test_slru.c
M src/tools/pgindent/typedefs.list

Refactor shmem initialization code in predicate.c

commit   : 4c9eca5afea0e8623e39f6a778412d4da687f659    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:01 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:13:01 +0300    

Click here for diff

This is in preparation to convert it to use the new shmem allocation  
functions, making the next commit that does that smaller. This inlines  
SerialInit() to the caller, and moves all the initialization steps  
within PredicateLockShmemInit() to happen after all the  
ShmemInit{Struct|Hash}() calls.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

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

Use the new shmem allocation functions in a few core subsystems

commit   : c6d55714ba4c282dcf5fb5fe5ef2a5cad0b06e81    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:59 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:59 +0300    

Click here for diff

These subsystems have some complicating properties, making them  
slightly harder to convert than most:  
  
- The initialization callbacks of some of these subsystems have  
  dependencies, i.e. they need to be initialized in the right order.  
  
- The ProcGlobal pointer still needs to be inherited by the  
  BackendParameters mechanism on EXEC_BACKEND builds, because  
  ProcGlobal is required by InitProcess() to get a PGPROC entry, and  
  the PGPROC entry is required to use LWLocks, and usually attaching  
  to shared memory areas requires the use of LWLocks.  
  
- Similarly, ProcSignal pointer still needs to be handled by  
  BackendParameters, because query cancellation connections access it  
  without calling InitProcess  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/varsup.c
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/win32_sema.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/hash/dynahash.c
M src/include/access/transam.h
M src/include/storage/dsm.h
M src/include/storage/dsm_registry.h
M src/include/storage/pg_sema.h
M src/include/storage/pmsignal.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/sinvaladt.h
M src/include/storage/subsystemlist.h

Convert lwlock.c to use the new shmem allocation functions

commit   : a006bc7b1699d952afcb6d786343e8bf0ecc61d6    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:57 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:57 +0300    

Click here for diff

It seems like a good candidate to convert first because it needs to  
initialized before any other subsystem, but other than that it's  
nothing special.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tcop/postgres.c
M src/include/storage/lwlock.h
M src/include/storage/subsystemlist.h

Introduce a registry of built-in shmem subsystems

commit   : 1fc2e9fbc0a3d17aa484dbfab11af58eb2cb20ad    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:55 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:55 +0300    

Click here for diff

To add a new built-in subsystem, add it to subsystemslist.h. That  
hooks up its shmem callbacks so that they get called at the right  
times during postmaster startup. For now this is unused, but will  
replace the current SubsystemShmemSize() and SubsystemShmemInit()  
calls in the next commits.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/backend/tcop/postgres.c
M src/include/storage/ipc.h
A src/include/storage/subsystemlist.h
A src/include/storage/subsystems.h
M src/tools/pginclude/headerscheck

Convert pg_stat_statements to use the new shmem allocation functions

commit   : d4885af3d65325c1fcd319e98c634fde9a200443    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:53 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:53 +0300    

Click here for diff

As part of this, embed the LWLock it needs in the shared memory struct  
itself, so that we don't need to use RequestNamedLWLockTranche()  
anymore. LWLockNewTrancheId() + LWLockInitialize() is more convenient  
to use in extensions.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M contrib/pg_stat_statements/pg_stat_statements.c

Add a test module to test after-startup shmem allocations

commit   : 6409994c7dd8cc8c06c00882880e04cc895c28bd    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:51 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:51 +0300    

Click here for diff

The old ShmemInit{Struct/Hash}() functions could be used after  
postmaster statup, as long as the allocation is small enough to fit in  
spare shmem reserved at startup. I believe some extensions do that,  
although we hadn't really documented it and had not coverage for it.  
The new test module covers that after-startup usage with the new  
ShmemRequestStruct() functions.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_shmem/Makefile
A src/test/modules/test_shmem/meson.build
A src/test/modules/test_shmem/t/001_late_shmem_alloc.pl
A src/test/modules/test_shmem/test_shmem–1.0.sql
A src/test/modules/test_shmem/test_shmem.c
A src/test/modules/test_shmem/test_shmem.control
M src/tools/pgindent/typedefs.list

Introduce a new mechanism for registering shared memory areas

commit   : 283e823f9dcb03d0be720928b261628af06d3fd4    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:50 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:50 +0300    

Click here for diff

This replaces the [Subsystem]ShmemSize() and [Subsystem]ShmemInit()  
functions called at postmaster startup with a new set of callbacks.  
The new mechanism is designed to be more ergonomic. Notably, the size  
of each shmem area is specified in the same ShmemRequestStruct() call,  
together with its name. The same mechanism is used in extensions,  
replacing the shmem_{request/startup}_hooks.  
  
ShmemInitStruct() and ShmemInitHash() become backwards-compatibility  
wrappers around the new functions. In future commits, I will replace  
all ShmemInitStruct() and ShmemInitHash() calls with the new  
functions, although we'll still need to keep them around for  
extensions.  
  
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M doc/src/sgml/system-views.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/shmem_hash.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/hash/dynahash.c
M src/include/storage/shmem.h
M src/include/storage/shmem_internal.h
M src/tools/pgindent/typedefs.list

Move some code from shmem.c and shmem.h

commit   : 6ef9bee29310fa519b1b0f01221fcf1c41a33679    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:48 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 6 Apr 2026 02:12:48 +0300    

Click here for diff

A little refactoring in preparation for the next commit, to make the  
material changes in that commit more clear.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/postmaster/launch_backend.c
M src/backend/storage/ipc/Makefile
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/ipc/shmem.c
A src/backend/storage/ipc/shmem_hash.c
M src/include/storage/shmem.h
A src/include/storage/shmem_internal.h

instrumentation: Separate per-node logic from other uses

commit   : 5a79e78501f46bd3ac7fbd0ff84cf1e20dbafd19    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 17:18:00 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 17:18:00 -0400    

Click here for diff

Previously, different places (e.g. query "total time") were repurposing the  
Instrumentation struct initially introduced for capturing per-node statistics  
during execution. This overuse of the same struct is confusing, e.g. by  
cluttering calls of InstrStartNode/InstrStopNode in unrelated code paths, and  
prevents future refactorings.  
  
Instead, simplify the Instrumentation struct to only track time and WAL/buffer  
usage. Similarly, drop the use of InstrEndLoop outside of per-node  
instrumentation - these calls were added without any apparent benefit since  
the relevant fields were never read.  
  
Introduce the NodeInstrumentation struct to carry forward the per-node  
instrumentation information. WorkerInstrumentation is renamed to  
WorkerNodeInstrumentation for clarity.  
  
In passing, clarify that InstrAggNode is expected to only run after  
InstrEndLoop (as it does in practice), and drop unused code.  
  
This also fixes a consequence-less bug: Previously ->async_mode was only set  
when a non-zero instrument_option was passed. That turns out to be harmless  
right now, as ->async_mode only affects a timing related field.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/commands/explain.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execProcnode.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

instrumentation: Separate trigger logic from other uses

commit   : 7d9b74df53e9268bd638274f1415ebfeecf0de51    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 16:47:12 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 16:47:12 -0400    

Click here for diff

Introduce TriggerInstrumentation to capture trigger timing and firings  
(previously counted in "ntuples"), to aid a future refactoring that  
splits out all Instrumentation fields beyond timing and WAL/buffers into  
more specific structs.  
  
In passing, drop the "n" argument to InstrAlloc, as all remaining callers need  
exactly one Instrumentation struct.  The duplication between InstrAlloc() and  
InstrInit(), as well as the conditional initialization of async_mode will be  
addressed in a subsequent commit.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/commands/explain.c
M src/backend/commands/trigger.c
M src/backend/executor/execMain.c
M src/backend/executor/execProcnode.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Fixups for a4f774cf1c7

commit   : 6c7bce28c83f4deaa6a6205dc32e86ac1630182c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 15:36:34 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 15:36:34 -0400    

Click here for diff

The database name was warned about when building with  
-DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS, leading to BF and CI failures.  
  
It is somewhat confusing that the required prefix is different for databases  
than other object types.  
  
Also fix a pgindent violation that caused koel to start to fail.  
  
Discussion: https://postgr.es/m/ptyiexyhmtxf4lm524s7o7w64r26ra237uusv4tjav4yhpmeoo@vfwwllz7tivb  

M src/backend/utils/adt/ddlutils.c
M src/test/regress/expected/database_ddl.out
M src/test/regress/sql/database_ddl.sql

Add tid_block() and tid_offset() accessor functions

commit   : df6949ccf7a6d5160e3068ed843eb46ab7bc2601    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 14:45:27 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 14:45:27 -0400    

Click here for diff

The two new functions allow to extract the block number and offset from a tid.  
  
There are existing ways to do so (e.g. by doing (ctid::text::point)[0]), but  
they are hard to remember and not pretty.  
  
tid_block() returns int8 (bigint) because BlockNumber is uint32, which exceeds  
the range of int4. tid_offset() returns int4 (integer) because OffsetNumber is  
uint16, which fits safely in int4.  
  
Bumps catversion.  
  
Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com>  
Discussion: https://postgr.es/m/CAJTYsWUzok2+mvSYkbVUwq_SWWg-GdHqCuYumN82AU97SjwjCA@mail.gmail.com  

M doc/src/sgml/func/allfiles.sgml
A doc/src/sgml/func/func-tid.sgml
M doc/src/sgml/func/func.sgml
M src/backend/utils/adt/tid.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/tid.out
M src/test/regress/sql/tid.sql

Check that the tranche name is unique in RequestNamedLWLockTranche

commit   : f10b6be2581f879f24a4830443bab356ec6d71c5    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 5 Apr 2026 21:05:20 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 5 Apr 2026 21:05:20 +0300    

Click here for diff

You could request two tranches with same name, but things would get  
confusing when you called GetNamedLWLockTranche() to get the LWLocks  
allocated for them; it would always return the first tranche with the  
name. That doesn't make sense, so forbid duplicates.  
  
We still allow duplicates with LWLockNewTrancheId(). That works better  
as you don't use the name to look up the tranche ID later. It's still  
confusing in wait events, for example, but it's not dangerous in the  
same way.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/463a28db-0c0b-4af6-bac6-3891828bbbfe@iki.fi  

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

Improve test_lwlock_tranches

commit   : 92a685e4070d01653daac1d60de6c155723a5c68    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 5 Apr 2026 21:05:15 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 5 Apr 2026 21:05:15 +0300    

Click here for diff

While working on refactoring how shmem is allocated, I made a mistake  
where the main LWLock array did not reserve space for the LWLocks  
allocated with RequestNamedLWLockTranche(), and the test still  
passed. Matthias van de Meent spotted that before it got committed,  
but in order to catch such mistakes in the future, add checks in  
test_lwlock_tranches that the locks allocated with  
RequestNamedLWLockTranche() can be acquired and released.  
  
Another change is to stop requesting multiple tranches with the same  
name with RequestNamedLWLockTranche(). As soon as I started to test  
using the locks I realized that's bogus, and the next commit will  
forbid it. Keep test coverage for duplicates requested with  
LWLockNewTrancheId() for now, but make it more clear that that's what  
the test does.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/463a28db-0c0b-4af6-bac6-3891828bbbfe@iki.fi  
Discussion: https://www.postgresql.org/message-id/CAEze2WjgCROMMXY0+j8FFdm3iFcr7By-+6Mwiz=PgGSEydiW3A@mail.gmail.com  

M src/test/modules/test_lwlock_tranches/expected/test_lwlock_tranches.out
M src/test/modules/test_lwlock_tranches/sql/test_lwlock_tranches.sql
M src/test/modules/test_lwlock_tranches/test_lwlock_tranches–1.0.sql
M src/test/modules/test_lwlock_tranches/test_lwlock_tranches.c

Add pg_get_database_ddl() function

commit   : a4f774cf1c7e5c6cf2f3393f611e1df16cdb5a5a    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:57:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:57:35 -0400    

Click here for diff

Add a new SQL-callable function that returns the DDL statements needed  
to recreate a database. It takes a regdatabase argument and an optional  
VARIADIC text argument for options that are specified as alternating  
name/value pairs. The following options are supported: pretty (boolean)  
for formatted output, owner (boolean) to include OWNER and tablespace  
(boolean) to include TABLESPACE. The return is one or multiple rows  
where the first row is a CREATE DATABASE statement and subsequent rows are  
ALTER DATABASE statements to set some database properties.  
  
The caller must have CONNECT privilege on the target database.  
  
Author: Akshay Joshi <akshay.joshi@enterprisedb.com>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Co-authored-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Quan Zongliang <quanzongliang@yeah.net>  
Discussion: https://postgr.es/m/CANxoLDc6FHBYJvcgOnZyS+jF0NUo3Lq_83-rttBuJgs9id_UDg@mail.gmail.com  
Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net  

M doc/src/sgml/func/func-info.sgml
M src/backend/utils/adt/ddlutils.c
M src/include/catalog/pg_proc.dat
A src/test/regress/expected/database_ddl.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/database_ddl.sql

Add pg_get_tablespace_ddl() function

commit   : b99fd9fd7f363c6363f4c8a95c699b9134b0357f    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:55:16 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:55:16 -0400    

Click here for diff

Add a new SQL-callable function that returns the DDL statements needed  
to recreate a tablespace. It takes a tablespace name or OID and an  
optional VARIADIC text argument for options that are specified as  
alternating name/value pairs. The following options are supported: pretty  
(boolean) for formatted output and owner (boolean) to include OWNER.  
(It includes two variants because there is no regtablespace pseudotype.)  
The return is one or multiple rows where the first row is a CREATE  
TABLESPACE statement and subsequent rows are ALTER TABLESPACE statements  
to set some tablespace properties.  
  
The caller must have SELECT privilege on pg_tablespace.  
  
get_reloptions() in ruleutils.c is made non-static so it can be called  
from the new ddlutils.c file.  
  
Author: Nishant Sharma <nishant.sharma@enterprisedb.com>  
Author: Manni Wood <manni.wood@enterprisedb.com>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Co-authored-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com  
Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net  

M doc/src/sgml/func/func-info.sgml
M src/backend/utils/adt/ddlutils.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/pg_proc.dat
M src/include/utils/ruleutils.h
A src/test/regress/expected/tablespace_ddl.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/tablespace_ddl.sql

Add pg_get_role_ddl() function

commit   : 76e514ebb4b55f95b844e3e94e61fa64ab16fd0b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:52:25 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:52:25 -0400    

Click here for diff

Add a new SQL-callable function that returns the DDL statements needed  
to recreate a role. It takes a regrole argument and an optional VARIADIC  
text argument for options that are specified as alternating name/value  
pairs. The following options are supported: pretty (boolean) for  
formatted output and memberships (boolean) to include GRANT statements  
for role memberships and membership options. The return is one or  
multiple rows where the first row is a CREATE ROLE statement and  
subsequent rows are ALTER ROLE statements to set some role properties.  
Password information is never included in the output.  
  
The caller must have SELECT privilege on pg_authid.  
  
Author: Mario Gonzalez <gonzalemario@gmail.com>  
Author: Bryan Green <dbryan.green@gmail.com>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Co-authored-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Quan Zongliang <quanzongliang@yeah.net>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/4c5f895e-3281-48f8-b943-9228b7da6471@gmail.com  
Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net  

M doc/src/sgml/func/func-info.sgml
M src/backend/utils/adt/ddlutils.c
M src/include/catalog/pg_proc.dat
A src/test/regress/expected/role_ddl.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/role_ddl.sql

Add infrastructure for pg_get_*_ddl functions

commit   : 4881981f92024e4db6249bd3dc96a3859638a665    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:50:41 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 19 Mar 2026 09:50:41 -0400    

Click here for diff

Add parse_ddl_options(), append_ddl_option(), and append_guc_value()  
helper functions in a new ddlutils.c file that provide common option  
parsing and output formatting for the pg_get_*_ddl family of functions  
which will follow in later patches.  These accept VARIADIC text  
arguments as alternating name/value pairs.  
  
Callers declare an array of DdlOption descriptors specifying the  
accepted option names and their types (boolean, text, or integer).  
parse_ddl_options() matches each supplied pair against the array,  
validates the value, and fills in the result fields.  This  
descriptor-based scheme is based on an idea from Euler Taveira.  
  
This is placed in a new ddlutils.c file which will contain the  
pg_get_*_ddl functions.  
  
Author: Akshay Joshi <akshay.joshi@enterprisedb.com>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Co-authored-by: Euler Taveira <euler@eulerto.com>  
Discussion: https://postgr.es/m/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com  
Discussion: https://postgr.es/m/4c5f895e-3281-48f8-b943-9228b7da6471@gmail.com  
Discussion: https://postgr.es/m/CANxoLDc6FHBYJvcgOnZyS+jF0NUo3Lq_83-rttBuJgs9id_UDg@mail.gmail.com  
Discussion: https://postgr.es/m/e247c261-e3fb-4810-81e0-a65893170e94@dunslane.net  

M src/backend/utils/adt/Makefile
A src/backend/utils/adt/ddlutils.c
M src/backend/utils/adt/meson.build
M src/tools/pgindent/typedefs.list

Allow index_create to suppress index_build progress reporting

commit   : caec9d9fadf1b04741ac554470c46bc1f8e89d19    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 5 Apr 2026 13:34:08 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 5 Apr 2026 13:34:08 +0200    

Click here for diff

A future REPACK patch wants a way to suppress index_build doing its  
progress reports when building an index, because that would interfere  
with repack's own reporting; so add an INDEX_CREATE_SUPPRESS_PROGRESS  
bit that enables this.  
  
Furthermore, change the index_create_copy() API so that it takes flag  
bits for index_create() and passes them unchanged.  This gives its  
callers more direct control, which eases the interface -- now its  
callers can pass the INDEX_CREATE_SUPPRESS_PROGRESS bit directly.  We  
use it for the current caller in REINDEX CONCURRENTLY, since it's also  
not interested in progress reporting, since it doesn't want  
index_build() to be called at all in the first place.  
  
One thing to keep in mind, pointed out by Mihail, is that we're not  
suppressing the index-AM-specific progress report updates which happen  
during ambuild().  At present this is not a problem, because the values  
updated by those don't overlap with those used by commands other than  
CREATE INDEX; but maybe in the future we'll want the ability to suppress  
them also.  (Alternatively we might want to display how each  
index-build-subcommand progresses during REPACK and others.)  
  
Author: Antonin Houska <ah@cybertec.at>  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Discussion: https://postgr.es/m/102906.1773668762@localhost  

M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/include/catalog/index.h

postgres_fdw: Inherit the local transaction's access/deferrable modes.

commit   : de28140ded8d4ba00faf905ec3530ffeb8a34a53    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Sun, 5 Apr 2026 18:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Sun, 5 Apr 2026 18:55:00 +0900    

Click here for diff

READ ONLY transactions should prevent modifications to foreign data as  
well as local data, but postgres_fdw transactions declared as READ ONLY  
that reference foreign tables mapped to a remote view executing volatile  
functions would modify data on remote servers, as it would open remote  
transactions in READ WRITE mode.  
  
Similarly, DEFERRABLE transactions should not abort due to a  
serialization failure even when accessing foreign data, but postgres_fdw  
transactions declared as DEFERRABLE would abort due to that failure in a  
remote server, as it would open remote transactions in NOT DEFERRABLE  
mode.  
  
To fix, modify postgres_fdw to open remote transactions in the same  
access/deferrable modes as the local transaction.  This commit also  
modifies it to open remote subtransactions in the same access mode as  
the local subtransaction.  
  
This commit changes the behavior of READ ONLY/DEFERRABLE transactions  
using postgres_fdw; in particular, it doesn't allow the READ ONLY  
transactions to modify data on remote servers anymore, so such  
transactions should be redeclared as READ WRITE or rewritten using other  
tools like dblink.  The release notes should note this as an  
incompatibility.  
  
These issues exist since the introduction of postgres_fdw, but to avoid  
the incompatibility in the back branches, fix them in master only.  
  
Author: Etsuro Fujita <etsuro.fujita@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAPmGK16n_hcUUWuOdmeUS%2Bw4Q6dZvTEDHb%3DOP%3D5JBzo-M3QmpQ%40mail.gmail.com  
Discussion: https://postgr.es/m/E1uLe9X-000zsY-2g%40gemulon.postgresql.org  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml
M src/backend/access/transam/xact.c
M src/include/access/xact.h

aio: Simplify pgaio_worker_submit().

commit   : fc44f106657a0b2f55147d8309a676a6ac555a95    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 5 Apr 2026 18:01:10 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 5 Apr 2026 18:01:10 +1200    

Click here for diff

Merge pgaio_worker_submit_internal() and pgaio_worker_submit().  The  
separation didn't serve any purpose.  
  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKG%2Bm4xV0LMoH2c%3DoRAdEXuCnh%2BtGBTWa7uFeFMGgTLAw%2BQ%40mail.gmail.com  

M src/backend/storage/aio/method_worker.c

read_stream: Only increase read-ahead distance when waiting for IO

commit   : f63ca3379025ee4547865182da6cae14aec35d58    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    

Click here for diff

This avoids increasing the distance to the maximum in cases where the I/O  
subsystem is already keeping up. This turns out to be important for  
performance for two reasons:  
  
- Pinning a lot of buffers is not cheap. If additional pins allow us to avoid  
  IO waits, it's definitely worth it, but if we can already do all the  
  necessary readahead at a distance of 16, reading ahead 512 buffers can  
  increase the CPU overhead substantially.  This is particularly noticeable  
  when the to-be-read blocks are already in the kernel page cache.  
  
- If the read stream is read to completion, reading in data earlier than  
  needed is of limited consequences, leaving aside the CPU costs mentioned  
  above. But if the read stream will not be fully consumed, e.g. because it is  
  on the inner side of a nested loop join, the additional IO can be a serious  
  performance issue. This is not that commonly a problem for current read  
  stream users, but the upcoming work, to use a read stream to fetch table  
  pages as part of an index scan, frequently encounters this.  
  
Note that this commit would have substantial performance downsides without  
earlier commits:  
  
- Commit 6e36930f9aa, which avoids decreasing the readahead distance when  
  there was recent IO, is crucial, as otherwise we very often would end up not  
  reading ahead aggressively enough anymore with this commit, due to  
  increasing the distance less often.  
  
- "read stream: Split decision about look ahead for AIO and combining" is  
  important as we would otherwise not perform IO combining when the IO  
  subsystem can keep up.  
  
- "aio: io_uring: Trigger async processing for large IOs" is important to  
  continue to benefit from memory copy parallelism when using fewer IOs.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Tested-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CA+hUKGL2PhFyDoqrHefqasOnaXhSg48t1phs3VM8BAdrZqKZkw@mail.gmail.com  

M src/backend/storage/aio/read_stream.c

read stream: Split decision about look ahead for AIO and combining

commit   : 8ca147d582a5a9f3345478654408c46314758b50    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    

Click here for diff

In a subsequent commit the read-ahead distance will only be increased when  
waiting for IO. Without further work that would cause a regression: As IO  
combining and read-ahead are currently controlled by the same mechanism, we  
would end up not allowing IO combining when never needing to wait for IO (as  
the distance ends up too small to allow for full sized IOs), which can  
increase CPU overhead. A typical reason to not have to wait for IO completion  
at a low look-ahead distance is use of io_uring with the to-be-read data in  
the page cache. But even with worker the IO submission rate may be low enough  
for the worker to keep up.  
  
One might think that we could just always perform IO combining, but doing so  
at the start of a scan can cause performance regressions:  
  
1) Performing a large IO commonly has a higher latency than smaller IOs. That  
   is not a problem once reading ahead far enough, but at the start of a stream  
   it can lead to longer waits for IO completion.  
  
2) Sometimes read streams will not be read to completion. Immediately starting  
   with full sized IOs leads to more wasted effort. This is not commonly an  
   issue with existing read stream users, but the upcoming use of read streams  
   to fetch table pages as part of an index scan frequently encounters this.  
  
Solve this issue by splitting ReadStream->distance into ->combine_distance and  
->readahead_distance. Right now they are increased/decreased at the same time,  
but that will change in the next commit.  
  
One of the comments in read_stream_should_look_ahead() refers to a motivation  
that only really exists as of the next commit, but without it the code doesn't  
make sense on its own.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CA+hUKGL2PhFyDoqrHefqasOnaXhSg48t1phs3VM8BAdrZqKZkw@mail.gmail.com  

M src/backend/storage/aio/read_stream.c

read_stream: Move logic about IO combining & issuing to helpers

commit   : 434dab76ba76fba5dacab2dc695b6b3d5df8315b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    

Click here for diff

The long if statements were hard to read and hard to document. Splitting them  
into inline helpers makes it much easier to explain each part separately.  
  
This is done in preparation for making the logic more complicated...  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  

M src/backend/storage/aio/read_stream.c

aio: io_uring: Trigger async processing for large IOs

commit   : a9ee66881744d67193b56964b8398e5f83130956    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 5 Apr 2026 00:43:54 -0400    

Click here for diff

io_method=io_uring has a heuristic to trigger asynchronous processing of IOs  
once the IO depth is a bit larger. That heuristic is important when doing  
buffered IO from the kernel page cache, to allow parallelizing of the memory  
copy, as otherwise io_method=io_uring would be a lot slower than  
io_method=worker in that case.  
  
An upcoming commit will make read_stream.c only increase the read-ahead  
distance if we needed to wait for IO to complete. If to-be-read data is in the  
kernel page cache, io_uring will synchronously execute IO, unless the IO is  
flagged as async.  Therefore the aforementioned change in read_stream.c  
heuristic would lead to a substantial performance regression with io_uring  
when data is in the page cache, as we would never reach a deep enough queue to  
actually trigger the existing heuristic.  
  
Parallelizing the copy from the page cache is mainly important when doing a  
lot of IO, which commonly is only possible when doing largely sequential IO.  
  
The reason we don't just mark all io_uring IOs as asynchronous is that the  
dispatch to a kernel thread has overhead. This overhead is mostly noticeable  
with small random IOs with a low queue depth, as in that case the gain from  
parallelizing the memory copy is small and the latency cost high.  
  
The facts from the two prior paragraphs show a way out: Use the size of the IO  
in addition to the depth of the queue to trigger asynchronous processing.  
  
One might think that just using the IO size might be enough, but  
experimentation has shown that not to be the case - with deep look-ahead  
distances being able to parallelize the memory copy is important even with  
smaller IOs.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CA+hUKGL2PhFyDoqrHefqasOnaXhSg48t1phs3VM8BAdrZqKZkw@mail.gmail.com  

M src/backend/storage/aio/method_io_uring.c

Fix unused function warning on Arm platforms

commit   : 2849fe4c978540111748208ba96af7808602c567    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sun, 5 Apr 2026 08:49:47 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sun, 5 Apr 2026 08:49:47 +0700    

Click here for diff

Guard definition pg_pmull_available() on compile-time availability  
of PMULL. Oversight in fbc57f2bc. In passing, remove "inline" hint  
for consistency.  
  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/f153d5a4-a9be-4211-b0b2-7e99b56d68d5@vondra.me  

M src/port/pg_crc32c_armv8_choose.c

Modernize struct declarations in snapbuild.h

commit   : 69c11f0545a027fdcb32254b546a0cd431823e4f    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 5 Apr 2026 00:21:53 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 5 Apr 2026 00:21:53 +0200    

Click here for diff

Just a cosmetic cleanup.  

M src/include/replication/snapbuild.h

Make index_concurrently_create_copy more general

commit   : 33bf7318f94ce730563eb5ed95ad6c61d6e6f7a6    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 4 Apr 2026 20:38:26 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 4 Apr 2026 20:38:26 +0200    

Click here for diff

Also rename it to index_create_copy.  Add a 'boolean concurrent' option,  
and make it work for both cases: in concurrent mode, just create the  
catalog entries; caller is responsible for the actual building later.  
In non-concurrent mode, the index is built right away.  
  
This allows it to be reused for other purposes -- specifically, for  
concurrent REPACK.  
  
(With the CONCURRENTLY option, REPACK cannot simply swap the heap file and  
rebuild its indexes.  Instead, it needs to build a separate set of  
indexes, including their system catalog entries, *before* the actual  
swap, to reduce the time AccessExclusiveLock needs to be held for.  This  
approach is different from what CREATE INDEX CONCURRENTLY does.)  
  
Per a suggestion from Mihail Nikalayeu.  
  
Author: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/41104.1754922120@localhost  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/include/catalog/index.h

heapam: Keep buffer pins across index scan resets.

commit   : 2d3490dd99f04d97202eb37f103f929f3dc33162    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 13:49:37 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 13:49:37 -0400    

Click here for diff

Avoid dropping the heap page pin (xs_cbuf) and visibility map pin  
(xs_vmbuffer) within heapam_index_fetch_reset.  Retaining these pins  
saves cycles during certain nested loop joins and merge joins that  
frequently restore a saved mark: cases where the next tuple fetched  
after a reset often falls on the same heap page will now avoid the cost  
of repeated pinning and unpinning.  
  
Avoiding dropping the scan's heap page buffer pin is preparation for an  
upcoming patch that will add I/O prefetching to index scans.  Testing of  
that patch (which makes heapam tend to pin more buffers concurrently  
than was typical before now) shows that the aforementioned cases get a  
small but clearly measurable benefit from this optimization.  
  
Upcoming work to add a slot-based table AM interface for index scans  
(which is further preparation for prefetching) will move VM checks for  
index-only scans out of the executor and into heapam.  That will expand  
the role of xs_vmbuffer to include VM lookups for index-only scans (the  
field won't just be used for setting pages all-visible during on-access  
pruning via the enhancement recently introduced by commit b46e1e54).  
Avoiding dropping the xs_vmbuffer pin will preserve the historical  
behavior of nodeIndexonlyscan.c, which always kept this pin on a rescan;  
that aspect of this commit isn't really new.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com  

M src/backend/access/heap/heapam_indexscan.c
M src/backend/access/index/indexam.c

Remove unnecessary #include "spin.h" from shmem.h

commit   : fda530013282de284b1352ad310c2c53ead8ba78    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 20:22:04 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 20:22:04 +0300    

Click here for diff

Commit 6b8238cb6a removed the last usage of slock_t from the  
file. proc.c was relying the indirect #include, so add it to proc.c  
directly.  

M src/include/storage/proc.h
M src/include/storage/shmem.h

heapam: Track heap block in IndexFetchHeapData.

commit   : c7d09595e46ff513ae0a23ae80e58871a321174f    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:45:33 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:45:33 -0400    

Click here for diff

Add an explicit BlockNumber field (xs_blk) to IndexFetchHeapData that  
tracks which heap block is currently pinned in xs_cbuf.  
  
heapam_index_fetch_tuple now uses xs_blk to determine when buffer  
switching is needed, replacing the previous approach that compared  
buffer identities via ReleaseAndReadBuffer on every non-HOT-chain call.  
  
This is preparatory work for an upcoming commit that will add index  
prefetching using a read stream.  Delegating the release of a currently  
pinned buffer to ReleaseAndReadBuffer won't work anymore -- at least not  
when the next buffer that the scan needs to pin is one returned by  
read_stream_next_buffer (not a buffer returned by ReadBuffer).  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com  

M src/backend/access/heap/heapam_indexscan.c
M src/include/access/heapam.h

Move heapam_handler.c index scan code to new file.

commit   : a29fdd6c8d816af0d042491a79c8ec1a60272c06    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:30:41 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:30:41 -0400    

Click here for diff

Move the heapam index fetch callbacks (index_fetch_begin,  
index_fetch_reset, index_fetch_end, and index_fetch_tuple) into a new  
dedicated file.  Also move heap_hot_search_buffer over.  This is a  
purely mechanical move with no functional impact.  
  
Upcoming work to add a slot-based table AM interface for index scans  
will substantially expand this code.  Keeping it in heapam_handler.c  
would clutter a file whose primary role is to wire up the TableAmRoutine  
callbacks.  Bitmap heap scans and sequential scans would benefit from  
similar separation in the future.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/bmbrkiyjxoal6o5xadzv5bveoynrt3x37wqch7w3jnwumkq2yo@b4zmtnrfs4mh  

M src/backend/access/heap/Makefile
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
A src/backend/access/heap/heapam_indexscan.c
M src/backend/access/heap/meson.build
M src/include/access/heapam.h

Rename heapam_index_fetch_tuple argument for clarity.

commit   : 1adff1a0c558ecaef4fbe4cf343c426a59414749    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:30:05 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 4 Apr 2026 11:30:05 -0400    

Click here for diff

Rename heapam_index_fetch_tuple's call_again argument to heap_continue,  
for consistency with the pointed-to variable name (IndexScanDescData's  
xs_heap_continue field).  
  
Preparation for an upcoming commit that will move index scan related  
heapam functions into their own file.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/bmbrkiyjxoal6o5xadzv5bveoynrt3x37wqch7w3jnwumkq2yo@b4zmtnrfs4mh  

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

Fix indentation

commit   : 519acd1be59e407a62dbe6a5240d9d1dcb8cd062    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 21:48:58 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 21:48:58 +0700    

Click here for diff

Per buildfarm member koel  

M src/port/pg_crc32c_armv8.c

Compute CRC32C on ARM using the Crypto Extension where available

commit   : fbc57f2bc2ee498958a4c5326002af39dd99c90b    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 20:47:01 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 20:47:01 +0700    

Click here for diff

In similar vein to commit 3c6e8c123, the ARMv8 cryptography extension  
has 64x64 -> 128-bit carryless multiplication instructions suitable  
for computing CRC. This was tested to be around twice as fast as  
scalar CRC instructions for longer inputs.  
  
We now do a runtime check, even for builds that target "armv8-a+crc",  
but those builds can still use a direct call for constant inputs,  
which we assume are short.  
  
As for x86, the MIT-licensed implementation was generated with the  
"generate" program from  
  
https://github.com/corsix/fast-crc32/  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZaKhE+RD5KKouUFoxx1EbUNrNhcduM1VQ=DkSDadNEFng@mail.gmail.com  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/include/port/pg_crc32c.h
M src/port/meson.build
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c

Use AVX2 for calculating page checksums where available

commit   : 5e13b0f240397b210a0af11f83204d0b4f1713c2    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 18:07:15 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 4 Apr 2026 18:07:15 +0700    

Click here for diff

We already rely on autovectorization for computing page checksums,  
but on x86 we can get a further several-fold performance increase by  
annotating pg_checksum_block() with a function target attribute for  
the AVX2 instruction set extension. Not only does that use 256-bit  
registers, it can also use vector multiplication rather than the  
vector shifts and adds used in SSE2.  
  
Similar to other hardware-specific paths, we set a function pointer  
on first use. We don't bother to avoid this on platforms without AVX2  
since the overhead of indirect calls doesn't matter for multi-kilobyte  
inputs. However, we do arrange so that only core has the function  
pointer mechanism. External programs will continue to build a normal  
static function and don't need to be aware of this.  
  
This matters most when using io_uring since in that case the checksum  
computation is not done in parallel by IO workers.  
  
Co-authored-by: Matthew Sterrett <matthewsterrett2@gmail.com>  
Co-authored-by: Andrew Kim <andrew.kim@intel.com>  
Reviewed-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>  
Tested-by: Ants Aasma <ants.aasma@cybertec.at>  
Tested-by: Stepan Neretin <slpmcf@gmail.com> (earlier version)  
Discussion: https://postgr.es/m/CA+vA85_5GTu+HHniSbvvP+8k3=xZO=WE84NPwiKyxztqvpfZ3Q@mail.gmail.com  
Discussion: https://postgr.es/m/20250911054220.3784-1-root%40ip-172-31-36-228.ec2.internal  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/backend/storage/page/checksum.c
M src/include/pg_config.h.in
M src/include/port/pg_cpu.h
A src/include/storage/checksum_block.inc.c
M src/include/storage/checksum_impl.h
M src/port/pg_cpu_x86.c

Add missing shmem size estimate for fast-path locking struct

commit   : c06443063f01b0996a16dea77462ac6b31eb181d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 11:46:11 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 11:46:11 +0300    

Click here for diff

It's been missing ever since fast-path locking was introduced. It's a  
small discrepancy, about 4 kB, but let's be tidy. This doesn't seem  
worth backpatching, however; in stable branches we were less precise  
about the estimates and e.g. added a 10% margin to the hash table  
estimates, which is usually much bigger than this discrepancy.  

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

More tar portability adjustments.

commit   : bab656bb87b0ffed92407f93d0d4a9e4d18c0c5c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 4 Apr 2026 11:13:18 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 4 Apr 2026 11:13:18 +1300    

Click here for diff

For the three implementations that have caused problems so far:  
  
* GNU and BSD (libarchive) tar both understand --format=ustar  
* ustar doesn't support large UID/GID values, so set them to 0 to  
  avoid a hard error from at least GNU tar  
* OpenBSD tar needs -F ustar, and it appears to warn but carry  
  on with "nobody" if a UID is too large  
* -f /dev/null is a more portable way to throw away the output, since  
  the default destination might be a tape device depending on build  
  options that a distribution might change  
* Windows ships BSD tar but lacks /dev/null, so ask perl for its name  
  
Based on their manuals, the other two implementations the tests are  
likely to encounter in the wild don't seem to need any special handling:  
  
* Solaris/illumos tar uses ustar and replaces large UIDs with 60001  
* AIX tar uses ustar (unless --format=pax) and truncates large UIDs  
  
Backpatch-through: 18  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Co-authored-by: Sami Imseih <samimseih@gmail.com> (large UIDs)  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (earlier version)  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com> (OpenBSD)  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net> (Windows)  
Discussion: https://postgr.es/m/3676229.1775170250%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/CAA5RZ0tt89MgNi4-0F4onH%2B-TFSsysFjMM-tBc6aXbuQv5xBXw%40mail.gmail.com  

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

Remove HASH_DIRSIZE, always use the default algorithm to select it

commit   : 4953a25b7f3bb5a555342764231157c76e6acbac    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:28 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:28 +0300    

Click here for diff

It's not very useful to specify a non-standard directory size. The  
HASH_DIRSIZE option was only used for shared memory hash tables, and  
those always used hash_select_dirsize() to choose the size, which in  
turn just uses the default algorithm anyway. That assumption was  
ingrained in hash_estimate_size(), too.  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/backend/utils/hash/dynahash.c
M src/include/utils/hsearch.h

Allocate all parts of shmem hash table from a single contiguous area

commit   : 9fe9ecd516b09434df59d6e7396d508f9c4477c8    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:25 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:25 +0300    

Click here for diff

Previously, the shared header (HASHHDR) and the directory were  
allocated by the caller, and passed to hash_create(), while the actual  
elements were allocated separately with ShmemAlloc(). After this  
commit, all the memory needed by the header, the directory, and all  
the elements is allocated using a single ShmemInitStruct() call, and  
the different parts are carved out of that allocation. This way the  
ShmemIndex entries (and thus pg_shmem_allocations) reflect the size of  
the whole hash table, rather than just the directories.  
  
Commit f5930f9a98 attempted this earlier, but it had to be reverted.  
The new strategy is to let dynahash.c perform all the allocations with  
the alloc function, but have the alloc function carve out the parts  
from the one larger allocation. The shared header and the directory  
are now also allocated with alloc calls, instead of passing the area  
for those directly from the caller.  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/backend/utils/hash/dynahash.c
M src/include/utils/hsearch.h
M src/tools/pgindent/typedefs.list

Prevent shared memory hash tables from growing beyond initial size

commit   : 999e9ebb51c920de270e23a5fe929441f073ad55    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:24 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:24 +0300    

Click here for diff

Set HASH_FIXED_SIZE on all shared memory hash tables, to prevent them  
from growing after the initial allocation. It was always weirdly  
indeterministic that if one hash table used up all the unused shared  
memory, you could not use that space for other things anymore until  
restart. We just got rid of that behavior for the LOCK and PROCLOCK  
tables, but it's similarly weird for all other hash tables.  
  
Increase SHMEM_INDEX_SIZE because we were already above the max size,  
on that one, and it's now a hard limit.  
  
Some callers of ShmemInitHash() still pass HASH_FIXED_SIZE, but that's  
now unnecessary. They should perhaps now be removed, but it doesn't do  
any harm either to pass it.  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/include/storage/shmem.h

Merge init and max size options on shmem hash tables

commit   : 9ebe1c4f2c7cecd0fc2d02afd87a74f6ba44569e    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:20 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 4 Apr 2026 02:40:20 +0300    

Click here for diff

Replace the separate init and max size options with a single size  
option. We didn't make much use of the feature, all callers except the  
ones in wait_event.c already used the same size for both, and the hash  
tables in wait_event.c are small so there's little harm in just  
allocating them to the max size.  
  
The only reason why you might want to not reserve the max size upfront  
is to make the memory available for other hash tables to grow beyond  
their max size. Letting hash tables grow much beyond their max size is  
bad for performance, however, because we cannot resize the directory,  
and we never had very much "wiggle room" to grow to anyway so you  
couldn't really rely on it. We recently marked the LOCK and PROCLOCK  
tables with HAS_FIXED_SIZE, so there's nothing left in core that would  
benefit from more unallocated shared memory.  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/wait_event.c
M src/include/storage/shmem.h

oauth: Let validators provide failure DETAILs

commit   : d438a36591c58f60e0748b341855ec5519e1e3b4    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 3 Apr 2026 16:05:33 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 3 Apr 2026 16:05:33 -0700    

Click here for diff

At the moment, the only way for a validator module to report error  
details on failure is to log them separately before returning from  
validate_cb. Independently of that problem, the ereport() calls that we  
make during validation failure partially duplicate some of the work of  
auth_failed().  
  
The end result is overly verbose and confusing for readers of the logs:  
  
    [768233] LOG:  [my_validator] bad signature in bearer token  
    [768233] LOG:  OAuth bearer authentication failed for user "jacob"  
    [768233] DETAIL:  Validator failed to authorize the provided token.  
    [768233] FATAL:  OAuth bearer authentication failed for user "jacob"  
    [768233] DETAIL:  Connection matched file ".../pg_hba.conf" line ...  
  
Solve both problems by making use of the existing logdetail pointer  
that's provided by ClientAuthentication. Validator modules may set  
ValidatorModuleResult->error_detail to override our default generic  
message.  
  
The end result looks something like  
  
    [242284] FATAL:  OAuth bearer authentication failed for user "jacob"  
    [242284] DETAIL:  [my_validator] bad signature in bearer token  
        Connection matched file ".../pg_hba.conf" line ...  
  
Reported-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/202601241015.y5uvxd7oxnfs%40alvherre.pgsql  

M doc/src/sgml/oauth-validators.sgml
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/auth.c
M src/include/libpq/oauth.h
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/validator.c

Make data checksum tests more resilient for slow machines

commit   : 0036232ba8fb282979cff16c8751a361cb85fe76    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 4 Apr 2026 00:25:07 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 4 Apr 2026 00:25:07 +0200    

Click here for diff

The test for re-running checksum enabling was only checking for the  
data checksum state to transition to 'on', but didn't account for  
the launcher process having had time to exit, thus getting an error  
instead of the expected no-op.  Adding a pg_stat_activity check for  
the launcher exiting resolves the error, verified by inducing delay  
in the launcher.  
  
Also wrap a variable only used in injection point tests within the  
correct USE macros to avoid warning for an unused variable.  
  
All per the buildfarm.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Buildfarm  
Discussion: https://postgr.es/m/1CB288C9-564B-4664-B096-C2F4377D17AB@yesql.se  

M src/test/modules/test_checksums/t/001_basic.pl
M src/test/modules/test_checksums/test_checksums.c

Add elevel parameter to relation_needs_vacanalyze().

commit   : 01876ace13697163b3b8455e1c7e4140ecfcdb1a    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 17:04:28 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 17:04:28 -0500    

Click here for diff

This will be used in a follow-up commit to avoid emitting debug  
logs from this function.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Teach relation_needs_vacanalyze() to always compute scores.

commit   : 53b8ca6881a1578fc47db47a2754faba754a2b7c    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 16:44:41 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 16:44:41 -0500    

Click here for diff

Presently, this function only computes component scores when the  
corresponding threshold is reached.  A follow-up commit will add a  
view that shows tables' autovacuum scores, and we anticipate that  
users will want to use this view to discover tables that are  
nearing autovacuum eligibility.  This commit teaches this function  
to always compute autovacuum scores, even when a threshold has not  
been reached or autovacuum is disabled.  
  
The restructuring in this commit revealed an interesting edge case.  
If the table needs vacuuming for wraparound prevention and  
autovacuum is disabled for it, we might still choose to analyze it.  
It's not clear if this is intentional, but it has been this way for  
nearly 20 years, so it seems best to avoid changing it without  
further discussion.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Online enabling and disabling of data checksums

commit   : f19c0eccae9680f5785b11cdc58ef571998caec9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 3 Apr 2026 22:58:51 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 3 Apr 2026 22:58:51 +0200    

Click here for diff

This allows data checksums to be enabled, or disabled, in a running  
cluster without restricting access to the cluster during processing.  
  
Data checksums could prior to this only be enabled during initdb or  
when the cluster is offline using the pg_checksums app. This commit  
introduce functionality to enable, or disable, data checksums while  
the cluster is running regardless of how it was initialized.  
  
A background worker launcher process is responsible for launching a  
dynamic per-database background worker which will mark all buffers  
dirty for all relation with storage in order for them to have data  
checksums calculated on write.  Once all relations in all databases  
have been processed, the data_checksums state will be set to on and  
the cluster will at that point be identical to one which had data  
checksums enabled during initialization or via offline processing.  
  
When data checksums are being enabled, concurrent I/O operations  
from backends other than the data checksums worker will write the  
checksums but not verify them on reading.  Only when all backends  
have absorbed the procsignalbarrier for setting data_checksums to  
on will they also start verifying checksums on reading.  The same  
process is repeated during disabling; all backends write checksums  
but do not verify them until the barrier for setting the state to  
off has been absorbed by all.  This in-progress state is used to  
ensure there are no false negatives (or positives) due to reading  
a checksum which is not in sync with the page.  
  
A new testmodule, test_checksums, is introduced with an extensive  
set of tests covering both online and offline data checksum mode  
changes.  The tests which run concurrent pgbdench during online  
processing are gated behind the PG_TEST_EXTRA flag due to being  
very expensive to run.  Two levels of PG_TEST_EXTRA flags exist  
to turn on a subset of the expensive tests, or the full suite of  
multiple runs.  
  
This work is based on an earlier version of this patch which was  
reviewed by among others Heikki Linnakangas, Robert Haas, Andres  
Freund, Tomas Vondra, Michael Banck and Andrey Borodin.  During  
the work on this new version, Tomas Vondra has given invaluable  
assistance with not only coding and reviewing but very in-depth  
testing.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Author: Magnus Hagander <magnus@hagander.net>  
Co-authored-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CABUevExz9hUUOLnJVr2kpw9Cx=o4MCr1SVKwbupzuxP7ckNutA@mail.gmail.com  
Discussion: https://postgr.es/m/20181030051643.elbxjww5jjgnjaxg@alap3.anarazel.de  
Discussion: https://postgr.es/m/CABUevEwE3urLtwxxqdgd5O2oQz9J717ZzMbh+ziCSa5YLLU_BA@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/func/func-admin.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/images/Makefile
A doc/src/sgml/images/datachecksums.gv
A doc/src/sgml/images/datachecksums.svg
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/backup/basebackup.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/system_views.sql
M src/backend/commands/dbcommands.c
M src/backend/postmaster/Makefile
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
A src/backend/postmaster/datachecksum_state.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/decode.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/page/README
M src/backend/storage/page/bufpage.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_waldump/t/001_basic.pl
M src/include/access/rmgrlist.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/commands/progress.h
M src/include/miscadmin.h
A src/include/postmaster/datachecksum_state.h
M src/include/postmaster/proctypelist.h
M src/include/replication/decode.h
M src/include/storage/bufpage.h
M src/include/storage/checksum.h
M src/include/storage/lwlocklist.h
M src/include/storage/procsignal.h
M src/include/utils/backend_progress.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_checksums/.gitignore
A src/test/modules/test_checksums/Makefile
A src/test/modules/test_checksums/README
A src/test/modules/test_checksums/meson.build
A src/test/modules/test_checksums/t/001_basic.pl
A src/test/modules/test_checksums/t/002_restarts.pl
A src/test/modules/test_checksums/t/003_standby_restarts.pl
A src/test/modules/test_checksums/t/004_offline.pl
A src/test/modules/test_checksums/t/005_injection.pl
A src/test/modules/test_checksums/t/006_pgbench_single.pl
A src/test/modules/test_checksums/t/007_pgbench_standby.pl
A src/test/modules/test_checksums/t/008_pitr.pl
A src/test/modules/test_checksums/t/009_fpi.pl
A src/test/modules/test_checksums/t/DataChecksums/Utils.pm
A src/test/modules/test_checksums/test_checksums–1.0.sql
A src/test/modules/test_checksums/test_checksums.c
A src/test/modules/test_checksums/test_checksums.control
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/tools/pgindent/typedefs.list

Refactor relation_needs_vacanalyze().

commit   : 8261ee24fe332a5042cd4bc3101b4fd99dee6a46    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 14:03:12 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 3 Apr 2026 14:03:12 -0500    

Click here for diff

This commit adds an early return to this function, allowing us to  
remove a level of indentation on a decent chunk of code.  This is  
preparatory work for follow-up commits that will add a new system  
view to show tables' autovacuum scores.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s4xjMrB-VAnLccC7kY8d0-4806-Lsac-czJsdA1LXtAw%40mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Change default of max_locks_per_transactions to 128

commit   : 79534f90657c37c5238e5341a111dedd26d9c0fb    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:27:46 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:27:46 +0300    

Click here for diff

The previous commits reduced the amount of memory available for locks  
by eliminating the "safety margins" and by settling the split between  
LOCK and PROCLOCK tables at startup. The allocation is now more  
deterministic, but it also means that you often hit one of the limits  
sooner than before. To compensate for that, bump up  
max_locks_per_transactions from 64 to 128. With that there is a little  
more space in the both hash tables than what was the effective maximum  
size for either table before the previous commits.  
  
This only changes the default, so if you had changed  
max_locks_per_transactions in postgresql.conf, you will still have  
fewer locks available than before for the same setting value. This  
should be noted in the release notes. A good rule of thumb is that if  
you double max_locks_per_transactions, you should be able to get as  
many locks as before.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/e07be2ba-856b-4ff5-8313-8b58b6b4e4d0@iki.fi  

M doc/src/sgml/config.sgml
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_resetwal/pg_resetwal.c

Make the lock hash tables fixed-sized

commit   : e1ad034809a4628b995ae458d0d56744ca3b5ff3    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:27:16 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:27:16 +0300    

Click here for diff

This prevents the LOCK table from "stealing" space that was originally  
calculated for the PROLOCK table, and vice versa. That was weirdly  
indeterministic so that if you e.g. took a lot of locks consuming all  
the available shared memory for the LOCK table, subsequent  
transactions that needed the more space for the PROCLOCK table would  
fail, but if you restarted the system then the space would be  
available for PROCLOCK again. Better to be strict and predictable,  
even though that means that in many cases you can acquire far fewer  
locks than before.  
  
This also prevents the lock hash tables from using up the  
general-purpose 100 kB reserve we set aside for "stuff that's too  
small to bother estimating" in CalculateShmemSize(). We are pretty  
good at accounting for everything nowadays, so we could probably make  
that reservation smaller, but I'll leave that for another commit.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/e07be2ba-856b-4ff5-8313-8b58b6b4e4d0@iki.fi  

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

Remove 10% safety margin from lock manager hash table estimates

commit   : 3e854d2ff1a6ee1d9e0e01319ef41eb466f06c23    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:26:18 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:26:18 +0300    

Click here for diff

As the comment says, the hash table sizes are just estimates, but that  
doesn't mean we need a "safety margin" here. hash_estimate_size()  
estimates the needed size in bytes pretty accurately for the given  
number of elements, so if we wanted room for more elements in the  
table, we should just use larger max_table_size in the  
hash_estimate_size() call.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/e07be2ba-856b-4ff5-8313-8b58b6b4e4d0@iki.fi  

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

Remove bogus "safety margin" from predicate.c shmem estimates

commit   : feb03dfecdc9810619bc94793be3257a487a669f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:25:57 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 3 Apr 2026 20:25:57 +0300    

Click here for diff

The 10% safety margin was copy-pasted from lock.c when the predicate  
locking code was originally added. However, we later (commit  
7c797e7194) added the HASH_FIXED_SIZE flag to the hash tables, which  
means that they cannot actually use the safety margin that we're  
calculating for them.  
  
The extra memory was mainly used by the main lock manager, which is  
the only shmem hash table of non-trivial size that does not use the  
HASH_FIXED_SIZE flag. If we wanted to have more space for the lock  
manager, we should reserve it directly in lock.c. After this commit,  
the lock manager will just have less memory available than before.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/e07be2ba-856b-4ff5-8313-8b58b6b4e4d0@iki.fi  

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

Optimize fast-path FK checks with batched index probes

commit   : b7b27eb41a5cc0b45a1a9ce5c1cde5883d7bc358    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 3 Apr 2026 14:33:53 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 3 Apr 2026 14:33:53 +0900    

Click here for diff

Instead of probing the PK index on each trigger invocation, buffer  
FK rows in a new per-constraint cache entry (RI_FastPathEntry) and  
flush them as a batch.  
  
On each trigger invocation, the new ri_FastPathBatchAdd() buffers  
the FK row in RI_FastPathEntry.  When the buffer fills (64 rows)  
or the trigger-firing cycle ends, the new ri_FastPathBatchFlush()  
probes the index for all buffered rows, sharing a single  
CommandCounterIncrement, snapshot, permission check, and security  
context switch across the batch, rather than repeating each per row  
as the SPI path does.  Per-flush CCI is safe because all AFTER  
triggers for the buffered rows have already fired by flush time.  
  
For single-column foreign keys, the new ri_FastPathFlushArray()  
builds an ArrayType from the buffered FK values (casting to the  
PK-side type if needed) and constructs a scan key with the  
SK_SEARCHARRAY flag.  The index AM sorts and deduplicates the array  
internally, then walks matching leaf pages in one ordered traversal  
instead of descending from the root once per row.  A matched[] bitmap  
tracks which batch items were satisfied; the first unmatched item is  
reported as a violation.  Multi-column foreign keys fall back to  
per-row probing via the new ri_FastPathFlushLoop().  
  
The fast path introduced in the previous commit (2da86c1ef9) yields  
~1.8x speedup.  This commit adds ~1.6x on top of that, for a combined  
~2.9x speedup over the unpatched code (int PK / int FK, 1M rows, PK  
table and index cached in memory).  
  
FK tuples are materialized via ExecCopySlotHeapTuple() into a new  
purpose-specific memory context (flush_cxt), child of  
TopTransactionContext, which is also used for per-flush transient  
work: cast results, the search array, and index scan allocations.  
It is reset after each flush and deleted in teardown.  
  
The PK relation, index, tuple slots, and fast-path metadata are  
cached in RI_FastPathEntry across trigger invocations within a  
trigger-firing batch, avoiding repeated open/close overhead.  The  
snapshot and IndexScanDesc are taken fresh per flush.  The entry is  
not subject to cache invalidation: cached relations are held with  
locks for the transaction duration, and the entry's lifetime is  
bounded by the trigger-firing cycle.  
  
Lifecycle management for RI_FastPathEntry relies on three new  
mechanisms:  
  
  - AfterTriggerBatchCallback: A new general-purpose callback  
    mechanism in trigger.c.  Callbacks registered via  
    RegisterAfterTriggerBatchCallback() fire at the end of each  
    trigger-firing batch (AfterTriggerEndQuery for immediate  
    constraints, AfterTriggerFireDeferred at COMMIT, and  
    AfterTriggerSetState for SET CONSTRAINTS IMMEDIATE).  The RI  
    code registers ri_FastPathEndBatch as a batch callback.  
  
  - Batch callbacks only fire at the outermost query level  
    (checked inside FireAfterTriggerBatchCallbacks), so nested  
    queries from SPI inside other AFTER triggers do not tear down  
    the cache mid-batch.  
  
  - XactCallback: ri_FastPathXactCallback NULLs the static cache  
    pointer at transaction end, handling the abort path where the  
    batch callback never fired.  
  
  - SubXactCallback: ri_FastPathSubXactCallback NULLs the static  
    cache pointer on subtransaction abort, preventing the batch  
    callback from accessing already-released resources.  
  
  - AfterTriggerBatchIsActive(): A new exported accessor that  
    returns true when afterTriggers.query_depth >= 0.  During  
    ALTER TABLE ... ADD FOREIGN KEY validation, RI triggers are  
    called directly outside the after-trigger framework, so batch  
    callbacks would never fire.  The fast-path code uses this to  
    fall back to the non-cached per-invocation path in that  
    context.  
  
ri_FastPathEndBatch() flushes any partial batch before tearing  
down cached resources.  Since the FK relation may already be  
closed by flush time (e.g. for deferred constraints at COMMIT),  
it reopens the relation using entry->fk_relid if needed.  
  
The existing ALTER TABLE validation path bypasses batching and  
continues to call ri_FastPathCheck() directly per row, because  
RI triggers are called outside the after-trigger framework there  
and batch callbacks would never fire to flush the buffer.  
  
Suggested-by: David Rowley <dgrowleyml@gmail.com>  
Author: Amit Langote <amitlangote09@gmail.com>  
Co-authored-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Tested-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/CA+HiwqF4C0ws3cO+z5cLkPuvwnAwkSp7sfvgGj3yQ=Li6KNMqA@mail.gmail.com  

M src/backend/commands/trigger.c
M src/backend/utils/adt/ri_triggers.c
M src/include/commands/trigger.h
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql
M src/tools/pgindent/typedefs.list

jit: No backport::SectionMemoryManager for LLVM 22.

commit   : be21341e13d996b54ff8a2f1f9c8f4f1b63fc9ea    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 3 Apr 2026 14:48:54 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 3 Apr 2026 14:48:54 +1300    

Click here for diff

LLVM 22 has the fix that we copied into our tree in commit 9044fc1d and  
a new function to reach it[1][2], so we only need to use our copy for  
Aarch64 + LLVM < 22.  The only change to the final version that our copy  
didn't get is a new LLVM_ABI macro, but that isn't appropriate for us.  
Our copy is hopefully now frozen and would only need maintenance if bugs  
are found in the upstream code.  
  
Non-Aarch64 systems now also use the new API with LLVM 22.  It allocates  
all sections with one contiguous mmap() instead of one per  
section.  We could have done that earlier, but commit 9044fc1d wanted to  
limit the blast radius to the affected systems.  We might as well  
benefit from that small improvement everywhere now that it is available  
out of the box.  
  
We can't delete our copy until LLVM 22 is our minimum supported version,  
or we switch to the newer JITLink API for at least Aarch64.  
  
[1] https://github.com/llvm/llvm-project/pull/71968  
[2] https://github.com/llvm/llvm-project/pull/174307  
  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CA%2BhUKGJTumad75o8Zao-LFseEbt%3DenbUFCM7LZVV%3Dc8yg2i7dg%40mail.gmail.com  

M src/backend/jit/llvm/SectionMemoryManager.cpp
M src/backend/jit/llvm/llvmjit.c
M src/include/jit/SectionMemoryManager.h
M src/include/jit/llvmjit_backport.h

Further harden tests that might use not-so-compatible tar versions.

commit   : ebba64c08d965550b2d034ee931a27fdf2de56b7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2026 17:21:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2026 17:21:18 -0400    

Click here for diff

Buildfarm testing shows that OpenSUSE (and perhaps related platforms?)  
configures GNU tar in such a way that it'll archive sparse WAL files  
by default, thus triggering the pax-extension detection code added by  
bc30c704a.  Thus, we need something similar to 852de579a but for  
GNU tar's option set.  "--format=ustar" seems to do the trick.  
  
Moreover, the buildfarm shows that pg_verifybackup's 003_corruption.pl  
test script is also triggering creation of pax-format tar files on  
that platform.  We had not noticed because those test cases all fail  
(intentionally) before getting to the point of trying to verify WAL  
data.  
  
Since that means two TAP scripts need this option-selection logic, and  
plausibly more will do so in future, factor it out into a subroutine  
in Test::Utils.  We also need to back-patch the 003_corruption.pl fix  
into v18, where it's also failing.  
  
While at it, clean up some places where guards for $tar being empty  
or undefined were incomplete or even outright backwards.  Presumably,  
we missed noticing because the set of machines that run TAP tests  
and don't have tar installed is empty.  But if we're going to try  
to handle that scenario, we should do it correctly.  
  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/02770bea-b3f3-4015-8a43-443ae345379c@vondra.me  
Backpatch-through: 18  

M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/test/perl/PostgreSQL/Test/Utils.pm

Add additional jsonpath string methods

commit   : bd4f879a9cdd11b6b683cea0ea51d7c27a8f1153    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 2 Apr 2026 15:07:33 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 2 Apr 2026 15:07:33 -0400    

Click here for diff

Add the following jsonpath methods:  
  
*   l/r/btrim()  
*   lower(), upper()  
*   initcap()  
*   replace()  
*   split_part()  
  
Each simply dispatches to the standard string processing functions.  
These depend on the locale, but since it's set at `initdb`, they can be  
considered immutable and therefore allowed in any jsonpath expression.  
  
Author: Florents Tselai <florents.tselai@gmail.com>  
Co-authored-by: David E. Wheeler <david@justatheory.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CA+v5N40sJF39m0v7h=QN86zGp0CUf9F1WKasnZy9nNVj_VhCZQ@mail.gmail.com  

M doc/src/sgml/func/func-json.sgml
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/expected/sqljson_queryfuncs.out
M src/test/regress/sql/jsonb_jsonpath.sql
M src/test/regress/sql/jsonpath.sql
M src/test/regress/sql/sqljson_queryfuncs.sql

Rename jsonpath method arg tokens

commit   : a35c9d524ed0a225894c45a33017a82cd8bb6680    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 2 Apr 2026 15:07:24 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 2 Apr 2026 15:07:24 -0400    

Click here for diff

This is just cleanup in the jsonpath grammar.  
  
Rename the `csv_` tokens to `int_`, because they represent signed or  
unsigned integers, as follows:  
  
*   `csv_elem` => `int_elem`  
*   `csv_list` => `int_list`  
*   `opt_csv_list` => `opt_int_list`  
  
Rename the `datetime_precision` tokens to `uint_arg`, as they represent  
unsigned integers and will be useful for other methods in the future, as  
follows:  
  
*   `datetime_precision` => `uint_elem`  
*   `opt_datetime_precision` => `opt_uint_arg`  
  
Rename the `datetime_template` tokens to `str_arg`, as they represent  
strings and will be useful for other methods in the future, as follows:  
  
*   `datetime_template` => `str_elem`  
*   `opt_datetime_template` => `opt_str_arg`  
  
Author: David E. Wheeler <david@justatheory.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CA+v5N40sJF39m0v7h=QN86zGp0CUf9F1WKasnZy9nNVj_VhCZQ@mail.gmail.com  

M src/backend/utils/adt/jsonpath_gram.y

Add target_relid parameter to pg_get_publication_tables().

commit   : fd7a25af11e2cad4f48ffc4e50f18644e657ed53    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 2 Apr 2026 11:34:50 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 2 Apr 2026 11:34:50 -0700    

Click here for diff

When a tablesync worker checks whether a specific table is published,  
it previously issued a query to the publisher calling  
pg_get_publication_tables() and filtering the result by relid via a  
WHERE clause. Because the function itself was fully evaluated before  
the filter was applied, this forced the publisher to enumerate all  
tables in the publication. For publications covering a large number of  
tables, this resulted in expensive catalog scans and unnecessary CPU  
overhead on the publisher.  
  
This commit adds a new overloaded form of pg_get_publication_tables()  
that accepts an array of publication names and a target table  
OID. Instead of enumerating all published tables, it evaluates  
membership for the specified relation via syscache lookups, using the  
new is_table_publishable_in_publication() helper. This helper  
correctly accounts for publish_via_partition_root, ALL TABLES with  
EXCEPT clauses, schema publications, and partition inheritance, while  
avoiding the overhead of building the complete published table list.  
  
The existing VARIADIC array form of pg_get_publication_tables() is  
preserved for backward compatibility. Tablesync workers use the new  
two-argument form when connected to a publisher running PostgreSQL 19  
or later.  
  
Bump catalog version.  
  
Reported-by: Marcos Pegoraro <marcos@f10.com.br>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Haoyan Wang <wanghaoyan20@163.com>  
Discussion: https://postgr.es/m/CAB-JLwbBFNuASyEnZWP0Tck9uNkthBZqi6WoXNevUT6+mV8XmA@mail.gmail.com  

M src/backend/catalog/pg_publication.c
M src/backend/replication/logical/tablesync.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql

Harden astreamer tar parsing logic against archives it can't handle.

commit   : bc30c704add5518fbd831a5ad3bc46990c4954cf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2026 12:20:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 2 Apr 2026 12:20:26 -0400    

Click here for diff

Previously, there was essentially no verification in this code that  
the input is a tar file at all, let alone that it fits into the  
subset of valid tar files that we can handle.  This was exposed by  
the discovery that we couldn't handle files that FreeBSD's tar  
makes, because it's fairly aggressive about converting sparse WAL  
files into sparse tar entries.  To fix:  
  
* Bail out if we find a pax extension header.  This covers the  
sparse-file case, and also protects us against scenarios where  
the pax header changes other file properties that we care about.  
(Eventually we may extend the logic to actually handle such  
headers, but that won't happen in time for v19.)  
  
* Be more wary about tar file type codes in general: do not assume  
that anything that's neither a directory nor a symlink must be a  
regular file.  Instead, we just ignore entries that are none of the  
three supported types.  
  
* Apply pg_dump's isValidTarHeader to verify that a purported  
header block is actually in tar format.  To make this possible,  
move isValidTarHeader into src/port/tar.c, which is probably where  
it should have been since that file was created.  
  
I also took the opportunity to const-ify the arguments of  
isValidTarHeader and tarChecksum, and to use symbols not hard-wired  
constants inside tarChecksum.  
  
Back-patch to v18 but not further.  Although this code exists inside  
pg_basebackup in older branches, it's not really exposed in that  
usage to tar files that weren't generated by our own code, so it  
doesn't seem worth back-porting these changes across 3c9056981  
and f80b09bac.  I did choose to include a back-patch of 5868372bb  
into v18 though, to minimize cosmetic differences between these  
two branches.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/3049460.1775067940@sss.pgh.pa.us>  
Backpatch-through: 18  

M src/bin/pg_basebackup/astreamer_inject.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_waldump/archive_waldump.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_tar.c
M src/include/fe_utils/astreamer.h
M src/include/pgtar.h
M src/port/tar.c

Remove redundant SetLatch() calls in interrupt handling functions

commit   : 57706799186aa7971b78cab8911fb2604833de0f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 2 Apr 2026 23:55:30 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 2 Apr 2026 23:55:30 +0900    

Click here for diff

Interrupt handling functions (e.g., HandleCatchupInterrupt(),  
HandleParallelApplyMessageInterrupt()) are called only by  
procsignal_sigusr1_handler(), which already calls SetLatch()  
for the current process at the end of its processing.  
Therefore, these interrupt handling functions do not need to  
call SetLatch() themselves.  
  
However, previously, some of these functions redundantly  
called SetLatch(). This commit removes those unnecessary  
calls.  
  
While duplicate SetLatch() calls are redundant, they are  
harmless, so this change is not backpatched.  
  
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Discussion: https://postgr.es/m/CALj2ACWd5apddj6Cd885WwJ6LquYu_G81C4GoR4xSoDV1x-FEA@mail.gmail.com  

M src/backend/access/transam/parallel.c
M src/backend/commands/async.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/sinval.c

Check for __cpuidex and __get_cpuid_count separately

commit   : effaa464afd355e8927bf430cfe6a0ddd2ee5695    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 2 Apr 2026 19:39:57 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 2 Apr 2026 19:39:57 +0700    

Click here for diff

Previously we would only check for the availability of __cpuidex if  
the related __get_cpuid_count was not available on a platform.  
  
Future commits will need to access hypervisor information about  
the TSC frequency of x86 CPUs. For that case __cpuidex is the only  
viable option for accessing a high leaf (e.g. 0x40000000), since  
__get_cpuid_count does not allow that.  
  
__cpuidex is defined in cpuid.h for gcc/clang, but in intrin.h  
for MSVC, so adjust tests to suite. We also need to cast the array  
of unsigned ints to signed, since gcc (with -Wall) and clang emit  
warnings otherwise.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: John Naylor <john.naylor@postgresql.org>  
Discussion: https://postgr.es/m/CAP53PkyooCeR8YV0BUD_xC7oTZESHz8OdA=tP7pBRHFVQ9xtKg@mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/port/pg_cpu_x86.c

Use command_ok for pg_regress calls in 002_pg_upgrade and 027_stream_regress

commit   : bb6ae9707c1789c9d2036c9bbd35965a01e1b214    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:55:21 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:55:21 -0400    

Click here for diff

Now that command_ok() captures and displays failure output, use it  
instead of system() plus manual diff-dumping in these two tests.  This  
simplifies both scripts and produces consistent, truncated output on  
failure.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/DFYFWM053WHS.10K8ZPJ605UFK@jeltef.nl  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/test/recovery/t/027_stream_regress.pl

perl tap: Use croak instead of die in our helper modules

commit   : b8da9869b850246ea047038fb974830269b83bcc    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:55:13 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:55:13 -0400    

Click here for diff

Replace die with croak throughout Cluster.pm and Utils.pm (except in  
INIT blocks and signal handlers, where die is correct) so that error  
messages report the test script's line number rather than the helper  
module's.  
  
Add @CARP_NOT in Utils.pm listing PostgreSQL::Test::Cluster, so that  
when a Utils function is called through a Cluster.pm wrapper, croak  
skips both packages and reports the actual test-script caller.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/DFYFWM053WHS.10K8ZPJ605UFK@jeltef.nl  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm

perl tap: Show die reason in TAP output

commit   : 76540fdedf405c01518007bef3bdd96e0b96d390    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:54:41 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:54:41 -0400    

Click here for diff

Install a $SIG{__DIE__} handler in the INIT block of Utils.pm that emits  
the die message as a TAP diagnostic.  Previously, an unexpected die  
(e.g. from safe_psql) produced only "no plan was declared" with no  
indication of the actual error.  The handler also calls done_testing()  
to suppress that confusing message.  
  
Dies during compilation ($^S undefined) and inside eval ($^S == 1) are  
left alone.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/DFYFWM053WHS.10K8ZPJ605UFK@jeltef.nl  
Discussion: https://postgr.es/m/20220222181924.eehi7o4pmneeb4hm%40alap3.anarazel.de  

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

perl tap: Show failed command output

commit   : 1402b8d2fc70faa5154cbc26cab8c4ac384880db    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:54:29 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:54:29 -0400    

Click here for diff

Capture stdout and stderr from command_ok() and command_fails() and emit  
them as TAP diagnostics on failure.  Output is truncated to the first  
and last 30 lines per channel to avoid flooding.  
  
A new helper _diag_command_output() is introduced in Utils.pm so  
both functions share the same truncation and formatting logic.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/DFYFWM053WHS.10K8ZPJ605UFK@jeltef.nl  

M src/bin/pg_ctl/t/001_start_stop.pl
M src/test/perl/PostgreSQL/Test/Utils.pm

pg_regress: Include diffs in TAP output

commit   : 5720ae01436480c1dcdd34ece0c3d83b00844bca    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:53:49 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 1 Apr 2026 13:53:49 -0400    

Click here for diff

When pg_regress fails it is often tedious to find the actual diffs,  
especially in CI where you must navigate a file browser.  Emit the first  
80 lines of the combined regression.diffs as TAP diagnostics so the  
failure reason is visible directly in the test output.  
  
The line limit is across all failing tests in a single pg_regress run to  
avoid flooding when a crash causes every subsequent test to fail.  
  
New DIAG_DETAIL / DIAG_END tap output types are added, mirroring the  
existing NOTE_DETAIL / NOTE_END pair, so that long diff lines can be  
emitted without spurious '#' prefixes on continuation lines.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/DFYFWM053WHS.10K8ZPJ605UFK@jeltef.nl  

M src/test/regress/pg_regress.c

jit: Change the default to off.

commit   : 7f8c88c2b872cb74882ab93dcb05529dab2a10bc    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 2 Apr 2026 12:53:18 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 2 Apr 2026 12:53:18 +0200    

Click here for diff

While JIT can speed up large analytical queries, it can also cause  
serious performance issues on otherwise very fast queries. Compiling  
and optimizing the expressions may be so expensive, it completely  
outweighs the JIT benefits for shorter queries.  
  
Ideally, we'd address this in the cost model, but the part deciding  
whether to enable JIT for a query is rather simple, partially because we  
don't have any reliable estimates of how expensive the LLVM compilation  
and optimization is.  
  
Sometimes seemingly unrelated changes (for example a couple additional  
INSERTs into a table) increase the cost just enough to enable JIT,  
resulting in a performance cliff.  
  
Because of these risks, most large-scale deployments already disable JIT  
by default. Notably, this includes all hyperscalers.  
  
This commit changes our default to align with that established practice.  
If we improve the JIT (be it better costing or cheaper execution), we  
can consider enabling it by default again.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://postgr.es/m/DG1VZJEX1AQH.2EH4OKGRUDB71@jeltef.nl  

M doc/src/sgml/config.sgml
M src/backend/jit/jit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample

Test pg_stat_statements across crash restart

commit   : 148fe2b05df592f5bca575b4e5e8a4253ea5a3ce    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 2 Apr 2026 13:33:06 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 2 Apr 2026 13:33:06 +0300    

Click here for diff

Add 'pg_stat_statements' to the crash restart test, to test that  
shared memory and LWLock initialization works across crash restart in  
a library listed in shared_preload_libraries. We had no test coverage  
for that.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/test/recovery/t/013_crash_restart.pl

Doc: Fix oversight in commit 55cefadde8.

commit   : 4441d6b2e44976b499bec334a8a7f087f9189974    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 2 Apr 2026 10:16:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 2 Apr 2026 10:16:53 +0530    

Click here for diff

pg_publication_rel.prrelid refers to sequences whereas stores information only of tables.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pv1UKR_bxmN7wcCCpQveHoYprvH-hbdFq8gsaH1Ye7B_w@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

jit: Stop emitting lifetime.end for LLVM 22.

commit   : de6b80e5ff4b92b1ca6e1fd3bf0f737f857f114d    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 2 Apr 2026 15:24:44 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 2 Apr 2026 15:24:44 +1300    

Click here for diff

The lifetime.end intrinsic can now only be used for stack memory  
allocated with alloca[1][2][3].  We use it to tell LLVM about the  
lifetime of function arguments/isnull values that we keep in palloc'd  
memory, so that it can avoid spilling registers to memory.  
  
We might need to rearrange things and put them on the stack, but that'll  
take some research.  In the meantime, unbreak the build on LLVM 22.  
  
[1] https://github.com/llvm/llvm-project/pull/149310  
[2] https://llvm.org/docs/LangRef.html#llvm-lifetime-end-intrinsic  
[3] https://llvm.org/docs/LangRef.html#i-alloca  
  
Backpatch-through: 14  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com> (earlier attempt)  
Reviewed-by: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com> (earlier attempt)  
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier attempt)  
Discussion: https://postgr.es/m/CA%2BhUKGJTumad75o8Zao-LFseEbt%3DenbUFCM7LZVV%3Dc8yg2i7dg%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit_expr.c

Fix nocachegetattr() so it again supports deforming cstrings

commit   : 331d829e62dbb08112bb3a2c5770cd10ba0ffccb    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 2 Apr 2026 14:11:17 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 2 Apr 2026 14:11:17 +1300    

Click here for diff

c456e3911 added various optimizations to the tuple deformation routines.  
One optimization assumed that heap tuples would never contain cstrings.  
That optimization also made its way into nocachegetattr(), which isn't  
correct as ROW() types get formed into HeapTuples by ExecEvalRow() and  
those can contain cstring Datums.  nocachegetattr() gets used to extract  
Datums from those tuples.  
  
Here we remove the pg_assume(), which was there to instruct the compiler  
to omit the attlen == -2 related code in att_addlength_pointer().  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/80aeac57-8f50-4732-a5b4-c2373c3f8149@gmail.com  

M src/backend/access/common/heaptuple.c

pg_test_timing: Reduce per-loop overhead

commit   : 82c0cb4e672dbc89f0bd0013c625a3a16ee36ad6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 20:02:09 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 20:02:09 -0400    

Click here for diff

The pg_test_timing program was previously using INSTR_TIME_GET_NANOSEC on an  
absolute instr_time value in order to do a diff, which goes against the spirit  
of how the GET_* macros are supposed to be used, and will cause overhead in a  
future change that assumes these macros are typically used on intervals only.  
  
Additionally the program was doing unnecessary work in the test loop by  
measuring the time elapsed, instead of checking the existing current time  
measurement against a target end time. To support that, introduce a new  
INSTR_TIME_ADD_NANOSEC macro that allows adding user-defined nanoseconds  
to an instr_time variable.  
  
While modifying the relevant code anyway, simplify it by not handling  
durations <= 0 in test_timing(), since duration is unsigned and 0 is  
disallowed by the caller.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53Pkyxv3-3gX+aOxC5tX0p2v9RHU+XH0iyvb64+ZnBXj92vg@mail.gmail.com  

M src/bin/pg_test_timing/pg_test_timing.c
M src/include/portability/instr_time.h

read_stream: Prevent distance from decaying too quickly

commit   : 6e36930f9aaffd5e097a01935e6f68ed851535ae    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 19:50:03 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 19:50:03 -0400    

Click here for diff

Until now we reduced the look-ahead distance by 1 on every hit, and doubled it  
on every miss. That is problematic because there are very common IO patterns  
where this prevents us from ever reaching a sufficiently high distance (e.g. a  
miss followed by a hit will never have the distance grow beyond 2). In many  
such cases, if we had ever reached a sufficient look-ahead distance, things  
would have been fine, because we grow the distance faster than we decrease it.  
  
One might think that the most obvious answer to this problem would be to never  
reduce the distance. However, that would not work well, as (particularly with  
upcoming users of read streams), it is reasonably common to at first have a  
lot of misses and then to transition to a fully cached workload, e.g. because  
the same blocks are needed repeatedly within one stream. Doing unnecessarily  
deep readahead can be costly, due to having to pin a lot more buffers, which  
increases CPU overhead.  
  
Because the cost of a synchronously handled miss can be very high (multiple  
milliseconds for every IO with commonly used storage) compared to the CPU  
overhead of keeping the distance too high, we want to err on the side of not  
reducing the distance too early.  
  
The insight that a decrease of the distance by 1 at ever hit may be ok at  
large distances, but not at low distances, shows a way out: If we only allow  
decreasing the distance once there were no misses for our maximum look-ahead  
distance, we will keep the distance high as long as readahead has a chance to  
do IO asynchronously, but not commonly when not.  
  
Several folks have written variants of this patch, including at least Thomas  
Munro, Melanie Plageman and I.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CA+hUKGL2PhFyDoqrHefqasOnaXhSg48t1phs3VM8BAdrZqKZkw@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-Wz%3DkMg3PNay96cHMT0LFwtxP-cQSRZTZzh1Cixxf8G%3Dzrw%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c

read_stream: Issue IO synchronously while in fast path

commit   : cceb1bf45e3a12a859c1453bd53925b95d1b0cf1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 19:22:44 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 19:22:44 -0400    

Click here for diff

While in fast-path, execute any IO that we might encounter synchronously.  
Because we are, in that moment, not reading ahead, dispatching any occasional  
IO to workers has the dispatch overhead, without any realistic chance of the  
IO completing before we need it.  
  
This helps io_method=worker performance for workloads that have only  
occasional cache misses, but where those occasional misses still take long  
enough to matter.  It is likely this is only measurable with fast local  
storage or workloads with the data in the kernel page cache, as with remote  
storage the IO latency, not the dispatch-to-worker latency, is the determining  
factor.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CAH2-Wz%3DkMg3PNay96cHMT0LFwtxP-cQSRZTZzh1Cixxf8G%3Dzrw%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c

Make ShmemIndex visible in the pg_shmem_allocations view

commit   : 1bdbb211bbf31b0024f000746c42326648ecde90    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 1 Apr 2026 23:56:51 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 1 Apr 2026 23:56:51 +0300    

Click here for diff

Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

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

Give an 'options' parameter to tuple_delete/_update

commit   : db89a47115f0c7e664832f4b41cb03130b8a4fbe    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 1 Apr 2026 20:26:57 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 1 Apr 2026 20:26:57 +0200    

Click here for diff

The tuple_insert() method already has an equivalent argument, so this  
makes sense just on consistency grounds, for future growth.  
  
table_delete() can immediately use it to carry the 'changingPart'  
boolean; for table_update we don't have any options at present.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> (older version)  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Antonin Houska <ah@cybertec.at>  
Discussion: https://postgr.es/m/202603171606.kf6pmhscqbqz@alvherre.pgsql  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/heapam.h
M src/include/access/tableam.h

Add UPDATE/DELETE FOR PORTION OF

commit   : 8e72d914c52876525a90b28444453de8085c866f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 19:06:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 19:06:03 +0200    

Click here for diff

This is an extension of the UPDATE and DELETE commands to do a  
"temporal update/delete" based on a range or multirange column.  The  
user can say UPDATE t FOR PORTION OF valid_at FROM '2001-01-01' TO  
'2002-01-01' SET ... (or likewise with DELETE) where valid_at is a  
range or multirange column.  
  
The command is automatically limited to rows overlapping the targeted  
portion, and only history within those bounds is changed.  If a row  
represents history partly inside and partly outside the bounds, then  
the command truncates the row's application time to fit within the  
targeted portion, then it inserts one or more "temporal leftovers":  
new rows containing all the original values, except with the  
application-time column changed to only represent the untouched part  
of history.  
  
To compute the temporal leftovers that are required, we use the *_minus_multi  
set-returning functions defined in 5eed8ce50c.  
  
- Added bison support for FOR PORTION OF syntax.  The bounds must be  
  constant, so we forbid column references, subqueries, etc. We do  
  accept functions like NOW().  
- Added logic to executor to insert new rows for the "temporal  
  leftover" part of a record touched by a FOR PORTION OF query.  
- Documented FOR PORTION OF.  
- Added tests.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024%40illuminatedcomputing.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/dml.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/images/Makefile
M doc/src/sgml/images/meson.build
A doc/src/sgml/images/temporal-delete.svg
A doc/src/sgml/images/temporal-delete.txt
A doc/src/sgml/images/temporal-update.svg
A doc/src/sgml/images/temporal-update.txt
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/update.sgml
M doc/src/sgml/trigger.sgml
M src/backend/executor/execMain.c
M src/backend/executor/nodeModifyTable.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_merge.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/include/nodes/execnodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/pathnode.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_node.h
M src/include/utils/lsyscache.h
A src/test/regress/expected/for_portion_of.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/without_overlaps.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/for_portion_of.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/updatable_views.sql
M src/test/regress/sql/without_overlaps.sql
M src/test/subscription/t/034_temporal.pl
M src/tools/pgindent/typedefs.list

Fix vicinity of tuple_insert to use uint32, not int, for options

commit   : ec2f81766ad72d3ff4c45400f30d2670589aec11    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 1 Apr 2026 18:14:51 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 1 Apr 2026 18:14:51 +0200    

Click here for diff

Oversight in commit 1bd6f22f43ac: I was way too optimistic about the  
compiler letting me know what variables needed to be updated, and missed  
a few of them.  Clean it up.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/40E570EE-5A60-49D8-B8F7-2F8F2B7C8DFA@gmail.com  

M src/backend/access/common/toast_internals.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/table/toast_helper.c
M src/backend/commands/copyfrom.c
M src/backend/commands/createas.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h

Add support for extended statistics on virtual generated columns.

commit   : f7f4052a4e959ded803417b14af2b45316445940    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 1 Apr 2026 17:02:24 +0100    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 1 Apr 2026 17:02:24 +0100    

Click here for diff

This allows both univariate and multivariate statistics to be built on  
virtual generated columns and expressions that refer to virtual  
generated columns. The restriction disallowing extended statistics on  
a single column is lifted in the case of a single virtual generated  
column, since it is treated as a single expression.  
  
In the catalogs, references to virtual generated columns are stored  
as-is. They are expanded at ANALYZE time to build the statistics, and  
at planning time to allow the optimizer to make use of the statistics.  
This allows the statistics to be correctly rebuilt using ANALYZE, if a  
column's generation expression is altered (which causes any existing  
statistics data to be deleted).  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/20250422181006.dd6f9d1d81299f5b2ad55e1a@sraoss.co.jp  

M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_statistics.sgml
M src/backend/commands/statscmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/statistics/extended_stats.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

doc: Add missing description for DROP SUBSCRIPTION IF EXISTS.

commit   : 196bf448e0054304f3e18df00c5c6133e5c8c7d7    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 1 Apr 2026 09:48:48 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 1 Apr 2026 09:48:48 -0500    

Click here for diff

Oversight in commit 665d1fad99.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHut%2BPv72haFerrCdYdmF6hu6o2jKcGzkXehom%2BsP-JBBmOVDg%40mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/drop_subscription.sgml

bufmgr: Return whether WaitReadBuffers() needed to wait

commit   : 513374a47a71d64ff5c4790b7f962d3a80e8cc7c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 09:26:43 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 09:26:43 -0400    

Click here for diff

Thanks to the previous commit, pgaio_wref_check_done() will now detect whether  
IO has completed even if userspace has not yet consumed the kernel completion.  
This knowledge can be useful for callers of WaitReadBuffers() to know whether  
it needed to wait or not, e.g. for adjusting read-ahead aggressiveness or for  
instrumentation.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CAH2-Wz%3DkMg3PNay96cHMT0LFwtxP-cQSRZTZzh1Cixxf8G%3Dzrw%40mail.gmail.com  
Discussion: https://postgr.es/m/a177a6dd-240b-455a-8f25-aca0b1c08c6e@vondra.me  

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

aio: io_uring: Allow IO methods to check if IO completed in the background

commit   : 6e648e353fa04ad86f896da347bbb9b51bc98ad4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 09:26:43 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 1 Apr 2026 09:26:43 -0400    

Click here for diff

Until now pgaio_wref_check_done() with io_method=io_uring would not detect if  
IOs are known to have completed to the kernel, but the completion has not yet  
been consumed by userspace.  This can lead to inferior performance and also  
makes it harder to use smarter feedback logic in read_stream, because we  
cannot use knowledge about whether an IO completed to control the readahead  
distance.  
  
This commit just adds the io_uring specific infrastructure. Later commits will  
return whether a wait was needed from WaitReadBuffers() and then use that  
knowledge.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/f3xxfrkafjxpyqxywcxricxgyizjirfceychyxsgn7bwjp5eda@kwbduhy7tfmu  
Discussion: https://postgr.es/m/CAH2-Wz%3DkMg3PNay96cHMT0LFwtxP-cQSRZTZzh1Cixxf8G%3Dzrw%40mail.gmail.com  

M src/backend/storage/aio/aio.c
M src/backend/storage/aio/method_io_uring.c
M src/include/storage/aio_internal.h

Make FastPathMeta self-contained by copying FmgrInfo structs

commit   : edee5634564d5f9fae4c3a10ee3182de338ed07e    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Wed, 1 Apr 2026 18:43:40 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Wed, 1 Apr 2026 18:43:40 +0900    

Click here for diff

FastPathMeta stored pointers into ri_compare_cache entries via  
compare_entries[], creating a dependency on that cache remaining  
stable.  If ri_compare_cache entries were invalidated after fpmeta  
was populated, the pointers would dangle.  
  
Replace compare_entries[] with inline copies of the two FmgrInfo  
fields actually needed (cast_func_finfo and eq_opr_finfo), copied  
at populate time via fmgr_info_copy().  fpmeta now depends only on  
riinfo remaining valid, which is already handled by the invalidation  
callback.  
  
Introduced by commit 2da86c1ef9 ("Add fast path for foreign key  
constraint checks"), noticed while reviewing code for robustness  
under CLOBBER_CACHE_ALWAYS.  
  
Discussion: https://postgr.es/m/CA+HiwqFQ+ZA7hSOygv4uv_t75B3r0_gosjadetCsAEoaZwTu6g@mail.gmail.com  

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

Fix two issues in fast-path FK check introduced by commit 2da86c1ef9

commit   : e484b0eea61482207b8fb8df9533be6d7defc25e    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Wed, 1 Apr 2026 17:29:33 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Wed, 1 Apr 2026 17:29:33 +0900    

Click here for diff

First, under CLOBBER_CACHE_ALWAYS, the RI_ConstraintInfo entry can  
be invalidated by relcache callbacks triggered inside table_open()  
or index_open(), leaving ri_FastPathCheck() calling  
ri_populate_fastpath_metadata() with a stale entry whose valid flag  
is false.  Fix by moving the fpmeta initialization to after  
ri_CheckPermissions(), reloading riinfo first to ensure it is  
valid, then calling ri_ExtractValues() and build_index_scankeys()  
immediately after before any further operations that could trigger  
invalidation.  
  
Second, fpmeta allocated in TopMemoryContext was not freed when the  
entry was invalidated in InvalidateConstraintCacheCallBack(),  
leaking memory each time the constraint cache entry was recycled.  
Fix by freeing and NULLing fpmeta at invalidation time.  
  
Noticed locally when testing with CLOBBER_CACHE_ALWAYS.  
  
Discussion: https://postgr.es/m/CA+HiwqGBU__7-VZZhQWQ3EQuwLYNPd9==ngnzduhGWKHMj9mvw@mail.gmail.com  

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

Skip common prefixes during radix sort

commit   : f6bd9f0fe25a3cea06e26204cc75cc6e954c4577    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 1 Apr 2026 14:18:57 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 1 Apr 2026 14:18:57 +0700    

Click here for diff

During the counting step, keep track of the bits that are the same  
for the entire input.  If we counted only a single distinct byte,  
the next recursion will start at the next byte position that has  
more than one distinct byte in the input. This allows us to skip over  
multiple passes where the byte is the same for the entire input.  
  
This provides a significant speedup for integers that have some upper  
bytes with all-zeros or all-ones, which is common.  
  
Reviewed-by: Chengpeng Yan <chengpeng_yan@outlook.com>  
Reviewed-by: ChangAo Chen <cca5507@qq.com>  
Discussion: https://postgr.es/m/CANWCAZYpGMDSSwAa18fOxJGXaPzVdyPsWpOkfCX32DWh3Qznzw@mail.gmail.com  

M src/backend/utils/sort/tuplesort.c

Reduce log level of some logical decoding messages from LOG to DEBUG1

commit   : 21b018e7eab57b5e4be183133a8c5b8229eccb3d    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 1 Apr 2026 15:43:02 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 1 Apr 2026 15:43:02 +0900    

Click here for diff

Previously some logical decoding messages (e.g., "logical decoding found  
consistent point") were logged at level LOG, even though they provided  
low-level, developer-oriented information that DBAs were typically not  
interested in.  
  
Since these messages can occur routinely (for example, when keeping calling  
pg_logical_slot_get_changes() to obtain the changes from logical decoding),  
logging them at LOG can be overly verbose.  
  
This commit reduces their log level to DEBUG1 to avoid unnecessary log noise.  
  
This change applies to a small set of messages for now. Additional messages  
may be adjusted similarly in the future.  
  
Even with this change, if these messages from walsender still need to be  
observed, enabling DEBUG1 logging selectively for walsender (e.g.,  
log_min_messages = 'warning,walsender:debug1') would be helpful to avoid  
increasing overall log volume.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwGTyHgtD9tyN664x6vQ8Q1G53H7ZUCgBU9_X=nLt3f1QA@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/test/recovery/t/038_save_logical_slots_shutdown.pl

Use standard C23 and C++ attributes if available

commit   : 76f4b92bac87fa54bd6dd8bd53e59f93127ec2ef    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 08:03:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 08:03:01 +0200    

Click here for diff

Use the standard C23 and C++ attributes [[nodiscard]], [[noreturn]],  
and [[maybe_unused]], if available.  
  
This makes pg_nodiscard and pg_attribute_unused() available in  
not-GCC-compatible compilers that support C23 as well as in C++.  
  
For pg_noreturn, we can now drop the GCC-specific and MSVC-specific  
fallbacks, because the C11 and the C++ implementation will now cover  
all required cases.  
  
Note, in a few places, we need to change the position of the attribute  
because it's not valid in that place in C23.  
  
Discussion: https://www.postgresql.org/message-id/flat/pxr5b3z7jmkpenssra5zroxi7qzzp6eswuggokw64axmdixpnk@zbwxuq7gbbcw  

M src/backend/utils/mmgr/slab.c
M src/include/c.h
M src/include/lib/radixtree.h
M src/test/modules/worker_spi/worker_spi.c

Enable test_cplusplusext with MSVC

commit   : c05ad248f99c729b53f6fa83939266b509682c33    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 07:48:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 1 Apr 2026 07:48:47 +0200    

Click here for diff

The test_cplusplusext test module has so far been disabled on MSVC.  
The only remaining problem now is that designated initializers, as  
used in PG_MODULE_MAGIC, require C++20.  (With GCC and Clang they work  
in older C++ versions as well.)  
  
This adds another test in the top-level meson.build to check that the  
compiler supports C++20 designated initializers.  This is not  
required, we are just checking and recording the answer.  If yes, we  
can enable the test module.  
  
Most current compilers likely won't be in C++20 mode by default.  This  
doesn't change that; we are not doing anything to try to switch the  
compiler into that mode.  This might be a separate project, but for  
now we'll leave that for the user or the test scaffolding.  
  
The VS task on Cirrus CI is changed to provide the required flag to  
turn on C++20 mode.  
  
There is no equivalent change in configure, since this change mainly  
targets MSVC.  
  
Co-authored-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com  

M .cirrus.tasks.yml
M meson.build
M src/test/modules/test_cplusplusext/meson.build

Fix miscellaneous issues in EXCEPT publication clause.

commit   : 6b0550c45d132c7a75acf98cb76f8a43bf5e94df    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 1 Apr 2026 09:08:54 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 1 Apr 2026 09:08:54 +0530    

Click here for diff

Improve documentation regarding multiple publications and partition  
hierarchies. Refine error reporting for excluded relations. Consolidate  
docs by using table_object instead of expanded table syntax in publication  
commands. Also includes minor test cleanup and naming fixes.  
  
Reported-by: Peter Smith <smithpb2250@gmail.com>  
Author: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm1CiBYcteE_jjPA4BPHfX30dg9eTTTkJgkjY5tgE7t=bQ@mail.gmail.com  
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/test/regress/expected/publication.out
M src/test/subscription/t/037_except.pl

Fix pg_waldump/t/001_basic.pl with BSD tar on ZFS.

commit   : 852de579a6eea3bebf719530ea2d2c232573b845    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 1 Apr 2026 14:02:39 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 1 Apr 2026 14:02:39 +1300    

Click here for diff

The new test fails with an error about a missing WAL file on that  
stack, because it is archived in GNU tar's --sparse --format=posix  
format.  BSD tar uses that format by default, unlike GNU tar itself, and  
ZFS triggers it by implicitly creating sparse files when it sees a lot  
of zeroes.  
  
The problem will surely also affect real users of the new tar support in  
pg_waldump (commit b15c1513) and pg_verifybackup (commit b3cf461b3) on  
such systems.  Ideas under discussion, but for now the test is made to  
pass by disabling sparse file detection in BSD tar.  
  
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/1624716.1774736283%40sss.pgh.pa.us  

M src/bin/pg_waldump/t/001_basic.pl

bufmgr: Fix ordering of checks in PinBuffer()

commit   : c0af4eb4e71ecd4826ae6c9985f1d10ace5e1be6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 31 Mar 2026 19:24:58 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 31 Mar 2026 19:24:58 -0400    

Click here for diff

The check for skip_if_not_valid added in 819dc118c0f6 was put at the start of  
the loop. A CAS loop in theory does allow to make that check in a race free  
manner. However, just after the check, there's a  
    old_buf_state = WaitBufHdrUnlocked(buf);  
which introduces a race, because it would allow BM_VALID to be cleared, after  
the skip_if_not_valid check.  
  
Fix by restarting the loop after WaitBufHdrUnlocked().  
  
Reported-by: Yura Sokolov <y.sokolov@postgrespro.ru>  
Discussion: https://postgr.es/m/5bf667f3-5270-4b19-a08f-0facbecdff68@postgrespro.ru  

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

Doc: warn that parallel pg_restore may fail if --no-schema was used.

commit   : 273d26b75e78a4811b0c6039c0ee38cde2341ce4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 16:36:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 16:36:01 -0400    

Click here for diff

If the archive file was made with --no-schema or related options  
then it likely does not have enough dependency information to  
ensure that parallel restore will choose a workable restore order.  
Document this.  
  
In passing, do some minor wordsmithing on new nearby text about  
restoring from pg_dumpall archives.  
  
Author: vaibhave postgres <postgresvaibhave@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAM_eQjzTLtt1X9WKvMV6Rew0UvxT3mmhimZa9WT-vqaPjmXk-g@mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_restore.sgml

Fix test_aio read_buffers() to work without cassert

commit   : 8519251ee975a8cca16fb35d699c1a39f2d217a1    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 31 Mar 2026 15:02:52 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 31 Mar 2026 15:02:52 -0400    

Click here for diff

In a production build, StartReadBuffers() doesn't populate all fields  
of a ReadBuffersOperation for a buffer hit because no callers use them  
(they are populated in assert builds).  
  
read_buffers() (a test-only function) relied on some of these fields, so  
AIO tests failed on non-assert builds (discovered on the buildfarm after  
commit 020c02bd908).  
  
Fix by tracking the required information ourselves in read_buffers() and  
avoiding reliance on the ReadBuffersOperation unless we know that we did  
IO.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/9ce8f5d8-8ab2-4aa2-b062-c5d74161069c%40gmail.com  

M src/test/modules/test_aio/test_aio.c

oauth: Don't log discovery connections by default

commit   : e020a897efeaed52cd3f5fef7f933cb5dc6cbfaf    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:33 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:33 -0700    

Click here for diff

Currently, when the client sends a parameter discovery request within  
OAUTHBEARER, the server logs the attempt with  
  
    FATAL:  OAuth bearer authentication failed for user  
  
These log entries are difficult to distinguish from true authentication  
failures, and by default, libpq sends a discovery request as part of  
every OAuth connection, making them annoyingly noisy. Use the new  
PG_SASL_EXCHANGE_ABANDONED status to suppress them.  
  
Patch by Zsolt Parragi, with some additional comments added by me.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAN4CZFPim7hUiyb7daNKQPSZ8CvQRBGkVhbvED7yZi8VktSn4Q%40mail.gmail.com  

M src/backend/libpq/auth-oauth.c
M src/test/modules/oauth_validator/t/001_server.pl

sasl: Allow backend mechanisms to "abandon" exchanges

commit   : c4ff16339f07d1e253bdf18e5da5fa25f62a750d    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:31 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:31 -0700    

Click here for diff

Introduce PG_SASL_EXCHANGE_ABANDONED, which allows CheckSASLAuth to  
suppress the failing log entry for any SASL exchange that isn't actually  
an authentication attempt. This is desirable for OAUTHBEARER's discovery  
exchanges (and a subsequent commit will make use of it there).  
  
This might have some overlap in the future with in-band aborts for SASL  
exchanges, but it's intentionally not named _ABORTED to avoid confusion.  
(We don't currently support clientside aborts in our SASL profile.)  
  
Adapted from a patch by Zsolt Parragi.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAN4CZFPim7hUiyb7daNKQPSZ8CvQRBGkVhbvED7yZi8VktSn4Q%40mail.gmail.com  

M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth.c
M src/include/libpq/sasl.h

Add FATAL_CLIENT_ONLY to ereport/elog

commit   : c2bca7cc9621f45e27dc332e3f58c7544386de88    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:29 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:29 -0700    

Click here for diff

SASL exchanges must end with either an AuthenticationOk or an  
ErrorResponse from the server, and the standard way to produce an  
ErrorResponse packet is for auth_failed() to call ereport(FATAL). This  
means that there's no way for a SASL mechanism to suppress the server  
log entry if the "authentication attempt" was really just a query for  
authentication metadata, as is done with OAUTHBEARER.  
  
Following the example of 1f9158ba4, add a FATAL_CLIENT_ONLY elevel. This  
will allow ClientAuthentication() to choose not to log a particular  
failure, while still correctly ending the authentication exchange before  
process exit.  
  
(The provenance of this patch is convoluted: since it's a mechanical  
copy-paste of 1f9158ba4, both Zsolt Parragi and I produced nearly  
identical versions independently, and Andrey Borodin reviewed Zsolt's  
version. Tom Lane is the author of 1f9158ba4, but I don't want to imply  
that he's signed off on this adaptation. See Discussion.)  
  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/CAN4CZFPim7hUiyb7daNKQPSZ8CvQRBGkVhbvED7yZi8VktSn4Q%40mail.gmail.com  

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

libpq: Allow developers to reimplement libpq-oauth

commit   : 09532b4040ed4c313351366166f55e810f152d6a    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:26 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:26 -0700    

Click here for diff

For PG19, since we won't have the ability to officially switch out flow  
plugins, relax the flow-loading code to not require the internal init  
function. Modules that don't have one will be treated as custom user  
flows in error messages.  
  
This will let bleeding-edge developers more easily test out the API and  
provide feedback for PG20, by telling the runtime linker to find a  
different libpq-oauth. It remains undocumented for end users.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  

M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h

libpq: Poison the v2 part of a v1 Bearer request

commit   : 0af4d402cb900364f275cc6f9c28dca4a5bec36b    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:23 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 31 Mar 2026 11:47:23 -0700    

Click here for diff

The new PGoauthBearerRequestV2 API (which has similarities to the  
"subclass" pointer architecture in use by the backend, for Nodes)  
carries the risk of a developer ignoring the type of hook in use and  
just casting directly to the V2 struct. This will appear to work fine in  
19, but crash (or worse) when speaking to libpq 18.  
  
However, we're in a unique position to catch this problem, because we  
have tight control over the struct. Add poisoning code to the v1 path  
which does the following:  
  
- masks the v2 request->issuer pointer, to hopefully point at nonsense  
  memory  
- abort()s if the v2 request->error is assigned by the hook  
- attempts to cover both with VALGRIND_MAKE_MEM_NOACCESS for the  
  duration of the callback (a potential AddressSanitizer implementation  
  is left for future work)  
  
The struct is unpoisoned after the call, so we can switch back to the v2  
internal implementation when necessary.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOYmi%2BnCg5upBVOo_UCSjMfO%3DYMkZXcSEsgaADKXqerr5wahZQ%40mail.gmail.com  

M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h

Avoid including vacuum.h in tableam.h and heapam.h.

commit   : 771fe0948cad0acf883f15026c718d4f6942c8cb    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 31 Mar 2026 12:43:52 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 31 Mar 2026 12:43:52 -0500    

Click here for diff

Commit 2252fcd427 modified some function prototypes in tableam.h  
and heapam.h to take a VacuumParams argument instead of a pointer,  
which required including vacuum.h in those headers.  vacuum.h has a  
reasonably large dependency tree, and headers like tableam.h are  
widely included, so this is not ideal.  To fix, change the  
functions in question to accept a "const VacuumParams *" argument  
instead.  That allows us to use a forward declaration for  
VacuumParams and avoid including vacuum.h.  Since vacuum_rel()  
needs to scribble on the params argument, we still pass it by value  
to that function so that the original struct is not modified.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/rzxpxod4c4la62yvutyrvgoyilrl2fx55djaf2suidy7np5m6c%403l2ln476eadh  

M contrib/dblink/dblink.c
M contrib/tablefunc/tablefunc.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/toasting.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/event_trigger.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/ri_triggers.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/vacuum.h
M src/pl/tcl/pltcl.c
M src/tools/pgindent/typedefs.list

Doc: remove bogus claim that tsvectors can have up to 2^64 entries.

commit   : 960382e3e991f774d0ef92eb82dd7ef641f74108    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 11:49:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 11:49:54 -0400    

Click here for diff

This is nonsense on its face, since the textsearch parsing logic  
generally uses int32 to count words (see, eg, struct ParsedText).  
Not to mention that we don't support input strings larger than  
1GB.  
  
The actual limitation of interest is documented nearby: a tsvector  
can't be larger than 1MB, thanks to 20-bit offset fields within it  
(see WordEntry.pos).  That constrains us to well under 256K lexemes  
per tsvector, depending on how many positions are stored per lexeme.  
  
It seems sufficient therefore to just remove the bit about number  
of lexemes.  
  
Author: Dharin Shah <dharinshah95@gmail.com>  
Discussion: https://postgr.es/m/CAOj6k6d0YO6AO-bhxkfUXPxUi-+YX9-doh2h5D5z0Bm8D2w=OA@mail.gmail.com  

M doc/src/sgml/textsearch.sgml

Doc: improve explanation of GiST compress/decompress methods.

commit   : fb7a9050d53c5cd4b7c86f8e07196bd47b9db3b2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 11:23:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 31 Mar 2026 11:23:20 -0400    

Click here for diff

The docs previously didn't explain that leaf and non-leaf keys  
could be treated differently, even though many of our opclasses  
do exactly that.  It also wasn't explained how that relates to  
the STORAGE option, particularly since only one storage type  
can be specified for both leaf and non-leaf keys.  
  
While here, reorganize the text slightly, rather than sticking  
additional detail into what's supposed to be a brief summary  
paragraph.  
  
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA+renyWs5Np+FLSYfL+eu20S4U671A3fQGb-+7e22HLrD1NbYw@mail.gmail.com  

M doc/src/sgml/gist.sgml
M src/backend/access/gist/README

Change the signature of dynahash's alloc function

commit   : 7b424e3108e4745ba7d37e358a1177911fa5a5ad    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 31 Mar 2026 16:55:03 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 31 Mar 2026 16:55:03 +0300    

Click here for diff

Instead of passing the current memory context to the alloc function  
via a shared variable, pass it directly as an argument.  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/backend/utils/hash/dynahash.c
M src/include/utils/hsearch.h

Remove HASH_SEGMENT option

commit   : dde69621c3248c1c6e623a4f5baa182783ead681    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 31 Mar 2026 16:45:28 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 31 Mar 2026 16:45:28 +0300    

Click here for diff

It's been unused forever. There's no urgency in removing it now, but  
it was just something that caught my eye.  
  
Aleksander Alekseev proposed this a long time ago [0], but Tom Lane  
was worried about third-party extensions using it. I believe that's a  
non-issue: I tried grepping through all extensions found on github and  
didn't find any references to HASH_SEGMENT.  
  
[0] https://www.postgresql.org/message-id/20160418180711.55ac82c0@fujitsu  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/utils/hash/dynahash.c
M src/include/utils/hsearch.h

Fix cross variable references in graph pattern causing segfault

commit   : a0dd0702e464f206b08c99a74cb58809c51aafa5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 11:44:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 11:44:43 +0200    

Click here for diff

When converting the WHERE clause in an element pattern,  
generate_query_for_graph_path() calls replace_property_refs() to  
replace the property references in it.  Only the current graph element  
pattern is passed as the context for replacement.  If there are  
references to variables from other element patterns, it causes a  
segmentation fault (an assertion failure in an Assert enabled build)  
since it does not find path_element object corresponding to those  
variables.  
  
We do not support forward and backward variable references within a  
graph table clause.  Hence prohibit all the cross references.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5u6AoDfNg4%3DR5eVJn_bJn%3DC%3DwVPrto02P_06fxy39fniA%40mail.gmail.com  

M src/backend/parser/parse_graphtable.c
M src/include/parser/parse_node.h
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Property references are preferred over regular column references

commit   : c5b3253b8abd7b89689d1095c7c1154b784ca9c9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 11:37:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 11:37:35 +0200    

Click here for diff

When a ColumnRef can be resolved as a graph table property reference  
and a lateral table column reference prefer the graph table property  
reference since element pattern variables in the GRAPH_TABLE clause  
form the innermost namespace.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5u6AoDfNg4%3DR5eVJn_bJn%3DC%3DwVPrto02P_06fxy39fniA%40mail.gmail.com  

M src/backend/parser/parse_expr.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Fix use-after-free in ri_LoadConstraintInfo

commit   : 68a8601ee9ec7285b5a3839e17360c0a9d0e52a3    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Tue, 31 Mar 2026 17:04:44 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Tue, 31 Mar 2026 17:04:44 +0900    

Click here for diff

conindid was read from conForm after ReleaseSysCache(tup).  Move  
the read to before the release.  
  
Introduced by commit 2da86c1ef9b5.  
  
Per buildfarm member prion.  
  
Discussion: https://postgr.es/m/CA+HiwqGGYjN6F2oL7yAk=hvSs-sj3TPqZ9JC9iyLkCqJadECrw@mail.gmail.com  

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

Formalize WAL record for XLOG_CHECKPOINT_REDO

commit   : 097ab69d17f74e3c45b8c092d29df74f59bb5421    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 31 Mar 2026 09:38:01 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 31 Mar 2026 09:38:01 +0200    

Click here for diff

XLOG_CHECKPOINT_REDO only contains the wal_level copied straight in  
without an encapsulating record structure. While it works, it makes  
future uses of XLOG_CHECKPOINT_REDO hard as there is nowhere to put  
new data items.  This fix this was inspired by the online checksums  
patch which adds data to this record,  but this change has value on  
its own.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/c92b5d8b-bc03-47bc-b209-2e4a719eee32@iki.fi  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/postmaster/walsummarizer.c
M src/include/access/xlog_internal.h
M src/tools/pgindent/typedefs.list

Disable some C++ warnings in MSVC

commit   : 82a7cbea747c465eee8449587be2d6cc47af82fe    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 08:38:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 08:38:24 +0200    

Click here for diff

Flexible array members, as used in many PostgreSQL header files, are  
not a C++ feature.  MSVC warns about these.  Disable the  
warning.  (GCC and Clang accept them, but they would warn in -pedantic  
mode.)  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com  

M meson.build

meson: Make room for C++-only warning flags for MSVC

commit   : 4c83f1253593ef46a0a190afb8ecead21f483196    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 08:38:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 31 Mar 2026 08:38:24 +0200    

Click here for diff

Refactor the MSVC warning option handling to have a list of common  
flags and lists of flags specific to C and C++.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com  

M meson.build

Add fast path for foreign key constraint checks

commit   : 2da86c1ef9b5446e0e22c0b6a5846293e58d98e3    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Tue, 31 Mar 2026 13:49:21 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Tue, 31 Mar 2026 13:49:21 +0900    

Click here for diff

Add a fast-path optimization for foreign key checks that bypasses SPI  
by directly probing the unique index on the referenced table.  
Benchmarking shows ~1.8x speedup for bulk FK inserts (int PK/int FK,  
1M rows, where PK table and index are cached).  
  
The fast path applies when the referenced table is not partitioned and  
the constraint does not involve temporal semantics.  Otherwise, the  
existing SPI path is used.  
  
This optimization covers only the referential check trigger  
(RI_FKey_check).  The action triggers (CASCADE, SET NULL, SET DEFAULT,  
RESTRICT, NO ACTION) must find rows on the FK side to modify, which  
requires a table scan with no guaranteed index available, and then  
execute DML against those rows through the full executor path including  
any triggered actions.  Replicating that without substantial code  
duplication is not feasible, so those triggers remain on the SPI path.  
Extending the fast path to action triggers remains possible as future  
work if the necessary infrastructure is built.  
  
The new ri_FastPathCheck() function extracts the FK values, builds scan  
keys, performs an index scan, and locks the matching tuple with  
LockTupleKeyShare via ri_LockPKTuple(), which handles the RI-specific  
subset of table_tuple_lock() results.  
  
If the locked tuple was reached by chasing an update chain  
(tmfd.traversed), recheck_matched_pk_tuple() verifies that the key  
is still the same, emulating EvalPlanQual.  
  
The scan uses GetTransactionSnapshot(), matching what the SPI path  
uses (via _SPI_execute_plan pushing GetTransactionSnapshot() as the  
active snapshot).  Under READ COMMITTED this is a fresh snapshot;  
under REPEATABLE READ / SERIALIZABLE it is the frozen transaction-  
start snapshot, so PK rows committed after the transaction started  
are not visible.  
  
The ri_CheckPermissions() function performs schema USAGE and table  
SELECT checks, matching what the SPI path gets implicitly through  
the executor's permission checks.  The fast path also switches to  
the PK table owner's security context (with SECURITY_NOFORCE_RLS)  
before the index probe, matching the SPI path where the query runs  
as the table owner.  
  
ri_HashCompareOp() is adjusted to handle cross-type equality operators  
(e.g. int48eq for int4 PK / int8 FK) which can appear in conpfeqop.  
The existing code asserted same-type operators only, which was correct  
for its existing callers (ri_KeysEqual compares same-type FK column  
values via ff_eq_oprs), but the fast path is the first caller to pass  
pf_eq_oprs, which can be cross-type.  
  
Per-key metadata (compare entries, operator procedures, strategy  
numbers) is cached in RI_ConstraintInfo via  
ri_populate_fastpath_metadata() on first use, eliminating repeated  
calls to ri_HashCompareOp() and get_op_opfamily_properties().  
conindid and pk_is_partitioned are also cached at constraint load  
time, avoiding per-invocation syscache lookups and the need to open  
pk_rel before deciding whether the fast path applies.  
  
New regression tests cover RLS bypass and ACL enforcement for the  
fast-path permission checks.  New isolation tests exercise concurrent  
PK updates under both READ COMMITTED and REPEATABLE READ.  
  
Author: Junwang Zhao <zhjwpku@gmail.com>  
Co-authored-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Tested-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/CA+HiwqF4C0ws3cO+z5cLkPuvwnAwkSp7sfvgGj3yQ=Li6KNMqA@mail.gmail.com  

M src/backend/utils/adt/ri_triggers.c
A src/test/isolation/expected/fk-concurrent-pk-upd.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-concurrent-pk-upd.spec
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql
M src/tools/pgindent/typedefs.list

Change syntax of EXCEPT TABLE clause in publication commands.

commit   : 5984ea868eeeb202bddedfbdaca81adfe7ea6779    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 31 Mar 2026 09:40:51 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 31 Mar 2026 09:40:51 +0530    

Click here for diff

Adjust the syntax of the EXCEPT clause in CREATE/ALTER PUBLICATION  
added in commits fd366065e0 and 493f8c6439 to move the TABLE keyword  
inside the relation list.  
  
Old syntax:  
CREATE PUBLICATION ... FOR ALL TABLES EXCEPT TABLE (t1, ...);  
ALTER PUBLICATION  ... SET ALL TABLES EXCEPT TABLE (t1, ...);  
  
New syntax:  
CREATE PUBLICATION ... FOR ALL TABLES EXCEPT (TABLE t1, ...);  
ALTER PUBLICATION  ... SET ALL TABLES EXCEPT (TABLE t1, ...);  
  
This is to ensure that inclusion and exclusion list can be specified in  
a same way. Previously, the exclusion table list can be specified as  
TABLE (t1, t2, t3) and inclusion list can be specified as TABLE t1, t2,  
t3, or TABLE t1, TABLE t2, TABLE t3.  
  
This change is purely syntactic and does not alter behavior.  
  
Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Author: vignesh C <vignesh21@gmail.com>  
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Reviewed-by: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoCC8XuwfX62qKBSfHUAoww_XB3_84HjswgL9jxQy696yw@mail.gmail.com  
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
M src/test/subscription/t/037_except.pl

Doc: update ddl.sgml's description of cmin and cmax.

commit   : 786552e7f22315c4103c5404f9c4c6bccc95f8c1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 18:25:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 18:25:17 -0400    

Click here for diff

We long ago folded these two tuple header fields into one field  
to save space.  However, nothing was done to the user-facing  
documentation about them, perhaps with the idea that we'd add  
code to emit something approximating the original definitions.  
That never happened and presumably never will, so update the  
text to reflect current reality.  
  
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA+renyVYYboiTayRRE0j1oKpeB+NjEBSUXfwgEu6O0JESSmauQ@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Add warning option -Wold-style-declaration

commit   : c73e8ee061adf26ed77ffa7e676f5de6d9f6da21    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 23:12:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 23:12:38 +0200    

Click here for diff

This warning has been triggered a few times via the buildfarm (see  
commits 8212625e53f, 2b7259f8557, afe86a9e73b), so we might as well  
add it so that everyone sees it.  
  
(This is completely separate from the recently added  
-Wold-style-definition.)  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/aa73q1aT0A3/vke/%40ip-10-97-1-34.eu-west-3.compute.internal  

M configure
M configure.ac
M meson.build

libpq: Add oauth_ca_file option to change CAs without debugging

commit   : 993368113c432832862db29f927c206dab0c0b8a    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 30 Mar 2026 14:14:45 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 30 Mar 2026 14:14:45 -0700    

Click here for diff

PG18 hid the PGOAUTHCAFILE envvar behind PGOAUTHDEBUG=UNSAFE, because I  
thought that any "real" production usage of private CA certificates  
would have them added to the Curl system trust store. But there are use  
cases, such as containerized environments, that prefer to manage custom  
CA settings more granularly; some of them consider envvar configuration  
of certificates to be standard practice.  
  
Move PGOAUTHCAFILE out from under the debug flag, and add an  
oauth_ca_file option to libpq to configure trusted CAs per connection.  
  
Patch by Jonathan Gonzalez V., with some additional wordsmithing and  
test organization by me.  
  
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/16a91d02795cb991963326a902afa764e4d721db.camel%40gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/t/OAuth/Server.pm

Remove bits* typedefs.

commit   : bab2f27eaaad77f799ecc224f9e11b09adb07d5a    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 30 Mar 2026 16:12:08 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 30 Mar 2026 16:12:08 -0500    

Click here for diff

In addition to removing the bits8, bits16, and bits32 typedefs,  
this commit replaces all uses with uint8, uint16, or uint32.  bits*  
provided little benefit beyond establishing the intent of the  
variable, and they were inconsistently used for that purpose.  
Third-party code should instead use the corresponding uint*  
typedef.  
  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Discussion: https://postgr.es/m/absbX33E4eaA0Ity%40nathan  

M contrib/dblink/dblink.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/postgres_fdw/deparse.c
M doc/src/sgml/fdwhandler.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/reloptions.c
M src/backend/access/spgist/spgutils.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/indexcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeModifyTable.c
M src/backend/foreign/foreign.c
M src/backend/nodes/gen_node_support.pl
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/syslogger.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/postinit.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/psql/tab-complete.in.c
M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/reloptions.h
M src/include/access/tupmacs.h
M src/include/c.h
M src/include/catalog/index.h
M src/include/commands/cluster.h
M src/include/commands/vacuum.h
M src/include/common/jsonapi.h
M src/include/executor/executor.h
M src/include/executor/instrument_node.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/miscadmin.h
M src/include/nodes/parsenodes.h
M src/include/port/pg_bitutils.h
M src/include/postmaster/syslogger.h
M src/include/replication/reorderbuffer.h
M src/include/replication/walsender_private.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/builtins.h
M src/include/utils/pgstat_internal.h
M src/include/utils/regproc.h
M src/include/utils/ruleutils.h
M src/include/utils/varbit.h
M src/pl/plpython/plpy_typeio.c
M src/port/pg_bitutils.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c
M src/test/modules/worker_spi/worker_spi.c
M src/tools/pgindent/typedefs.list

Use ShmemInitStruct to allocate shmem for semaphores

commit   : 40c41dc77306bf6f8f97b0012355c0dd8e11a430    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 23:39:35 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 23:39:35 +0300    

Click here for diff

This makes them visible in pg_shmem_allocations  
  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://www.postgresql.org/message-id/01ab1d41-3eda-4705-8bbd-af898f5007f1@iki.fi  

M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c

Set pd_prune_xid on insert

commit   : 378a216187aea1b488ce60ed07dd1ac5c14a9984    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 16:07:11 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 16:07:11 -0400    

Click here for diff

Now that on-access pruning can update the visibility map (VM) during  
read-only queries, set the page’s pd_prune_xid hint during INSERT and on  
the new page during UPDATE.  
  
This allows heap_page_prune_and_freeze() to set the VM the first time a  
page is read after being filled with tuples. This may avoid I/O  
amplification by setting the page all-visible when it is still in shared  
buffers and allowing later vacuums to skip scanning the page. It also  
enables index-only scans of newly inserted data much sooner.  
  
As a side benefit, this addresses a long-standing note in heap_insert()  
and heap_multi_insert(): aborted inserts can now be pruned on-access  
rather than lingering until the next VACUUM.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com  

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

Allow on-access pruning to set pages all-visible

commit   : b46e1e54d078def33b840ae1fa6c5236a7b12ec2    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 15:47:07 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 15:47:07 -0400    

Click here for diff

Many queries do not modify the underlying relation. For such queries, if  
on-access pruning occurs during the scan, we can check whether the page  
has become all-visible and update the visibility map accordingly.  
Previously, only vacuum and COPY FREEZE marked pages as all-visible or  
all-frozen.  
  
This commit implements on-access VM setting for sequential scans, tid  
range scans, sample scans, bitmap heap scans, and the underlying heap  
relation in index scans.  
  
Setting the visibility map on-access can avoid write amplification  
caused by vacuum later needing to set the page all-visible, which could  
trigger a write and potentially an FPI. It also allows more frequent  
index-only scans, since they require pages to be marked all-visible in  
the VM.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Add commit 874da8b1f6 to .git-blame-ignore-revs.

commit   : e3637a05dc4330e451f890184f13b341a4f8fd51    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 30 Mar 2026 14:35:24 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 30 Mar 2026 14:35:24 -0500    

Click here for diff

M .git-blame-ignore-revs

configure: Apply -Werror=vla to C++ as well as C

commit   : 488ab592d9ea1b4c7d6e43389c34c4bbbcb8f0d4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 20:55:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 20:55:16 +0200    

Click here for diff

The comment part of d9dd406fe281 mentioned that -Wvla is not applicable  
for C++. That is not fully correct: it is true that VLAs are not part of the  
C++ standard, and g++ with -pedantic will also warn about them as a non-standard  
extension.  However, -Wvla itself works fine in C++ and will catch VLA  
usage just as in C.  
  
Fix configure.ac to apply -Werror=vla to C++ as well. There is no need to  
fix meson.build as it already includes it in common_warning_flags.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Suggested-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/7bf60ab1-2b5d-4a77-93ce-815072a0a014%40eisentraut.org  

M configure
M configure.ac

Be more careful to preserve consistency of a tuplestore.

commit   : 739477345036c26f0661eedb419058b0b9943f34    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 13:59:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 13:59:54 -0400    

Click here for diff

Several places in tuplestore.c would leave the tuplestore data  
structure effectively corrupt if some subroutine were to throw  
an error.  Notably, if WRITETUP() failed after some number of  
successful calls within dumptuples(), the tuplestore would  
contain some memtuples pointers that were apparently live  
entries but in fact pointed to pfree'd chunks.  
  
In most cases this sort of thing is fine because transaction  
abort cleanup is not too picky about the contents of memory that  
it's going to throw away anyway.  There's at least one exception  
though: if a Portal has a holdStore, we're going to call  
tuplestore_end() on that, even during transaction abort.  
So it's not cool if that tuplestore is corrupt, and that means  
tuplestore.c has to be more careful.  
  
This oversight demonstrably leads to crashes in v15 and before,  
if a holdable cursor fails to persist its data due to an undersized  
temp_file_limit setting.  Very possibly the same thing can happen in  
v16 and v17 as well, though the specific test case submitted failed  
to fail there (cf. 095555daf).  The failure is accidentally dodged  
as of v18 because 590b045c3 got rid of tuplestore_end's retail tuple  
deletion loop.  Still, it seems unwise to permit tuplestores to become  
internally inconsistent in any branch, so I've applied the same fix  
across the board.  
  
Since the known test case for this is rather expensive and doesn't  
fail in recent branches, I've omitted it.  
  
Bug: #19438  
Reported-by: Dmitriy Kuzmin <kuzmin.db4@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/19438-9d37b179c56d43aa@postgresql.org  
Backpatch-through: 14  

M src/backend/utils/sort/tuplestore.c

Replace getopt() with our re-entrant variant in the backend

commit   : 681774315d738ed9bb213d755c6f39fa5b5009b9    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:47:16 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:47:16 +0300    

Click here for diff

Some of these probably could continue using non-re-entrant getopt()  
even if we start using threads in the future, but it seems better to  
make them all anyway, so that we have a clear-cut rule of "no plain  
getopt() in the postgres binary".  
  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/d1da5f0e-0d68-47c9-a882-eb22f462752f@iki.fi  

M src/backend/bootstrap/bootstrap.c
M src/backend/postmaster/postmaster.c
M src/backend/tcop/postgres.c
M src/backend/utils/misc/ps_status.c

Invent a variant of getopt(3) that is thread-safe

commit   : fd8e3f7ceeed8b0155e124a0da4ec6a4fb53ec1f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:47:13 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:47:13 +0300    

Click here for diff

The standard getopt(3) function is not re-entrant nor thread-safe.  
That's OK for current usage, but it's one more little thing we need to  
change in order to make the server multi-threaded.  
  
There's no standard getopt_r() function on any platform, I presume  
because command line arguments are usually parsed early when you start  
a program, before launching any threads, so there isn't much need for  
it. However, we call it at backend startup to parse options from the  
startup packet. Because there's no standard, we're free to define our  
own.  
  
The pg_getopt_start/next() implementation is based on the old getopt  
implementation, I just gathered all the state variables to a struct.  
The non-re-entrant getopt() function is now a wrapper around the  
re-entrant variant, on platforms that don't have getopt(3).  
getopt_long() is not used in the server, so we don't need to provide a  
re-entrant variant of that.  
  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/d1da5f0e-0d68-47c9-a882-eb22f462752f@iki.fi  

A src/include/port/pg_getopt_ctx.h
M src/port/Makefile
M src/port/getopt.c
M src/port/meson.build
A src/port/pg_getopt_ctx.c
M src/tools/pgindent/typedefs.list

Fix latent bug in get_stats_option_name()

commit   : c5f7820e5780f5be9cb406834108576b42e568f8    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:34:48 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 20:34:48 +0300    

Click here for diff

The function is supposed to look at the passed in 'arg' argument, but  
peeks at the 'optarg' global variable that's part of getopt()  
instead. It happened to work anyway, because all callers passed  
'optarg' as the argument.  
  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/d1da5f0e-0d68-47c9-a882-eb22f462752f@iki.fi  

M src/backend/tcop/postgres.c

Pass down information on table modification to scan nodes

commit   : 50eb5faea2959125a575bae0a062ccb33b49c43d    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 13:27:34 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 13:27:34 -0400    

Click here for diff

Pass down information to sequential scan, index [only] scan, bitmap  
table scan, sample scan, and TID range scan nodes on whether or not the  
query modifies the relation being scanned. A later commit will use this  
information to update the VM during on-access pruning only if the  
relation is not modified by the query.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/4379FDA3-9446-4E2C-9C15-32EFE8D4F31B%40yandex-team.ru  

M src/backend/executor/execUtils.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidrangescan.c
M src/include/access/tableam.h
M src/include/executor/executor.h

Don't use bits32 in table AM interface

commit   : 349bd8820215528adbd79a31796d205e148734f6    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 30 Mar 2026 19:03:28 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 30 Mar 2026 19:03:28 +0200    

Click here for diff

Seems there's near-universal dislike for the bitsXX typedefs.  
Revert that part of commit 1bd6f22f43ac in favor of using plain uint32.  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/include/access/heapam.h
M src/include/access/tableam.h

Thread flags through begin-scan APIs

commit   : dcd8cc1c852cac4e65d336a79afb6b9eb9700ae1    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 12:27:24 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 12:27:24 -0400    

Click here for diff

Add an AM user-settable flags parameter to several of the table scan  
functions, one table AM callback, and index_beginscan(). This allows  
users to pass additional context to be used when building the scan  
descriptors.  
  
For index scans, a new flags field is added to IndexFetchTableData, and  
the heap AM saves the caller-provided flags there.  
  
This introduces an extension point for follow-up work to pass per-scan  
information (such as whether the relation is read-only for the current  
query) from the executor to the AM layer.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/2be31f17-5405-4de9-8d73-90ebc322f7d8%40vondra.me  

M contrib/pgrowlocks/pgrowlocks.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/table/tableam.c
M src/backend/commands/constraint.c
M src/backend/commands/copyto.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/partitioning/partbounds.c
M src/backend/utils/adt/selfuncs.c
M src/include/access/genam.h
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/access/tableam.h

Detect pfree or repalloc of a previously-freed memory chunk.

commit   : 095555daf1246ac28595fcf5b26bbb4686b0cdb6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 12:02:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 30 Mar 2026 12:02:08 -0400    

Click here for diff

Before the major rewrite in commit c6e0fe1f2, AllocSetFree() would  
typically crash when asked to free an already-free chunk.  That was  
an ugly but serviceable way of detecting coding errors that led to  
double pfrees.  But since that rewrite, double pfrees went through  
just fine, because the "hdrmask" of a freed chunk isn't changed at all  
when putting it on the freelist.  We'd end with a corrupt freelist  
that circularly links back to the doubly-freed chunk, which would  
usually result in trouble later, far removed from the actual bug.  
  
This situation is no good at all for debugging purposes.  Fortunately,  
we can fix it at low cost in MEMORY_CONTEXT_CHECKING builds by making  
AllocSetFree() check for chunk->requested_size == InvalidAllocSize,  
relying on the pre-existing code that sets it that way just below.  
  
I investigated the alternative of changing a freed chunk's methodid  
field, which would allow detection in non-MEMORY_CONTEXT_CHECKING  
builds too.  But that adds measurable overhead.  Seeing that we didn't  
notice this oversight for more than three years, it's hard to argue  
that detecting this type of bug is worth any extra overhead in  
production builds.  
  
Likewise fix AllocSetRealloc() to detect repalloc() on a freed chunk,  
and apply similar changes in generation.c and slab.c.  (generation.c  
would hit an Assert failure anyway, but it seems best to make it act  
like aset.c.)  bump.c doesn't need changes since it doesn't support  
pfree in the first place.  Ideally alignedalloc.c would receive  
similar changes, but in debugging builds it's impossible to reach  
AlignedAllocFree() or AlignedAllocRealloc() on a pfreed chunk, because  
the underlying context's pfree would have wiped the chunk header of  
the aligned chunk.  But that means we should get an error of some  
sort, so let's be content with that.  
  
Per investigation of why the test case for bug #19438 didn't appear to  
fail in v16 and up, even though the underlying bug was still present.  
(This doesn't fix the underlying double-free bug, just cause it to  
get detected.)  
  
Bug: #19438  
Reported-by: Dmitriy Kuzmin <kuzmin.db4@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/19438-9d37b179c56d43aa@postgresql.org  
Backpatch-through: 16  

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

Fix outdated comment on MainLWLockArray

commit   : bd365b1ae510005eda5633702d2fa9325ee8ab61    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 17:13:11 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 30 Mar 2026 17:13:11 +0300    

Click here for diff

It's no longer passed to child processes down via BackendParameters in  
EXEC_BACKEND mode.  
  
Reported-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAA5RZ0vPWNMvTBqyH7nqDRrHd6Y4Et5iNqXFuwpbsPOk3cL4rQ@mail.gmail.com  

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

pg_plan_advice: Avoid assertion failure with partitionwise aggregate.

commit   : e2ee95233cab32a0d5fe64925aefe816c13dbbc0    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 30 Mar 2026 09:58:25 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 30 Mar 2026 09:58:25 -0400    

Click here for diff

An Append node that is part of a partitionwise aggregate has no  
apprelids. If such a node was elided, the previous coding would  
attempt to call unique_nonjoin_rtekind() on a NULL pointer, which  
leads to an assertion failure. Insert a NULL check to prevent that.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: http://postgr.es/m/0afba1ce-c946-4131-972d-191d9a1c097c@gmail.com  

M contrib/pg_plan_advice/pgpa_scan.c

Remove PlannedStmt->resultRelations in favor of resultRelationRelids

commit   : 39dcd10a2c493821cc88a9f8d17677507571e87d    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 09:51:28 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 09:51:28 -0400    

Click here for diff

PlannedStmt->resultRelations was an integer list of range table indexes  
because at the time it was added (to Query), the Bitmapset data type did  
not yet exist in Postgres.  
  
0f4c170cf3b added a Bitmapset of result relations, so remove the integer  
list of RTIs and use the more compact resultRelationRelids.  
  
Discussion: https://postgr.es/m/CAApHDvqAOeOwCKh9g0gfxWa040%3DHyc7_oA%3DC59rjod8kXJDWyw%40mail.gmail.com  

M contrib/pg_overexplain/pg_overexplain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execUtils.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/plannodes.h

Make it cheap to check if a relation is modified by a query

commit   : 0f4c170cf3b85ef8b092990a88e5b7b50892f7d5    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 09:38:03 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 30 Mar 2026 09:38:03 -0400    

Click here for diff

Save the range table indexes of result relations and row mark relations  
in separate bitmapsets in the PlannedStmt. Precomputing them allows  
cheap membership checks during execution. Together, these two groups  
approximate all relations that will be modified by a query. This  
includes relations targeted by INSERT, UPDATE, DELETE, and MERGE as well  
as relations with any row mark (like SELECT FOR UPDATE).  
  
Future work will use information on whether or not a relation is  
modified by a query in a heuristic.  
  
PlannedStmt->resultRelations is only used in a membership check, so it  
will be removed in a separate commit.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/F5CDD1B5-628C-44A1-9F85-3958C626F6A9%40gmail.com  

M src/backend/executor/execParallel.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/plannodes.h

Have table_insert and siblings use an unsigned type for options

commit   : 1bd6f22f43ac1bd2215ba4ef720fc4f18fea26e5    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 30 Mar 2026 13:27:04 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 30 Mar 2026 13:27:04 +0200    

Click here for diff

Using signed types can lead to bugs, such as the one fixed by commit  
2a2e1b470b9b.  
  
Discussion: https://postgr.es/m/44e6ze3kuunhky63wmfjxrmn72pds2whwf5ok6hpz7c4my7k2h@l65zhpcuasnf  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/include/access/heapam.h
M src/include/access/tableam.h

headerscheck: Avoid mutual inclusion of pg_config.h and c.h

commit   : c546f008cddf9319ce500321a65eec2329ae6d6a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:31:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:31:08 +0200    

Click here for diff

Headers that c.h includes early should not have another header  
included before them in the headerscheck test file, especially not  
c.h.  
  
A particular instance of a problem is that pg_config.h defines some  
symbols that c.h later undefines in some cases, such as in the code  
added by commit cd083b54bd67, but there were also some before that.  
This only works correctly if pg_config.h is included first.  
  
pg_config_manual.h and pg_config_os.h are closely related to  
pg_config.h and should be treated the same way.  
  
postgres_ext.h is meant to be usable standalone, so testing it with  
c.h included first defeats the point.  
  
c.h also includes port.h, but this commit leaves that alone, since  
port.h does need some of c.h to be processed first.  (But because of  
header guards, testing port.h separately is probably ineffective.)  
  
Discussion: https://www.postgresql.org/message-id/flat/579116be-5016-4dbc-aed0-c06f8d9f5bbb%40eisentraut.org  

M src/tools/pginclude/headerscheck

Make cast functions to type money error safe

commit   : b36b95640487b9dc70408e9078c30e80963efccb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 10:05:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 10:05:22 +0200    

Click here for diff

This converts the cast functions from types integer, bigint, and  
numeric to type money to support soft errors.  
  
Note: Casting from type money to type numeric (the other way, function  
cash_numeric) is not yet error safe.  
  
Author: jian he <jian.universality@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com  

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

Remove extraneous PGDLLIMPORT

commit   : ec5981c3816e46a5d38d2834e406257bb5563429    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 30 Mar 2026 14:39:13 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 30 Mar 2026 14:39:13 +0700    

Click here for diff

Oversight from commit 3c6e8c123896. Should be harmless, so no  
backpatch.  
  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAN4CZFM8jmh4+1rUR2c++JWK9sV85T8_mqmwHMvM0YWkTm4_dQ@mail.gmail.com  

M src/include/port/pg_crc32c.h

Fix accidentally casting away const

commit   : 75a5914d005b5b65090567eb08343b6a962c89cf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:21:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:21:49 +0200    

Click here for diff

Recently introduced in commit b15c1513984.  

M src/bin/pg_waldump/archive_waldump.c

Make cast function from circle to polygon error safe

commit   : 26f9012beecf36bcffc5a2081c7e698d3ecf6aa2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:06:27 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 30 Mar 2026 09:06:27 +0200    

Click here for diff

Previously, the function casting type circle to type polygon could not  
be made error safe, because it is an SQL language function.  
  
This refactors it as a C/internal function, by sharing code with the  
C/internal function that the SQL function previously wrapped, and soft  
error support is added.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com  

M src/backend/catalog/system_functions.sql
M src/backend/utils/adt/geo_ops.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Fix FK triggers losing DEFERRABLE/INITIALLY DEFERRED when marked ENFORCED again

commit   : 2497dac55648e738b643577e807bfd2a3ac4c6e2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 14:37:33 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 14:37:33 +0900    

Click here for diff

Previously, a foreign key defined as DEFERRABLE INITIALLY DEFERRED could  
behave as NOT DEFERRABLE after being set to NOT ENFORCED and then back  
to ENFORCED.  
  
This happened because recreating the FK triggers on re-enabling the constraint  
forgot to restore the tgdeferrable and tginitdeferred fields in pg_trigger.  
  
Fix this bug by properly setting those fields when the foreign key constraint  
is marked ENFORCED again and its triggers are recreated, so the original  
DEFERRABLE and INITIALLY DEFERRED properties are preserved.  
  
Backpatch to v18, where NOT ENFORCED foreign keys were introduced.  
  
Author: Yasuo Honda <yasuo.honda@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAKmOUTms2nkxEZDdcrsjq5P3b2L_PR266Hv8kW5pANwmVaRJJQ@mail.gmail.com  
Backpatch-through: 18  

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

Fix datum_image_*()'s inability to detect sign-extension variations

commit   : 0d866282b841a198bff0e6bbfc75493e46ecd126    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 30 Mar 2026 16:14:34 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 30 Mar 2026 16:14:34 +1300    

Click here for diff

Functions such as hash_numeric() are not careful to use the correct  
PG_RETURN_*() macro according to the return type of that function as  
defined in pg_proc.  Because that function is meant to return int32,  
when the hashed value exceeds 2^31, the 64-bit Datum value won't wrap to  
a negative number, which means the Datum won't have the same value as it  
would have had it been cast to int32 on a two's complement machine.  This  
isn't harmless as both datum_image_eq() and datum_image_hash() may receive  
a Datum that's been formed and deformed from a tuple in some cases, and  
not in other cases.  When formed into a tuple, the Datum value will be  
coerced into an integer according to the attlen as specified by the  
TupleDesc.  This can result in two Datums that should be equal being  
classed as not equal, which could result in (but not limited to) an error  
such as:  
  
ERROR:  could not find memoization table entry  
  
Here we fix this by ensuring we cast the Datum value to a signed integer  
according to the typLen specified in the datum_image_eq/datum_image_hash  
function call before comparing or hashing.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Backpatch-through: 14  
Discussion: https://postgr.es/m/CAHewXNmcXVFdB9_WwA8Ez0P+m_TQy_KzYk5Ri5dvg+fuwjD_yw@mail.gmail.com  

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

psql: Make \d+ inheritance tables list formatting consistent with other objects

commit   : 1a11405a436038293f425f2ffc41b02235eda912    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 11:21:22 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 11:21:22 +0900    

Click here for diff

This followw up on the previous change (commit 7bff9f106a5) for partitions by  
applying the same formatting to inheritance tables lists.  
  
Previously, \d+ <table> displayed inheritance tables differently from other  
object lists: the first inheritance table appeared on the same line as the  
"Inherits" header. For example:  
  
    Inherits: test_like_5,  
              test_like_5x  
  
This commit updates the output so that inheritance tables are listed  
consistently with other objects, with each entry on its own line starting  
below the header:  
  
    Inherits:  
        test_like_5  
        test_like_5x  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>  
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pu1puO00C-OhgLnAcECzww8MB3Q8DCsvx0cZWHRfs4gBQ@mail.gmail.com  

M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/without_overlaps.out

psql: Make \d+ partition list formatting consistent with other objects

commit   : 7bff9f106a5ec36bd97829ca7eb97fc2a4705406    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 11:06:42 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 30 Mar 2026 11:06:42 +0900    

Click here for diff

Previously, \d+ <table> displayed partitions differently from other object  
lists: the first partition appeared on the same line as the "Partitions"  
header. For example:  
  
    Partitions: pt12 FOR VALUES IN (1, 2),  
                pt34 FOR VALUES IN (3, 4)  
  
This commit updates the output so that partitions are listed consistently  
with other objects, with each entry on its own line starting below the header:  
  
    Partitions:  
        pt12 FOR VALUES IN (1, 2)  
        pt34 FOR VALUES IN (3, 4)  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>  
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pu1puO00C-OhgLnAcECzww8MB3Q8DCsvx0cZWHRfs4gBQ@mail.gmail.com  

M contrib/seg/expected/partition.out
M src/bin/psql/describe.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert.out
M src/test/regress/expected/partition_split.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/tablespace.out

Doc: fix stale text about partition locking with cached plans

commit   : c57d8178eb06ec001b6538c3bb985e079b6d329b    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Mon, 30 Mar 2026 10:29:21 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Mon, 30 Mar 2026 10:29:21 +0900    

Click here for diff

Commit 121d774caea added text to master describing pruning-aware  
locking behavior introduced by 525392d57.  That behavior was  
reverted in May 2025, making the text incorrect.  Replace it with  
the text used in back branches, which correctly describes current  
behavior: pruned partitions are still locked at the beginning of  
execution.  
  
Discussion: https://postgr.es/m/CA+HiwqFT0fPPoYBr0iUFWNB-Og7bEXB9hB=6ogk_qD9=OM8Vbw@mail.gmail.com  

M doc/src/sgml/ddl.sgml

Add comment explaining fire_triggers=false in ri_PerformCheck()

commit   : 1ad7191f7e927ecda72928a9f1e69d40edfed3e4    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Mon, 30 Mar 2026 10:10:17 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Mon, 30 Mar 2026 10:10:17 +0900    

Click here for diff

The reason for passing fire_triggers=false to SPI_execute_snapshot()  
in ri_PerformCheck() was not documented, making it unclear why it was  
done that way.  Add a comment explaining that it ensures AFTER triggers  
on rows modified by the RI action are queued in the outer query's  
after-trigger context and fire only after all RI updates on the same  
row are complete.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Surya Poondla <suryapoondla4@gmail.com>  
Discussion: https://postgr.es/m/20250331212648.ad4ab804559001d7f0788741@sraoss.co.jp  

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

Make geometry cast functions error safe

commit   : 45cdaf3665bedfbabb908bb84284f3db26781ad3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 29 Mar 2026 20:40:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 29 Mar 2026 20:40:50 +0200    

Click here for diff

This adjusts cast functions of the geometry types to support soft  
errors.  This requires refactoring of various helper functions to  
support error contexts.  Also make the float8 to float4 cast error  
safe.  It requires some of the same helper functions.  
  
This is in preparation for a future feature where conversion errors in  
casts can be caught.  
  
(The function casting type circle to type polygon is not yet made error  
safe, because it is an SQL language function.)  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com  

M src/backend/utils/adt/float.c
M src/backend/utils/adt/geo_ops.c
M src/include/utils/float.h

Doc: document more incompatible pg_restore option pairs.

commit   : d4cb9c37765a3d07784602679a1e7af7ecf15f1d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2026 14:06:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2026 14:06:50 -0400    

Click here for diff

Most of the pairs of incompatible options (such as --file and --dbname)  
are pretty obvious and need no explanation.  But it may not be obvious  
that --single-transaction cannot be used together with --create or  
multiple jobs, so let's mention that in the documentation.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Discussion: https://postgr.es/m/CAExHW5ti5igDwOOde6shgfS7JPtCY9gNrkB3xNr=FuGTYVDSjQ@mail.gmail.com  

M doc/src/sgml/ref/pg_restore.sgml

Doc: clarify introductory description of pg_dumpall.

commit   : e7b809ae758636833e1e8a248ac6a6834eb034a1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2026 13:53:17 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 29 Mar 2026 13:53:17 -0400    

Click here for diff

Add a sentence that describes the parts of a cluster's state that are  
*not* included in the output.  
  
Also swap two sentences in the introductory paragraph.  Without that,  
it is not clear what the "it" at the beginning of the second sentence  
is referring to.  Also add a reference to pg_restore, since not all  
output formats are restored with pg_dump.  
  
Also clarify the recently-added text about where different output  
formats go, and relocate it above the ancillary text about having  
to run as superuser.  
  
Reported-by: Dimitre Radoulov <cichomitiko@gmail.com>  
Author: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAGJBphSX2oMPPu=VM4U8NP4+qffFH_483tFQCJ_s-mOcN3DLDw@mail.gmail.com  

M doc/src/sgml/ref/pg_dumpall.sgml

Fix multiple bugs in astreamer pipeline code.

commit   : 01d58d7e3ff3f7482ff478cb4a49c48aad276138    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Mar 2026 16:17:08 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Mar 2026 16:17:08 -0400    

Click here for diff

astreamer_tar_parser_content() sent the wrong data pointer when  
forwarding MEMBER_TRAILER padding to the next streamer.  After  
astreamer_buffer_until() buffers the padding bytes, the 'data'  
pointer has been advanced past them, but the code passed 'data'  
instead of bbs_buffer.data.  This caused the downstream consumer  
to receive bytes from after the padding rather than the padding  
itself, and could read past the end of the input buffer.  
  
astreamer_gzip_decompressor_content() only checked for  
Z_STREAM_ERROR from inflate(), silently ignoring Z_DATA_ERROR  
(corrupted data) and Z_MEM_ERROR (out of memory).  Fix by  
treating any return other than Z_OK, Z_STREAM_END, and  
Z_BUF_ERROR as fatal.  
  
astreamer_gzip_decompressor_free() missed calling inflateEnd() to  
release zlib's internal decompression state.  
  
astreamer_tar_parser_free() neglected to pfree() the streamer  
struct itself, leaking it.  
  
astreamer_extractor_content() did not check the return value of  
fclose() when closing an extracted file.  A deferred write error  
(e.g., disk full on buffered I/O) would be silently lost.  
  
Discussion: https://postgr.es/m/results/98c6b630-acbb-44a7-97fa-1692ce2b827c@dunslane.net  
  
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>  
  
Backpatch-through: 15  

M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_tar.c

Sort InternalBGWorkers list alphabetically

commit   : 0841b219bf0b2413e61cd1526781bedfdb50f458    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 29 Mar 2026 14:15:00 +0200    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sun, 29 Mar 2026 14:15:00 +0200    

Click here for diff

This simplifies deciding where to add a new one.  

M src/backend/postmaster/bgworker.c

Make cast functions from jsonb error safe

commit   : 10e4d8aaf46fb46b8b78e026560b68af84a6495b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 28 Mar 2026 15:44:13 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 28 Mar 2026 15:44:13 +0100    

Click here for diff

This adjusts cast functions from jsonb to other types to support soft  
errors.  This just involves some refactoring of the underlying helper  
functions to use ereturn.  
  
This is in preparation for a future feature where conversion errors in  
casts can be caught.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com  

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

aio: Don't wait for already in-progress IO

commit   : 999dec9ec6a81668057427c2e9312b20635fba02    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 19:51:53 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 19:51:53 -0400    

Click here for diff

When a backend attempts to start a read IO and finds the first buffer already  
has I/O in progress, previously it waited for that I/O to complete before  
initiating reads for any of the subsequent buffers.  
  
Although it must wait for the I/O to finish when acquiring the buffer, there's  
no reason for it to wait when setting up the read operation. Waiting at this  
point prevents starting I/O on subsequent buffers and can significantly reduce  
concurrency.  
  
This matters in two workloads:  
1) When multiple backends scan the same relation concurrently.  
2) When a single backend requests the same block multiple times within the  
   readahead distance.  
  
Waiting each time an in-progress read is encountered effectively degenerates  
the access pattern into synchronous I/O.  
  
To fix this, when encountering an already in-progress IO for the head buffer,  
the wait reference is now recorded and waiting is deferred until  
WaitReadBuffers(), when the buffer actually needs to be acquired.  
  
In rare cases, a backend may still need to wait synchronously at IO  
start time: If another backend has set BM_IO_IN_PROGRESS on the buffer  
but has not yet set the wait reference. Such windows should be brief and  
uncommon.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/flat/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw%403p3zu522yykv  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h
M src/test/modules/test_aio/t/001_aio.pl
M src/test/modules/test_aio/test_aio–1.0.sql
M src/test/modules/test_aio/test_aio.c

bufmgr: Improve StartBufferIO interface

commit   : 74eafeab1a576620879e889ec70bf826e3e7fce8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 19:02:23 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 19:02:23 -0400    

Click here for diff

Until now StartBufferIO() had a few weaknesses:  
  
- As it did not submit staged IOs, it was not safe to call StartBufferIO()  
  where there was a potential for unsubmitted IO, which required  
  AsyncReadBuffers() to use a wrapper (ReadBuffersCanStartIO()) around  
  StartBufferIO().  
  
- With nowait = true, the boolean return value did not allow to distinguish  
  between no IO being necessary and having to wait, which would lead  
  ReadBuffersCanStartIO() to unnecessarily submit staged IO.  
  
- Several callers needed to handle both local and shared buffers, requiring  
  the caller to differentiate between StartBufferIO() and StartLocalBufferIO()  
  
- In a future commit some callers of StartBufferIO() want the BufferDesc's  
  io_wref to be returned, to asynchronously wait for in-progress IO  
  
- Indicating whether to wait with the nowait parameter was somewhat confusing  
  compared to a wait parameter  
  
Address these issues as follows:  
  
- StartBufferIO() is renamed to StartSharedBufferIO()  
  
- A new StartBufferIO() is introduced that supports both shared and local  
  buffers  
  
- The boolean return value has been replaced with an enum, indicating whether  
  the IO is already done, already in progress or that the buffer has been  
  readied for IO  
  
- A new PgAioWaitRef * argument allows the caller to get the wait reference is  
  desired.  All current callers pass NULL, a user of this will be introduced  
  subsequently  
  
- Instead of the nowait argument there now is wait  
  
  This probably would not have been worthwhile on its own, but since all these  
  lines needed to be touched anyway...  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h
M src/test/modules/test_aio/t/001_aio.pl
M src/test/modules/test_aio/test_aio–1.0.sql
M src/test/modules/test_aio/test_aio.c
M src/tools/pgindent/typedefs.list

Fix RequestNamedLWLockTranche in single-user mode

commit   : 2407c8db159dbae5afd23080a92122e1acb2f5c1    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 28 Mar 2026 01:02:11 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sat, 28 Mar 2026 01:02:11 +0200    

Click here for diff

PostmasterContext is not available in single-user mode, use  
TopMemoryContext instead. Also make sure that we use the correct  
memory context in the lappend().  
  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/acb_Eo1XtmCO_9z7@nathan  

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

test_aio: Add read_stream test infrastructure & tests

commit   : 1f6f200cab67e67f1c20d9c9ca5013e0f23f51e4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 18:47:04 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 18:47:04 -0400    

Click here for diff

While we have a lot of indirect coverage of read streams, there are corner  
cases that are hard to test when only indirectly controlling and observing the  
read stream.  This commit adds an SQL callable SRF interface for a read stream  
and uses that in a few tests.  
  
To make some of the tests possible, the injection point infrastructure in  
test_aio had to be expanded to allow blocking IO completion.  
  
While at it, fix a wrong debug message in inj_io_short_read_hook().  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

M src/test/modules/test_aio/meson.build
A src/test/modules/test_aio/t/004_read_stream.pl
M src/test/modules/test_aio/test_aio–1.0.sql
M src/test/modules/test_aio/test_aio.c
M src/tools/pgindent/typedefs.list

test_aio: Add basic tests for StartReadBuffers()

commit   : 020c02bd90896066964d173139b3adb154ec7426    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 18:44:35 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 18:44:35 -0400    

Click here for diff

Upcoming commits will change StartReadBuffers() and its building blocks,  
making it worthwhile to directly test StartReadBuffers().  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

M src/test/modules/test_aio/t/001_aio.pl
M src/test/modules/test_aio/test_aio–1.0.sql
M src/test/modules/test_aio/test_aio.c

Doc: split functions-posix-regexp section into multiple subsections.

commit   : 00c025a001170979e99706ce746f75fcc615761d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Mar 2026 17:41:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Mar 2026 17:41:00 -0400    

Click here for diff

Create a <sect4> section for each function that the previous text  
described in one long series of paragraphs.  Also split the functions'  
previously in-line syntax summaries into <synopsis> clauses, which is  
more readable and allows us to sneak in an explicit mention of the  
result data type.  
  
This change gives us an opportunity to make cross-reference links  
more specific, too, so do that.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CACJufxFuk9P=P4=BZ=qCkgvo6im8aL8NnCkjxx2S2MQDWNdouw@mail.gmail.com  

M doc/src/sgml/func/func-json.sgml
M doc/src/sgml/func/func-matching.sgml
M doc/src/sgml/func/func-string.sgml
M doc/src/sgml/ref/psql-ref.sgml

bufmgr: Make UnlockReleaseBuffer() more efficient

commit   : f39cb8c011062d65e146c1e9d1aae221e96d8320    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    

Click here for diff

Now that the buffer content lock is implemented as part of BufferDesc.state,  
releasing the lock and unpinning the buffer can be implemented as a single  
atomic operation.  
  
This improves workloads that have heavy contention on a small number of  
buffers substantially, I e.g., see a ~20% improvement for pipelined readonly  
pgbench on an older two socket machine.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

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

Use UnlockReleaseBuffer() in more places

commit   : 8df3c48e466cfe8a1f9ccd3fb367244d4a47e94a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    

Click here for diff

An upcoming commit will make UnlockReleaseBuffer() considerably faster and  
more scalable than doing LockBuffer(BUFFER_LOCK_UNLOCK); ReleaseBuffer();. But  
it's a small performance benefit even as-is.  
  
Most of the callsites changed in this patch are not performance sensitive,  
however some, like the nbtree ones, are in critical paths.  
  
This patch changes all the easily convertible places over to  
UnlockReleaseBuffer() mainly because I needed to check all of them anyway, and  
reducing cases where the operations are done separately makes the checking  
easier.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

M contrib/amcheck/verify_gin.c
M contrib/pageinspect/rawpage.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/test/modules/test_aio/test_aio.c

bufmgr: Don't copy pages while writing out

commit   : 41d3d64e87af3f16833b095032affe404443659b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 27 Mar 2026 15:27:04 -0400    

Click here for diff

After the series of preceding commits introducing and using  
BufferBeginSetHintBits()/BufferSetHintBits16(), hint bits are not set anymore  
while IO is going on. Therefore we do not need to copy pages while they are  
being written out anymore.  
  
For the same reason XLogSaveBufferForHint() now does not need to operate on a  
copy of the page anymore, but can instead use the normal XLogRegisterBuffer()  
mechanism. For that the assertions and comments to XLogRegisterBuffer() had to  
be updated to allow share-exclusive locked buffers to be registered.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

M src/backend/access/hash/hashpage.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/smgr/bulk_write.c
M src/include/storage/bufpage.h
M src/test/modules/test_aio/test_aio.c

pgindent: ensure all C files end with a newline.

commit   : 79ac82125ef6608b8a1c7e089eea17476537467c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Mar 2026 15:38:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Mar 2026 15:38:48 -0400    

Click here for diff

Not only is this good style, but it dodges some obscure bugs within  
pg_bsd_indent.  We could try to fix said bugs, but the amount of  
effort required seems far out of proportion to the benefit.  
  
Reported-by: Akshay Joshi <akshay.joshi@enterprisedb.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CANxoLDfca8O5SkeDxB_j6SVNXd+pNKaDmVmEW+2yyicdU8fy0w@mail.gmail.com  

M src/tools/pgindent/pgindent

doc: Clarify collation requirements for base32hex sortability.

commit   : e752a2ccc98f324e7013cc4eabc1998d5a1020d0    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 27 Mar 2026 12:13:29 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 27 Mar 2026 12:13:29 -0700    

Click here for diff

While fixing the base32hex UUID sortability test in commit  
89210037a0a, it turned out that the expected lexicographical order is  
only maintained under the C collation (or an equivalent byte-wise  
collation). Natural language collations may employ different rules,  
breaking the sortability.  
  
This commit updates the documentation to explicitly state that  
base32hex is "byte-wise sortable", ensuring users do not fall into the  
trap of using natural language collations when querying their encoded  
data.  
  
Co-Authored-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/CAD21AoAwX1D6baSGuQXm0mzPXPWB07kgaoaaahjNHHenbdY24A@mail.gmail.com  

M doc/src/sgml/func/func-binarystring.sgml

Add rudimentary table prioritization to autovacuum.

commit   : d7965d65fc5bb2139bc51c051c11428414c65160    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 27 Mar 2026 10:17:05 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 27 Mar 2026 10:17:05 -0500    

Click here for diff

Autovacuum workers scan pg_class twice to collect the set of tables  
to process.  The first pass is for plain relations and materialized  
views, and the second is for TOAST tables.  When the worker finds a  
table to process, it adds it to the end of a list.  Later on, it  
processes the tables in the same order as the list.  This simple  
strategy has worked surprisingly well for a long time, but there  
have been many discussions over the years about trying to improve  
it.  
  
This commit introduces a scoring system that is used to sort the  
aforementioned list of tables to process.  The idea is to have  
autovacuum workers prioritize tables that are furthest beyond their  
thresholds (e.g., a table nearing transaction ID wraparound should  
be vacuumed first).  This prioritization scheme is certainly far  
from perfect; there are simply too many possibilities for any  
scoring technique to work across all workloads, and the situation  
might change significantly between the time we calculate the score  
and the time that autovacuum processes it.  However, we have  
attemped to develop something that is expected to work for a large  
portion of workloads with reasonable parameter settings.  
  
The score is calculated as the maximum of the ratios of each of the  
table's relevant values to its threshold.  For example, if the  
number of inserted tuples is 100, and the insert threshold for the  
table is 80, the insert score is 1.25.  If all other scores are  
below that value, the table's score will be 1.25.  The other  
criteria considered for the score are the table ages (both  
relfrozenxid and relminmxid) compared to the corresponding  
freeze-max-age setting, the number of update/deleted tuples  
compared to the vacuum threshold, and the number of  
inserted/updated/deleted tuples compared to the analyze threshold.  
  
Once exception to the previous paragraph is for tables nearing  
wraparound, i.e., those that have surpassed the effective failsafe  
ages.  In that case, the relfrozenxid/relminmxid-based score is  
scaled aggressively so that the table has a decent chance of  
sorting to the front of the list.  
  
To adjust how strongly each component contributes to the score, the  
following parameters can be adjusted from their default of 1.0 to  
anywhere between 0.0 and 10.0 (inclusive).  Setting all of these to  
0.0 restores pre-v19 prioritization behavior:  
  
	autovacuum_freeze_score_weight  
	autovacuum_multixact_freeze_score_weight  
	autovacuum_vacuum_score_weight  
	autovacuum_vacuum_insert_score_weight  
	autovacuum_analyze_score_weight  
  
This is intended to be a baby step towards smarter autovacuum  
workers.  Possible future improvements include, but are not limited  
to, periodic reprioritization, automatic cost limit adjustments,  
and better observability (e.g., a system view that shows current  
scores).  While we do not expect this commit to produce any  
earth-shattering improvements, it is arguably a prerequisite for  
the aforementioned follow-up changes.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/aOaAuXREwnPZVISO%40nathan  

M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M src/backend/postmaster/autovacuum.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/autovacuum.h
M src/tools/pgindent/typedefs.list

Align tests for stored and virtual generated columns

commit   : 9a9998163bda0d8c17d84ea22ced6a60f8018634    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 15:49:34 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 15:49:34 +0100    

Click here for diff

These tests were intended to be aligned with each other, but  
additional tests for virtual generated columns disrupted that  
alignment.  The test confirming that user-defined types are not  
allowed in virtual generated columns has also been moved to the  
generated_virtual.sql-specific section.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Mutaamba Maasha <maasha@gmail.com>  
Reviewed-by: Surya Poondla <s_poondla@apple.com>  
Discussion: https://www.postgresql.org/message-id/flat/20250808115142.e9ccb81f35466a9a131a4c55@sraoss.co.jp  

M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql

pgindent: Always clean up .BAK files from pg_bsd_indent

commit   : 6857947db5bbec823226cd5234f088524f933caa    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 14:24:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 14:24:52 +0100    

Click here for diff

The previous commit let pgindent clean up File::Temp files on SIGINT.  
This extends that to also cleaning up the .BAK files, created by  
pg_bsd_indent.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/DFCDD5H4J7VX.3GJKRBBDCKQ86@jeltef.nl  

M src/tools/pgindent/pgindent

pgindent: Clean up temp files created by File::Temp on SIGINT

commit   : 801de0bd443375ed3928ef44f2ee70a734d2a4d5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 14:24:13 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 14:24:13 +0100    

Click here for diff

When pressing Ctrl+C while running pgindent, it would often leave around  
files like pgtypedefAXUEEA. This slightly changes SIGINT handling so  
those files are cleaned up.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/DFCDD5H4J7VX.3GJKRBBDCKQ86@jeltef.nl  

M src/tools/pgindent/pgindent

Refactor PredicateLockShmemInit to not reuse var for different things

commit   : 3fd0577728277e66f072f3b07adf78299dfad7cc    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 13:24:34 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 13:24:34 +0200    

Click here for diff

The PredicateLockShmemInit function is pretty complicated, and one  
source of confusion is that it reuses the same local variable for  
sizes of things. Replace the different uses with separate variables  
for clarity.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/113724ab-0028-493f-9605-6e8570f0939f@iki.fi  

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

Avoid memory leak on error while parsing pg_stat_statements dump file

commit   : 3c74cb5762db6373187c3cf83f1b955e88773e33    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 12:20:38 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 12:20:38 +0200    

Click here for diff

By using palloc() instead of raw malloc().  
  
Reported-by: Gaurav Singh <gaurav.singh@yugabyte.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/CAEcQ1bYR9s4eQLFDjzzJHU8fj-MTbmRpW-9J-r2gsCn+HEsynw@mail.gmail.com  
Backpatch-through: 14  

M contrib/pg_stat_statements/pg_stat_statements.c

Add a graph pattern variable only once

commit   : 288ae968726ebaca587a446041fe0e0a6377562d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 10:49:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 10:49:49 +0100    

Click here for diff

An element pattern variable may be repeated in the path pattern.  
GraphTableParseState maintains a list of all variable names used in  
the graph pattern.  Add a new variable name to that list only when it  
is not present already.  This isn't a problem right now, but it could  
be in the future.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5tR4O0vjeqTCPr2VB5pYjNYbJgbCBEQf63NtU5Pz1MiOQ%40mail.gmail.com  

M src/backend/parser/parse_graphtable.c

Minor comment fixes to yesterday's LWLock tranche refactoring

commit   : 98993150c0a4c082cdb8864ae20c0bb934ad27cb    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 11:44:10 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 27 Mar 2026 11:44:10 +0200    

Click here for diff

Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAA5RZ0sLENRM+BicUjQFs_rP38oPx3gm0SsGrD0-jMhhM+HZ_w@mail.gmail.com  

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

Reject consecutive element patterns of same kind

commit   : 720f0f89d696a5c12817359b5c0f3da8e7ebdfe8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 10:30:01 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Mar 2026 10:30:01 +0100    

Click here for diff

Adding an implicit empty vertex pattern when a path pattern starts or  
ends with an edge pattern or when two consecutive edge patterns appear  
in the pattern is not supported right now.  Prohibit such path  
patterns.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/72a23702-6d96-4103-a54b-057c2352e885%2540eisentraut.org  

M src/backend/parser/parse_graphtable.c
M src/backend/rewrite/rewriteGraphTable.c
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/graph_table.sql

Enable warning like -Wstrict-prototypes on MSVC as well

commit   : b4a132022444e051fb402648d08f9ed487b2c45e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    

Click here for diff

This adds an MSVC warning option equivalent to those added in commit  
29bf4ee7496 for GCC/Clang.  
  
Note that this requires commit bccfc73acde (Disable warnings in system  
headers in MSVC).  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/aa73q1aT0A3/vke/%40ip-10-97-1-34.eu-west-3.compute.internal  

M meson.build

pg_plan_advice: pgindent

commit   : 874da8b1f6143808a4433df645c1e81f6a8bbd1e    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 20:10:13 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 20:10:13 -0400    

Click here for diff

Reported-by: Lukas Fittl <lukas@fittl.com>  

M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/pgpa_planner.h
M contrib/pg_plan_advice/pgpa_walker.c
M src/include/nodes/pathnodes.h

Use ShmemInitStruct to allocate lwlock.c's shared memory

commit   : 30d432502bf42343ec0f9ad599625cde0cb38e57    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:37 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:37 +0200    

Click here for diff

It's nice to have them show up in pg_shmem_allocations like all other  
shmem areas. ShmemInitStruct() depends on ShmemIndexLock, but only  
after postmaster startup.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi  

M src/backend/postmaster/launch_backend.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h

Move ShmemIndexLock into ShmemAllocator

commit   : 06d859aaf4e988ddef8adc55efb21324c5e30092    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:33 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:33 +0200    

Click here for diff

This makes shmem.c independent of the main LWLock array. That makes it  
possible to stop passing MainLWLockArray through BackendParameters in  
the next commit.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlocklist.h

Use a separate spinlock to protect LWLockTranches

commit   : 12e3e0f2c8f7a47902b4c201ac31a12390f75657    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:29 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:29 +0200    

Click here for diff

Previously we reused the shmem allocator's ShmemLock to also protect  
lwlock.c's shared memory structures. Introduce a separate spinlock for  
lwlock.c for the sake of modularity. Now that lwlock.c has its own  
shared memory struct (LWLockTranches), this is easy to do.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi  

M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/shmem.h

Refactor how user-defined LWLock tranches are stored in shmem

commit   : d6eba30a245cd258e0b62753088202284dc59dc0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:22 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:47:22 +0200    

Click here for diff

Merge the LWLockTranches and NamedLWLockTrancheRequest data structures  
in shared memory into one array of user-defined tranches. The  
NamedLWLockTrancheRequest list is now only used in postmaster, to hold  
the requests until shared memory is initialized.  
  
Introduce a C struct, LWLockTranches, to hold all the different fields  
kept in shared memory. This gives an easier overview of what are all  
the things kept in shared memory. Previously, we had separate pointers  
for LWLockTrancheNames, LWLockCounter and the (shared memory copy of)  
NamedLWLockTrancheRequestArray.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi  

M src/backend/postmaster/launch_backend.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
M src/tools/pgindent/typedefs.list

Rename MAX_NAMED_TRANCHES to MAX_USER_DEFINED_TRANCHES

commit   : cc88481aeb98326c528acb07114dd92f06de28c0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:46:04 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 23:46:04 +0200    

Click here for diff

The "named tranches" term is a little confusing. In most places it  
refers to tranches requested with RequestNamedLWLockTranche(), even  
though all built-in tranches and tranches allocated with  
LWLockNewTrancheId() also have a name. But in MAX_NAMED_TRANCHES, it  
refers to tranches requested with either RequestNamedLWLockTranche()  
or LWLockNewTrancheId(), as it's the maximum of all of those in total.  
  
The "user defined" term is already used in  
LWTRANCHE_FIRST_USER_DEFINED, so let's standardize on that to mean  
tranches allocated with either RequestNamedLWLockTranche() or  
LWLockNewTrancheId().  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi  

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

Doc: declutter CREATE TABLE synopsis.

commit   : a6d26e0fb29b8b644a495a6c2d5ed5c50b41addb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 17:27:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 17:27:32 -0400    

Click here for diff

Factor out the "persistence mode" and storage/compression parts  
of the syntax synopsis to reduce line lengths and increase  
readability.  Also add an introductory para about the persistence  
modes so that the Description section still lines up with the  
synopsis.  
  
Author: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CAKFQuwYfMV-2SdrP-umr5SVNSqTn378BUvHsebetp5=DhT494w@mail.gmail.com  

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

pg_plan_advice: Invent DO_NOT_SCAN(relation_identifier).

commit   : 6455e55b0da47255f332a96f005ba0dd1c7176c2    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 17:09:57 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 17:09:57 -0400    

Click here for diff

The premise of src/test/modules/test_plan_advice is that if we plan  
a query once, generate plan advice, and then replan it using that  
same advice, all of that advice should apply cleanly, since the  
settings and everything else are the same. Unfortunately, that's  
not the case: the test suite is the main regression tests, and  
concurrent activity can change the statistics on tables involved  
in the query, especially system catalogs. That's OK as long as it  
only affects costing, but in a few cases, it affects which relations  
appear in the final plan at all.  
  
In the buildfarm failures observed to date, this happens because  
we consider alternative subplans for the same portion of the query;  
in theory, MinMaxAggPath is vulnerable to a similar hazard. In both  
cases, the planner clones an entire subquery, and the clone has a  
different plan name, and therefore different range table identifiers,  
than the original. If a cost change results in flipping between one  
of these plans and the other, the test_plan_advice tests will fail,  
because the range table identifiers to which advice was applied won't  
even be present in the output of the second planning cycle.  
  
To fix, invent a new DO_NOT_SCAN advice tag. When generating advice,  
emit it for relations that should not appear in the final plan at  
all, because some alternative version of that relation was used  
instead. When DO_NOT_SCAN is supplied, disable all scan methods for  
that relation.  
  
To make this work, we reuse a bunch of the machinery that previously  
existed for the purpose of ensuring that we build the same set of  
relation identifiers during planning as we do from the final  
PlannedStmt. In the process, this commit slightly weakens the  
cross-check mechanism: before this commit, it would fire whenever  
the pg_plan_advice module was loaded, even if pg_plan_advice wasn't  
actually doing anything; now, it will only engage when we have some  
other reason to create a pgpa_planner_state. The old way was complex  
and didn't add much useful test coverage, so this seems like an  
acceptable sacrifice.  
  
Discussion: http://postgr.es/m/CA+TgmoYuWmN-00Ec5pY7zAcpSFQUQLbgAdVWGR9kOR-HM-fHrA@mail.gmail.com  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  

M contrib/pg_plan_advice/README
A contrib/pg_plan_advice/expected/alternatives.out
M contrib/pg_plan_advice/expected/scan.out
M contrib/pg_plan_advice/meson.build
M contrib/pg_plan_advice/pgpa_ast.c
M contrib/pg_plan_advice/pgpa_ast.h
M contrib/pg_plan_advice/pgpa_output.c
M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/pgpa_planner.h
M contrib/pg_plan_advice/pgpa_trove.c
M contrib/pg_plan_advice/pgpa_walker.c
M contrib/pg_plan_advice/pgpa_walker.h
A contrib/pg_plan_advice/sql/alternatives.sql
M contrib/pg_plan_advice/sql/scan.sql
M doc/src/sgml/pgplanadvice.sgml

Add an alternative_plan_name field to PlannerInfo.

commit   : 26255a320733de2d91a30bd6ae529dd01e7f3409    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 16:45:17 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 16:45:17 -0400    

Click here for diff

Typically, we have only one PlannerInfo for any given subquery, but  
when we are considering a MinMaxAggPath or a hashed subplan, we end  
up creating a second PlannerInfo for the same portion of the query,  
with a clone of the original range table. In fact, in the MinMaxAggPath  
case, we might end up creating several clones, one per aggregate.  
  
At present, there's no easy way for a plugin, such as pg_plan_advice,  
to understand the relationships between the original range table and  
the copies of it that are created in these cases.  To fix, add an  
alternative_plan_name field to PlannerInfo. For a hashed subplan, this  
is the plan name for the non-hashed alternative; for minmax aggregates,  
this is the plan_name from the parent PlannerInfo; otherwise, it's the  
same as plan_name.  
  
Discussion: http://postgr.es/m/CA+TgmoYuWmN-00Ec5pY7zAcpSFQUQLbgAdVWGR9kOR-HM-fHrA@mail.gmail.com  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/planner.h

Doc: commit performs rollback of aborted transactions.

commit   : 10e2a8ac6a621352e032a0ca5c74a2be88d157e4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 15:14:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 15:14:21 -0400    

Click here for diff

The COMMIT command handles an aborted transaction in the same  
manner as the ROLLBACK command, but this wasn't explained in  
its official reference page.  Also mention that behavior in  
the tutorial's material on transactions.  
  
Also add a comment mentioning that we don't raise an exception  
for COMMIT within an aborted transaction, as the SQL standard  
would have us do.  
  
Hyperlink a couple of cross-references while we're at it.  
  
Author: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Gurjeet Singh <gurjeet@singh.im>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAKFQuwYgYR3rWt6vFXw=ZWZ__bv7PqvdOnHujG+UyqE11f+3sg@mail.gmail.com  

M doc/src/sgml/advanced.sgml
M doc/src/sgml/ref/commit.sgml

Address perlcritic complaint in response to 906a0469728

commit   : 698ab40469841877aef82f619d06cbbe4d1cbb80    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 15:03:47 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 15:03:47 -0400    

Click here for diff

M src/test/modules/test_aio/t/TestAio.pm

bufmgr: Restructure AsyncReadBuffers()

commit   : 8a1a1d6ab86217020a612ee2e03eae4fe00ae781    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:51:52 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:51:52 -0400    

Click here for diff

Restructure AsyncReadBuffers() to use early return when the head buffer is  
already valid, instead of using a did_start_io flag and if/else branches. Also  
move around a bit of the code to be located closer to where it is used. This  
is a refactor only.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

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

bufmgr: Make buffer hit helper

commit   : df09452c3209d542a19b9c4afa7a18c656cb4a80    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:51:25 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:51:25 -0400    

Click here for diff

Already two places count buffer hits, requiring quite a few lines of  
code since we do accounting in so many places. Future commits will add  
more locations, so refactor into a helper.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

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

bufmgr: Pass io_object and io_context through to PinBufferForBlock()

commit   : c2a68e08b13f3cb437c92102fb11ab0f45dbd67f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:50:44 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:50:44 -0400    

Click here for diff

PinBufferForBlock() is always_inline and called in a loop in  
StartReadBuffersImpl(). Previously it computed io_context and io_object  
internally, which required calling IOContextForStrategy() -- a non-inline  
function the compiler cannot prove is side-effect-free. This could potential  
cause unneeded redundant function calls.  
  
Compute io_context and io_object in the callers instead, allowing  
StartReadBuffersImpl() to do so once before entering the loop.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

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

pg_plan_advice: Refactor to invent pgpa_planner_info

commit   : 5dcb15e89af2d9fbc3b038c2ea420905b279fdaf    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 11:57:33 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 26 Mar 2026 11:57:33 -0400    

Click here for diff

pg_plan_advice tracks two pieces of per-PlannerInfo data: (1) for each  
RTI, the corresponding relation identifier, for purposes of  
cross-checking those calculations against the final plan; and (2) the  
set of semijoins seen during planning for which the strategy of making  
one side unique was considered. The former is tracked using a hash  
table that uses <plan_name, RTI> as the key, and the latter is  
tracked using a List of <plan_name, relids>.  
  
It seems better to track both of these things in the same way and  
to try to reuse some code instead of having everything be completely  
separate, so invent pgpa_planner_info; we'll create one every time we  
see a new PlannerInfo and need to associate some data with it, and  
we'll use the plan_name field to distinguish between PlannerInfo  
objects, as it should always be unique. Then, refactor the two  
systems mentioned above to use this new infrastructure.  
  
(Note that the adjustment in pgpa_plan_walker is necessary in order  
to avoid spuriously triggering the sanity check in that function,  
in the case where a pgpa_planner_info is created for a purpose not  
related to sj_unique_rels.)  
  
Discussion: https://postgr.es/m/CA+TgmoaK=4w7-qknUo3QhUJ53pXZq=c=KgZmRyD+k7ytqfmgSg@mail.gmail.com  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  

M contrib/pg_plan_advice/pgpa_planner.c
M contrib/pg_plan_advice/pgpa_planner.h
M contrib/pg_plan_advice/pgpa_walker.c
M contrib/pg_plan_advice/pgpa_walker.h
M src/tools/pgindent/typedefs.list

Add labels to help make psql's hidden queries more understandable.

commit   : 41d69e6dccad6ef26511a466e6484bc8807362cf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 11:36:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 26 Mar 2026 11:36:38 -0400    

Click here for diff

We recommend looking at psql's "-E" output to help understand the  
system catalogs, but in some cases (particularly table displays)  
there's a bunch of rather impenetrable SQL there.  As a small  
improvement, label each query issued by describe.c with a short  
description of its purpose.  The code is arranged so that the  
labels also appear as SQL comments in the server log, if the  
server is logging these commands.  
  
We could expand this policy to every use of PSQLexec(), but most of  
the ones outside describe.c are issuing simple commands like "BEGIN"  
or "COMMIT", which don't seem to need such glosses.  I did add  
labels to the commands issued by \sf, \sv and friends.  
  
Also, make the -E and log output for hidden queries say  
"INTERNAL QUERY" not just "QUERY", to distinguish them from  
user-written queries.  
  
Author: Greg Sabino Mullane <htamfids@gmail.com>  
Co-authored-by: David Christensen <david+pg@pgguru.net>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAKAnmmJz8Hh=8Ru8jgzySPWmLBhnv4=oc_0KRiz-UORJ0Dex+w@mail.gmail.com  

M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/describe.c

Fix off-by-one error in read IO tracing

commit   : cf66978d7990b219a2eda03c3d4f978f68d046d3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:07:59 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:07:59 -0400    

Click here for diff

AsyncReadBuffer()'s no-IO needed path passed  
TRACE_POSTGRESQL_BUFFER_READ_DONE the wrong block number because it had  
already incremented operation->nblocks_done. Fix by folding the  
nblocks_done offset into the blocknum local variable at initialization.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/u73un3xeljr4fiidzwi4ikcr6vm7oqugn4fo5vqpstjio6anl2%40hph6fvdiiria  
Backpatch-through: 18  

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

aio: Refactor tests in preparation for more tests

commit   : 906a0469728e1dead174e0b738337f6f07a99601    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:07:59 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Mar 2026 10:07:59 -0400    

Click here for diff

In a future commit more AIO related tests are due to be introduced. However  
001_aio.pl already is fairly large.  
  
This commit introduces a new TestAio package with helpers for writing AIO  
related tests. Then it uses the new helpers to simplify the existing  
001_aio.pl by iterating over all supported io_methods. This will be  
particularly helpful because additional methods already have been submitted.  
  
Additionally this commit splits out testing of initdb using a non-default  
method into its own test. While that test is somewhat important, it's fairly  
slow and doesn't break that often. For development velocity it's helpful for  
001_aio.pl to be faster.  
  
While particularly the latter could benefit from being its own commit, it  
seems to introduce more back-and-forth than it's worth.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv  

M src/test/modules/test_aio/meson.build
M src/test/modules/test_aio/t/001_aio.pl
A src/test/modules/test_aio/t/003_initdb.pl
A src/test/modules/test_aio/t/TestAio.pm

Respect disabled_nodes in fix_alternative_subplan.

commit   : 47c110f77e75ed7efd54c3b152f7da2350522f8c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 20 Mar 2026 14:04:41 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 20 Mar 2026 14:04:41 -0400    

Click here for diff

When my commit e22253467942fdb100087787c3e1e3a8620c54b2 added the  
concept of disabled_nodes, it failed to add a disabled_nodes field  
to SubPlan. This is a regression: before that commit, when  
fix_alternative_subplan compared the costs of two plans, the number  
of disabled nodes affected the result, because it was just a  
component of the total cost. After that commit, it no longer did,  
making it possible for a disabled path to win on cost over one that  
is not disabled. Fix that.  
  
As usual for planner fixes that might destabilize plan choices,  
no back-patch.  
  
Discussion: https://postgr.es/m/CA+TgmoaK=4w7-qknUo3QhUJ53pXZq=c=KgZmRyD+k7ytqfmgSg@mail.gmail.com  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/primnodes.h

Fix -Wcast-qual warning

commit   : 119e791e9c7d7d122f7a9554514455c38115964a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 15:00:24 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 15:00:24 +0100    

Click here for diff

This dials back a couple of the qualifiers added by commit  
7724cb9935a.  Specifically, in match_boolean_partition_clause() the  
call to negate_clause() casts away the const, so we shouldn't make the  
input argument const.  

M src/backend/partitioning/partprune.c

Avoid sending duplicate WAL locations in standby status replies

commit   : 400a790a48eb7a1e76f23f9f6d8a6f7159395f65    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Mar 2026 20:54:32 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Mar 2026 20:54:32 +0900    

Click here for diff

Previously, when the startup process applied WAL and requested walreceiver  
to send an apply notification to the primary, walreceiver sent a status reply  
unconditionally, even if the WAL locations had not advanced since  
the previous update.  
  
As a result, the standby could send two consecutive status reply messages  
with identical WAL locations even though wal_receiver_status_interval had  
not yet elapsed. This could unexpectedly reset the reported replication lag,  
making it difficult for users to monitor lag. The second message was also  
unnecessary because it reported no progress.  
  
This commit updates walreceiver to send a reply only when the apply location  
has advanced since the last status update, even when the startup process  
requests a notification.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurTzcUrEzrH97DD7+Yz=HGPU81kzWQonKZvqBwYhx2G9_A@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/walreceiver.c
M src/include/replication/walreceiver.h

Fix premature NULL lag reporting in pg_stat_replication

commit   : eef1ba704ddeb73633e40f8cab41ab7402952684    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Mar 2026 20:49:31 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Mar 2026 20:49:31 +0900    

Click here for diff

pg_stat_replication is documented to keep the last measured lag values for  
a short time after the standby catches up, and then set them to NULL when  
there is no WAL activity. However, previously lag values could become NULL  
prematurely even while WAL activity was ongoing, especially in logical  
replication.  
  
This happened because the code cleared lag when two consecutive reply messages  
indicated that the apply location had caught up with the send location.  
It did not verify that the reported positions were unchanged, so lag could be  
cleared even when positions had advanced between messages. In logical  
replication, where the apply location often quickly catches up, this issue was  
more likely to occur.  
  
This commit fixes the issue by clearing lag only when the standby reports that  
it has fully replayed WAL (i.e., both flush and apply locations have caught up  
with the send location) and the write/flush/apply positions remain unchanged  
across two consecutive reply messages.  
  
The second message with unchanged positions typically results from  
wal_receiver_status_interval, so lag values are cleared after that interval  
when there is no activity. This avoids showing stale lag data while preventing  
premature NULL values.  
  
Even with this fix, lag may rarely become NULL during activity if identical  
position reports are sent repeatedly. Eliminating such duplicate messages  
would address this fully, but that change is considered too invasive for stable  
branches and will be handled in master only later.  
  
Backpatch to all supported branches.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurTzcUrEzrH97DD7+Yz=HGPU81kzWQonKZvqBwYhx2G9_A@mail.gmail.com  
Backpatch-through: 14  

M src/backend/replication/walsender.c

Refactor ShmemIndex initialization

commit   : 6b8238cb6aa76924fa63640fe421c421d2fa5472    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 11:35:55 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 26 Mar 2026 11:35:55 +0200    

Click here for diff

Initialize the ShmemIndex hash table in InitShmemAllocator() already,  
removing the need for the separate InitShmemIndex() step.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5vM1bneLYfg0wGeAa=52UiJ3z4vKd3AJ72X8Fw6k3KKrg@mail.gmail.com  

M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/include/storage/shmem.h

MSVC: Remove unnecessary warning option

commit   : 515b0dc4bc74b43793ccf82965b7aaa79ad7161b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 09:10:42 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 09:10:42 +0100    

Click here for diff

The MSVC warning option /w24777 added by commit 2307cfe3162 was a  
typo, it should have been /w24477.  But this option is already enabled  
by default in level 1, so we don't need to add it explicitly.  So just  
remove it.  

M meson.build

Make fixed-length list building macros work in C++

commit   : f8e7ca32851082a85d628b7821ae674be09bf1f3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 08:40:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 26 Mar 2026 08:40:18 +0100    

Click here for diff

Compound literals, as used in pg_list.h for list_makeN(), are not a  
C++ feature.  MSVC doesn't accept these.  (GCC and Clang accept them,  
but they would warn in -pedantic mode.)  Replace with equivalent  
inline functions.  (These are the only instances of compound literals  
used in PostgreSQL header files.)  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg%40mail.gmail.com  

M src/include/nodes/pg_list.h

Refactor replorigin_session_setup() for better readability.

commit   : 735e8fe685359480e77d837493a5dc0a38866944    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 26 Mar 2026 09:15:25 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 26 Mar 2026 09:15:25 +0530    

Click here for diff

Reorder the validation checks in replorigin_session_setup() to provide a  
more logical flow. This makes the function easier to follow and ensures  
that basic state checks are performed consistently.  
  
Additionally, update an error message to align its phrasing with similar  
diagnostics in the replication origin subsystem, improving overall  
consistency.  
  
Author: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/e0508305-bc6a-417c-b969-36564d632f9e@iki.fi  

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

Fix UUID sortability tests in base32hex encoding.

commit   : 89210037a0ab1f5e1375484edcfb8bbb4d9e7970    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 20:12:26 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 20:12:26 -0700    

Click here for diff

Commit 497c1170cb1 added base32hex encoding support, but its  
regression test for UUIDs failed on buildfarm members hippopotamus and  
jay using natural language locales (such as cs_CZ). This happened  
because those collations may sort characters differently, which breaks  
the strict byte-wise lexicographical ordering expected by base32hex  
encoding.  
  
This commit fixes the regression tests by explicitly using the C  
collation.  
  
Per buildfarm members hippopotamus and jay.  
  
Analyzed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/682417.1774482047@sss.pgh.pa.us  

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

Improve timeout handling of pg_promote()

commit   : 4287c50fc21e6d1c7798955020f8438ae2327472    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Mar 2026 10:39:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 26 Mar 2026 10:39:40 +0900    

Click here for diff

Previously, pg_promote() looped a fixed number of times, calculated from  
the specified timeout, and waited 100ms on a latch, once per iteration,  
for the promotion of a standby to complete.  However, unrelated signals  
to the backend could set the latch and wake up the backend early,  
resulting in a faster consumption of the loops and an execution time of  
the function that does not match with the timeout input given in input.  
This could be confusing for the function caller, especially if some  
backend-side timeout is aggressive, because the function would return  
much earlier than expected and report that the promote request has not  
completed within the time requested.  
  
This commit refines the logic to track the time actually elapsed, by  
looping until the requested duration has truly passed.  The code  
calculates the end time we expect, then uses it when looping.  
  
Author: Robert Pang <robertpang@google.com>  
Reviewed-by: Tiancheng Ge <getiancheng_2012@163.com>  
Discussion: https://postgr.es/m/CAJhEC07OK8J7tLUbyiccnuOXRE7UKxBNqD2-pLfeFXa=tBoWtw@mail.gmail.com  

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

Remove a low-value, high-risk optimization in pg_waldump.

commit   : e9d723487b262e8d2bb883e4f8e799c3774265c7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 19:15:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 19:15:52 -0400    

Click here for diff

The code removed here deleted already-used data from a partially-read  
WAL segment's hashtable entry.  The intent was evidently to try to  
keep the entry's memory consumption below the WAL segment's total  
size, but we don't use WAL segments that are so large as to make that  
a big win.  The important memory-space optimization is to remove  
hashtable entries altogether when done with them, and that's handled  
elsewhere.  To buy that, we must accept a substantially more complex  
(and under-documented) logical invariant about what is in entry->buf,  
as well as complex and under-documented interactions with the entry  
spilling logic, various re-checking code paths in xlogreader.c,  
and pg_waldump's overall data processing order.  Any of those aspects  
could have bugs lurking still, and are quite likely to be prone to  
new bugs after future code changes.  
  
Given the number of bugs we've already found in commit b15c15139,  
I judge that simplifying anything we possibly can is a good decision.  
  
While here, revise and extend some related comments.  
  
Discussion: https://postgr.es/m/374225.1774459521@sss.pgh.pa.us  

M src/bin/pg_waldump/archive_waldump.c

Fix misuse of simplehash.h hash operations in pg_waldump.

commit   : ff84efe4fdc081545ec68064588dffecfb026527    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 18:37:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 18:37:28 -0400    

Click here for diff

Both ArchivedWAL_insert() and ArchivedWAL_delete_item() can cause  
existing hashtable entries to move.  The code didn't account for this  
and could leave privateInfo->cur_file pointing at a dead or incorrect  
entry, with hilarity ensuing.  Likewise, read_archive_wal_page calls  
read_archive_file which could result in movement of the hashtable  
entry it is working with.  
  
I believe these bugs explain some odd buildfarm failures, although  
the amount of data we use in pg_waldump's TAP tests isn't enough to  
trigger them reliably.  
  
This code's all new as of commit b15c15139, so no need for back-patch.  
  
Discussion: https://postgr.es/m/374225.1774459521@sss.pgh.pa.us  

M src/bin/pg_waldump/archive_waldump.c

Fix file descriptor leakages in pg_waldump.

commit   : 03b1e30e7aa5c0d83514db4156cfc80632f50493    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 18:28:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Mar 2026 18:28:42 -0400    

Click here for diff

TarWALDumpCloseSegment was of the opinion that it didn't need to  
do anything.  It was mistaken: it has to close the open file if  
any, because nothing else will, leading to a descriptor leak.  
  
In addition, we failed to ensure that any file being read by the  
XLogReader machinery gets closed before the atexit callback tries to  
cleanup the temporary directory holding spilled WAL files.  While the  
file would have been closed already in case of a success exit, this  
doesn't happen in case of pg_fatal() exits.  The least messy way  
to fix that is to move the atexit function into pg_waldump.c,  
where it has easier access to the XLogReaderState pointer and to  
WALDumpCloseSegment.  
  
These FD leakages are pretty insignificant on Unix-ish platforms,  
but they're a bug on Windows, because they prevent successful cleanup  
of the temporary directory for extracted WAL files.  (Windows can't  
delete a directory that holds a deleted-but-still-open file.)  
This is visible in occasional buildfarm failures.  
  
This code's all new as of commit b15c15139, so no need for back-patch.  
  
Discussion: https://postgr.es/m/374225.1774459521@sss.pgh.pa.us  

M src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/pg_waldump.c

Add base32hex support to encode() and decode() functions.

commit   : 497c1170cb108cd84fe13db19c049177376fec5f    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 11:35:19 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 11:35:19 -0700    

Click here for diff

This adds support for base32hex encoding and decoding, as defined in  
RFC 4648 Section 7. Unlike standard base32, base32hex uses the  
extended hex alphabet (0-9, A-V) which preserves the lexicographical  
order of the encoded data.  
  
This is particularly useful for representing UUIDv7 values in a  
compact string format while maintaining their time-ordered sort  
property.  
  
The encode() function produces output padded with '=', while decode()  
accepts both padded and unpadded input. Following the behavior of  
other encoding types, decoding is case-insensitive.  
  
Suggested-by: Sergey Prokhorenko <sergeyprokhorenko@yahoo.com.au>  
Author: Andrey Borodin <x4mmm@yandex-team.ru>  
Co-authored-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Илья Чердаков <i.cherdakov.pg@gmail.com>  
Reviewed-by: Chengxi Sun <chengxisun92@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAJ7c6TOramr1UTLcyB128LWMqita1Y7%3Darq3KHaU%3Dqikf5yKOQ%40mail.gmail.com  

M doc/src/sgml/func/func-binarystring.sgml
M src/backend/utils/adt/encode.c
M src/test/regress/expected/strings.out
M src/test/regress/expected/uuid.out
M src/test/regress/sql/strings.sql
M src/test/regress/sql/uuid.sql

Remove unused autovac_table.at_sharedrel

commit   : c8b4a3ec087b037b1f59554d622855cf9cc44cfb    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 25 Mar 2026 14:04:33 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 25 Mar 2026 14:04:33 +0100    

Click here for diff

The last use was removed by commit 38f7831d703b.  After that, we compute  
MyWorkerInfo->wi_sharedrel directly from the pg_class tuple of the table  
being vacuumed rather than passing it around.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Discussion: https://postgr.es/m/20260325165734.7ab8e4e55fe4c2f1e55031d9@sraoss.co.jp  

M src/backend/postmaster/autovacuum.c

psql: Fix tab completion for FOREIGN DATA WRAPPER and SUBSCRIPTION.

commit   : 5fa7837d9a3970c5ea372bb90b916b54478fb818    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 09:30:26 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 25 Mar 2026 09:30:26 -0700    

Click here for diff

Commit 8185bb5347 extended the CREATE/ALTER SUBSCRIPTION and  
CREATE/ALTER FOREIGN DATA WRAPPER commands, but missed the  
corresponding tab-completion logic. This commit fixes that oversight  
by adding completion support for:  
  
- The CONNECTION keyword in CREATE/ALTER FOREIGN DATA WRAPPER.  
- The list of foreign servers in CREATE/ALTER SUBSCRIPTION.  
  
Author: Yamaguchi Atsuo <acrobatcoder@gmail.com>  
Discussion: https://postgr.es/m/CAKSyusJWdWcUKVd3qJXcEaQxJewGymQWV_r3-mc=Knrqo0AZ_g@mail.gmail.com  

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

Remove compiler warning option -Wendif-labels

commit   : 87e1891c459ecf7aa839de75d8afca3e1a6d154f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    

Click here for diff

This warning has always been on by default in GCC (and in Clang at  
least going back to 3.1), so we don't need the option explicitly.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/aa73q1aT0A3/vke/%40ip-10-97-1-34.eu-west-3.compute.internal  

M configure
M configure.ac
M meson.build

Disable warnings in system headers in MSVC

commit   : bccfc73acde97cdb76ba36558ed394e89d3c808b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 15:03:30 +0100    

Click here for diff

This is similar to the standard behavior in GCC.  For MSVC, we set all  
headers in angle brackets to be considered system headers.  (GCC goes  
by path, not include style.)  
  
The required option is available since VS 2017.  (Before VS 2019  
version 16.10, the additional option /experimental:external is  
required, but per discussion in [0], we effectively require 16.11, so  
this shouldn't be a problem.)  
  
[0]: https://www.postgresql.org/message-id/04ab76a3-186c-4a37-8076-e6882ebf9d43%40eisentraut.org  
  
Then, we can remove one workaround for avoiding a warning from a  
system header.  (And some warnings to be enabled in the future could  
benefit from this.)  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/aa73q1aT0A3/vke/%40ip-10-97-1-34.eu-west-3.compute.internal  

M meson.build
M src/backend/port/win32/crashdump.c

Fix some typos and make small stylistic improvements

commit   : 5282bf535e474dc2517f2e835d147420ae2144de    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 09:17:40 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 09:17:40 +0100    

Click here for diff

for commit 2f094e7ac69  
  
Author: zengman <zengman@halodbtech.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M src/backend/rewrite/rewriteGraphTable.c

Fix typo

commit   : c79e4141273caa1b4fb88c479bb90dc40f2fbbf2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 07:09:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 25 Mar 2026 07:09:44 +0100    

Click here for diff

Mistake in commit e2f289e5b9b: SOFT_ERROR_OCCURRED was called with the  
wrong fcinfo field.  
  
Reported-by: Jianghua Yang <yjhjstz@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAAZLFmSGti716gWeY%3DDCZ9TTVOixnHZ4_4V4tDzoeE86D64vOA%40mail.gmail.com  

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

pg_createsubscriber: Add -l/--logdir option to redirect output to files.

commit   : 6b5b7eae3ae65572e2abda20ef2b2c908527c28a    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 25 Mar 2026 11:22:07 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 25 Mar 2026 11:22:07 +0530    

Click here for diff

This commit introduces a -l (or --logdir) argument to pg_createsubscriber,  
allowing users to specify a directory for log files.  
  
When enabled, a timestamped subdirectory is created within the specified  
log directory, containing:  
  
pg_createsubscriber_server.log: Captures logs from the standby server  
during its start/stop cycles.  
pg_createsubscriber_internal.log: Captures the tool's own internal  
diagnostic and progress messages.  
  
This ensures that transient server and utility messages are preserved for  
troubleshooting after the subscriber creation process completes or errored  
out.  
  
Author: Gyan Sreejith <gyan.sreejith@gmail.com>  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc+G+f4oSUHw@mail.gmail.com  

M doc/src/sgml/ref/pg_createsubscriber.sgml
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

Refactor handling of x86 CPUID instructions

commit   : be6a7494d2e387d1f5b7a5dcc6c2afcb403188d6    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 25 Mar 2026 12:32:36 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 25 Mar 2026 12:32:36 +0700    

Click here for diff

Introduce two helpers for CPUID, pg_cpuid and pg_cpuid_subleaf that wrap  
the platform specific __get_cpuid/__cpuid and __get_cpuid_count/__cpuidex  
functions.  
  
Additionally, use macros to specify registers names (e.g. EAX) for clarity,  
instead of numeric integers into the result array.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Suggested-By: John Naylor <john.naylor@postgresql.org>  
Discussion: https://postgr.es/m/CANWCAZZ+Crjt5za9YmFsURRMDW7M4T2mutDezd_3s1gTLnrzGQ@mail.gmail.com  

M src/port/pg_cpu_x86.c

Remove isolation test lock-stats

commit   : 7c64d56fd9765bb577937c07eabed971e605c67c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 25 Mar 2026 08:48:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 25 Mar 2026 08:48:15 +0900    

Click here for diff

This test is proving to be unstable in the CI for Windows, at least.  
The origin of the issue is that the deadlock_timeout requests may not  
be processed, causing the lock stats to not be updated.  This could be  
mitigated by making the hardcoded sleep longer, however this would cost  
in runtime on fast machines.  On slow machines, there is no guarantee  
that an augmented sleep would be enough.  
  
An isolation test may not be the best method to write this test  
(TAP test with injection point with a NOTICE+wait_for_log before  
processing the deadlock_timeout request should remove the need of a  
sleep).  As we are late in the release cycle, I am removing the test for  
now to keep the CI and the buildfarm a maximum stable.  Let's revisit  
this part later.  
  
Discussion: https://postgr.es/m/hlkdrplgrmudbspibsuq6xooxrqxqsgwo6x5b6x5ptvkgjbe7w@xogt6xgua6dz  

D src/test/isolation/expected/lock-stats.out
M src/test/isolation/isolation_schedule
D src/test/isolation/specs/lock-stats.spec

Refactor to remove ForeignServerName().

commit   : 11f8018ee6784476d8dcee3ef64b267fb16fc374    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2026 15:20:28 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2026 15:20:28 -0700    

Click here for diff

Callers either have a ForeignServer object or can readily construct  
one.  
  
Discussion: https://postgr.es/m/CAExHW5vV5znEvecX=ra2-v7UBj9-M6qvdDzuB78M-TxbYD1PEA@mail.gmail.com  
Suggested-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  

M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/foreign/foreign.c
M src/include/foreign/foreign.h

GetSubscription(): use per-object memory context.

commit   : f16f5d608ca6830f452a3b1e9f72afc6851cab38    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2026 15:10:03 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 24 Mar 2026 15:10:03 -0700    

Click here for diff

Constructing a Subcription object uses a number of small or temporary  
allocations. Use a per-object memory context for easy cleanup.  
  
Get rid of FreeSubscription() which did not free all the allocations  
anyway. Also get rid of the PG_TRY()/PG_CATCH() logic in  
ForeignServerConnectionString() which were used to avoid leaks during  
GetSubscription().  
  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/xvdjrdqnpap3uq7owbaox3r7p5gf7sv62aaqf2ju3vb6yglatr%40kvvwhoudrlxq  
Discussion: https://postgr.es/m/CAA4eK1K=WjZ1maBCmj=5ZdO66AwPORK5ZBxVKedS0xdCcb621A@mail.gmail.com  

M src/backend/catalog/pg_subscription.c
M src/backend/foreign/foreign.c
M src/backend/replication/logical/worker.c
M src/include/catalog/pg_subscription.h

Remove XLOG_HEAP2_VISIBLE entirely

commit   : a881cc9c7e819fb26b73bb43b35d43db6b795cc7    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 17:58:12 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 17:58:12 -0400    

Click here for diff

There are no remaining users that emit XLOG_HEAP2_VISIBLE records, so it  
can be removed. This includes deleting the xl_heap_visible struct and  
all functions responsible for emitting or replaying XLOG_HEAP2_VISIBLE  
records.  
  
Bumps XLOG_PAGE_MAGIC because we removed a WAL record type.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com  

M src/backend/access/common/bufmask.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/replication/logical/decode.c
M src/backend/storage/ipc/standby.c
M src/include/access/heapam_xlog.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xlog_internal.h
M src/tools/pgindent/typedefs.list

WAL log VM setting for empty pages in XLOG_HEAP2_PRUNE_VACUUM_SCAN

commit   : a759ced2f1e2f817005c1b8ee92d0626764da7d1    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 17:28:05 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 17:28:05 -0400    

Click here for diff

As part of removing XLOG_HEAP2_VISIBLE records, phase I of VACUUM now  
marks empty pages all-visible and all-frozen in a  
XLOG_HEAP2_PRUNE_VACUUM_SCAN record.  
  
This has no real independent benefit, but empty pages were the last user  
of XLOG_HEAP2_VISIBLE, so by making this change we can next remove all  
of the XLOG_HEAP2_VISIBLE code.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Earlier version Reviewed-by: Robert Haas <robertmhaas@gmail.com>  

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

WAL log VM setting during vacuum phase I in XLOG_HEAP2_PRUNE_VACUUM_SCAN

commit   : 1252a4ee28636734d68f1acd33be45399c83dc53    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 16:49:46 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 16:49:46 -0400    

Click here for diff

Vacuum no longer emits a separate WAL record for each page set  
all-visible or all-frozen during phase I. Instead, visibility map  
updates are now included in the XLOG_HEAP2_PRUNE_VACUUM_SCAN record that  
is already emitted for pruning and freezing.  
  
Previously, heap_page_prune_and_freeze() determined whether a page was  
all-visible, but the corresponding VM bits were only set later in  
lazy_scan_prune(). Now the VM is updated immediately in  
heap_page_prune_and_freeze(), at the same time as the heap  
modifications. This reduces WAL volume produced by vacuum.  
  
For now, vacuum is still the only user of heap_page_prune_and_freeze()  
allowed to set the VM. On-access pruning is not yet able to set the VM.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Earlier version Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

get_memoize_path: Don't exit quickly when PGS_NESTLOOP_PLAIN is unset.

commit   : dc47beacaa0b0ad13d7ccd77399cccc98027964d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 16:17:26 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 16:17:26 -0400    

Click here for diff

This function exits early in the case where the number of inner rows  
is estimated to be less than 2, on the theory that in that case a  
Nested Loop with inner Memoize must lose to a plain Nested Loop.  
But since commit 4020b370f214315b8c10430301898ac21658143f it's  
possible for a plain Nested Loop to be disabled, while a Nested Loop  
with inner Memoize is still enabled. In that case, this reasoning  
is not valid, so adjust the code not to exit early in that case.  
  
This issue was revealed by a test_plan_advice failure on buildfarm  
member skink, where NESTED_LOOP_MEMOIZE() couldn't be enforced on  
replanning due to this early exit.  
  
Discussion: http://postgr.es/m/CA+TgmoZUN8FT1Ah=m6Uis5bHa4FUa+_hMDWtcABG17toEfpiUg@mail.gmail.com  

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

Keep newest live XID up-to-date even if page not all-visible

commit   : 9ba3ec076a68b82d49fb4d0ea008205befd2292b    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 15:36:34 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 15:36:34 -0400    

Click here for diff

During pruning, we keep track of the newest xmin of live tuples on the  
page visible to all running and future transactions so that we can use  
it later as the snapshot conflict horizon when setting the VM if the  
page turns out to be all-visible.  
  
Previously, we stopped updating this value once we determined the page  
was not all-visible. However, maintaining it even when the page is not  
all-visible is inexpensive and makes the snapshot conflict horizon  
calculation clearer. This guarantees it won't contain a stale value.  
  
Since we'll keep it up to date all the time now anyway, there's no  
reason not to maintain set_all_visible for on-access pruning. This will  
allow us to set the VM on-access in the future.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk  

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

Use GlobalVisState in vacuum to determine page level visibility

commit   : dd5716f3c74df6ebc97f5886b755ba79a3f5b559    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 14:50:59 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 24 Mar 2026 14:50:59 -0400    

Click here for diff

During vacuum's first and third phases, we examine tuples' visibility to  
determine if we can set the page all-visible in the visibility map.  
  
Previously, this check compared tuple xmins against a single XID chosen  
at the start of vacuum (OldestXmin). We now use GlobalVisState, which  
enables future work to set the VM during on-access pruning, since  
ordinary queries have access to GlobalVisState but not OldestXmin.  
  
This also benefits vacuum: in some cases, GlobalVisState may advance  
during a vacuum, allowing more pages to become considered all-visible.  
And, in the future, we could easily add a heuristic to update  
GlobalVisState more frequently during vacuums of large tables.  
  
OldestXmin is still used for freezing and as a backstop to ensure we  
don't freeze a dead tuple that wasn't yet prunable according to  
GlobalVisState in the rare occurrences where GlobalVisState moves  
backwards.  
  
Because comparing a transaction ID against GlobalVisState is more  
expensive than comparing against a single XID, we defer this check until  
after scanning all tuples on the page. Therefore, we perform the  
GlobalVisState check only once per page. This is safe because  
visibility_cutoff_xid records the newest live xmin on the page; if it is  
globally visible, then the entire page is all-visible.  
  
Using GlobalVisState means on-access pruning can also maintain  
visibility_cutoff_xid, which is required to set the visibility map  
on-access in the future.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/flat/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk#c755ef151507aba58471ffaca607e493  

M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/storage/ipc/procarray.c
M src/include/utils/snapmgr.h

Avoid including clog.h in proc.h

commit   : f227b7b20c36b7348867eec48d539d28cfdf831c    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 17:30:40 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 17:30:40 +0100    

Click here for diff

The number of .c files that must include access/clog.h can currently be  
counted on one's fingers and miss only one (assuming one has the usual  
number of hands).  However, due to indirect inclusion via proc.h,  
there's a lot of files that are pointlessly including it.  This is easy  
to avoid with the easy trick implemented by this commit.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/202603221856.iwlhitt6dxxx@alvherre.pgsql  

M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Fix poorly-sized buffers in astreamer compression modules.

commit   : 6e243d81c54966e640870c96d73576376ec125c6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2026 12:17:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2026 12:17:04 -0400    

Click here for diff

astreamer_gzip.c and astreamer_lz4.c left their decompression  
output buffers at StringInfo's default allocation, merely 1kB.  
This results in a lot of ping-ponging between the decompressor  
and the next astreamer filter.  This patch increases these buffer  
sizes to 256kB.  In a simple test this had a small but measurable  
effect (saving a few percent) on the overall runtime of pg_waldump  
for the gzipped-data case; I didn't bother measuring for lz4.  
  
astreamer_zstd.c used ZSTD_DStreamOutSize() to size its  
compression output buffer, but the libzstd API says you should use  
ZSTD_CStreamOutSize(); ZSTD_DStreamOutSize() is for decompression.  
The two functions seem to produce the same value (256kB) here, so  
this is just cosmetic, but nonetheless we should play by the rules.  
  
While these issues are old, they don't seem significant enough to  
warrant back-patching.  
  
Discussion: https://postgr.es/m/3424809.1774234940@sss.pgh.pa.us  

M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_zstd.c

Remove read_archive_file()'s "count" parameter.

commit   : ca1f1ade3f64f53c5319ee2c7db71a669a38cc83    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2026 12:06:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 24 Mar 2026 12:06:08 -0400    

Click here for diff

Instead, always try to fill the allocated buffer completely.  
The previous coding apparently intended (though it's undocumented)  
to read only small amounts of data until we are able to identify the  
WAL segment size and begin filtering out unwanted segments.  However  
this extra complication has no measurable value according to simple  
testing here, and it could easily be a net loss if there is a  
substantial amount of non-WAL data in the archive file before the  
first WAL file.  
  
Discussion: https://postgr.es/m/3341199.1774221191@sss.pgh.pa.us  

M src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/pg_waldump.h

Don't include storage/lock.h in so many headers

commit   : 2102ebb1953fe656a46819e11ff4204e2f918dda    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 17:11:12 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 17:11:12 +0100    

Click here for diff

Since storage/locktags.h was added by commit 322bab79744d, many headers  
can be made leaner by depending on that instead of on storage/lock.h,  
which has many other dependencies.  
  
(In fact, some of these changes were possible even before that.)  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/abvrRZo52Yx9ZzWQ@ip-10-97-1-34.eu-west-3.compute.internal  

M contrib/amcheck/verify_heapam.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/discard.c
M src/backend/commands/tablespace.c
M src/backend/optimizer/util/inherit.c
M src/backend/parser/parse_oper.c
M src/backend/replication/logical/sequencesync.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/include/access/reloptions.h
M src/include/access/twophase.h
M src/include/catalog/namespace.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/toasting.h
M src/include/commands/cluster.h
M src/include/commands/tablecmds.h
M src/include/commands/vacuum.h
M src/include/replication/worker_internal.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/predicate.h
M src/include/storage/procarray.h
M src/include/storage/sinvaladt.h
M src/include/storage/standby.h

Fix dereference in a couple of GUC check hooks

commit   : 5f2350a043db08ab0ea48d22f51acfa5d9b374d9    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 16:45:39 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Mar 2026 16:45:39 +0100    

Click here for diff

check_backtrace_functions() and check_archive_directory() were doing an  
empty-string check this way:  
    *newval[0] == '\0'  
which, because of operator precedence, is interpreted as *(newval[0])  
instead of (*newval)[0] -- but these variables are pointers to C-strings  
and we want to check the first character therein, rather than check the  
first pointer of the array, so that interpretation is wrong.  This would  
be wrong for any index element other than 0, as evidenced by every other  
dereference of the same variable in check_backtrace_functions, which use  
parentheses.  
  
Add parentheses to make the intended dereference explicit.  
  
This is just cosmetic at this stage, so no backpatch, although it's been  
"wrong" for a long time.  
  
Author: Zhang Hu <kongbaik228@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Chao Li <lic@highgo.com>  
Discussion: https://postgr.es/m/CAB5m2QssN6UO+ckr6ZCcV0A71mKUB6WdiTw1nHo43v4DTW1Dfg@mail.gmail.com  

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

test_bloomfilter: Fix error message.

commit   : c7b9f16113325eca806e81b29a10b70290cc164b    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 24 Mar 2026 09:32:15 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 24 Mar 2026 09:32:15 -0500    

Click here for diff

The error message in question uses the wrong format specifier and  
variable.  This has been wrong for a while, but since it's in a  
test module and wasn't noticed until just now, no back-patch.  
  
Oversight in commit 51bc271790.  
  
Author: Jianghua Yang <yjhjstz@gmail.com>  
Discussion: https://postgr.es/m/CAAZLFmS2OMiwe65gdm-MKgO%3DLnKatGMSK6JWxhycGN3TWrhbnw%40mail.gmail.com  

M src/test/modules/test_bloomfilter/test_bloomfilter.c

Add a test for creating an index on a whole-row expression.

commit   : 4647ee2da37c106f0b964171227df956082d39a4    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 10:06:38 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 10:06:38 -0400    

Click here for diff

Surprisingly, we have no existing test for this. Had this test  
been present before commit 570e2fcc041a55ba8991a640cc3f3f0e122feac3  
the Assert added in commit c98ad086ad9b1ca9dbb2725f246298fa8450d82f  
would have caught the bug.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com  

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

Fix accidentally casting away const

commit   : 6bc7449eac31ca573572000a10660d5995a4f96a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Mar 2026 14:28:56 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Mar 2026 14:28:56 +0100    

Click here for diff

Recently introduced in commit 4b5ba0c4ca5.  

M src/bin/pg_dump/pg_dump.c

Report detailed errors from XLogFindNextRecord() failures.

commit   : 1c162c965a113192cd5137e6de38a10fbc0a5692    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 24 Mar 2026 22:33:09 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 24 Mar 2026 22:33:09 +0900    

Click here for diff

Previously, XLogFindNextRecord() did not return detailed error information  
when it failed to find a valid WAL record. As a result, callers such as  
the WAL summarizer, pg_waldump, and pg_walinspect could only report generic  
errors (e.g., "could not find a valid record after ..."), making  
troubleshooting difficult.  
  
This commit fix the issue by extending XLogFindNextRecord() to return  
detailed error information on failure, and updating its callers to include  
those details in their error messages.  
  
For example, when pg_waldump is run on a WAL file with an invalid magic number,  
it now reports not only the generic error but also the specific cause  
(e.g., "invalid magic number").  
  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAO6_XqoxJXddcT4wkd9Xd+cD6Sz-fyspRGuV4Bq-wbXG4pVNzA@mail.gmail.com  

M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/xlogreader.c
M src/backend/postmaster/walsummarizer.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/t/001_basic.pl
M src/include/access/xlogreader.h

Bounds-check access to TupleDescAttr with an Assert.

commit   : c98ad086ad9b1ca9dbb2725f246298fa8450d82f    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 08:58:50 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 08:58:50 -0400    

Click here for diff

The second argument to TupleDescAttr should always be at least zero  
and less than natts; otherwise, we index outside of the attribute  
array. Assert that this is the case.  
  
Various violations, or possible violations, of this rule that are  
currently in the tree are actually harmless, because while  
we do call TupleDescAttr() before verifying that the argument is  
within range, we don't actually dereference it unless the argument  
was within range all along. Nonetheless, the Assert means we  
should be more careful, so tidy up accordingly.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com  

M src/backend/access/common/tupdesc.c
M src/include/access/tupdesc.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_exec.c

Make many cast functions error safe

commit   : e2f289e5b9b82acaf1523fda827e71b8fc8bd549    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Mar 2026 12:01:05 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Mar 2026 12:01:05 +0100    

Click here for diff

This adjusts many C functions underlying casts to support soft errors.  
This is in preparation for a future feature where conversion errors in  
casts can be caught.  
  
This patch covers cast functions that can be adjusted easily by  
changing ereport to ereturn or making other light changes.  The  
underlying helper functions were already changed to support soft  
errors some time ago as part of soft error support in type input  
functions.  
  
Other casts and types will require some more work and are being kept  
as separate patches.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CADkLM%3Dfv1JfY4Ufa-jcwwNbjQixNViskQ8jZu3Tz_p656i_4hQ%40mail.gmail.com  

M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/bytea.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/xml.c
M src/include/utils/xml.h

Prevent spurious "indexes on virtual generated columns are not supported".

commit   : 570e2fcc041a55ba8991a640cc3f3f0e122feac3    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 06:11:15 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 24 Mar 2026 06:11:15 -0400    

Click here for diff

Both of the checks in DefineIndex() that can produce this error  
message have a guard against negative attribute numbers, but lack a  
guard to ensure that attno is non-zero. As a result, we can index  
off the beginning of the TupleDesc and read a garbage byte for  
attgenerated. If that byte happens to be 'v', we'll incorrectly  
produce the error mentioned above.  
  
The first call site is easy to hit: any attempt to create an  
expression index does so. The second one is not currently hit in  
the regression tests, but can be hit by something like  
CREATE INDEX ON some_table ((some_function(some_table))).  
  
Found by study of a test_plan_advice failure on buildfarm member  
skink, though this issue has nothing to do with test_plan_advice  
and seems to have only been revealed by happenstance.  
  
Backpatch-through: 18  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com  

M src/backend/commands/indexcmds.c

Fix copy-paste error in test_ginpostinglist

commit   : d2a1aa77c25549bd0d285bdb29a89e29db4d30b2    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 24 Mar 2026 16:40:33 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 24 Mar 2026 16:40:33 +0700    

Click here for diff

The check for a mismatch on the second decoded item pointer  
was an exact copy of the first item pointer check, comparing  
orig_itemptrs[0] with decoded_itemptrs[0] instead of orig_itemptrs[1]  
with decoded_itemptrs[1].  The error message also reported (0, 1) as  
the expected value instead of (blk, off).  As a result, any decoding  
error in the second item pointer (where the varbyte delta encoding  
is exercised) would go undetected.  
  
This has been wrong since commit bde7493d1, so backpatch to all  
supported versions.  
  
Author: Jianghua Yang <yjhjstz@gmail.com>  
Discussion: https://postgr.es/m/CAAZLFmSOD8R7tZjRLZsmpKtJLoqjgawAaM-Pne1j8B_Q2aQK8w@mail.gmail.com  
Backpatch-through: 14  

M src/test/modules/test_ginpostinglist/test_ginpostinglist.c

Further improve commentary about ChangeVarNodesWalkExpression()

commit   : 6888658516a20a2605087f557d96f3d0d0937608    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 24 Mar 2026 09:48:07 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 24 Mar 2026 09:48:07 +0200    

Click here for diff

The updated comment explains why we use ChangeVarNodes_walker() instead of  
expression_tree_walker(), and provides a bit more detail about the differences  
in processing top-level Query and subqueries.  
  
Author: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAPpHfdvbjq342WTQ705Wmqhe8794pcp7wospz%2BWUJ2qB7vuOqA%40mail.gmail.com  
Backpatch-through: 18  

M src/backend/rewrite/rewriteManip.c

Add support for lock statistics in pgstats

commit   : 4019f725f5d43f37b23222d06d20e3da1038d373    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 15:32:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 15:32:09 +0900    

Click here for diff

This commit adds a new stats kind, called PGSTAT_KIND_LOCK, implementing  
statistics for lock tags, as reported by pg_locks.  The implementation  
is fixed-sized, as the data is caped based on the number of lock tags in  
LockTagType.  
  
The new statistics kind records the following fields, providing insight  
regarding lock behavior, while avoiding impact on performance-critical  
code paths (such as fast-path lock acquisition):  
- waits and wait_time: respectively track the number of times a lock  
required waiting and the total time spent acquiring it.  These metrics  
are only collected once a lock is successfully acquired and after  
deadlock_timeout has been exceeded.  
fastpath_exceeded: counts how often a lock could not be acquired via  
the fast path due to the max_locks_per_transaction slot limits.  
  
A new view called pg_stat_lock can be used to access this data, coupled  
with a SQL function called pg_stat_get_lock().  
  
Bump stat file format PGSTAT_FILE_FORMAT_ID.  
Bump catalog version.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aIyNxBWFCybgBZBS%40ip-10-97-1-34.eu-west-3.compute.internal  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
A src/backend/utils/activity/pgstat_lock.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/include/utils/pgstat_kind.h
A src/test/isolation/expected/lock-stats.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/lock-stats.spec
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
M src/tools/pgindent/typedefs.list

Move some code blocks in lock.c and proc.c

commit   : a90d86518243a077cdd1445ec8586ffb81dae408    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 13:34:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 13:34:54 +0900    

Click here for diff

This change will simplify an upcoming change that will introduce lock  
statistics, reducting code churn.  
  
This commit means that we begin to calculate the time it took to acquire  
a lock after the deadlock check interrupt has run should log_lock_waits  
be off, when taken in isolation.  This is not a performance-critical  
code path, and note that log_lock_waits is enabled by default since  
2aac62be8cbb.  
  
Extracted from a larger patch by the same author.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aIyNxBWFCybgBZBS@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c

Make implementation of SASLprep compliant for ASCII characters

commit   : 3d10ece612f535be15a9cb7ca31620c80db6f0e9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 08:29:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Mar 2026 08:29:23 +0900    

Click here for diff

This commit makes our implementation of SASLprep() compliant with RFC  
3454 (Stringprep) and RFC 4013 (SASLprep).  Originally, as introduced in  
60f11b87a234, the operation considered a password made of only ASCII  
characters as valid, performing an optimization for this case to skip  
the internal NFKC transformation.  
  
However, the RFCs listed above use a different definition, with the  
following characters being prohibited:  
- 0x00~0x1F (0~31), control characters.  
- 0x7F (127, DEL).  
  
In its SCRAM protocol, Postgres has the idea to apply a password as-is  
if SASLprep() is not a success, so this change is safe on  
backward-compatibility grounds:  
- A libpq client with the compliant SASLprep can connect to a server  
with a non-compliant SASLprep.  
- A libpq client with the non-compliant SASLprep can connect to a server  
with a compliant SASLprep.  
  
This commit removes the all-ASCII optimization used in pg_saslprep() and  
applies SASLprep even if a password is made only of ASCII characters,  
making the operation compatible with the RFC.  All the in-core callers  
of pg_saslprep() do that:  
- pg_be_scram_build_secret() in auth-scram.c, when generating a  
SCRAM verifier for rolpassword in the backend.  
- scram_init() in fe-auth-scram.c, when starting the SASL exchange.  
- pg_fe_scram_build_secret() in fe-auth-scram.c, when generating a SCRAM  
verifier for the frontend with libpq, to generate it for a ALTER/CREATE  
ROLE command for example.  
  
The test module test_saslprep shows the difference this change is  
leading to.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/aaEJ-El2seZHeFcG@paquier.xyz  

M src/common/saslprep.c
M src/test/modules/test_saslprep/expected/test_saslprep.out
M src/test/modules/test_saslprep/t/001_saslprep_ranges.pl

Silence compiler warning from older compilers.

commit   : 2e123e3c2bd34f2377212a4e7cfcdbf9e2d9c7ff    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 17:25:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 17:25:12 -0400    

Click here for diff

Our RHEL7-vintage buildfarm animals are complaining about  
"the comparison will always evaluate as true" for a usage of  
SOFT_ERROR_OCCURRED() on a local variable.  This is the same  
issue addressed in 7bc88c3d6 and some earlier commits, so solve  
it the same way: write "escontext.error_occurred" instead.  
  
Problem dates to recent commit a0b6ef29a, no need for back-patch.  

M src/backend/commands/tablecmds.c

Doc: minor improvements to SNI documentation.

commit   : 7c08a7e809721212b0c2b694cd19bd4379b8974f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 15:33:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 15:33:51 -0400    

Click here for diff

My attention was drawn to this new documentation by overlength-line  
complaints in the PDF docs builds: the synopsis for hostname lines was  
too wide.  I initially thought of shortening the parameter names to  
fit, but it turns out that adding <optional> markup is enough to  
persuade DocBook to break the line, and that seems more helpful  
anyway.  
  
While here, I couldn't resist some copy-editing, mostly being  
consistent about whether to use Oxford commas or not.  The biggest  
change was to re-order the entries in the hostname-values table to  
match the running text.  

M doc/src/sgml/runtime.sgml

Doc: document how EXPLAIN ANALYZE reports parallel queries.

commit   : 99d6aa64ef85a736f08b39e4e9b174c9bed035a7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 14:48:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 14:48:52 -0400    

Click here for diff

This wasn't covered anywhere before...  
  
Reported-by: Marcos Pegoraro <marcos@f10.com.br>  
Author: Maciek Sakrejda <maciek@pganalyze.com>  
Reviewed-by: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAB-JLwYCgdiB=trauAV1HN5rAWQdvDGgaaY_mqziN88pBTvqqg@mail.gmail.com  

M doc/src/sgml/perform.sgml

doc: make "datadir" argument specification more specific

commit   : 0a68fd70cb87ae08c72c3bb626d9b277dd5eb937    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 23 Mar 2026 12:13:31 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 23 Mar 2026 12:13:31 -0400    

Click here for diff

Previously these cases were listed as "directory".  
  
Author: Peter Smith  
  
Discussion: https://postgr.es/m/CAHut+PvCOQqMi0zRk3GecbYzm5xX1wQixxm9Qs3oXXr5fFCUgw@mail.gmail.com  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_checksums.sgml
M doc/src/sgml/ref/pg_createsubscriber.sgml
M doc/src/sgml/ref/pg_rewind.sgml

Improve commentary about ChangeVarNodesWalkExpression().

commit   : 360dd6f7b4c522d9a48d4621feb6da0a91bd7594    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 11:14:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Mar 2026 11:14:24 -0400    

Click here for diff

IMO the proximate cause of the bug fixed in commit 07b7a964d  
was sloppy thinking about what ChangeVarNodesWalkExpression()  
is to be used for.  Flesh out its header comment to try to  
improve that situation.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1607553.1774017006@sss.pgh.pa.us  
Backpatch-through: 18  

M src/backend/rewrite/rewriteManip.c

Fix invalid value of pg_aios.pid, function pg_get_aios()

commit   : 93b76db0ace674a29a5d2146a139d6dd87b99659    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Mar 2026 18:13:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Mar 2026 18:13:56 +0900    

Click here for diff

When the value of pg_aios.pid is found to be 0, the function had the  
idea to set "nulls" to "false" instead of "true", without setting the  
value stored in the tuplestore.  This could lead to the display of buggy  
data.  The intention of the code is clearly to display NULL when a PID  
of 0 is found, and this commit adjusts the logic to do so.  
  
Issue introduced by 60f566b4f243.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by:  Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/tencent_7D61A85D6143AD57CA8D8C00DEC541869D06@qq.com  
Backpatch-through: 18  

M src/backend/storage/aio/aio_funcs.c

ci: Run headerscheck and cpluspluscheck in parallel

commit   : 085a531983e210318d9e7d7088482cf4090b1fa6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Mar 2026 08:21:22 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Mar 2026 08:21:22 +0100    

Click here for diff

This can save several seconds of wall-clock time for that task.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/b49e74d4-3cf9-4d1c-9dce-09f75e55d026%40eisentraut.org  

M .cirrus.tasks.yml

headerscheck: Get CXXFLAGS from Makefile.global

commit   : 0f17d1dbfa6224b3ab0f4377c593b880be427f31    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Mar 2026 07:18:11 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Mar 2026 07:18:11 +0100    

Click here for diff

headerscheck in C++ mode (cpluspluscheck) previously hardcoded  
CXXFLAGS and documented that you might need to override them manually  
from the environment.  Now that we have better C++ support in the  
build system, we can just get CXXFLAGS from Makefile.global, like we  
do for other variables.  
  
Furthermore, this is necessary in some configurations to make  
cpluspluscheck work under meson, because under meson, some -I options  
end up in CXXFLAGS where under make they would be in CPPFLAGS.  
Therefore, getting the correct CXXFLAGS is required in those cases.  
  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com  

M src/tools/pginclude/README
M src/tools/pginclude/headerscheck

pg_createsubscriber: Introduce module-specific logging functions.

commit   : d6628a5ea0a56b62eb3feaa8d8210ce76e9afc2c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 23 Mar 2026 09:23:20 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 23 Mar 2026 09:23:20 +0530    

Click here for diff

Replace generic pg_log_* calls with report_createsub_log() and  
report_createsub_fatal(). This refactor provides the necessary  
infrastructure to support logging to external files via the -l option.  
  
These new functions enable the utility to route messages to both the  
terminal and a log file based on the logging configuration and verbosity  
levels provided by the user.  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Author: Gyan Sreejith <gyan.sreejith@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAEqnbaUthOQARV1dscGvB_EsqC-YfxiM6rWkVDHc+G+f4oSUHw@mail.gmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

Add missing deflateEnd() for server-side gzip base backups

commit   : ded9754804bcdee60d72cfb0e0aaeda03a2c2f44    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Mar 2026 09:04:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Mar 2026 09:04:44 +0900    

Click here for diff

The gzip basebackup sink called deflateInit2() in begin_archive() but  
never called deflateEnd(), leaking zlib's internal compression state  
(~256KB per archive) until the memory context of the base backup is  
destroyed.  
  
The code tree has already a matching deflateEnd() call for each  
deflateInit[2]() call (pgrypto, etc.), except for the file touched in  
this commit, so this brings more consistency for all the compression  
methods.  The server-side LZ4 and zstd implementations require a  
dedicated cleanup callback as they allocate their state outside the  
context of a palloc().  
  
As currently used, deflateInit2() is called once per tablespace in a  
single backup.  Memory would slightly bloat only when dealing with many  
tablespaces at once, not across multiple base backups so this is not  
worth a backpatch.  This change could matter for future uses of this  
code.  
  
zlib allows the definition of memory allocation and free callbacks in  
the z_stream object given to a deflateInit[2]().  The base backup  
backend code relies on palloc() for the allocations and deflateEnd()  
internally only cleans up memory (no fd allocation for example).  
  
Author: Jianghua Yang <yjhjstz@gmail.com>  
Discussion: https://postgr.es/m/CAAZLFmQNJ0QNArpWEOZXwv=vbumcWKEHz-b1me5gBqRqG67EwQ@mail.gmail.com  

M src/backend/backup/basebackup_gzip.c

Fix another buglet in archive_waldump.c.

commit   : 69c57466a7521ee146cfdde766713181d45a2d36    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:48:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:48:38 -0400    

Click here for diff

While re-reading 860359ea0, I noticed another problem: when  
spilling to a temp file, it did not bother to check the result  
of fclose().  This is bad since write errors (like ENOSPC)  
may not be reported until close time.  

M src/bin/pg_waldump/archive_waldump.c

Fix assorted bugs in archive_waldump.c.

commit   : 860359ea029fa208202da0424300078e5781b5b6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:24:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:24:42 -0400    

Click here for diff

1. archive_waldump.c called astreamer_finalize() nowhere.  This meant  
that any data retained in decompression buffers at the moment we  
detect archive EOF would never reach astreamer_waldump_content(),  
resulting in surprising failures if we actually need the last few  
bytes of the archive file.  
  
To fix that, make read_archive_file() do the finalize once it detects  
EOF.  Change its API to return a boolean "yes there's more data"  
rather than the entirely-misleading raw count of bytes read.  
  
2. init_archive_reader() relied on privateInfo->cur_file to track  
which WAL segment was being read, but cur_file can become NULL if a  
member trailer is processed during a read_archive_file() call.  This  
could cause unreproducible "could not find WAL in archive" failures,  
particularly with compressed archives where all the WAL data fits in  
a small number of compressed bytes.  
  
Fix by scanning the hash table after each read to find any cached  
WAL segment with sufficient data, instead of depending on cur_file.  
Also reduce the minimum data requirement from XLOG_BLCKSZ to  
sizeof(XLogLongPageHeaderData), since we only need the long page  
header to extract the segment size.  
  
We likewise need to fix init_archive_reader() to scan the whole  
hash table for irrelevant entries, since we might have already  
loaded more than one entry when the data is compressible enough.  
  
3. get_archive_wal_entry() relied on tracking cur_file to identify  
WAL hash table entries that need to be spilled to disk.  However,  
this can't work for entries that are read completely within a  
single read_archive_file call: the caller will never see cur_file  
pointing at such an entry.  Instead, scan the WAL hash table to  
find entries we should spill.  This also fixes a buglet that any  
hash table entries completely loaded during init_archive_reader  
were never considered for spilling.  
  
Also, simplify the logic tremendously by not attempting to spill  
entries that haven't been read fully.  I am not convinced that the old  
logic handled that correctly in every path, and it's really not worth  
the complication and risk of bugs to try to spill entries on the fly.  
We can just write them in a single go once they are no longer the  
cur_file.  
  
4. Fix a rather critical performance problem: the code thought that  
resetStringInfo() will reclaim storage, but it doesn't.  So by the  
end of the run we'd have consumed storage space equal to the total  
amount of WAL read, negating all the effort of the spill logic.  
  
Also document the contract that cur_file can change (or become NULL)  
during a single read_archive_file() call, since the decompression  
pipeline may produce enough output to trigger multiple astreamer  
callbacks.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/2178517.1774064942@sss.pgh.pa.us  

M src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/pg_waldump.h

Remove nonfunctional tar file trailer size check.

commit   : 5868372bbfb9ea788cd9621a6db3015ac1681cf7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:13:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:13:41 -0400    

Click here for diff

The ASTREAMER_ARCHIVE_TRAILER case in astreamer_tar_parser_content()  
intended to reject tar files whose trailer exceeded 2 blocks.  However,  
the check compared 'len' after astreamer_buffer_bytes() had already  
consumed all the data and set len to 0, so the pg_fatal() could never  
fire.  
  
Moreover, per the POSIX specification for the ustar format, the last  
physical block of a tar archive is always full-sized, and "logical  
records after the two zero logical records may contain undefined data."  
GNU tar, for example, zero-pads its output to a 10kB boundary by  
default.  So rejecting extra data after the two zero blocks would be  
wrong even if the check worked.  (But if the check had worked, it  
would have alerted us to the bug just fixed in 9aa1fcc54.)  
  
Remove the dead check and update the comment to explain why trailing  
data is expected and harmless.  
  
Per report from Tom Lane.  
  
Author: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/2178517.1774064942@sss.pgh.pa.us  

M src/fe_utils/astreamer_tar.c

Fix finalization of decompressor astreamers.

commit   : 9aa1fcc547021c341606efbc7c343ff96a8bd964    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:06:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Mar 2026 18:06:48 -0400    

Click here for diff

Send the correct amount of data to the next astreamer, not the  
whole allocated buffer size.  This bug escaped detection because  
in present uses the next astreamer is always a tar-file parser  
which is insensitive to trailing garbage.  But that may not  
be true in future uses.  
  
Author: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/2178517.1774064942@sss.pgh.pa.us  
Backpatch-through: 15  

M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_zstd.c

Add fake LSN support to hash index AM.

commit   : e5836f7b7d9a2949414ae022c74c18070202d429    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Mar 2026 17:31:43 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Mar 2026 17:31:43 -0400    

Click here for diff

Use fake LSNs in all hash AM critical sections that write a WAL record.  
This gives us a reliable way (a way that works during scans of both  
logged and unlogged relations) to detect when an index page was  
concurrently modified during the window between when the page is  
initially read (by _hash_readpage) and when the page has any known-dead  
items LP_DEAD-marked (by _hash_kill_items).  
  
Preparation for an upcoming patch that makes the hash index AM use the  
amgetbatch interface, enabling I/O prefetching during hash index scans.  
  
The amgetbatch design imposes certain rules on index AMs with respect to  
how they hold on to index page buffer pins (at least in the case of pins  
held as an interlock against unsafe concurrent TID recycling by VACUUM).  
These rules have consequences for routines that set LP_DEAD bits on  
index tuples from an amgetbatch index AM: such routines have an inherent  
need to reason about concurrent TID recycling by VACUUM, but can no  
longer rely on their amgettuple routine holding on to a buffer pin  
(during the aforementioned window) as an interlock against such  
recycling.  Instead, they have to follow a new, standardized approach.  
  
The new approach taken by amgetbatch index AMs when setting LP_DEAD bits  
is heavily based on the current nbtree dropPin design, which was added  
by commit 2ed5b87f.  It also works by checking if the page's LSN  
advanced during the window where unsafe concurrent TID recycling might  
have taken place.  
  
This commit is similar to commit 8a879119, which taught nbtree to use  
fake LSNs to improve its dropPin behavior.  However, unlike that commit,  
this is not an independently useful enhancement, since hash doesn't  
implement anything like nbtree's dropPin behavior (not yet).  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-WzkehuhxyuA8quc7rRN3EtNXpiKsjPfO8mhb+0Dr2K0Dtg@mail.gmail.com  

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

Add pruning fast path for all-visible and all-frozen pages

commit   : 01b7e4a46d0fa8478c1142f65ee441fb0c32cca1    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 22 Mar 2026 15:46:50 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 22 Mar 2026 15:46:50 -0400    

Click here for diff

Because of the SKIP_PAGES_THRESHOLD optimization or a stale prune XID,  
heap_page_prune_and_freeze() can be invoked for pages with no pruning or  
freezing work to do. To avoid this, if a page is already all-frozen or  
it is all-visible and no freezing will be attempted, exit early. We  
can't exit early if vacuum passed DISABLE_PAGE_SKIPPING, though.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Make IndexScanInstrumentation a pointer in executor scan nodes.

commit   : f026fbf059f2d9d7c8f1f52e9210018d38d795d8    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Mar 2026 13:20:29 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 22 Mar 2026 13:20:29 -0400    

Click here for diff

Change the IndexScanInstrumentation fields in IndexScanState,  
IndexOnlyScanState, and BitmapIndexScanState from inline structs to  
pointers.  This avoids additional space overhead whenever new fields are  
added to IndexScanInstrumentation in the future, at least in the common  
case where the instrumentation isn't used (i.e. when the executor node  
isn't being run through an EXPLAIN ANALYZE).  
  
Preparation for an upcoming patch series that will add index  
prefetching.  The new slot-based interface that will enable index  
prefetching necessitates that we add at least one more field to  
IndexScanInstrumentation (to count heap fetches during index-only  
scans).  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/include/nodes/execnodes.h

Detect and fix visibility map corruption in more cases

commit   : 4f7ecca84ddacbce27bdff3b78981a2bd9c9b242    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 22 Mar 2026 11:52:40 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 22 Mar 2026 11:52:40 -0400    

Click here for diff

Move VM corruption detection and repair into heap page pruning. This  
allows VM repair during on-access pruning, not only during vacuum.  
  
Also, expand corruption detection to cover pages marked all-visible that  
contain dead tuples and tuples inserted or deleted by in-progress  
transactions, rather than only all-visible pages with LP_DEAD items.  
  
Pinning the correct VM page before on-access pruning is cheap when  
compared to the cost of actually pruning. The vmbuffer is saved in the  
scan descriptor, so a query should only need to pin each VM page once,  
and a single VM page covers a large number of heap pages.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list

Don't reset 'latest_page_number' when replaying multixid truncation

commit   : 516310ed4dba89bd300242df0d56b4782f33ed4d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Mar 2026 14:23:54 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Mar 2026 14:23:54 +0200    

Click here for diff

'latest_page_number' is set to the correct value, according to  
nextOffset, early at system startup. Contrary to the comment, it hence  
should be set up correctly by the time we get to WAL replay.  
  
This was committed to back-branches earlier already (commit  
817f74600d), to fix a bug in a backwards-compatibility codepath. We  
don't have that bug on 'master', but the change nevertheless makes  
sense on 'master' too.  
  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/20260214090150.GC2297@p46.dedyn.io;lightning.p46.dedyn.io  
Discussion: https://www.postgresql.org/message-id/e1787b17-dc93-4621-a5a1-c713d1ac6a1b@iki.fi  

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

Add test for single-page VACUUM of hash index on INSERT

commit   : 1f7947a48d0c4b802f986ac32dc0e95b6f7f8f8f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 22 Mar 2026 15:24:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 22 Mar 2026 15:24:33 +0900    

Click here for diff

_hash_vacuum_one_page() in hashinsert.c is a routine related to hash  
indexes that can perform a single-page VACUUM when dead tuples are  
detected during index insertion.  This routine previously had no test  
coverage, and this commit adds a test case for that purpose.  
  
To safely create dead tuples in a way that works with parallel tests,  
this uses a technique based on a rollbacked INSERT, following a  
suggestion by Heikki Linnakangas.  
  
Author: Alexander Kuzmenkov <akuzmenkov@tigerdata.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CALzhyqxrc1ZHYmf5V8NE+yMboqVg7xZrQM7K2c7VS0p1v8z42w@mail.gmail.com  

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

commit   : 322bab79744dfb8f7ddb5191b3102cf7986d14a0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 21 Mar 2026 14:34:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 21 Mar 2026 14:34:47 +0900    

Click here for diff

This commit moves all the declarations related to locktags from lock.h  
to a new header called locktag.h.  This header is useful so as code  
paths that care about locktags but not the lock hashtable can know about  
these without having to include lock.h and all its set of dependencies.  
  
This move includes the basic locktag structures and the set of macros to  
fill in the locktag fields before attempting to acquire a lock.  
  
Based on a suggestion from me, suggestion done while discussing a  
different feature.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/abufUya2oK-_PJ3E@paquier.xyz  

M src/include/storage/lock.h
A src/include/storage/locktag.h

plpgsql: optimize "SELECT simple-expression INTO var".

commit   : ce8d5fe0e2802158b65699aeae1551d489948167    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Mar 2026 18:23:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Mar 2026 18:23:45 -0400    

Click here for diff

Previously, we always fed SELECT ... INTO to the SPI machinery.  
While that works for all cases, it's a great deal slower than  
the otherwise-equivalent "var := expression" if the expression  
is "simple" and the INTO target is a single variable.  Users  
coming from MSSQL or T_SQL are likely to be surprised by this;  
they are used to writing SELECT ... INTO since there is no  
"var := expression" syntax in those dialects.  Hence, check for  
a simple expression and use the faster code path if possible.  
  
(Here, "simple" means whatever exec_is_simple_query accepts,  
which basically means "SELECT scalar-expression" without any  
input tables, aggregates, qual clauses, etc.)  
  
This optimization is not entirely transparent.  Notably, one of  
the reasons it's faster is that the hooks that pg_stat_statements  
uses aren't called in this path, so that the evaluated expression  
no longer appears in pg_stat_statements output as it did before.  
There may be some other minor behavioral changes too, although  
I tried hard to make error reporting look the same.  Hopefully,  
none of them are significant enough to not be acceptable as  
routine changes in a PG major version.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>  
Discussion: https://postgr.es/m/CAFj8pRDieSQOPDHD_svvR75875uRejS9cN87FoAC3iXMXS1saQ@mail.gmail.com  

M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/expected/plancache.out
M src/pl/plpgsql/src/expected/plpgsql_simple.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_simple.sql

Fix dependency on FDW's connection function.

commit   : 4a0b46b6e1e4988a317c8ec9a8917e3f6831e427    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 20 Mar 2026 12:42:59 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 20 Mar 2026 12:42:59 -0700    

Click here for diff

Missed in commit 8185bb5347.  
  
Catalog version bump.  
  
Discussion: https://postgr.es/m/fd49b44dc65da8e71ab20c1cf1ec7e65921c20f5.camel@j-davis.com  

M src/backend/commands/foreigncmds.c
M src/include/catalog/catversion.h
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/subscription.out
M src/test/regress/sql/foreign_data.sql
M src/test/regress/sql/subscription.sql

pg_verifybackup: Enable WAL parsing for tar-format backups

commit   : b3cf461b3cf91c586ab94b4dddd6dcd8ff8fec47    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    

Click here for diff

Now that pg_waldump supports reading WAL from tar archives, remove the  
restriction that forced --no-parse-wal for tar-format backups.  
  
pg_verifybackup now automatically locates the WAL archive: it looks for  
a separate pg_wal.tar first, then falls back to the main base.tar.  A  
new --wal-path option (replacing the old --wal-directory, which is kept  
as a silent alias) accepts either a directory or a tar archive path.  
  
The default WAL directory preparation is deferred until the backup  
format is known, since tar-format backups resolve the WAL path  
differently from plain-format ones.  
  
Author: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com  

M doc/src/sgml/ref/pg_verifybackup.sgml
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl

pg_waldump: Add support for reading WAL from tar archives

commit   : b15c1513984e6eafd264bf6e84a08549905621f1    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    

Click here for diff

pg_waldump can now accept the path to a tar archive (optionally  
compressed with gzip, lz4, or zstd) containing WAL files and decode  
them.  This was added primarily for pg_verifybackup, which previously  
had to skip WAL parsing for tar-format backups.  
  
The implementation uses the existing archive streamer infrastructure  
with a hash table to track WAL segments read from the archive.  If WAL  
files within the archive are not in sequential order, out-of-order  
segments are written to a temporary directory (created via mkdtemp under  
$TMPDIR or the archive's directory) and read back when needed.  An  
atexit callback ensures the temporary directory is cleaned up.  
  
The --follow option is not supported when reading from a tar archive.  
  
Author: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com  

M doc/src/sgml/ref/pg_waldump.sgml
M src/bin/pg_waldump/Makefile
A src/bin/pg_waldump/archive_waldump.c
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/pg_waldump.h
M src/bin/pg_waldump/t/001_basic.pl
M src/tools/pgindent/typedefs.list

pg_waldump: Preparatory refactoring for tar archive WAL decoding.

commit   : f8a0cd26717063b99d846b693b416187ab56d67b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    

Click here for diff

Several refactoring steps in preparation for adding tar archive WAL  
decoding support to pg_waldump:  
  
- Move XLogDumpPrivate and related declarations into a new pg_waldump.h  
  header, allowing a second source file to share them.  
  
- Factor out required_read_len() so the read-size calculation can be  
  reused for both regular WAL files and tar-archived WAL.  
  
- Move the WAL segment size variable into XLogDumpPrivate and rename it  
  to segsize, making it accessible to the archive streamer code.  
  
Author: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com  

M src/bin/pg_waldump/pg_waldump.c
A src/bin/pg_waldump/pg_waldump.h

Move tar detection and compression logic to common.

commit   : c8a350a439826267186c187dbfbf1f839f7521aa    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 20 Mar 2026 15:31:35 -0400    

Click here for diff

Consolidate tar archive identification and compression-type detection  
logic into a shared location. Currently used by pg_basebackup and  
pg_verifybackup, this functionality is also required for upcoming  
pg_waldump enhancements.  
  
This change promotes code reuse and simplifies maintenance across  
frontend tools.  
  
Author: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/common/compression.c
M src/include/common/compression.h

Bump transaction/multixact ID warning limits to 100M.

commit   : 48f11bfa06c6bc15369a2a0c89f7594392e02e2d    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Mar 2026 14:15:33 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Mar 2026 14:15:33 -0500    

Click here for diff

These warning limits were last changed to 40M by commit cd5e82256d.  
For the benefit of workloads that rapidly consume transactions or  
multixacts, this commit bumps the limits to 100M.  This will  
hopefully give users enough time to react.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://postgr.es/m/aRdhSSFb9zZH_0zc%40nathan  

M doc/src/sgml/maintenance.sgml
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c

Add percentage of available IDs to wraparound warnings.

commit   : e646450e609d690ced30d9e8e3fdc27ee6c3ff4c    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Mar 2026 14:15:33 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Mar 2026 14:15:33 -0500    

Click here for diff

This commit adds DETAIL messages to the existing wraparound  
WARNINGs that include the percentage of transaction/multixact IDs  
that remain available for use.  The hope is that this more clearly  
expresses the urgency of the situation.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://postgr.es/m/aRdhSSFb9zZH_0zc%40nathan  

M doc/src/sgml/maintenance.sgml
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c

Discount the metapage when estimating number of index pages visited.

commit   : 733f20df53721b5be0481afe9f26b9c2a4d51712    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Mar 2026 14:50:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 20 Mar 2026 14:50:53 -0400    

Click here for diff

genericcostestimate() estimates the number of index leaf pages to  
be visited as a pro-rata fraction of the total number of leaf pages.  
Or at least that was the intention.  What it actually used in the  
calculation was the total number of index pages, so that non-leaf  
pages were also counted.  In a decent-sized index the error is  
probably small, since we expect upper page fanout to be high.  
But in a small index that's not true; in the worst case with one  
data-bearing page plus a metapage, we had 100% relative error.  
This led to surprising planning choices such as not using a small  
partial index.  
  
To fix, ask genericcostestimate's caller to supply an estimate of  
the number of non-leaf pages, and subtract that.  For the built-in  
index AMs, it seems sufficient to count the index metapage (if the  
AM uses one) as non-leaf.  Per the above argument, counting upper  
index pages shouldn't change the estimate much, and in most cases  
we don't have any easy way of estimating the number of upper pages.  
This might be an area for further research in future.  
  
Any external genericcostestimate callers that do not set the new field  
GenericCosts.numNonLeafPages will see the same behavior as before,  
assuming they followed the advice to zero out that whole struct.  
  
Unsurprisingly, this change affects a number of plans seen in the  
core regression tests.  I hacked up the existing tests to keep the  
tests' plans the same, since in each case it appeared that the  
test's intent was to test exactly that plan.  Also add one new  
test case demonstrating that a better index choice is now made.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Discussion: https://postgr.es/m/870521.1745860752@sss.pgh.pa.us  

M contrib/bloom/blcost.c
M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h
M src/test/regress/expected/join.out
M src/test/regress/expected/memoize.out
M src/test/regress/expected/select.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/memoize.sql
M src/test/regress/sql/select.sql

Fix self-join removal to update bare Var references in join clauses

commit   : 07b7a964d368e0618e1e1c788f3b998b4e571427    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 20 Mar 2026 15:32:52 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Fri, 20 Mar 2026 15:32:52 +0200    

Click here for diff

Self-join removal failed to update Var nodes when the join clause was a  
bare Var (e.g., ON t1.bool_col) rather than an expression containing  
Vars.  ChangeVarNodesWalkExpression() used expression_tree_walker(),  
which descends into child nodes but does not process the top-level node  
itself.  When a bare Var referencing the removed relation appeared as  
the clause, its varno was left unchanged, leading to "no relation entry  
for relid N" errors.  
  
Fix by calling ChangeVarNodes_walker() directly instead of  
expression_tree_walker(), so the top-level node is also processed.  
  
Bug: #19435  
Reported-by: Hang Ammmkilo <ammmkilo@163.com>  
Author: Andrei Lepikhov <lepihov@gmail.com>  
Co-authored-by: Tender Wang <tndrwang@gmail.com>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/19435-3cc1a87f291129f1%40postgresql.org  
Backpatch-through: 18  

M src/backend/rewrite/rewriteManip.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

SET NOT NULL: Call object-alter hook only after the catalog change

commit   : e7975f1c06b585dcda645c6047e6f37cdfacce84    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 20 Mar 2026 14:38:50 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 20 Mar 2026 14:38:50 +0100    

Click here for diff

... otherwise, the function invoked by the hook might consult the  
catalog and not see that the new constraint exists.  
  
This relies on set_attnotnull doing CommandCounterIncrement()  
after successfully modifying the catalog.  
  
Oversight in commit 14e87ffa5c54.  
  
Author: Artur Zakirov <zaartur@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/CAKNkYnxUPCJk-3Xe0A3rmCC8B8V8kqVJbYMVN6ySGpjs_qd7dQ@mail.gmail.com  

M src/backend/commands/tablecmds.c

test_plan_advice: Set TAP test priority 50 in meson.build.

commit   : 12444183e40187a9fb6002a3912053f302725f0a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 20 Mar 2026 08:39:55 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 20 Mar 2026 08:39:55 -0400    

Click here for diff

Since this runs the main regression tests, it can take some time to  
complete. Therefore, it's better to start it earlier, as we also do  
for the main regression test suite.  
  
Author: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: http://postgr.es/m/1095d3fe-a6eb-4d83-866e-649d6f369908@gmail.com  

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

Add option force_array for COPY JSON FORMAT

commit   : 4c0390ac53b745c2800f6aa3d9ee2515d6ab499b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:51:12 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:51:12 -0400    

Click here for diff

This adds the force_array option, which is available exclusively  
when using COPY TO with the JSON format.  
  
When enabled, this option wraps the output in a top-level JSON array  
(enclosed in square brackets with comma-separated elements), making the  
entire result a valid single JSON value.  Without this option, the  
default behavior is to output a stream of independent JSON objects.  
  
Attempting to use this option with COPY FROM or with formats other than  
JSON will raise an error.  
  
Author: Joe Conway <mail@joeconway.com>  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Florents Tselai <florents.tselai@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com  
Discussion: https://postgr.es/m/6a04628d-0d53-41d9-9e35-5a8dc302c34c@joeconway.com  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/bin/psql/tab-complete.in.c
M src/include/commands/copy.h
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

json format for COPY TO

commit   : 7dadd38cda95bf5bc0c4715d9ab71766d1693379    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:50:24 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:50:24 -0400    

Click here for diff

This introduces the JSON format option for the COPY TO command, allowing  
users to export query results or table data directly as a stream of JSON  
objects (one per line, NDJSON style).  
  
The JSON format is currently supported only for COPY TO operations; it  
is not available for COPY FROM.  
  
JSON format is incompatible with some standard text/CSV formatting  
options, including HEADER, DEFAULT, NULL, DELIMITER, FORCE QUOTE,  
FORCE NOT NULL, and FORCE NULL.  
  
Column list support is included: when a column list is specified, only  
the named columns are emitted in each JSON object.  
  
Regression tests covering valid JSON exports and error handling for  
incompatible options have been added to src/test/regress/sql/copy.sql.  
  
Author: Joe Conway <mail@joeconway.com>  
Author: jian he <jian.universality@gmail.com>  
Co-Authored-By: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Andrey M. Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Daniel Verite <daniel@manitou-mail.org>  
Reviewed-by: Davin Shearer <davin@apache.org>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com  
Discussion: https://postgr.es/m/6a04628d-0d53-41d9-9e35-5a8dc302c34c@joeconway.com  

M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/backend/parser/gram.y
M src/backend/utils/adt/json.c
M src/bin/psql/tab-complete.in.c
M src/include/commands/copy.h
M src/include/utils/json.h
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

introduce CopyFormat, refactor CopyFormatOptions

commit   : a2145605ee3d92faccd769010059b110c44104ff    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:49:01 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 16 Mar 2026 16:49:01 -0400    

Click here for diff

Currently, the COPY command format is determined by two boolean fields  
(binary, csv_mode) in CopyFormatOptions.  This approach, while  
functional, isn't ideal for implementing other formats in the future.  
  
To simplify adding new formats, introduce a CopyFormat enum.  This makes  
the code cleaner and more maintainable, allowing for easier integration  
of additional formats down the line.  
  
Author: Joel Jacobson <joel@compiler.org>  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com  
Discussion: https://postgr.es/m/6a04628d-0d53-41d9-9e35-5a8dc302c34c@joeconway.com  

M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/include/commands/copy.h
M src/tools/pgindent/typedefs.list

Cleanup users and roles in graph_table_rls test

commit   : 040a56be4bcc88cad98f092970a8c6521263bba1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Mar 2026 10:54:35 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Mar 2026 10:54:35 +0100    

Click here for diff

This test leaves behind the roles and users it creates.  
002_pg_upgrade test dumps and restore the regression when  
PG_TEST_EXTRA contains regress_dump_restore.  The global objects such  
as users and roles are not dumped by pg_dump.  But it still dumps the  
policies associated with users, and commands to set the ownership.  
Restoring these policies and the ownerships fails since the users and  
roles do not exist.  To fix this failure we could use --no-owner, but  
it does not exclude the policy objects associated with users.  Hence  
drop the users, roles and policies that depend upon them at the end of  
the test.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

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

Update Unicode data to Unicode 17.0.0

commit   : 57ee397953985feb95cffa65a06fcaf6a2cd5367    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Mar 2026 08:42:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 20 Mar 2026 08:42:50 +0100    

Click here for diff

Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alexander Borisov <lex.borisov@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M contrib/unaccent/unaccent.rules
M src/Makefile.global.in
M src/common/unicode/meson.build
M src/include/common/unicode_case_table.h
M src/include/common/unicode_category_table.h
M src/include/common/unicode_east_asian_fw_table.h
M src/include/common/unicode_nonspacing_table.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_normprops_table.h
M src/include/common/unicode_version.h

Add support for EXCEPT TABLE in ALTER PUBLICATION.

commit   : 493f8c6439cf64d75883c650b5dd573d8fe0664b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 20 Mar 2026 11:36:09 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 20 Mar 2026 11:36:09 +0530    

Click here for diff

Following commit fd366065e0, which added EXCEPT TABLE support to  
CREATE PUBLICATION, this commit extends ALTER PUBLICATION to allow  
modifying the exclusion list.  
  
New Syntax:  
ALTER PUBLICATION name SET  publication_all_object [, ... ]  
  
where publication_all_object is one of:  
ALL TABLES [ EXCEPT TABLE ( except_table_object [, ... ] ) ]  
ALL SEQUENCES  
  
If the EXCEPT clause is provided, the existing exclusion list in  
pg_publication_rel is replaced with the specified relations. If the  
EXCEPT clause is omitted, any existing exclusions for the publication  
are cleared. Similarly, SET ALL SEQUENCES updates  
  
Note that because this is a SET command, specifying only one object  
type (e.g., SET ALL SEQUENCES) will reset the other unspecified flags  
(e.g., setting puballtables to false).  
  
Consistent with CREATE PUBLICATION, only root partitioned tables or  
standard tables can be specified in the EXCEPT list. Specifying a  
partition child will result in an error.  
  
Author: vignesh C <vignesh21@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com  

M doc/src/sgml/ref/alter_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/bin/psql/tab-complete.in.c
M src/include/catalog/pg_publication.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
M src/test/subscription/t/037_except.pl

Fix new tuple deforming code so it can support cstrings again

commit   : 07d5bffe75d05b9c84803ea1ffaf5ce729f0e717    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 20 Mar 2026 14:16:06 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 20 Mar 2026 14:16:06 +1300    

Click here for diff

In c456e3911, I mistakenly thought that the deformer code would never  
see cstrings and that I could use pg_assume() to have the compiler omit  
producing code for attlen == -2 attributes.  That saves bloating the  
deforming code a bit with the extra check and strlen() call.  While this  
is ok to do for tuples from the heap, it's not ok to do for  
MinimalTuples as those *can* contain cstrings and  
tts_minimal_getsomeattrs() implements deforming by inlining the  
(slightly misleadingly named) slot_deform_heap_tuple() code.  
  
To fix, add a new parameter to the slot_deform_heap_tuple() and have the  
callers define which code to inline.  Because this new parameter is  
passed as a const, the compiler can choose to emit or not emit the  
cstring-related code based on the parameter's value.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAHewXNmSK+gKziAt_WvQoMVWt3_LRVMmRYY9dAbMPMcpPV0QmA@mail.gmail.com  

M src/backend/executor/execTuples.c

Fix dependency on FDW handler.

commit   : 703fee3b25c45b3b336b95f91a6a89ade85815f4    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 19 Mar 2026 14:59:07 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 19 Mar 2026 14:59:07 -0700    

Click here for diff

ALTER FOREIGN DATA WRAPPER could drop the dependency on the handler  
function if it wasn't explicitly specified.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/35c44a4b7fb76d35418c4d66b775a88f4ce60c86.camel@j-davis.com  
Backpatch-through: 14  

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

Add parallel vacuum worker usage to VACUUM (VERBOSE) and autovacuum logs.

commit   : adcdbe93860b16a069c6834062e56e731c54a1a1    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 19 Mar 2026 15:01:47 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 19 Mar 2026 15:01:47 -0700    

Click here for diff

This commit adds both the number of parallel workers planned and the  
number of parallel workers actually launched to the output of  
VACUUM (VERBOSE) and autovacuum logs.  
  
Previously, this information was only reported as an INFO message  
during VACUUM (VERBOSE), which meant it was not included in autovacuum  
logs in practice. Although autovacuum does not yet support parallel  
vacuum, a subsequent patch will enable it and utilize these logs in  
its regression tests. This change also improves observability by  
making it easier to verify if parallel vacuum is utilizing the  
expected number of workers.  
  
Author: Daniil Davydov <3danissimo@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CACG=ezZOrNsuLoETLD1gAswZMuH2nGGq7Ogcc0QOE5hhWaw=cw@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuumparallel.c
M src/include/commands/vacuum.h
M src/tools/pgindent/typedefs.list

Allow explicit casting between bytea and uuid.

commit   : ba21f5bf8aff277aa1659a51d26109e0914df182    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 19 Mar 2026 13:51:50 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Thu, 19 Mar 2026 13:51:50 -0700    

Click here for diff

This enables the use of functions such as encode() and decode() with  
UUID values, allowing them to be converted to and from alternative  
formats like base64 or hex.  
  
The cast maps the 16-byte internal representation of a UUID directly  
to a bytea datum. This is more efficient than going through a text  
forepresentation.  
  
Bump catalog version.  
  
Author:	Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Co-authored-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://postgr.es/m/CAJ7c6TOramr1UTLcyB128LWMqita1Y7%3Darq3KHaU%3Dqikf5yKOQ%40mail.gmail.com  

M doc/src/sgml/datatype.sgml
M src/backend/utils/adt/bytea.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/uuid.out
M src/test/regress/sql/uuid.sql

Improve hash join's handling of tuples with null join keys.

commit   : 1811f1af98fb237fdd5adb588cd4b57c433b75f8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 15:21:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 15:21:36 -0400    

Click here for diff

In a plain join, we can just summarily discard an input tuple  
with null join key(s), since it cannot match anything from  
the other side of the join (assuming a strict join operator).  
However, if the tuple comes from the outer side of an outer join  
then we have to emit it with null-extension of the other side.  
  
Up to now, hash joins did that by inserting the tuple into the hash  
table as though it were a normal tuple.  This is unnecessarily  
inefficient though, since the required processing is far simpler than  
for a potentially-matchable tuple.  Worse, if there are a lot of such  
tuples they will bloat the hash bucket they go into, possibly causing  
useless repeated attempts to split that bucket or increase the number  
of batches.  We have a report of a large join vainly creating many  
thousands of batches when faced with such input.  
  
This patch improves the situation by keeping such tuples out of the  
hash table altogether, instead pushing them into a separate tuplestore  
from which we return them later.  (One might consider trying to return  
them immediately; but that would require substantial refactoring, and  
it doesn't work anyway for cases where we rescan an unmodified hash  
table.)  This works even in parallel hash joins, because whichever  
worker reads a null-keyed tuple can just return it; there's no need  
for consultation with other workers.  Thus the tuplestores are local  
storage even in a parallel join.  
  
A pre-existing buglet that I noticed while analyzing the code's  
behavior is that ExecHashRemoveNextSkewBucket fails to decrement  
hashtable->skewTuples for tuples moved into the main hash table  
from the skew hash table.  This invalidates ExecHashTableInsert's  
calculation of the number of main-hash-table tuples, though probably  
not by a lot since we expect the skew table to be small relative  
to the main one.  Nonetheless, let's fix that too while we're here.  
  
Bug: #18909  
Reported-by: Sergey Koposov <Sergey.Koposov@ed.ac.uk>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/3061845.1746486714@sss.pgh.pa.us  

M src/backend/executor/execExpr.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/utils/sort/tuplestore.c
M src/include/executor/executor.h
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplestore.h
M src/test/regress/expected/join.out
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/join_hash.sql

Avoid leaking duplicated file descriptors in corner cases.

commit   : 8b02c22bb43cb480f437704dc547ea77196b7e93    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 14:25:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 14:25:26 -0400    

Click here for diff

pg_dump's compression modules had variations on the theme of  
  
	fp = fdopen(dup(fd), mode);  
	if (fp == NULL)  
	    // fail, reporting errno  
  
which is problematic for two reasons.  First, if dup() succeeds but  
fdopen() fails, we'd leak the duplicated FD.  That's not important  
at present since the program will just exit immediately after failure  
anyway; but perhaps someday we'll try to continue, making the resource  
leak potentially significant.  Second, if dup() fails then fdopen()  
will overwrite the useful errno (perhaps EMFILE) with a misleading  
value EBADF, making it difficult to understand what went wrong.  
Fix both issues by testing for dup() failure before proceeding to  
the next call.  
  
These failures are sufficiently unlikely, and the consequences minor  
enough, that this doesn't seem worth the effort to back-patch.  
But let's fix it in HEAD.  
  
Author: Jianghua Yang <yjhjstz@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/62bbe34d-2315-4b42-b768-56d901aa83e1@gmail.com  

M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_zstd.c

Allow choosing specific grantors via GRANT/REVOKE ... GRANTED BY.

commit   : dd1398f1378799acc60c3ed85d82439b2ff69141    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Mar 2026 11:41:39 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Mar 2026 11:41:39 -0500    

Click here for diff

Except for GRANT and REVOKE on roles, the GRANTED BY clause  
currently only accepts the current role to match the SQL standard.  
And even if an acceptable grantor (i.e., the current role) is  
specified, Postgres ignores it and chooses the "best" grantor for  
the command.  Allowing the user to select a specific grantor would  
allow better control over the precise behavior of GRANT/REVOKE  
statements.  This commit adds that ability.  For consistency with  
select_best_grantor(), we only permit choosing grantor roles for  
which the current role inherits privileges.  
  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/aRYLkTpazxKhnS_w%40nathan  

M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M src/backend/catalog/aclchk.c
M src/backend/utils/adt/acl.c
M src/include/nodes/parsenodes.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

dshash: Make it possible to suppress out of memory errors

commit   : 6f0738ddec85b416e7186e3099be70a3420bf3ea    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Mar 2026 11:51:17 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Mar 2026 11:51:17 -0400    

Click here for diff

Introduce dshash_find_or_insert_extended, which is just like  
dshash_find_or_insert except that it takes a flags argument.  
Currently, the only supported flag is DSHASH_INSERT_NO_OOM, but  
I have chosen to use an integer rather than a boolean in case we  
end up with more flags in the future.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoaJwUukUZGu7_yL74oMTQQz2=zqucMhF9+9xBmSC5us1w@mail.gmail.com  

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

Fix transient memory leakage in jsonpath evaluation.

commit   : 5a2043bf713113b0f6e9dbf2046499a5ca67883c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 11:37:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Mar 2026 11:37:14 -0400    

Click here for diff

This patch reimplements JsonValueList to be more space-efficient  
and arranges for temporary JsonValueLists created during jsonpath  
evaluation to be freed when no longer needed, rather than being  
leaked till the end of the function evaluation cycle as before.  
  
The motivation is to prevent indefinite memory bloat while  
evaluating jsonpath expressions that traverse a lot of data.  
As an example, this query  
  SELECT  
    jsonb_path_query((SELECT jsonb_agg(i) FROM generate_series(1,10000) i),  
                     '$[*] ? (@ < $)');  
formerly required about 6GB to execute, with the space required  
growing quadratically with the length of the input array.  
With this patch the memory consumption stays static.  (The time  
required is still quadratic, but we can't do much about that: this  
path expression asks to compare each array element to each other one.)  
  
The bloat happens because we construct a JsonValueList containing all  
the array elements to represent the second occurrence of "$", and then  
just leak it after evaluating the filter expression for any one value  
generated from "$[*]".  If I were implementing this functionality from  
scratch I'd probably try to avoid materializing that representation at  
all, but changing that now looks like more trouble than it's worth.  
This patch takes the more conservative approach of just making sure  
we free the list after we're done with it.  
  
The existing representation of JsonValueList is neither especially  
compact nor especially easy to free: it's a List containing pointers  
to separately-palloc'd JsonbValue structs.  We could theoretically  
use list_free_deep, but it's not 100% clear that all the JsonbValues  
are always safe for us to free.  In any case we are talking about a  
lot of palloc/pfree traffic if we keep it like this.  This patch  
replaces that with what's essentially an expansible array of  
JsonbValues, so that even a long list requires relatively few  
palloc requests.  Also, for the very common case that only one or  
two elements appear in the list, this representation uses *zero*  
pallocs: the elements can be kept in the on-the-stack base struct.  
  
Note that we are only interested in freeing the JsonbValue structs  
themselves.  While many types of JsonbValue include pointers to  
external data such as strings or numerics, we expect that that data  
is part of the original jsonb input Datum(s) and need not (indeed  
cannot) be freed here.  
  
In this reimplementation, JsonValueListAppend() always copies the  
supplied JsonbValue struct into the JsonValueList data.  This allows  
simplifying and regularizing many call sites that sometimes palloc'd  
JsonbValues and sometimes passed a local-variable JsonbValue.  Always  
doing the latter is simpler, faster, and less bug-prone.  
  
I also removed JsonValueListLength() in favor of constant-time tests  
for whether the list has zero, one, or more than one member, which is  
what the callers really need to know.  JsonValueListLength() was not  
a hot code path, so this aspect of the patch won't move the needle in  
the least performance-wise.  But it seems neater.  
  
I've not done any wide-ranging performance testing, but this should  
be faster than the old code thanks to reduction of palloc overhead.  
On the specific example shown above, it's about twice as fast as  
before on not-very-large inputs; and of course it wins big if you  
consider an input large enough to drive the old code into swapping.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/569394.1773783211@sss.pgh.pa.us  

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

Add some const qualifiers enabled by typeof_unqual change on copyObject

commit   : 7724cb9935a96eabba80f5e62ee4b32068967dd2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Mar 2026 06:34:27 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Mar 2026 06:34:27 +0100    

Click here for diff

The recent commit to change copyObject() to use typeof_unqual allows  
cleaning up some APIs to take advantage of this improved qualifier  
handling.  EventTriggerCollectSimpleCommand() is a good example: It  
takes a node tree and makes a copy that it keeps around for its  
internal purposes, but it can't communicate via its function signature  
that it promises not scribble on the passed node tree.  That is now  
fixed.  
  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M src/backend/catalog/index.c
M src/backend/commands/event_trigger.c
M src/backend/commands/indexcmds.c
M src/backend/commands/trigger.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/partitioning/partprune.c
M src/backend/rewrite/rewriteManip.c
M src/backend/utils/cache/plancache.c
M src/include/commands/defrem.h
M src/include/commands/event_trigger.h
M src/include/commands/trigger.h
M src/include/rewrite/rewriteManip.h
M src/include/utils/plancache.h

Add commit 015d32016d84 to .git-blame-ignore-revs.

commit   : 46fb08aff69fd293961ac57e9339aef855555692    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:45:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:45:07 +0900    

Click here for diff

M .git-blame-ignore-revs

test_saslprep: Apply proper indentation

commit   : 015d32016d845f8a29b3ec3ab7fa98a69cea1a0f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:42:24 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:42:24 +0900    

Click here for diff

Noticed before koel has the idea to complain.  Rebase thinko from commit  
aa73838a5c94.  

M src/test/modules/test_saslprep/t/001_saslprep_ranges.pl
M src/test/modules/test_saslprep/test_saslprep.c
M src/tools/pgindent/typedefs.list

Short-circuit row estimation in NOT IN containing NULL consts

commit   : c95cd2991f1e3ece689adfe662082f200126d255    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 19 Mar 2026 17:16:36 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 19 Mar 2026 17:16:36 +1300    

Click here for diff

ScalarArrayOpExpr used for either NOT IN or <>/= ALL, when the array  
contains a NULL constant, will never evaluate to true.  Here we add an  
explicit short-circuit in scalararraysel() to account for this and return  
0.0 rows when we see that a NULL exists.  When the array is a constant,  
we can very quickly see if there are any NULL values and return early  
before going to much effort in scalararraysel().  For non-const arrays,  
we short-circuit after finding the first NULL and forego selectivity  
estimations of any remaining elements.  
  
In the future, it might be better to do something for this case in  
constant folding.  We would need to be careful to only do this for  
strict operators on expressions located in places that don't care about  
distinguishing false from NULL returns. i.e. EXPRKIND_QUAL expressions.  
Doing that requires a bit more thought and effort, so here we just fix  
some needlessly slow selectivity estimations for ScalarArrayOpExpr  
containing many array elements and at least one NULL.  
  
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/eaa2598c-5356-4e1e-9ec3-5fd6eb1cd704@tantorlabs.com  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/planner_est.out
M src/test/regress/sql/planner_est.sql

test_saslprep: Test module for SASLprep()

commit   : aa73838a5c94457552d261968f63ee6ea6e366f5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:03:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 13:03:30 +0900    

Click here for diff

This module includes two functions:  
- test_saslprep(), that performs pg_saslprep on a bytea.  
- test_saslprep_ranges(), able to check for all valid ranges of UTF-8  
codepoints pg_saslprep() handles each one of them.  
  
This provides a detailed coverage of our implementation of SASLprep()  
used for SCRAM, with:  
- ASCII characters.  
- Incomplete UTF-8 sequences, for 390b3cbbb2af (later backpatched).  
- A more advanced check for all the valid UTF-8 ranges of codepoints, to  
check for cases where these generate an empty password, based on an  
original suggestion from Heikki Linnakangas.  This part consumes  
resources and time, so it is implemented as a TAP test under a  
new PG_TEST_EXTRA value.  
  
A different patch is still under discussion to tweak our internal  
SASLprep() implementation, and this module can be used to track any  
changes in behavior.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/aaEJ-El2seZHeFcG@paquier.xyz  

M doc/src/sgml/regress.sgml
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_saslprep/.gitignore
A src/test/modules/test_saslprep/Makefile
A src/test/modules/test_saslprep/README
A src/test/modules/test_saslprep/expected/test_saslprep.out
A src/test/modules/test_saslprep/meson.build
A src/test/modules/test_saslprep/sql/test_saslprep.sql
A src/test/modules/test_saslprep/t/001_saslprep_ranges.pl
A src/test/modules/test_saslprep/test_saslprep–1.0.sql
A src/test/modules/test_saslprep/test_saslprep.c
A src/test/modules/test_saslprep/test_saslprep.control

Add more debugging information for bgworker termination tests of worker_spi

commit   : 79a5911fe65be80d4a4cb6ca6f90ae7d2cc6e9bc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 11:39:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Mar 2026 11:39:31 +0900    

Click here for diff

widowbird has failed again after af8837a10bc7, with the same symptoms of  
a backend still lying around when attempting a database rename with a  
bgworker connected to the database being renamed.  
  
We are still not sure yet how the failure can be reached, if this is a  
timing issue in the test or an actual bug in the logic used for  
interruptible bgworkers.  This commit adds more debugging information in  
the backend to help with the analysis as a temporary measure.  
  
Another thing I have noticed is that the queries launching the dynamic  
bgworkers or checking pg_stat_activity would connect to the database  
renamed.  These are switched to use 'postgres'.  That will hopefully  
remove some of the friction of the test, but I doubt that this is the  
end of the story.  
  
Discussion: https://postgr.es/m/abtJLEAsf1HZXWdR@paquier.xyz  

M src/backend/postmaster/bgworker.c
M src/test/modules/worker_spi/t/002_worker_terminate.pl

doc: Clarify BUFFERS behavior without ANALYZE in EXPLAIN

commit   : 645c6d05cc37d06994b7423c1bf816c609bcb6be    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 19 Mar 2026 08:30:50 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 19 Mar 2026 08:30:50 +0900    

Click here for diff

This commit clarifies the documentation for the BUFFERS option of EXPLAIN  
by explicitly describing its behavior when ANALYZE is not specified.  
  
Author: Ryo Matsumura <matsumura.ryo@fujitsu.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/TYRPR01MB13457D31085CB5B246DBBA1AFE845A@TYRPR01MB13457.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/explain.sgml

pg_plan_advice: Fix multiple copy-and-paste-errors in test case.

commit   : b335fe56f35506348a567648e3a7ac1b3ac0baf3    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Mar 2026 18:15:36 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 18 Mar 2026 18:15:36 -0400    

Click here for diff

The second half of this file is meant to test feedback, not  
generated advice, and is meant to use the statements that it  
prepares, not leftover prepared statements from earlier in the  
file.  
  
These mistakes resulted in failures under debug_discard_caches = 1,  
because re-executing pt2 instead of executing pt4 for the first  
time resulted in different output depending on whether the query  
was replanned.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (per BF member avocet)  

M contrib/pg_plan_advice/expected/prepared.out
M contrib/pg_plan_advice/sql/prepared.sql

ssl: Skip passphrase reload tests in EXEC_BACKEND builds

commit   : e87ab5049deb6ea2fe26d4d8395d3f3b7d496bfc    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 22:59:57 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 22:59:57 +0100    

Click here for diff

SSL password command reloading must be enabled on Windows and in  
EXEC_BACKEND builds due to them always reloading the context. The  
new tests in commit 4f433025 skipped under Windows but missed the  
EXEC_BACKEND check.  Reported by buildfarm member culicidae.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAOYmi+kXmCCgBWffzmSjaNhME5rD=gjyc_OP1FeWQTw2MmSNjg@mail.gmail.com  

M src/test/ssl/t/004_sni.pl

Fix -Wstrict-prototypes warning in ecpg_init_sqlca() declaration.

commit   : f91b8ff6af910744e6e317c5c2bc2698addde59a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Mar 2026 15:25:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Mar 2026 15:25:12 -0400    

Click here for diff

When headerscheck compiles ecpglib_extern.h, POSTGRES_ECPG_INTERNAL is  
not defined, causing sqlca.h to expand "sqlca" as a macro  
(*ECPGget_sqlca()).  This causes the ecpg_init_sqlca() declaration to  
trigger a -Wstrict-prototypes warning.  
  
Fix by renaming the parameter from "sqlca" to "sqlca_p" in both the  
declaration and definition, avoiding the macro expansion.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reported-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAN55FZ1VDwJ-ZD092ChYf%2B%2BhuP%2B-S3Cg45tJ8jNH5wx2c4BHAg%40mail.gmail.com  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/misc.c

pg_restore: Remove unnecessary strlen() calls in options parsing.

commit   : ec80215c033dfbea0e864b955ec9d2c0a7f4a4ca    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 18 Mar 2026 14:22:15 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 18 Mar 2026 14:22:15 -0500    

Click here for diff

Unlike pg_dump and pg_dumpall, pg_restore first checks whether the  
argument passed to --format, --host, and --port is empty before  
setting the corresponding variable.  Consequently, pg_restore does  
not error if given an empty format name, whereas pg_dump and  
pg_dumpall do.  Empty arguments for --host and --port are ignored  
by all three applications, so this commit produces no functionality  
changes there.  This behavior should perhaps be reconsidered, but  
that is left as a future exercise.  As with other recent changes to  
option handling for these applications (commits b2898baaf7,  
7c8280eeb5, and be0d0b457c), no back-patch.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Discussion: https://postgr.es/m/CAKYtNApkh%3DVy2DpNRCnEJmPpxNuksbAh_QBav%3D2fLmVjBhGwFw%40mail.gmail.com  

M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl

ALTER SUBSCRIPTION ... SERVER test.

commit   : 1c5bf1185af0128a8415fc48155045fb16b51dee    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2026 10:15:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2026 10:15:51 -0700    

Click here for diff

Test ALTER SUBSCRIPTION ... SERVER and ALTER SUBSCRIPTION  
... CONNECTION, including invalidation.  
  
Also run perltidy on the test file.  
  
Discussion: https://postgr.es/m/CAExHW5vV5znEvecX=ra2-v7UBj9-M6qvdDzuB78M-TxbYD1PEA@mail.gmail.com  
Suggested-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  

M contrib/postgres_fdw/t/010_subscription.pl

Exclude contrib/pg_plan_advice/pgpa_parser.h from headerscheck.

commit   : 8df3c7a85ec24d1598f7a3bf77458b453ee6e6fb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Mar 2026 13:10:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Mar 2026 13:10:14 -0400    

Click here for diff

Like other Bison-written headers, it's not worth the trouble to  
make this compilable standalone.  (We might revisit this someday,  
if we ever move up our minimum required Bison version.)  

M src/tools/pginclude/headerscheck

Fix pg_dump for CREATE FOREIGN DATA WRAPPER ... CONNECTION.

commit   : b71bf3b8457027c445b5b3aa4914daa7e6718cf4    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2026 09:58:42 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 18 Mar 2026 09:58:42 -0700    

Click here for diff

Discussion: https://postgr.es/m/7eb0c03b4312b32cb76d340023b39a751745a1f9.camel@j-davis.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Enable -Wstrict-prototypes and -Wold-style-definition by default

commit   : 29bf4ee7496ca594495deb2599e8a44c6338525e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 14:31:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 14:31:50 +0100    

Click here for diff

Those are available in all gcc and clang versions that support C11 and as C11  
is required as of f5e0186f865c, then we can add them without capability test.  
  
Having them enabled by default avoid having to chase these manually like  
11171fe1fc8, cdf4b9aff2, 0e72b9d440, 7069dbcc31, f1283ed6cc, 7b66e2c086,  
e95126cf04 and 9f7c527af3 have done.  
  
Also, readline headers trigger a lot of warnings with -Wstrict-prototypes, so  
we make use of the system_header pragma to hide the warnings.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/13d51b20-a69c-4ac1-8546-ec4fc278064f%40eisentraut.org  
Discussion: https://postgr.es/m/aTFctZwWSpl2/LG5%40ip-10-97-1-34.eu-west-3.compute.internal  

M configure
M configure.ac
M meson.build
M src/bin/psql/input.h

Update RELEASE_CHANGES

commit   : 9b406a9e48545adf36c0dfcfc565be468d274f8b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 13:36:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 13:36:44 +0100    

Click here for diff

The existing instructions did not cover meson.  Point to  
src/common/unicode/README instead, where there is more information.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M src/tools/RELEASE_CHANGES

Implement unaccent Unicode data update in meson

commit   : 1b0c269f2e4f1cdcfd6d7c71d8eaa8020c23ebdb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 13:36:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 13:36:44 +0100    

Click here for diff

The meson/ninja update-unicode target did not cover the required  
updates in contrib/unaccent/.  This is fixed now.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alexander Borisov <lex.borisov@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M contrib/unaccent/meson.build
M meson.build
M src/common/unicode/README
M src/common/unicode/meson.build

ssl: Serverside SNI support for libpq

commit   : 4f433025f666fa4a6209f0e847715767fb1c7ace    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 12:37:11 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 12:37:11 +0100    

Click here for diff

Support for SNI was added to clientside libpq in 5c55dc8b4733 with the  
sslsni parameter, but there was no support for utilizing it serverside.  
This adds support for serverside SNI such that certificate/key handling  
is available per host.  A new config file, $datadir/pg_hosts.conf, is  
used for configuring which certificate and key should be used for which  
hostname.  In order to use SNI the ssl_sni GUC must be set to on, when  
it is off the ssl configuration works just like before.  If ssl_sni is  
enabled and pg_hosts.conf is non-empty it will take precedence over  
the regular SSL GUCs, if it is empty or missing the regular GUCs will  
be used just as before this commit with no hostname specific handling.  
The TLS init hook is not compatible with ssl_sni since it operates on  
a single TLS configuration and SNI break that assumption.  If the init  
hook and ssl_sni are both enabled, a WARNING will be issued.  
  
Host configuration can either be for a literal hostname to match, non-  
SNI connections using the no_sni keyword or a default fallback matching  
all connections.  By omitting no_sni and the fallback a strict mode  
can be achieved where only connections using sslsni=1 and a specified  
hostname are allowed.  
  
CRL file(s) are applied from postgresql.conf to all configured hostnames.  
  
Serverside SNI requires OpenSSL, currently LibreSSL does not support  
the required infrastructure to update the SSL context during the TLS  
handshake.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Dewei Dai <daidewei1970@163.com>  
Reviewed-by: Cary Huang <cary.huang@highgo.ca>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/1C81CD0D-407E-44F9-833A-DD0331C202E5@yesql.se  

M configure
M configure.ac
M doc/src/sgml/runtime.sgml
M meson.build
M src/backend/Makefile
M src/backend/commands/variable.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/meson.build
A src/backend/libpq/pg_hosts.conf.sample
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/libpq/hba.h
M src/include/libpq/libpq.h
M src/include/pg_config.h.in
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/ssl/meson.build
M src/test/ssl/t/001_ssltests.pl
A src/test/ssl/t/004_sni.pl
M src/tools/pgindent/typedefs.list

ssl: Add tests for client CA

commit   : 25e568ba7ce712c41acf7058ef14dd49d912c3ab    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 12:36:53 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 18 Mar 2026 12:36:53 +0100    

Click here for diff

These tests were originally written to test the SSL SNI patchset  
but they have merit on their own since we lack coverage for these  
scenarios in the non SNI case as well.  
  
Author: Jacob Champion <jacob.champion@enterprisedb.com>  
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/1C81CD0D-407E-44F9-833A-DD0331C202E5@yesql.se  

M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

meson: Add headerscheck and cpluspluscheck targets

commit   : e82fc27e095b5a84c578b6e6b43b3396463bd812    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 11:25:47 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 11:25:47 +0100    

Click here for diff

Author: Miłosz Bieniek <bieniek.milosz0@gmail.com>  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com  

M doc/src/sgml/targets-meson.txt
M meson.build
M src/tools/pginclude/README

meson: Add {perl|python}_includespec to generated Makefile.global

commit   : 720c9b504ec6934e93d7304e789c445dc1c09f31    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 11:09:14 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 11:09:14 +0100    

Click here for diff

This is meant to help enable headerscheck under meson, but can also be  
useful in general, for example for third-party extension that might  
use these values.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com  

M meson.build
M src/makefiles/meson.build

Allow setting the collation strength in ICU tailoring rules

commit   : 905e44152a1d49b90cb8d800dcaaba7981288ae2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 08:54:35 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 Mar 2026 08:54:35 +0100    

Click here for diff

There was a bug that if you created an ICU collation with tailoring  
rules, any strength specification inside the rules was ignored.  This  
was because we called ucol_openRules() with UCOL_DEFAULT_STRENGTH for  
the strength argument, which overrides the strength.  This was because  
of faulty guidance in the ICU documentation, which has since been  
fixed.  The correct invocation is to use UCOL_DEFAULT for the strength  
argument.  
  
This fixes bug #18771 and bug #19425.  
  
Author: Daniel Verite <daniel@manitou-mail.org>  
Reported-by: Ruben Ruiz <ruben.ruizcuadrado@gmail.com>  
Reported-by: dorian.752@live.fr  
Reported-by: Todd Lang <Todd.Lang@D2L.com>  
Discussion: https://www.postgresql.org/message-id/flat/YT2PPF959236618377A072745A280E278F4BE1DA@YT2PPF959236618.CANPRD01.PROD.OUTLOOK.COM  
Discussion: https://www.postgresql.org/message-id/flat/18771-98bb23e455b0f367@postgresql.org  
Discussion: https://www.postgresql.org/message-id/flat/19425-58915e19dacd4f40%40postgresql.org  

M src/backend/utils/adt/pg_locale_icu.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Move planner row-estimation tests to new planner_est.sql

commit   : 374a6394c6ae2e6f8b70ca7897e1499ff72ae7e5    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 18 Mar 2026 17:22:05 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 18 Mar 2026 17:22:05 +1300    

Click here for diff

Move explain_mask_costs() and the associated planner row-estimation  
tests from misc_functions.sql to a new regression test file,  
planner_est.sql.  
  
Previously, there wasn't an ideal home for such tests, likely as there  
were very few such tests due to width and selectivity estimations being  
too dependent on statistics and hardware.  That's not always the case, as  
we have SupportRequestRows support functions.  More such tests are  
possibly on the way, so let's create a better home so that we don't have  
to create the explain_mask_costs() function in each file we might have  
added such tests to.  
  
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvphShGABn-3AoE36dTvGHW7gUpFSw0_ZZnH84wGCW3hHw@mail.gmail.com  

M src/test/regress/expected/misc_functions.out
A src/test/regress/expected/planner_est.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/misc_functions.sql
A src/test/regress/sql/planner_est.sql

test_plan_advice: Add .gitignore

commit   : ab697307dd0f0b4f6c6671421d4dd0bc20f176cb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Mar 2026 11:04:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Mar 2026 11:04:10 +0900    

Click here for diff

Issue noticed while playing with the tree.  

A src/test/modules/test_plan_advice/.gitignore

Allow IS JSON predicate to work with domain types

commit   : 3b4c2b9db25ee1c51e5133da529668a37aa02fc3    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 13 Mar 2026 11:51:26 +0800    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 13 Mar 2026 11:51:26 +0800    

Click here for diff

The IS JSON predicate only accepted the base types text, json, jsonb, and  
bytea.  Extend it to also accept domain types over those base types by  
resolving through getBaseType() during parse analysis.  
  
The base type OID is stored in the JsonIsPredicate node (as exprBaseType)  
so the executor can dispatch to the correct validation path without  
repeating the domain lookup at runtime.  
  
When a non-supported type (or domain over a non-supported type) is used,  
the error message displays the original type name as written by the user,  
rather than the resolved base type.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/CACJufxEk34DnJFG72CRsPPT4tsJL9arobX0tNPsn7yH28J=zQg@mail.gmail.com  

M src/backend/executor/execExprInterp.c
M src/backend/nodes/makefuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix use of wrong variable in _hash_kill_items()

commit   : f5eb854ab6d6281ec2d3143657944bdda6676341    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 17 Mar 2026 14:54:41 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 17 Mar 2026 14:54:41 -0400    

Click here for diff

In 82467f627bd I somehow ended up using 'so->currPos.buf' instead of the 'buf'  
variable, which is incorrect when the buffer is not already pinned. At the  
very least this can lead to assertion failures  
  
Unfortunately this shows that this code path was not covered. Expand  
src/test/modules/index/specs/killtuples.spec to test it.  Until now the  
'result' step always reported either a 0 or 1 buffer accesses, but when  
exercising hash overflows, more buffers are accessed.  To avoid depending on  
the precise number of accesses, change the result step to return whether there  
were any heap accesses. That makes the change a lot more verbose, but still  
seems worth it.  
  
Reported-by: Alexander Kuzmenkov <akuzmenkov@tigerdata.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/vjtmvwvbxt7w5uyacxpzibpj65ewcb7uqaqbhd4arvnjbp5jqz%405ksdh6fsyqve  
Discussion: https://postgr.es/m/b9de8d05-3b02-4a27-9b0b-03972fa4bfd3@iki.fi  

M src/backend/access/hash/hashutil.c
M src/test/modules/index/expected/killtuples.out
M src/test/modules/index/specs/killtuples.spec

pg_plan_advice: Avoid a crash under GEQO.

commit   : 01b02c0ecad1bb4e884614a00a5c619f20480823    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 14:25:43 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 14:25:43 -0400    

Click here for diff

The previous code could allocate pgpa_sj_unique_rel objects in a context  
that had too short a lifespan. Fix by allocating them (and any  
associated List-related allocations) in the same context as the  
pgpa_planner_state to which they are attached. We also need to copy  
uniquerel->relids, because the associated RelOptInfo may also be  
allocated within a short-lived context.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: http://postgr.es/m/a6e6d603-e847-44dc-acd5-879fb4570062@gmail.com  

M contrib/pg_plan_advice/pgpa_planner.c

Test pg_plan_advice using a new test_plan_advice module.

commit   : e0e4c132ef2b59f42b9d01872c69607983f3ef31    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 14:00:45 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 14:00:45 -0400    

Click here for diff

The TAP test included in this new module runs the regression tests  
with pg_plan_advice loaded. It arranges for each query to be planned  
twice.  The first time, we generate plan advice. The second time, we  
replan the query using the resulting advice string. If the tests  
fail, that means that using pg_plan_advice to tell the planner to  
do what it was going to do anyway breaks something, which indicates  
a problem either with pg_plan_advice or with the planner.  
  
The test also enables pg_plan_advice.feedback_warnings, so that if the  
plan advice fails to apply cleanly when the query is replanned, a  
failure will occur.  
  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Discussion: http://postgr.es/m/CA%2BTgmoZzM2i%2Bp-Rxdphs4qx7sshn-kzxF91ASQ5duOo0dFRXLQ%40mail.gmail.com  

M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_plan_advice/Makefile
A src/test/modules/test_plan_advice/meson.build
A src/test/modules/test_plan_advice/t/001_replan_regress.pl
A src/test/modules/test_plan_advice/test_plan_advice.c

pg_plan_advice: Always install pg_plan_advice.h, and in the right place

commit   : 59dcc19b397f69a3654d39bae5a13f1659d922d8    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 12:36:57 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 12:36:57 -0400    

Click here for diff

The Makefile failed to set HEADERS_pg_plan_advice, so the header wasn't  
installed. Fixing that reveals another problem: since this is just a  
loadable module, not an extension, the header file is installed into  
$(includedir_server)/contrib rather than $(includedir_server)/extension.  
While we have no existing cases of installing header files there, it  
appears to be the intent of pgxs.mk.  However, this is inconsistent with  
meson.build, which was using dir_include_extension. Changing that to  
dir_include_server / 'contrib' makes the install locations consistent  
across the two builds.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: http://postgr.es/m/CAN4CZFP6NOjv__4Mx+iQD8StdpbHvzDAatEQn2n15UKJ=MySSQ@mail.gmail.com  

M contrib/pg_plan_advice/Makefile
M contrib/pg_plan_advice/meson.build

pg_dump: Simplify query for retrieving attribute statistics.

commit   : 4b5ba0c4ca5244d0ed589f67baf0204957886e6b    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 17 Mar 2026 11:32:40 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 17 Mar 2026 11:32:40 -0500    

Click here for diff

This query fetches information from pg_stats, which did not return  
table OIDs until recent commit 3b88e50d6c.  Because of this, we had  
to cart around arrays of schema and table names, and we needed an  
extra filter clause to hopefully convince the planner to use the  
correct index.  With the introduction of pg_stats.tableid, we can  
instead just use an array of OIDs, and we no longer need the extra  
filter clause hack.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CADkLM%3DcoCVy92QkVUUTLdo5eO2bMDtwMrzRn_8miAhX%2BuPaqXg%40mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Hardcode typeof_unqual to __typeof_unqual__ for clang

commit   : 2eb6cd327caea42b5f29e0b16d6053c52aa08c3c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 16:44:43 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 16:44:43 +0100    

Click here for diff

A new attempt was made in 63275ce84d2 to make typeof_unqual work on all  
configurations of CC and CLANG. This re-introduced an old problem  
though, where CLANG would only support __typeof_unqual__ but the  
configure check for CC detected support for typeof_unqual.  
  
This fixes that by always defining typeof_unqual as __typeof_unqual__  
under clang.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M src/include/c.h

pg_plan_advice: Fix variable type confusion.

commit   : 7560995a38dc408ae78973728965d052ccdbdb48    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 10:20:15 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 17 Mar 2026 10:20:15 -0400    

Click here for diff

pgs_mask values should always be uint64, but in a couple of  
places I incorrectly used uint32. Fix that.  
  
Reported-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: http://postgr.es/m/CAApHDvquH6wnp4fhpaCOkC4R3KAvr2BOTbhhDPDQCBNR3YbLMQ@mail.gmail.com  

M contrib/pg_plan_advice/pgpa_planner.c

make immutability tests in to_json and to_jsonb complete

commit   : ecd9288624a1582a732cf86ac5a01475a1ce7815    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 10 Mar 2026 14:25:29 +0800    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 10 Mar 2026 14:25:29 +0800    

Click here for diff

Complete the TODOs in to_json_is_immutable() and to_jsonb_is_immutable()  
by recursing into container types (arrays, composites, ranges, multiranges,  
domains) to check element/sub-type mutability, rather than conservatively  
returning "mutable" for all arrays and composites.  
  
The shared logic is factored into a single json_check_mutability() function  
in jsonfuncs.c, with the existing exported functions as thin wrappers.  
Composite type inspection uses lookup_rowtype_tupdesc() (typcache) instead  
of relation_open() to avoid unnecessary lock acquisition in the optimizer.  
  
Range and multirange types are now also checked recursively: if the  
subtype's conversion is immutable, the range is considered immutable  
for JSON purposes, even though range_out is generically marked STABLE.  
This is a behavioral change: range types with immutable subtypes (e.g.,  
int4range) can now appear in expression indexes via JSON_ARRAY/JSON_OBJECT,  
whereas previously they were conservatively rejected.  
  
Add regression tests for JSON_ARRAY and JSON_OBJECT mutability with  
expression indexes and generated columns, covering arrays, composites,  
domains, ranges, multiranges and combinations thereof.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CACJufxFz=OsXQdsMJ-cqoqspD9aJrwntsQP-U2A-UaV_M+-S9g@mail.gmail.com  
Commitfest: https://commitfest.postgresql.org/patch/5759  

M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/utils/jsonfuncs.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Add more columns to pg_stats, pg_stats_ext, and pg_stats_ext_exprs.

commit   : 3b88e50d6c2ef972748378a10fc444efae90ed14    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 17 Mar 2026 09:26:27 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 17 Mar 2026 09:26:27 -0500    

Click here for diff

This commit adds table OID and attribute number columns to  
pg_stats, and it adds table OID and statistics object OID columns  
to pg_stats_ext and pg_stats_ext_exprs.  A proposed follow-up  
commit would use pg_stats.tableid to simplify a query in pg_dump.  
The others have no immediate purpose but may be useful later.  
  
Bumps catversion.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM%3DcoCVy92QkVUUTLdo5eO2bMDtwMrzRn_8miAhX%2BuPaqXg%40mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_import.out

Dump labels in reproducible order

commit   : c9babbc8816a4f5d5894eda555e39ba30781322f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 14:06:53 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 14:06:53 +0100    

Click here for diff

In pg_get_propgraphdef(), sort the labels before writing out, for a  
consistent dump order.  Also, since we now have a list, we can get rid  
of the separate table scan to get the count.  
  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Co-authored-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

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

Don't leave behind files in src dir in 007_multixact_conversion.pl

commit   : 2c1a7d421f92c14c8fedbd77200607b3df554add    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 17 Mar 2026 11:24:10 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 17 Mar 2026 11:24:10 +0200    

Click here for diff

pg_upgrade test 007_multixact_conversion.pl was leaving files like  
delete_old_cluster.sh in the source directory for VPATH and meson  
builds. To fix, change the tmp_check directory before running the  
test, like in the other pg_upgrade tests.  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
https://www.postgresql.org/message-id/TYRPR01MB121563A4DA8B2FE9A2ECB79F5F541A@TYRPR01MB12156.jpnprd01.prod.outlook.com  

M src/bin/pg_upgrade/t/007_multixact_conversion.pl

pg_dump: Add appropriate version check

commit   : 182cdf5aeaf7b34a288a135d66f2893dc288a24e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 09:46:06 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Mar 2026 09:46:06 +0100    

Click here for diff

Some code added by commit 2f094e7ac69 needs to be behind a version  
check so that it is not run against older databases.  
  
Author: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/afe3f099-3271-4fc4-8e32-467b5309affb%40dunslane.net  

M src/bin/pg_dump/pg_dump.c

gen_guc_tables.pl: Improve detection of inconsistent data

commit   : 233e6ae95330eac51880b050908b1e3ac9860d9b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 17:38:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 17:38:55 +0900    

Click here for diff

This commit adds two improvements to gen_guc_tables.pl:  
1) When finding two entries with the same name, the script complained  
about these being not in alphabetical order, which was confusing.  
Duplicated entries are now reported as their own error.  
2) While the presence of the required fields is checked for all the  
parameters, the script did not perform any checks on the non-required  
fields.  A check is added to check that any field defined matches with  
what can be accepted.  Previously, a typo in the name of a required  
field would cause the field to be reported as missing.  Non-mandatory  
fields would be silently ignored, which was problematic as we could lose  
some information.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAN4CZFP=3xUoXb9jpn5OWwicg+rbyrca8-tVmgJsQAa4+OExkw@mail.gmail.com  

M src/backend/utils/misc/gen_guc_tables.pl

Refactor some code around ALTER TABLE [NO] INHERIT

commit   : 1a7ccd2b332d5fafa9bf1121c82693c9a2a57298    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 14:34:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 14:34:29 +0900    

Click here for diff

[NO] INHERIT is not supported for partitioned tables, but this portion  
of tablecmds.c did not apply the same rules as the other sub-commands,  
checking the relkind in the execution phase, not the preparation phase.  
  
This commit refactors the code to centralize the relkind and other  
checks in the preparation phase for both command patterns, getting rid  
of one translatable string on the way.  ATT_PARTITIONED_TABLE is  
removed from ATSimplePermissions(), and the child relation is checked  
the same way for both sub-commands.  The ALTER TABLE patterns that now  
fail at preparation failed already at execution, hence there should be  
no changes from the user perspective except more consistent error  
messages generated.  
  
Some comments at the top of ATPrepAddInherit() were incorrect,  
CreateInheritance() being the routine checking the columns and  
constraints between the parent and its to-be-child.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com  

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

Add regression test for ALTER TABLE .. NO INHERIT on typed tables

commit   : cbf9a72993ec8148cdf1925e414e0b4e27f20f2f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 13:14:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 13:14:02 +0900    

Click here for diff

This test addition has come up as a suggestion by me, while discussing a  
patch that manipulates the area of the code related to this command  
pattern.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com  

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

Tweak TAP test for worker terminations in worker_spi

commit   : af8837a10bc70d5e815a1bda986429a2a73ad174    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 12:56:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Mar 2026 12:56:46 +0900    

Click here for diff

The test has been reported as having a race condition for the case of a  
worker that should be terminated after a database rename.  Based on the  
report received from buildfarm member jay, the database renamed is  
accessed by a different session, preventing the ALTER DATABASE to  
complete, ultimately failing the test.  
  
Honestly, I am not completely sure what is the origin of this  
disturbance, but two possibilities are an autovacuum or parallel worker  
(due to debug_parallel_query being used by the host).  In order to  
(hopefully) stabilize the test, autovacuum and debug_parallel_query are  
now disabled in the configuration of the node used in the test.  
  
The failure is hard to reproduce, so it will take a few weeks to make  
sure that the test has become stable.  Let's see where it goes.  
  
Reported-by: Aya Iwata <iwata.aya@fujitsu.com>  
Discussion: https://postgr.es/m/OS3PR01MB8889505E2F3E443CCA4BD72EEA45A@OS3PR01MB8889.jpnprd01.prod.outlook.com  

M src/test/modules/worker_spi/t/002_worker_terminate.pl

Reduce size of CompactAttribute struct to 8 bytes

commit   : d8a859d22b1accd8ea749394a488e4de014b2396    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 17 Mar 2026 15:06:31 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 17 Mar 2026 15:06:31 +1300    

Click here for diff

Previously, this was 16 bytes.  With the use of some bitflags and by  
reducing the attcacheoff field size to a 16-bit type, we can halve the  
size of the struct.  
  
It's unlikely that caching the offsets for offsets larger than what will  
fit in a 16-bit int will help much as the tuple is very likely to have  
some non-fixed-width types anyway, the offsets of which we cannot cache.  
  
Shrinking this down to 8 bytes helps by accessing fewer cachelines when  
performing tuple deformation.  The fields used there are all fully  
fledged fields, which don't require any bitmasking to extract the value  
of.  It also helps to more efficiently calculate the address of a  
compact_attrs[] element in TupleDesc as the x86 LEA instruction can work  
with 8 byte offsets, which allows the element address to be calculated  
from the TupleDesc's address in a single instruction using LEA's  
concurrent shift and add.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAApHDvodSVBj3ypOYbYUCJX%2BNWL%3DVZs63RNBQ_FxB_F%2B6QXF-A%40mail.gmail.com  

M src/backend/access/common/tupdesc.c
M src/backend/executor/execTuples.c
M src/include/access/tupdesc.h

Fix WAL flush LSN used by logical walsender during shutdown

commit   : d927b4bd97c8087c26254cb29a59c8b768cc6bd7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 17 Mar 2026 08:10:20 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 17 Mar 2026 08:10:20 +0900    

Click here for diff

Commit 6eedb2a5fd8 made the logical walsender call  
XLogFlush(GetXLogInsertRecPtr()) to ensure that all pending WAL is flushed,  
fixing a publisher shutdown hang. However, if the last WAL record ends at  
a page boundary, GetXLogInsertRecPtr() can return an LSN pointing past  
the page header, which can cause XLogFlush() to report an error.  
  
A similar issue previously existed in the GiST code. Commit b1f14c96720  
introduced GetXLogInsertEndRecPtr(), which returns a safe WAL insertion end  
location (returning the start of the page when the last record ends at a page  
boundary), and updated the GiST code to use it with XLogFlush().  
  
This commit fixes the issue by making the logical walsender use  
XLogFlush(GetXLogInsertEndRecPtr()) when flushing pending WAL during shutdown.  
  
Backpatch to all supported versions.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/vzguaguldbcyfbyuq76qj7hx5qdr5kmh67gqkncyb2yhsygrdt@dfhcpteqifux  
Backpatch-through: 14  

M src/backend/replication/walsender.c

Clean up postgres_fdw/t/010_subscription.pl.

commit   : f4af7849b3db1c71efdafbe7a9e37c7e7f27e006    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 16 Mar 2026 13:42:55 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 16 Mar 2026 13:42:55 -0700    

Click here for diff

The test was based on test/subscription/002_rep_changes.pl, but had  
some leftover copy+paste problems that were useless and/or  
distracting.  
  
Discussion: https://postgr.es/m/CAA4eK1+=V_UFNHwcoMFqzy0F4AtS9_GyXhQDUzizgieQPWr=0A@mail.gmail.com  
Reported-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  

M contrib/postgres_fdw/t/010_subscription.pl

Fix thinko in nocachegetattr() and nocache_index_getattr()

commit   : 7a2ab122a1c555ee4298863917ce68a2b9800cb8    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 17 Mar 2026 09:00:39 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 17 Mar 2026 09:00:39 +1300    

Click here for diff

This code was recently adjusted by c456e3911, but that commit didn't get  
the logic correct when finding the attnum to start walking the tuple in.  
If there is a NULL, we need to start walking the tuple before it.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAHewXNnb-s_=VdVUZ9h7dPA0u3hxV8x2aU3obZytnqQZ_MiROA@mail.gmail.com  

M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c

pg_plan_advice: Fix failures to accept identifier keywords.

commit   : 5e72ce2467c15340026955b57ff75f75e853a766    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 16 Mar 2026 14:37:12 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 16 Mar 2026 14:37:12 -0400    

Click here for diff

TOK_IDENT allows only non-keywords; identifier should be used  
any place where either keywords or non-keywords should be accepted.  
Hence, without this commit, any string that happens to be a keyword  
can't be used as a partition schema, partition name, or plan name,  
which is incorrect.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Discussion: http://postgr.es/m/CAP53PkzKeD=t90OfeMsniYrcRe2THQbUx3g6wV17Y=ZtiwmWTQ@mail.gmail.com  

M contrib/pg_plan_advice/expected/syntax.out
M contrib/pg_plan_advice/pgpa_parser.y
M contrib/pg_plan_advice/sql/syntax.sql

Fix whitespace

commit   : 4f888d0f9425468e74cd3f0ca6a3047fd404807b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 19:33:13 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 19:33:13 +0100    

Click here for diff

M contrib/pg_plan_advice/expected/prepared.out
M contrib/pg_plan_advice/sql/prepared.sql

Hardcode override of typeof_unqual for clang-for-bitcode

commit   : 63275ce84d2f571136b585d7493e1ec351388014    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 18:56:30 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 18:56:30 +0100    

Click here for diff

The fundamental problem is that when we call clang to generate  
bitcode, we might be using configure results from a different  
compiler, which might not be fully compatible with the clang we are  
using.  In practice, clang supports most things other compilers  
support, so this has apparently not been a problem in practice.  
  
But commits 4cfce4e62c8, 0af05b5dbb4, and 59292f7aac7 have been  
struggling to make typeof_unqual work in this situation.  Clang added  
support in version 19, GCC in version 14, so if you are using, say,  
GCC 14 and Clang 16, the compilation with the latter will fail.  Such  
combinations are not very likely in practice, because GCC 14 and Clang  
19 were released within a few months of each other, and so Linux  
distributions are likely to have suitable combinations.  But some  
buildfarm members and some Fedora versions are affected, so this tries  
to fix it.  
  
The fully correct solution would be to run a separate set of configure  
tests for that clang-for-bitcode, but that would be very difficult to  
implement, and probably of limited use in practice.  So the workaround  
here is that we hardcodedly override the configure result under clang  
based on the version number.  As long as we only have a few of these  
cases, this should be manageable.  
  
Also swap the order of the tests of typeof_unqual: Commit 59292f7aac7  
tested the underscore variant first, but the reasons for that are now  
gone.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M config/c-compiler.m4
M configure
M meson.build
M src/include/c.h

pg_dumpall: Fix handling of incompatible options.

commit   : be0d0b457cb605f6e539f92af5e564fbe9d65e59    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 16 Mar 2026 11:01:20 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 16 Mar 2026 11:01:20 -0500    

Click here for diff

This commit teaches pg_dumpall to fail when both --clean and  
--data-only are specified.  Previously, it passed the options  
through to pg_dump, which would fail after pg_dumpall had already  
started producing output.  Like recent commits b2898baaf7 and  
7c8280eeb5, no back-patch.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Discussion: https://postgr.es/m/CAKYtNArrHiJ0LDB9BFZiUWs6tC78QkBN50wiwO07WhxewYDS3Q%40mail.gmail.com  

M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl

Make some tests more stable by adding more explicit ordering

commit   : cd8844e7db64d57554c780ec9881457c573c51ab    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 16:24:22 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 16:24:22 +0100    

Click here for diff

for some tests added by commit 2f094e7ac69, based on buildfarm results  

M src/test/regress/expected/create_property_graph.out
M src/test/regress/expected/graph_table.out
M src/test/regress/sql/create_property_graph.sql
M src/test/regress/sql/graph_table.sql

Reduce header inclusions via execnodes.h

commit   : fba4233c832870c8363438419743c48fdcb2151c    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 16 Mar 2026 14:34:57 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 16 Mar 2026 14:34:57 +0100    

Click here for diff

Remove a bunch of #include lines from execnodes.h.  Most of these  
requier suitable typedefs to be added, so that it still compiles  
standalone.  In one case, the fix is to move a struct definition to the  
one .c file where it is needed.  
  
Also some light clean up in plannodes.h and genam.h, though not as  
extensive as in execnodes.h.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/202603131240.ihwqdxnj7w2o@alvherre.pgsql  

M contrib/amcheck/verify_heapam.c
M contrib/dblink/dblink.c
M contrib/hstore/hstore_subs.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/tablefunc/tablefunc.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/xml2/xpath.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/wait.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execSRF.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/foreign/foreign.c
M src/backend/jit/jit.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_utilcmd.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/worker.c
M src/backend/rewrite/rewriteGraphTable.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/shmem.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/pg_config.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/tuplestore.c
M src/include/access/genam.h
M src/include/access/gin_private.h
M src/include/bootstrap/bootstrap.h
M src/include/catalog/index.h
M src/include/commands/explain.h
M src/include/commands/explain_state.h
M src/include/executor/execScan.h
M src/include/executor/executor.h
M src/include/executor/hashjoin.h
M src/include/lib/simplehash.h
M src/include/nodes/execnodes.h
M src/include/nodes/plannodes.h
M src/pl/plperl/plperl.c
M src/pl/tcl/pltcl.c
M src/test/modules/injection_points/injection_points.c
M src/test/modules/test_custom_stats/test_custom_var_stats.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_regex/test_regex.c

Remove unstable test for pg_statio_all_sequences stats reset

commit   : 57b5543bb8517c15e3179e5ed2493edbb708457f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 21:05:13 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 21:05:13 +0900    

Click here for diff

Commit 8fe315f18d4 added the stats_reset column to pg_statio_all_sequences and  
included a regression test to verify that statistics in this view are reset  
correctly. However, this test caused buildfarm member crake to report  
a pg_upgradeCheck failure.  
  
The failing test assumed that the blks_read and blks_hit counters  
in pg_statio_all_sequences would be zero after calling  
pg_stat_reset_single_table_counters(). On crake, however, either blks_read or  
blks_hit sometimes appeared as 1 during the pg_upgradeCheck test, even right  
after the reset.  
  
Since these counters may change due to concurrent activity and the test is  
unstable, this commit removes the checks for blks_read and blks_hit in  
pg_statio_all_sequences from the regression test.  
  
Per buildfarm member crake.  
  
Discussion: https://postgr.es/m/CAHGQGwFcay_tX=7HSS=N=+Yd0FLEm2GrJgwxnqHM4wvxX0B=4g@mail.gmail.com  

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

Fix pg_upgrade failure when extension_control_path is used

commit   : 1e67508730eb0c98bf6eec660d0ed04368982266    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 11:52:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 11:52:02 +0100    

Click here for diff

When an extension is located via extension_control_path and it has a  
hardcoded $libdir/ path, this is stripped by the  
extension_control_path mechanism.  But when pg_upgrade verifies the  
extension using LOAD, this stripping does not happen, and so  
pg_upgrade will fail because it cannot load the extension.  To work  
around that, change pg_upgrade to itself strip the prefix when it runs  
its checks.  A test case is also added.  
  
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Reviewed-by: Niccolò Fei <niccolo.fei@enterprisedb.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/43b3691c673a8b9158f5a09f06eacc3c63e2c02d.camel%40gmail.com  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/meson.build
A src/bin/pg_upgrade/t/008_extension_control_path.pl
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/meson.build
A src/test/modules/test_extensions/test_ext.c

Use C11 alignas in typedef definitions

commit   : 5c2a8d272b9aa95f36355357095a2838120b0fe2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:41:38 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:41:38 +0100    

Click here for diff

They were already using pg_attribute_aligned.  This replaces that with  
alignas and moves that into the required syntactic position.  
  
Suggested-by: Peter Eisentraut <peter@eisentraut.org>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/d7a788fa-e609-4894-a8be-2f70e135424f%40eisentraut.org  

M src/backend/storage/aio/method_io_uring.c
M src/include/storage/proc.h

Prevent -Wstrict-prototypes and -Wold-style-definition warnings

commit   : d7ad79e5069b3649bfd973f84d89be40519f8cba    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:53:24 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:53:24 +0100    

Click here for diff

A following commit will enable -Wstrict-prototypes and -Wold-style-definition  
by default. This commit fixes the warnings that those new flags will generate  
before actually adding the new flags.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/13d51b20-a69c-4ac1-8546-ec4fc278064f%40eisentraut.org  

M src/interfaces/ecpg/test/compat_informix/intoasc.pgc
M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_informix-intoasc.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
M src/interfaces/ecpg/test/expected/preproc-autoprep.c
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
M src/interfaces/ecpg/test/expected/sql-code100.c
M src/interfaces/ecpg/test/expected/sql-copystdout.c
M src/interfaces/ecpg/test/expected/sql-declare.c
M src/interfaces/ecpg/test/expected/sql-dyntest.c
M src/interfaces/ecpg/test/expected/sql-fetch.c
M src/interfaces/ecpg/test/expected/sql-func.c
M src/interfaces/ecpg/test/expected/sql-indicators.c
M src/interfaces/ecpg/test/expected/sql-insupd.c
M src/interfaces/ecpg/test/expected/sql-parser.c
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-show.c
M src/interfaces/ecpg/test/expected/sql-sqljson.c
M src/interfaces/ecpg/test/expected/sql-sqljson_jsontable.c
M src/interfaces/ecpg/test/expected/thread-alloc.c
M src/interfaces/ecpg/test/expected/thread-descriptor.c
M src/interfaces/ecpg/test/expected/thread-prep.c
M src/interfaces/ecpg/test/expected/thread-thread.c
M src/interfaces/ecpg/test/expected/thread-thread_implicit.c
M src/interfaces/ecpg/test/preproc/array_of_struct.pgc
M src/interfaces/ecpg/test/preproc/autoprep.pgc
M src/interfaces/ecpg/test/preproc/pointer_to_struct.pgc
M src/interfaces/ecpg/test/sql/code100.pgc
M src/interfaces/ecpg/test/sql/copystdout.pgc
M src/interfaces/ecpg/test/sql/declare.pgc
M src/interfaces/ecpg/test/sql/dyntest.pgc
M src/interfaces/ecpg/test/sql/fetch.pgc
M src/interfaces/ecpg/test/sql/func.pgc
M src/interfaces/ecpg/test/sql/indicators.pgc
M src/interfaces/ecpg/test/sql/insupd.pgc
M src/interfaces/ecpg/test/sql/parser.pgc
M src/interfaces/ecpg/test/sql/quote.pgc
M src/interfaces/ecpg/test/sql/show.pgc
M src/interfaces/ecpg/test/sql/sqljson.pgc
M src/interfaces/ecpg/test/sql/sqljson_jsontable.pgc
M src/interfaces/ecpg/test/thread/alloc.pgc
M src/interfaces/ecpg/test/thread/descriptor.pgc
M src/interfaces/ecpg/test/thread/prep.pgc
M src/interfaces/ecpg/test/thread/thread.pgc
M src/interfaces/ecpg/test/thread/thread_implicit.pgc
M src/interfaces/libpq/test/libpq_testclient.c

SQL Property Graph Queries (SQL/PGQ)

commit   : 2f094e7ac691abc9d2fe0f4dcf0feac4a6ce1d9c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:14:18 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 10:14:18 +0100    

Click here for diff

Implementation of SQL property graph queries, according to SQL/PGQ  
standard (ISO/IEC 9075-16:2023).  
  
This adds:  
  
- GRAPH_TABLE table function for graph pattern matching  
- DDL commands CREATE/ALTER/DROP PROPERTY GRAPH  
- several new system catalogs and information schema views  
- psql \dG command  
- pg_get_propgraphdef() function for pg_dump and psql  
  
A property graph is a relation with a new relkind RELKIND_PROPGRAPH.  
It acts like a view in many ways.  It is rewritten to a standard  
relational query in the rewriter.  Access privileges act similar to a  
security invoker view.  (The security definer variant is not currently  
implemented.)  
  
Starting documentation can be found in doc/src/sgml/ddl.sgml and  
doc/src/sgml/queries.sgml.  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Ajay Pal <ajay.pal.k@gmail.com>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_overexplain/sql/pg_overexplain.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func/func-info.sgml
M doc/src/sgml/information_schema.sgml
A doc/src/sgml/keywords/sql2023-16-nonreserved.txt
A doc/src/sgml/keywords/sql2023-16-reserved.txt
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/alter_extension.sgml
A doc/src/sgml/ref/alter_property_graph.sgml
M doc/src/sgml/ref/comment.sgml
A doc/src/sgml/ref/create_property_graph.sgml
A doc/src/sgml/ref/drop_property_graph.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/security_label.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/reference.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/sql_features.txt
M src/backend/commands/Makefile
M src/backend/commands/alter.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/meson.build
A src/backend/commands/propgraphcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execMain.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/print.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/meson.build
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
A src/backend/parser/parse_graphtable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/scan.l
M src/backend/rewrite/Makefile
M src/backend/rewrite/meson.build
A src/backend/rewrite/rewriteGraphTable.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/plancache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/help.c
M src/bin/psql/tab-complete.in.c
M src/fe_utils/psqlscan.l
M src/include/catalog/Makefile
M src/include/catalog/catversion.h
M src/include/catalog/meson.build
M src/include/catalog/pg_class.h
M src/include/catalog/pg_proc.dat
A src/include/catalog/pg_propgraph_element.h
A src/include/catalog/pg_propgraph_element_label.h
A src/include/catalog/pg_propgraph_label.h
A src/include/catalog/pg_propgraph_label_property.h
A src/include/catalog/pg_propgraph_property.h
A src/include/commands/propgraphcmds.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
A src/include/parser/parse_graphtable.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
A src/include/rewrite/rewriteGraphTable.h
M src/include/tcop/cmdtaglist.h
M src/include/utils/acl.h
M src/include/utils/lsyscache.h
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-sqlpgq.c
A src/interfaces/ecpg/test/expected/sql-sqlpgq.stderr
A src/interfaces/ecpg/test/expected/sql-sqlpgq.stdout
M src/interfaces/ecpg/test/sql/.gitignore
M src/interfaces/ecpg/test/sql/Makefile
M src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/sql/sqlpgq.pgc
M src/test/regress/expected/alter_generic.out
A src/test/regress/expected/create_property_graph.out
A src/test/regress/expected/graph_table.out
A src/test/regress/expected/graph_table_rls.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/privileges.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/alter_generic.sql
A src/test/regress/sql/create_property_graph.sql
A src/test/regress/sql/graph_table.sql
A src/test/regress/sql/graph_table_rls.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/privileges.sql
M src/tools/pgindent/typedefs.list

Ensure "still waiting on lock" message is logged only once per wait.

commit   : fd6ecbfa75ff0316f17c75d3931f20eb4f6e1231    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 18:10:57 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 18:10:57 +0900    

Click here for diff

When log_lock_waits is enabled, the "still waiting on lock" message is normally  
emitted only once while a session continues waiting. However, if the wait is  
interrupted, for example by wakeups from client_connection_check_interval,  
SIGHUP for configuration reloads, or similar events, the message could be  
emitted again each time the wait resumes.  
  
For example, with very small client_connection_check_interval values  
(e.g., 100 ms), this behavior could flood the logs with repeated messages,  
making them difficult to use.  
  
To prevent this, this commit guards the "still waiting on lock" message so  
it is reported at most once during a lock wait, even if the wait is interrupted.  
This preserves the intended behavior when no interrupts occur.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Hüseyin Demir <huseyin.d3r@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwHZUmg+r4kMcPYt_Z-txxVX+CJJhfra+qemxKXvAxYbpw@mail.gmail.com  

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

Reject ALTER TABLE .. CLUSTER earlier for partitioned tables

commit   : c336133c65a7ac3223a3cb492b8bbf4fa3999375    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Mar 2026 17:48:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Mar 2026 17:48:39 +0900    

Click here for diff

ALTER TABLE .. CLUSTER ON and SET WITHOUT CLUSTER are not supported for  
partitioned tables and already fail with a check happening when the  
sub-command is executed, not when it is prepared.  
  
This commit moves the relkind check for partitioned tables to happen  
when the sub-command is prepared in ATSimplePermissions().  This matches  
with the practice of the other sub-commands of ALTER TABLE, shaving one  
translatable string.  
  
mark_index_clustered() can be a bit simplified, switching one  
elog(ERROR) to an assertion.  Note that mark_index_clustered() can also  
be called through a CLUSTER command, but it cannot be reached for a  
partitioned table, per the assertion based on the relkind in  
cluster_rel(), and there is only one caller of rebuild_relation().  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAEoWx2kggo1N2kDH6OSfXHL_5gKg3DqQ0PdNuL4LH4XSTKJ3-g@mail.gmail.com  

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

Add stats_reset column to pg_statio_all_sequences

commit   : 8fe315f18d4181d37385c8e62ea3009084ba303a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 17:24:08 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 17:24:08 +0900    

Click here for diff

pg_statio_all_sequences lacked a stats_reset column, unlike the other  
pg_statio_* views that already expose it. This commit adds the column so  
users can see when the statistics in this view were last reset.  
  
Also this commit updates the documentation for  
pg_stat_reset_single_table_counters() to clarify that it can reset statistics  
for sequences and materialized views as well.  
  
Catalog version bumped.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Co-authored-by: Shihao Zhong <zhong950419@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0v0OPGyDpwxkX81CtTt9xsj9-TNxhm=8JdOvEKPsVVFNg@mail.gmail.com  

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

Fix accidentally casting away const

commit   : a41bc38439a1929a741eb6f1d40ed9eb30d9a8d7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 07:37:03 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Mar 2026 07:37:03 +0100    

Click here for diff

Recently introduced in commit 8c2b30487cc.  

M src/backend/parser/analyze.c

Remove obsolete speculative insert cleanup in ReorderBuffer.

commit   : 5f39698c9028554850fca6d3f764449c0da76d99    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 16 Mar 2026 10:14:22 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 16 Mar 2026 10:14:22 +0530    

Click here for diff

Commit 4daa140a2f introduced proper decoding for speculative aborts. As a  
result, the internal state is guaranteed to be clean when a new  
speculative insert is encountered. This patch removes the defensive  
cleanup code that is no longer reachable.  
  
Author: Antonin Houska <ah@cybertec.at>  
Discussion: https://postgr.es/m/23256.1772702981@localhost  

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

file_fdw: Add regression test for file_fdw with ON_ERROR='set_null'

commit   : d8879d34b9dd651080a4994b58fd7eb0e5049252    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 12:13:11 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Mar 2026 12:13:11 +0900    

Click here for diff

Commit 2a525cc97e1 introduced the ON_ERROR = 'set_null' option for COPY,  
allowing it to be used with foreign tables backed by file_fdw. However,  
unlike ON_ERROR = 'ignore', no regression test was added to verify  
this behavior for file_fdw.  
  
This commit adds a regression test to ensure that foreign tables using  
file_fdw work correctly with ON_ERROR = 'set_null', improving test coverage.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Yi Ding <dingyi_yale@163.com>  
Discussion: https://postgr.es/m/CAHGQGwGmPc6aHpA5=WxKreiDePiOEitfOFsW2dSo5m81xWXgRA@mail.gmail.com  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql

Optimize hash index bulk-deletion with streaming read

commit   : bfa3c4f106b1fb858ead1c8f05332f09d34f664a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Mar 2026 09:22:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Mar 2026 09:22:09 +0900    

Click here for diff

This commit refactors hashbulkdelete() to use streaming reads, improving  
the efficiency of the operation by prefetching upcoming buckets while  
processing a current bucket.  There are some specific changes required  
to make sure that the cleanup work happens in accordance to the data  
pushed to the stream read callback.  When the cached metadata page is  
refreshed to be able to process the next set of buckets, the stream is  
reset and the data fed to the stream read callback has to be updated.  
The reset needs to happen in two code paths, when _hash_getcachedmetap()  
is called.  
  
The author has seen better performance numbers than myself on this one  
(with tweaks similar to 6c228755add8).  The numbers are good enough for  
both of us that this change is worth doing, in terms of IO and runtime.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M src/backend/access/hash/hash.c
M src/tools/pgindent/typedefs.list

Move -ffast-math defense to float.c and remove the configure check.

commit   : 82ff54377e557914d975d22c4847d98d0efa1dac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 19:34:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 19:34:52 -0400    

Click here for diff

We had defenses against -ffast-math in timestamp-related files,  
which is a pretty obsolete place for them since we've not supported  
floating-point timestamps in a long time.  Remove those and instead  
put one in float.c, which is still broken by using this switch.  
Add some commentary to put more color on why it's a bad idea.  
  
Also remove the check from configure.  That was just there to fail  
faster, but it doesn't really seem necessary anymore, and besides  
we have no corresponding check in meson.build.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Suggested-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/abFXfKC8zR0Oclon%40ip-10-97-1-34.eu-west-3.compute.internal  

M configure
M configure.ac
M src/backend/utils/adt/date.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/timestamp.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c

Be more careful about int vs. Oid in ecpglib.

commit   : c675d80d7221411689d0f8ab18386d2f517eed0c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 18:55:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 18:55:37 -0400    

Click here for diff

Print an OID value inserted into a SQL query with %u not %d.  
The existing code accidentally fails to malfunction when  
given an OID above 2^31, but only accidentally; future changes  
to our SQL parser could perhaps break it.  
  
Declare the Oid values that ecpg_type_infocache_push() and  
ecpg_is_type_an_array() work with as "Oid" not "int".  
This doesn't have any functional effect, but it's clearer.  
  
At the moment I don't see a need to back-patch this.  
  
Bug: #19429  
Author: fairyfar@msn.com  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19429-aead3b1874be1a99@postgresql.org  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c

Optimize tuple deformation

commit   : c456e39113809376f6604e720910ccd24e18e034    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 16 Mar 2026 11:46:00 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 16 Mar 2026 11:46:00 +1300    

Click here for diff

This commit includes various optimizations to improve the performance of  
tuple deformation.  
  
We now precalculate CompactAttribute's attcacheoff, which allows us to  
remove the code from the deform routines which was setting the  
attcacheoff.  Setting the attcacheoff is now handled by  
TupleDescFinalize(), which must be called before the TupleDesc is used for  
anything.  Having TupleDescFinalize() means we can store the first  
attribute in the TupleDesc which does not have an offset cached.  That  
allows us to add a dedicated deforming loop to deform all attributes up  
to the final one with an attcacheoff set, or up to the first NULL  
attribute, whichever comes first.  
  
Here we also improve tuple deformation performance of tuples with NULLs.  
Previously, if the HEAP_HASNULL bit was set in the tuple's t_infomask,  
deforming would, one-by-one, check each and every bit in the NULL bitmap  
to see if it was zero.  Now, we process the NULL bitmap 1 byte at a time  
rather than 1 bit at a time to find the attnum with the first NULL.  We  
can now deform the tuple without checking for NULLs up to just before that  
attribute.  
  
We also record the maximum attribute number which is guaranteed to exist  
in the tuple, that is, has a NOT NULL constraint and isn't an  
atthasmissing attribute.  When deforming only attributes prior to the  
guaranteed attnum, we've no need to access the tuple's natt count.  As an  
additional optimization, we only count fixed-width columns when  
calculating the maximum guaranteed column, as this eliminates the need to  
emit code to fetch byref types in the deformation loop for guaranteed  
attributes.  
  
Some locations in the code deform tuples that have yet to go through NOT  
NULL constraint validation.  We're unable to perform the guaranteed  
attribute optimization when that's the case.  This optimization is opt-in  
via the TupleTableSlot using the TTS_FLAG_OBEYS_NOT_NULL_CONSTRAINTS  
flag.  
  
This commit also adds a more efficient way of populating the isnull  
array by using a bit-wise SWAR trick which performs multiplication on the  
inverse of the tuple's bitmap byte and masking out all but the lower bit  
of each of the boolean's byte.  This results in much more optimal code  
when compared to determining the NULLness via att_isnull().  8 isnull  
elements are processed at once using this method, which means we need to  
round the tts_isnull array size up to the next 8 bytes.  The palloc code  
does this anyway, but the round-up needed to be formalized so as not to  
overwrite the sentinel byte in MEMORY_CONTEXT_CHECKING builds.  Doing  
this also allows the NULL-checking deforming loop to more efficiently  
check the isnull array, rather than doing the bit-wise processing for each  
attribute that att_isnull() does.  
  
The level of performance improvement from these changes seems to vary  
depending on the CPU architecture.  Apple's M chips seem particularly  
fond of the changes, with some of the tested deform-heavy queries going  
over twice as fast as before.  With x86-64, the speedups aren't quite as  
large.  With tables containing only a small number of columns, the  
speedups will be less.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvpoFjaj3%2Bw_jD5uPnGazaw41A71tVJokLDJg2zfcigpMQ%40mail.gmail.com  

M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/tupdesc.c
M src/backend/access/spgist/spgutils.c
M src/backend/executor/execMain.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/include/access/tupdesc.h
M src/include/access/tupmacs.h
M src/include/executor/executor.h
M src/include/executor/tuptable.h

Add all required calls to TupleDescFinalize()

commit   : 503620311e3fc127708b00d4cd7eff6fd3154753    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 16 Mar 2026 11:45:49 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 16 Mar 2026 11:45:49 +1300    

Click here for diff

As of this commit all TupleDescs must have TupleDescFinalize() called on  
them once the TupleDesc is set up and before BlessTupleDesc() is called.  
  
In this commit, TupleDescFinalize() does nothing. This change has only  
been separated out from the commit that properly implements this function  
to make the change more obvious.  Any extension which makes its own  
TupleDesc will need to be modified to call the new function.  
  
The follow-up commit which properly implements TupleDescFinalize() will  
cause any code which forgets to do this to fail in assert-enabled builds in  
BlessTupleDesc().  It may still be worth mentioning this change in the  
release notes so that extension authors update their code.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvpoFjaj3%2Bw_jD5uPnGazaw41A71tVJokLDJg2zfcigpMQ%40mail.gmail.com  

M contrib/dblink/dblink.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_visibility/pg_visibility.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gistscan.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/backup/basebackup_copy.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/toasting.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/commands/wait.c
M src/backend/executor/execSRF.c
M src/backend/executor/execTuples.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/misc/guc_funcs.c
M src/include/access/tupdesc.h
M src/pl/plpgsql/src/pl_comp.c
M src/test/modules/test_custom_stats/test_custom_fixed_stats.c
M src/test/modules/test_predtest/test_predtest.c

Save a few bytes per CatCTup.

commit   : e5a77d876dbb6168e3013d32198794c535f1627d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 18:05:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 18:05:38 -0400    

Click here for diff

CatalogCacheCreateEntry() computed the space needed for a CatCTup  
as sizeof(CatCTup) + MAXIMUM_ALIGNOF.  That's not our usual style,  
and it wastes memory by allocating more padding than necessary.  
On 64-bit machines sizeof(CatCTup) would be maxaligned already  
since it contains pointer fields, therefore this code is wasting  
8 bytes compared to the more usual MAXALIGN(sizeof(CatCTup)).  
  
While at it, we don't really need to do MemoryContextSwitchTo()  
when we're only allocating one block.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/tencent_A42E0544C6184FE940CD8E3B14A3F0A39605@qq.com  

M src/backend/utils/cache/catcache.c

Fix small memory leak in get_dbname_oid_list_from_mfile().

commit   : bb53b8d359d33f10b6274be743c42f6e8ecfbb84    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 15:24:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 15 Mar 2026 15:24:04 -0400    

Click here for diff

Coverity complained that this function leaked the dumpdirpath string,  
which it did.  But we don't need to make a copy at all, because  
there's not really any point in trimming trailing slashes from the  
directory name here.  If that were needed, the initial  
file_exists_in_directory() test would have failed, since it doesn't  
bother with that (and neither does anyplace else in this file).  
Moreover, if we did want that, reimplementing canonicalize_path()  
poorly is not the way to proceed.  Arguably, all of this code should  
be reexamined with an eye to using src/port/path.c's facilities, but  
for today I'll settle for getting rid of the memory leak.  

M src/bin/pg_dump/pg_restore.c

pg_restore: Remove dead code in restore_all_databases()

commit   : a793677e57bc27c674cb94b230164b2c28f4cbae    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 15 Mar 2026 12:09:36 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 15 Mar 2026 12:09:36 -0400    

Click here for diff

Cleanup from commit 763aaa06f03.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
Discussion: https://postgr.es/m/CAKYtNAqN49Hqd4v0wWH3uW6d6QsH+8e8bR_MVf4CboTZSzd+Aw@mail.gmail.com  

M src/bin/pg_dump/pg_restore.c

Save vmbuffer in heap-specific scan descriptors for on-access pruning

commit   : 99bf1f8aa6cd8029cb9ce17d4a804eed386bec97    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 11:09:10 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 11:09:10 -0400    

Click here for diff

Future commits will use the visibility map in on-access pruning to fix  
VM corruption and set the VM if the page is all-visible.  
  
Saving the vmbuffer in the scan descriptor reduces the number of times  
it would need to be pinned and unpinned, making the overhead of doing so  
negligible.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/C3AB3F5B-626E-4AAA-9529-23E9A20C727F%40gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/include/access/heapam.h

Avoid BufferGetPage() calls in heap_update()

commit   : 8d2c1df4f4c54d0a73fcabaf5e25bc55ce7fb5fa    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 10:42:34 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 10:42:34 -0400    

Click here for diff

BufferGetPage() isn't cheap and heap_update() calls it multiple times  
when it could just save the page from a single call. Do that.  
While we are at it, make separate variables for old and new page in  
heap_xlog_update(). It's confusing to reuse "page" for both pages.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_a%2BhO4PCptyaPR7AMZd7FjcHfOFKKJT8ouU3KedMud0tQ%40mail.gmail.com  

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

Initialize missing fields in CreateExecutorState()

commit   : a3511443e5e1cb59bae86d0757aa727dda099704    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 10:12:16 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Sun, 15 Mar 2026 10:12:16 -0400    

Click here for diff

d47cbf474ec and cbc127917e0 forgot to initialize a few fields they  
introduced in the EState, so do that now.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/F5CDD1B5-628C-44A1-9F85-3958C626F6A9%40gmail.com  

M src/backend/executor/execUtils.c

Make typeof and typeof_unqual fallback definitions work on C++11

commit   : cd083b54bd675a6c941b2d52f398cebbf95b060f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 15 Mar 2026 07:36:27 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 15 Mar 2026 07:36:27 +0100    

Click here for diff

These macros were unintentionally using C++14 features. This replaces  
them with valid C++11 code.  
  
Tested locally by compiling with -std=c++11 (which reproduced the  
original issue).  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M src/include/c.h

Switch the semaphore API on Solaris to unnamed POSIX.

commit   : 0123ce131fca454009439dfa3b2266d1d40737d7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Mar 2026 14:10:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Mar 2026 14:10:32 -0400    

Click here for diff

Solaris descendants (Illumos, OpenIndiana, OmniOS, etc.) hit System V  
semaphore limits ("No space left on device" from semget) when running  
many parallel test scripts under default system settings.  We could  
tell people to raise those settings, but there's a better answer.  
Unnamed POSIX semaphores have been available on Solaris for decades  
and work well, so prefer them, as was recently done for AIX.  
  
This patch also updates the documentation to remove now-unnecessary  
advice about raising project.max-sem-ids and project.max-msg-ids.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Greg Burd <greg@burd.me>  
Discussion: https://postgr.es/m/470305.1772417108@sss.pgh.pa.us  

M doc/src/sgml/runtime.sgml
M meson.build
M src/template/solaris

Fix aclitemout() to work during early bootstrap.

commit   : 2eb87345e18e18395bc5051f72c9f4ca30d70c38    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Mar 2026 13:46:54 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 14 Mar 2026 13:46:54 -0400    

Click here for diff

"initdb -d" has been broken since commit f95d73ed4, because I changed  
aclitemin to work in bootstrap mode but failed to consider aclitemout.  
That routine isn't reached by default, but it is if the elog message  
level is high enough, so it needs to work without catalog access too.  
  
This patch just makes it use its existing code paths to print role  
OIDs numerically.  We could alternatively invent an inverse of  
boot_get_role_oid() and print them symbolically, but that would take  
more code and it's not apparent that it'd be any better for debugging  
purposes.  
  
Reported-by: Greg Burd <greg@burd.me>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/4416.1773328045@sss.pgh.pa.us  

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

Tighten asserts on ParallelWorkerNumber

commit   : 02eecead8678a9afe6047d42692f752e3ec0639c    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 14 Mar 2026 15:24:37 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 14 Mar 2026 15:24:37 +0100    

Click here for diff

The comment about ParallelWorkerNumbr in parallel.c says:  
  
  In parallel workers, it will be set to a value >= 0 and < the number  
  of workers before any user code is invoked; each parallel worker will  
  get a different parallel worker number.  
  
However asserts in various places collecting instrumentation allowed  
(ParallelWorkerNumber == num_workers). That would be a bug, as the value  
is used as index into an array with num_workers entries.  
  
Fixed by adjusting the asserts accordingly. Backpatch to all supported  
versions.  
  
Discussion: https://postgr.es/m/5db067a1-2cdf-4afb-a577-a04f30b69167@vondra.me  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Backpatch-through: 14  

M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeSort.c

pgstattuple: Optimize pgstattuple_approx() with streaming read

commit   : ae58189a4d523f0156ebe30f4534180555669e88    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 Mar 2026 15:06:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 Mar 2026 15:06:13 +0900    

Click here for diff

This commit plugs into pgstattuple_approx(), the SQL function faster  
than pgstattuple() that returns approximate results, the streaming read  
APIs.  A callback is used to be able to skip all-visible pages via VM  
lookup, to match with the logic prior to this commit.  
  
Under test conditions similar to 6c228755add8 (some dm_delay and  
debug_io_direct=data), this can substantially improve the execution time  
of the function, particularly for large relations.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M contrib/pgstattuple/pgstatapprox.c
M src/tools/pgindent/typedefs.list

Allow sibling call optimization in slot_getsomeattrs_int()

commit   : 4deecb52affa4b6f791e8a57f6584610e4dd12f4    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 14 Mar 2026 13:52:09 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 14 Mar 2026 13:52:09 +1300    

Click here for diff

This changes the TupleTableSlotOps contract to make it so the  
getsomeattrs() function is in charge of calling  
slot_getmissingattrs().  
  
Since this removes all code from slot_getsomeattrs_int() aside from the  
getsomeattrs() call itself, we may as well adjust slot_getsomeattrs() so  
that it calls getsomeattrs() directly.  We leave slot_getsomeattrs_int()  
intact as this is still called from the JIT code.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAApHDvodSVBj3ypOYbYUCJX%2BNWL%3DVZs63RNBQ_FxB_F%2B6QXF-A%40mail.gmail.com  

M src/backend/executor/execTuples.c
M src/include/executor/tuptable.h

Use fake LSNs to improve nbtree dropPin behavior.

commit   : 8a879119a1d12ff0a410fe3b64ad15069c3a377c    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 13 Mar 2026 20:37:39 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 13 Mar 2026 20:37:39 -0400    

Click here for diff

Use fake LSNs in all nbtree critical sections that write a WAL record.  
That way we can safely apply the _bt_killitems LSN trick with logged and  
unlogged indexes alike.  This brings the same benefits to plain scans of  
unlogged relations that commit 2ed5b87f brought to plain scans of logged  
relations: scans will drop their leaf page pin eagerly (by applying the  
"dropPin" optimization), which avoids blocking progress by VACUUM.  This  
is particularly helpful with applications that allow a scrollable cursor  
to remain idle for long periods.  
  
Preparation for an upcoming commit that will add the amgetbatch  
interface, and switch nbtree over to it (from amgettuple) to enable I/O  
prefetching.  The index prefetching read stream's effective prefetch  
distance is adversely affected by any buffer pins held by the index AM.  
At the same time, it can be useful for prefetching to read dozens of  
leaf pages ahead of the scan to maintain an adequate prefetch distance.  
  
The index prefetching patch avoids this tension by always eagerly  
dropping index page pins of the kind traditionally held as an interlock  
against unsafe concurrent TID recycling by VACUUM (essentially the same  
way that amgetbitmap routines have always avoided holding onto pins).  
The work from this commit makes that possible during scans of nbtree  
unlogged indexes -- without our having to give up on setting LP_DEAD  
bits on index tuples altogether.  
  
Follow-up to commit d774072f, which moved the fake LSN infrastructure  
out of GiST so that it could be used by other index AMs.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Reviewed-By: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/CAH2-WzkehuhxyuA8quc7rRN3EtNXpiKsjPfO8mhb+0Dr2K0Dtg@mail.gmail.com  

M src/backend/access/nbtree/README
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c

Move fake LSN infrastructure out of GiST.

commit   : d774072f0040f9acf148cc9740b79857fbde7042    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 13 Mar 2026 19:38:17 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 13 Mar 2026 19:38:17 -0400    

Click here for diff

Move utility functions used by GiST to generate fake LSNs into xlog.c  
and xloginsert.c, so that other index AMs can also generate fake LSNs.  
  
Preparation for an upcoming commit that will add support for fake LSNs  
to nbtree, allowing its dropPin optimization to be used during scans of  
unlogged relations.  That commit is itself preparation for another  
upcoming commit that will add a new amgetbatch/btgetbatch interface to  
enable I/O prefetching.  
  
Bump XLOG_PAGE_MAGIC due to XLOG_GIST_ASSIGN_LSN becoming  
XLOG_ASSIGN_LSN.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Reviewed-By: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/CAH2-WzkehuhxyuA8quc7rRN3EtNXpiKsjPfO8mhb+0Dr2K0Dtg@mail.gmail.com  

M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/gist_private.h
M src/include/access/gistxlog.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xloginsert.h
M src/include/catalog/pg_control.h

Add error code to user-visible message.

commit   : 9b860373da5e2d05010e15ca697c8a11c5c0a395    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 13 Mar 2026 16:07:54 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 13 Mar 2026 16:07:54 -0700    

Click here for diff

Reported-by: Alexander Lakhin <exclusion@gmail.com>  

M src/backend/foreign/foreign.c

Use GetXLogInsertEndRecPtr in gistGetFakeLSN

commit   : b1f14c9672026a647b826455f03552ca30846e48    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 13 Mar 2026 22:42:29 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 13 Mar 2026 22:42:29 +0100    

Click here for diff

The function used GetXLogInsertRecPtr() to generate the fake LSN. Most  
of the time this is the same as what XLogInsert() would return, and so  
it works fine with the XLogFlush() call. But if the last record ends at  
a page boundary, GetXLogInsertRecPtr() returns LSN pointing after the  
page header. In such case XLogFlush() fails with errors like this:  
  
  ERROR: xlog flush request 0/01BD2018 is not satisfied --- flushed only to 0/01BD2000  
  
Such failures are very hard to trigger, particularly outside aggressive  
test scenarios.  
  
Fixed by introducing GetXLogInsertEndRecPtr(), returning the correct LSN  
without skipping the header. This is the same as GetXLogInsertRecPtr(),  
except that it calls XLogBytePosToEndRecPtr().  
  
Initial investigation by me, root cause identified by Andres Freund.  
  
This is a long-standing bug in gistGetFakeLSN(), probably introduced by  
c6b92041d38 in PG13. Backpatch to all supported versions.  
  
Reported-by: Peter Geoghegan <pg@bowt.ie>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Discussion: https://postgr.es/m/vf4hbwrotvhbgcnknrqmfbqlu75oyjkmausvy66ic7x7vuhafx@e4rvwavtjswo  
Backpatch-through: 14  

M src/backend/access/gist/gistutil.c
M src/backend/access/transam/xlog.c
M src/include/access/xlog.h

Free memory allocated for unrecognized_protocol_options

commit   : 311a851436cb39145baff61a2936c5d327b040e3    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 23:37:19 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 23:37:19 +0200    

Click here for diff

Since 4966bd3ed95e Valgrind started to warn about little amount of  
memory being leaked in ProcessStartupPacket(). This is not critical  
but the warnings may distract from real issues. Fix it by freeing the  
list after use.  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://www.postgresql.org/message-id/CAJ7c6TN3Hbb5p=UHx0SPVN+h_JwPAV6rxoqOm7gHBMFKfnGK-Q@mail.gmail.com  

M src/backend/tcop/backend_startup.c

Add convenience view to stats import test.

commit   : 233bbdf031e4832a409e3028b45d709e7ddb93c9    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 15:04:10 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 15:04:10 -0500    

Click here for diff

Presently, many statements in stats_import.sql select all columns  
from the pg_stats system view.  A proposed follow-up commit would  
add columns to this view (some of which are not stable across test  
runs), breaking all of these tests.  This commit introduces a  
convenience view for those statements so that future changes are  
minimally disruptive.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CADkLM%3DcoCVy92QkVUUTLdo5eO2bMDtwMrzRn_8miAhX%2BuPaqXg%40mail.gmail.com  

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

Fix bug due to confusion about what IsMVCCSnapshot means

commit   : ce5d489166e5c8437aa1a35f462f67f1aeae87d4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 13 Mar 2026 12:11:05 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 13 Mar 2026 12:11:05 -0400    

Click here for diff

In 0b96e734c59 I (Andres) relied on page_collect_tuples() being called only  
with an MVCC snapshot, and added assertions to that end, but did not realize  
that IsMVCCSnapshot() allows both proper MVCC snapshots and historical  
snapshots, which behave quite similarly to MVCC snapshots.  
  
Unfortunately that can lead to incorrect visibility results during logical  
decoding, as a historical snapshot is interpreted as a plain MVCC  
snapshot. The only reason this wasn't noticed earlier is that it's hard to  
reach as most of the time there are no sequential scans during logical  
decoding.  
  
To fix the bug and avoid issues like this in the future, split  
IsMVCCSnapshot() into IsMVCCSnapshot() and IsMVCCLikeSnapshot(), where now  
only the latter includes historic snapshots.  
  
One effect of this is that during logical decoding no page-at-a-time snapshots  
are used, as otherwise runtime branches to handle historic snapshots would be  
needed in some performance critical paths. Given how uncommon sequential scans  
are during logical decoding, that seems acceptable.  
  
Author: Antonin Houska <ah@cybertec.at>  
Reported-by: Antonin Houska <ah@cybertec.at>  
Discussion: https://postgr.es/m/61812.1770637345@localhost  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/index/indexam.c
M src/backend/access/nbtree/nbtree.c
M src/include/utils/snapmgr.h

libpq-oauth: Fix Makefile dependencies

commit   : b634c4e0e8f47186c664f7141e8ab0b73c50eb0c    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 10:34:03 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 10:34:03 -0700    

Click here for diff

As part of 6225403f2, I'd removed the override for the `stlib` target,  
since NAME no longer contains a major version number. But I forgot that  
its dependencies are declared before Makefile.shlib is included; those  
dependencies were then omitted entirely.  
  
Per buildfarm member indri, which appears to be the only system so far  
that's bothered by an empty archive.  

M src/interfaces/libpq-oauth/Makefile

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

commit   : 1c33a2d81db16212754845691817e22cd3501cb6    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:45:34 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:45:34 -0500    

Click here for diff

M .git-blame-ignore-revs

commit   : dba35604485feff679893f22a79e8c0f3ee6fc0e    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 09:38:04 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 09:38:04 -0700    

Click here for diff

Now that libpq-oauth doesn't have to match the major version of libpq,  
some things in pg_wchar.h are technically unsafe for us to use. (See  
b6c7cfac8 for a fuller discussion.) This is unlikely to be a problem --  
we only care about UTF-8 in the context of OAuth right now -- but if  
anyone did introduce a way to hit it, it'd be extremely difficult to  
debug or reproduce, and it'd be a potential security vulnerability to  
boot.  
  
Define USE_PRIVATE_ENCODING_FUNCS so that anyone who tries to add a  
dependency on the exported APIs will simply fail to link the shared  
module.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  

M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build

libpq-oauth: Use the PGoauthBearerRequestV2 API

commit   : 6225403f2783dae16be57120618522d255bd6cc8    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 09:37:59 -0700    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 13 Mar 2026 09:37:59 -0700    

Click here for diff

Switch the private libpq-oauth ABI to a public one, based on the new  
PGoauthBearerRequestV2 API. A huge amount of glue code can be removed as  
part of this, and several code paths can be deduplicated. Additionally,  
the shared library no longer needs to change its name for every major  
release; it's now just "libpq-oauth.so".  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  

M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/README
M src/interfaces/libpq-oauth/exports.txt
M src/interfaces/libpq-oauth/meson.build
M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq-oauth/oauth-curl.h
M src/interfaces/libpq-oauth/oauth-utils.c
M src/interfaces/libpq-oauth/oauth-utils.h
M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h
M src/tools/pgindent/typedefs.list

Initialize variable to placate compiler.

commit   : be43c48c22cc8a4f55258e5230d23909e13c5efd    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:32:14 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:32:14 -0500    

Click here for diff

Since commit 5883ff30b0, some compilers have been warning that the  
rtekind variable in unique_nonjoin_rtekind() may be used  
uninitialized.  There doesn't appear to be any actual risk, so  
let's just initialize it to something to silence the compiler  
warnings.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0sieVNfniCKMDdDjuXGd1OuzMQfTS5%3D9vX3sa-iiujKUA%40mail.gmail.com  

M contrib/pg_plan_advice/pgpa_scan.c

Optimize COPY FROM (FORMAT {text,csv}) using SIMD.

commit   : e0a3a3fd5361913502ff696ecf47770ca55975ae    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:07:32 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 13 Mar 2026 11:07:32 -0500    

Click here for diff

Presently, such commands scan the input buffer one byte at a time  
looking for special characters.  This commit adds a new path that  
uses SIMD instructions to skip over chunks of data without any  
special characters.  This can be much faster.  
  
To avoid regressions, SIMD processing is disabled for the remainder  
of the COPY FROM command as soon as we encounter a short line or a  
special character (except for end-of-line characters, else we'd  
always disable it after the first line).  This is perhaps too  
conservative, but it could probably be made more lenient in the  
future via fine-tuned heuristics.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Co-authored-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Ayoub Kazar <ma_kazar@esi.dz>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Neil Conway <neil.conway@gmail.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Tested-by: Manni Wood <manni.wood@enterprisedb.com>  
Tested-by: Mark Wong <markwkm@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurSW8cNr6TPKsjrstnPfhf4QyQqB4tnPXGGe8N4e_v7Jig%40mail.gmail.com  

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

Factor out constructSetOpTargetlist() from transformSetOperationTree()

commit   : 8c2b30487cc7e8797ca78f3b089ae0fec199f1a9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 Mar 2026 16:08:09 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 Mar 2026 16:08:09 +0100    

Click here for diff

This would be used separately by a future patch.  It also makes a  
little smaller.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M src/backend/parser/analyze.c

Add callback for I/O error messages in SLRUs

commit   : f9de9bf302d2df41da06c6377ba1904883cd9d51    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 16:21:06 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 16:21:06 +0200    

Click here for diff

Historically, all SLRUs were addressed by transaction IDs, but that  
hasn't been true for a long time. However, the error message on I/O  
error still always talked about accessing a transaction ID.  
  
This commit adds a callback that allows subsystems to construct their  
own error messages, which can then correctly refer to a transaction  
ID, multixid or whatever else is used to address the particular SLRU.  
  
Author: Maxim Orlov <orlovmg@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://www.postgresql.org/message-id/CACG=ezZZfurhYV+66ceubxQAyWqv9vaUi0yoO4-t48OE5xc0DQ@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/backend/access/transam/subtrans.c
M src/backend/commands/async.c
M src/backend/storage/lmgr/predicate.c
M src/include/access/slru.h
M src/test/modules/test_slru/expected/test_slru.out
M src/test/modules/test_slru/sql/test_slru.sql
M src/test/modules/test_slru/test_slru–1.0.sql
M src/test/modules/test_slru/test_slru.c
M src/tools/pgindent/typedefs.list

Add stats_reset column to pg_stat_database_conflicts.

commit   : 723619eaa3a85f32ce8c2d32c063da26f89ca8d2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 13 Mar 2026 22:17:14 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 13 Mar 2026 22:17:14 +0900    

Click here for diff

This commit adds a stats_reset column to pg_stat_database_conflicts,  
allowing users to see when the statistics in this view were last reset.  
This makes the view consistent with pg_stat_database and other statistics  
views.  
  
Catalog version bumped.  
  
Author: Shihao Zhong <zhong950419@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAGRkXqS98OebEWjax99_LVAECsxCB8i=BfsdAL34i-5QHfwyOQ@mail.gmail.com  

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

Check for interrupts during non-fast-update GIN insertion

commit   : 2e1dcf8c5424309305182af4700314cf59bab6b0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 15:12:32 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 15:12:32 +0200    

Click here for diff

ginExtractEntries() can produce a lot of entries for a single item.  
During index build, we check for interrupts between entries, and the  
fast-update codepath does it as part of vacuum_delay_point(), but the  
non-fast update insertion codepath was uninterruptible. Add  
CHECK_FOR_INTERRUPTS() between entries in the non-fast update codepath  
too.  
  
Author: Vinod Sridharan <vsridh90@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAFMdLD6mQvAuStiOGvBJxAEfo6wdjZhj3+JveTLxOX8MVn4zmA@mail.gmail.com  

M src/backend/access/gin/gininsert.c

Rework ginScanToDelete() to pass Buffers instead of BlockNumbers.

commit   : fa6f2f624c01bba6e4c7b6920256afcc1ee17eb2    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 21 Feb 2026 11:08:08 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 21 Feb 2026 11:08:08 +0200    

Click here for diff

Previously, ginScanToDelete() and ginDeletePage() passed BlockNumbers and  
re-read pages that were already pinned and locked during the tree walk.  The  
caller ginVacuumPostingTree()) held a cleanup-locked root buffer, yet  
ginScanToDelete() re-read it by block number with special-case code to skip  
re-locking.  
  
At first, this commit gives both functions more appropriate names,  
ginScanPostingTreeToDelete() and ginDeletePostingPage(), indicating they deal  
with posting trees/pages.  This is more descriptive and similar to the way we  
name other GIN functions, for instance, ginVacuumPostingTree() and  
ginVacuumPostingTreeLeaves().  
  
Then rework both functions to pass Buffers directly.  DataPageDeleteStack now  
carries buffer, myoff (downlink offset in parent), and isRoot per level,  
so ginScanPostingTreeToDelete() takes only GinVacuumState and  
DataPageDeleteStack pointers.  Also, ginDeletePostingPage() receives the three  
Buffers directly, and no longer reads or releases them itself.  The caller  
reads and locks child pages before recursing, and manages buffer lifecycle  
afterward.  
  
This eliminates the confusing isRoot special cases in buffer management,  
including the apparent (but unreachable) double release of the root  
buffer identified by Andres Freund.  
  
Add comments explaining the locking protocol and the DataPageDeleteStack  
structure.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/utrlxij43fbguzw4kldte2spc4btoldizutcqyrfakqnbrp3ir@ph3sphpj4asz  
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Jinbinge <jinbinge@126.com>  

M src/backend/access/gin/README
M src/backend/access/gin/ginvacuum.c

Fix pointer type of ShmemAllocatorData->index

commit   : f30cebb9542358702ca0f2c4be2cd504a2568606    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 11:00:15 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 13 Mar 2026 11:00:15 +0200    

Click here for diff

This went unnoticed in commit e2362eb2bd because the pointer is cast  
to/from a void pointer.  

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

xml2: Fix failure with xslt_process() under -fsanitize=undefined

commit   : 7d64419f8073dafdb8ae28c20b1323bf6a93c55e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Mar 2026 16:06:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Mar 2026 16:06:28 +0900    

Click here for diff

The logic of xslt_process() has never considered the fact that  
xsltSaveResultToString() would return NULL for an empty string (the  
upstream code has always done so, with a string length of 0).  This  
would cause memcpy() to be called with a NULL pointer, something  
forbidden by POSIX.  
  
Like 46ab07ffda9d and similar fixes, this is backpatched down to all the  
supported branches, with a test case to cover this scenario.  An empty  
string has been always returned in xml2 in this case, based on the  
history of the module, so this is an old issue.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/c516a0d9-4406-47e3-9087-5ca5176ebcf9@gmail.com  
Backpatch-through: 14  

M contrib/xml2/expected/xml2.out
M contrib/xml2/expected/xml2_1.out
M contrib/xml2/sql/xml2.sql
M contrib/xml2/xslt_proc.c

Change copyObject() to use typeof_unqual

commit   : 59292f7aac72305f8e47f19155e6c7e0a070acb9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 Mar 2026 06:34:24 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 Mar 2026 06:34:24 +0100    

Click here for diff

Currently, when the argument of copyObject() is const-qualified, the  
return type is also, because the use of typeof carries over all the  
qualifiers.  This is incorrect, since the point of copyObject() is to  
make a copy to mutate.  But apparently no code ran into it.  
  
The new implementation uses typeof_unqual, which drops the qualifiers,  
making this work correctly.  
  
typeof_unqual is standardized in C23, but all recent versions of all  
the usual compilers support it even in non-C23 mode, at least as  
__typeof_unqual__.  We add a configure/meson test for typeof_unqual  
and __typeof_unqual__ and use it if it's available, else we use the  
existing fallback of just returning void *.  
  
This is the second attempt, after the first attempt in commit  
4cfce4e62c8 was reverted.  The following two points address problems  
with the earlier version:  
  
We test the underscore variant first so that there is a higher chance  
that clang used for bitcode also supports it, since we don't test that  
separately.  
  
Unlike the typeof test, the typeof_unqual test also tests with a void  
pointer similar to how copyObject() would use it, because that is not  
handled by MSVC, so we want the test to fail there.  
  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/nodes/nodes.h
M src/include/pg_config.h.in
M src/test/modules/test_cplusplusext/test_cplusplusext.cpp

pgstattuple: Optimize btree and hash index functions with streaming read

commit   : 213f0079b3415ad8f5f0a62d119ed1f0a448ad8f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Mar 2026 10:48:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Mar 2026 10:48:45 +0900    

Click here for diff

This commit replaces the synchronous ReadBufferExtended() loops with the  
streaming read routines, affecting pgstatindex() (for btree) and  
pgstathashindex() (for hash indexes).  
  
Under test conditions similar to 6c228755add8 (some dm_delay and  
debug_io_direct=data), this can result in nice runtime and IO gains.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M contrib/pgstattuple/pgstatindex.c

Enable fast default for domains with non-volatile constraints

commit   : a0b6ef29a51818a4073a5f390ed10ef6453d5c11    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 12 Mar 2026 17:53:09 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 12 Mar 2026 17:53:09 -0400    

Click here for diff

Previously, ALTER TABLE ADD COLUMN always forced a table rewrite when  
the column type was a domain with constraints (CHECK or NOT NULL), even  
if the default value satisfied those constraints.  This was because  
contain_volatile_functions() considers CoerceToDomain immutable, so  
the code conservatively assumed any constrained domain might fail.  
  
Improve this by using soft error handling (ErrorSaveContext) to evaluate  
the CoerceToDomain expression at ALTER TABLE time.  If the default value  
passes the domain's constraints, the value is stored as a "missing"  
attribute default and no table rewrite is needed.  If the constraint  
check fails, we fall back to a table rewrite, preserving the historical  
behavior that constraint violations are only raised when the table  
actually contains rows.  
  
Domains with volatile constraint expressions always require a table  
rewrite since the constraint result could differ per evaluation and  
cannot be cached.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Viktor Holmberg <viktor.holmberg@aiven.io>  
Discussion: https://postgr.es/m/CACJufxE_+iZBR1i49k_AHigppPwLTJi6km8NOsC7FWvKdEmmXg@mail.gmail.com  

M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/include/executor/executor.h
M src/test/regress/expected/fast_default.out
M src/test/regress/sql/fast_default.sql

Extend DomainHasConstraints() to optionally check constraint volatility

commit   : 487cf2cbd2f5a32cf9756eb9bd6dbf9f3956c8b7    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 12 Mar 2026 17:52:33 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 12 Mar 2026 17:52:33 -0400    

Click here for diff

Add an optional bool *has_volatile output parameter to  
DomainHasConstraints().  When non-NULL, the function checks whether any  
CHECK constraint contains a volatile expression.  Callers that don't  
need this information pass NULL and get the same behavior as before.  
  
This is needed by a subsequent commit that enables the fast default  
optimization for domains with non-volatile constraints: we can safely  
evaluate such constraints once at ALTER TABLE time, but volatile  
constraints require a full table rewrite.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Viktor Holmberg <viktor.holmberg@aiven.io>  
Discussion: https://postgr.es/m/CACJufxE_+iZBR1i49k_AHigppPwLTJi6km8NOsC7FWvKdEmmXg@mail.gmail.com  

M src/backend/commands/copyfrom.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_expr.c
M src/backend/utils/cache/typcache.c
M src/include/utils/typcache.h

Document the 'command' column of pg_stat_progress_repack

commit   : a630ac5c2016e523a1c29df117b7c1a563a7f6f8    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 12 Mar 2026 19:19:23 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 12 Mar 2026 19:19:23 +0100    

Click here for diff

Commit ac58465e0618 added and documented a new progress-report view for  
REPACK, but neglected to list the 'command' column in the docs.  This is  
my (Álvaro's) fail, as I added the column in v23 of the patch and forgot  
to document it.  
  
In passing, add a note in the docs for pg_stat_progress_cluster that it  
might contain rows for sessions running REPACK, though mapping the  
command name to either the older commands; and that it is for backwards-  
compatibility only.  (Maybe we should just remove this older view.)  
  
Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>  
Discussion: https://postgr.es/m/LV8PR84MB37870F0F35EF2E8CB99768CBEE47A@LV8PR84MB3787.NAMPRD84.PROD.OUTLOOK.COM  
Discussion: https://postgr.es/m/202510101352.vvp4p3p2dblu@alvherre.pgsql  

M doc/src/sgml/monitoring.sgml

Use simplehash for backend-private buffer pin refcounts.

commit   : a367c433ad015b889ee296b07de00017819915c4    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 12 Mar 2026 13:26:16 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 12 Mar 2026 13:26:16 -0400    

Click here for diff

Replace dynahash with simplehash for the per-backend PrivateRefCountHash  
overflow table.  Simplehash generates inlined, open-addressed lookup  
code, avoiding the per-call overhead of dynahash that becomes noticeable  
when many buffers are pinned with a CPU-bound workload.  
  
Motivated by testing of the index prefetching patch, which pins many  
more buffers concurrently than typical index scans.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-By: Tomas Vondra <tomas@vondra.me>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/tools/pgindent/typedefs.list

nbtree: Avoid allocating _bt_search stack.

commit   : d071e1cfec23505e0f55f06988c0144f16235586    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 12 Mar 2026 13:22:36 -0400    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 12 Mar 2026 13:22:36 -0400    

Click here for diff

Avoid allocating memory for an nbtree descent stack during index scans.  
We only require a descent stack during inserts, when it is used to  
determine where to insert a new pivot tuple/downlink into the target  
leaf page's parent page in the event of a page split.  (Page deletion's  
first phase also performs a _bt_search that requires a descent stack.)  
  
This optimization improves performance by minimizing palloc churn.  It  
speeds up index scans that call _bt_search frequently/descend the index  
many times, especially when the cost of scanning the index dominates  
(e.g., with index-only skip scans).  Testing has shown that the  
underlying issue causes performance problems for an upcoming patch that  
will replace btgettuple with a new btgetbatch interface to enable I/O  
prefetching.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/CAH2-Wzmy7NMba9k8m_VZ-XNDZJEUQBU8TeLEeL960-rAKb-+tQ@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Add pg_plan_advice contrib module.

commit   : 5883ff30b02ceed3c5eabba4d9c09a7766f9a8fc    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 12 Mar 2026 12:59:52 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 12 Mar 2026 12:59:52 -0400    

Click here for diff

Provide a facility that (1) can be used to stabilize certain plan choices  
so that the planner cannot reverse course without authorization and  
(2) can be used by knowledgeable users to insist on plan choices contrary  
to what the planner believes best. In both cases, terrible outcomes are  
possible: users should think twice and perhaps three times before  
constraining the planner's ability to do as it thinks best; nevertheless,  
there are problems that are much more easily solved with these facilities  
than without them.  
  
This patch takes the approach of analyzing a finished plan to produce  
textual output, which we call "plan advice", that describes key  
decisions made during plan; if that plan advice is provided during  
future planning cycles, it will force those key decisions to be made in  
the same way.  Not all planner decisions can be controlled using advice;  
for example, decisions about how to perform aggregation are currently  
out of scope, as is choice of sort order. Plan advice can also be edited  
by the user, or even written from scratch in simple cases, making it  
possible to generate outcomes that the planner would not have produced.  
Partial advice can be provided to control some planner outcomes but not  
others.  
  
Currently, plan advice is focused only on specific outcomes, such as  
the choice to use a sequential scan for a particular relation, and not  
on estimates that might contribute to those outcomes, such as a  
possibly-incorrect selectivity estimate. While it would be useful to  
users to be able to provide plan advice that affects selectivity  
estimates or other aspects of costing, that is out of scope for this  
commit.  
  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Dian Fay <di@nmfay.com>  
Reviewed-by: Ajay Pal <ajay.pal.k@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com  

M contrib/Makefile
M contrib/meson.build
A contrib/pg_plan_advice/.gitignore
A contrib/pg_plan_advice/Makefile
A contrib/pg_plan_advice/README
A contrib/pg_plan_advice/expected/gather.out
A contrib/pg_plan_advice/expected/join_order.out
A contrib/pg_plan_advice/expected/join_strategy.out
A contrib/pg_plan_advice/expected/partitionwise.out
A contrib/pg_plan_advice/expected/prepared.out
A contrib/pg_plan_advice/expected/scan.out
A contrib/pg_plan_advice/expected/semijoin.out
A contrib/pg_plan_advice/expected/syntax.out
A contrib/pg_plan_advice/meson.build
A contrib/pg_plan_advice/pg_plan_advice.c
A contrib/pg_plan_advice/pg_plan_advice.h
A contrib/pg_plan_advice/pgpa_ast.c
A contrib/pg_plan_advice/pgpa_ast.h
A contrib/pg_plan_advice/pgpa_identifier.c
A contrib/pg_plan_advice/pgpa_identifier.h
A contrib/pg_plan_advice/pgpa_join.c
A contrib/pg_plan_advice/pgpa_join.h
A contrib/pg_plan_advice/pgpa_output.c
A contrib/pg_plan_advice/pgpa_output.h
A contrib/pg_plan_advice/pgpa_parser.y
A contrib/pg_plan_advice/pgpa_planner.c
A contrib/pg_plan_advice/pgpa_planner.h
A contrib/pg_plan_advice/pgpa_scan.c
A contrib/pg_plan_advice/pgpa_scan.h
A contrib/pg_plan_advice/pgpa_scanner.l
A contrib/pg_plan_advice/pgpa_trove.c
A contrib/pg_plan_advice/pgpa_trove.h
A contrib/pg_plan_advice/pgpa_walker.c
A contrib/pg_plan_advice/pgpa_walker.h
A contrib/pg_plan_advice/sql/gather.sql
A contrib/pg_plan_advice/sql/join_order.sql
A contrib/pg_plan_advice/sql/join_strategy.sql
A contrib/pg_plan_advice/sql/partitionwise.sql
A contrib/pg_plan_advice/sql/prepared.sql
A contrib/pg_plan_advice/sql/scan.sql
A contrib/pg_plan_advice/sql/semijoin.sql
A contrib/pg_plan_advice/sql/syntax.sql
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
A doc/src/sgml/pgplanadvice.sgml
M src/tools/pgindent/typedefs.list

doc: Document variables for path substitution in SQL tests

commit   : 02976b0a1718037f73fded250411b013e81fdafa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 16:35:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 16:35:58 +0900    

Click here for diff

Test suites driven by pg_regress can use the following environment  
variables for path substitutions since d1029bb5a26c:  
- PG_ABS_SRCDIR  
- PG_ABS_BUILDDIR  
- PG_DLSUFFIX  
- PG_LIBDIR  
  
These variables have never been documented, and they can be useful for  
out-of-core code based on the options used by the pg_regress command  
invoked by installcheck (or equivalent) to build paths to libraries for  
various commands, like LOAD or CREATE FUNCTION.  
  
Reviewed-by: Zhang Hu <kongbaik228@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/abDAWzHaesHLDFke@paquier.xyz  

M doc/src/sgml/regress.sgml

bloom: Optimize VACUUM and bulk-deletion with streaming read

commit   : d841ca2d149666b823525e7f5258efd9ef9d7fb1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 12:00:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 12:00:22 +0900    

Click here for diff

This commit replaces the synchronous ReadBufferExtended() loops done in  
blbulkdelete() and blvacuumcleanup() with the streaming read equivalent,  
to improve I/O efficiency during bloom index vacuum cleanup operations.  
  
Under the same test conditions as 6c228755add8, the runtime is proving  
to gain around 30% better, with most the benefits coming from a large  
reduction of the IO operation based on the stats retrieved in the  
scenarios run.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M contrib/bloom/blvacuum.c

Use streaming read for VACUUM cleanup of GIN

commit   : 6c228755add8f0714677440d53a160f9ed332902    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 11:48:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 Mar 2026 11:48:31 +0900    

Click here for diff

This commit replace the synchronous ReadBufferExtended() loop done in  
ginvacuumcleanup() with the streaming read equivalent, to improve I/O  
efficiency during GIN index vacuum cleanup operations.  
  
With dm_delay to emulate some latency and debug_io_direct=data to force  
synchronous writes and force the read path to be exercised, the author  
has noticed a 5x improvement in runtime, with a substantial reduction in  
IO stats numbers.  I have reproduced similar numbers while running  
similar tests, with improvements becoming better with more tuples and  
more pages manipulated.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M src/backend/access/gin/ginvacuum.c

commit   : 383eb21ebffe9ddd97dca03e529fa363580e7ccf    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Thu, 12 Mar 2026 09:45:18 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Thu, 12 Mar 2026 09:45:18 +0900    

Click here for diff

The planner has historically been unable to convert "x NOT IN (SELECT  
y ...)" sublinks into anti-joins.  This is because standard SQL  
semantics for NOT IN require that if the comparison "x = y" returns  
NULL, the "NOT IN" expression evaluates to NULL (effectively false),  
causing the row to be discarded.  In contrast, an anti-join preserves  
the row if no match is found.  Due to this semantic mismatch regarding  
NULL handling, the conversion was previously considered unsafe.  
  
However, if we can prove that neither side of the comparison can yield  
NULL values, and further that the operator itself cannot return NULL  
for non-null inputs, the behavior of NOT IN and anti-join becomes  
identical.  Enabling this conversion allows the planner to treat the  
sublink as a first-class relation rather than an opaque SubPlan  
filter.  This unlocks global join ordering optimization and permits  
the selection of the most efficient join algorithm based on cost,  
often yielding significant performance improvements for large  
datasets.  
  
This patch verifies that neither side of the comparison can be NULL  
and that the operator is safe regarding NULL results before performing  
the conversion.  
  
To verify operator safety, we require that the operator be a member of  
a B-tree or Hash operator family.  This serves as a proxy for standard  
boolean behavior, ensuring the operator does not return NULL on valid  
non-null inputs, as doing so would break index integrity.  
  
For operand non-nullability, this patch makes use of several existing  
mechanisms.  It leverages the outer-join-aware-Var infrastructure to  
verify that a Var does not come from the nullable side of an outer  
join, and consults the NOT-NULL-attnums hash table to efficiently  
verify schema-level NOT NULL constraints.  Additionally, it employs  
find_nonnullable_vars to identify Vars forced non-nullable by qual  
clauses, and expr_is_nonnullable to deduce non-nullability for other  
expression types.  
  
The logic for verifying the non-nullability of the subquery outputs  
was adapted from prior work by David Rowley and Tom Lane.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Reviewed-by: Zhang Mingli <zmlpostgres@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Discussion: https://postgr.es/m/CAMbWs495eF=-fSa5CwJS6B-BaEi3ARp0UNb4Lt3EkgUGZJwkAQ@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/var.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/include/optimizer/clauses.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/subselect.h
M src/include/utils/lsyscache.h
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
M src/tools/pgindent/typedefs.list

bufmgr: Fix use of wrong variable in GetPrivateRefCountEntrySlow()

commit   : 6322a028fa437669022473be8af39bbd89b644c3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 17:26:38 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 17:26:38 -0400    

Click here for diff

Unfortunately, in 30df61990c67, I made GetPrivateRefCountEntrySlow() set a  
wrong cache hint when moving entries from the hash table to the faster array.  
There are no correctness concerns due to this, just an unnecessary loss of  
performance.  
  
Noticed while testing the index prefetching patch.  
  
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com  

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

Fix use of volatile.

commit   : 547c15f9f8764af7b030a3b67dcbddab639da13c    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 11 Mar 2026 14:27:58 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 11 Mar 2026 14:27:58 -0700    

Click here for diff

Commit 8185bb5347 misused volatile. Fix it. See also 6307b096e25.  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/1bb21c7d-885f-4f07-a3ed-21b60d7c92c6@eisentraut.org  

M src/backend/foreign/foreign.c

Add support for altering CHECK constraint enforceability

commit   : 342051d73b386ad763e13930e15031f7ba5367f5    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 11 Mar 2026 16:15:35 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 11 Mar 2026 16:15:35 -0400    

Click here for diff

This commit adds support for ALTER TABLE ALTER CONSTRAINT ... [NOT]  
ENFORCED for CHECK constraints.  Previously, only foreign key  
constraints could have their enforceability altered.  
  
When changing from NOT ENFORCED to ENFORCED, the operation not only  
updates catalog information but also performs a full table scan in  
Phase 3 to validate that existing data satisfies the constraint.  
  
For partitioned tables and inheritance hierarchies, the operation  
recurses to all child tables.  When changing to NOT ENFORCED, we must  
recurse even if the parent is already NOT ENFORCED, since child  
constraints may still be ENFORCED.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@cybertec.at>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CACJufxHCh_FU-FsEwsCvg9mN6-5tzR6H9ntn+0KUgTCaerDOmg@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/constraints.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/inherit.sql

commit   : a9747153e14d38a72d2468744fab946643423924    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 11 Mar 2026 16:14:58 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 11 Mar 2026 16:14:58 -0400    

Click here for diff

The functions AlterConstrEnforceabilityRecurse and  
ATExecAlterConstrEnforceability are being renamed to  
AlterFKConstrEnforceabilityRecurse and ATExecAlterFKConstrEnforceability,  
respectively.  
  
The current alter constraint functions only handle Foreign Key constraints.  
Renaming them to be more explicit about the constraint type is necessary;  
otherwise, it will cause confusion when we later introduce the ability to alter  
the enforceability of other constraints.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
  
Discussion: https://postgr.es/m/CACJufxHCh_FU-FsEwsCvg9mN6-5tzR6H9ntn+0KUgTCaerDOmg@mail.gmail.com  

M src/backend/commands/tablecmds.c

bufmgr: Switch to standard order in MarkBufferDirtyHint()

commit   : a766125efd60ddc8358979322496a8e0fd8746c4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 13:58:44 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 13:58:44 -0400    

Click here for diff

When we were updating hint bits with just a share lock MarkBufferDirtyHint()  
had to use a non-standard order of operations, i.e. WAL log the buffer before  
marking the buffer dirty. This was required because the lock level used to set  
hints did not conflict with the lock level that was used to flush pages, which  
would have allowed flushing the page out before the WAL record. The  
non-standard order in turn required preventing the checkpoint from starting  
between writing the WAL record and flushing out the page.  
  
Now that setting hints and writing out buffers use share-exclusive, we can  
revert back to the normal order of operations.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c

bufmgr: Remove the, now obsolete, BM_JUST_DIRTIED

commit   : b0f4ff3c92664e28615e2f885195c803156d47eb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 13:53:37 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 11 Mar 2026 13:53:37 -0400    

Click here for diff

Due to the recent changes to use a share-exclusive mode for setting hint bits  
and for flushing pages - instead of using share mode as before - a buffer  
cannot be dirtied while the flush is ongoing.  The reason we needed  
JUST_DIRTIED was to handle the case where the buffer was dirtied while IO was  
ongoing - which is not possible anymore.  
  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

Avoid WAL flush checks for unlogged buffers in GetVictimBuffer()

commit   : 11e0824bd97e1639f9358260f389083135e0b5e3    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 11 Mar 2026 14:48:26 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 11 Mar 2026 14:48:26 -0400    

Click here for diff

GetVictimBuffer() rejects a victim buffer if it is from a bulkread  
strategy ring and reusing it would require flushing WAL. Unlogged table  
buffers can have fake LSNs (e.g. unlogged GiST pages) and calling  
XLogNeedsFlush() on a fake LSN is meaningless.  
  
This is a bit of future-proofing because currently the bulkread strategy  
is not used for relations with fake LSNs.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Earlier version reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/flat/fmkqmyeyy7bdpvcgkheb6yaqewemkik3ls6aaveyi5ibmvtxnd%40nu2kvy5rq3a6  

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

Do not lock in BufferGetLSNAtomic() on archs with 8 byte atomic reads

commit   : 943e881733ca62ea2e1ceb20e79b3d149379755d    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 18:32:03 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 18:32:03 +0100    

Click here for diff

On platforms where we can read or write the whole LSN atomically, we do  
not need to lock the buffer header to prevent torn LSNs. We can do this  
only on platforms with PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY, and when the  
pd_lsn field is properly aligned.  
  
For historical reasons the PageXLogRecPtr was defined as a struct with  
two uint32 fields. This replaces it with a single uint64 value, to make  
the intent clearer. To prevent issues with weak typedefs the value is  
still wrapped in a struct.  
  
This also adjusts heapfuncs() in pageinspect, to ensure proper alignment  
when reading the LSN from a page on alignment-sensitive hardware.  
  
Idea by Andres Freund. Initial patch by Andreas Karlsson, improved by  
Peter Geoghegan. Minor tweaks by me.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Tomas Vondra <tomas@vondra.me>  
Discussion: https://postgr.es/m/b6610c3b-3f59-465a-bdbb-8e9259f0abc4@proxel.se  

M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/rawpage.c
M src/backend/access/common/bufmask.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/gist.h
M src/include/storage/bufpage.h

Fix indentation from commit 29a0fb21577

commit   : b6eb8dde6be32e394a4420dfeb671b5891a87c8b    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 15:14:46 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 15:14:46 +0100    

Click here for diff

Per buildfarm animal koel  

M src/backend/storage/aio/method_worker.c

Conditional locking in pgaio_worker_submit_internal

commit   : 29a0fb215779d10fae0cbeb8ce57805f244bad9b    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 12:11:04 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 11 Mar 2026 12:11:04 +0100    

Click here for diff

With io_method=worker, there's a single I/O submission queue. With  
enough workers, the backends and workers may end up spending a lot of  
time competing for the AioWorkerSubmissionQueueLock lock. This can  
happen with workloads that keep the queue full, in which case it's  
impossible to add requests to the queue. Increasing the number of I/O  
workers increases the pressure on the lock, worsening the issue.  
  
This change improves the situation in two ways:  
  
* If AioWorkerSubmissionQueueLock can't be acquired without waiting,  
  the I/O is performed synchronously (as if the queue was full).  
  
* When an entry can't be added to a full queue, stop trying to add more  
  entries. All remaining entries are handled as synchronous I/O.  
  
The regression was reported by Alexandre Felipe. Investigation and  
patch by me, based on an idea by Andres Freund.  
  
Reported-by: Alexandre Felipe <o.alexandre.felipe@gmail.com>  
Author: Tomas Vondra <tomas@vondra.me>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAE8JnxOn4+xUAnce+M7LfZWOqfrMMxasMaEmSKwiKbQtZr65uA@mail.gmail.com  

M src/backend/storage/aio/method_worker.c

Fixes for C++ typeof implementation

commit   : 9c05f152b5dd7aeaa6e64bd4ed2fc86bab437073    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 11:54:10 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 11:54:10 +0100    

Click here for diff

This fixes two bugs in commit 1887d822f14.  
  
First, if we are using the fallback C++ implementation of typeof, then  
we need to include the C++ header <type_traits> for  
std::remove_reference_t.  This header is also likely to be used for  
other C++ implementations of type tricks, so we'll put it into the  
global includes.  
  
Second, for the case that the C compiler supports typeof in a spelling  
that is not "typeof" (for example, __typeof__), then we need to #undef  
typeof in the C++ section to avoid warnings about duplicate macro  
definitions.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M src/include/c.h

Remove Int8GetDatum function

commit   : d4a080b8a190c4ba434a390939c995a50da12cf6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 10:46:08 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 10:46:08 +0100    

Click here for diff

We have no uses of Int8GetDatum in our tree and did not have for a  
long time (or never), and the inverse does not exist either.  
  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/CALdSSPhFyb9qLSHee73XtZm1CBWJNo9+JzFNf-zUEWCRW5yEiQ@mail.gmail.com  

M src/include/postgres.h

Sort out table_open vs. relation_open in rewriter

commit   : d537f59fbbfcd3b50a7208b1320a0fa73ca589f5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 09:22:11 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 Mar 2026 09:22:11 +0100    

Click here for diff

table_open() is a wrapper around relation_open() that checks that the  
relkind is table-like and gives a user-facing error message if not.  
It is best used in directly user-facing areas to check that the user  
used the right kind of command for the relkind.  In internal uses  
where the relkind was previously checked from the user's perspective,  
table_open() is not necessary and might even be confusing if it were  
to give out-of-context error messages.  
  
In rewriteHandler.c, there were several such table_open() calls, which  
this changes to relation_open().  This currently doesn't make a  
difference, but there are plans to have other relkinds that could  
appear in the rewriter but that shouldn't be accessible via  
table-specific commands, and this clears the way for that.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M src/backend/rewrite/rewriteHandler.c

Require share-exclusive lock to set hint bits and to flush

commit   : 82467f627bd478569de04f4a3f1993098e80c812    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 10 Mar 2026 19:32:13 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 10 Mar 2026 19:32:13 -0400    

Click here for diff

At the moment hint bits can be set with just a share lock on a page (and,  
until 45f658dacb9, in one case even without any lock). Because of this we need  
to copy pages while writing them out, as otherwise the checksum could be  
corrupted.  
  
The need to copy the page is problematic to implement AIO writes:  
  
1) Instead of just needing a single buffer for a copied page we need one for  
   each page that's potentially undergoing I/O  
2) To be able to use the "worker" AIO implementation the copied page needs to  
   reside in shared memory  
  
It also causes problems for using unbuffered/direct-IO, independent of AIO:  
Some filesystems, raid implementations, ... do not tolerate the data being  
written out to change during the write. E.g. they may compute internal  
checksums that can be invalidated by concurrent modifications, leading e.g. to  
filesystem errors (as the case with btrfs).  
  
It also just is plain odd to allow modifications of buffers that are just  
share locked.  
  
To address these issues, this commit changes the rules so that modifications  
to pages are not allowed anymore while holding a share lock. Instead the new  
share-exclusive lock (introduced in fcb9c977aa5) allows at most one backend to  
modify a buffer while other backends have the same page share locked. An  
existing share-lock can be upgraded to a share-exclusive lock, if there are no  
conflicting locks. For that BufferBeginSetHintBits()/BufferFinishSetHintBits()  
and BufferSetHintBits16() have been introduced.  
  
To prevent hint bits from being set while the buffer is being written out,  
writing out buffers now requires a share-exclusive lock.  
  
The use of share-exclusive to gate setting hint bits means that from now on  
only one backend can set hint bits at a time. To allow multiple backends to  
set hint bits would require more complicated locking: For setting hint bits  
we'd need to store the count of backends currently setting hint bits and we  
would need another lock-level for I/O conflicting with the lock-level to set  
hint bits. Given that the share-exclusive lock for setting hint bits is only  
held for a short time, that backends would often just set the same hint bits  
and that the cost of occasionally not setting hint bits in hotly accessed  
pages is fairly low, this seems like an acceptable tradeoff.  
  
The biggest change to adapt to this is in heapam. To avoid performance  
regressions for sequential scans that need to set a lot of hint bits, we need  
to amortize the cost of BufferBeginSetHintBits() for cases where hint bits are  
set at a high frequency. To that end HeapTupleSatisfiesMVCCBatch() uses the  
new SetHintBitsExt(), which defers BufferFinishSetHintBits() until all hint  
bits on a page have been set.  Conversely, to avoid regressions in cases where  
we can't set hint bits in bulk (because we're looking only at individual  
tuples), use BufferSetHintBits16() when setting hint bits without batching.  
  
Several other places also need to be adapted, but those changes are  
comparatively simpler.  
  
After this we do not need to copy buffers to write them out anymore. That  
change is done separately however.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  
Discussion: https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf%40gcnactj4z56m  

M src/backend/access/gist/gistget.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/README
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

bloom: Optimize bitmap scan path with streaming read

commit   : 4c910f3bbe92aa4e84ff15fa27b4de2da0d7ae50    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Mar 2026 07:36:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Mar 2026 07:36:10 +0900    

Click here for diff

This commit replaces the per-page buffer read look in blgetbitmap() with  
a reading stream, to improve scan efficiency, particularly useful for  
large bloom indexes.  Some benchmarking with a large number of rows has  
shown a very nice improvement in terms of runtime and IO read reduction  
with test cases up to 10M rows for a bloom index scan.  
  
For the io_uring method, The author has reported a 3x in runtime with  
io_uring while I was at close to a 7x.  For the worker method with 3  
workers, the author has reported better numbers than myself in runtime,  
with the reduction in IO stats being appealing for all the cases  
measured.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VrqfbcDXqGrdLQ2xaQ=K0RzExNuw6U_GGqzSJu32wfdQ@mail.gmail.com  

M contrib/bloom/blscan.c

Remove unused PruneState member frz_conflict_horizon

commit   : 4c7362c553663d24b479e6f286720e5175c93d42    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 10 Mar 2026 18:28:18 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 10 Mar 2026 18:28:18 -0400    

Click here for diff

c2a23dcf9e3af1c removed use of PruneState.frz_conflict_horizon but  
neglected to actually remove the member. Do that now.  

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

Don't clear pendingRecoveryConflicts at end of transaction

commit   : 138592d1b06634b85d4b0275ba6501676bb8113a    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Mar 2026 00:06:09 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Mar 2026 00:06:09 +0200    

Click here for diff

Commit 17f51ea818 introduced a new pendingRecoveryConflicts field in  
PGPROC to replace the various ProcSignals. The new field was cleared  
in ProcArrayEndTransaction(), which makes sense for conflicts with  
e.g. locks or buffer pins which are gone at end of transaction. But it  
is not appropriate for conflicts on a database, or a logical slot.  
  
Because of this, the 035_standby_logical_decoding.pl test was  
occasionally getting stuck in the buildfarm. It happens if the startup  
process signals recovery conflict with the logical slot just when the  
walsender process using the slot calls ProcArrayEndTransaction().  
  
To fix, don't clear pendingRecoveryConflicts in  
ProcArrayEndTransaction(). We could still clear certain conflict  
flags, like conflicts on locks, but we didn't try to do that before  
commit 17f51ea818 either.  
  
In the passing, fix a misspelled comment, and make  
InitAuxiliaryProcess() to also clear pendingRecoveryConflicts. I don't  
think aux processes can have recovery conflicts, but it seems best to  
initialize the field and keep InitAuxiliaryProcess() as close to  
InitProcess() as possible.  
  
Analyzed-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3e07149d-060b-48a0-8f94-3d5e4946ae45@gmail.com  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c

Use the newest to-be-frozen xid as the conflict horizon for freezing

commit   : c2a23dcf9e3af1c80a99b4ee43f0885eb6894e3a    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 10 Mar 2026 15:24:39 -0400    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 10 Mar 2026 15:24:39 -0400    

Click here for diff

Previously WAL records that froze tuples used OldestXmin as the snapshot  
conflict horizon, or the visibility cutoff if the page would become  
all-frozen. Both are newer than (or equal to) the newst XID actually  
frozen on the page.  
  
Track the newest XID that will be frozen and use that as the snapshot  
conflict horizon instead. This yields an older horizon resulting in  
fewer query cancellations on standbys.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAAKRu_bbaUV8OUjAfVa_iALgKnTSfB4gO3jnkfpcFgrxEpSGJQ%40mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/include/access/heapam.h

Introduce the REPACK command

commit   : ac58465e0618941842439eb3f5a2cf8bebd5a3f1    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 10 Mar 2026 19:56:39 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 10 Mar 2026 19:56:39 +0100    

Click here for diff

REPACK absorbs the functionality of VACUUM FULL and CLUSTER in a single  
command.  Because this functionality is completely different from  
regular VACUUM, having it separate from VACUUM makes it easier for users  
to understand; as for CLUSTER, the term is heavily overloaded in the  
IT world and even in Postgres itself, so it's good that we can avoid it.  
  
We retain those older commands, but de-emphasize them in the  
documentation, in favor of REPACK; the difference between VACUUM FULL  
and CLUSTER (namely, the fact that tuples are written in a specific  
ordering) is neatly absorbed as two different modes of REPACK.  
  
This allows us to introduce further functionality in the future that  
works regardless of whether an ordering is being applied, such as (and  
especially) a concurrent mode.  
  
Author: Antonin Houska <ah@cybertec.at>  
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/82651.1720540558@antos  
Discussion: https://postgr.es/m/202507262156.sb455angijk6@alvherre.pgsql  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/cluster.sgml
A doc/src/sgml/ref/repack.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/reference.sgml
M src/backend/access/heap/heapam_handler.c
M src/backend/catalog/index.c
M src/backend/catalog/system_views.sql
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/pgstatfuncs.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/commands/cluster.h
M src/include/commands/progress.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/tcop/cmdtaglist.h
M src/include/utils/backend_progress.h
M src/test/regress/expected/cluster.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/cluster.sql
M src/tools/pgindent/typedefs.list

Fix grammar in short description of effective_wal_level.

commit   : a596d27d807974778513158cb0eafc76bae33d97    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 10 Mar 2026 11:36:38 -0700    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 10 Mar 2026 11:36:38 -0700    

Click here for diff

Align with the convention of using third-person singular (e.g.,  
"Shows" instead of "Show") for GUC parameter descriptions.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20260210.143752.1113524465620875233.horikyota.ntt@gmail.com  

M src/backend/utils/misc/guc_parameters.dat

heapam: Don't mimic MarkBufferDirtyHint() in inplace updates

commit   : f4a4ce52c0d1565c13c436ea17960d22787ea752    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 10 Mar 2026 10:06:09 -0400    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 10 Mar 2026 10:06:09 -0400    

Click here for diff

Previously heap_inplace_update_and_unlock() used an operation order similar to  
MarkBufferDirty(), to reduce the number of different approaches used for  
updating buffers.  However, in an upcoming patch, MarkBufferDirtyHint() will  
switch to using the update protocol used by most other places (enabled by hint  
bits only being set while holding a share-exclusive lock).  
  
Luckily it's pretty easy to adjust heap_inplace_update_and_unlock(). As a  
comment already foresaw, we can use the normal order, with the slight change  
of updating the buffer contents after WAL logging.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d  

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

pg_dumpall: simplify coding of dropDBs()

commit   : a198c26dede50a1fd4c22fb134b53ce8d4f8f5e3    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 10 Mar 2026 16:00:19 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 10 Mar 2026 16:00:19 +0100    

Click here for diff

There's no need for a StringInfo when all you want is a string  
being constructed in a single pass.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reported-by: Ranier Vilela <ranier.vf@gmail.com>  
Reviewed-by: Yang Yuanzhuo <1197620467@qq.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/CAEudQAq2wyXZRdsh+wVHcOrungPU+_aQeQU12wbcgrmE0bQovA@mail.gmail.com  

M src/bin/pg_dump/pg_dumpall.c

Remove duplicate initialization in initialize_brin_buildstate().

commit   : 59bae234352d10535da7e655bcd7bc8a1339f57f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 10 Mar 2026 22:55:11 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 10 Mar 2026 22:55:11 +0900    

Click here for diff

Commit dae761a added initialization of some BrinBuildState fields  
in initialize_brin_buildstate(). Later, commit b437571 inadvertently  
added the same initialization again.  
  
This commit removes that redundant initialization. No behavioral  
change is intended.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2nmrca6-9SNChDvRYD6+r==fs9qg5J93kahS7vpoq8QVg@mail.gmail.com  

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

Rename grammar nonterminal to simplify reuse

commit   : 8080f44f96a978ce94f7e6b44df1158880525e01    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 Mar 2026 13:56:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 Mar 2026 13:56:52 +0100    

Click here for diff

A list of expressions with optional AS-labels is useful in a few  
different places.  Right now, this is available as xml_attribute_list  
because it was first used in the XMLATTRIBUTES construct, but it is  
already used elsewhere, and there are other possible future uses.  To  
reduce possible confusion going forward, rename it to  
labeled_expr_list (like existing expr_list plus ColLabel).  
  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M src/backend/parser/gram.y

Allow extensions to mark an individual index as disabled.

commit   : 0fbfd37cefb7eb30c0fa8a158751c19ddeddf1f0    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Mar 2026 08:33:55 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Mar 2026 08:33:55 -0400    

Click here for diff

Up until now, the only way for a loadable module to disable the use of a  
particular index was to use build_simple_rel_hook (or, previous to  
yesterday's commit, get_relation_info_hook) to remove it from the index  
list. While that works, it has some disadvantages. First, the index  
becomes invisible for all purposes, and can no longer be used for  
optimizations such as self-join elimination or left join removal, which  
can severely degrade the resulting plan.  
  
Second, if the module attempts to compel the use of a certain index  
by removing all other indexes from the index list and disabling  
other scan types, but the planner is unable to use the chosen index  
for some reason, it will fall back to a sequential scan, because that  
is only disabled, whereas the other indexes are, from the planner's  
point of view, completely gone. While this situation ideally shouldn't  
occur, it's hard for a loadable module to be completely sure whether  
the planner will view a certain index as usable for a certain query.  
If it isn't, it may be better to fall back to a scan using a disabled  
index rather than falling back to an also-disabled sequential scan.  
  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA%2BTgmoYS4ZCVAF2jTce%3DbMP0Oq_db_srocR4cZyO0OBp9oUoGg%40mail.gmail.com  

M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h

Switch to FATAL error for missing checkpoint record without backup_label

commit   : 03facc1211b0ff1550f41bcd4da09329080c30f9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Mar 2026 12:00:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Mar 2026 12:00:05 +0900    

Click here for diff

Crash recovery started without a backup_label previously crashed with a  
PANIC if the checkpoint record could not be found.  This commit lowers  
the report generated to be a FATAL instead.  
  
With recovery methods being more imaginative these days, this should  
provide more flexibility when handling PostgreSQL recovery processing in  
the event of a driver error, similarly to 15f68cebdcec.  An extra  
benefit of this change is that it becomes possible to add a test to  
check that a FATAL is hit with an expected error message pattern.  With  
the recovery code becoming more complicated over the last couple of  
years, I suspect that this will be benefitial to cover in the long-term.  
  
The original PANIC behavior has been introduced in the early days of  
crash recovery, as of 4d14fe0048cf (PANIC did not exist yet, the code  
used STOP).  
  
Author: Nitin Jadhav <nitinjadhavpostgres@gmail.com>  
Discussion: https://postgr.es/m/CAMm1aWZbQ-Acp_xAxC7mX9uZZMH8+NpfepY9w=AOxbBVT9E=uA@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/meson.build
A src/test/recovery/t/052_checkpoint_segment_missing.pl

Fix misuse of "volatile" in xml.c

commit   : 6307b096e2599edfe238816118b3f365a73fd12a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Mar 2026 07:05:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Mar 2026 07:05:32 +0900    

Click here for diff

What should be used is not "volatile foo *ptr" but "foo *volatile ptr",  
The incorrect (former) style means that what the pointer variable points  
to is volatile.  The correct (latter) style means that the pointer  
variable itself needs to be treated as volatile.  The latter style is  
required to ensure a consistent treatment of these variables after a  
longjmp with the TRY/CATCH blocks.  
  
Some casts can be removed thanks to this change.  
  
Issue introduced by 2e947217474c, so no backpatch is required.  A  
similar set of issues has been fixed in 93001888d85c for contrib/xml2/.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Discussion: https://postgr.es/m/tencent_5BE8DAD985EE140ED62EA728C8D4E1311F0A@qq.com  

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

pg_{dump,restore}: Refactor handling of conflicting options.

commit   : 7c8280eeb5872f5c2663b562a9c6fcf8ec8a4b82    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 9 Mar 2026 11:37:46 -0500    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 9 Mar 2026 11:37:46 -0500    

Click here for diff

This commit makes use of the function added by commit b2898baaf7  
for these applications' handling of conflicting options.  It  
doesn't fix any bugs, but it does trim several lines of code.  
  
Author: Jian He <jian.universality@gmail.com>  
Reviewed-by: Steven Niu <niushiji@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CACJufxHDYn%2B3-2jR_kwYB0U7UrNP%2B0EPvAWzBBD5EfUzzr1uiw%40mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/007_pg_dumpall.pl

Replace get_relation_info_hook with build_simple_rel_hook.

commit   : 91f33a2ae92a68ac89b36eb21e0c5c903d03a142    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 09:48:26 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 09:48:26 -0400    

Click here for diff

For a long time, PostgreSQL has had a get_relation_info_hook which  
plugins can use to editorialize on the information that  
get_relation_info obtains from the catalogs. However, this hook is  
only called for baserels of type RTE_RELATION, and there is  
potential utility in a similar call back for other types of  
RTEs. This might have had utility even before commit  
4020b370f214315b8c10430301898ac21658143f added pgs_mask to  
RelOptInfo, but it certainly has utility now.  
  
So, move the callback up one level, deleting get_relation_info_hook and  
adding build_simple_rel_hook instead. The new callback is called just  
slightly later than before and with slightly different arguments, but it  
should be fairly straightforward to adjust existing code that currently  
uses get_relation_info_hook: the values previously available as  
relationObjectId and inhparent are now available via rte->relid and  
rte->inh, and calls where rte->rtekind != RTE_RELATION can be ignored if  
desired.  
  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA%2BTgmoYg8uUWyco7Pb3HYLMBRQoO6Zh9hwgm27V39Pb6Pdf%3Dug%40mail.gmail.com  

M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/optimizer/pathnode.h
M src/include/optimizer/plancat.h

Consider startup cost as a figure of merit for partial paths.

commit   : 8300d3ad4aa73dc6beec8dca7d9362dbc21c9a83    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 08:16:30 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 08:16:30 -0400    

Click here for diff

Previously, the comments stated that there was no purpose to considering  
startup cost for partial paths, but this is not the case: it's perfectly  
reasonable to want a fast-start path for a plan that involves a LIMIT  
(perhaps over an aggregate, so that there is enough data being processed  
to justify parallel query but yet we don't want all the result rows).  
  
Accordingly, rewrite add_partial_path and add_partial_path_precheck to  
consider startup costs. This also fixes an independent bug in  
add_partial_path_precheck: commit e22253467942fdb100087787c3e1e3a8620c54b2  
failed to update it to do anything with the new disabled_nodes field.  
That bug fix is formally separate from the rest of this patch and could  
be committed separately, but I think it makes more sense to fix both  
issues together, because then we can (as this commit does) just make  
add_partial_path_precheck do the cost comparisons in the same way as  
compare_path_costs_fuzzily, which hopefully reduces the chances of  
ending up with something that's still incorrect.  
  
This patch is based on earlier work on this topic by Tomas Vondra,  
but I have rewritten a great deal of it.  
  
Co-authored-by: Robert Haas <rhaas@postgresql.org>  
Co-authored-by: Tomas Vondra <tomas@vondra.me>  
Discussion: http://postgr.es/m/CA+TgmobRufbUSksBoxytGJS1P+mQY4rWctCk-d0iAUO6-k9Wrg@mail.gmail.com  

M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/pathnode.h
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

Prevent restore of incremental backup from bloating VM fork.

commit   : ffc226ab64d4ebdb089c278396d5df3d0a3f83b9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 06:36:42 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 9 Mar 2026 06:36:42 -0400    

Click here for diff

When I (rhaas) wrote the WAL summarizer code, I incorrectly believed  
that XLOG_SMGR_TRUNCATE truncates all forks to the same length.  In  
fact, what other parts of the code do is compute the truncation length  
for the FSM and VM forks from the truncation length used for the main  
fork. But, because I was confused, I coded the WAL summarizer to set the  
limit block for the VM fork to the same value as for the main fork.  
(Incremental backup always copies FSM forks in full, so there is no  
similar issue in that case.)  
  
Doing that doesn't directly cause any data corruption, as far as I can  
see. However, it does create a serious risk of consuming a large amount  
of extra disk space, because pg_combinebackup's reconstruct.c believes  
that the reconstructed file should always be at least as long as the  
limit block value. We might want to be smarter about that at some point  
in the future, because it's always safe to omit all-zeroes blocks at the  
end of the last segment of a relation, and doing so could save disk  
space, but the current algorithm will rarely waste enough disk space to  
worry about unless we believe that a relation has been truncated to a  
length much longer than its actual length on disk, which is exactly what  
happens as a result of the problem mentioned in the previous paragraph.  
  
To fix, create a new visibilitymap helper function and use it to include  
the right limit block in the summary files. Incremental backups taken  
with existing summary files will still have this issue, but this should  
improve the situation going forward.  
  
Diagnosed-by: Oleg Tkachenko <oatkachenko@gmail.com>  
Diagnosed-by: Amul Sul <sulamul@gmail.com>  
Discussion: http://postgr.es/m/CAAJ_b97PqG89hvPNJ8cGwmk94gJ9KOf_pLsowUyQGZgJY32o9g@mail.gmail.com  
Discussion: http://postgr.es/m/6897DAF7-B699-41BF-A6FB-B818FCFFD585%40gmail.com  
Backpatch-through: 17  

M src/backend/access/heap/visibilitymap.c
M src/backend/postmaster/walsummarizer.c
M src/bin/pg_combinebackup/t/011_ib_truncation.pl
M src/include/access/visibilitymap.h

Remove trailing period from errmsg in subscriptioncmds.c.

commit   : 06d83022628e6bfa9c4bd1feabe2b41e0bdc1310    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 9 Mar 2026 15:10:03 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 9 Mar 2026 15:10:03 +0530    

Click here for diff

Author: Sahitya Chandra <sahityajb@gmail.com>  
Discussion: https://postgr.es/m/20260308142806.181309-1-sahityajb@gmail.com  

M src/backend/commands/subscriptioncmds.c

Move comment back to better place

commit   : 2799e29fb8b1346bd6eab625ce8ad508eab5dc81    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 9 Mar 2026 09:46:36 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 9 Mar 2026 09:46:36 +0100    

Click here for diff

Commit f014b1b9bb8 inserted some new code in between existing code and  
a trailing comment.  Move the comment back to near the code it belongs  
to.  

M configure
M configure.ac

doc: Document IF NOT EXISTS option for ALTER FOREIGN TABLE ADD COLUMN.

commit   : 173aa8c5e89130c757c029262f10fc537b6f68ae    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 9 Mar 2026 18:23:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 9 Mar 2026 18:23:36 +0900    

Click here for diff

Commit 2cd40adb85d added the IF NOT EXISTS option to ALTER TABLE ADD COLUMN.  
This also enabled IF NOT EXISTS for ALTER FOREIGN TABLE ADD COLUMN,  
but the ALTER FOREIGN TABLE documentation was not updated to mention it.  
  
This commit updates the documentation to describe the IF NOT EXISTS option for  
ALTER FOREIGN TABLE ADD COLUMN.  
  
While updating that section, also this commit clarifies that the COLUMN keyword  
is optional in ALTER FOREIGN TABLE ADD/DROP COLUMN. Previously, part of  
the documentation could be read as if COLUMN were required.  
  
This commit adds regression tests covering these ALTER FOREIGN TABLE syntaxes.  
  
Backpatch to all supported versions.  
  
Suggested-by: Fujii Masao <masao.fujii@gmail.com>  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFk=rrhrwGwPtQxBesbT4DzSZ86Q3ftcwCu3AR5bOiXLw@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/alter_foreign_table.sgml
M src/test/regress/expected/foreign_data.out
M src/test/regress/sql/foreign_data.sql

Fix size underestimation of DSA pagemap for odd-sized segments

commit   : 4da2afd01f938af35c1a52bbf6bc40baa52462f6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 13:46:27 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 13:46:27 +0900    

Click here for diff

When make_new_segment() creates an odd-sized segment, the pagemap was  
only sized based on a number of usable_pages entries, forgetting that a  
segment also contains metadata pages, and that the FreePageManager uses  
absolute page indices that cover the entire segment.  This  
miscalculation could cause accesses to pagemap entries to be out of  
bounds.  During subsequent reuse of the allocated segment, allocations  
landing on pages with indices higher than usable_pages could cause  
out-of-bounds pagemap reads and/or writes.  On write, 'span' pointers  
are stored into the data area, corrupting the allocated objects.  On  
read (aka during a dsa_free), garbage is interpreted as a span pointer,  
typically crashing the server in dsa_get_address().  
  
The normal geometric path correctly sizes the pagemap for all pages in  
the segment.  The odd-sized path needs to do the same, but it works  
forward from usable_pages rather than backward from total_size.  
  
This commit fixes the sizing of the odd-sized case by adding pagemap  
entries for the metadata pages after the initial metadata_bytes  
calculation, using an integer ceiling division to compute the exact  
number of additional entries needed in one go, avoiding any iteration in  
the calculation.  
  
An assertion is added in the code path for odd-sized segments, ensuring  
that the pagemap includes the metadata area, and that the result is  
appropriately sized.  
  
This problem would show up depending on the size requested for the  
allocation of a DSA segment.  The reporter has noticed this issue when a  
parallel hash join makes a DSA allocation large enough to trigger the  
odd-sized segment path, but it could happen for anything that does a DSA  
allocation.  
  
A regression test is added to test_dsa, down to v17 where the test  
module has been introduced.  This adds a set of cheap tests to check the  
problem, the new assertion being useful for this purpose.  Sami has  
proposed a test that took a longer time than what I have done here; the  
test committed is faster and good enough to check the odd-sized  
allocation path.  
  
Author: Paul Bunn <paul.bunn@icloud.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/044401dcabac$fe432490$fac96db0$@icloud.com  
Backpatch-through: 14  

M src/backend/utils/mmgr/dsa.c
M src/test/modules/test_dsa/expected/test_dsa.out
M src/test/modules/test_dsa/sql/test_dsa.sql
M src/test/modules/test_dsa/test_dsa–1.0.sql
M src/test/modules/test_dsa/test_dsa.c

Refactor tests for catalog diff comparisons in stats_import.sql

commit   : ccd7abaa456f34a41efe2e5198f0bb2227aa43d9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 08:46:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 08:46:06 +0900    

Click here for diff

The tests of stats_import.sql include a set of queries to do  
differential checks of the three statistics catalog relations, based on  
the comparison of a source relation and a target relation, used for the  
copy of the stats data with the restore functions:  
- pg_statistic  
- pg_stats_ext  
- pg_stats_ext_exprs  
  
This commit refactors the tests to reduce the bloat of such differential  
queries, by creating a set of objects that make the differential queries  
smaller:  
- View for a base relation type.  
- First function to retrieve stats data, that returns a type based on  
the view previously created.  
- Second function that checks the difference, based on two calls of the  
first function.  
  
This change leads to a nice reduction of stats_import.sql, with a larger  
effect on the output file.  
  
While on it, this adds some sanity checks for the three catalogs, to  
warn developers that the stats import facilities may need to be updated  
if any of the three catalogs change.  These are rare in practice, see  
918eee0c497c as one example.  Another stylistic change is the use of the  
extended output format for the differential queries, so as we avoid long  
lines of output if a diff is caught.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=eEhxJpSUP+eC=eMGZZsVOpnfKDvVkuCbsFg9CajYwDsA@mail.gmail.com  

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

Fix typo in stats_import.sql

commit   : 9e8193a26229a2a578619fb3ee0687761aff2ea1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 07:15:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Mar 2026 07:15:26 +0900    

Click here for diff

The test mentioned pg_stat_ext_exprs, but the correct catalog name is  
pg_stats_ext_exprs.  
  
Thinko in ba97bf9cb7b4.  
  
Discussion: https://postgr.es/m/CADkLM=eEhxJpSUP+eC=eMGZZsVOpnfKDvVkuCbsFg9CajYwDsA@mail.gmail.com  

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

Fix invalid boolean if-test

commit   : eb2c867b0aab5fd6bbea1d8dbfea23d9d6fa1a94    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 7 Mar 2026 14:28:16 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 7 Mar 2026 14:28:16 +0100    

Click here for diff

We were testing the truth value of the array of booleans (which is  
always true) instead of the boolean element specific to the affected  
table column.  
  
This causes a binary-upgrade dump fail to omit the name of a constraint;  
that is, the correct constraint name is always printed, even when it's  
not needed.  The affected case is a binary-upgrade dump of a not-null  
constraint in an inherited column, which must in addition have no  
comment.  
  
Another point is that in order for this to make a difference, the  
constraint must have the default name in the child table.  That is, the  
constraint must have been created _in the parent table_ with the name  
that it would have in the child table, like so:  
  CREATE TABLE parent (a int CONSTRAINT child_a_not_null NOT NULL);  
  CREATE TABLE child () INHERITS (parent);  
Otherwise, the correct name must be printed by binary-upgrade pg_dump  
anyway, since it wouldn't match the name produced at the parent.  
  
Moreover, when it does hit, the pre-18-compatibility code (which has to  
work with a constraint that has no name) gets involved and uses the  
UPDATE on pg_constraint using the conkey instead of column name ... and  
so everything ends up working correctly AFAICS.  
  
I think it might cause a problem if the table and column names are  
overly long, but I didn't want to spend time investigating further.  
  
Still, it's wrong code, and static analyzers have twice complained about  
it, so fix it by adding the array index accessor that was obviously  
meant.  
  
Reported-by: Ranier Vilela <ranier.vf@gmail.com>  
Reported-by: George Tarasov <george.v.tarasov@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/CAEudQAo7ah=4TDheuEjtb0dsv6bHoK7uBNqv53Tsub2h-xBSJw@mail.gmail.com  
Discussion: https://postgr.es/m/f3029f25-acc9-4cb9-a74f-fe93bcfb3a27@gmail.com  

M src/bin/pg_dump/pg_dump.c

libpq: Introduce PQAUTHDATA_OAUTH_BEARER_TOKEN_V2

commit   : e982331b52083ee81f5f62f9872c874cbc1862c1    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Mar 2026 12:00:32 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Mar 2026 12:00:32 -0800    

Click here for diff

For the libpq-oauth module to eventually make use of the  
PGoauthBearerRequest API, it needs some additional functionality: the  
derived Issuer ID for the authorization server needs to be provided, and  
error messages need to be built without relying on PGconn internals.  
These features seem useful for application hooks, too, so that they  
don't each have to reinvent the wheel.  
  
The original plan was for additions to PGoauthBearerRequest to be made  
without a version bump to the PGauthData type. Applications would simply  
check a LIBPQ_HAS_* macro at compile time to decide whether they could  
use the new features. That theoretically works for applications linked  
against libpq, since it's not safe to downgrade libpq from the version  
you've compiled against.  
  
We've since found that this strategy won't work for plugins, due to a  
complication first noticed during the libpq-oauth module split: it's  
normal for a plugin on disk to be *newer* than the libpq that's loading  
it, because you might have upgraded your installation while an  
application was running. (In other words, a plugin architecture causes  
the compile-time and run-time dependency arrows to point in opposite  
directions, so plugins won't be able to rely on the LIBPQ_HAS_* macros  
to determine what APIs are available to them.)  
  
Instead, extend the original PGoauthBearerRequest (now retroactively  
referred to as "v1" in the code) with a v2 subclass-style struct. When  
an application implements and accepts PQAUTHDATA_OAUTH_BEARER_TOKEN_V2,  
it may safely cast the base request pointer it receives in its callbacks  
to v2 in order to make use of the new functionality. libpq will query  
the application for a v2 hook first, then v1 to maintain backwards  
compatibility, before giving up and using the builtin flow.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/libpq-fe.h
M src/test/modules/oauth_validator/oauth_hook_client.c
M src/test/modules/oauth_validator/t/002_client.pl
M src/tools/pgindent/typedefs.list

pg_dumpall: Fix handling of conflicting options.

commit   : b2898baaf7e40a187de5b0134d53d944b38209cd    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 6 Mar 2026 14:00:04 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 6 Mar 2026 14:00:04 -0600    

Click here for diff

pg_dumpall is missing checks for some conflicting options,  
including those passed through to pg_dump.  To fix, introduce a  
new function that checks whether mutually exclusive options are  
set, and use that in pg_dumpall.  A similar change could likely be  
made for pg_dump and pg_restore, but that is left as a future  
exercise.  
  
This is arguably a bug fix, but since this might break existing  
scripts, no back-patch for now.  
  
Author: Jian He <jian.universality@gmail.com>  
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Wang Peng <215722532@qq.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CACJufxFf5%3DwSv2MsuO8iZOvpLZQ1-meAMwhw7JX5gNvWo5PDug%40mail.gmail.com  

M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/fe_utils/option_utils.c
M src/include/fe_utils/option_utils.h

Use palloc_object() and palloc_array() in more areas of the logical replication.

commit   : 50ea4e09b6c2331b4cc6434fa12b43bc62de682c    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 6 Mar 2026 10:49:50 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 6 Mar 2026 10:49:50 -0800    

Click here for diff

The idea is to encourage the use of newer routines across the tree, as  
these offer stronger type-safety guarantees than raw palloc().  
  
Similar work has been done in commits 1b105f9472bd, 0c3c5c3b06a3,  
31d3847a37be, and 4f7dacc5b82a. This commit extends those changes to  
more locations within src/backend/replication/logical/.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pv4N7Vpxo18+NAR1r9RGvR8b0BtwTkoeCE2PfFoXgmR6A@mail.gmail.com  

M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c

Support grouping-expression references and GROUPING() in subqueries.

commit   : 415100aa62bff1402672eec4b68deef2cd436126    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Mar 2026 13:40:55 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Mar 2026 13:40:55 -0500    

Click here for diff

Until now, substitute_grouped_columns and its predecessor  
check_ungrouped_columns intentionally did not cope with references  
to GROUP BY expressions (anything more complex than a Var) within  
subqueries of the query having GROUP BY.  Because they didn't try to  
match subexpressions of subqueries to the GROUP BY list, they'd drill  
down to raw Vars of the grouping level and then fail with "subquery  
uses ungrouped column from outer query".  There have been remarkably  
few complaints about this deficiency, so nobody ever did anything  
about it.  
  
The reason for not wanting to deal with it is that within a subquery,  
Vars will have varlevelsup different from zero and will thus not be  
equal() to the expressions seen in the outer query.  We recognized  
this at least as far back as 96ca8ffeb, although I think the comment  
I added about it then was just documenting a pre-existing deficiency.  
It looks like at the time, the solutions I considered were  
(1) write a version of equal() that permits an offset in varlevelsup,  
or (2) dynamically apply IncrementVarSublevelsUp at each  
subexpression.  (1) would require an amount of new code that seems  
rather out of proportion to the benefit, while (2) would add an  
exponential amount of cost to the matching process.  But rethinking  
it now, what seems attractive is (3) apply IncrementVarSublevelsUp to  
the groupingClause list not the subexpressions, and do so only once  
per subquery depth level.  Then we can still use plain equal() to  
check for matches, and we're not incurring cost proportional to some  
power of the subquery's complexity.  
  
This patch continues to use the old logic when the GROUP BY list is  
all Vars.  We could discard the special comparison logic for that and  
always do it the more general way, but that would be a good deal  
slower.  (Micro-benchmarking just parse analysis suggests it's about  
50% slower than the Vars-only path.  But we've not heard complaints  
about the speed of matching within the main query, so I doubt that  
applying the same matching logic within subqueries will be a problem.)  
The lack of complaints suggests strongly that this is a very minority  
use-case, so I don't want to make the typical case slower to fix it.  
  
While testing that, I was surprised to discover a nearby bug:  
GROUPING() within a subquery fails to match GROUP BY Vars that are  
join alias Vars.  It tries to apply flatten_join_alias_vars to make  
such cases work, but that fails to work inside a subquery because  
varlevelsup is wrong.  Therefore, this patch invents a new entry point  
flatten_join_alias_for_parser() that allows specification of a  
sublevels_up offset.  (It seems cleaner to give the parser its own  
entry point rather than abuse the planner's conventions even further.)  
  
While this is pretty clearly a bug fix, I'm hesitant to take the risk  
of back-patching, seeing that the existing behavior has stood for so  
long with so few complaints.  Maybe we can reconsider once this patch  
has baked awhile in master.  
  
Reported-by: PALAYRET Jacques <jacques.palayret@meteo.fr>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/531183.1772058731@sss.pgh.pa.us  

M src/backend/optimizer/util/var.c
M src/backend/parser/parse_agg.c
M src/include/optimizer/optimizer.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/groupingsets.sql

CREATE SUBSCRIPTION ... SERVER.

commit   : 8185bb53476378443240d57f7d844347d5fae1bf    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 6 Mar 2026 08:27:56 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 6 Mar 2026 08:27:56 -0800    

Click here for diff

Allow CREATE SUBSCRIPTION to accept a foreign server using the SERVER  
clause instead of a raw connection string using the CONNECTION clause.  
  
  * Enables a user with sufficient privileges to create a subscription  
    using a foreign server by name without specifying the connection  
    details.  
  
  * Integrates with user mappings (and other FDW infrastructure) using  
    the subscription owner.  
  
  * Provides a layer of indirection to manage multiple subscriptions  
    to the same remote server more easily.  
  
Also add CREATE FOREIGN DATA WRAPPER ... CONNECTION clause to specify  
a connection_function. To be eligible for a subscription, the foreign  
server's foreign data wrapper must specify a connection_function.  
  
Add connection_function support to postgres_fdw, and bump postgres_fdw  
version to 1.3.  
  
Bump catversion.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/61831790a0a937038f78ce09f8dd4cef7de7456a.camel@j-davis.com  

M contrib/postgres_fdw/Makefile
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/meson.build
A contrib/postgres_fdw/postgres_fdw–1.2–1.3.sql
M contrib/postgres_fdw/postgres_fdw.control
M contrib/postgres_fdw/sql/postgres_fdw.sql
A contrib/postgres_fdw/t/010_subscription.pl
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/alter_foreign_data_wrapper.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_foreign_data_wrapper.sgml
M doc/src/sgml/ref/create_server.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/foreigncmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/foreign/foreign.c
M src/backend/parser/gram.y
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_subscription.h
M src/include/foreign/foreign.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/subscription.out
M src/test/regress/regress.c
M src/test/regress/sql/subscription.sql

Don't include wait_event.h in pgstat.h

commit   : 868825aaeb4099081364b563e532c30c1b31cabd    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 6 Mar 2026 16:24:58 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 6 Mar 2026 16:24:58 +0100    

Click here for diff

wait_event.h itself includes wait_event_types.h, which is a generated  
file, so it's nice that we can avoid compiling >10% of the tree just  
because that file is regenerated.  
  
To avoid breaking too many third-party modules, we now #include  
utils/wait_classes.h in storage/latch.h.  Then, the very common case  
of doing  
	WaitLatch(..., PG_WAIT_EXTENSION)  
continues to work by including just storage/latch.h.  (I didn't try to  
determine how many modules would actually break if we don't do this, but  
this seems a convenient and low-impact measure.)  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/202602181214.gcmhx2vhlxzp@alvherre.pgsql  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/archive/shell_archive.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_throttle.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/dbcommands.c
M src/backend/commands/vacuum.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/pqmq.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/md.c
M src/backend/storage/sync/sync.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/init/miscinit.c
M src/common/controldata_utils.c
M src/include/pgstat.h
M src/include/storage/latch.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/worker_spi/worker_spi.c

doc: Fix capitalization of Unicode

commit   : 90ca7c1429d6ebfd89300ddcf1c8da6b3e671928    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:31:35 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:31:35 +0100    

Click here for diff

Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M doc/src/sgml/targets-meson.txt

Fix Python deprecation warning

commit   : 16686a853f1b0f479fbe716acecb3a264e70c824    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:31:35 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:31:35 +0100    

Click here for diff

Starting with Python 3.14, contrib/unaccent/generate_unaccent_rules.py  
complains  
  
    DeprecationWarning: codecs.open() is deprecated. Use open() instead.  
  
This makes that change.  This works for all Python 3.x versions.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2a668979-ed92-49a3-abf9-a3ec2d460ec2%40eisentraut.org  

M contrib/unaccent/generate_unaccent_rules.py

Make unconstify and unvolatize use StaticAssertVariableIsOfTypeMacro

commit   : 258248d0bdbf1b1818e2c6a157b17227fd000d76    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:13:58 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:13:58 +0100    

Click here for diff

The unconstify and unvolatize macros had an almost identical assertion  
as was already defined in StaticAssertVariableIsOfTypeMacro, only it  
had a less useful error message and didn't have a sizeof fallback.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M src/include/c.h

Use typeof everywhere instead of compiler specific spellings

commit   : e2308350c9b775c0c66099ba16af34757c6b0367    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:13:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 10:13:49 +0100    

Click here for diff

We define typeof ourselves as __typeof__ if it does not exist.  So  
let's actually use that for consistency.  The meson/autoconf checks  
for __builtin_types_compatible_p still use __typeof__ though, because  
there we have not redefined it.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M src/include/c.h

Portable StaticAssertExpr

commit   : aa7c86852343dd18f5834f70e4caa50ae49326c9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 09:15:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 Mar 2026 09:15:44 +0100    

Click here for diff

Use a different way to write StaticAssertExpr() that does not require  
the GCC extension statement expressions.  
  
For C, we put the static_assert into a struct.  This appears to be a  
common approach.  
  
We still need to keep the fallback implementation to support buggy  
MSVC < 19.33.  
  
For C++, we put it into a lambda expression.  (The C approach doesn't  
work; it's not permitted to define a new type inside sizeof.)  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/5fa3a9f5-eb9a-4408-9baf-403d281f8b10%40eisentraut.org  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in

Fix publisher shutdown hang caused by logical walsender busy loop.

commit   : 6eedb2a5fd88da11fab92dcde9205366f6fff82f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Mar 2026 16:43:40 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Mar 2026 16:43:40 +0900    

Click here for diff

Previously, when logical replication was running, shutting down  
the publisher could cause the logical walsender to enter a busy loop  
and prevent the publisher from completing shutdown.  
  
During shutdown, the logical walsender waits for all pending WAL  
to be written out. However, some WAL records could remain unflushed,  
causing the walsender to wait indefinitely.  
  
The issue occurred because the walsender used XLogBackgroundFlush() to  
flush pending WAL. This function does not guarantee that all WAL is written.  
For example, WAL generated by a transaction without an assigned  
transaction ID that aborts might not be flushed.  
  
This commit fixes the bug by making the logical walsender call XLogFlush()  
instead, ensuring that all pending WAL is written and preventing  
the busy loop during shutdown.  
  
Backpatch to all supported versions.  
  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAO6_Xqo3co3BuUVEVzkaBVw9LidBgeeQ_2hfxeLMQcXwovB3GQ@mail.gmail.com  
Backpatch-through: 14  

M src/backend/replication/walsender.c

Improve tests for recovery_target_timeline GUC.

commit   : 2007df43332b7c4d153bcd2153e32d5a76f7e3ac    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Mar 2026 16:02:09 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Mar 2026 16:02:09 +0900    

Click here for diff

Commit fd7d7b71913 added regression tests to verify recovery_target_timeline  
settings. To confirm that invalid values are rejected, those tests started the  
server with an invalid setting and then verified that startup failed. While  
functionally correct, this approach was expensive because it required  
setting up and starting the server for each test case.  
  
This commit updates the tests for recovery_target_timeline to use  
the simpler approach introduced by commit bffd7130 for recovery_target_xid,  
using ALTER SYSTEM SET to verify that invalid settings are rejected.  
This avoids the need to set up and start the server when checking invalid  
recovery_target_timeline values.  
  
Author: David Steele <david@pgbackrest.org>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwG44vZbSoBmg076G+xkR6n=Tj2=q+fVkfP7yEsyF1daFA@mail.gmail.com  

M src/test/recovery/t/003_recovery_targets.pl

Fix inconsistency with HeapTuple freeing in extended_stats_funcs.c

commit   : d5ea206728de7cb301d2f572055a76d4ea43bc8d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 14:49:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 14:49:00 +0900    

Click here for diff

heap_freetuple() is a thin wrapper doing a pfree(), and the function  
import_pg_statistic(), introduced by ba97bf9cb7b4, had the idea to call  
directly pfree() rather than the "dedicated" heap tuple routine.  
  
upsert_pg_statistic_ext_data already uses heap_freetuple().  This code  
is harmless as-is, but let's be consistent across the board.  
  
Reported-by: Yonghao Lee <yonghao_lee@qq.com>  
Discussion: https://postgr.es/m/tencent_CA1315EE8FB9C62F742C71E95FAD72214205@qq.com  

M src/backend/statistics/extended_stats_funcs.c

Fix order of columns in pg_stat_recovery

commit   : 2d4ead6f4bd0e30df15dc0ae654c9ce573f41bed    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 14:41:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 14:41:41 +0900    

Click here for diff

recovery_last_xact_time is listed before current_chunk_start_time in the  
documentation, the function definition and the view definition, but  
their order was reversed in the code.  
  
Thinko in 01d485b142e4.  Mea culpa.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurQQ1naKmPJhfE5WOUQjtf5tu08Kw3QCGY5UY=7Rt9fE=w@mail.gmail.com  

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

Fix inconsistent elevel in pg_sync_replication_slots() retry logic.

commit   : f1ddaa15357fccb03dea371f8cb481ce2c5e4808    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 6 Mar 2026 10:51:32 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 6 Mar 2026 10:51:32 +0530    

Click here for diff

The commit 0d2d4a0ec3 allowed pg_sync_replication_slots() to retry sync  
attempts, but missed a case, when WAL prior to a slot's  
confirmed_flush_lsn is not yet flushed locally.  
  
By changing the elevel from ERROR to LOG, we allow the sync loop to  
continue. This provides the opportunity for the slot to be synchronized  
once the standby catches up with the necessary WAL.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAFPTHDZAA+gWDntpa5ucqKKba41=tXmoXqN3q4rpjO9cdxgQrw@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/replication/logical/slotsync.c

Add system view pg_stat_recovery

commit   : 01d485b142e4c89aef79da9fd60f203c1bd4458b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 12:37:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 12:37:40 +0900    

Click here for diff

This commit introduces pg_stat_recovery, that exposes at SQL level the  
state of recovery as tracked by XLogRecoveryCtlData in shared memory,  
maintained by the startup process.  This new view includes the following  
fields, that are useful for monitoring purposes on a standby, once it  
has reached a consistent state (making the execution of the SQL function  
possible):  
- Last-successfully replayed WAL record LSN boundaries and its timeline.  
- Currently replaying WAL record end LSN and its timeline.  
- Current WAL chunk start time.  
- Promotion trigger state.  
- Timestamp of latest processed commit/abort.  
- Recovery pause state.  
  
Some of this data can already be recovered from different system  
functions, but not all of it.  See pg_get_wal_replay_pause_state or  
pg_last_xact_replay_timestamp.  This new view offers a stronger  
consistency guarantee, by grabbing the recovery state for all fields  
through one spinlock acquisition.  
  
The system view relies on a new function, called pg_stat_get_recovery().  
Querying this data requires the pg_read_all_stats privilege.  The view  
returns no rows if the node is not in recovery.  
  
This feature originates from a suggestion I have made while discussion  
the addition of a CONNECTING state to the WAL receiver's shared memory  
state, because we lacked access to some of the state data.  The author  
has taken the time to implement it, so thanks for that.  
  
Bump catalog version.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7W+Nody-+P9y4PNk37-QWuLpfUrEonHuEhrX+Vx9Kq+Kw@mail.gmail.com  
Discussion: https://postgr.es/m/aW13GJn_RfTJIFCa@paquier.xyz  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/recovery/t/001_stream_rep.pl
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Refactor code retrieving string for RecoveryPauseState

commit   : 42a12856a6a09e6477a8e9156cfa39cc3a8708e0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 11:53:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Mar 2026 11:53:23 +0900    

Click here for diff

This refactoring is going to be useful in an upcoming commit, to avoid  
some code duplication with the function pg_get_wal_replay_pause_state(),  
that returns a string for the recovery pause state.  
  
Refactoring opportunity noticed while hacking on a different patch.  
  
Discussion: https://postgr.es/m/CABPTF7W+Nody-+P9y4PNk37-QWuLpfUrEonHuEhrX+Vx9Kq+Kw@mail.gmail.com  

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

Simplify creation of built-in functions with non-default ACLs.

commit   : f95d73ed433207c4323802dc96e52f3e5553a86c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 17:43:09 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 17:43:09 -0500    

Click here for diff

Up to now, to create such a function, one had to make a pg_proc.dat  
entry and then modify it with GRANT/REVOKE commands, which we put in  
system_functions.sql.  That seems a little ugly though, because it  
violates the idea of having a single source of truth about the initial  
contents of pg_proc, and it results in leaving dead rows in the  
initial contents of pg_proc.  
  
This patch improves matters by allowing aclitemin to work during early  
bootstrap, before pg_authid has been loaded.  On the same principle  
that we use for early access to pg_type details, put a table of known  
built-in role names into bootstrap.c, and use that in bootstrap mode.  
  
To create a built-in function with a non-default ACL, one should write  
the desired ACL list in its pg_proc.dat entry, using a simplified  
version of aclitemout's notation: omit the grantor (if it is the  
bootstrap superuser, which it pretty much always should be) and spell  
the bootstrap superuser's name as POSTGRES, similarly to the notation  
used elsewhere in src/include/catalog.  This results in entries like  
  
  proacl => '{POSTGRES=X,pg_monitor=X}'  
  
which shows that we've revoked public execute permissions and instead  
granted that to pg_monitor.  
  
In addition to fixing up pg_proc.dat entries, I got rid of some  
role grants that had been stuck into system_functions.sql,  
and instead put them into a new file pg_auth_members.dat;  
that seems like a far less random place to put the information.  
  
The correctness of the data changes can be verified by comparing the  
initial contents of pg_proc and pg_auth_members before and after.  
pg_proc should match exactly, but the OID column of pg_auth_members  
will probably be different because those OIDs now get assigned a  
little earlier in bootstrap.  (I forced a catversion bump out of  
caution, but it wasn't really necessary.)  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net  

M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/acl.c
M src/include/bootstrap/bootstrap.h
M src/include/catalog/Makefile
M src/include/catalog/catversion.h
M src/include/catalog/meson.build
A src/include/catalog/pg_auth_members.dat
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_proc.dat

Be more wary of false matches in initdb's replace_token().

commit   : 7664319ccb0288b3b13b111b0d88ec7881f3c5bf    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 17:22:31 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 17:22:31 -0500    

Click here for diff

Do not replace the target string unless the occurrence is surrounded  
by whitespace or line start/end.  This avoids potential false match  
to a substring of a field.  While we've not had trouble with that  
up to now, the next patch creates hazards of false matches to  
POSTGRES within an ACL field.  
  
There is one call site that needs adjustment, as it was presuming  
it could write "::1" and have that match "::1/128".  For all the  
others, this restriction is okay and strictly safer.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net  

M src/bin/initdb/initdb.c

Prefix PruneState->all_{visible,frozen} with set_

commit   : 34cb4254bdb6d344e2440c721abc11196982ccd5    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:54:28 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:54:28 -0500    

Click here for diff

The PruneState had members called "all_visible" and "all_frozen" which  
reflect not the current state of the page but the state it could be in  
once pruning and freezing have been executed. These are then saved in  
the PruneFreezeResult so the caller can set the VM accordingly.  
  
Prefix the PruneState members as well as the corresponsding  
PruneFreezeResult members with "set_" to clarify that they represent the  
proposed state of the all-visible and all-frozen bits for a heap page in  
the visibility map, not the current state.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h

Add PageGetPruneXid() helper

commit   : 68c2dcb9130e8e3bc60676909676be1567c3cd51    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:22:57 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:22:57 -0500    

Click here for diff

This is similar to the other page accessors in bufpage.h. It improves  
readability and avoids long lines.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/BD8B69E7-26D8-4706-9164-597C6AE57812%40gmail.com  

M src/backend/access/heap/pruneheap.c
M src/include/storage/bufpage.h

Move commonly used context into PruneState and simplify helpers

commit   : 59663e4207fdbf8ffffad0c378f0c455ce2beb06    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:10:29 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 5 Mar 2026 16:10:29 -0500    

Click here for diff

heap_page_prune_and_freeze() and many of its helpers use the heap  
buffer, block number, and page. Other helpers took the heap page and  
didn't use it. Initializing these values once during  
prune_freeze_setup() simplifies the helpers' interfaces and avoids any  
repeated calls to BufferGetBlockNumber() and BufferGetPage().  
  
While updating PruneState, also reorganize its fields to make the layout  
and member documentation more consistent.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/BD8B69E7-26D8-4706-9164-597C6AE57812%40gmail.com  

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

Exit after fatal errors in client-side compression code.

commit   : ac0accafd6b6eef1a86a50f42346e1e926505df2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 14:43:21 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 Mar 2026 14:43:21 -0500    

Click here for diff

It looks like whoever wrote the astreamer (nee bbstreamer) code  
thought that pg_log_error() is equivalent to elog(ERROR), but  
it's not; it just prints a message.  So all these places tried to  
continue on after a compression or decompression error return,  
with the inevitable result being garbage output and possibly  
cascading error messages.  We should use pg_fatal() instead.  
  
These error conditions are probably pretty unlikely in practice,  
which no doubt accounts for the lack of field complaints.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/1531718.1772644615@sss.pgh.pa.us  
Backpatch-through: 15  

M src/bin/pg_dump/compress_lz4.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_zstd.c

oauth: Add TLS support for oauth_validator tests

commit   : a6483f5ac9680801da0c8ad207c2870c0d6a61c2    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:53 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:53 -0800    

Click here for diff

The oauth_validator tests don't currently support HTTPS, which makes  
testing PGOAUTHCAFILE difficult. Add a localhost certificate to  
src/test/ssl and make use of it in oauth_server.py.  
  
In passing, explain the hardcoded use of IPv4 in our issuer identifier,  
after intermittent failures on NetBSD led to commit 8d9d5843b. (The new  
certificate is still set up for IPv6, to make it easier to improve that  
behavior in the future.)  
  
Patch by Jonathan Gonzalez V., with some additional tests and tweaks by  
me.  
  
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Discussion: https://postgr.es/m/8a296a2c128aba924bff0ae48af2b88bf8f9188d.camel@gmail.com  

M src/test/modules/oauth_validator/Makefile
M src/test/modules/oauth_validator/meson.build
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/t/OAuth/Server.pm
M src/test/modules/oauth_validator/t/oauth_server.py
A src/test/ssl/conf/server-localhost-alt-names.config
A src/test/ssl/ssl/server-localhost-alt-names.crt
A src/test/ssl/ssl/server-localhost-alt-names.key
M src/test/ssl/sslfiles.mk

libpq: Add PQgetThreadLock() to mirror PQregisterThreadLock()

commit   : b8d76858353e40f888c809eb14a974cf13bf23ab    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:48 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:48 -0800    

Click here for diff

Allow libpq clients to retrieve the current pg_g_threadlock pointer with  
PQgetThreadLock(). Single-threaded applications could already do this in  
a convoluted way:  
  
    pgthreadlock_t tlock;  
  
    tlock = PQregisterThreadLock(NULL);  
    PQregisterThreadLock(tlock);    /* re-register the callback */  
  
    /* use tlock */  
  
But a generic library can't do that without potentially breaking  
concurrent libpq connections.  
  
The motivation for doing this now is the libpq-oauth plugin, which  
currently relies on direct injection of pg_g_threadlock, and should  
ideally not.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmEU_q9sr1PMmE-4rLwFN%3DOjyndDwFZvpsMU3RNJLrM9g%40mail.gmail.com  
Discussion: https://postgr.es/m/CAOYmi%2B%3DMHD%2BWKD4rsTn0v8220mYfyLGhEc5EfhmtqrAb7SmC5g%40mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h

oauth: Report cleanup errors as warnings on stderr

commit   : f8c0b91a6063fc8066f1ed22c463417f1f611dfd    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:36 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Thu, 5 Mar 2026 10:04:36 -0800    

Click here for diff

Using conn->errorMessage for these "shouldn't-happen" cases will only  
work if the connection itself fails. Our SSL and password callbacks  
print WARNINGs when they find themselves in similar situations, so  
follow their lead.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmEU_q9sr1PMmE-4rLwFN%3DOjyndDwFZvpsMU3RNJLrM9g%40mail.gmail.com  

M src/interfaces/libpq-oauth/oauth-curl.c

Fix handling of updated tuples in the MERGE statement

commit   : 177037341a4414f1089748686af9ce8bd9f8d383    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 5 Mar 2026 19:47:20 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 5 Mar 2026 19:47:20 +0200    

Click here for diff

This branch missed the IsolationUsesXactSnapshot() check.  That led to EPQ on  
repeatable read and serializable isolation levels.  This commit fixes the  
issue and provides a simple isolation check for that.  Backpatch through v15  
where MERGE statement was introduced.  
  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAPpHfdvzZSaNYdj5ac-tYRi6MuuZnYHiUkZ3D-AoY-ny8v%2BS%2Bw%40mail.gmail.com  
Author: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Backpatch-through: 15  

M src/backend/executor/nodeModifyTable.c
M src/test/isolation/expected/merge-update.out
M src/test/isolation/specs/merge-update.spec

Improve validation of recovery_target_xid GUC values.

commit   : bffd7130e942e2bd45153ab09e5fab70e74ece58    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Mar 2026 21:40:32 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Mar 2026 21:40:32 +0900    

Click here for diff

Previously, the recovery_target_xid GUC values were not sufficiently validated.  
As a result, clearly invalid inputs such as the string "bogus", a decimal value  
like "1.1", or 0 (a transaction ID smaller than the minimum valid value of 3)  
were unexpectedly accepted. In these cases, the value was interpreted as  
transaction ID 0, which could cause recovery to behave unexpectedly.  
  
This commit improves validation of recovery_target_xid GUC so that invalid  
values are rejected with an error. This prevents recovery from proceeding  
with misconfigured recovery_target_xid settings.  
  
Also this commit updates the documentation to clarify the allowed values  
for recovery_target_xid GUC.  
  
Author: David Steele <david@pgbackrest.org>  
Reviewed-by: Hüseyin Demir <huseyin.d3r@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/f14463ab-990b-4ae9-a177-998d2677aae0@pgbackrest.org  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/t/003_recovery_targets.pl

doc: Clarify that COLUMN is optional in ALTER TABLE ... ADD/DROP COLUMN.

commit   : 9b0e5bd5320f95cfb35f0402c0f4bb7a1d3ecb0f    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Mar 2026 12:55:52 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Mar 2026 12:55:52 +0900    

Click here for diff

In ALTER TABLE ... ADD/DROP COLUMN, the COLUMN keyword is optional. However,  
part of the documentation could be read as if COLUMN were required, which may  
mislead users about the command syntax.  
  
This commit updates the ALTER TABLE documentation to clearly state that  
COLUMN is optional for ADD and DROP.  
  
Also this commit adds regression tests covering ALTER TABLE ... ADD/DROP  
without the COLUMN keyword.  
  
Backpatch to all supported versions.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2n6ShLMOnjOtf63TjjgGbgiTVT5OMsSOFmbjGb6Xue1Bw@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/alter_table.sgml
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql

Move definition of XLogRecoveryCtlData to xlogrecovery.h

commit   : 5f8124a0cf33fe421b915b57dcf04fea8b7a252c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 12:17:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 12:17:47 +0900    

Click here for diff

XLogRecoveryCtlData is the structure that stores the shared-memory state  
of WAL recovery, including information such as promotion requests, the  
timeline ID (TLI), and the LSNs of replayed records.  
  
This refactoring is independently useful because it allows code outside  
of core to access the recovery state in live.  It will be used by an  
upcoming patch that introduces a SQL function for querying this  
information, that can be accessed on a standby once a consistent state  
has been reached.  This only moves code around, changing nothing  
functionally.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7W+Nody-+P9y4PNk37-QWuLpfUrEonHuEhrX+Vx9Kq+Kw@mail.gmail.com  

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

Fix rare instability in recovery TAP test 004_timeline_switch

commit   : ea4744782b3f9d3dd69be20f31f970bee60f5f09    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 10:05:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 10:05:44 +0900    

Click here for diff

This fixes a problem similar to ad8c86d22cbd.  In this case, the test  
could fail under the following circumstances:  
- The primary is stopped with teardown_node(), meaning that it may not  
be able to send all its WAL records to standby_1 and standby_2.  
- If standby_2 receives more records than standby_1, attempting to  
reconnect standby_2 to the promoted standby_1 would fail because of a  
timeline fork.  
  
This race condition is fixed with a simple trick: instead of tearing  
down the primary, it is stopped cleanly so as all the WAL records of the  
primary are received and flushed by both standby_1 and standby_2.  Once  
we do that, there is no need for a wait_for_catchup() before stopping  
the node.  The test wants to check that a timeline jump can be achieved  
when reconnecting a standby to a promoted standby in the same cluster,  
hence an immediate stop of the primary is not required.  
  
This failure is harder to reach than the previous instability of  
009_twophase, still the buildfarm has been able to detect this failure  
at least once.  I have tried Alexander Lakhin's test trick with the  
bgwriter and very aggressive standby snapshots, but I could not  
reproduce it directly.  It is reachable, as the buildfarm has proved.  
  
Backpatch down to all supported branches, and this problem can lead to  
spurious failures in the buildfarm.  
  
Discussion: https://postgr.es/m/493401a8-063f-436a-8287-a235d9e065fc@gmail.com  
Backpatch-through: 14  

M src/test/recovery/t/004_timeline_switch.pl

Change default value of default_toast_compression to "lz4", take two

commit   : 34dfca293432e206b8f80431f81535aff69782ca    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 09:24:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 09:24:35 +0900    

Click here for diff

The default value for default_toast_compression was "pglz".  The main  
reason for this choice is that this option is always available, pglz  
code being embedded in Postgres.  However, it is known that LZ4 is more  
efficient than pglz: less CPU required, more compression on average.  As  
of this commit, the default value of default_toast_compression becomes  
"lz4", if available.  By switching to LZ4 as the default, users should  
see natural speedups on TOAST data reads and/or writes.  
  
Support for LZ4 in TOAST compression was added in Postgres v14, or 5  
releases ago.  This should be long enough to consider this feature as  
stable.  
  
While at it, quotes are removed from default_toast_compression in  
postgresql.conf.sample.  Quotes are not required in this case.  The  
in-place value replacement done by initdb if the build supports LZ4  
would not use them in the postgresql.conf file added to a  
freshly-initialized cluster.  
  
Note that this is a version lighter than 7c1849311e49, that included a  
replacement of --with-lz4 by --without-lz4 in configure builds, forcing  
a requirement for LZ4 in all environments.  The buildfarm did not like  
it, at all.  This commit switches default_toast_compression to lz4 as  
default only when --with-lz4 is defined, which should keep the buildfarm  
at bay while still allowing users to benefit from LZ4 compression in  
TOAST as long as the code is compiled with it.  
  
Author: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://posgr.es/m/435df33a-129e-4f0c-a803-f3935c5a5ecb@eisentraut.org  

M doc/src/sgml/config.sgml
M src/backend/access/common/toast_compression.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/access/toast_compression.h

Revert "Change default value of default_toast_compression to "lz4""

commit   : 4f0b3afab4da87255ee159b96ba531157ee5af3b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 08:25:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Mar 2026 08:25:35 +0900    

Click here for diff

This reverts commit 7c1849311e49, due to the fact that more than 60% of  
the buildfarm members do not have lz4 installed.  As we are in the last  
commit fest of the development cycle, and that it could take a couple  
of weeks to stabilize things, this change is reverted for now.  
  
This commit will be reworked in a lighter version, as  
default_toast_compression's default can be changed to "lz4" without the  
switch from --with-lz4 to --without-lz4.  This approach will keep the  
buildfarm at bay, and still allow builds to take advantage of LZ4 in  
TOAST by default, as long as the code is compiled with LZ4 support.  
  
A harder requirement based on LZ4 should be achievable at some point,  
but it is going to require some work from the buildfarm owners first.  
Perhaps this part could be revisited at the beginning of the next  
development cycle.  
  
Discussion: https://postgr.es/m/CAOYmi+meTT0NbLbnVqOJD5OKwCtHL86PQ+RZZTrn6umfmHyWaw@mail.gmail.com  

M .cirrus.tasks.yml
M configure
M configure.ac
M doc/src/sgml/config.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M src/backend/access/common/toast_compression.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/access/toast_compression.h

pg_restore: add --no-globals option to skip globals

commit   : 3c19983cc0816001ad849a9f0bcaf2ea8321b93d    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 27 Feb 2026 08:07:10 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 27 Feb 2026 08:07:10 -0500    

Click here for diff

This is a followup to commit 763aaa06f03 Add non-text output formats to  
pg_dumpall.  
  
Add a --no-globals option to pg_restore that skips restoring global  
objects (roles and tablespaces) when restoring from a pg_dumpall  
archive.  When -C/--create is not specified, databases that do not  
already exist on the target server are also skipped.  
  
This is useful when restoring only specific databases from a pg_dumpall  
archive without needing the global objects to be restored first.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
  
With small tweaks by me.  
  
Discussion: https://postgr.es/m/CAKYtNArdcc5kx1MdTtTKFNYiauo3=zCA-NB0LmBCW-RU_kSb3A@mail.gmail.com  

M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/007_pg_dumpall.pl

Improve writing map.dat preamble

commit   : c7572cd48d393d16b57461cf954ae06c084ca2ee    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 4 Mar 2026 16:08:04 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 4 Mar 2026 16:08:04 -0500    

Click here for diff

Fix code from commit 763aaa06f03  
  
Suggestion from Alvaro Herrera following a bug discovered by Coverity.  

M src/bin/pg_dump/pg_dumpall.c

Fix casting away const-ness in pg_restore.c

commit   : 01c729e0c7a5899b841e596147381f5437ab8aab    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 4 Mar 2026 15:44:45 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 4 Mar 2026 15:44:45 -0500    

Click here for diff

This was intoduced in commit 763aaa06f03  
  
per gripe from Peter Eistentrut.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
  
Slightly tweaked by me.  
  
Discussion: https://postgr.es/m/016819c0-666e-42a8-bfc8-2b93fd8d0176@eisentraut.org  

M src/bin/pg_dump/pg_restore.c

Fix estimate_hash_bucket_stats's correction for skewed data.

commit   : e6a1d8f5acbc661d3165d92d0cc1ff6b8f997f16    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 Mar 2026 15:33:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 Mar 2026 15:33:15 -0500    

Click here for diff

The previous idea was "scale up the bucketsize estimate by the ratio  
of the MCV's frequency to the average value's frequency".  But we  
should have been suspicious of that plan, since it frequently led to  
impossible (> 1) values which we had to apply an ad-hoc clamp to.  
Joel Jacobson demonstrated that it sometimes leads to making the  
wrong choice about which side of the hash join should be inner.  
  
Instead, drop the whole business of estimating average frequency, and  
just clamp the bucketsize estimate to be at least the MCV's frequency.  
This corresponds to the bucket size we'd get if only the MCV appears  
in a bucket, and the MCV's frequency is not affected by the  
WHERE-clause filters.  (We were already making the latter assumption.)  
This also matches the coding used since 4867d7f62 in the case where  
only a default ndistinct estimate is available.  
  
Interestingly, this change affects no existing regression test cases.  
Add one to demonstrate that it helps pick the smaller table to be  
hashed when the MCV is common enough to affect the results.  
  
This leaves estimate_hash_bucket_stats not considering the effects of  
null join keys at all, which we should probably improve.  However,  
I have a different patch in the queue that will change the executor's  
handling of null join keys, so it seems appropriate to wait till  
that's in before doing anything more here.  
  
Reported-by: Joel Jacobson <joel@compiler.org>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Joel Jacobson <joel@compiler.org>  
Discussion: https://postgr.es/m/341b723c-da45-4058-9446-1514dedb17c1@app.fastmail.com  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix yet another bug in archive streamer with LZ4 decompression.

commit   : c70f6dc6bd793cca86c734865914a031ef88240f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 Mar 2026 12:08:37 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 Mar 2026 12:08:37 -0500    

Click here for diff

The code path in astreamer_lz4_decompressor_content() that updated  
the output pointers when the output buffer isn't full was wrong.  
It advanced next_out by bytes_written, which could include previous  
decompression output not just that of the current cycle.  The  
correct amount to advance is out_size.  While at it, make the  
output pointer updates look more like the input pointer updates.  
  
This bug is pretty hard to reach, as it requires consecutive  
compression frames that are too small to fill the output buffer.  
pg_dump could have produced such data before 66ec01dc4, but  
I'm unsure whether any files we use astreamer with would be  
likely to contain problematic data.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/0594CC79-1544-45DD-8AA4-26270DE777A7@gmail.com  
Backpatch-through: 15  

M src/fe_utils/astreamer_lz4.c

Don't malloc(0) in EventTriggerCollectAlterTSConfig

commit   : ce4fbe1ac6e9eeae08a825b7ce09efec3614632f    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 4 Mar 2026 15:04:53 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 4 Mar 2026 15:04:53 +0100    

Click here for diff

Author: Florin Irion <florin.irion@enterprisedb.com>  
Discussion: https://postgr.es/m/c6fff161-9aee-4290-9ada-71e21e4d84de@gmail.com  

M src/backend/commands/event_trigger.c
M src/test/modules/test_ddl_deparse/Makefile
A src/test/modules/test_ddl_deparse/expected/textsearch.out
M src/test/modules/test_ddl_deparse/meson.build
A src/test/modules/test_ddl_deparse/sql/textsearch.sql

Allow table exclusions in publications via EXCEPT TABLE.

commit   : fd366065e06ae953c4f2d973d5c5f0474f3b87b6    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 4 Mar 2026 15:55:01 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 4 Mar 2026 15:55:01 +0530    

Click here for diff

Extend CREATE PUBLICATION ... FOR ALL TABLES to support the EXCEPT TABLE  
syntax. This allows one or more tables to be excluded. The publisher will  
not send the data of excluded tables to the subscriber.  
  
To support this, pg_publication_rel now includes a prexcept column to flag  
excluded relations. For partitioned tables, the exclusion is applied at  
the root level; specifying a root table excludes all current and future  
partitions in that tree.  
  
Follow-up work will implement ALTER PUBLICATION support for managing these  
exclusions.  
  
Author: vignesh C <vignesh21@gmail.com>  
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm3=JrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh=tamA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_rel.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
M src/test/subscription/meson.build
A src/test/subscription/t/037_except.pl

Add test for row-locking and multixids with prepared transactions

commit   : fe08113aefc9dec62f218d5d712dde4ffbb0f0a3    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Mar 2026 11:29:02 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Mar 2026 11:29:02 +0200    

Click here for diff

This is a repro for the issue fixed in commit ccae90abdb. Backpatch to  
v17 like that commit, although that's a little arbitrary as this test  
would work on older versions too.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAA5RZ0twq5bNMq0r0QNoopQnAEv+J3qJNCrLs7HVqTEntBhJ=g@mail.gmail.com  
Backpatch-through: 17  

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

Skip prepared_xacts test if max_prepared_transactions < 2

commit   : 19615a44b3e633a94aaae712c5c448e69d4996b2    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Mar 2026 11:06:43 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Mar 2026 11:06:43 +0200    

Click here for diff

This reduces maintenance overhead, as we no longer need to update the  
dummy expected output file every time the .sql file changes.  
  
Discussion: https://www.postgresql.org/message-id/1009073.1772551323@sss.pgh.pa.us  
Backpatch-through: 14  

M src/test/regress/expected/prepared_xacts.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/sql/prepared_xacts.sql

Fix rare instability in recovery TAP test 009_twophase

commit   : ad8c86d22cbd043cfb48cc3c18e43c4f267b2eb0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 16:30:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 16:30:51 +0900    

Click here for diff

The phase of the test where we want to check that 2PC transactions  
prepared on a primary can be committed on a promoted standby relied on  
an immediate stop of the primary.  This logic has a race condition: it  
could be possible that some records (most likely standby snapshot  
records) are generated on the primary before it finishes its shutdown,  
without the promoted standby know about them.  When the primary is  
recycled as new standby, the test could fail because of a timeline fork  
as an effect of these extra records.  
  
This fix takes care of the instability by doing a clean stop of the  
primary instead of a teardown (aka immediate stop), so as all records  
generated on the primary are sent to the promoted standby and flushed  
there.  There is no need for a teardown of the primary in this test  
scenario: the commit of 2PC transactions on a promoted standby do not  
care about the state of the primary, only of the standby.  
  
This race is very hard to hit in practice, even slow buildfarm members  
like skink have a very low rate of reproduction.  Alexander Lakhin has  
come up with a recipe to improve the reproduction rate a lot:  
- Enable -DWAL_DEBUG.  
- Patch the bgwriter so as standby snapshots are generated every  
milliseconds.  
- Run 009_twophase tests under heavy parallelism.  
  
With this method, the failure appears after a couple of iterations.  
With the fix in place, I have been able to run more than 50 iterations  
of the parallel test sequence, without seeing a failure.  
  
Issue introduced in 30820982b295, due to a copy-pasto coming from the  
surrounding tests.  Thanks also to Hayato Kuroda for digging into the  
details of the failure.  He has proposed a fix different than the one of  
this commit.  Unfortunately, it relied on injection points, feature only  
available in v17.  The solution of this commit is simpler, and can be  
applied to v14~v16.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/b0102688-6d6c-c86a-db79-e0e91d245b1a@gmail.com  
Backpatch-through: 14  

M src/test/recovery/t/009_twophase.pl

Change default value of default_toast_compression to "lz4", when available

commit   : 7c1849311e49ec57cb86b32a9aa630456588c3f0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 13:05:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 13:05:31 +0900    

Click here for diff

The default value for default_toast_compression was "pglz".  The main  
reason for this choice is that this option is always available, pglz  
code being embedded in Postgres.  However, it is known that LZ4 is more  
efficient than pglz: less CPU required, more compression on average.  As  
of this commit, the default value of default_toast_compression becomes  
"lz4", if available.  By switching to LZ4 as the default, users should  
see natural speedups on TOAST data reads and/or writes.  
  
Support for LZ4 in TOAST compression was added in Postgres v14, or 5  
releases ago.  This should be long enough to consider this feature as  
stable.  
  
--with-lz4 is removed, replaced by a --without-lz4 to disable LZ4 in the  
builds on an option-basis, following a practice similar to readline or  
ICU.  References to --with-lz4 are removed from the documentation.  
  
While at it, quotes are removed from default_toast_compression in  
postgresql.conf.sample.  Quotes are not required in this case.  The  
in-place value replacement done by initdb if the build supports LZ4  
would not use them in the postgresql.conf file added to a  
freshly-initialized cluster.  
  
For the reference, a similar switch has been done with ICU in  
fcb21b3acdcb.  Some of the changes done in this commit are consistent  
with that.  
  
Note: this is going to create some disturbance in the buildfarm, in  
environments where lz4 is not installed.  
  
Author: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://posgr.es/m/435df33a-129e-4f0c-a803-f3935c5a5ecb@eisentraut.org  

M .cirrus.tasks.yml
M configure
M configure.ac
M doc/src/sgml/config.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M src/backend/access/common/toast_compression.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/include/access/toast_compression.h

Remove redundant restriction checks in apply_child_basequals

commit   : 1f4f87d79436cd04d549b3ad0a141a7a3adca28c    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 4 Mar 2026 10:57:43 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 4 Mar 2026 10:57:43 +0900    

Click here for diff

In apply_child_basequals, after translating a parent relation's  
restriction quals for a child relation, we simplify each child qual by  
calling eval_const_expressions.  Historically, the code then called  
restriction_is_always_false and restriction_is_always_true to reduce  
NullTest quals that are provably false or true.  
  
However, since commit e2debb643, the planner natively performs  
NullTest deduction during constant folding.  Therefore, calling  
restriction_is_always_false and restriction_is_always_true immediately  
afterward is redundant and wastes CPU cycles.  We can safely remove  
them and simply rely on the constant folding to handle the deduction.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs4-vLmGXaUEZyOMacN0BVfqWCt2tM-eDVWdDfJnOQaauGg@mail.gmail.com  

M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/relnode.c

Remove obsolete SAMESIGN macro

commit   : ce1c17a3163fa5adaa7c6af90bb1b0164cc7a28f    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 4 Mar 2026 10:56:06 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 4 Mar 2026 10:56:06 +0900    

Click here for diff

The SAMESIGN macro was historically used as a helper for manual  
integer overflow checks.  However, since commit 4d6ad3125 introduced  
overflow-aware integer operations, this manual sign-checking logic is  
no longer necessary.  
  
The macro remains defined in brin_minmax_multi.c and timestamp.c, but  
is not used in either file.  This patch removes these definitions to  
clean things up.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs4-NL3J3hQ3LzrwV-YUkQC18P+jM7ZiegQyAHzgdZev2qg@mail.gmail.com  

M src/backend/access/brin/brin_minmax_multi.c
M src/backend/utils/adt/timestamp.c

Add some tests for CREATE OR REPLACE VIEW with column additions

commit   : 9ef6381829cb92a23ed7730335a669cb16af3580    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 09:55:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Mar 2026 09:55:58 +0900    

Click here for diff

When working on an already-defined view with matching attributes, CREATE  
OR REPLACE VIEW would internally generate an ALTER TABLE command with a  
set of AT_AddColumnToView sub-commands, one for each attribute added.  
  
Such a command is stored in event triggers twice:  
- Once as a simple command.  
- Once as an ALTER TABLE command, as it has sub-commands.  
  
There was no test coverage to track this command pattern in terms of  
event triggers and DDL deparsing:  
- For the test module test_ddl_deparse, two command notices are issued.  
- For event triggers, a CREATE VIEW command is logged twice, which may  
look a bit weird first, but again this maps with the internal behavior  
of how the commands are built, and how the event trigger code reacts in  
terms of commands gathered.  
  
While on it, this adds a test for CREATE SCHEMA with a CREATE VIEW  
command embedded in it, case supported by the grammar but not covered  
yet.  
  
This hole in the test coverage has been found while digging into what  
would be a similar behavior for sequences if adding attributes to them  
with ALTER TABLE variants, after the initial relation creation.  
  
Discussion: https://postgr.es/m/aaFG9bqkEn0RhLJG@paquier.xyz  

M src/test/modules/test_ddl_deparse/expected/create_view.out
M src/test/modules/test_ddl_deparse/sql/create_view.sql
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql

Add read_stream_{pause,resume}()

commit   : 38229cb905165fe676ab8728cb9dd0833a5534ed    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 3 Mar 2026 15:55:52 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 3 Mar 2026 15:55:52 -0500    

Click here for diff

Read stream users can now pause lookahead when no blocks are currently  
available. After resuming, subsequent read_stream_next_buffer() calls  
continue lookahead with the previous lookahead distance.  
  
This is especially useful for read stream users with self-referential  
access patterns (where consuming already-read buffers can produce  
additional block numbers).  
  
Author: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKGJLT2JvWLEiBXMbkSSc5so_Y7%3DN%2BS2ce7npjLw8QL3d5w%40mail.gmail.com  

M src/backend/storage/aio/read_stream.c
M src/include/storage/read_stream.h

doc: Add restart on failure to example systemd file

commit   : b30656ce0071806ce649f2b69a4d06018d5c01a4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 13:13:45 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 13:13:45 +0100    

Click here for diff

The documentation previously had a systemd unit file that would not  
attempt to recover from process failures such as OOM's, segfaults,  
etc.  This commit adds "Restart=on-failure",` which tells systemd to  
attempt to restart the process after failure.  This is the recommended  
configuration per the systemd documentation: "Setting this to  
on-failure is the recommended choice for long-running services".  Many  
PostgreSQL users will simply copy/paste what the PostgreSQL  
documentation recommends and will probably do their own research and  
change the service file to restart on failure, so might as well set  
this as the default in the PostgreSQL documentation.  
  
Author: Andrew Jackson <andrewjackson947@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAKK5BkFfMpAQnv8CLs%3Di%3DrZwurtCV_gmfRb0uZi-V%2Bd6wcryqg%40mail.gmail.com  

M doc/src/sgml/runtime.sgml

Reduce scope of for-loop-local variables to avoid shadowing

commit   : cece37c9843c980b5be2f6d24c2b9cef1f9429a7    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Mar 2026 11:19:23 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Mar 2026 11:19:23 +0100    

Click here for diff

Adjust a couple of for-loops where a local variable was shadowed by  
another in the same scope, by renaming it as well as reducing its scope  
to the containing for-loop.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAEoWx2kQ2x5gMaj8tHLJ3=jfC+p5YXHkJyHrDTiQw2nn2FJTmQ@mail.gmail.com  

M src/backend/backup/basebackup_incremental.c
M src/backend/parser/parse_target.c

Reduce the scope of volatile qualifiers

commit   : f2d7570cdde75fd67acb279063b2701806662035    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 10:01:44 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 10:01:44 +0100    

Click here for diff

Commit c66a7d75e652 introduced a new "cast discards ‘volatile’"  
warning (-Wcast-qual) in vac_truncate_clog().  
  
Instead of making use of unvolatize(), remove the warning by reducing the  
scope of the volatile qualifier (added in commit 2d2e40e3bef) to only  
2 fields.  
  
Also do the same for vac_update_datfrozenxid(), since the intent of  
commit f65ab862e3b was to prevent the same kind of race condition that  
commit 2d2e40e3bef was fixing.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Suggested-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/aZ3a%2BV82uSfEjDmD%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/commands/vacuum.c

Add COPY (on_error set_null) option

commit   : 2a525cc97e19868940c533787165bc7e7de3a80a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 07:23:38 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Mar 2026 07:23:38 +0100    

Click here for diff

If ON_ERROR SET_NULL is specified during COPY FROM, any data type  
conversion errors will result in the affected column being set to a  
null value.  A column's not-null constraints are still enforced, and  
attempting to set a null value in such columns will raise a constraint  
violation error.  This applies to a column whose data type is a domain  
with a NOT NULL constraint.  
  
Author: Jian He <jian.universality@gmail.com>  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: "David G. Johnston" <david.g.johnston@gmail.com>  
Reviewed-by: Yugo NAGATA <nagata@sraoss.co.jp>  
Reviewed-by: torikoshia <torikoshia@oss.nttdata.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/flat/CAKFQuwawy1e6YR4S%3Dj%2By7pXqg_Dw1WBVrgvf%3DBP3d1_aSfe_%2BQ%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
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.in.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

doc: Fix sentence of pg_walsummary page

commit   : a1bd0c16157b71938f7bac118ff85b48902d8cc8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Mar 2026 15:27:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Mar 2026 15:27:50 +0900    

Click here for diff

Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Discussion: https://postgr.es/m/CAHut+PvfYBL-ppX-i8DPeRu7cakYCZz+QYBhrmQzicx7z_Tj5w@mail.gmail.com  
Backpatch-through: 17  

M doc/src/sgml/ref/pg_walsummary.sgml

doc: Clarify that empty COMMENT string removes the comment.

commit   : bae42a54e3dfb935e55f54c0ff350bdfd4503815    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Mar 2026 14:45:52 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Mar 2026 14:45:52 +0900    

Click here for diff

Clarify the documentation of COMMENT ON to state that specifying an empty  
string is treated as NULL, meaning that the comment is removed.  
  
This makes the behavior explicit and avoids possible confusion about how  
empty strings are handled.  
  
Also adds regress test cases that use empty string to remove a comment.  
  
Backpatch to all supported versions.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Reviewed-by: Shengbin Zhao <zshengbin91@gmail.com>  
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: zhangqiang <zhang_qiang81@163.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/26476097-B1C1-4BA8-AA92-0AD0B8EC7190@gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/comment.sgml
M src/test/regress/expected/create_index.out
M src/test/regress/expected/create_role.out
M src/test/regress/sql/create_index.sql
M src/test/regress/sql/create_role.sql

Add support for "exprs" in pg_restore_extended_stats()

commit   : ba97bf9cb7b4ca184ab669569be2633a46cfdd0c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Mar 2026 14:19:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Mar 2026 14:19:54 +0900    

Click here for diff

This commit adds support for the restore of extended statistics of the  
kind "exprs", counting for the statistics data computed for expressions.  
  
The input format consists of a jsonb object which must be an array of  
objects which are keyed by statistics parameter names, like this:  
[{"stat_type1": "...", "stat_type2": "...", ...},  
 {"stat_type1": "...", "stat_type2": "...", ...}, ...]  
  
The outer array must have as many elements as there are expressions  
defined in the statistics object, mapping with the way extended  
statistics are built with one pg_statistic tuple stored for each  
expression whose statistics have been computed.  The elements of the  
array must be either objects or null values (equivalent of invalid data,  
case also supported by the stats computations when its data is inserted  
in the catalogs).  
  
The keys of the inner objects are names of the statistical columns in  
pg_stats_ext_exprs (i.e. everything after "inherited").  Not all  
parameter keys need to be provided, those omitted being silently  
ignored.  Key values that do not match a statistical column name will  
cause a warning to be issued, but do not otherwise fail the expression  
or the import as a whole.  
  
The expected value type for all parameters is jbvString, which allows  
us to validate the values using the input function specific to that  
parameter.  Any parameters with a null value are silently ignored, same  
as if they were not provided in the first place.  
  
This commit includes a battery of test cases:  
- Sanity checks for what-should-be-all the failures in restore code  
paths, including parsing errors, parameter sanity checks depending on  
the extended stats object definition, etc.  
- Value injection, for scalar, array, range, multi-range cases.  
- Stats data cloning, with differential checks between the source  
relation and its target.  The source and the target should hold the same  
stats data after restore.  
- While expressions are supported in extended statistics since v14,  
range_length_histogram, range_empty_frac, and range_bounds_histogram  
have been added to pg_stat_ext_exprs only in v19.  A test case has been  
added to emulate a dump taken from v18, with expression stats restored  
for a range data type where these three fields are NULL.  
  
Support for pg_dump is included, with expressions supported since v14,  
inherited since v15, and data for range types in expressions in v19.  
  
pg_upgrade is the main use-case of this feature; it is also possible to  
inject statistics, same as for the other extstat kinds.  
  
As of this commit, ANALYZE should not be required after pg_upgrade when  
the cluster upgrading from uses extended statistics, as MCV,  
dependencies, expressions and ndistinct stats are all covered.  The  
stats data related to range types used in expressions requires v19,  
whose support has also been added.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=fPcci6oPyuyEZ0F4bWqAA7HzaWO+ZPptufuX5_uWt6kw@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

style: define parameterless functions as foo(void).

commit   : 11171fe1fc833c279f78e922c7f4b98c063b932b    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 2 Mar 2026 20:12:38 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 2 Mar 2026 20:12:38 -0800    

Click here for diff

Change pg_icu_unicode_version() to pg_icu_unicode_version(void),  
introduced by commit af2d4ca191. See commit 9b05e2ec08, which fixed  
similar cases.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aaEhpwrj1FY/8/7n@ip-10-97-1-34.eu-west-3.compute.internal  

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

Fix local-variable shadowing in pg_trgm's printSourceNFA().

commit   : cdaa67565867ba443afb66b9e82023d65487dc7c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Mar 2026 14:40:29 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Mar 2026 14:40:29 -0500    

Click here for diff

We hadn't noticed this violation of -Wshadow=compatible-local  
because this function isn't compiled without -DTRGM_REGEXP_DEBUG.  
  
As long as we have to clean it up, let's do so by converting all  
this function's loops to use C99 loop-local control variables.  
  
Reported-by: Sergei Kornilov <sk@zsrv.org>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3009911772478436@08341ecb-668d-43a9-af4d-b45f00c72521  

M contrib/pg_trgm/trgm_regexp.c

Add commit 7b24959434 to .git-blame-ignore-revs.

commit   : f191dc676632614ea1c74616f457096114f9fa29    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Mar 2026 13:23:28 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Mar 2026 13:23:28 -0600    

Click here for diff

M .git-blame-ignore-revs

basic_archive: Allow archive directory to be missing at startup.

commit   : cc774c543b23e91175642a65559aae456f17d89e    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Mar 2026 13:12:25 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Mar 2026 13:12:25 -0600    

Click here for diff

Presently, the GUC check hook for basic_archive.archive_directory  
checks that the specified directory exists.  Consequently, if the  
directory does not exist at server startup, archiving will be stuck  
indefinitely, even if it appears later.  To fix, remove this check  
from the hook so that archiving will resume automatically once the  
directory is present.  basic_archive must already be prepared to  
deal with the directory disappearing at any time, so no additional  
special handling is required.  
  
Reported-by: Олег Самойлов <splarv@ya.ru>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Sergei Kornilov <sk@zsrv.org>  
Discussion: https://postgr.es/m/73271769675212%40mail.yandex.ru  
Backpatch-through: 15  

M contrib/basic_archive/basic_archive.c

Fix OldestMemberMXactId and OldestVisibleMXactId array usage

commit   : ccae90abdbb61b43b4cb0625f8677f1ad079c61c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 2 Mar 2026 19:19:22 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 2 Mar 2026 19:19:22 +0200    

Click here for diff

Commit ab355e3a88 changed how the OldestMemberMXactId array is  
indexed. It's no longer indexed by synthetic dummyBackendId, but with  
ProcNumber. The PGPROC entries for prepared xacts come after auxiliary  
processes in the allProcs array, which rendered the calculation for  
MaxOldestSlot and the indexes into the array incorrect.  (The  
OldestVisibleMXactId array is not used for prepared xacts, and thus  
never accessed with ProcNumber's greater than MaxBackends, so this  
only affects the OldestMemberMXactId array.)  
  
As a result, a prepared xact would store its value past the end of the  
OldestMemberMXactId array, overflowing into the OldestVisibleMXactId  
array. That could cause a transaction's row lock to appear invisible  
to other backends, or other such visibility issues. With a very small  
max_connections setting, the store could even go beyond the  
OldestVisibleMXactId array, stomping over the first element in the  
BufferDescriptor array.  
  
To fix, calculate the array sizes more precisely, and introduce helper  
functions to calculate the array indexes correctly.  
  
Author: Yura Sokolov <y.sokolov@postgrespro.ru>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/7acc94b0-ea82-4657-b1b0-77842cb7a60c@postgrespro.ru  
Backpatch-through: 17  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

psql: Tab-complete ALTER ROLE ... IN DATABASE SET/RESET

commit   : 344b572e3eff620ffc2e3680730103e33a502bc6    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 2 Mar 2026 18:03:44 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 2 Mar 2026 18:03:44 +0100    

Click here for diff

Detailed completion of the RESET clause is still missing.  Not sure a  
detailed implementation is worth the trouble.  
  
Author: Ian Lawrence Barwick <barwick@gmail.com>  
Author: Vasuki M <vasukianand0119@gmail.com>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Reviewed-by: Dharin Shah <dharinshah95@gmail.com>  
Reviewed-by: Surya Poondla <suryapoondla4@gmail.com>  
Discussion: https://postgr.es/m/CAB8KJ=iH_v1YB2ss1A=BqvOAf28OVYiWRqUdE6TJ3pP-RdsPig@mail.gmail.com  

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

In pg_dumpall, don't skip role GRANTs with dangling grantor OIDs.

commit   : 74b4438a70b9a2ea654501ce061ae7dea1e6a2ea    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Mar 2026 11:14:58 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Mar 2026 11:14:58 -0500    

Click here for diff

In commits 29d75b25b et al, I made pg_dumpall's dumpRoleMembership  
logic treat a dangling grantor OID the same as dangling role and  
member OIDs: print a warning and skip emitting the GRANT.  This wasn't  
terribly well thought out; instead, we should handle the case by  
emitting the GRANT without the GRANTED BY clause.  When the source  
database is pre-v16, such cases are somewhat expected because those  
versions didn't prevent dropping the grantor role; so don't even  
print a warning that we did this.  (This change therefore restores  
pg_dumpall's pre-v16 behavior for these cases.)  The case is not  
expected in >= v16, so then we do print a warning, but soldiering on  
with no GRANTED BY clause still seems like a reasonable strategy.  
  
Per complaint from Robert Haas that we were now dropping GRANTs  
altogether in easily-reachable scenarios.  
  
Reported-by: Robert Haas <robertmhaas@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA+TgmoauoiW4ydDhdrseg+DD4Kwha=+TSZp18BrJeHKx3o1Fdw@mail.gmail.com  
Backpatch-through: 16  

M src/bin/pg_dump/pg_dumpall.c

Save prune cycles by consistently clearing prune hints on all-visible pages

commit   : 8b9d42bf6bd29b855a6bee21aa6010c070980086    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 2 Mar 2026 11:05:59 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 2 Mar 2026 11:05:59 -0500    

Click here for diff

All-visible pages can't contain prunable tuples. We already clear the  
prune hint (pd_prune_xid) during pruning of all-visible pages, but we  
were not doing so in vacuum phase three, nor initializing it for  
all-frozen pages created by COPY FREEZE, and we were not clearing it on  
standbys.  
  
Because page hints are not WAL-logged, pages on a standby carry stale  
pd_prune_xid values. After promotion, that stale hint triggers  
unnecessary on-access pruning.  
  
Fix this by clearing the prune hint everywhere we currently mark a heap  
page all-visible. Clearing it when setting PD_ALL_VISIBLE ensures no  
extra overhead.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/flat/CAAKRu_b-BMOyu0X-0jc_8bWNSbQ5K6JTEueayEhcQuw-OkCSKg%40mail.gmail.com  

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

Support using copyObject in standard C++

commit   : 1887d822f1428637c935b9f5e8be4a2a56fb77c7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 2 Mar 2026 11:46:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 2 Mar 2026 11:46:02 +0100    

Click here for diff

Calling copyObject in C++ without GNU extensions (e.g. when using  
-std=c++11 instead of -std=gnu++11) fails with an error like this:  
  
error: use of undeclared identifier 'typeof'; did you mean 'typeid'  
  
This is due to the C compiler used to compile PostgreSQL supporting  
typeof, but that function actually not being present in the C++  
compiler.  This fixes that by explicitely checking for typeof support  
in C++, and then either use that or define typeof ourselves as:  
  
    std::remove_reference_t<decltype(x)>  
  
According to the paper that led to adding typeof to the C standard,  
that's the C++ equivalent of the C typeof:  
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2927.htm#existing-decltype  
  
Author: Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/DGPW5WCFY7WY.1IHCDNIVVT300%2540jeltef.nl  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in
M src/test/modules/test_cplusplusext/test_cplusplusext.cpp

Check for memset_explicit() and explicit_memset()

commit   : 386ca3908de28dd882a62b8f97a329db07b23138    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 2 Mar 2026 07:47:42 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 2 Mar 2026 07:47:42 +0100    

Click here for diff

We can use either of these to implement a missing explicit_bzero().  
  
explicit_memset() is supported on NetBSD.  NetBSD hitherto didn't have  
a way to implement explicit_bzero() other than the fallback variant.  
  
memset_explicit() is the C23 standard, so we use it as first  
preference.  It is currently supported on:  
  
- NetBSD 11  
- FreeBSD 15  
- glibc 2.43  
  
It doesn't provide additional coverage, but as it's the new standard,  
its availability will presumably grow.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/c4701776-8d99-41da-938d-88528a3adc15%40eisentraut.org  

M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/port/explicit_bzero.c

Remove WAL page header flag XLP_BKP_REMOVABLE

commit   : f68d7e7483d240d8c92b8fc245a3a10199d426dd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 14:13:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 14:13:05 +0900    

Click here for diff

There are no known users of this flag.  The last supposed user was  
pglesslog, which is the reason why this flag has been introduced in  
core, based on an historical search pointing at a8d539f12498.  
  
I have mentioned that we may want to remove this flag back in 2018, due  
to zero users of it in core.  More recently, Noah has pointed out that  
this flag is not safe to use: XLP_BKP_REMOVABLE can be set by the WAL  
writer in a lock-free fashion with runningBackups > 0, meaning that some  
full-page images could be required but not logged, ultimately corrupting  
backups.  
  
Bump XLOG_PAGE_MAGIC.  
  
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/20250705001628.c3.nmisch@google.com  
Discussion: https://postgr.es/m/CAEze2WhiwKSoAvfUggjDeoeY0-rz9cTpfrHcqvBMmJxv-K_5DA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/include/access/xlog_internal.h

Fix memory allocation size in RegisterExtensionExplainOption()

commit   : f7dc17aa9116a90a235ecf77c46afbbd6b6f8fbc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 13:14:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 13:14:15 +0900    

Click here for diff

The allocations used for the static array ExplainExtensionOptionArray,  
that tracks a set of ExplainExtensionOption, used "char *" instead of  
ExplainExtensionOption as the memory size consumed by one element,  
underestimating the memory required by half.  
  
The initial allocation of ExplainExtensionNameArray wants to hold 16  
elements before being reallocated, and with "char *" it meant that there  
was enough space only for 8 ExplainExtensionOption elements, 16 bytes  
required for each element.  The backend would crash once one tries to  
register a 9th EXPLAIN option.  
  
As far as I can see, the allocation formulas of GetExplainExtensionId()  
have been copy-pasted to RegisterExtensionExplainOption(), but the  
internal maths of the copy were not adjusted accordingly.  
  
Oversight in c65bc2e1d14a.  
  
Author: Joel Jacobson <joel@compiler.org>  
Discussion: https://postgr.es/m/2a4bd2f5-2a2f-409f-8ac7-110dd3fad4fc@app.fastmail.com  
Backpatch-through: 18  

M src/backend/commands/explain_state.c

test_custom_types: Test module with fancy custom data types

commit   : 2176520089e8c78a2eadb693670f65eaabf8ede2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 11:10:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 11:10:31 +0900    

Click here for diff

This commit adds a new test module called "test_custom_types", that can  
be used to stress code paths related to custom data type  
implementations.  
  
Currently, this is used as a test suite to validate the set of fixes  
done in 3b7a6fa15720, that requires some typanalyze callbacks that can  
force very specific backend behaviors, as of:  
- typanalyze callback that returns "false" as status, to mark a failure  
in computing statistics.  
- typanalyze callback that returns "true" but let's the backend know  
that no interesting stats could be computed, with stats_valid set to  
"false".  
  
This could be extended more in the future if more problems are found.  
For simplicity, the module uses a fake int4 data type, that requires a  
btree operator class to be usable with extended statistics.  The type is  
created by the extension, and its properties are altered in the test.  
  
Like 3b7a6fa15720, this module is backpatched down to v14, for coverage  
purposes.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aaDrJsE1I5mrE-QF@paquier.xyz  
Backpatch-through: 14  

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

psql: Add tab completion for DELETE ... USING.

commit   : 0bf7d4ca9a6d0cd151de0209fd43671f158c1c88    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 2 Mar 2026 11:07:42 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 2 Mar 2026 11:07:42 +0900    

Click here for diff

This implements the tab completion that was marked as XXX TODO in the  
source code. The following completion is now supported:  
  
    DELETE FROM <table> USING <TAB> -> list of relations supporting SELECT  
  
This uses Query_for_list_of_selectables (instead of Query_for_list_of_tables)  
because the USING clause can reference not only tables but also views and  
other selectable objects, following the same syntax as the FROM clause  
of a SELECT statement.  
  
Author: Tatsuya Kawata <kawatatatsuya0913@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHza6qf0CLJuJr+5cQw0oWNebM5VyMB-ghoKBgnEjOQ_JtAiuw@mail.gmail.com  

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

Fix set of issues with extended statistics on expressions

commit   : 3b7a6fa1572000ffde0aa7dc951a1faf2f401618    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 09:38:37 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Mar 2026 09:38:37 +0900    

Click here for diff

This commit addresses two defects regarding extended statistics on  
expressions:  
- When building extended statistics in lookup_var_attr_stats(), the call  
to examine_attribute() did not account for the possibility of a NULL  
return value.  This can happen depending on the behavior of a typanalyze  
callback — for example, if the callback returns false, if no rows are  
sampled, or if no statistics are computed.  In such cases, the code  
attempted to build MCV, dependency, and ndistinct statistics using a  
NULL pointer, incorrectly assuming valid statistics were available,  
which could lead to a server crash.  
- When loading extended statistics for expressions,  
statext_expressions_load() did not account for NULL entries in the  
pg_statistic array storing expression statistics.  Such NULL entries can  
be generated when statistics collection fails for an expression, as may  
occur during the final step of serialize_expr_stats().  An extended  
statistics object defining N expressions requires N corresponding  
elements in the pg_statistic array stored for the expressions, and some  
of these elements can be NULL.  This situation is reachable when a  
typanalyze callback returns true, but sets stats_valid to indicate that  
no useful statistics could be computed.  
  
While these scenarios cannot occur with in-core typanalyze callbacks, as  
far as I have analyzed, they can be triggered by custom data types with  
custom typanalyze implementations, at least.  
  
No tests are added in this commit.  A follow-up commit will introduce a  
test module that can be extended to cover similar edge cases if  
additional issues are discovered.  This takes care of the core of the  
problem.  
  
Attribute and relation statistics already offer similar protections:  
- ANALYZE detects and skips the build of invalid statistics.  
- Invalid catalog data is handled defensively when loading statistics.  
  
This issue exists since the support for extended statistics on  
expressions has been added, down to v14 as of a4d75c86bf15.  Backpatch  
to all supported stable branches.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aaDrJsE1I5mrE-QF@paquier.xyz  
Backpatch-through: 14  

M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c

Correctly calculate "MCV frequency" for a unique column.

commit   : d80b0225010fd407c784bbecde116a28198b6eab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 1 Mar 2026 12:56:55 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 1 Mar 2026 12:56:55 -0500    

Click here for diff

In commit bd3e3e9e5, I over-hastily used 1 / rel->rows as the assumed  
frequency of entries in a column that ANALYZE has found to be unique.  
However, rel->rows is the number of table rows that are estimated to  
pass the query's restriction conditions, so that we got a too-large  
result if the query has selective restrictions.  What I should have  
used is 1 / rel->tuples, since that is the estimated total number of  
table rows.  The pre-existing code path that digs a frequency out of  
the histogram produces a frequency relative to the whole table, so  
surely this new alternative code path must do so as well.  Any  
correction needed on the basis of selectivity must be done by the  
user of the mcv_freq value.  
  
Fixing this causes all the regression test plans changed by bd3e3e9e5  
to revert to what they had been, except for the first change in  
join.out.  As I correctly argued in bd3e3e9e5, in that test case we  
have no stats and should not risk a hash join.  Evidently I was less  
correct to argue that the other changes were improvements.  
  
Reported-by: Joel Jacobson <joel@compiler.org>  
Diagnosed-by: Tender Wang <tndrwang@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/341b723c-da45-4058-9446-1514dedb17c1@app.fastmail.com  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out

psql: Show comments in \dRp+, \dRs+, and \dX+ psql meta-commands.

commit   : aecc558666ad62fbecb08ff7af1394656811a581    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Sat, 28 Feb 2026 23:56:46 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Sat, 28 Feb 2026 23:56:46 +0900    

Click here for diff

Previously, the psql meta-commands that list publications, subscriptions,  
and extended statistics did not display their associated comments,  
whereas other \d meta-commands did. This made it inconvenient for users  
to view these objects together with their descriptions.  
  
This commit improves \dRp+ and \dRs+ to include comments for publications  
and subscriptions. It also extends the \dX meta-command to accept the + option,  
allowing comments for extended statistics to be shown when requested.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Co-authored-by: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwGL4JqiKA26fnGx-cTM=VzoTs_uzqejvj4Fawyr4uLUUw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/test/regress/expected/publication.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/expected/subscription.out

Refactor detection of x86 ZMM registers

commit   : 51bb4a58ed23cb228e5dd2e5971843e785f4d913    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 28 Feb 2026 16:28:09 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 28 Feb 2026 16:28:09 +0700    

Click here for diff

- Call _xgetbv within x86_set_runtime_features rather than in a  
  separate function  
- Use symbols for XCR mask bits rather than a magic constant  
  
A future commit will build on this to detect YMM registers without  
code duplication.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CANWCAZbgEUFw7LuYSVeJ=Tj98R5HoOB1Ffeqk3aLvbw5rU5NTw@mail.gmail.com  

M src/port/pg_cpu_x86.c

Fix some -Wcast-qual warnings

commit   : 3f9886298052802258261e1bdcd3f1dd0e8399b9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Feb 2026 21:57:33 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 27 Feb 2026 21:57:33 +0100    

Click here for diff

This fixes some warnings from -Wcast-qual that are easy to fix,  
without using unconstify or the like.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/990c9117-b013-4026-aaf5-261fe2832c3d%40eisentraut.org  

M src/backend/access/gin/ginbulk.c
M src/backend/postmaster/launch_backend.c
M src/backend/utils/adt/xml.c
M src/backend/utils/error/elog.c
M src/common/jsonapi.c
M src/fe_utils/astreamer_lz4.c
M src/include/access/gin_private.h
M src/include/port/pg_lfind.h
M src/include/postmaster/postmaster.h
M src/interfaces/ecpg/preproc/parser.c

Doc: improve user docs and code comments about EXISTS(SELECT * ...).

commit   : 65a3ff8f1be0186a9c207821bcf0f543545a04d9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Feb 2026 15:20:16 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Feb 2026 15:20:16 -0500    

Click here for diff

Point out that Postgres automatically optimizes away the target list  
of an EXISTS' subquery, except in weird cases such as target lists  
containing set-returning functions.  Thus, both common conventions  
EXISTS(SELECT * FROM ...) and EXISTS(SELECT 1 FROM ...) are  
overhead-free and there's little reason to prefer one over the other.  
  
In the code comments, mention that the SQL spec says that  
EXISTS(SELECT * FROM ...) should be interpreted as EXISTS(SELECT  
some-literal FROM ...), but we don't choose to do it exactly that way.  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/9b301c70-3909-4f0f-98ca-9e3c4d142f3e@eisentraut.org  

M doc/src/sgml/func/func-subquery.sgml
M src/backend/optimizer/plan/subselect.c

Don't flatten join alias Vars that are stored within a GROUP RTE.

commit   : 98616ac18b49ac9f84a96177d8a7822f34904183    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Feb 2026 12:54:02 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 27 Feb 2026 12:54:02 -0500    

Click here for diff

The RTE's groupexprs list is used for deparsing views, and for that  
usage it must contain the original alias Vars; else we can get  
incorrect SQL output.  But since commit 247dea89f,  
parseCheckAggregates put the GROUP BY expressions through  
flatten_join_alias_vars before building the RTE_GROUP RTE.  
Changing the order of operations there is enough to fix it.  
  
This patch unfortunately can do nothing for already-created views:  
if they use a coding pattern that is subject to the bug, they will  
deparse incorrectly and hence present a dump/reload hazard in the  
future.  The only fix is to recreate the view from the original SQL.  
But the trouble cases seem to be quite narrow.  AFAICT the output  
was only wrong for "SELECT ... t1 LEFT JOIN t2 USING (x) GROUP BY x"  
where t1.x and t2.x were not of identical data types and t1.x was  
the side that required an implicit coercion.  If there was no hidden  
coercion, or if the join was plain, RIGHT, or FULL, the deparsed  
output was uglier than intended but not functionally wrong.  
  
Reported-by: Swirl Smog Dowry <swirl-smog-dowry@duck.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CA+-gibjCg_vjcq3hWTM0sLs3_TUZ6Q9rkv8+pe2yJrdh4o4uoQ@mail.gmail.com  
Backpatch-through: 18  

M src/backend/parser/parse_agg.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Centralize detection of x86 CPU features

commit   : 16743db061e431d40522547c6436af6616026caa    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Fri, 27 Feb 2026 20:30:41 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Fri, 27 Feb 2026 20:30:41 +0700    

Click here for diff

We now maintain an array of booleans that indicate which features were  
detected at runtime. When code wants to check for a given feature,  
the array is automatically checked if it has been initialized and if  
not, a single function checks all features at once.  
  
Move all x86 feature detection to pg_cpu_x86.c, and move the CRC  
function choosing logic to the file where the hardware-specific  
functions are defined, consistent with more recent hardware-specific  
files in src/port.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CANWCAZbgEUFw7LuYSVeJ=Tj98R5HoOB1Ffeqk3aLvbw5rU5NTw@mail.gmail.com  

A src/include/port/pg_cpu.h
M src/port/pg_cpu_x86.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_popcount_x86.c
M src/tools/pgindent/typedefs.list

Clean up nodes that are no longer of use in 007_pgdumpall.pl

commit   : d6d9b96b4044e5c744bf2c6474b2c5c2de355f85    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 27 Feb 2026 07:14:06 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 27 Feb 2026 07:14:06 -0500    

Click here for diff

Oversight in commit 763aaa06f03. When nodes are going out of scope, we  
should stop the underlying postmasters rather than waiting for the  
script to end.  
  
Per gripe from Tom Lane  
  
Discussion: https://postgr.es/m/740033.1772142754@sss.pgh.pa.us  

M src/bin/pg_dump/t/007_pg_dumpall.pl

Use pg_malloc_object() and pg_alloc_array() variants in frontend code

commit   : 574bee89c237d79e4dd3209f0fa3b10e0179b57a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Feb 2026 18:59:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 27 Feb 2026 18:59:41 +0900    

Click here for diff

This commit updates the frontend tools (src/bin/, contrib/ and  
src/test/) to use the memory allocation variants based on  
pg_malloc_object() and pg_malloc_array() in various code paths.  This  
does not cover all the allocations, but a good chunk of them.  
  
Like all the changes of this kind (31d3847a37be, etc.), this should  
encourage any future code to use this new style.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://postgr.es/m/cfb645da-6b3a-4f22-9bcc-5bc46b0e9c61@proxel.se  

M contrib/oid2name/oid2name.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_combinebackup/load_manifest.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/bin/pg_ctl/pg_ctl.c
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/slru_io.c
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/task.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/copy.c
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/bin/psql/variables.c
M src/bin/scripts/reindexdb.c
M src/test/isolation/isolationtester.c
M src/test/isolation/specparse.y
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/regress/pg_regress.c

Don't include proc.h in shm_mq.h

commit   : a2c89835f5124f9a98edffd953f42639bf9a31b5    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 27 Feb 2026 10:53:47 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 27 Feb 2026 10:53:47 +0100    

Click here for diff

This prevents proliferation of proc.h to tons of other places; shm_mq.h  
is widely included.  
  
Discussion: https://postgr.es/m/202602261733.s2rkxezwuif6@alvherre.pgsql  

M src/backend/access/brin/brin.c
M src/backend/access/gin/gininsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/transam/parallel.c
M src/backend/catalog/namespace.c
M src/backend/commands/async.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeGather.c
M src/backend/libpq/pqmq.c
M src/backend/optimizer/plan/createplan.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/misc/guc_tables.c
M src/include/access/parallel.h
M src/include/libpq/pqmq.h
M src/include/storage/shm_mq.h
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/worker.c

postgres_fdw: Fix thinko in comment for UserMappingPasswordRequired().

commit   : e7b97a22383a5310e0cf643468f648666de3970f    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 27 Feb 2026 17:05:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 27 Feb 2026 17:05:00 +0900    

Click here for diff

This commit also rephrases this comment to improve readability.  
  
Oversight in commit 6136e94dc.  
  
Reported-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Author: Andreas Karlsson <andreas@proxel.se>  
Co-authored-by: Etsuro Fujita <etsuro.fujita@gmail.com>  
Discussion: https://postgr.es/m/CAPmGK16pDnM_wU3kmquPj-M9MYqG3y0BdntRZ0eytqbCaFY3WQ%40mail.gmail.com  
Backpatch-through: 14  

M contrib/postgres_fdw/connection.c

Remove table_scan_analyze_next_tuple unneeded parameter OldestXmin

commit   : 284925508ae685a63ee056f89a336caecab64a63    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:35:32 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:35:32 -0500    

Click here for diff

heapam_scan_analyze_next_tuple() doesn't distinguish between dead and  
recently dead tuples when counting them, so it doesn't need OldestXmin.  
GetOldestNonRemovableTransactionId() isn't free, so removing it is a  
win.  
  
Looking at other table AMs implementing table_scan_analyze_next_tuple(),  
we couldn't find one using OldestXmin either, so remove it from the  
callback.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Suggested-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CALdSSPjvhGXihT_9f-GJabYU%3D_PjrFDUxYaURuTbfLyQM6TErg%40mail.gmail.com  

M src/backend/access/heap/heapam_handler.c
M src/backend/commands/analyze.c
M src/include/access/tableam.h

Simplify visibility check in heap_page_would_be_all_visible()

commit   : 3efe58febc3c6a48dc1be7d13243fd2183afe9a8    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:33:36 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:33:36 -0500    

Click here for diff

heap_page_would_be_all_visible() does not need to distinguish between  
HEAPTUPLE_RECENTLY_DEAD and HEAPTUPLE_DEAD tuples: any tuple in a state  
other than HEAPTUPLE_LIVE means the page is not all-visible and  
heap_page_would_be_all_visible() returns false.  
  
Given that, calling HeapTupleSatisfiesVacuum() is unnecessary, since it  
performs extra work to distinguish between dead and recently dead tuples  
using OldestXmin. Replace it with the more minimal  
HeapTupleSatisfiesVacuumHorizon().  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CALdSSPjvhGXihT_9f-GJabYU%3D_PjrFDUxYaURuTbfLyQM6TErg%40mail.gmail.com  

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

Fix more multibyte issues in ltree.

commit   : c8308a984d9dd45b3111bd99c8fba23cb78aeaa0    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 26 Feb 2026 12:23:22 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 26 Feb 2026 12:23:22 -0800    

Click here for diff

Commit 84d5efa7e3 missed some multibyte issues caused by short-circuit  
logic in the callers. The callers assumed that if the predicate string  
is longer than the label string, then it couldn't possibly be a match,  
but it can be when using case-insensitive matching (LVAR_INCASE) if  
casefolding changes the byte length.  
  
Fix by refactoring to get rid of the short-circuit logic as well as  
the function pointer, and consolidate the logic in a replacement  
function ltree_label_match().  
  
Discussion: https://postgr.es/m/02c6ef6cf56a5013ede61ad03c7a26affd27d449.camel@j-davis.com  
Backpatch-through: 14  

M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltxtquery_op.c

Fix memory leaks in pg_locale_icu.c.

commit   : d942511f08a0979d9042c9b1d0d56113a451382e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 29 Jan 2026 10:37:09 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 29 Jan 2026 10:37:09 -0800    

Click here for diff

The backport prior to 18 requires minor modification due to code  
refactoring.  
  
Discussion: https://postgr.es/m/e2b7a0a88aaadded7e2d19f42d5ab03c9e182ad8.camel@j-davis.com  
Backpatch-through: 16  

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

commit   : 5aea60839ba30440b1e1448dffc8334bbcf1a59a    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:04:49 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 26 Feb 2026 15:04:49 -0500    

Click here for diff

The LVRelState fields that track newly all-visible/all-frozen pages were  
previously named vm_new_visible_pages, vm_new_frozen_pages, and  
vm_new_visible_frozen_pages. The correct terminology is all-visible and  
all-frozen; omitting “all” was open to misinterpretation, as the page  
isn't visible or invisible, rather all the tuples on the page are  
visible to all running and future transactions. Rename the members  
accordingly.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/bqc4kh5midfn44gnjiqez3bjqv4zogydguvdn446riw45jcf3y%404ez66il7ebvk  

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

Don't include latch.h in libpq/libpq.h

commit   : 7b9b620d8fc764bda2b580dc7e654f6505934480    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 17:58:52 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 17:58:52 +0100    

Click here for diff

This reduces the inclusion footprint of latch.h a bit.  
  
Per suggestion from Andres Freund.  
  
Discussion: https://postgr.es/m/pap7mzhcxvuwlfdebjkh646ntyk4brtwm4dbocfpllwdccta5t@w3d7wz6mjpwv  

M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/pqcomm.c
M src/include/libpq/libpq.h

instrumentation: Drop INSTR_TIME_SET_CURRENT_LAZY macro

commit   : 9d6294c09ed0015e0f16b518e6e53000c856dd01    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Feb 2026 10:38:20 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Feb 2026 10:38:20 -0500    

Click here for diff

This macro had exactly one user in InstrStartNode, and the caller can  
instead use INSTR_TIME_IS_ZERO / INSTR_TIME_SET_CURRENT directly.  
  
This supports a future change that intends to modify the time source being  
used in the InstrStartNode case.  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53Pkx1bK1FB71_nBqYmzvSSXnp_MbE0ZDnU+baPJF6Ud2WDA@mail.gmail.com  

M src/backend/executor/instrument.c
M src/include/portability/instr_time.h

instrumentation: Rename INSTR_TIME_LT macro to INSTR_TIME_GT

commit   : 3218825271bd5ea3921ecd18e373bc76947c70bc    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Feb 2026 10:19:23 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 26 Feb 2026 10:19:23 -0500    

Click here for diff

This was incorrectly named "LT" for "larger than" in e5a5e0a90750d66, but  
that is against existing conventions, where "LT" means "less than".  
Clarify by using "GT" for "greater than" in macro name, and add a missing  
comment at the top of instr_time.h to note the macro's existence.  
  
Reported by: Peter Smith <smithpb2250@gmail.com>  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAHut%2BPut94CTpjQsqOJHdHkgJ2ZXq%2BqVSfMEcmDKLiWLW-hPfA%40mail.gmail.com  

M src/backend/executor/instrument.c
M src/include/portability/instr_time.h

Add non-text output formats to pg_dumpall

commit   : 763aaa06f03401584d07db71256fc0ab47235cce    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Feb 2026 15:08:55 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Feb 2026 15:08:55 -0500    

Click here for diff

pg_dumpall can now produce output in custom, directory, or tar formats  
in addition to plain text SQL scripts. When using non-text formats,  
pg_dumpall creates a directory containing:  
- toc.glo: global data (roles and tablespaces) in custom format  
- map.dat: mapping between database OIDs and names  
- databases/: subdirectory with per-database archives named by OID  
  
pg_restore is extended to handle these pg_dumpall archives, restoring  
globals and then each database. The --globals-only option can be used  
to restore only the global objects.  
  
This enables parallel restore of pg_dumpall output and selective  
restoration of individual databases from a cluster-wide backup.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
Co-Author: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-By: Tushar Ahuja <tushar.ahuja@enterprisedb.com>  
Reviewed-By: Jian He <jian.universality@gmail.com>  
Reviewed-By: Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com>  
Reviewed-By: Srinath Reddy <srinath2133@gmail.com>  
  
Discussion: https://postgr.es/m/cb103623-8ee6-4ba5-a2c9-f32e3a4933fa@dunslane.net  

M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
A src/bin/pg_dump/t/007_pg_dumpall.pl
M src/tools/pgindent/typedefs.list

Reduce includes in pgstat.h

commit   : 7bb50dd7d6b9f3cbad005aeb6eb9e4a065481b25    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 13:50:12 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 13:50:12 +0100    

Click here for diff

The lack of fallout here is somewhat surprising.  
  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/aY-UE-4t7FiYgH3t@alap3.anarazel.de  

M src/include/pgstat.h

pg_dump: Preserve NO INHERIT on NOT NULL on inheritance children

commit   : d0833fdae7ebb520e14db20ebd8973c5999f636e    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 11:50:26 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 26 Feb 2026 11:50:26 +0100    

Click here for diff

When the constraint is printed without the column, we were not printing  
the NO INHERIT flag.  
  
Author: Jian He <jian.universality@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/CACJufxEDEOO09G+OQFr=HmFr9ZDLZbRoV7+pj58h3_WeJ_K5UQ@mail.gmail.com  

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

EUC_CN, EUC_JP, EUC_KR, EUC_TW: Skip U+00A0 tests instead of failing.

commit   : 0163951b785e9b839706ce8e557066ad083beef1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Wed, 25 Feb 2026 18:13:22 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Wed, 25 Feb 2026 18:13:22 -0800    

Click here for diff

Settings that ran the new test euc_kr.sql to completion would fail these  
older src/pl tests.  Use alternative expected outputs, for which psql  
\gset and \if have reduced the maintenance burden.  This fixes  
"LANG=ko_KR.euckr LC_MESSAGES=C make check-world".  (LC_MESSAGES=C fixes  
IO::Pty usage in tests 010_tab_completion and 001_password.)  That file  
is new in commit c67bef3f3252a3a38bf347f9f119944176a796ce.  Back-patch  
to v14, like that commit.  
  
Discussion: https://postgr.es/m/20260217184758.da.noahmisch@microsoft.com  
Backpatch-through: 14  

M src/pl/plperl/GNUmakefile
M src/pl/plperl/expected/plperl_elog.out
M src/pl/plperl/expected/plperl_elog_1.out
A src/pl/plperl/expected/plperl_unicode.out
A src/pl/plperl/expected/plperl_unicode_1.out
M src/pl/plperl/meson.build
M src/pl/plperl/sql/plperl_elog.sql
A src/pl/plperl/sql/plperl_unicode.sql
M src/pl/plpython/expected/plpython_unicode.out
A src/pl/plpython/expected/plpython_unicode_1.out
M src/pl/plpython/sql/plpython_unicode.sql
M src/pl/tcl/expected/pltcl_unicode.out
A src/pl/tcl/expected/pltcl_unicode_1.out
M src/pl/tcl/sql/pltcl_unicode.sql

doc: Clarify INCLUDING COMMENTS behavior in CREATE TABLE LIKE.

commit   : b2ff2a0b52962dcbcbc9c5a8d74fd4e8c28d1f2a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Feb 2026 09:01:52 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Feb 2026 09:01:52 +0900    

Click here for diff

The documentation for the INCLUDING COMMENTS option of the LIKE clause  
in CREATE TABLE was inaccurate and incomplete. It stated that comments for  
copied columns, constraints, and indexes are copied, but regarding comments  
on constraints in reality only comments on CHECK and NOT NULL constraints  
are copied; comments on other constraints (such as primary keys) are not.  
In addition, comments on extended statistics are copied, but this was not  
documented.  
  
The CREATE FOREIGN TABLE documentation had a similar omission: comments  
on extended statistics are also copied, but this was not mentioned.  
  
This commit updates the documentation to clarify the actual behavior.  
The CREATE TABLE reference now specifies that comments on copied columns,  
CHECK constraints, NOT NULL constraints, indexes, and extended statistics are  
copied. The CREATE FOREIGN TABLE reference now notes that comments on  
extended statistics are copied as well.  
  
Backpatch to all supported versions. Documentation updates related to  
CREATE FOREIGN TABLE LIKE and NOT NULL constraint comment copying are  
not applied to v17 and earlier, since those features were introduced in v18.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwHSOSGcaYDvHF8EYCUCfGPjbRwGFsJ23cx5KbJ1X6JouQ@mail.gmail.com  
Backpatch-through: 14  

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

Fix ProcWakeup() resetting wrong waitStart field.

commit   : 70f470314cb45578d929240dfd6be3a12003830e    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Feb 2026 08:46:12 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 26 Feb 2026 08:46:12 +0900    

Click here for diff

Previously, when one process woke another that was waiting on a lock,  
ProcWakeup() incorrectly cleared its own waitStart field (i.e.,  
MyProc->waitStart) instead of that of the process being awakened.  
As a result, the awakened process retained a stale lock-wait start timestamp.  
  
This did not cause user-visible issues. pg_locks.waitstart was reported as  
NULL for the awakened process (i.e., when pg_locks.granted is true),  
regardless of the waitStart value.  
  
This bug was introduced by commit 46d6e5f56790.  
  
This commit fixes this by resetting the waitStart field of the process  
being awakened in ProcWakeup().  
  
Backpatch to all supported branches.  
  
Reported-by: Chao Li <li.evan.chao@gmail.com>  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: ji xu <thanksgreed@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/537BD852-EC61-4D25-AB55-BE8BE46D07D7@gmail.com  
Backpatch-through: 14  

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

Stabilize output of new isolation test insert-conflict-do-update-4.

commit   : 4c1a27e53a508f74883cda52a6c8612121d7fd6b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Feb 2026 10:51:42 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 25 Feb 2026 10:51:42 -0500    

Click here for diff

The test added by commit 4b760a181 assumed that a table's physical  
row order would be predictable after an UPDATE.  But a non-heap table  
AM might produce some other order.  Even with heap AM, the assumption  
seems risky; compare a3fd53bab for instance.  Adding an ORDER BY is  
cheap insurance and doesn't break any goal of the test.  
  
Author: Pavel Borisov <pashkin.elfe@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CALT9ZEHcE6tpvumScYPO6pGk_ASjTjWojLkodHnk33dvRPHXVw@mail.gmail.com  
Backpatch-through: 14  

M src/test/isolation/expected/insert-conflict-do-update-4.out
M src/test/isolation/specs/insert-conflict-do-update-4.spec

Fix unsafe RTE_GROUP removal in simplify_EXISTS_query

commit   : 77c7a17a6e5fefcd55edb6b47fc462a059b983dc    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 25 Feb 2026 11:13:21 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 25 Feb 2026 11:13:21 +0900    

Click here for diff

When simplify_EXISTS_query removes the GROUP BY clauses from an EXISTS  
subquery, it previously deleted the RTE_GROUP RTE directly from the  
subquery's range table.  
  
This approach is dangerous because deleting an RTE from the middle of  
the rtable list shifts the index of any subsequent RTE, which can  
silently corrupt any Var nodes in the query tree that reference those  
later relations.  (Currently, this direct removal has not caused  
problems because the RTE_GROUP RTE happens to always be the last entry  
in the rtable list.  However, relying on that is extremely fragile and  
seems like trouble waiting to happen.)  
  
Instead of deleting the RTE_GROUP RTE, this patch converts it in-place  
to be RTE_RESULT type and clears its groupexprs list.  This preserves  
the length and indexing of the rtable list, ensuring all Var  
references remain intact.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3472344.1771858107@sss.pgh.pa.us  
Backpatch-through: 18  

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

Fix USE_SLICING_BY_8_CRC32C builds on x86

commit   : 3322f01a11b79d4b3c84ae9322c0984891349e46    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 25 Feb 2026 08:44:59 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 25 Feb 2026 08:44:59 +0700    

Click here for diff

A future commit will move the CRC function choosing logic to the  
file where the hardware-specific functions are defined, but until  
then add guards for builds without those functions. Oversight in  
commit b9278871f.  
  
Per buildfarm animal rhinoceros  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/4014992.1771963187@sss.pgh.pa.us  

M src/port/pg_cpu_x86.c

pg_upgrade: Use max_protocol_version=3.0 for older servers

commit   : a60a103386a1e8bde65fa80feb2486d23bacbbcd    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 24 Feb 2026 14:01:37 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 24 Feb 2026 14:01:37 -0800    

Click here for diff

The grease patch in 4966bd3ed found its first problem: prior to the  
February 2018 patch releases, no server knew how to negotiate protocol  
versions, so pg_upgrade needs to take that into account when speaking to  
those older servers.  
  
This will be true even after the grease feature is reverted; we don't  
need anyone to trip over this again in the future. Backpatch so that all  
supported versions of pg_upgrade can gracefully handle an update to the  
default protocol version. (This is needed for any distributions that  
link older binaries against newer libpqs, such as Debian.) Branches  
prior to 18 need an additional version check, for the existence of  
max_protocol_version.  
  
Per buildfarm member crake.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAOYmi%2B%3D4QhCjssfNEoZVK8LPtWxnfkwT5p-PAeoxtG9gpNjqOQ%40mail.gmail.com  
Backpatch-through: 14  

M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/task.c
M src/bin/pg_upgrade/version.c

Add backtrace support for Windows using DbgHelp API

commit   : 65707ed9afc924e0eec19a706b24af5bae1f9574    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Feb 2026 17:34:56 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 24 Feb 2026 17:34:56 +0100    

Click here for diff

Previously, backtrace generation on Windows would return an "unsupported"  
message.  With this commit, we rely on CaptureStackBackTrace() to capture  
the call stack and the DbgHelp API (SymFromAddrW, SymGetLineFromAddrW64)  
for symbol resolution.  
  
Symbol handler initialization (SymInitialize) is performed once per  
process and cached.  If initialization fails, the report for it is  
returned as the backtrace output.  The symbol handler is cleaned up via  
on_proc_exit() to release DbgHelp resources.  
  
The implementation provides symbol names, offsets, and addresses.  When  
PDB files are available, it also includes source file names and line  
numbers.  Symbol names and file paths are converted from UTF-16 to the  
database encoding using wchar2char(), which properly handles both UTF-8  
and non-UTF-8 databases on Windows.  When symbol information is  
unavailable or encoding conversion fails, it falls back to displaying raw  
addresses.  
  
The implementation uses the explicit UTF16 versions of the DbgHelp  
functions (SYMBOL_INFOW, SymFromAddrW, IMAGEHLP_LINEW64,  
SymGetLineFromAddrW64) rather than the generic versions.  This allows us  
to rely on predictable encoding conversion, rather than using the  
haphazard ANSI codepage that we'd get otherwise.  
  
DbgHelp is apparently available on all Windows platforms we support, so  
there are no version number checks.  
  
Author: Bryan Green <dbryan.green@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Discussion: https://postgr.es/m/a692c0fe-caca-4c08-9c5d-debfd0ef2504@gmail.com  

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

commit   : dea0812cda1998d6940a4a27369e998046009ae1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 11:27:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 11:27:49 +0100    

Click here for diff

This adds IDs to create_foreign_table.sgml's and  
alter_foreign_table.sgml's <varlistentry> and <refsect1>, similar to  
other reference pages.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Quan Zongliang <quanzongliang@yeah.net>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CACJufxE6fW2jFAyTFWEYdUSDP%3D9P2yYerdksPTgxqDM4DZvvvw%40mail.gmail.com  

M doc/src/sgml/ref/alter_foreign_table.sgml
M doc/src/sgml/ref/create_foreign_table.sgml

Make ALTER DOMAIN VALIDATE CONSTRAINT no-op when constraint is already validated

commit   : a99c6b56ffa74dae49e6847cc6c113d000c8ebd0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 10:56:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 10:56:17 +0100    

Click here for diff

Currently, AlterDomainValidateConstraint will re-validate a constraint  
that has already been validated, which would just waste cycles.  This  
operation should be a no-op when the constraint is already validated.  
This also aligns with ATExecValidateConstraint.  
  
Author: jian he <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CACJufxG=-Dv9fPJHqkA9c-wGZ2dDOWOXSp-X-0K_G7r-DgaASw@mail.gmail.com  

M src/backend/commands/typecmds.c

Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK constraints

commit   : f80bedd52b1501de51b7180cd817e3e1fc31429d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 10:30:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 24 Feb 2026 10:30:50 +0100    

Click here for diff

Previously, changing the generation expression of a virtual column was  
prohibited if the column was referenced by a CHECK constraint.  This  
lifts that restriction.  
  
RememberAllDependentForRebuilding within ATExecSetExpression will  
rebuild all the dependent constraints, later ATPostAlterTypeCleanup  
queues the required AlterTableStmt operations for ALTER TABLE Phase 3  
execution.  
  
Overall, ALTER COLUMN SET EXPRESSION on virtual columns may require  
scanning the table to re-verify any associated CHECK constraints, but  
it does not require a table rewrite in ALTER TABLE Phase 3.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CACJufxH3VETr7orF5rW29GnDk3n1wWbOE3WdkHYd3iPGrQ9E_A@mail.gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_virtual.sql

Fix variety of typos and grammar mistakes

commit   : 462fe0ff6215ae222fc866af621e4b86462289b1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 13:26:37 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 13:26:37 +0900    

Click here for diff

This commit includes a batch of fixes for various minor typos and  
grammar mistakes, that have been proposed to the hackers mailing list  
since the beginning of January.  
  
Similar batches are planned on a bi-monthly basis depending on the  
amount received, with the next one for the end of April.  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gist/gistget.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup_copy.c
M src/backend/commands/extension.c
M src/backend/statistics/extended_stats_funcs.c
M src/backend/storage/smgr/smgr.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/fe_utils/astreamer_zstd.c
M src/include/nodes/parsenodes.h

doc: Adjust some markups on pg_waldump page

commit   : e2f3d82f89bb997d5340d8f3022c51dfab78ac06    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 12:54:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 12:54:23 +0900    

Click here for diff

Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://postgr.es/m/CAHut+PuuPps9bUPvouU5dH=tOTiF8QBzQox5O7DqXeOFdda79Q@mail.gmail.com  

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

fe_utils: Sprinkle some pg_malloc_object() and pg_malloc_array()

commit   : ff393fa526648c091a3492da3bd6dd140e3c55e7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 12:34:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 24 Feb 2026 12:34:42 +0900    

Click here for diff

The idea is to encourage more the use of these allocation routines  
across the tree, as these offer stronger type safety guarantees than  
pg_malloc() & friends (type cast in the result, sizeof() embedded).  
This commit updates some code paths of src/fe_utils/.  
  
This commit is similar to 31d3847a37be.  
  
Author: Henrik TJ <henrik@0x48.dk>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://postgr.es/m/6df1b64e-1314-9afd-41a3-3fefb76225e1@0x48.dk  

M src/fe_utils/conditional.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/simple_list.c

Convert SpinLock* macros to static inline functions.

commit   : bfc321b4723e8ca5fd3adb22a2727ec5c55d3808    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 15:32:01 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 15:32:01 -0600    

Click here for diff

This is preparatory work for a proposed follow-up commit that would  
add assertions to these functions.  
  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/aZX2oUcKf7IzHnnK%40nathan  
Discussion: https://postgr.es/m/20200617183354.pm3biu3zbmo2pktq%40alap3.anarazel.de  

M src/include/storage/spin.h

Fix indentation from commit b380a56a3f9

commit   : 7b24959434629970c14fc5ee668585e491e565e4    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Feb 2026 16:22:11 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 23 Feb 2026 16:22:11 -0500    

Click here for diff

Per buildfarm animal koel  

M src/bin/pg_upgrade/check.c

Allow pg_{read,write}_all_data to access large objects.

commit   : d98197602790e60ddb63e491cd9768ab9fc410ed    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 14:55:21 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 14:55:21 -0600    

Click here for diff

Since the initial goal of pg_read_all_data was to be able to run  
pg_dump as a non-superuser without explicitly granting access to  
every object, it follows that it should allow reading all large  
objects.  For consistency, pg_write_all_data should allow writing  
all large objects, too.  
  
Author: Nitin Motiani <nitinmotiani@google.com>  
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Discussion: https://postgr.es/m/CAH5HC96dxAEvP78s1-JK_nDABH5c4w2MDfyx4vEWxBEfofGWsw%40mail.gmail.com  

M doc/src/sgml/user-manag.sgml
M src/backend/catalog/aclchk.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Work around lgamma(NaN) bug on AIX.

commit   : d743545d8471dbb0016313885392211f58ef2b1c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 15:30:44 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 15:30:44 -0500    

Click here for diff

lgamma(NaN) should produce NaN, but on older versions of AIX  
it reports an ERANGE error.  While that's been fixed in the latest  
version of libm, it'll take awhile for the fix to propagate.  This  
workaround is harmless even when the underlying bug does get fixed.  
  
Discussion: https://postgr.es/m/3603369.1771877682@sss.pgh.pa.us  

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

Use LOCKMODE in parse_relation.c/.h

commit   : aca61f7e5f8a8a96865d33d0a6f993bf346f47db    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 21:17:06 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 21:17:06 +0100    

Click here for diff

There were a couple of comments in parse_relation.c  
  
> Note: properly, lockmode should be declared LOCKMODE not int, but that  
> would require importing storage/lock.h into parse_relation.h.  Since  
> LOCKMODE is typedef'd as int anyway, that seems like overkill.  
  
but actually LOCKMODE has been in storage/lockdefs.h for a while,  
which is intentionally a more narrow header.  So we can include that  
one in parse_relation.h and just use LOCKMODE normally.  
  
An alternative would be to add a duplicate typedef into  
parse_relation.h, but that doesn't seem necessary here.  
  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/4bcd65fb-2497-484c-bb41-83cb435eb64d%40eisentraut.org  

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

libpq: Grease the protocol by default

commit   : 4966bd3ed95e0d02bf220c4bad2b292963827dd4    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 23 Feb 2026 10:48:20 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 23 Feb 2026 10:48:20 -0800    

Click here for diff

Send PG_PROTOCOL_GREASE and _pq_.test_protocol_negotiation, which were  
introduced in commit d8d7c5dc8, by default, and fail the connection if  
the server attempts to claim support for them. The hope is to provide  
feedback to noncompliant implementations and gain confidence in our  
ability to advance the protocol. (See the other commit for details.)  
  
To help end users navigate the situation, a link to our documentation  
that explains the behavior is displayed. We append this to the error  
message when the NegotiateProtocolVersion response is incorrect, or when  
the peer sends an error during startup that appears to be grease-  
related.  
  
It's still possible for users to connect to servers that don't support  
protocol negotiation, by adding max_protocol_version=3.0 to their  
connection strings. Only the default connection behavior is impacted.  
  
This commit is tracked as a PG19 open item and will be reverted before  
RC1. (The implementation here doesn't handle negotiation with later  
server versions, so it can't be released into the wild as a  
five-year-supported feature. But an improved implementation might be  
able to do so, in the future...)  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Restore AIX support.

commit   : 4a1b05caa55dc14a1f936af78d8d19c843bfd8b9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 13:34:22 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 13:34:22 -0500    

Click here for diff

The concerns that led us to remove AIX support in commit 0b16bb877  
have now been alleviated:  
  
1. IBM has stepped forward to provide support, including buildfarm  
animal(s).  
2. AIX 7.2 and later seem to be fine with large pg_attribute_aligned  
requirements.  Since 7.1 is now EOL anyway, we can just cease to  
support it.  
3. Tossing xlc support overboard seems okay as well.  It's a bit  
sad to drop one of the few remaining non-gcc-alike compilers, but  
working around xlc's bugs and idiosyncrasies doesn't seem justified  
by the theoretical portability benefits.  
4. Likewise, we can stop supporting 32-bit AIX builds.  This is  
not so much about whether we could build such executables as that  
they're too much of a pain to manage in the field, due to limited  
address space available for dynamic library loading.  
5. We hit on a way to manage catalog column alignment that doesn't  
require continuing developer effort (see commit ecae09725).  
  
Hence, this commit reverts 0b16bb877 and some follow-on commits  
such as e6bb491bf, except for not putting back XLC support nor  
the changes related to catalog column alignment.  
  
Some other notable changes from the way things were in v16:  
  
Prefer unnamed POSIX semaphores on AIX, rather than the default  
choice of SysV semaphores.  
  
Include /opt/freeware/lib in -Wl,-blibpath, even when it is not  
mentioned anywhere in LDFLAGS.  
  
Remove platform-specific adjustment of MEMSET_LOOP_LIMIT; maybe  
that's still the right thing, but it really ought to be re-tested.  
  
Silence compiler warnings related to getpeereid(), wcstombs_l(),  
and PAM conversation procs.  
  
Accept "libpythonXXX.a" as an okay name for the Python shared  
library (but only on AIX!).  
  
Author: Aditya Kamath <Aditya.Kamath1@ibm.com>  
Author: Srirama Kucherlapati <sriram.rk@in.ibm.com>  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CY5PR11MB63928CC05906F27FB10D74D0FD322@CY5PR11MB6392.namprd11.prod.outlook.com  

M Makefile
M config/python.m4
M configure
M configure.ac
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
A src/backend/port/aix/mkldexport.sh
M src/backend/utils/error/elog.c
M src/backend/utils/misc/ps_status.c
A src/include/port/aix.h
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/meson.build
A src/makefiles/Makefile.aix
M src/port/README
M src/port/strerror.c
A src/template/aix
M src/test/regress/Makefile
M src/tools/gen_export.pl
M src/tools/pginclude/headerscheck

Cope with AIX's alignment woes by using _Pragma("pack").

commit   : ecae09725236f5ebd4b91eb0f2d5c17a8ae477ca    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 12:34:51 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 12:34:51 -0500    

Click here for diff

Because we assume that int64 and double have the same alignment  
requirement, AIX's default behavior that alignof(double) = 4 while  
alignof(int64) = 8 is a headache.  There are two issues:  
  
1. We align both int8 and float8 tuple columns per ALIGNOF_DOUBLE,  
which is an ancient choice that can't be undone without breaking  
pg_upgrade and creating some subtle SQL-level compatibility issues  
too.  However, the cost of that is just some marginal inefficiency  
in fetching int8 values, which can't be too awful if the platform  
architects were willing to pay the same costs for fetching float8s.  
So our decision is to leave that alone.  This patch makes our  
alignment choices the same as they were pre-v17, namely that  
ALIGNOF_DOUBLE and ALIGNOF_INT64_T are whatever the compiler prefers  
and then MAXIMUM_ALIGNOF is the larger of the two.  (On all supported  
platforms other than AIX, all three values will be the same.)  
  
2.  We need to overlay C structs onto catalog tuples, and int8 fields  
in those struct declarations may not be aligned to match this rule.  
  
In the old branches we had some annoying rules about ordering catalog  
columns to avoid alignment problems, but nobody wants to resurrect  
those.  However, there's a better answer: make the compiler construe  
those struct declarations the way we need it to by using the pack(N)  
pragma.  This requires no manual effort to maintain going forward;  
we only have to insert the pragma into all the catalog *.h files.  
(As the catalogs stand at this writing, nothing actually changes  
because we've not moved any affected columns since v16; hence no  
catversion bump is required.  The point of this is to not have  
to worry about the issue going forward.)  
  
We did not have this option when the AIX port was first made.  This  
patch depends on the C99 feature _Pragma(), as well as the pack(N)  
pragma which dates to somewhere around gcc 4.0, and probably doesn't  
exist in xlc at all.  But now that we've agreed to toss xlc support  
out the window, there doesn't seem to be a reason not to go this way.  
  
In passing, I got rid of LONGALIGN[_DOWN] along with the configure  
probes for ALIGNOF_LONG.  We were not using those anywhere and it  
seems highly unlikely that we'd do so in future.  Instead supply  
INT64ALIGN[_DOWN], which isn't used either but at least could  
have a good reason to be used.  
  
Discussion: https://postgr.es/m/1127261.1769649624@sss.pgh.pa.us  

M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/catalog/genbki.h
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_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_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/pg_config.h.in

Warn upon successful MD5 password authentication.

commit   : bc60ee86066520ee0f86abd3d47bb8ab9757842f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 11:22:04 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 11:22:04 -0600    

Click here for diff

This uses the "connection warning" infrastructure introduced by  
commit 1d92e0c2cc to emit a WARNING when an MD5 password is used to  
authenticate.  MD5 password support was marked as deprecated in  
v18 and will be removed in a future release of Postgres.  These  
warnings are on by default but can be turned off via the existing  
md5_password_warnings parameter.  
  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Xiangyu Liang <liangxiangyu_2013@163.com>  
Discussion: https://postgr.es/m/aYzeAYEbodkkg5e-%40nathan  

M doc/src/sgml/config.sgml
M src/backend/libpq/crypt.c
M src/test/authentication/t/001_password.pl

Rename validate_relation_kind()

commit   : 797872f6b9c929a78677999c323ddc1ccb4e30d0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 17:38:06 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 17:38:06 +0100    

Click here for diff

There are three static definitions of validate_relation_kind() in the  
codebase, one each in table.c, indexam.c and sequence.c, validating that  
the given relation is a table, an index or a sequence respectively.  
The compiler knows which definition to use where because they are static.  
But this could be confusing to a reader. Rename these functions so that  
their names reflect the kind of relation they are validating. While at  
it, also update the comments in table.c to clarify the definition of  
table-like relkinds so that we don't have to maintain the exclusion list  
as the set of relkinds undergoes changes.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org  

M src/backend/access/index/indexam.c
M src/backend/access/sequence/sequence.c
M src/backend/access/table/table.c

Flip logic in table validate_relation_kind

commit   : d7be57ad85da54bf3c7e079e4941935e5d00fdf2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 17:26:29 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 17:26:29 +0100    

Click here for diff

It instead of checking which relkinds it shouldn't be, explicitly list  
the ones we accept.  This is used to check which relkinds are accepted  
in table_open() and related functions.  Before this change, figuring  
that out was always a few steps too complicated.  This also makes  
changes for new relkinds more explicit instead of accidental.  
Finally, this makes this more aligned with the functions of the same  
name in src/backend/access/index/indexam.c and  
src/backend/access/sequence/sequence.c.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org  

M src/backend/access/table/table.c

Disallow CR and LF in database, role, and tablespace names

commit   : b380a56a3f9556588a89013b765d67947d54f7d0    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 21 Feb 2026 17:17:48 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 21 Feb 2026 17:17:48 -0500    

Click here for diff

Previously, these characters could cause problems when passed through  
shell commands, and were flagged with a comment in string_utils.c  
suggesting they be rejected in a future major release.  
  
The affected commands are CREATE DATABASE, CREATE ROLE, CREATE TABLESPACE,  
ALTER DATABASE RENAME, ALTER ROLE RENAME, and ALTER TABLESPACE RENAME.  
  
Also add a pg_upgrade check to detect these invalid names in clusters  
being upgraded from pre-v19 versions, producing a report file listing  
any offending objects that must be renamed before upgrading.  
  
Tests have been modified accordingly.  
  
Author: Mahendra Singh Thalor <mahi6run@gmail.com>  
Reviewed-By: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-By: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-By: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-By: Srinath Reddy <srinath2133@gmail.com>  
  
Discussion: https://postgr.es/m/CAKYtNApkOi4FY0S7+3jpTqnHVyyZ6Tbzhtbah-NBbY-mGsiKAQ@mail.gmail.com  

M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_upgrade/check.c
M src/bin/scripts/t/020_createdb.pl
M src/fe_utils/string_utils.c
M src/test/modules/unsafe_tests/expected/alter_system_table.out
M src/test/modules/unsafe_tests/expected/rolenames.out
M src/test/modules/unsafe_tests/sql/alter_system_table.sql
M src/test/modules/unsafe_tests/sql/rolenames.sql
M src/test/regress/expected/tablespace.out
M src/test/regress/sql/tablespace.sql

meson: allow disabling building/installation of static libraries.

commit   : 78727dcba32ed374eb2e92df976649bff56e2056    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 16:25:54 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 16:25:54 +0100    

Click here for diff

We now support the common meson option -Ddefault_library, with values  
'both' (the default), 'shared' (install only shared libraries), and  
'static' (install only static libraries).  The 'static' choice doesn't  
actually work, since psql and other programs insist on linking to the  
shared version of libpq, but it's there pro-forma.  It could be built  
out if we really wanted, but since we have never supported the  
equivalent in the autoconf build system, there doesn't appear to be an  
urgent need.  
  
With an eye to re-supporting AIX, the internal implementation  
distinguishes whether to install libpgport.a and other static-only  
libraries from whether to build/install the static variant of  
libraries that we can build both ways.  This detail isn't exposed as a  
meson option, though it could be if there's demand.  
  
The Cirrus CI task SanityCheck now uses -Ddefault_library=shared to  
save a little bit of build time (and to test this option).  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/e8aa97db-872b-4087-b073-f296baae948d@eisentraut.org  

M .cirrus.tasks.yml
M doc/src/sgml/installation.sgml
M meson.build
M src/common/meson.build
M src/fe_utils/meson.build
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/libpq-oauth/meson.build
M src/interfaces/libpq/meson.build
M src/port/meson.build

Make use of pg_popcount() in more places.

commit   : f33b8793fd7306b81e8c614718ee8f01b4fa0cfd    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 09:26:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 09:26:00 -0600    

Click here for diff

This replaces some loops over word-length popcount functions with  
calls to pg_popcount().  Since pg_popcount() may use a function  
pointer for inputs with sizes >= a Bitmapset word, this produces a  
small regression for the common one-word case in bms_num_members().  
To deal with that, this commit adds an inlined fast-path for that  
case.  This fast-path could arguably go in pg_popcount() itself  
(with an appropriate alignment check), but that is left for future  
study.  
  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com  

M src/backend/nodes/bitmapset.c
M src/include/lib/radixtree.h

Remove uses of popcount builtins.

commit   : eb9ab7e0930aef9fe1da4b71d0979ebe5361ee48    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 09:26:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 23 Feb 2026 09:26:00 -0600    

Click here for diff

This commit replaces the implementations of pg_popcount{32,64} with  
branchless ones in plain C.  While these new implementations do not  
make use of more sophisticated population count instructions  
available on some CPUs, testing indicates they perform well,  
especially now that they are inlined.  Newer versions of popular  
compilers will automatically replace these with special  
instructions if possible, anyway.  A follow-up commit will replace  
various loops over these functions with calls to pg_popcount(),  
leaving us little reason to worry about micro-optimizing them  
further.  
  
Since this commit removes the only uses of the popcount builtins,  
we can also remove the corresponding configuration checks.  
  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/include/port/pg_bitutils.h
M src/port/pg_popcount_aarch64.c

Rename pg_crc32c_sse42_choose.c for general purpose

commit   : b9278871f991e0c1419b96b7508fe5206903fb1a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 23 Feb 2026 19:19:49 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 23 Feb 2026 19:19:49 +0700    

Click here for diff

Future commits will consolidate the CPU feature detection functionality  
now scattered around in various files, and the CRC "*_choose.c"  
files seem to be the natural place for it. For now, just rename in  
a separate commit to make it easier to follow the git log. Do the  
minimum necessary to keep the build systems functional, and build the  
new file pg_cpu_x86.c unconditionally using guards to control the  
visibility of its contents, following the model of some more recent  
files in src/port.  
  
Limit scope to x86 to reduce the number of moving parts, since the  
motivation for doing this now is to clear out some technical debt  
before adding AVX2 detection. Arm is left for future work.  
  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Discussion: https://postgr.es/m/CANWCAZbgEUFw7LuYSVeJ=Tj98R5HoOB1Ffeqk3aLvbw5rU5NTw@mail.gmail.com  

M configure
M configure.ac
M src/port/Makefile
M src/port/meson.build
R094 src/port/pg_crc32c_sse42_choose.c src/port/pg_cpu_x86.c

Change error message for sequence validate_relation_kind()

commit   : 55f385932920a232c490fe594d44fb9a9a236c5e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 10:56:54 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 10:56:54 +0100    

Click here for diff

We can just say "... is not a sequence" instead of the more  
complicated variant from before, which was probably copied from  
src/backend/access/table/table.c.  
  
Fix a typo in a comment in passing.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/6d3fef19-a420-4e11-8235-8ea534bf2080%40eisentraut.org  

M src/backend/access/sequence/sequence.c
M src/test/regress/expected/sequence.out

meson: Refactor libpq targets variables

commit   : 4bfbbeb679c09c28813d4545bb1f764c3041d475    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 10:37:38 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 10:37:38 +0100    

Click here for diff

Some of the knowledge of the libpq targets was spread around between  
the top-level meson.build and src/interfaces/libpq*.  This change  
organizes it more like other targets by having a libpq_targets  
variable that different subdirectories can add to.  
  
Discussion: https://www.postgresql.org/message-id/flat/e8aa97db-872b-4087-b073-f296baae948d%40eisentraut.org  

M meson.build
M src/interfaces/libpq-oauth/meson.build
M src/interfaces/libpq/meson.build

test_cplusplusext: Add C++ pg_fallthrough test case

commit   : 2f2c9d836373ed7f4c017a9d953264f33cc03e3e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M src/test/modules/test_cplusplusext/test_cplusplusext.cpp

Enable -Wimplicit-fallthrough option for clang

commit   : 0284e07599a53d27d744042c10aec3e2e674d5b5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    

Click here for diff

On clang, -Wimplicit-fallthrough requires annotations with attributes,  
but on gcc, -Wimplicit-fallthrough is the same as  
-Wimplicit-fallthrough=3, which allows annotations with comments.  In  
order to enforce consistent annotations with attributes on both  
compilers, we test first for -Wimplicit-fallthrough=5, which will  
succeed on gcc, and if that is not found we test for  
-Wimplicit-fallthrough.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M configure
M configure.ac
M meson.build

Fix additional fallthrough warning

commit   : 3f7a0e1e55eff9d96c6d4ac8aa03895de21e06bc    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    

Click here for diff

Clang warns about this one, but GCC did not.  (Apparently a bug in  
GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122796)  
  
Apparently, the previous "fall through" comment was introduced  
manually in commit f76892c9ff7e without the compiler actually asking  
for it.  
  
This is in preparation for enabling fallthrough warnings on Clang.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M src/bin/scripts/reindexdb.c

Fix additional fallthrough warnings from clang

commit   : 3a63b76571ba253e2784ba34377cdcbdb8ad6796    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 07:37:50 +0100    

Click here for diff

Clang warns if falling through to a case or default label that is  
immediately followed by break, but GCC does  
not (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432).  (MSVC also  
warns about the equivalent code in C++.)  
  
This is in preparation for enabling fallthrough warnings on Clang.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M contrib/isn/isn.c
M contrib/pg_overexplain/pg_overexplain.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/logical/decode.c
M src/backend/tcop/dest.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
M src/pl/plpgsql/src/pl_comp.c
M src/tools/pg_bsd_indent/indent.c

Avoid including utils/timestamp.h in conflict.h.

commit   : 308622edf1743aa407df0044cc4529aed8de15e6    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 23 Feb 2026 10:19:05 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 23 Feb 2026 10:19:05 +0530    

Click here for diff

conflict.h currently includes utils/timestamp.h despite only requiring  
basic timestamp type definitions. This creates unnecessary overhead.  
  
Replace the include with datatype/timestamp.h to provide the necessary  
types. This change requires explicitly including utils/timestamp.h in  
test_custom_fixed_stats.c, which previously relied on the indirect  
inclusion.  
  
Extracted from the larger patch by Andres Freund.  
Discussion: https://postgr.es/m/aY-UE-4t7FiYgH3t@alap3.anarazel.de  

M src/include/replication/conflict.h
M src/test/modules/test_custom_stats/test_custom_fixed_stats.c

doc: Add section "Options" for pg_controldata

commit   : ee465848846efe6da0c73c99a0fcde6982831468    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Feb 2026 13:42:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 23 Feb 2026 13:42:38 +0900    

Click here for diff

Adding this section brings consistency with the pages of other tools,  
potentially easing the introduction of new options in the future as  
these are now showing in the shape of a list.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://postgr.es/m/CAHut+PtSF5AW3DHpYA-_muDLms2xBUzHpd545snVj8vFpmsmGg@mail.gmail.com  

M doc/src/sgml/ref/pg_controldata.sgml

Align PGPROC to cache line boundary

commit   : 412f78c66eedbe9cf41a657f4566d86a69ab7af2    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Feb 2026 13:13:43 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Feb 2026 13:13:43 +0200    

Click here for diff

On common architectures, the PGPROC struct happened to be a multiple  
of 64 bytes on PG 18, but it's changed on 'master' since. There was  
worry that changing the alignment might hurt performance, due to false  
cacheline sharing across elements in the proc array. However, there  
was no explicit alignment, so any alignment to cache lines was  
accidental. Add explicit alignment to remove worry about false  
sharing.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi  

M src/include/storage/proc.h

Rearrange fields in PGPROC, for clarity

commit   : 2e0853176f8f28a7684aa8b5af73446332960725    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Feb 2026 12:45:13 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 22 Feb 2026 12:45:13 +0200    

Click here for diff

The ordering was pretty random, making it hard to get an overview of  
what's in it. Group related fields together, and add comments to act  
as separators between the groups.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi  

M src/include/storage/proc.h

doc: Add description of "filename" for pg_walsummary

commit   : 4476106c65d2ed3aed35887f9b94fbc55d96074a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 22 Feb 2026 15:12:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 22 Feb 2026 15:12:58 +0900    

Click here for diff

This command requires an input file (WAL summary file), that has to be  
specified without an option name.  The shape of the command and how to  
use this parameter is implied in its synopsis.  However, this page  
lacked a description of the parameter.  Listing parameters that do  
not require an option is a common practice across the docs.  See for  
example pg_dump, pg_restore, etc.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/CAHut+PtbQi8Dw_0upS9dd=Oh9OqfOdAo=0_DOKG=YSRT_a+0Fw@mail.gmail.com  

M doc/src/sgml/ref/pg_walsummary.sgml

Avoid name collision with NOT NULL constraints

commit   : 0eeffd31bf9bb73446387cd7eebbbf43148aa281    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 21 Feb 2026 12:22:08 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Sat, 21 Feb 2026 12:22:08 +0100    

Click here for diff

If a CREATE TABLE statement defined a constraint whose name is identical  
to the name generated for a NOT NULL constraint, we'd throw an  
(unnecessary) unique key violation error on  
pg_constraint_conrelid_contypid_conname_index: this can easily be  
avoided by choosing a different name for the NOT NULL constraint.  
  
Fix by passing the constraint names already created by  
AddRelationNewConstraints() to AddRelationNotNullConstraints(), so that  
the latter can avoid name collisions with them.  
  
Bug: #19393  
Author: Laurenz Albe <laurenz.albe@cybertec.at>  
Reported-by: Hüseyin Demir <huseyin.d3r@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/19393-6a82427485a744cf@postgresql.org  

M src/backend/catalog/heap.c
M src/backend/commands/tablecmds.c
M src/include/catalog/heap.h
M src/test/regress/expected/create_table.out
M src/test/regress/sql/create_table.sql

commit   : 36bbcd5be3ffee1aa03f69228022decef6ebd37a    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 20 Feb 2026 22:34:42 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 20 Feb 2026 22:34:42 +0200    

Click here for diff

The field was mainly used for the position in a LOCK's wait queue, but  
also as the position in a the freelist when the PGPROC entry was not  
in use. The reuse saves some memory at the expense of readability,  
which seems like a bad tradeoff. If we wanted to make the struct  
smaller there's other things we could do, but we're actually just  
discussing adding padding to the struct for performance reasons.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi  

M src/backend/access/transam/twophase.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

Speedup COPY FROM with additional function inlining.

commit   : dc592a41557b072178f1798700bf9c69cd8e4235    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Feb 2026 12:07:27 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 20 Feb 2026 12:07:27 -0600    

Click here for diff

Following the example set by commit 58a359e585, we can squeeze out  
a little more performance from COPY FROM (FORMAT {text,csv}) by  
inlining CopyReadLineText() and passing the is_csv parameter as a  
constant.  This allows the compiler to emit specialized code with  
fewer branches.  
  
This is preparatory work for a proposed follow-up commit that would  
further optimize this code with SIMD instructions.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Ayoub Kazar <ma_kazar@esi.dz>  
Tested-by: Manni Wood <manni.wood@enterprisedb.com>  
Discussion: https://postgr.es/m/CAOzEurSW8cNr6TPKsjrstnPfhf4QyQqB4tnPXGGe8N4e_v7Jig%40mail.gmail.com  

M src/backend/commands/copyfromparse.c

Fix expanding 'bounds' in pg_trgm's calc_word_similarity() function

commit   : 18bcdb75d155e68a9cb34b5b76d0bccd0a234110    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 20 Feb 2026 11:56:42 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 20 Feb 2026 11:56:42 +0200    

Click here for diff

If the 'bounds' array needs to be expanded, because the input contains  
more trigrams than the initial guess, the code didn't return the  
reallocated array correctly to the caller. That could lead to a crash  
in the rare case that the input string becomes longer when it's  
lower-cased. The only known instance of that is when an ICU locale is  
used with certain single-byte encodings. This was an oversight in  
commit 00896ddaf41f.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Backpatch-through: 18  

M contrib/pg_trgm/trgm_op.c

Fix computation of varnullingrels when translating appendrel Var

commit   : 691977d37037f30e39cc65f60e327f678f2cebe9    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Fri, 20 Feb 2026 17:57:53 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Fri, 20 Feb 2026 17:57:53 +0900    

Click here for diff

When adjust_appendrel_attrs translates a Var referencing a parent  
relation into a Var referencing a child relation, it propagates  
varnullingrels from the parent Var to the translated Var.  Previously,  
the code simply overwrote the translated Var's varnullingrels with  
those of the parent.  
  
This was incorrect because the translated Var might already possess  
nonempty varnullingrels.  This happens, for example, when a LATERAL  
subquery within a UNION ALL references a Var from the nullable side of  
an outer join.  In such cases, the translated Var correctly carries  
the outer join's relid in its varnullingrels.  Overwriting these bits  
with the parent Var's set caused the planner to lose track of the fact  
that the Var could be nulled by that outer join.  
  
In the reported case, because the underlying column had a NOT NULL  
constraint, the planner incorrectly deduced that the Var could never  
be NULL and discarded essential IS NOT NULL filters.  This led to  
incorrect query results where NULL rows were returned instead of being  
filtered out.  
  
To fix, use bms_add_members to merge the parent Var's varnullingrels  
into the translated Var's existing set, preserving both sources of  
nullability.  
  
Back-patch to v16.  Although the reported case does not seem to cause  
problems in v16, leaving incorrect varnullingrels in the tree seems  
like a trap for the unwary.  
  
Bug: #19412  
Reported-by: Sergey Shinderuk <s.shinderuk@postgrespro.ru>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19412-1d0318089b86859e@postgresql.org  
Backpatch-through: 16  

M src/backend/optimizer/util/appendinfo.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix constant in error message for recovery_target_timeline

commit   : 0dc22fff64716dc3937705f0b7d0980475b164c1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 20 Feb 2026 16:17:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 20 Feb 2026 16:17:57 +0900    

Click here for diff

The intention was to use PG_UINT32_MAX, not UINT_MAX.  Let's be  
consistent and use the same constant.  
  
Thinko in fd7d7b719137.  
  
Author: David Steele <david@pgbackrest.org>  
Discussion: https://postgr.es/m/aZfXO97jSQaTTlfD@paquier.xyz  

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

Avoid including worker_internal.h in pgstat.h.

commit   : 9842e8aca096d9b988a3ae924cdf4aa7e1bb2ea2    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 20 Feb 2026 09:26:33 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 20 Feb 2026 09:26:33 +0530    

Click here for diff

pgstat.h is a widely included header. Including worker_internal.h there is  
unnecessary and creates tight coupling. By refactoring  
pgstat_report_subscription_error() to fetch the required  
LogicalRepWorkerType internally rather than receiving it as an argument,  
we can eliminate the need for the internal header.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Author: Nisha Moond <nisha.moond412@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/aY-UE-4t7FiYgH3t@alap3.anarazel.de  

M src/backend/commands/functioncmds.c
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/storage/ipc/procsignal.c
M src/backend/utils/activity/pgstat_subscription.c
M src/include/pgstat.h
M src/include/replication/worker_internal.h
M src/test/modules/test_custom_stats/test_custom_var_stats.c

Remove SpinLockFree() and S_LOCK_FREE().

commit   : ba401828c194c17031a6a2dedd97bc0defd80d4b    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Feb 2026 16:19:41 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Feb 2026 16:19:41 -0600    

Click here for diff

S_LOCK_FREE() is used by the test program in s_lock.c, but nobody  
has voiced concerns about losing some coverage there.  
SpinLockFree() appears to have been unused since it was introduced  
by commit 499abb0c0f.  There was agreement to remove these in 2020,  
but it never happened.  Since we still have agreement for removal  
in 2026, let's do that now.  
  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/aZX2oUcKf7IzHnnK%40nathan  
Discussion: https://postgr.es/m/20200608225338.m5zho424w6lpwb2d%40alap3.anarazel.de  

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

Assume "inline" keyword is available.

commit   : aa71a35a40b504b33834238ee6d2d551ba4a3740    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Feb 2026 14:37:29 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 19 Feb 2026 14:37:29 -0600    

Click here for diff

This has been a keyword since C99, and we now require C11, so we no  
longer need to use __inline__ or to check for it at configure time.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/aZdGbDaV4_yKCMc-%40nathan  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/include/port/atomics/arch-x86.h
M src/include/storage/s_lock.h

Fix add_partial_path interaction with disabled_nodes

commit   : 6e466e1e839e2d40b30af9cbda107af867d259f6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Feb 2026 13:46:10 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 19 Feb 2026 13:46:10 -0500    

Click here for diff

Commit e22253467942fdb100087787c3e1e3a8620c54b2 adjusted the logic in  
add_path() to keep the path list sorted by disabled_nodes and then by  
total_cost, but failed to make the corresponding adjustment to  
add_partial_path. As a result, add_partial_path might sort the path list  
just by total cost, which could lead to later planner misbehavior.  
  
In principle, this should be back-patched to v18, but we are typically  
reluctant to back-patch planner fixes for fear of destabilizing working  
installations, and it is unclear to me that this has sufficiently  
serious consequences to justify an exception, so for now, no back-patch.  
  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: http://postgr.es/m/CAMbWs4-mO3jMK4t_LgcJ+7Eo=NmGgkxettgRaVbJzZvVZ1koMA@mail.gmail.com  

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

Add translator comment

commit   : fc3896c786a2df86904e138d819c16f263bf7673    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 19 Feb 2026 17:11:04 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 19 Feb 2026 17:11:04 +0100    

Click here for diff

Otherwise the message is not very clear.  
  
Backpatch-through: 18  

M src/backend/replication/syncrep.c

Remove no-longer-useful markers in pg_hba.conf.sample.

commit   : 2f248ad573ce30e6847318ce4ea5eec3f747cbda    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Feb 2026 11:08:52 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 19 Feb 2026 11:08:52 -0500    

Click here for diff

The source version of pg_hba.conf.sample contains  
@remove-line-for-nolocal@ markers that indicate which lines should  
be deleted for an installation that doesn't HAVE_UNIX_SOCKETS.  
We no longer support that case, and since commit f55808828 all  
that initdb is doing is unconditionally removing the markers.  
We might as well remove the markers from the source version and  
drop the removal code, which is unintelligible now anyway.  
  
This will not of course save any noticeable number of cycles  
in initdb, but it might save some confusion for future  
developers looking at pg_hba.conf.sample.  It also reduces the  
number of distinct cases that replace_token() has to support,  
possibly allowing some tightening of that function.  
  
Discussion: https://postgr.es/m/2287786.1771458157@sss.pgh.pa.us  

M src/backend/libpq/pg_hba.conf.sample
M src/bin/initdb/initdb.c

Add per-subscription wal_receiver_timeout setting.

commit   : fb80f388f4a140934f51f68578ba321152332ce7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 20 Feb 2026 01:00:09 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 20 Feb 2026 01:00:09 +0900    

Click here for diff

This commit allows setting wal_receiver_timeout per subscription  
using the CREATE SUBSCRIPTION and ALTER SUBSCRIPTION commands.  
The value is stored in the subwalrcvtimeout column of the pg_subscription  
catalog.  
  
When set, this value overrides the global wal_receiver_timeout for  
the subscription's apply worker. The default is -1, which means the  
global setting (from the server configuration, command line, role,  
or database) remains in effect.  
  
This feature is useful for configuring different timeout values for  
each subscription, especially when connecting to multiple publisher  
servers, to improve failure detection.  
  
Bump catalog version.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/a1414b64-bf58-43a6-8494-9704975a41e9@oss.nttdata.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Make GUC wal_receiver_timeout user-settable.

commit   : 8a6af3ad08799755e575275d0df5feb7b102ca35    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 20 Feb 2026 00:52:43 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 20 Feb 2026 00:52:43 +0900    

Click here for diff

When multiple subscribers connect to different publisher servers,  
it can be useful to set different wal_receiver_timeout values for  
each connection to better detect failures. However, previously  
this wasn't possible, which limited flexibility in managing subscriptions.  
  
This commit changes wal_receiver_timeout to be user-settable,  
allowing different values to be assigned using ALTER ROLE SET for  
each subscription owner. This effectively enables per-subscription  
configuration.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/a1414b64-bf58-43a6-8494-9704975a41e9@oss.nttdata.com  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc_parameters.dat

Log checkpoint request flags in checkpoint completion messages.

commit   : 5b93a5987bd704d2363295eee919eee45f84c286    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 19 Feb 2026 23:55:12 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 19 Feb 2026 23:55:12 +0900    

Click here for diff

Checkpoint completion log messages include more detail than checkpoint  
start messages, but previously omitted the checkpoint request flags,  
which were only logged at checkpoint start. As a result, users had to  
correlate completion messages with earlier start messages to see  
the full context.  
  
This commit includes the checkpoint request flags in the checkpoint  
completion log message as well. This duplicates some information,  
but makes the completion message self-contained and easier to interpret.  
  
Author: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Michael Banck <mbanck@gmx.net>  
Reviewed-by: Yuan Li <carol.li2025@outlook.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAMtXxw9tPwV=NBv5S9GZXMSKPeKv5f9hRhSjZ8__oLsoS5jcuA@mail.gmail.com  

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

Use fallthrough attribute instead of comment

commit   : 8354b9d6b602ea549bc8d85cb404771505662a7b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Feb 2026 08:41:03 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Feb 2026 08:41:03 +0100    

Click here for diff

Instead of using comments to mark fallthrough switch cases, use the  
fallthrough attribute.  This will (in the future, not here) allow  
supporting other compilers besides gcc.  The commenting convention is  
only supported by gcc, the attribute is supported by clang, and in the  
fullness of time the C23 standard attribute would allow supporting  
other compilers as well.  
  
Right now, we package the attribute into a macro called  
pg_fallthrough.  This commit defines that macro and replaces the  
existing comments with that macro invocation.  
  
We also raise the level of the gcc -Wimplicit-fallthrough= option from  
3 to 5 to enforce the use of the attribute.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M configure
M configure.ac
M contrib/btree_gin/btree_gin.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pgcrypto/pgp-info.c
M meson.build
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/explain.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/libpq/auth.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partprune.c
M src/backend/postmaster/postmaster.c
M src/backend/regex/regc_lex.c
M src/backend/regex/regcomp.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/storage/aio/aio.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/sort/tuplestore.c
M src/bin/pgbench/pgbench.c
M src/common/hashfn.c
M src/common/wchar.c
M src/include/c.h
M src/include/common/hashfn_unstable.h
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/libpq/fe-secure.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/tcl/pltcl.c
M src/port/snprintf.c
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/timezone/zic.c
M src/tools/pg_bsd_indent/indent.c
M src/tools/pg_bsd_indent/parse.c

Remove useless fallthrough annotation

commit   : 0c3fbb3fef1e805d39b7bae576a3b2da4f9e1858    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Feb 2026 08:41:03 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 Feb 2026 08:41:03 +0100    

Click here for diff

A fallthrough attribute after the last case is a constraint violation  
in C23, and clang warns about it (not about this comment, but if we  
changed it to an attribute).  Remove it.  (There was apparently never  
anything after this to fall through to, even in the first commit  
da07a1e8565.)  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org  

M src/backend/postmaster/postmaster.c

Sanitize some WAL-logging buffer handling in GIN and GiST code

commit   : 21e323e941cf6ff02f931cd21bcfe4ab2cb5d622    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Feb 2026 15:59:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 19 Feb 2026 15:59:20 +0900    

Click here for diff

As transam's README documents, the general order of actions recommended  
when WAL-logging a buffer is to unlock and unpin buffers after leaving a  
critical section.  This pattern was not being followed by some code  
paths of GIN and GiST, adjusted in this commit, where buffers were  
either unlocked or unpinned inside a critical section.  Based on my  
analysis of each code path updated here, there is no reason to not  
follow the recommended unlocking/unpin pattern done outside of a  
critical section.  
  
These inconsistencies are rather old, coming mainly from ecaa4708e5dd  
and ff301d6e690b.  The guidelines in the README predate these commits,  
being introduced in 6d61cdec0761.  
  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/CALdSSPgBPnpNNzxv0Y+_GNFzW6PmzRZYh+_hpf06Y1N2zLhZaQ@mail.gmail.com  

M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/transam/xloginsert.c

Simplify creation of built-in functions with default arguments.

commit   : 759b03b24ce96f0ba6d734b570d1a6f4a0fb1177    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Feb 2026 14:14:44 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 18 Feb 2026 14:14:44 -0500    

Click here for diff

Up to now, to create such a function, one had to make a pg_proc.dat  
entry and then overwrite it with a CREATE OR REPLACE command in  
system_functions.sql.  That's error-prone (cf. bug #19409) and  
results in leaving dead rows in the initial contents of pg_proc.  
  
Manual maintenance of pg_node_tree strings seems entirely impractical,  
and parsing expressions during bootstrap would be extremely difficult  
as well.  But Andres Freund observed that all the current use-cases  
are simple constants, and building a Const node is well within the  
capabilities of bootstrap mode.  So this patch invents a special case:  
if bootstrap mode is asked to ingest a non-null value for  
pg_proc.proargdefaults (which would otherwise fail in  
pg_node_tree_in), it parses the value as an array literal and then  
feeds the element strings to the input functions for the corresponding  
parameter types.  Then we can build a suitable pg_node_tree string  
with just a few more lines of code.  
  
This allows removing all the system_functions.sql entries that are  
just there to set up default arguments, replacing them with  
proargdefaults fields in pg_proc.dat entries.  The old technique  
remains available in case someone needs a non-constant default.  
  
The initial contents of pg_proc are demonstrably the same after  
this patch, except that (1) json_strip_nulls and jsonb_strip_nulls  
now have the correct provolatile setting, as per bug #19409;  
(2) pg_terminate_backend, make_interval, and drandom_normal  
now have defaults that don't include a type coercion, which is  
how they should have been all along.  
  
In passing, remove some unused entries from bootstrap.c's TypInfo[]  
array.  I had to add some new ones because we'll now need an entry for  
each default-possessing system function parameter, but we shouldn't  
carry more than we need there; it's just a maintenance gotcha.  
  
Bug: #19409  
Reported-by: Lucio Chiessi <lucio.chiessi@trustly.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/183292bb-4891-4c96-a3ca-e78b5e0e1358@dunslane.net  
Discussion: https://postgr.es/m/19409-e16cd2605e59a4af@postgresql.org  

M doc/src/sgml/bki.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/system_functions.sql
M src/backend/utils/cache/lsyscache.c
M src/include/bootstrap/bootstrap.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Use standard die() handler for SIGTERM in bgworkers

commit   : d62dca3b297413a11a594c9675f2fb22e931d01b    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 18 Feb 2026 19:59:34 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 18 Feb 2026 19:59:34 +0200    

Click here for diff

The previous default bgworker_die() signal would exit with elog(FATAL)  
directly from the signal handler. That could cause deadlocks or  
crashes if the signal handler runs while we're e.g holding a spinlock  
or in the middle of a memory allocation.  
  
All the built-in background workers overrode that to use the normal  
die() handler and CHECK_FOR_INTERRUPTS(). Let's make that the default  
for all background workers. Some extensions relying on the old  
behavior might need to adapt, but the new default is much safer and is  
the right thing to do for most background workers.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/5238fe45-e486-4c62-a7f3-c7d8d416e812@iki.fi  

M doc/src/sgml/bgworker.sgml
M src/backend/access/transam/parallel.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/test/modules/test_shm_mq/worker.c

Update obsolete comment

commit   : 3894f08abe490d31518d038b0a8eaa46ce971b03    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 18 Feb 2026 18:09:54 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 18 Feb 2026 18:09:54 +0100    

Click here for diff

table_tuple_update's update_indexes argument hasn't been a boolean since  
commit 19d8e2308bc5.  
  
Backpatch-through: 16  

M src/include/access/tableam.h

Force creation of stamp file after libpq library check in meson builds

commit   : 623a90c2ade60ae52bf19495d8670c9b72de4299    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 16:07:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 16:07:13 +0900    

Click here for diff

Previously, if --stamp_file was specified, libpq_check.pl would create a  
new stamp file only if none could be found.  If there was already a  
stamp file, the script would do nothing, leaving the previous stamp file  
in place.  This logic could cause unnecessary rebuilds because meson  
relies on the timestamp of the output files to determine if a rebuild  
should happen.  In this case, a stamp file generated during an older  
check would be kept, but we need a stamp file from the latest moment  
where the libpq check has been run, so as correct rebuild decisions can  
be taken.  
  
This commit changes libpq_check.pl so as a fresh stamp file is created  
each time libpq_check.pl is run, when --stamp_file is specified.  
  
Oversight in commit 4a8e6f43a6b5.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: VASUKI M <vasukim1992002@gmail.com>  
Discussion: https://postgr.es/m/CAN55FZ22rrN6gCn7urtmTR=_5z7ArZLUJu-TsMChdXwmRTaquA@mail.gmail.com  

M src/interfaces/libpq/libpq_check.pl

Switch SysCacheIdentifier to a typedef enum

commit   : ee642cccc43ca1a0ff4a4af2a457208b919af017    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 09:58:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 09:58:38 +0900    

Click here for diff

The main purpose of this change is to allow an ABI checker to understand  
when the list of SysCacheIdentifier changes, by switching all the  
routine declarations that relied on a signed integer for a syscache ID  
to this new type.  This is going to be useful in the long-term for  
versions newer than v19 so as we will be able to check when the list of  
values in SysCacheIdentifier is updated in a non-ABI compliant fashion.  
  
Most of the changes of this commit are due to the new definition of  
SyscacheCallbackFunction, where a SysCacheIdentifier is now required for  
the syscache ID.  It is a mechanical change, still slightly invasive.  
  
There are more areas in the tree that could be improved with an ABI  
checker in mind; this takes care of only one area.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/289125.1770913057@sss.pgh.pa.us  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/shippable.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/commands/alter.c
M src/backend/commands/extension.c
M src/backend/optimizer/util/predtest.c
M src/backend/parser/parse_oper.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/misc/superuser.c
M src/include/catalog/objectaddress.h
M src/include/replication/worker_internal.h
M src/include/utils/inval.h
M src/include/utils/syscache.h

Add concept of invalid value to SysCacheIdentifier

commit   : c06b5b99bbb0d0e5ddeea9661ec7678e3cf53b4c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 09:25:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 09:25:52 +0900    

Click here for diff

This commit tweaks the generation of the syscache IDs for the enum  
SysCacheIdentifier to now include an invalid value, with -1 assigned as  
value.  The concept of an invalid syscache ID exists when handling  
lookups of a ObjectAddress, based on their set of properties in  
ObjectPropertyType.  -1 is used for the case where an object type has no  
option for a syscache lookup.  
  
This has been found as independently useful while discussing a switch of  
SysCacheIdentifier to a typedef, as we already have places that want to  
know about the concept of an invalid value when dealing with  
ObjectAddresses.  
  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://postgr.es/m/aZQRnmp9nVjtxAHS@paquier.xyz  

M src/backend/catalog/aclchk.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/objectaddress.c

Fix one-off issue with cache ID in objectaddress.c

commit   : f7df12a66cc90ed12d24edba31eeedfb546ef14c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 08:47:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 Feb 2026 08:47:58 +0900    

Click here for diff

get_catalog_object_by_oid_extended() has been doing a syscache lookup  
when given a cache ID strictly higher than 0, which is wrong because the  
first valid value of SysCacheIdentifier is 0.  
  
This issue had no consequences, as the first value assigned in the  
enum SysCacheIdentifier is AGGFNOID, which is not used in the object  
type properties listed in objectaddress.c.  Even if an ID of 0 was  
hypotherically given, the code would still work with a less efficient  
heap-or-index scan.  
  
Discussion: https://postgr.es/m/aZTr_R6JGmqokUBb@paquier.xyz  

M src/backend/catalog/objectaddress.c

Use a bitmask for ExecInsertIndexTuples options

commit   : b7271aa1d71acda712a372213633fdb55c1465c1    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 17 Feb 2026 17:59:45 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 17 Feb 2026 17:59:45 +0100    

Click here for diff

... instead of passing a bunch of separate booleans.  
  
Also, rearrange the argument list in a hopefully more sensible order.  
  
Discussion: https://postgr.es/m/202602111846.xpvuccb3inbx@alvherre.pgsql  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com> (older version)  

M src/backend/commands/copyfrom.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h

Fix memory leak in new GUC check_hook

commit   : 661237056b3ad92af40bc674459152d5ea0a58bb    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 17 Feb 2026 16:38:24 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 17 Feb 2026 16:38:24 +0100    

Click here for diff

Commit 38e0190ced71 forgot to pfree() an allocation (freed in other  
places of the same function) in only one of several spots in  
check_log_min_messages().  Per Coverity.  Add that.  
  
While at it, avoid open-coding guc_strdup().  The new coding does a  
strlen() that wasn't there before, but I doubt it's measurable.  

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

Ignore SIGINT in walwriter and walsummarizer

commit   : a92b809f9da100ed5cef9d6b6ce2edd576449521    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 17 Feb 2026 17:18:31 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 17 Feb 2026 17:18:31 +0200    

Click here for diff

Previously, SIGINT was treated the same as SIGTERM in walwriter and  
walsummarizer. That decision goes back to when the walwriter process  
was introduced (commit ad4295728e04), and was later copied to  
walsummarizer. It was a pretty arbitrary decision back then, and we  
haven't adopted that convention in all the other processes that have  
been introduced later.  
  
Summary of how other processes respond to SIGINT:  
- Autovacuum launcher: Cancel the current iteration of launching  
- bgworker: Ignore (unless connected to a database)  
- checkpointer: Request shutdown checkpoint  
- bgwriter: Ignore  
- pgarch: Ignore  
- startup process: Ignore  
- walreceiver: Ignore  
- IO worker: die()  
  
IO workers are a notable exception in that they exit on SIGINT, and  
there's a documented reason for that: IO workers ignore SIGTERM, so  
SIGINT provides a way to manually kill them. (They do respond to  
SIGUSR2, though, like all the other processes that we don't want to  
exit immediately on SIGTERM on operating system shutdown.)  
  
To make this a little more consistent, ignore SIGINT in walwriter and  
walsummarizer. They have no "query" to cancel, and they react to  
SIGTERM just fine.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/818bafaf-1e77-4c78-8037-d7120878d87c@iki.fi  

M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c

Test most StaticAssert macros in C++ extensions

commit   : 451650eaacd5e482380f2b0e506fc81f5aa92fc7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Feb 2026 10:06:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Feb 2026 10:06:39 +0100    

Click here for diff

Most of the StaticAssert macros already worked in C++ with Clang and  
GCC:(the only compilers we're currently testing C++ extension support  
for).  This adds a regression test for them in our test C++ extension,  
so we can safely change their implementation without accidentally  
breaking C++.  
  
The only macros that StaticAssert macros that don't work yet are the  
StaticAssertVariableIsOfType and StaticAssertVariableIsOfTypeMacro.  
These will be added in a follow-on commit.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M src/test/modules/test_cplusplusext/test_cplusplusext.cpp

Test List macros in C++ extensions

commit   : 3d28ecb5ac76ae29ca0837dc81e7dacc2ab215eb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Feb 2026 10:06:32 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 17 Feb 2026 10:06:32 +0100    

Click here for diff

All of these macros already work in C++ with Clang and GCC (the only  
compilers we're currently testing C++ extension support for).  This  
adds a regression test for them in our test C++ extension, so we can  
safely change their implementation without accidentally breaking C++.  
Some of the List macros didn't work in C++ in the past (see commit  
d5ca15ee5), and this would have caught that.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M src/test/modules/test_cplusplusext/test_cplusplusext.cpp

Fix test_valid_server_encoding helper function.

commit   : bd626ef093b2e5f279285a344c8ac53d67cdfd76    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 17 Feb 2026 13:53:32 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 17 Feb 2026 13:53:32 +1300    

Click here for diff

Commit c67bef3f325 introduced this test helper function for use by  
src/test/regress/sql/encoding.sql, but its logic was incorrect.  It  
confused an encoding ID for a boolean so it gave the wrong results for  
some inputs, and also forgot the usual return macro.  The mistake didn't  
affect values actually used in the test, so there is no change in  
behavior.  
  
Also drop it and another missed function at the end of the test, for  
consistency.  
  
Backpatch-through: 14  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  

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

Suppress new "may be used uninitialized" warning.

commit   : 8cef93d8a5886b57099fcd32e92f12bc5df7bbd1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 16 Feb 2026 18:04:58 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 16 Feb 2026 18:04:58 -0800    

Click here for diff

Various buildfarm members, having compilers like gcc 8.5 and 6.3, fail  
to deduce that text_substring() variable "E" is initialized if  
slice_size!=-1.  This suppression approach quiets gcc 8.5; I did not  
reproduce the warning elsewhere.  Back-patch to v14, like commit  
9f4fd119b2cbb9a41ec0c19a8d6ec9b59b92c125.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1157953.1771266105@sss.pgh.pa.us  
Backpatch-through: 14  

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

hstore: Fix NULL pointer dereference with receive function

commit   : a6f823e77835a075265bc6accce0a17370ed6db5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Feb 2026 08:41:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Feb 2026 08:41:26 +0900    

Click here for diff

The receive function of hstore was not able to handle correctly  
duplicate key values when a new duplicate links to a NULL value, where a  
pfree() could be attempted on a NULL pointer, crashing due to a pointer  
dereference.  
  
This problem would happen for a COPY BINARY, when stacking values like  
that:  
aa => 5  
aa => null  
  
The second key/value pair is discarded and pfree() calls are attempted  
on its key and its value, leading to a pointer dereference for the value  
part as the value is NULL.  The first key/value pair takes priority when  
a duplicate is found.  
  
Per offline report.  
  
Reported-by: "Anemone" <vergissmeinnichtzh@gmail.com>  
Reported-by: "A1ex" <alex000young@gmail.com>  
Backpatch-through: 14  

M contrib/hstore/hstore_io.c

pg_upgrade: Use COPY for LO metadata for upgrades from < v12.

commit   : b33f753612846b20ed54e296a52a6a52a6c793bc    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 16 Feb 2026 15:13:06 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 16 Feb 2026 15:13:06 -0600    

Click here for diff

Before v12, pg_largeobject_metadata was defined WITH OIDS, so  
unlike newer versions, the "oid" column was a hidden system column  
that pg_dump's getTableAttrs() will not pick up.  Thus, for commit  
161a3e8b68, we did not bother trying to use COPY for  
pg_largeobject_metadata for upgrades from older versions.  This  
commit removes that restriction by adjusting the query in  
getTableAttrs() to pick up the "oid" system column and by teaching  
dumpTableData_copy() to use COPY (SELECT ...) for this catalog,  
since system columns cannot be used in COPY's column list.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/aYzuAz_ITUpd9ZvH%40nathan  

M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c

Ensure that all three build methods install the same set of files.

commit   : 6be5b76d66cadbea715defa109963939ea866922    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Feb 2026 15:20:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 Feb 2026 15:20:15 -0500    

Click here for diff

syscache_info.h was installed into $installdir/include/server/catalog  
if you use a non-VPATH autoconf build, but not if you use a VPATH  
build or meson.  That happened because the makefiles blindly install  
src/include/catalog/*.h, and in a non-VPATH build the generated  
header files would be swept up in that.  While it's hard to conjure  
a reason to need syscache_info.h outside of backend build, it's  
also hard to get the makefiles to skip syscache_info.h, so let's  
go the other way and install it in the other two cases too.  
  
Another problem, new in v19, was that meson builds install a copy of  
src/include/catalog/README, while autoconf builds do not.  The issue  
here is that that file is new and wasn't added to meson.build's  
exclusion list.  
  
While it's clearly a bug if different build methods don't install  
the same set of files, I doubt anyone would thank us for changing  
the behavior in released branches.  Hence, fix in master only.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/946828.1771185367@sss.pgh.pa.us  

M src/include/catalog/Makefile
M src/include/catalog/meson.build
M src/include/meson.build

doc: Add note to ssl_group config on X25519 and FIPS

commit   : db93988ab0e78396f2ed9e96c826ff988d12b9f2    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 16 Feb 2026 15:11:29 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 16 Feb 2026 15:11:29 +0100    

Click here for diff

The X25519 curve is not allowed when OpenSSL is configured for  
FIPS mode, so add a note to the documentation that the default  
setting must be altered for such setups.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3521653.1770666093@sss.pgh.pa.us  

M doc/src/sgml/config.sgml

Avoid using the X25519 curve in ssl tests

commit   : 07e90c6913586a5c46e55e162771aaa5a33811ba    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 16 Feb 2026 15:10:16 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 16 Feb 2026 15:10:16 +0100    

Click here for diff

The X25519 curve is disallowed when OpenSSL is configured for  
FIPS mode which makes the testsuite fail.  Since X25519 isn't  
required for the tests we can remove it to allow FIPS enabled  
configurations to run the tests.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3521653.1770666093@sss.pgh.pa.us  

M src/test/ssl/t/SSL/Server.pm

Change remaining StaticAssertStmt() to StaticAssertDecl()

commit   : d50c86e743755e7ea91e5980f09f8575e0cb338b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Feb 2026 09:13:10 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 Feb 2026 09:13:10 +0100    

Click here for diff

This completes the work started by commit 75f49221c22.  
  
In basebackup.c, changing the StaticAssertStmt to StaticAssertDecl  
results in having the same StaticAssertDecl() in 2 functions.  So, it  
makes more sense to move it to file scope instead.  
  
Also, as it depends on some computations based on 2 tar blocks, define  
TAR_NUM_TERMINATION_BLOCKS.  
  
In deadlock.c, change the StaticAssertStmt to StaticAssertDecl and  
keep it in the function scope.  Add new braces to avoid warning from  
-Wdeclaration-after-statement.  
  
In aset.c, change the StaticAssertStmt to StaticAssertDecl and move it  
to file scope.  
  
Finally, update the comments in c.h a bit.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/aYH6ii46AvGVCB84%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/backup/basebackup.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/utils/mmgr/aset.c
M src/include/c.h

Remove recovery.signal at recovery end when both signal files are present.

commit   : 351265a6c7fd15737e4b68cada778728fc325a8b    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Feb 2026 13:57:38 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 16 Feb 2026 13:57:38 +0900    

Click here for diff

When both standby.signal and recovery.signal are present, standby.signal  
takes precedence and the server runs in standby mode. Previously,  
in this case, recovery.signal was not removed at the end of standby mode  
(i.e., on promotion) or at the end of archive recovery, while standby.signal  
was removed. As a result, a leftover recovery.signal could cause  
a subsequent restart to enter archive recovery unexpectedly, potentially  
preventing the server from starting. This behavior was surprising and  
confusing to users.  
  
This commit fixes the issue by updating the recovery code to remove  
recovery.signal alongside standby.signal when both files are present and  
recovery completes.  
  
Because this code path is particularly sensitive and changes in recovery  
behavior can be risky for stable branches, this change is applied only to  
the master branch.  
  
Reported-by: Nikolay Samokhvalov <nik@postgres.ai>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: David Steele <david@pgbackrest.org>  
Discussion: https://postgr.es/m/CAM527d8PVAQFLt_ndTXE19F-XpDZui861882L0rLY3YihQB8qA@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/t/002_archiving.pl

pgcrypto: Tweak error message for incorrect session key length

commit   : 459576303dfb47d5b9626331df1f8e8767840ede    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Feb 2026 12:18:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Feb 2026 12:18:18 +0900    

Click here for diff

The error message added in 379695d3cc70 referred to the public key being  
too long.  This is confusing as it is in fact the session key included  
in a PGP message which is too long.  This is harmless, but let's be  
precise about what is wrong.  
  
Per offline report.  
  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Backpatch-through: 14  

M contrib/pgcrypto/expected/pgp-pubkey-session.out
M contrib/pgcrypto/px.c

Fix SUBSTRING() for toasted multibyte characters.

commit   : 9f4fd119b2cbb9a41ec0c19a8d6ec9b59b92c125    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 14 Feb 2026 12:16:16 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 14 Feb 2026 12:16:16 -0800    

Click here for diff

Commit 1e7fe06c10c0a8da9dd6261a6be8d405dc17c728 changed  
pg_mbstrlen_with_len() to ereport(ERROR) if the input ends in an  
incomplete character.  Most callers want that.  text_substring() does  
not.  It detoasts the most bytes it could possibly need to get the  
requested number of characters.  For example, to extract up to 2 chars  
from UTF8, it needs to detoast 8 bytes.  In a string of 3-byte UTF8  
chars, 8 bytes spans 2 complete chars and 1 partial char.  
  
Fix this by replacing this pg_mbstrlen_with_len() call with a string  
traversal that differs by stopping upon finding as many chars as the  
substring could need.  This also makes SUBSTRING() stop raising an  
encoding error if the incomplete char is past the end of the substring.  
This is consistent with the general philosophy of the above commit,  
which was to raise errors on a just-in-time basis.  Before the above  
commit, SUBSTRING() never raised an encoding error.  
  
SUBSTRING() has long been detoasting enough for one more char than  
needed, because it did not distinguish exclusive and inclusive end  
position.  For avoidance of doubt, stop detoasting extra.  
  
Back-patch to v14, like the above commit.  For applications using  
SUBSTRING() on non-ASCII column values, consider applying this to your  
copy of any of the February 12, 2026 releases.  
  
Reported-by: SATŌ Kentarō <ranvis@gmail.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Bug: #19406  
Discussion: https://postgr.es/m/19406-9867fddddd724fca@postgresql.org  
Backpatch-through: 14  

M src/backend/utils/adt/varlena.c
M src/test/regress/expected/encoding.out
M src/test/regress/sql/encoding.sql

pg_mblen_range, pg_mblen_with_len: Valgrind after encoding ereport.

commit   : 4644f8b23bb8cd5cf3454bcd69bc28a5fd5623a9    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 14 Feb 2026 12:16:16 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 14 Feb 2026 12:16:16 -0800    

Click here for diff

The prior order caused spurious Valgrind errors.  They're spurious  
because the ereport(ERROR) non-local exit discards the pointer in  
question.  pg_mblen_cstr() ordered the checks correctly, but these other  
two did not.  Back-patch to v14, like commit  
1e7fe06c10c0a8da9dd6261a6be8d405dc17c728.  
  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20260214053821.fa.noahmisch@microsoft.com  
Backpatch-through: 14  

M src/backend/utils/mb/mbutils.c

Perform radix sort on SortTuples with pass-by-value Datums

commit   : ef3c3cf6d021ff9884c513afd850a9fe85cad736    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 14 Feb 2026 13:50:06 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 14 Feb 2026 13:50:06 +0700    

Click here for diff

Radix sort can be much faster than quicksort, but for our purposes it  
is limited to sequences of unsigned bytes. To make tuples with other  
types amenable to this technique, several features of tuple comparison  
must be accounted for, i.e. the sort key must be "normalized":  
  
1. Signedness -- It's possible to modify a signed integer such that  
it can be compared as unsigned. For example, a signed char has range  
-128 to 127. If we cast that to unsigned char and add 128, the range  
of values becomes 0 to 255 while preserving order.  
  
2. Direction -- SQL allows specification of ASC or DESC. The  
descending case is easily handled by taking the complement of the  
unsigned representation.  
  
3. NULL values -- NULLS FIRST and NULLS LAST must work correctly.  
  
This commmit only handles the case where datum1 is pass-by-value  
Datum (possibly abbreviated) that compares like an ordinary  
integer. (Abbreviations of values of type "numeric" are a convenient  
counterexample.) First, tuples are partitioned by nullness in the  
correct NULL ordering. Then the NOT NULL tuples are sorted with radix  
sort on datum1. For tiebreaks on subsequent sortkeys (including the  
first sort key if abbreviated), we divert to the usual qsort.  
  
ORDER BY queries on pre-warmed buffers are up to 2x faster on high  
cardinality inputs with radix sort than the sort specializations added  
by commit 697492434, so get rid of them. It's sufficient to fall back  
to qsort_tuple() for small arrays. Moderately low cardinality inputs  
show more modest improvents. Our qsort is strongly optimized for very  
low cardinality inputs, but radix sort is usually equal or very close  
in those cases.  
  
The changes to the regression tests are caused by under-specified sort  
orders, e.g. "SELECT a, b from mytable order by a;". For unstable  
sorts, such as our qsort and this in-place radix sort, there is no  
guarantee of the order of "b" within each group of "a".  
  
The implementation is taken from ska_byte_sort() (Boost licensed),  
which is similar to American flag sort (an in-place radix sort) with  
modifications to make it better suited for modern pipelined CPUs.  
  
The technique of normalization described above can also be extended  
to the case of multiple keys. That is left for future work (Thanks  
to Peter Geoghegan for the suggestion to look into this area).  
  
Reviewed-by: Chengpeng Yan <chengpeng_yan@outlook.com>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Reviewed-by: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com> (earlier version)  
Discussion: https://postgr.es/m/CANWCAZYzx7a7E9AY16Jt_U3+GVKDADfgApZ-42SYNiig8dTnFA@mail.gmail.com  

M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h
M src/include/utils/tuplesort.h
M src/test/regress/expected/tuplesort.out
M src/tools/pgindent/typedefs.list

doc: Mention PASSING support for jsonpath variables

commit   : aa082bed0b6433b58815683dde425bce57ed931c    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 12:12:11 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 12:12:11 +0100    

Click here for diff

Commit dfd79e2d added a TODO comment to update this paragraph  
when support for PASSING was added.  Commit 6185c9737cf added  
PASSING but missed resolving this TODO.  Fix by expanding the  
paragraph with a reference to PASSING.  
  
Author: Aditya Gollamudi <adigollamudi@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20260117051406.sx6pss4ryirn2x4v@pgs  

M doc/src/sgml/json.sgml

doc: Update docs images README with required ditaa version

commit   : 4469fe176118607f1a1dbcbbe5de57f9156e293f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:50:17 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:50:17 +0100    

Click here for diff

The URL for Ditaa linked to the old Sourceforge version which is  
too old for what we need, the fork over on Github is the correct  
version to use for re-generating the SVG files for the docs. The  
required Ditaa version is 0.11.0 as it when SVG support as added.  
Running the version found on Sourceforge produce the error below:  
  
$ ditaa -E -S --svg in.txt out.txt  
Unrecognized option: --svg  
usage: ditaa <INPFILE> [OUTFILE] [-A] [-b <BACKGROUND>] [-d] [-E] [-e  
      <ENCODING>] [-h] [--help] [-o] [-r] [-S] [-s <SCALE>] [-T] [-t  
      <TABS>] [-v] [-W]  
  
While there, also mention that meson rules exists for building  
images.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://postgr.es/m/CAN55FZ2O-23xERF2NYcvv9DM_1c9T16y6mi3vyP=O1iuXS0ASA@mail.gmail.com  

M doc/src/sgml/images/README

meson: Add target for generating docs images

commit   : 4ec0e75afd488d41482ae10f6b5df9fa9a586dee    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:50:14 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:50:14 +0100    

Click here for diff

This adds an 'images' target to the meson build system in order to  
be able to regenerate the images used in the docs.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAN55FZ0c0Tcjx9=e-YibWGHa1-xmdV63p=THH4YYznz+pYcfig@mail.gmail.com  

A doc/src/sgml/images/meson.build
M doc/src/sgml/meson.build
M meson.build

pg_dump: Use pg_malloc_object() and pg_malloc_array()

commit   : 6736dea14afbe239588dad1c947ceb6e50adbf72    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Feb 2026 19:48:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Feb 2026 19:48:35 +0900    

Click here for diff

The idea is to encourage more the use of these allocation routines  
across the tree, as these offer stronger type safety guarantees than  
pg_malloc() & co (type cast in the result, sizeof() embedded).  This set  
of changes is dedicated to the pg_dump code.  
  
Similar work has been done as of 31d3847a37be, as one example.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>  
Discussion: https://postgr.es/m/CAHut+PvpGPDLhkHAoxw_g3jdrYxA1m16a8uagbgH3TGWSKtXNQ@mail.gmail.com  

M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/connectdb.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c

Restart BackgroundPsql's timer more nicely.

commit   : 53c6bd0aa3de58baf828e60c6c8934d0a10a8501    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:36:31 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 13 Feb 2026 11:36:31 +0100    

Click here for diff

Use BackgroundPsql's published API for automatically restarting  
its timer for each query, rather than manually reaching into it  
to achieve the same thing.  
  
010_tab_completion.pl's logic for this predates the invention  
of BackgroundPsql (and 664d75753 missed the opportunity to  
make it cleaner).  030_pager.pl copied-and-pasted the code.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1100715.1712265845@sss.pgh.pa.us  

M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/030_pager.pl

Improve error message for checksum failures in pgstat_database.c

commit   : 775fc014156bdfa6938ef02dce3d85364b1bd220    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Feb 2026 12:17:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 Feb 2026 12:17:08 +0900    

Click here for diff

This log message was referring to conflicts, but it is about checksum  
failures.  The log message improved in this commit should never show up,  
due to the fact that pgstat_prepare_report_checksum_failure() should  
always be called before pgstat_report_checksum_failures_in_db(), with a  
stats entry already created in the pgstats shared hash table.  The three  
code paths able to report database-level checksum failures follow  
already this requirement.  
  
Oversight in b96d3c389755.  
  
Author: Wang Peng <215722532@qq.com>  
Discussion: https://postgr.es/m/tencent_9B6CD6D9D34AE28CDEADEC6188DB3BA1FE07@qq.com  
Backpatch-through: 18  

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

Make pg_numa_query_pages() work in frontend programs

commit   : d7edcec35c7c28edb3bf283dfe9c892b042ca158    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 12 Feb 2026 19:41:06 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 12 Feb 2026 19:41:06 +0200    

Click here for diff

It's currently only used in the server, but it was placed in src/port  
with the idea that it might be useful in client programs too. However,  
it will currently fail to link if used in a client program, because  
CHECK_FOR_INTERRUPTS() is not usable in client programs. Fix that by  
wrapping it in "#ifndef FRONTEND".  
  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://www.postgresql.org/message-id/21cc7a48-99d9-4f69-9a3f-2c2de61ac8e5%40iki.fi  
Backpatch-through: 18  

M src/port/pg_numa.c

Fix comment neglected in commit ddc3250208

commit   : d7a4291bb73e891243de7649ba92e7337a476434    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 12 Feb 2026 19:41:02 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 12 Feb 2026 19:41:02 +0200    

Click here for diff

I renamed the field in commit ddc3250208, but missed this one  
reference.  

M src/include/replication/slot.h

Remove specialized word-length popcount implementations.

commit   : a4688988835f1f5e607040c8d89e52cbfba9369b    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 12 Feb 2026 11:32:49 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 12 Feb 2026 11:32:49 -0600    

Click here for diff

The uses of these functions do not justify the level of  
micro-optimization we've done and may even hurt performance in some  
cases (e.g., due to using function pointers).  This commit removes  
all architecture-specific implementations of pg_popcount{32,64} and  
converts the portable ones to inlined functions in pg_bitutils.h.  
These inlined versions should produce the same code as before (but  
inlined), so in theory this is a net gain for many machines.  A  
follow-up commit will replace the remaining loops over these  
word-length popcount functions with calls to pg_popcount(), further  
reducing the need for architecture-specific implementations.  
  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com  

M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c

Remove some unnecessary optimizations in popcount code.

commit   : cb7b2e5e8efb3e5fb08052425cd00f067a56f877    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 12 Feb 2026 11:32:49 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 12 Feb 2026 11:32:49 -0600    

Click here for diff

Over the past few releases, we've added a huge amount of complexity  
to our popcount implementations.  Commits fbe327e5b4, 79e232ca01,  
8c6653516c, and 25dc485074 did some preliminary refactoring, but  
many opportunities remain.  In particular, if we disclaim interest  
in micro-optimizing this code for 32-bit builds and in unnecessary  
alignment checks on x86-64, we can remove a decent chunk of code.  
I cannot find public discussion or benchmarks for the code this  
commit removes,  but it seems unlikely that this change will  
noticeably impact performance on affected systems.  
  
Suggested-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com  

M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c

Add support for INSERT ... ON CONFLICT DO SELECT.

commit   : 88327092ff06c48676d2a603420089bf493770f3    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 12 Feb 2026 09:55:06 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 12 Feb 2026 09:55:06 +0000    

Click here for diff

This adds a new ON CONFLICT action DO SELECT [FOR UPDATE/SHARE], which  
returns the pre-existing rows when conflicts are detected. The INSERT  
statement must have a RETURNING clause, when DO SELECT is specified.  
  
The optional FOR UPDATE/SHARE clause allows the rows to be locked  
before they are are returned. As with a DO UPDATE conflict action, an  
optional WHERE clause may be used to prevent rows from being selected  
for return (but as with a DO UPDATE action, rows filtered out by the  
WHERE clause are still locked).  
  
Bumps catversion as stored rules change.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Author: Marko Tiikkaja <marko@joh.to>  
Author: Viktor Holmberg <v@viktorh.net>  
Reviewed-by: Joel Jacobson <joel@compiler.org>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/d631b406-13b7-433e-8c0b-c6040c4b4663@Spark  
Discussion: https://postgr.es/m/5fca222d-62ae-4a2f-9fcb-0eca56277094@Spark  
Discussion: https://postgr.es/m/2b5db2e6-8ece-44d0-9890-f256fdca9f7e@proxel.se  
Discussion: https://postgr.es/m/CAL9smLCdV-v3KgOJX3mU19FYK82N7yzqJj2HAwWX70E=P98kgQ@mail.gmail.com  

M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/dml.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/merge.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/explain.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/execnodes.h
M src/include/nodes/lockoptions.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
A src/test/isolation/expected/insert-conflict-do-select.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-select.spec
M src/test/regress/expected/constraints.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/updatable_views.sql
M src/tools/pgindent/typedefs.list

Refactor slot synchronization logic in slotsync.c.

commit   : 788ec96d591d0a7c916f2f4332765f46410d73b5    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 12 Feb 2026 14:38:31 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 12 Feb 2026 14:38:31 +0530    

Click here for diff

Following e68b6adad9, the reason for skipping slot synchronization is  
stored as a slot property. This commit removes redundant function  
parameters that previously tracked this state, instead relying directly on  
the slot property.  
  
Additionally, this change centralizes the logic for skipping  
synchronization when required WAL has not yet been received or flushed. By  
consolidating this check, we reduce code duplication and the risk of  
inconsistent state updates across different code paths.  
  
In passing, add an assertion to ensure a slot is marked as temporary if a  
consistent point has not been reached during synchronization.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/TY4PR01MB16907DD16098BE3B20486D4569463A@TY4PR01MB16907.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/CAFPTHDZAA+gWDntpa5ucqKKba41=tXmoXqN3q4rpjO9cdxgQrw@mail.gmail.com  

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

Remove p_is_insert from struct ParseState.

commit   : 706cadde3239842a41a3375d50dda8b33325c008    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 12 Feb 2026 09:01:42 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Thu, 12 Feb 2026 09:01:42 +0000    

Click here for diff

The only place that used p_is_insert was transformAssignedExpr(),  
which used it to distinguish INSERT from UPDATE when handling  
indirection on assignment target columns -- see commit c1ca3a19df3.  
However, this information is already available to  
transformAssignedExpr() via its exprKind parameter, which is always  
either EXPR_KIND_INSERT_TARGET or EXPR_KIND_UPDATE_TARGET.  
  
As noted in the commit message for c1ca3a19df3, this use of  
p_is_insert isn't particularly pretty, so have transformAssignedExpr()  
use the exprKind parameter instead. This then allows p_is_insert to be  
removed entirely, which simplifies state management in a few other  
places across the parser.  
  
Author: Viktor Holmberg <v@viktorh.net>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/badc3b4c-da73-4000-b8d3-638a6f53a769@Spark  

M src/backend/parser/analyze.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_node.h

Reduce LEFT JOIN to ANTI JOIN using NOT NULL constraints

commit   : cf74558feb8f41b2bc459f59ed3f991024d04893    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Thu, 12 Feb 2026 15:30:13 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Thu, 12 Feb 2026 15:30:13 +0900    

Click here for diff

For a LEFT JOIN, if any var from the right-hand side (RHS) is forced  
to null by upper-level quals but is known to be non-null for any  
matching row, the only way the upper quals can be satisfied is if the  
join fails to match, producing a null-extended row.  Thus, we can  
treat this left join as an anti-join.  
  
Previously, this transformation was limited to cases where the join's  
own quals were strict for the var forced to null by upper qual levels.  
This patch extends the logic to check table constraints, leveraging  
the NOT NULL attribute information already available thanks to the  
infrastructure introduced by e2debb643.  If a forced-null var belongs  
to the RHS and is defined as NOT NULL in the schema (and is not  
nullable due to lower-level outer joins), we know that the left join  
can be reduced to an anti-join.  
  
Note that to ensure the var is not nullable by any lower-level outer  
joins within the current subtree, we collect the relids of base rels  
that are nullable within each subtree during the first pass of the  
reduce-outer-joins process.  This allows us to verify in the second  
pass that a NOT NULL var is indeed safe to treat as non-nullable.  
  
Based on a proposal by Nicolas Adenis-Lamarre, but this is not the  
original patch.  
  
Suggested-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>  
Author: Tender Wang <tndrwang@gmail.com>  
Co-authored-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CACPGbctKMDP50PpRH09in+oWbHtZdahWSroRstLPOoSDKwoFsw@mail.gmail.com  

M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Fix plpgsql's handling of "return simple_record_variable".

commit   : 9863c90759ecb3c200520db9a8b02c33eaec6e17    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Feb 2026 16:53:14 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Feb 2026 16:53:14 -0500    

Click here for diff

If the variable's value is null, exec_stmt_return() missed filling  
in estate->rettype.  This is a pretty old bug, but we'd managed not  
to notice because that value isn't consulted for a null result ...  
unless we have to cast it to a domain.  That case led to a failure  
with "cache lookup failed for type 0".  
  
The correct way to assign the data type is known by exec_eval_datum.  
While we could copy-and-paste that logic, it seems like a better  
idea to just invoke exec_eval_datum, as the ROW case already does.  
  
Reported-by: Pavel Stehule <pavel.stehule@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAFj8pRBT_ahexDf-zT-cyH8bMR_qcySKM8D5nv5MvTWPiatYGA@mail.gmail.com  
Backpatch-through: 14  

M src/pl/plpgsql/src/expected/plpgsql_domain.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_domain.sql

Fix pg_stat_get_backend_wait_event() for aux processes

commit   : 78a5e3074b824b4bbcb75ea4dd565ce735f54293    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 18:50:57 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 18:50:57 +0200    

Click here for diff

The pg_stat_activity view shows information for aux processes, but the  
pg_stat_get_backend_wait_event() and  
pg_stat_get_backend_wait_event_type() functions did not. To fix, call  
AuxiliaryPidGetProc(pid) if BackendPidGetProc(pid) returns NULL, like  
we do in pg_stat_get_activity().  
  
In version 17 and above, it's a little silly to use those functions  
when we already have the ProcNumber at hand, but it was necessary  
before v17 because the backend ID was different from ProcNumber. I  
have other plans for wait_event_info on master, so it doesn't seem  
worth applying a different fix on different versions now.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://www.postgresql.org/message-id/c0320e04-6e85-4c49-80c5-27cfb3a58108@iki.fi  
Backpatch-through: 14  

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

Add password expiration warnings.

commit   : 1d92e0c2cc4789255c630d8776bbe85ca9ebc27f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 11 Feb 2026 10:36:15 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 11 Feb 2026 10:36:15 -0600    

Click here for diff

This commit adds a new parameter called  
password_expiration_warning_threshold that controls when the server  
begins emitting imminent-password-expiration warnings upon  
successful password authentication.  By default, this parameter is  
set to 7 days, but this functionality can be disabled by setting it  
to 0.  This patch also introduces a new "connection warning"  
infrastructure that can be reused elsewhere.  For example, we may  
want to warn about the use of MD5 passwords for a couple of  
releases before removing MD5 password support.  
  
Author: Gilles Darold <gilles@darold.net>  
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: songjinzhou <tsinghualucky912@foxmail.com>  
Reviewed-by: liu xiaohui <liuxh.zj.cn@gmail.com>  
Reviewed-by: Yuefei Shi <shiyuefei1004@gmail.com>  
Reviewed-by: Steven Niu <niushiji@gmail.com>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/129bcfbf-47a6-e58a-190a-62fc21a17d03%40migops.com  

M doc/src/sgml/config.sgml
M src/backend/libpq/crypt.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/crypt.h
M src/include/miscadmin.h
M src/test/authentication/t/001_password.pl

Further stabilize a postgres_fdw test case.

commit   : a3fd53babb8e8bde688739ec367a6d170495cfb4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Feb 2026 11:03:01 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 11 Feb 2026 11:03:01 -0500    

Click here for diff

The buildfarm occasionally shows a variant row order in the output  
of this UPDATE ... RETURNING, implying that the preceding INSERT  
dropped one of the rows into some free space within the table rather  
than appending them all at the end.  It's not entirely clear why that  
happens some times and not other times, but we have established that  
it's affected by concurrent activity in other databases of the  
cluster.  In any case, the behavior is not wrong; the test is at fault  
for presuming that a seqscan will give deterministic row ordering.  
Add an ORDER BY atop the update to stop the buildfarm noise.  
  
The buildfarm seems to have shown this only in v18 and master  
branches, but just in case the cause is older, back-patch to  
all supported branches.  
  
Discussion: https://postgr.es/m/3866274.1770743162@sss.pgh.pa.us  
Backpatch-through: 14  

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

Cleanup for log_min_messages changes in 38e0190ced71

commit   : 1efdd7cc630a963e56f34d44877d2097b98166d6    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 11 Feb 2026 16:38:18 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 11 Feb 2026 16:38:18 +0100    

Click here for diff

* Remove an unused variable  
* Use "default log level" consistently (instead of "generic")  
* Keep the process types in alphabetical order (missed one place in the  
  SGML docs)  
* Since log_min_messages type was changed from enum to string, it  
  is a good idea to add single quotes when printing it out.  Otherwise  
  it fails if the user copies and pastes from the SHOW output to SET,  
  except in the simplest case.  Using single quotes reduces confusion.  
* Use lowercase string for the burned-in default value, to keep the same  
  output as previous versions.  
  
Author: Euler Taveira <euler@eulerto.com>  
Author: Man Zeng <zengman@halodbtech.com>  
Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/202602091250.genyflm2d5dw@alvherre.pgsql  

M doc/src/sgml/config.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/proctypelist.h
M src/include/utils/guc.h

Move ProcStructLock to the ProcGlobal struct

commit   : 7984ce7a1d21819865e473f17cb6b928cf58a10d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 16:48:45 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 16:48:45 +0200    

Click here for diff

It protects the freeProcs and some other fields in ProcGlobal, so  
let's move it there. It's good for cache locality to have it next to  
the thing it protects, and just makes more sense anyway. I believe it  
was allocated as a separate shared memory area just for historical  
reasons.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/b78719db-0c54-409f-b185-b0d59261143f@iki.fi  

M src/backend/postmaster/launch_backend.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

doc: Mention all SELECT privileges required by INSERT ... ON CONFLICT.

commit   : bc953bf52314ca881a18703f86b68743ef6f3a32    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:52:58 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:52:58 +0000    

Click here for diff

On the INSERT page, mention that SELECT privileges are also required  
for any columns mentioned in the arbiter clause, including those  
referred to by the constraint, and clarify that this applies to all  
forms of ON CONFLICT, not just ON CONFLICT DO UPDATE.  
  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Viktor Holmberg <v@viktorh.net>  
Discussion: https://postgr.es/m/CAEZATCXGwMQ+x00YY9XYG46T0kCajH=21QaYL9Xatz0dLKii+g@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/insert.sgml

doc: Clarify RLS policies applied for ON CONFLICT DO NOTHING.

commit   : 227a6ea65740bb8c5b1f37df016d7861fcba11c5    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:25:05 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:25:05 +0000    

Click here for diff

On the CREATE POLICY page, the description of per-command policies  
stated that SELECT policies are applied when an INSERT has an ON  
CONFLICT DO NOTHING clause. However, that is only the case if it  
includes an arbiter clause, so clarify that.  
  
While at it, also clarify the comment in the regression tests that  
cover this.  
  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Viktor Holmberg <v@viktorh.net>  
Discussion: https://postgr.es/m/CAEZATCXGwMQ+x00YY9XYG46T0kCajH=21QaYL9Xatz0dLKii+g@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/create_policy.sgml
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Remove useless store to local variable

commit   : ab32a9e21d37ede830635f502283883592ab0a62    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 11:49:18 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 11 Feb 2026 11:49:18 +0200    

Click here for diff

It was a leftover from commit 5764f611e1, which converted the loop to  
use dclist_foreach.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi  

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

Store information about Append node consolidation in the final plan.

commit   : 7358abcc6076f4b2530d10126ab379f8aea612a5    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 17:55:59 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 17:55:59 -0500    

Click here for diff

An extension (or core code) might want to reconstruct the planner's  
decisions about whether and where to perform partitionwise joins from  
the final plan. To do so, it must be possible to find all of the RTIs  
of partitioned tables appearing in the plan. But when an AppendPath  
or MergeAppendPath pulls up child paths from a subordinate AppendPath  
or MergeAppendPath, the RTIs of the subordinate path do not appear  
in the final plan, making this kind of reconstruction impossible.  
  
To avoid this, propagate the RTI sets that would have been present  
in the 'apprelids' field of the subordinate Append or MergeAppend  
nodes that would have been created into the surviving Append or  
MergeAppend node, using a new 'child_append_relid_sets' field for  
that purpose. The value of this field is a list of Bitmapsets,  
because each relation whose append-list was pulled up had its own  
set of RTIs: just one, if it was a partitionwise scan, or more than  
one, if it was a partitionwise join. Since our goal is to see where  
partitionwise joins were done, it is essential to avoid losing the  
information about how the RTIs were grouped in the pulled-up  
relations.  
  
This commit also updates pg_overexplain so that EXPLAIN (RANGE_TABLE)  
will display the saved RTI sets.  
  
Co-authored-by: Robert Haas <rhaas@postgresql.org>  
Co-authored-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com  

M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/tools/pgindent/typedefs.list

Improve type handling of varlena structures

commit   : 9181c870bada196711206f3a795bde6b8c43dcd3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Feb 2026 07:33:24 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 Feb 2026 07:33:24 +0900    

Click here for diff

This commit changes the definition of varlena to a typedef, so as it  
becomes possible to remove "struct" markers from various declarations in  
the code base.  Historically, "struct" markers are not the project style  
for variable declarations, so this update simplifies the code and makes  
it more consistent across the board.  
  
This change has an impact on the following structures, simplifying  
declarations using them:  
- varlena  
- varatt_indirect  
- varatt_external  
  
This cleanup has come up in a different path set that played with  
TOAST and varatt.h, independently worth doing on its own.  
  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aW8xvVbovdhyI4yo@paquier.xyz  

M contrib/amcheck/verify_heapam.c
M contrib/btree_gist/btree_utils_var.c
M contrib/pageinspect/heapfuncs.c
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/detoast.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/table/toast_helper.c
M src/backend/executor/tstoreReceiver.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/detoast.h
M src/include/access/heaptoast.h
M src/include/access/tableam.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/c.h
M src/include/fmgr.h
M src/include/utils/varbit.h
M src/include/utils/xml.h
M src/include/varatt.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c
M src/tools/pgindent/typedefs.list

Store information about elided nodes in the final plan.

commit   : 0d4391b265f83023d0b7eed71817517410f76e60    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 16:46:05 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 16:46:05 -0500    

Click here for diff

An extension (or core code) might want to reconstruct the planner's  
choice of join order from the final plan. To do so, it must be possible  
to find all of the RTIs that were part of the join problem in that plan.  
Commit adbad833f3d9e9176e8d7005f15ea6056900227d, together with the  
earlier work in 8c49a484e8ebb0199fba4bd68eaaedaf49b48ed0, is enough to  
let us match up RTIs we see in the final plan with RTIs that we see  
during the planning cycle, but we still have a problem if the planner  
decides to drop some RTIs out of the final plan altogether.  
  
To fix that, when setrefs.c removes a SubqueryScan, single-child Append,  
or single-child MergeAppend from the final Plan tree, record the type of  
the removed node and the RTIs that the removed node would have scanned  
in the final plan tree. It would be natural to record this information  
on the child of the removed plan node, but that would require adding an  
additional pointer field to type Plan, which seems undesirable.  So,  
instead, store the information in a separate list that the executor need  
never consult, and use the plan_node_id to identify the plan node with  
which the removed node is logically associated.  
  
Also, update pg_overexplain to display these details.  
  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com  

M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list

Store information about range-table flattening in the final plan.

commit   : adbad833f3d9e9176e8d7005f15ea6056900227d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 15:33:39 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 15:33:39 -0500    

Click here for diff

Suppose that we're currently planning a query and, when that same  
query was previously planned and executed, we learned something about  
how a certain table within that query should be planned. We want to  
take note when that same table is being planned during the current  
planning cycle, but this is difficult to do, because the RTI of the  
table from the previous plan won't necessarily be equal to the RTI  
that we see during the current planning cycle. This is because each  
subquery has a separate range table during planning, but these are  
flattened into one range table when constructing the final plan,  
changing RTIs.  
  
Commit 8c49a484e8ebb0199fba4bd68eaaedaf49b48ed0 allows us to match up  
subqueries seen in the previous planning cycles with the subqueries  
currently being planned just by comparing textual names, but that's  
not quite enough to let us deduce anything about individual tables,  
because we don't know where each subquery's range table appears in  
the final, flattened range table.  
  
To fix that, store a list of SubPlanRTInfo objects in the final  
planned statement, each including the name of the subplan, the offset  
at which it begins in the flattened range table, and whether or not  
it was a dummy subplan -- if it was, some RTIs may have been dropped  
from the final range table, but also there's no need to control how  
a dummy subquery gets planned. The toplevel subquery has no name and  
always begins at rtoffset 0, so we make no entry for it.  
  
This commit teaches pg_overexplain's RANGE_TABLE option to make use  
of this new data to display the subquery name for each range table  
entry.  
  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com  

M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_overexplain/sql/pg_overexplain.sql
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list

Pass cursorOptions to planner_setup_hook.

commit   : 0f4c8d33d49da012a04076159a008c9fa80bcc47    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 11:50:28 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 11:50:28 -0500    

Click here for diff

Commit 94f3ad3961a2cb32d30c79f01a70db4caff13318 failed to do this  
because I couldn't think of a use for the information, but this has  
proven to be short-sighted. Best to fix it before this code is  
officially released.  
  
Now, the only argument to standard_planenr that isn't passed to  
planner_setup_hook is boundParams, but that is accessible via  
glob->boundParams, and so doesn't need to be passed separately.  
  
Discussion: https://www.postgresql.org/message-id/CA+TgmoYS4ZCVAF2jTce=bMP0Oq_db_srocR4cZyO0OBp9oUoGg@mail.gmail.com  

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

Fix PGS_CONSIDER_NONPARTIAL interaction with Materialize nodes.

commit   : cbdf93d4712229fd82d40d823882a5bc84e407e5    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 11:49:07 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 10 Feb 2026 11:49:07 -0500    

Click here for diff

Commit 4020b370f214315b8c10430301898ac21658143f had the idea that it  
would be a good idea to handle testing PGS_CONSIDER_NONPARTIAL within  
cost_material to save callers the trouble, but that turns out not to be  
a very good idea. One concern is that it makes cost_material() dependent  
on the caller having initialized certain fields in the MaterialPath,  
which is a bit awkward for materialize_finished_plan, which wants to use  
a dummy path.  
  
Another problem is that it can result in generated materialized nested  
loops where the Materialize node is disabled, contrary to the intention  
of joinpath.c's logic in match_unsorted_outer() and  
consider_parallel_nestloop(), which aims to consider such paths only  
when they would not need to be disabled. In the previous coding, it was  
possible for the pgs_mask on the joinrel to have PGS_CONSIDER_NONPARTIAL  
set, while the inner rel had the same bit clear. In that case, we'd  
generate and then disable a Materialize path.  
  
That seems wrong, so instead, pull up the logic to test the  
PGS_CONSIDER_NONPARTIAL bit into joinpath.c, restoring the historical  
behavior that either we don't generate a given materialized nested loop  
in the first place, or we don't disable it.  
  
Discussion: http://postgr.es/m/CA+TgmoawzvCoZAwFS85tE5+c8vBkqgcS8ZstQ_ohjXQ9wGT9sw@mail.gmail.com  
Discussion: http://postgr.es/m/CA+TgmoYS4ZCVAF2jTce=bMP0Oq_db_srocR4cZyO0OBp9oUoGg@mail.gmail.com  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c

Refactor ProcessRecoveryConflictInterrupt for readability

commit   : be5257725d7f65708f5955a3a4beaedaa370e45b    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:10 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:10 +0200    

Click here for diff

Two changes here:  
  
1. Introduce a separate RECOVERY_CONFLICT_BUFFERPIN_DEADLOCK flag to  
indicate a suspected deadlock that involves a buffer pin. Previously  
the startup process used the same flag for a deadlock involving just  
regular locks, and to check for deadlocks involving the buffer  
pin. The cases are handled separately in the startup process, but the  
receiving backend had to deduce which one it was based on  
HoldingBufferPinThatDelaysRecovery(). With a separate flag, the  
receiver doesn't need to guess.  
  
2. Rewrite the ProcessRecoveryConflictInterrupt() function to not rely  
on fallthrough through the switch-statement. That was difficult to  
read.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi  

M src/backend/storage/ipc/standby.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.c
M src/include/storage/standby.h

Separate RecoveryConflictReasons from procsignals

commit   : 17f51ea818753093f929b4c235f3b89ebcc7c5fb    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:08 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:08 +0200    

Click here for diff

Share the same PROCSIG_RECOVERY_CONFLICT flag for all recovery  
conflict reasons. To distinguish, have a bitmask in PGPROC to indicate  
the reason(s).  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi  

M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/replication/logical/logicalctl.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/adt/mcxtfuncs.c
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/standby.h
M src/include/tcop/tcopprot.h
M src/tools/pgindent/typedefs.list

Use ProcNumber rather than pid in ReplicationSlot

commit   : ddc3250208bd5980a25b0421d607bae202fef06c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:05 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 10 Feb 2026 16:23:05 +0200    

Click here for diff

This helps the next commit.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi  

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

Simplify some log messages in extended_stats_funcs.c

commit   : f33c585774223757b01c8eddd134d364492ed94c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Feb 2026 16:59:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Feb 2026 16:59:19 +0900    

Click here for diff

The log messages used in this file applied too much quoting logic:  
- No need for quote_identifier(), which is fine to not use in the  
context of a log entry.  
- The usual project style is to group the namespace and object together  
in a quoted string, when mentioned in an log message.  This code quoted  
the namespace name and the extended statistics object name separately,  
which was confusing.  
  
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20260210.143752.1113524465620875233.horikyota.ntt@gmail.com  

M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out

Add information about range type stats to pg_stats_ext_exprs

commit   : 307447e6dbc035c0e6e7a8ce9cee704a3b710ee9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Feb 2026 12:36:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 Feb 2026 12:36:57 +0900    

Click here for diff

This commit adds three attributes to the system view pg_stats_ext_exprs,  
whose data can exist when involving a range type in an expression:  
range_length_histogram  
range_empty_frac  
range_bounds_histogram  
  
These statistics fields exist since 918eee0c497c, and have become  
viewable in pg_stats later in bc3c8db8ae2f.  This puts the definition of  
pg_stats_ext_exprs on par with pg_stats.  
  
This issue has showed up during the discussion about the restore of  
extended statistics for expressions, so as it becomes possible to query  
the stats data to restore from the catalogs.  Having access to this data  
is useful on its own, without the restore part.  
  
Some documentation and some tests are added, written by me.  Corey has  
authored the part in system_views.sql.  
  
Bump catalog version.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aYmCUx9VvrKiZQLL@paquier.xyz  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql

Teach planner to transform "x IS [NOT] DISTINCT FROM NULL" to a NullTest

commit   : f41ab51573a4c3d11f906b32a068182a1fd8596d    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:19:25 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:19:25 +0900    

Click here for diff

In the spirit of 8d19d0e13, this patch teaches the planner about the  
principle that NullTest with !argisrow is fully equivalent to SQL's IS  
[NOT] DISTINCT FROM NULL.  
  
The parser already performs this transformation for literal NULLs.  
However, a DistinctExpr expression with one input evaluating to NULL  
during planning (e.g., via const-folding of "1 + NULL" or parameter  
substitution in custom plans) currently remains as a DistinctExpr  
node.  
  
This patch closes the gap for const-folded NULLs.  It specifically  
targets the case where one input is a constant NULL and the other is a  
nullable non-constant expression.  (If the other input were otherwise,  
the DistinctExpr node would have already been simplified to a constant  
TRUE or FALSE.)  
  
This transformation can be beneficial because NullTest is much more  
amenable to optimization than DistinctExpr, since the planner knows a  
good deal about the former and next to nothing about the latter.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql

Optimize BooleanTest with non-nullable input

commit   : 0aaf0de7fed8555114aca766e9cdc836dad763a3    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:18:47 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:18:47 +0900    

Click here for diff

The BooleanTest construct (IS [NOT] TRUE/FALSE/UNKNOWN) treats a NULL  
input as the logical value "unknown".  However, when the input is  
proven to be non-nullable, this special handling becomes redundant.  
In such cases, the construct can be simplified directly to a boolean  
expression or a constant.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql

Optimize IS DISTINCT FROM with non-nullable inputs

commit   : 0a379612540cc51e54dc1c0cc4b9ef8797d2533c    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:17:45 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 10 Feb 2026 10:17:45 +0900    

Click here for diff

The IS DISTINCT FROM construct compares values acting as though NULL  
were a normal data value, rather than "unknown".  Semantically, "x IS  
DISTINCT FROM y" yields true if the values differ or if exactly one is  
NULL, and false if they are equal or both NULL.  Unlike ordinary  
comparison operators, it never returns NULL.  
  
Previously, the planner only simplified this construct if all inputs  
were constants, folding it to a constant boolean result.  This patch  
extends the optimization to cases where inputs are non-constant but  
proven to be non-nullable.  Specifically, "x IS DISTINCT FROM NULL"  
folds to constant TRUE if "x" is known to be non-nullable.  For cases  
where both inputs are guaranteed not to be NULL, the expression  
becomes semantically equivalent to "x <> y", and the DistinctExpr is  
converted into an inequality OpExpr.  
  
This transformation provides several benefits.  It converts the  
comparison into a standard operator, allowing the use of partial  
indexes and constraint exclusion.  Furthermore, if the clause is  
negated (i.e., "IS NOT DISTINCT FROM"), it simplifies to an equality  
operator.  This enables the planner to generate better plans using  
index scans, merge joins, hash joins, and EC-based qual deduction.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql

pg_upgrade: Fix handling of pg_largeobject_metadata.

commit   : 158408fef8b96907bb14f89654dd2beab27ff030    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 9 Feb 2026 14:58:02 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 9 Feb 2026 14:58:02 -0600    

Click here for diff

For binary upgrades from v16 or newer, pg_upgrade transfers the  
files for pg_largeobject_metadata from the old cluster, as opposed  
to using COPY or ordinary SQL commands to reconstruct its contents.  
While this approach adds complexity, it can greatly reduce  
pg_upgrade's runtime when there are many large objects.  
  
Large objects with comments or security labels are one source of  
complexity for this approach.  During pg_upgrade, schema  
restoration happens before files are transferred.  Comments and  
security labels are transferred in the former step, but the COMMENT  
and SECURITY LABEL commands will fail if their corresponding large  
objects do not exist.  To deal with this, pg_upgrade first copies  
only the rows of pg_largeobject_metadata that are needed to avoid  
failures.  Later, pg_upgrade overwrites those rows by replacing  
pg_largeobject_metadata's files with its files in the old cluster.  
  
Unfortunately, there's a subtle problem here.  Simply put, there's  
no guarantee that pg_upgrade will overwrite all of  
pg_largeobject_metadata's files on the new cluster.  For example,  
the new cluster's version might more aggressively extend relations  
or create visibility maps, and pg_upgrade's file transfer code is  
not sophisticated enough to remove files that lack counterparts in  
the old cluster.  These extra files could cause problems  
post-upgrade.  
  
More fortunately, we can simultaneously fix the aforementioned  
problem and further optimize binary upgrades for clusters with many  
large objects.  If we teach the COMMENT and SECURITY LABEL commands  
to allow nonexistent large objects during binary upgrades,  
pg_upgrade no longer needs to transfer pg_largeobject_metadata's  
contents beforehand.  This approach also allows us to remove the  
associated dependency tracking from pg_dump, even for upgrades from  
v12-v15 that use COPY to transfer pg_largeobject_metadata's  
contents.  
  
In addition to what is described in the previous paragraph, this  
commit modifies the query in getLOs() to only retrieve LOs with  
comments or security labels for upgrades from v12 or newer.  We  
have long assumed that such usage is rare, so this should reduce  
pg_upgrade's memory usage and runtime in many cases.  We might also  
be able to remove the "upgrades from v12 or newer" restriction on  
the recent batch of optimizations by adding special handling for  
pg_largeobject_metadata's hidden OID column on older versions  
(since this catalog previously used the now-removed WITH OIDS  
feature), but that is left as a future exercise.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/3yd2ss6n7xywo6pmhd7jjh3bqwgvx35bflzgv3ag4cnzfkik7m%40hiyadppqxx6w  

M src/backend/commands/comment.c
M src/backend/commands/seclabel.c
M src/bin/pg_dump/pg_dump.c

cleanup: Deadlock checker is no longer called from signal handler

commit   : 73d60ac385a93684f68297ae0ccb8f75bc6f23e1    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 9 Feb 2026 20:26:23 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 9 Feb 2026 20:26:23 +0200    

Click here for diff

Clean up a few leftovers from when the deadlock checker was called  
from signal handler. We stopped doing that in commit 6753333f55, in  
year 2015.  
  
- CheckDeadLock can return a return value directly to the caller,  
  there's no need to use a global variable for that.  
  
- Remove outdated comments that claimed that CheckDeadLock "signals  
  ProcSleep".  
  
- It should be OK to ereport() from DeadLockCheck now. I considered  
  getting rid of InitDeadLockChecking() and moving the workspace  
  allocations into DeadLockCheck, but it's still good to avoid doing  
  the allocations while we're holding all the partition locks. So just  
  update the comment to give that as the reason we do the allocations  
  up front.  

M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/proc.c

Remove HeapTupleheaderSetXminCommitted/Invalid functions

commit   : cbef472558ca50d282414e68083717c44b92ad62    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 9 Feb 2026 19:15:20 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 9 Feb 2026 19:15:20 +0100    

Click here for diff

They are not and never have been used by any known code -- apparently we  
just cargo-culted them in commit 37484ad2aace (or their ancestor macros  
anyway, which begat these functions in commit 34694ec888d6).  Allegedly  
they're also potentially dangerous; users are better off going through  
HeapTupleSetHintBits instead.  
  
Author: Andy Fan <zhihuifan1213@163.com>  
Discussion: https://postgr.es/m/87sejogt4g.fsf@163.com  

M src/include/access/htup_details.h

Fix incorrect iteration type in extension_file_exists()

commit   : 18f0afb2a635b433e778684acabffe1e52da8a86    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 9 Feb 2026 19:15:44 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 9 Feb 2026 19:15:44 +0200    

Click here for diff

Commit f3c9e341cd changed the type of objects in the List that  
get_extension_control_directories() returns, from "char *" to  
"ExtensionLocation *", but missed adjusting this one caller.  
  
Author: Chao Li <lic@highgo.com>  
Discussion: https://www.postgresql.org/message-id/362EA9B3-589B-475A-A16E-F10C30426E28@gmail.com  

M src/backend/commands/extension.c

Fix test "NUL byte in text decrypt" for --without-zlib builds.

commit   : c5dc75479b1525a3aa1daaf79028fa5af159800e    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 9 Feb 2026 09:08:10 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 9 Feb 2026 09:08:10 -0800    

Click here for diff

Backpatch-through: 14  
Security: CVE-2026-2006  

M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/sql/pgp-decrypt.sql

Harden _int_matchsel() against being attached to the wrong operator.

commit   : 8ebdf41c262ccd86407ca684aab3113bdbcf2c66    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 10:14:22 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 10:14:22 -0500    

Click here for diff

While the preceding commit prevented such attachments from occurring  
in future, this one aims to prevent further abuse of any already-  
created operator that exposes _int_matchsel to the wrong data types.  
(No other contrib module has a vulnerable selectivity estimator.)  
  
We need only check that the Const we've found in the query is indeed  
of the type we expect (query_int), but there's a difficulty: as an  
extension type, query_int doesn't have a fixed OID that we could  
hard-code into the estimator.  
  
Therefore, the bulk of this patch consists of infrastructure to let  
an extension function securely look up the OID of a datatype  
belonging to the same extension.  (Extension authors have requested  
such functionality before, so we anticipate that this code will  
have additional non-security uses, and may soon be extended to allow  
looking up other kinds of SQL objects.)  
  
This is done by first finding the extension that owns the calling  
function (there can be only one), and then thumbing through the  
objects owned by that extension to find a type that has the desired  
name.  This is relatively expensive, especially for large extensions,  
so a simple cache is put in front of these lookups.  
  
Reported-by: Daniel Firer as part of zeroday.cloud  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Security: CVE-2026-2004  
Backpatch-through: 14  

M contrib/intarray/_int_selfuncs.c
M src/backend/catalog/pg_depend.c
M src/backend/commands/extension.c
M src/include/catalog/dependency.h
M src/include/commands/extension.h
M src/tools/pgindent/typedefs.list

Require superuser to install a non-built-in selectivity estimator.

commit   : 841d42cc4e2f9ca1cf59758fc15619b00a11e148    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 10:07:31 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 10:07:31 -0500    

Click here for diff

Selectivity estimators come in two flavors: those that make specific  
assumptions about the data types they are working with, and those  
that don't.  Most of the built-in estimators are of the latter kind  
and are meant to be safely attachable to any operator.  If the  
operator does not behave as the estimator expects, you might get a  
poor estimate, but it won't crash.  
  
However, estimators that do make datatype assumptions can malfunction  
if they are attached to the wrong operator, since then the data they  
get from pg_statistic may not be of the type they expect.  This can  
rise to the level of a security problem, even permitting arbitrary  
code execution by a user who has the ability to create SQL objects.  
  
To close this hole, establish a rule that built-in estimators are  
required to protect themselves against being called on the wrong type  
of data.  It does not seem practical however to expect estimators in  
extensions to reach a similar level of security, at least not in the  
near term.  Therefore, also establish a rule that superuser privilege  
is required to attach a non-built-in estimator to an operator.  
We expect that this restriction will have little negative impact on  
extensions, since estimators generally have to be written in C and  
thus superuser privilege is required to create them in the first  
place.  
  
This commit changes the privilege checks in CREATE/ALTER OPERATOR  
to enforce the rule about superuser privilege, and fixes a couple  
of built-in estimators that were making datatype assumptions without  
sufficiently checking that they're valid.  
  
Reported-by: Daniel Firer as part of zeroday.cloud  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Security: CVE-2026-2004  
Backpatch-through: 14  

M src/backend/commands/operatorcmds.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/utils/adt/network_selfuncs.c

Guard against unexpected dimensions of oidvector/int2vector.

commit   : 60e7ae41a6987ed05dcfe87bddaccac8e1e93126    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 09:57:43 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 Feb 2026 09:57:43 -0500    

Click here for diff

These data types are represented like full-fledged arrays, but  
functions that deal specifically with these types assume that the  
array is 1-dimensional and contains no nulls.  However, there are  
cast pathways that allow general oid[] or int2[] arrays to be cast  
to these types, allowing these expectations to be violated.  This  
can be exploited to cause server memory disclosure or SIGSEGV.  
Fix by installing explicit checks in functions that accept these  
types.  
  
Reported-by: Altan Birler <altan.birler@tum.de>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Security: CVE-2026-2003  
Backpatch-through: 14  

M src/backend/access/hash/hashfunc.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/oid.c
M src/include/utils/builtins.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql

Require PGP-decrypted text to pass encoding validation.

commit   : d536aee5566354e42a1012da9dd3960e45402af5    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 9 Feb 2026 06:14:47 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 9 Feb 2026 06:14:47 -0800    

Click here for diff

pgp_sym_decrypt() and pgp_pub_decrypt() will raise such errors, while  
bytea variants will not.  The existing "dat3" test decrypted to non-UTF8  
text, so switch that query to bytea.  
  
The long-term intent is for type "text" to always be valid in the  
database encoding.  pgcrypto has long been known as a source of  
exceptions to that intent, but a report about exploiting invalid values  
of type "text" brought this module to the forefront.  This particular  
exception is straightforward to fix, with reasonable effect on user  
queries.  Back-patch to v14 (all supported versions).  
  
Reported-by: Paul Gerste (as part of zeroday.cloud)  
Reported-by: Moritz Sanft (as part of zeroday.cloud)  
Author: shihao zhong <zhong950419@gmail.com>  
Reviewed-by: cary huang <hcary328@gmail.com>  
Discussion: https://postgr.es/m/CAGRkXqRZyo0gLxPJqUsDqtWYBbgM14betsHiLRPj9mo2=z9VvA@mail.gmail.com  
Backpatch-through: 14  
Security: CVE-2026-2006  

M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/sql/pgp-decrypt.sql

Allow log_min_messages to be set per process type

commit   : 38e0190ced714b33c43c9676d768cc6814fc662a    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 9 Feb 2026 13:23:10 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 9 Feb 2026 13:23:10 +0100    

Click here for diff

Change log_min_messages from being a single element to a comma-separated  
list of type:level elements, with 'type' representing a process type,  
and 'level' being a log level to use for that type of process.  The list  
must also have a freestanding level specification which is used for  
process types not listed, which convenientely makes the whole thing  
backwards-compatible.  
  
Some choices made here could be contested; for instance, we use the  
process type `backend` to affect regular backends as well as dead-end  
backends and the standalone backend, and `autovacuum` means both the  
launcher and the workers.  I think it's largely sensible though, and it  
can easily be tweaked if desired.  
  
Author: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Tan Yang <332696245@qq.com>  
Discussion: https://postgr.es/m/e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com  

M doc/src/sgml/config.sgml
M src/backend/commands/extension.c
M src/backend/postmaster/launch_backend.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/proctypelist.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql

Code coverage for most pg_mblen* calls.

commit   : c67bef3f3252a3a38bf347f9f119944176a796ce    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 12 Jan 2026 10:20:06 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 12 Jan 2026 10:20:06 +1300    

Click here for diff

A security patch changed them today, so close the coverage gap now.  
Test that buffer overrun is avoided when pg_mblen*() requires more  
than the number of bytes remaining.  
  
This does not cover the calls in dict_thesaurus.c or in dict_synonym.c.  
That code is straightforward.  To change that code's input, one must  
have access to modify installed OS files, so low-privilege users are not  
a threat.  Testing this would likewise require changing installed  
share/postgresql/tsearch_data, which was enough of an obstacle to not  
bother.  
  
Security: CVE-2026-2006  
Backpatch-through: 14  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Co-authored-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  

M contrib/pg_trgm/Makefile
A contrib/pg_trgm/data/trgm_utf8.data
A contrib/pg_trgm/expected/pg_utf8_trgm.out
A contrib/pg_trgm/expected/pg_utf8_trgm_1.out
M contrib/pg_trgm/meson.build
A contrib/pg_trgm/sql/pg_utf8_trgm.sql
M src/backend/utils/adt/arrayfuncs.c
M src/test/regress/expected/copyencoding.out
A src/test/regress/expected/encoding.out
A src/test/regress/expected/encoding_1.out
A src/test/regress/expected/euc_kr.out
A src/test/regress/expected/euc_kr_1.out
M src/test/regress/parallel_schedule
M src/test/regress/regress.c
M src/test/regress/sql/copyencoding.sql
A src/test/regress/sql/encoding.sql
A src/test/regress/sql/euc_kr.sql

Replace pg_mblen() with bounds-checked versions.

commit   : 1e7fe06c10c0a8da9dd6261a6be8d405dc17c728    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 7 Jan 2026 22:14:31 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 7 Jan 2026 22:14:31 +1300    

Click here for diff

A corrupted string could cause code that iterates with pg_mblen() to  
overrun its buffer.  Fix, by converting all callers to one of the  
following:  
  
1. Callers with a null-terminated string now use pg_mblen_cstr(), which  
raises an "illegal byte sequence" error if it finds a terminator in the  
middle of the sequence.  
  
2. Callers with a length or end pointer now use either  
pg_mblen_with_len() or pg_mblen_range(), for the same effect, depending  
on which of the two seems more convenient at each site.  
  
3. A small number of cases pre-validate a string, and can use  
pg_mblen_unbounded().  
  
The traditional pg_mblen() function and COPYCHAR macro still exist for  
backward compatibility, but are no longer used by core code and are  
hereby deprecated.  The same applies to the t_isXXX() functions.  
  
Security: CVE-2026-2006  
Backpatch-through: 14  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Co-authored-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reported-by: Paul Gerste (as part of zeroday.cloud)  
Reported-by: Moritz Sanft (as part of zeroday.cloud)  

M contrib/btree_gist/btree_utils_var.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/hstore/hstore_io.c
M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_op.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-sha.c
M contrib/unaccent/unaccent.c
M src/backend/catalog/pg_proc.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/mb/mbutils.c
M src/include/mb/pg_wchar.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_utils.h
M src/test/modules/test_regex/test_regex.c

Fix mb2wchar functions on short input.

commit   : 74ee636cc93d919c845e3e3ad3642e6366ce1802    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 26 Jan 2026 11:22:32 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 26 Jan 2026 11:22:32 +1300    

Click here for diff

When converting multibyte to pg_wchar, the UTF-8 implementation would  
silently ignore an incomplete final character, while the other  
implementations would cast a single byte to pg_wchar, and then repeat  
for the remaining byte sequence.  While it didn't overrun the buffer, it  
was surely garbage output.  
  
Make all encodings behave like the UTF-8 implementation.  A later change  
for master only will convert this to an error, but we choose not to  
back-patch that behavior change on the off-chance that someone is  
relying on the existing UTF-8 behavior.  
  
Security: CVE-2026-2006  
Backpatch-through: 14  
Author: Thomas Munro <thomas.munro@gmail.com>  
Reported-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  

M src/common/wchar.c

Fix encoding length for EUC_CN.

commit   : af79c30dc3e5369cd6d2bfdccd2c2c0ffbd60ef3    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 5 Feb 2026 01:04:24 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 5 Feb 2026 01:04:24 +1300    

Click here for diff

While EUC_CN supports only 1- and 2-byte sequences (CS0, CS1), the  
mb<->wchar conversion functions allow 3-byte sequences beginning SS2,  
SS3.  
  
Change pg_encoding_max_length() to return 3, not 2, to close a  
hypothesized buffer overrun if a corrupted string is converted to wchar  
and back again in a newly allocated buffer.  We might reconsider that in  
master (ie harmonizing in a different direction), but this change seems  
better for the back-branches.  
  
Also change pg_euccn_mblen() to report SS2 and SS3 characters as having  
length 3 (following the example of EUC_KR).  Even though such characters  
would not pass verification, it's remotely possible that invalid bytes  
could be used to compute a buffer size for use in wchar conversion.  
  
Security: CVE-2026-2006  
Backpatch-through: 14  
Author: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  

M src/common/wchar.c

Fix buffer overflows in pg_trgm due to lower-casing

commit   : 00896ddaf41fa7b725991120678d544c18c6af70    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 20 Jan 2026 11:53:28 +0200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 20 Jan 2026 11:53:28 +0200    

Click here for diff

The code made a subtle assumption that the lower-cased version of a  
string never has more characters than the original. That is not always  
true. For example, in a database with the latin9 encoding:  
  
    latin9db=# select lower(U&'\00CC' COLLATE "lt-x-icu");  
       lower  
    -----------  
     i\x1A\x1A  
    (1 row)  
  
In this example, lower-casing expands the single input character into  
three characters.  
  
The generate_trgm_only() function relied on that assumption in two  
ways:  
  
- It used "slen * pg_database_encoding_max_length() + 4" to allocate  
  the buffer to hold the lowercased and blank-padded string. That  
  formula accounts for expansion if the lower-case characters are  
  longer (in bytes) than the originals, but it's still not enough if  
  the lower-cased string contains more *characters* than the original.  
  
- Its callers sized the output array to hold the trigrams extracted  
  from the input string with the formula "(slen / 2 + 1) * 3", where  
  'slen' is the input string length in bytes. (The formula was  
  generous to account for the possibility that RPADDING was set to 2.)  
  That's also not enough if one input byte can turn into multiple  
  characters.  
  
To fix, introduce a growable trigram array and give up on trying to  
choose the correct max buffer sizes ahead of time.  
  
Backpatch to v18, but no further. In previous versions lower-casing was  
done character by character, and thus the assumption that lower-casing  
doesn't change the character length was valid. That was changed in v18,  
commit fb1a18810f.  
  
Security: CVE-2026-2007  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Jeff Davis <pgsql@j-davis.com>  

M contrib/pg_trgm/trgm_op.c
M src/tools/pgindent/typedefs.list

Remove 'charlen' argument from make_trigrams()

commit   : 54598670fe0a191f49848d1a1a8ab09d99616e71    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 20 Jan 2026 14:34:32 +0200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 20 Jan 2026 14:34:32 +0200    

Click here for diff

The function assumed that if charlen == bytelen, there are no  
multibyte characters in the string. That's sensible, but the callers  
were a little careless in how they calculated the lengths. The callers  
converted the string to lowercase before calling make_trigram(), and  
the 'charlen' value was calculated *before* the conversion to  
lowercase while 'bytelen' was calculated after the conversion. If the  
lowercased string had a different number of characters than the  
original, make_trigram() might incorrectly apply the fastpath and  
treat all the bytes as single-byte characters, or fail to apply the  
fastpath (which is harmless), or it might hit the "Assert(bytelen ==  
charlen)" assertion. I'm not aware of any locale / character  
combinations where you could hit that assertion in practice,  
i.e. where a string converted to lowercase would have fewer characters  
than the original, but it seems best to avoid making that assumption.  
  
To fix, remove the 'charlen' argument. To keep the performance when  
there are no multibyte characters, always try the fast path first, but  
check the input for multibyte characters as we go. The check on each  
byte adds some overhead, but it's close enough. And to compensate, the  
find_word() function no longer needs to count the characters.  
  
This fixes one small bug in make_trigrams(): in the multibyte  
codepath, it peeked at the byte just after the end of the input  
string. When compiled with IGNORECASE, that was harmless because there  
is always a NUL byte or blank after the input string. But with  
!IGNORECASE, the call from generate_wildcard_trgm() doesn't guarantee  
that.  
  
Backpatch to v18, but no further. In previous versions lower-casing was  
done character by character, and thus the assumption that lower-casing  
doesn't change the character length was valid. That was changed in v18,  
commit fb1a18810f.  
  
Security: CVE-2026-2007  
Reviewed-by: Noah Misch <noah@leadboat.com>  

M contrib/pg_trgm/trgm_op.c

pgcrypto: Fix buffer overflow in pgp_pub_decrypt_bytea()

commit   : 379695d3cc70d040b547d912ce4842090d917ece    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Feb 2026 08:00:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 Feb 2026 08:00:59 +0900    

Click here for diff

pgp_pub_decrypt_bytea() was missing a safeguard for the session key  
length read from the message data, that can be given in input of  
pgp_pub_decrypt_bytea().  This can result in the possibility of a buffer  
overflow for the session key data, when the length specified is longer  
than PGP_MAX_KEY, which is the maximum size of the buffer where the  
session data is copied to.  
  
A script able to rebuild the message and key data that can trigger the  
overflow is included in this commit, based on some contents provided by  
the reporter, heavily editted by me.  A SQL test is added, based on the  
data generated by the script.  
  
Reported-by: Team Xint Code as part of zeroday.cloud  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Security: CVE-2026-2005  
Backpatch-through: 14  

M contrib/pgcrypto/Makefile
A contrib/pgcrypto/expected/pgp-pubkey-session.out
M contrib/pgcrypto/meson.build
M contrib/pgcrypto/pgp-pubdec.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
A contrib/pgcrypto/scripts/pgp_session_data.py
A contrib/pgcrypto/sql/pgp-pubkey-session.sql

Replace some hard-wired OID constants with corresponding macros.

commit   : 73dd7163c5d19f93b629d1ccd9d2a2de6e9667f6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 7 Feb 2026 23:15:20 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 7 Feb 2026 23:15:20 -0500    

Click here for diff

Looking again at commit 7cdb633c8, I wondered why we have hard-wired  
"1034" for the OID of type aclitem[].  Some other entries in the same  
array have numeric type OIDs as well.  This seems to be a hangover  
from years ago when not every built-in pg_type entry had an OID macro.  
But since we made genbki.pl responsible for generating these macros,  
there are macros available for all these array types, so there's no  
reason not to follow the project policy of never writing numeric OID  
constants in C code.  

M src/backend/bootstrap/bootstrap.c

meson: host_system value for Solaris is 'sunos' not 'solaris'.

commit   : c0bf15729f461308f54b7d4d46472c1ad43941a3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 7 Feb 2026 20:05:52 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 7 Feb 2026 20:05:52 -0500    

Click here for diff

This thinko caused us to not substitute our own getopt() code,  
which results in failing to parse long options for the postmaster  
since Solaris' getopt() doesn't do what we expect.  This can be seen  
in the results of buildfarm member icarus, which is the only one  
trying to build via meson on Solaris.  
  
Per consultation with pgsql-release, it seems okay to fix this  
now even though we're in release freeze.  The fix visibly won't  
affect any other platforms, and it can't break Solaris/meson  
builds any worse than they're already broken.  
  
Discussion: https://postgr.es/m/2471229.1770499291@sss.pgh.pa.us  
Backpatch-through: 16  

M meson.build

Further error message fix

commit   : 1653ce5236c4948550e52d15d54e4b6bb66a23b1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 7 Feb 2026 22:37:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 7 Feb 2026 22:37:02 +0100    

Click here for diff

Further fix of error message changed in commit 74a116a79b4.  The  
initial fix was not quite correct.  
  
Discussion: https://www.postgresql.org/message-id/flat/tencent_1EE1430B1E6C18A663B8990F%40qq.com  

M src/bin/pg_rewind/file_ops.c

Future-proof sort template against undefined behavior

commit   : 7467041cde9ed1966cb3ea18da8ac119b462c2e4    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 7 Feb 2026 17:02:35 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 7 Feb 2026 17:02:35 +0700    

Click here for diff

Commit 176dffdf7 added a NULL array pointer check before performing  
a qsort in order to prevent undefined behavior when passing NULL  
pointer and zero length. To head off future degenerate cases, check  
that there are at least two elements to sort before proceeding with  
insertion sort. This has the added advantage of allowing us to remove  
four equivalent checks that guarded against recursion/iteration.  
  
There might be a tiny performance penalty from unproductive  
recursions, but we can buy that back by increasing the insertion sort  
threshold. That is left for future work.  
  
Discussion: https://postgr.es/m/CANWCAZZWvds_35nXc4vXD-eBQa_=mxVtqZf-PM_ps=SD7ghhJg@mail.gmail.com  

M src/include/lib/sort_template.h

Revert "Change copyObject() to use typeof_unqual"

commit   : 0af05b5dbb42387957582e76232dc27138382e5a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 7 Feb 2026 10:08:38 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 7 Feb 2026 10:08:38 +0100    

Click here for diff

This reverts commit 4cfce4e62c8f09f5b1f6a7f69760ca46a74406e2.  
  
This implementation fails to compile on newer MSVC that support  
__typeof_unqual__.  (Older versions did not support it and compiled  
fine.)  Revert for now and research further.  
  
Reported-by: Bryan Green <dbryan.green@gmail.com>  
Discussion: https://www.postgresql.org/message-id/b03ddcd4-2a16-49ee-b105-e7f609f3c514%40gmail.com  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/nodes/nodes.h
M src/include/pg_config.h.in

commit   : 7cdb633c89da82d4c6fdfba007a9ff05a9dff29e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Feb 2026 20:46:03 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 6 Feb 2026 20:46:03 -0500    

Click here for diff

Commit 7b378237a widened AclMode to 64 bits, which implies that  
the alignment of AclItem is now determined by an int64 field.  
That commit correctly set the typalign for SQL type aclitem to  
'd', but it missed the hard-wired knowledge about _aclitem in  
bootstrap.c.  This doesn't seem to have caused any ill effects,  
probably because we never try to fill a non-null value into  
an aclitem[] column during bootstrap.  Nonetheless, it's clearly  
a gotcha waiting to happen, so fix it up.  
  
In passing, also fix a couple of typanalyze functions that were  
using hard-coded typalign constants when they could just as  
easily use greppable TYPALIGN_xxx macros.  
  
Noticed these while working on a patch to expand the set of  
typalign values.  I doubt we are going to pursue that path,  
but these fixes still seem worth a quick commit.  
  
Discussion: https://postgr.es/m/1127261.1769649624@sss.pgh.pa.us  

M src/backend/bootstrap/bootstrap.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c

Adjust style of some debugging macros.

commit   : ba1e14134a775e56a76c1537936c61102827507f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 6 Feb 2026 16:24:21 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 6 Feb 2026 16:24:21 -0600    

Click here for diff

This commit adjusts a few debugging macros to match the style of  
those in pg_config_manual.h.  Like commits 123661427b and  
b4cbc106a6, these were discovered while reviewing Aleksander  
Alekseev's proposed changes to pgindent.  
  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aP-H6kSsGOxaB21k%40nathan  

M src/backend/access/nbtree/nbtsort.c
M src/backend/utils/adt/numeric.c
M src/include/executor/execdebug.h

libpq: Prepare for protocol grease during 19beta

commit   : d8d7c5dc8f74506d35c7e8242be997fd5cf388eb    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Feb 2026 10:31:45 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Feb 2026 10:31:45 -0800    

Click here for diff

The main reason that libpq doesn't request protocol version 3.2 by  
default is because other proxy/server implementations don't implement  
the negotiation. This is a bit of a chicken-and-egg problem: We don't  
bump the default version that libpq requests, but other implementations  
may not be incentivized to implement version negotiation if their users  
never run into issues.  
  
One established practice to combat this is to flip Postel's Law on its  
head, by sending parameters that the server cannot possibly support. If  
the server fails the handshake instead of correctly negotiating, then  
the problem is surfaced naturally. If the server instead claims to  
support the bogus parameters, then we fail the connection to make the  
lie obvious. This is called "grease" (or "greasing"), after the GREASE  
mechanism in TLS that popularized the concept:  
  
    https://www.rfc-editor.org/rfc/rfc8701.html  
  
This patch reserves 3.9999 as an explicitly unsupported protocol version  
number and `_pq_.test_protocol_negotiation` as an explicitly unsupported  
protocol extension. A later commit will send these by default in order  
to stress-test the ecosystem during the beta period; that commit will  
then be reverted before 19 RC1, so that we can decide what to do with  
whatever data has been gathered.  
  
The _pq_.test_protocol_negotiation change here is intentionally docs-  
only: after its implementation is reverted, the parameter should remain  
reserved.  
  
Extracted/adapted from a patch by Jelte Fennema-Nio.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl  

M doc/src/sgml/protocol.sgml
M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-protocol3.c

doc: Expand upon protocol versions and extensions

commit   : e3d37853ecd51c87976df7ea5c5d641f45668370    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Feb 2026 10:25:12 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 6 Feb 2026 10:25:12 -0800    

Click here for diff

First, split the Protocol Versions table in two, and lead with the list  
of versions that are supported today. Reserved and unsupported version  
numbers go into the second table.  
  
Second, in anticipation of a new (reserved) protocol extension, document  
the extension negotiation process alongside version negotiation, and add  
the corresponding tables for future extension parameter registrations.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl  

M doc/src/sgml/protocol.sgml

Fix use of proc number in pgstat_create_backend()

commit   : 072c8421359730149f4eaf861ce55aa78968ba9d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Feb 2026 19:57:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Feb 2026 19:57:22 +0900    

Click here for diff

This routine's internals directly used MyProcNumber to choose which  
object ID to assign for the hash key of a backend's stats entry, while  
the value to use is given as input argument of the function.  
  
The original intention was to pass MyProcNumber as an argument of  
pgstat_create_backend() when called in pgstat_bestart_final(),  
pgstat_beinit() ensuring that MyProcNumber has been set, not use it  
directly in the function.  This commit addresses this inconsistency by  
using the procnum given by the caller of pgstat_create_backend(), not  
MyProcNumber.  
  
This issue is not a cause of bugs currently.  However, let's keep the  
code in sync across all the branches where this code exists, as it could  
matter in a future backpatch.  
  
Oversight in 4feba03d8b92.  
  
Reported-by: Ryo Matsumura <matsumura.ryo@fujitsu.com>  
Discussion: https://postgr.es/m/TYCPR01MB11316AD8150C8F470319ACCAEE866A@TYCPR01MB11316.jpnprd01.prod.outlook.com  
Backpatch-through: 18  

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

Fix some error message inconsistencies

commit   : 74a116a79b47631e163c9814f39f5d218834e94c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Feb 2026 15:38:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 Feb 2026 15:38:16 +0900    

Click here for diff

These errors are very unlikely going to show up, but in the event that  
they happen, some incorrect information would have been provided:  
- In pg_rewind, a stat() failure was reported as an open() failure.  
- In pg_combinebackup, a check for the new directory of a tablespace  
mapping was referred as the old directory.  
- In pg_combinebackup, a failure in reading a source file when copying  
blocks referred to the destination file.  
  
The changes for pg_combinebackup affect v17 and newer versions.  For  
pg_rewind, all the stable branches are affected.  
  
Author: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/tencent_1EE1430B1E6C18A663B8990F@qq.com  
Backpatch-through: 14  

M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_rewind/file_ops.c

Add file_extend_method=posix_fallocate,write_zeros.

commit   : f94e9141a0bbb365f8194517e142746466ee7014    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 31 May 2025 22:50:22 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 31 May 2025 22:50:22 +1200    

Click here for diff

Provide a way to disable the use of posix_fallocate() for relation  
files.  It was introduced by commit 4d330a61bb1.  The new setting  
file_extend_method=write_zeros can be used as a workaround for problems  
reported from the field:  
  
 * BTRFS compression is disabled by the use of posix_fallocate()  
 * XFS could produce spurious ENOSPC errors in some Linux kernel  
   versions, though that problem is reported to have been fixed  
  
The default is file_extend_method=posix_fallocate if available, as  
before.  The write_zeros option is similar to PostgreSQL < 16, except  
that now it's multi-block.  
  
Backpatch-through: 16  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reported-by: Dimitrios Apostolou <jimis@gmx.net>  
Discussion: https://postgr.es/m/b1843124-fd22-e279-a31f-252dffb6fbf2%40gmx.net  

M doc/src/sgml/config.sgml
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/fd.h

doc: Move synchronized_standby_slots to "Primary Server" section.

commit   : e35add48ccc2e5aa94de360f1a43c6c150bda54a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Feb 2026 09:40:05 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 6 Feb 2026 09:40:05 +0900    

Click here for diff

synchronized_standby_slots is defined in guc_parameter.dat as part of  
the REPLICATION_PRIMARY group and is listed under the "Primary Server"  
section in postgresql.conf.sample. However, in the documentation  
its description was previously placed under the "Sending Servers" section.  
  
Since synchronized_standby_slots only takes effect on the primary server,  
this commit moves its documentation to the "Primary Server" section to  
match its behavior and other references.  
  
Backpatch to v17 where synchronized_standby_slots was added.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwE_LwgXgCrqd08OFteJqdERiF3noqOKu2vt7Kjk4vMiGg@mail.gmail.com  
Backpatch-through: 17  

M doc/src/sgml/config.sgml

Fix comment in extended_stats_funcs.c

commit   : 9476ef206c64207a4fd2ddcb373759c7ede13a3c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Feb 2026 15:14:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Feb 2026 15:14:53 +0900    

Click here for diff

The attribute storing the statistics data for a set of expressions in  
pg_statistic_ext_data is stxdexpr.  stxdexprs does not exist.  
  
Extracted from a larger patch by the same author.  Incorrect as of  
efbebb4e8587.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=fPcci6oPyuyEZ0F4bWqAA7HzaWO+ZPptufuX5_uWt6kw@mail.gmail.com  

M src/backend/statistics/extended_stats_funcs.c

pg_upgrade: Optimize logical replication slot caught-up check.

commit   : 7a1f0f8747a7f7491702be88570a8e4d33686d76    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 4 Feb 2026 17:11:27 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 4 Feb 2026 17:11:27 -0800    

Click here for diff

Commit 29d0a77fa6 improved pg_upgrade to allow migrating logical slots  
provided that all logical slots have caught up (i.e., they have no  
pending decodable WAL records). Previously, this verification was done  
by checking each slot individually, which could be time-consuming if  
there were many logical slots to migrate.  
  
This commit optimizes the check to avoid reading the same WAL stream  
multiple times. It performs the check only for the slot with the  
minimum confirmed_flush_lsn and applies the result to all other slots  
in the same database. This limits the check to at most one logical  
slot per database.  
  
During the check, we identify the last decodable WAL record's LSN to  
report any slots with unconsumed records, consistent with the existing  
error reporting behavior. Additionally, the maximum  
confirmed_flush_lsn among all logical slots on the database is used as  
an early scan cutoff; finding a decodable WAL record beyond this point  
implies that no slot has caught up.  
  
Performance testing demonstrated that the execution time remains  
stable regardless of the number of slots in the database.  
  
Note that we do not distinguish slots based on their output plugins. A  
hypothetical plugin might use a replication origin filter that filters  
out changes from a specific origin. In such cases, we might get a  
false positive (erroneously considering a slot caught up). However,  
this is safe from a data integrity standpoint, such scenarios are  
rare, and the impact of a false positive is minimal.  
  
This optimization is applied only when the old cluster is version 19  
or later.  
  
Bump catalog version.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoBZ0LAcw1OHGEKdW7S5TRJaURdhEk3CLAW69_siqfqyAg@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/logical.h

oid2name: Add relation path to the information provided by -x/--extended

commit   : 3c5ec35dea254892d75d829b5642fc3732c8fcf9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Feb 2026 09:02:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 5 Feb 2026 09:02:12 +0900    

Click here for diff

This affects two command patterns, showing information about relations:  
* oid2name -x -d DBNAME, applying to all relations on a database.  
* oid2name -x -d DBNAME -t TABNAME [-t ..], applying to a subset of  
defined relations on a database.  
  
The relative path of a relation is added to the information provided,  
using pg_relation_filepath().  
  
Author: David Bidoc <dcbidoc@gmail.com>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Guillaume Lelarge <guillaume.lelarge@dalibo.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Mark Wong <markwkm@gmail.com>  
Discussion: https://postgr.es/m/CABour1v2CU1wjjoM86wAFyezJQ3-+ncH43zY1f1uXeVojVN8Ow@mail.gmail.com  

M contrib/oid2name/oid2name.c
M doc/src/sgml/oid2name.sgml

Assign "backend" type earlier during process start-up

commit   : 0c8e082fba8d36434552d3d7800abda54acafd57    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 4 Feb 2026 16:56:57 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 4 Feb 2026 16:56:57 +0100    

Click here for diff

Instead of assigning the backend type in the Main function of each  
postmaster child, do it right after fork(), by which time it is already  
known by postmaster_child_launch().  This reduces the time frame during  
which MyBackendType is incorrect.  
  
Before this commit, ProcessStartupPacket would overwrite MyBackendType  
to B_BACKEND for dead-end backends, which is quite dubious.  Stop that.  
  
We may now see MyBackendType == B_BG_WORKER before setting up  
MyBgworkerEntry.  As far as I can see this is only a problem if we try  
to log a message and %b is in log_line_prefix, so we now have a constant  
string to cover that case.  Previously, it would print "unrecognized",  
which seems strictly worse.  
  
Author: Euler Taveira <euler@eulerto.com>  
Discussion: https://postgr.es/m/e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/walreceiver.c
M src/backend/storage/aio/method_worker.c
M src/backend/tcop/backend_startup.c
M src/backend/utils/error/elog.c

Fix logical replication TAP test to read publisher log correctly.

commit   : 36ead7123292c2849be9950f3e552325fad7e6b7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Feb 2026 00:43:06 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 5 Feb 2026 00:43:06 +0900    

Click here for diff

Commit 5f13999aa11 added a TAP test for GUC settings passed via the  
CONNECTION string in logical replication, but the buildfarm member  
sungazer reported test failures.  
  
The test incorrectly used the subscriber's log file position as the  
starting offset when reading the publisher's log. As a result, the test  
failed to find the expected log message in the publisher's log and  
erroneously reported a failure.  
  
This commit fixes the test to use the publisher's own log file position  
when reading the publisher's log.  
  
Also, to avoid similar confusion in the future, this commit splits the single  
$log_location variable into $log_location_pub and $log_location_sub,  
clearly distinguishing publisher and subscriber log positions.  
  
Backpatched to v15, where commit 5f13999aa11 introduced the test.  
  
Per buildfarm member sungazer.  
This issue was reported and diagnosed by Alexander Lakhin.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/966ec3d8-1b6f-4f57-ae59-fc7d55bc9a5a@gmail.com  
Backpatch-through: 15  

M src/test/subscription/t/001_rep_changes.pl

Fix various instances of undefined behavior

commit   : 176dffdf7d2a0ea2615c4e390a2ab7e69d14f90f    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 4 Feb 2026 17:55:49 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 4 Feb 2026 17:55:49 +0700    

Click here for diff

Mostly this involves checking for NULL pointer before doing operations  
that add a non-zero offset.  
  
The exception is an overflow warning in heap_fetch_toast_slice(). This  
was caused by unneeded parentheses forcing an expression to be  
evaluated to a negative integer, which then got cast to size_t.  
  
Per clang 21 undefined behavior sanitizer.  
  
Backpatch to all supported versions.  
  
Co-authored-by: Alexander Lakhin <exclusion@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/777bd201-6e3a-4da0-a922-4ea9de46a3ee@gmail.com  
Backpatch-through: 14  

M contrib/pg_trgm/trgm_gist.c
M src/backend/access/heap/heaptoast.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/sort/sharedtuplestore.c

Add backendType to PGPROC, replacing isRegularBackend

commit   : 084e42bc7109673e46527b0a0f284edf539c3285    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Feb 2026 13:06:04 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 4 Feb 2026 13:06:04 +0200    

Click here for diff

We can immediately make use of it in pg_signal_backend(), which  
previously fetched the process type from the backend status array with  
pgstat_get_backend_type_by_proc_number(). That was correct but felt a  
little questionable to me: backend status should be for observability  
purposes only, not for permission checks.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/b77e4962-a64a-43db-81a1-580444b3e8f5@iki.fi  

M src/backend/access/transam/twophase.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/include/storage/proc.h
M src/include/utils/backend_status.h

Change copyObject() to use typeof_unqual

commit   : 4cfce4e62c8f09f5b1f6a7f69760ca46a74406e2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 Feb 2026 08:39:55 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 Feb 2026 08:39:55 +0100    

Click here for diff

Currently, when the argument of copyObject() is const-qualified, the  
return type is also, because the use of typeof carries over all the  
qualifiers.  This is incorrect, since the point of copyObject() is to  
make a copy to mutate.  But apparently no code ran into it.  
  
The new implementation uses typeof_unqual, which drops the qualifiers,  
making this work correctly.  
  
typeof_unqual is standardized in C23, but all recent versions of all  
the usual compilers support it even in non-C23 mode, at least as  
__typeof_unqual__.  We add a configure/meson test for typeof_unqual  
and __typeof_unqual__ and use it if it's available, else we use the  
existing fallback of just returning void *.  
  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/nodes/nodes.h
M src/include/pg_config.h.in

commit   : c8ec74713bf2c703c19f231ea4d1e6479630c72d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Feb 2026 16:38:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 4 Feb 2026 16:38:06 +0900    

Click here for diff

A failure while closing pg_wal/summaries/ incorrectly generated a report  
about pg_wal/archive_status/.  
  
While at it, this commit adds #undefs for the macros used in  
KillExistingWALSummaries() and KillExistingArchiveStatus() to prevent  
those values from being misused in an incorrect function context.  
  
Oversight in dc212340058b.  
  
Author: Tianchen Zhang <zhang_tian_chen@163.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/SE2P216MB2390C84C23F428A7864EE07FA19BA@SE2P216MB2390.KORP216.PROD.OUTLOOK.COM  
Backpatch-through: 17  

M src/bin/pg_resetwal/pg_resetwal.c

Docs: consolidate dependency notes in pg_dump and pg_restore

commit   : 78bf28e3bf504db0eea5e3bcb3c43e9908108480    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Feb 2026 19:29:15 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Feb 2026 19:29:15 +0100    

Click here for diff

The pg_dump documentation had repetitive notes for the --schema,  
--table, and --extension switches, noting that dependent database  
objects are not automatically included in the dump.  This commit removes  
these notes and replaces them with a consolidated paragraph in the  
"Notes" section.  
  
pg_restore had a similar note for -t but lacked one for -n; do likewise.  
  
Also, add a note to --extension in pg_dump to note that ancillary files  
(such as shared libraries and control files) are not included in the  
dump and must be present on the destination system.  
  
Author: Florents Tselai <florents.tselai@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/284C4D55-4F90-4AA0-84C8-1E6A28DDF271@gmail.com  

M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_restore.sgml

Don't hint that you can reconnect when the database is dropped

commit   : 57bff90160fdee56a0d55d7eaa7ec5ad709fda08    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 3 Feb 2026 15:08:16 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 3 Feb 2026 15:08:16 +0200    

Click here for diff

Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi  

M src/backend/tcop/postgres.c

Remove useless errdetail_abort()

commit   : cd375d5b6d5f7d89375541af444e16dd93d27a03    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 3 Feb 2026 15:08:13 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 3 Feb 2026 15:08:13 +0200    

Click here for diff

I don't understand how to reach errdetail_abort() with  
MyProc->recoveryConflictPending set. If a recovery conflict signal is  
received, ProcessRecoveryConflictInterrupt() raises an ERROR or FATAL  
error to cancel the query or connection, and abort processing clears  
the flag. The error message from ProcessRecoveryConflictInterrupt() is  
very clear that the query or connection was terminated because of  
recovery conflict.  
  
The only way to reach it AFAICS is with a race condition, if the  
startup process sends a recovery conflict signal when the transaction  
has just entered aborted state for some other reason. And in that case  
the detail would be misleading, as the transaction was already aborted  
for some other reason, not because of the recovery conflict.  
  
errdetail_abort() was the only user of the recoveryConflictPending  
flag in PGPROC, so we can remove that and all the related code too.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi  

M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/include/storage/proc.h
M src/include/storage/procarray.h

Reject ADD CONSTRAINT NOT NULL if name mismatches existing constraint

commit   : 96e2af605043974137d84edf5c0a24561956919e    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Feb 2026 12:33:29 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 3 Feb 2026 12:33:29 +0100    

Click here for diff

When using ALTER TABLE ... ADD CONSTRAINT to add a not-null constraint  
with an explicit name, we have to ensure that if the column is already  
marked NOT NULL, the provided name matches the existing constraint name.  
Failing to do so could lead to confusion regarding which constraint  
object actually enforces the rule.  
  
This patch adds a check to throw an error if the user tries to add a  
named not-null constraint to a column that already has one with a  
different name.  
  
Reported-by: yanliang lei <msdnchina@163.com>  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Co-authored-bu: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/19351-8f1c523ead498545%40postgresql.org  

M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql

Change StaticAssertVariableIsOfType to be a declaration

commit   : 955e50766869a5ccf862d7f8439f5d35b723c0f9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Feb 2026 08:36:47 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Feb 2026 08:36:47 +0100    

Click here for diff

This allows moving the uses to more natural and useful positions.  
Also, a declaration is the more native use of static assertions in C.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2273bc2a-045d-4a75-8584-7cd9396e5534%40eisentraut.org  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/include/c.h

Rename AssertVariableIsOfType to StaticAssertVariableIsOfType

commit   : 137d05df2f2014c584b229310b8635fa6a8572ba    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Feb 2026 08:36:47 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 3 Feb 2026 08:36:47 +0100    

Click here for diff

This keeps run-time assertions and static assertions clearly separate.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/2273bc2a-045d-4a75-8584-7cd9396e5534%40eisentraut.org  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/backend/executor/execParallel.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/access/xlogdefs.h
M src/include/c.h
M src/include/lib/ilist.h
M src/include/lib/pairingheap.h
M src/include/postgres.h
M src/include/storage/proclist.h
M src/include/utils/freepage.h
M src/include/utils/relptr.h

Add two IO wait events for COPY FROM/TO on a pipe/file/program

commit   : e05a24c2d4eab3dd76741dc6e6c18bb0584771c5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Feb 2026 12:20:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Feb 2026 12:20:41 +0900    

Click here for diff

Two wait events are added to the COPY FROM/TO code:  
* COPY_FROM_READ: reading data from a copy_file.  
* COPY_TO_WRITE: writing data to a copy_file.  
  
In the COPY code, copy_file can be set when processing a command through  
the pipe mode (for the non-DestRemote case), the program mode or the  
file mode, when processing fread() or fwrite() on it.  
  
Author: Nikolay Samokhvalov <nik@postgres.ai>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAM527d_iDzz0Kqyi7HOfqa-Xzuq29jkR6AGXqfXLqA5PR5qsng@mail.gmail.com  

M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/utils/activity/wait_event_names.txt

Fix incorrect errno in OpenWalSummaryFile()

commit   : 213fec296f419af8f199a721a9986e879656555c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Feb 2026 11:25:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 3 Feb 2026 11:25:10 +0900    

Click here for diff

This routine has an option to bypass an error if a WAL summary file is  
opened for read but is missing (missing_ok=true).  However, the code  
incorrectly checked for EEXIST, that matters when using O_CREAT and  
O_EXCL, rather than ENOENT, for this case.  
  
There are currently only two callers of OpenWalSummaryFile() in the  
tree, and both use missing_ok=false, meaning that the check based on the  
errno is currently dead code.  This issue could matter for out-of-core  
code or future backpatches that would like to use missing_ok set to  
true.  
  
Issue spotted while monitoring this area of the code, after  
a9afa021e95f.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aYAf8qDHbpBZ3Rml@paquier.xyz  
Backpatch-through: 17  

M src/backend/backup/walsummary.c

Release synchronous replication waiters immediately on configuration changes.

commit   : 21c1125d660617f71b20304150e4a8583299cf86    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Feb 2026 11:14:00 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Feb 2026 11:14:00 +0900    

Click here for diff

Previously, when synchronous_standby_names was changed (for example,  
by reducing the number of required synchronous standbys or modifying  
the standby list), backends waiting for synchronous replication were not  
released immediately, even if the new configuration no longer required them  
to wait. They could remain blocked until additional messages arrived from  
standbys and triggered their release.  
  
This commit improves walsender so that backends waiting for synchronous  
replication are released as soon as the updated configuration takes effect and  
the new settings no longer require them to wait, by calling  
SyncRepReleaseWaiters() when configuration changes are processed.  
  
As part of this change, the duplicated code that handles configuration changes  
in walsender has been refactored into a new helper function, which is now used  
at the three existing call places.  
  
Since this is an improvement rather than a bug fix, it is applied only to  
the master branch.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurSRii0tEYhu5cePmRcvS=ZrxTLEvxm3Kj0d7_uKGdM23g@mail.gmail.com  

M src/backend/replication/walsender.c

psql: Add %i prompt escape to indicate hot standby status.

commit   : dddbbc253b923ef27f724c6abb5a6a39e1254d54    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Feb 2026 10:03:19 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 3 Feb 2026 10:03:19 +0900    

Click here for diff

This commit introduces a new prompt escape %i for psql, which shows  
whether the connected server is operating in hot standby mode. It  
expands to standby if the server reports in_hot_standby = on, and  
primary otherwise.  
  
This is useful for distinguishing standby servers from primary ones  
at a glance, especially when working with multiple connections in  
replicated environments where libpq's multi-host connection strings  
are used.  
  
Author: Jim Jones <jim.jones@uni-muenster.de>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Discussion: https://www.postgresql.org/message-id/flat/016f6738-f9a9-4e98-bb5a-e1e4b9591d46@uni-muenster.de  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/prompt.c

Fix flakiness in the pg_visibility VM-only vacuum test by using a temporary table.

commit   : 4a99ef1a0d11ed464295515635a44aad1b000691    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 2 Feb 2026 17:44:37 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 2 Feb 2026 17:44:37 -0500    

Click here for diff

The test relies on VACUUM being able to mark a page all-visible, but  
this can fail when autovacuum in other sessions prevents the visibility  
horizon from advancing. Making the test table temporary isolates its  
horizon from other sessions, including catalog table vacuums, ensuring  
reliable test behavior.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/2b09fba6-6b71-497a-96ef-a6947fcc39f6%40gmail.com  

M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql

test_shm_mq: Set background worker names.

commit   : 12451d9d1f5991739540aefdec77694d59567b34    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Feb 2026 15:43:01 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 2 Feb 2026 15:43:01 -0600    

Click here for diff

Oversight in commit 5373bc2a08.  
  
Author: Michael Banck <mbanck@gmx.net>  
Discussion: https://postgr.es/m/20260202173156.GB17962%40p46.dedyn.io%3Blightning.p46.dedyn.io  

M src/test/modules/test_shm_mq/setup.c

Refactor att_align_nominal() to improve performance.

commit   : da7a1dc0d62ac3141328f4e6ad51d70e918167aa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Feb 2026 14:39:50 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Feb 2026 14:39:50 -0500    

Click here for diff

Separate att_align_nominal() into two macros, similarly to what  
was already done with att_align_datum() and att_align_pointer().  
The inner macro att_nominal_alignby() is really just TYPEALIGN(),  
while att_align_nominal() retains its previous API by mapping  
TYPALIGN_xxx values to numbers of bytes to align to and then  
calling att_nominal_alignby().  In support of this, split out  
tupdesc.c's logic to do that mapping into a publicly visible  
function typalign_to_alignby().  
  
Having done that, we can replace performance-critical uses of  
att_align_nominal() with att_nominal_alignby(), where the  
typalign_to_alignby() mapping is done just once outside the loop.  
  
In most places I settled for doing typalign_to_alignby() once  
per function.  We could in many places pass the alignby value  
in from the caller if we wanted to change function APIs for this  
purpose; but I'm a bit loath to do that, especially for exported  
APIs that extensions might call.  Replacing a char typalign  
argument by a uint8 typalignby argument would be an API change  
that compilers would fail to warn about, thus silently breaking  
code in hard-to-debug ways.  I did revise the APIs of array_iter_setup  
and array_iter_next, moving the element type attribute arguments to  
the former; if any external code uses those, the argument-count  
change will cause visible compile failures.  
  
Performance testing shows that ExecEvalScalarArrayOp is sped up by  
about 10% by this change, when using a simple per-element function  
such as int8eq.  I did not check any of the other loops optimized  
here, but it's reasonable to expect similar gains.  
  
Although the motivation for creating this patch was to avoid a  
performance loss if we add some more typalign values, it evidently  
is worth doing whether that patch lands or not.  
  
Discussion: https://postgr.es/m/1127261.1769649624@sss.pgh.pa.us  

M contrib/dblink/dblink.c
M src/backend/access/common/tupdesc.c
M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/varlena.c
M src/include/access/tupmacs.h
M src/include/utils/arrayaccess.h
M src/pl/plpython/plpy_typeio.c

In s_lock.h, use regular labels with %= instead of local labels.

commit   : 0c9f46c4280e31a4f49200f5d2cde37727651869    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Feb 2026 11:13:38 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 2 Feb 2026 11:13:38 -0500    

Click here for diff

Up to now we've used GNU-style local labels for branch targets  
in s_lock.h's assembly blocks.  But there's an alternative style,  
which I for one didn't know about till recently: use regular  
assembler labels, and insert a per-asm-block number in them  
using %= to ensure they are distinct across multiple TAS calls  
within one source file.  gcc has had %= since gcc 2.0, and  
I've verified that clang knows it too.  
  
While the immediate motivation for changing this is that AIX's  
assembler doesn't do local labels, it seems to me that this is a  
superior solution anyway.  There is nothing mnemonic about "1:",  
while a regular label can convey something useful, and at least  
to me it feels less error-prone.  Therefore let's standardize on  
this approach, also converting the one other usage in s_lock.h.  
  
Discussion: https://postgr.es/m/399291.1769998688@sss.pgh.pa.us  

M src/include/storage/s_lock.h

Fix error message in RemoveWalSummaryIfOlderThan()

commit   : a9afa021e95f2b0ffaaf26f3a27e685f634f4ac9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Feb 2026 10:21:04 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Feb 2026 10:21:04 +0900    

Click here for diff

A failing unlink() was reporting an incorrect error message, referring  
to stat().  
  
Author: Man Zeng <zengman@halodbtech.com>  
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/tencent_3BBE865C5F49D452360FF190@qq.com  
Backpath-through: 17  

M src/backend/backup/walsummary.c

Fix build inconsistency due to the generation of wait-event code

commit   : d46aa32ea5ce0c61a464cdc2c74fa9a428df8bc1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Feb 2026 08:02:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 Feb 2026 08:02:39 +0900    

Click here for diff

The build generates four files based on the wait event contents stored  
in wait_event_names.txt:  
- wait_event_types.h  
- pgstat_wait_event.c  
- wait_event_funcs_data.c  
- wait_event_types.sgml  
  
The SGML file is generated as part of a documentation build, with its  
data stored in doc/src/sgml/ for meson and configure.  The three others  
are handled differently for meson and configure:  
- In configure, all the files are created in src/backend/utils/activity/.  
A link to wait_event_types.h is created in src/include/utils/.  
- In meson, all the files are created in src/include/utils/.  
  
The two C files, pgstat_wait_event.c and wait_event_funcs_data.c, are  
then included in respectively wait_event.c and wait_event_funcs.c,  
without the "utils/" path.  
  
For configure, this does not present a problem.  For meson, this has to  
be combined with a trick in src/backend/utils/activity/meson.build,  
where include_directories needs to point to include/utils/ to make the  
inclusion of the C files work properly, causing builds to pull in  
PostgreSQL headers rather than system headers in some build paths, as  
src/include/utils/ would take priority.  
  
In order to fix this issue, this commit reworks the way the C/H files  
are generated, becoming consistent with guc_tables.inc.c:  
- For meson, basically nothing changes.  The files are still generated  
in src/include/utils/.  The trick with include_directories is removed.  
- For configure, the files are now generated in src/backend/utils/, with  
links in src/include/utils/ pointing to the ones in src/backend/.  This  
requires extra rules in src/backend/utils/activity/Makefile so as a  
make command in this sub-directory is able to work.  
- The three files now fall under header-stamp, which is actually simpler  
as guc_tables.inc.c does the same.  
- wait_event_funcs_data.c and pgstat_wait_event.c are now included with  
"utils/" in their path.  
  
This problem has not been an issue in the buildfarm; it has been noted  
with AIX and a conflict with float.h.  This issue could, however, create  
conflicts in the buildfarm depending on the environment with unexpected  
headers pulled in, so this fix is backpatched down to where the  
generation of the wait-event files has been introduced.  
  
While on it, this commit simplifies wait_event_names.txt regarding the  
paths of the files generated, to mention just the names of the files  
generated.  The paths where the files are generated became incorrect.  
The path of the SGML path was wrong.  
  
This change has been tested in the CI, down to v17.  Locally, I have run  
tests with configure (with and without VPATH), as well as meson, on the  
three branches.  
  
Combo oversight in fa88928470b5 and 1e68e43d3f0f.  
  
Reported-by: Aditya Kamath <aditya.kamath1@ibm.com>  
Discussion: https://postgr.es/m/LV8PR15MB64888765A43D229EA5D1CFE6D691A@LV8PR15MB6488.namprd15.prod.outlook.com  
Backpatch-through: 17  

M src/backend/Makefile
M src/backend/utils/.gitignore
M src/backend/utils/Makefile
D src/backend/utils/activity/.gitignore
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/Makefile
M src/include/utils/.gitignore
M src/include/utils/meson.build

Make psql/t/030_pager.pl more robust.

commit   : 6918434a4acb2b14535b3c1be30d306666db7c24    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Jan 2026 15:11:44 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Jan 2026 15:11:44 -0500    

Click here for diff

Similarly to the preceding commit, 030_pager.pl was assuming  
that patterns it looks for in interactive psql output would  
appear by themselves on a line, but that assumption tends to  
fall over in builds made --without-readline: the output we  
get might have a psql prompt immediately followed by the  
expected line of output.  
  
For several of these tests, just checking for the pattern  
followed by newline seems sufficient, because we could not  
get a false match against the command echo, nor against the  
unreplaced command output if the pager fails to be invoked  
when expected.  However, that's fairly scary for the test  
that was relying on information_schema.referential_constraints:  
"\d+" could easily appear at the end of a line in that view.  
Let's get rid of that hazard by making a custom test view  
instead of using information_schema.referential_constraints.  
  
This test script is new in v19, so no need for back-patch.  
  
Reported-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>  
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>  
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Discussion: https://postgr.es/m/db6fdb35a8665ad3c18be01181d44b31@postgrespro.ru  

M src/bin/psql/t/030_pager.pl

Improve guards against false regex matches in BackgroundPsql.pm.

commit   : a1d7ae2b2e38dd5d783c91316925f9f395da47e6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Jan 2026 14:59:25 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Jan 2026 14:59:25 -0500    

Click here for diff

BackgroundPsql needs to wait for all the output from an interactive  
psql command to come back.  To make sure that's happened, it issues  
the command, then issues \echo and \warn psql commands that echo  
a "banner" string (which we assume won't appear in the command's  
output), then waits for the banner strings to appear.  The hazard  
in this approach is that the banner will also appear in the echoed  
psql commands themselves, so we need to distinguish those echoes from  
the desired output.  Commit 8b886a4e3 tried to do that by positing  
that the desired output would be directly preceded and followed by  
newlines, but it turns out that that assumption is timing-sensitive.  
In particular, it tends to fail in builds made --without-readline,  
wherein the command echoes will be made by the pty driver and may  
be interspersed with prompts issued by psql proper.  
  
It does seem safe to assume that the banner output we want will be  
followed by a newline, since that should be the last output before  
things quiesce.  Therefore, we can improve matters by putting quotes  
around the banner strings in the \echo and \warn psql commands, so  
that their echoes cannot include banner directly followed by newline,  
and then checking for just banner-and-newline in the match pattern.  
  
While at it, spruce up the pump() call in sub query() to look like  
the neater version in wait_connect(), and don't die on timeout  
until after printing whatever we got.  
  
Reported-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>  
Diagnosed-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>  
Discussion: https://postgr.es/m/db6fdb35a8665ad3c18be01181d44b31@postgrespro.ru  
Backpatch-through: 14  

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

Move shmem allocator's fields from PGShmemHeader to its own struct

commit   : e2362eb2bd1459319dacaeaa5dc886dbca546b96    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 30 Jan 2026 18:22:56 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 30 Jan 2026 18:22:56 +0200    

Click here for diff

For readability. It was a slight modularity violation to have fields  
in PGShmemHeader that were only used by the allocator code in  
shmem.c. And it was inconsistent that ShmemLock was nevertheless not  
stored there. Moving all the allocator-related fields to a separate  
struct makes it more consistent and modular, and removes the need to  
allocate and pass ShmemLock separately via BackendParameters.  
  
Merge InitShmemAccess() and InitShmemAllocation() into a single  
function that initializes the struct when called from postmaster, and  
when called from backends in EXEC_BACKEND mode, re-establishes the  
global variables. That's similar to all the *ShmemInit() functions  
that we have.  
  
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAExHW5uNRB9oT4pdo54qAo025MXFX4MfYrD9K15OCqe-ExnNvg@mail.gmail.com  

M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/launch_backend.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/include/storage/pg_shmem.h
M src/include/storage/shmem.h
M src/tools/pgindent/typedefs.list

Minor cosmetic tweaks

commit   : e76221bd95f0428cc9b5872a4bcbf0b7e40b77b0    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 30 Jan 2026 14:26:02 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 30 Jan 2026 14:26:02 +0100    

Click here for diff

These changes should have been done by 2f9661311b83, but were  
overlooked.  I noticed while reviewing the code for commit b8926a5b4bb8.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/18984-0f4778a6599ac3ae@postgresql.org  

M src/backend/tcop/postgres.c
M src/backend/utils/mmgr/portalmem.c

Use C99 designated designators in a couple of places

commit   : 1eb09ed63a8d8063dc6bb75c8f31ec564bf35250    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 30 Jan 2026 10:11:04 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 30 Jan 2026 10:11:04 +0100    

Click here for diff

This makes the arrays somewhat easier to read.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://postgr.es/m/202601281204.sdxbr5qvpunk@alvherre.pgsql  

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

Remove unused argument from ApplyLogicalMappingFile().

commit   : bb26a81ee28c9d9c64e6f233fafa2792768ece1b    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 30 Jan 2026 09:05:35 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 30 Jan 2026 09:05:35 +0900    

Click here for diff

Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/20260128120056.b2a3e8184712ab5a537879eb@sraoss.co.jp  

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

tableam: Perform CheckXidAlive check once per scan

commit   : 87f7b824f20c1c06884ef0711b4d32dbf4461436    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jan 2026 17:27:23 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jan 2026 17:27:23 -0500    

Click here for diff

Previously, the CheckXidAlive check was performed within the table_scan*next*  
functions. This caused the check to be executed for every fetched tuple, an  
unnecessary overhead.  
  
To fix, move the check to table_beginscan* so it is performed once per scan  
rather than once per row.  
  
Note: table_tuple_fetch_row_version() does not use a scan descriptor;  
therefore, the CheckXidAlive check is retained in that function. The overhead  
is unlikely to be relevant for the existing callers.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Author: Dilip Kumar <dilipbalaut@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Suggested-by: Amit Kapila <akapila@postgresql.org>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/tlpltqm5jjwj7mp66dtebwwhppe4ri36vdypux2zoczrc2i3mp%40dhv4v4nikyfg  

M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
M src/backend/access/table/tableam.c
M src/include/access/tableam.h

bufmgr: Allow conditionally locking of already locked buffer

commit   : 333f586372aae764b7ad7e2c975b14fd431ce819    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jan 2026 16:49:01 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Jan 2026 16:49:01 -0500    

Click here for diff

In fcb9c977aa5 I included an assertion in BufferLockConditional() to detect if  
a conditional lock acquisition is done on a buffer that we already have  
locked. The assertion was added in the course of adding other assertions.  
Unfortunately I failed to realize that some of our code relies on such lock  
acquisitions to silently fail. E.g. spgist and nbtree may try to conditionally  
lock an already locked buffer when acquiring a empty buffer.  
  
LWLockAcquireConditional(), which was previously used to implement  
ConditionalLockBuffer(), does not have such an assert.  
  
Instead of just removing the assert, and relying on the lock acquisition to  
fail due to the buffer already locked, this commit changes the behaviour of  
conditional content lock acquisition to fail if the current backend has any  
pre-existing lock on the buffer, even if the lock modes would not  
conflict. The reason for that is that we currently do not have space to track  
multiple lock acquisitions on a single buffer. Allowing multiple locks on the  
same buffer by a backend also seems likely to lead to bugs.  
  
There is only one non-self-exclusive conditional content lock acquisition, in  
GetVictimBuffer(), but it only is used if the target buffer is not pinned and  
thus can't already be locked by the current backend.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/90bd2cbb-49ce-4092-9f61-5ac2ab782c94@gmail.com  

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

Further fix extended alignment for older g++.

commit   : bd9dfac8b121e67d7dd4a9bfecb1474fe6811927    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jan 2026 16:16:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Jan 2026 16:16:36 -0500    

Click here for diff

Commit 6ceef9408 was still one brick shy of a load, because it caused  
any usage at all of PGIOAlignedBlock or PGAlignedXLogBlock to fail  
under older g++.  Notably, this broke "headerscheck --cplusplus".  
We can permit references to these structs as abstract structs though;  
only actual declaration of such a variable needs to be forbidden.  
  
Discussion: https://www.postgresql.org/message-id/3119480.1769189606@sss.pgh.pa.us  

M src/include/c.h

Fix theoretical memory leaks in pg_locale_libc.c.

commit   : de90bb7db1f8c7ab1289f82f877a6e18f7b3d468    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 29 Jan 2026 10:14:55 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 29 Jan 2026 10:14:55 -0800    

Click here for diff

The leaks were hard to reach in practice and the impact was low.  
  
The callers provide a buffer the same number of bytes as the source  
string (plus one for NUL terminator) as a starting size, and libc  
never increases the number of characters. But, if the byte length of  
one of the converted characters is larger, then it might need a larger  
destination buffer. Previously, in that case, the working buffers  
would be leaked.  
  
Even in that case, the call typically happens within a context that  
will soon be reset. Regardless, it's worth fixing to avoid such  
assumptions, and the fix is simple so it's worth backporting.  
  
Discussion: https://postgr.es/m/e2b7a0a88aaadded7e2d19f42d5ab03c9e182ad8.camel@j-davis.com  
Backpatch-through: 18  

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

Replace literal 0 with InvalidXLogRecPtr for XLogRecPtr assignments

commit   : ec317440716487753bafa4c0f8adae53e2c32446    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 29 Jan 2026 18:37:09 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 29 Jan 2026 18:37:09 +0100    

Click here for diff

Use the proper constant InvalidXLogRecPtr instead of literal 0 when  
assigning XLogRecPtr variables and struct fields.  
  
This improves code clarity by making it explicit that these are  
invalid LSN values rather than ambiguous zero literals.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/aRtd2dw8FO1nNX7k@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/gist/gist.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/storage/lmgr/proc.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c

Fix mistakes in commit 4020b370f214315b8c10430301898ac21658143f

commit   : 71c1136989b363004357efb54c87b4192749a6a0    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 29 Jan 2026 08:04:23 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 29 Jan 2026 08:04:23 -0500    

Click here for diff

cost_tidrangescan() was setting the disabled_nodes value correctly,  
and then immediately resetting it to zero, due to poor code editing on  
my part.  
  
materialized_finished_plan correctly set matpath.parent to  
zero, but forgot to also set matpath.parallel_workers = 0, causing  
an access to uninitialized memory in cost_material. (This shouldn't  
result in any real problem, but it makes valgrind unhappy.)  
  
reparameterize_path was dereferencing a variable before verifying that  
it was not NULL.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (issue #1)  
Reported-by: Michael Paquier <michael@paquier.xyz> (issue #1)  
Diagnosed-by: Lukas Fittl <lukas@fittl.com> (issue #1)  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> (issue #2)  
Reported-by: Richard Guo <guofenglinux@gmail.com> (issue #3)  
Discussion: http://postgr.es/m/CAN4CZFPvwjNJEZ_JT9Y67yR7C=KMNa=LNefOB8ZY7TKDcmAXOA@mail.gmail.com  
Discussion: http://postgr.es/m/aXrnPgrq6Gggb5TG@paquier.xyz  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c

Wake LSN waiters before recovery target stop

commit   : 20a8f783e15c503125c2ed0ae890510879f62801    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 29 Jan 2026 09:47:09 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 29 Jan 2026 09:47:09 +0200    

Click here for diff

Move WaitLSNWakeup() immediately after ApplyWalRecord() so waiters are  
signaled even when recoveryStopsAfter() breaks out for pause/promotion  
targets.  
  
Discussion: https://postgr.es/m/9533608f-f289-44bd-b881-9e5a73203c5b%40iki.fi  
Discussion: https://postgr.es/m/CABPTF7Wdq6KbvC3EhLX3Pz%3DODCCPEX7qVQ%2BE%3DcokkB91an2E-A%40mail.gmail.com  
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Author: Xuneng Zhou <xunengzhou@gmail.com>  

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

psql: Disable %P (pipeline status) for non-active connection

commit   : 4b77282f250103f2ecd54b9f45421c742006317b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 16:20:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 16:20:45 +0900    

Click here for diff

In the psql prompt, %P prompt shows the current pipeline status.  Unlike  
most of the other options, its status was showing up in the output  
generated even if psql was not connected to a database.  This was  
confusing, because without a connection a pipeline status makes no  
sense.  
  
Like the other options, %P is updated so as its data is now hidden  
without an active connection.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/86EF76B5-6E62-404D-B9EC-66F4714D7D5F@gmail.com  
Backpatch-through: 18  

M src/bin/psql/prompt.c

Fix two error messages in extended_stats_funcs.c

commit   : 740a1494f4bfb470b16e5b70c79fae473b1a655d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 14:57:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 14:57:47 +0900    

Click here for diff

These have been fat-fingered in 0e80f3f88dea and 302879bd68d1.  The  
error message for ndistinct had an incorrect grammar, while the one for  
dependencies had finished with a period (incorrect based on the project  
guidelines).  
  
Discussion: https://postgr.es/m/aXrsjZQbVuB6236u@paquier.xyz  

M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out

Add test doing some cloning of extended statistics data

commit   : fc365e4fccc46d2991ab9614198aa6d71b3838d2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 13:22:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 13:22:07 +0900    

Click here for diff

The test added in this commit copies the data of an ANALYZE run on one  
relation to a secondary relation with the same attribute definitions and  
extended statistics objects.  Once the clone is done, the target and  
origin should have the same extended statistics information, with no  
differences.  
  
This test would have been able to catch e3094679b983, for example, as we  
expect the full range of statistics to be copied over, with no  
differences generated between the results of an ANALYZE and the data  
copied to the cloned relation.  
  
Note that this new test should remain at the bottom of stats_import.sql,  
so as any additions in the main relation and its clone are automatically  
covered when copying their statistics, so as it would work as a sanity  
check in the future.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

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

Add test for pg_restore_extended_stats() with multiranges

commit   : 0b7beec42ae2924f94410bded81f75f6f4eadd34    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 12:38:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 12:38:10 +0900    

Click here for diff

The restore of extended statistics has some paths dedicated to  
multirange types and expressions for all the stats kinds supported, and  
we did not have coverage for the case where an extended stats object  
uses a multirange attribute with or without an expression.  
  
Extracted from a larger patch by the same author, with a couple of  
tweaks from me regarding the format of the output generated, to make it  
more readable to the eye.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

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

Fix CI failure introduced in commit 851f6649cc.

commit   : 3a98f989e8e596efb0db942ead90f64800136fac    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 29 Jan 2026 03:22:02 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 29 Jan 2026 03:22:02 +0000    

Click here for diff

The test added in commit 851f6649cc uses a backup taken from a node  
created by the previous test to perform standby related checks. On  
Windows, however, the standby failed to start with the following error:  
FATAL:  could not rename file "backup_label" to "backup_label.old": Permission denied  
  
This occurred because some background sessions from the earlier test were  
still active. These leftover processes continued accessing the parent  
directory of the backup_label file, likely preventing the rename and  
causing the failure. Ensuring that these sessions are cleanly terminated  
resolves the issue in local testing.  
  
Additionally, the has_restoring => 1 option has been removed, as it was  
not required by the new test.  
  
Reported-by: Robert Haas <robertmhaas@gmail.com>  
Backpatch-through: 17  
Discussion: https://postgr.es/m/CA+TgmobdVhO0ckZfsBZ0wqDO4qHVCwZZx8sf=EinafvUam-dsQ@mail.gmail.com  

M src/test/recovery/t/046_checkpoint_logical_slot.pl

Add support for "mcv" in pg_restore_extended_stats()

commit   : efbebb4e85872b1c4d6bc19c4550e67850b83aab    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 12:14:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 12:14:08 +0900    

Click here for diff

This commit adds support for the restore of extended statistics of the  
kind "mcv", aka most-common values.  
  
This format is different from n_distinct and dependencies stat types in  
that it is the combination of three of the four different arrays from the  
pg_stats_ext view which in turn require three different input parameters  
on pg_restore_extended_statistics().  These are translated into three  
input arguments for the function:  
- "most_common_vals", acting as a leader of the others.  It is a  
2-dimension array, that includes the common values.  
- "most_common_freqs", 1-dimension array of float8[], with a number of  
elements that has to match with "most_common_vals".  
- "most_common_base_freqs", 1-dimension array of float8[], with a number  
of elements that has to match with "most_common_vals".  
  
All three arrays are required to achieve the restore of this type of  
extended statistics (if "most_common_vals" happens to be NULL in the  
catalogs, the rest is NULL by design).  
  
Note that "most_common_val_nulls" is not required in input, its data is  
rebuilt from the decomposition of the "most_common_vals" array based on  
its text[] representation.  The initial versions of the patch provided  
this option in input, but we do not require it and it simplifies a lot  
the result.  
  
Support in pg_dump is added down to v13 which is where the support for  
this type of extended statistics has been added, when --statistics is  
used.  This means that upgrade and dumps can restore extended statistics  
data transparently, like "dependencies", "ndistinct", attribute and  
relation statistics.  For MCV, the values are directly queried from the  
relevant catalogs.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/backend/statistics/mcv.c
M src/bin/pg_dump/pg_dump.c
M src/include/statistics/extended_stats_internal.h
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Fix whitespace issue in regression test stats_import

commit   : e09e5ad69acab315d2fd5c87626de1bdc0482480    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 11:59:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Jan 2026 11:59:43 +0900    

Click here for diff

Issue noticed while playing this area of the tests for a different  
patch.  

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

Add a couple of recent commits to .git-blame-ignore-revs.

commit   : ef1c8652065501503ed328249023509798a80df3    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 28 Jan 2026 15:56:48 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 28 Jan 2026 15:56:48 -0600    

Click here for diff

M .git-blame-ignore-revs

Consolidate replication origin session globals into a single struct.

commit   : 8f1e2dfe033e9a3236265c3b9f61bd226f4a8f54    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 12:26:22 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 12:26:22 -0800    

Click here for diff

This commit moves the separate global variables for replication origin  
state into a single ReplOriginXactState struct. This groups logically  
related variables, which improves code readability and simplifies  
state management (e.g., resetting the state) by handling them as a  
unit.  
  
Author: Chao Li <lic@highgo.com>  
Suggested-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2=pYvfRthXHTzSrOsf5_FfyY4zJyK4zV2v4W=yjUij1cA@mail.gmail.com  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/origin.h
M src/tools/pgindent/typedefs.list

Refactor replication origin state reset helpers.

commit   : 227eb4eea20575d9ef0aac0bdae7b6c2ba261f34    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 11:45:26 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 11:45:26 -0800    

Click here for diff

Factor out common logic for clearing replorigin_session_* variables  
into a dedicated helper function, replorigin_xact_clear().  
  
This removes duplicated assignments of these variables across multiple  
call sites, and makes the intended scope of each reset explicit.  
  
Author: Chao Li <lic@highgo.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAEoWx2=pYvfRthXHTzSrOsf5_FfyY4zJyK4zV2v4W=yjUij1cA@mail.gmail.com  

M src/backend/replication/logical/origin.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/origin.h

Standardize replication origin naming to use "ReplOrigin".

commit   : 1fdbca159e0055fefc0b391ec09520d0b3bd9248    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 11:03:29 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 28 Jan 2026 11:03:29 -0800    

Click here for diff

The replication origin code was using inconsistent naming  
conventions. Functions were typically prefixed with 'replorigin',  
while typedefs and constants used "RepOrigin".  
  
This commit unifies the naming convention by renaming RepOriginId to  
ReplOriginId.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoBDgm3hDqUZ+nqu=ViHmkCnJBuJyaxG_yvv27BAi2zBmQ@mail.gmail.com  

M contrib/test_decoding/test_decoding.c
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execReplication.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_upgrade/t/004_subscription.pl
M src/include/access/commit_ts.h
M src/include/access/twophase.h
M src/include/access/xlogdefs.h
M src/include/access/xlogreader.h
M src/include/executor/executor.h
M src/include/replication/conflict.h
M src/include/replication/logical.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list

Allow for plugin control over path generation strategies.

commit   : 4020b370f214315b8c10430301898ac21658143f    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Jan 2026 11:28:34 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Jan 2026 11:28:34 -0500    

Click here for diff

Each RelOptInfo now has a pgs_mask member which is a mask of acceptable  
strategies. For most rels, this is populated from PlannerGlobal's  
default_pgs_mask, which is computed from the values of the enable_*  
GUCs at the start of planning.  
  
For baserels, get_relation_info_hook can be used to adjust pgs_mask for  
each new RelOptInfo, at least for rels of type RTE_RELATION. Adjusting  
pgs_mask is less useful for other types of rels, but if it proves to  
be necessary, we can revisit the way this hook works or add a new one.  
  
For joinrels, two new hooks are added. joinrel_setup_hook is called each  
time a joinrel is created, and one thing that can be done from that hook  
is to manipulate pgs_mask for the new joinrel. join_path_setup_hook is  
called each time we're about to add paths to a joinrel by considering  
some particular combination of an outer rel, an inner rel, and a join  
type. It can modify the pgs_mask propagated into JoinPathExtraData to  
restrict strategy choice for that particular combination of rels.  
  
To make joinrel_setup_hook work as intended, the existing calls to  
build_joinrel_partition_info are moved later in the calling functions;  
this is because that function checks whether the rel's pgs_mask includes  
PGS_CONSIDER_PARTITIONWISE, so we want it to only be called after  
plugins have had a chance to alter pgs_mask.  
  
Upper rels currently inherit pgs_mask from the input relation. It's  
unclear that this is the most useful behavior, but at the moment there  
are no hooks to allow the mask to be set in any other way.  
  
Reviewed-by: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>  
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.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/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h

Fix duplicate arbiter detection during REINDEX CONCURRENTLY on partitions

commit   : e6d6e32f4240bb967460aabdd2db51181cff242f    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 28 Jan 2026 14:38:53 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 28 Jan 2026 14:38:53 +0100    

Click here for diff

Commit 90eae926a fixed ON CONFLICT handling during REINDEX CONCURRENTLY  
on partitioned tables by treating unparented indexes as potential  
arbiters.  However, there's a remaining race condition: when pg_inherits  
records are swapped between consecutive calls to get_partition_ancestors(),  
two different child indexes can appear to have the same parent, causing  
duplicate entries in the arbiter list and triggering "invalid arbiter  
index list" errors.  
  
Note that this is not a new problem introduced by 90eae926a.  The same  
error could occur before that commit in a slightly different scenario:  
an index is selected during planning, then index_concurrently_swap()  
commits, and a subsequent call to get_partition_ancestors() uses a new  
catalog snapshot that sees zero ancestors for that index.  
  
Fix by tracking which parent indexes have already been processed.  If a  
subsequent call to get_partition_ancestors() returns a parent we've  
already seen, treat that index as unparented instead, allowing it to be  
matched via IsIndexCompatibleAsArbiter() like other concurrent reindex  
scenarios.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/e5a8c1df-04e5-4343-85ef-5df2a7e3d90c@gmail.com  

M src/backend/executor/execPartition.c
M src/test/modules/test_misc/t/010_index_concurrently_upsert.pl

Fix pg_restore_extended_stats() with expressions

commit   : e3094679b9835fed2ea5c7d7877e8ac8e7554d33    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jan 2026 11:48:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jan 2026 11:48:45 +0900    

Click here for diff

This commit fixes an issue with the restore of ndistinct and  
dependencies statistics, causing the operation to fail when any of these  
kinds included expressions.  
  
In extended statistics, expressions use strictly negative attribute  
numbers, decremented from -1.  For example, let's imagine an object  
defined as follows:  
CREATE STATISTICS stats_obj (dependencies) ON lower(name), upper(name)  
  FROM tab_obj;  
  
This object would generate dependencies stats using -1 and -2 as  
attribute numbers, like that:  
[{"attributes": [-1], "dependency": -2, "degree": 1.000000},  
 {"attributes": [-2], "dependency": -1, "degree": 1.000000}]  
  
However, pg_restore_extended_stats() forgot to account for the number of  
expressions defined in an extended statistics object.  This would cause  
the validation step of ndistinct and dependencies data to fail,  
preventing a restore of their stats even if the input is valid.  
  
This issue has come up due to an incorrect split of the patch set.  Some  
tests are included to cover this behavior.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aXl4bMfSTQUxM_yy@paquier.xyz  

M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Add output test for pg_dependencies statistics import

commit   : f9562b95c6e8a66b4cd081f09cc600bf7a364c46    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jan 2026 08:37:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Jan 2026 08:37:46 +0900    

Click here for diff

Commit 302879bd68d115 has added the ability to restore extended stats of  
the type "dependencies", but it has forgotten the addition of a test to  
verify that the value restored was actually set.  
  
This test is the pg_dependencies equivalent of the test added for  
pg_ndistinct in 0e80f3f88dea.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=dZr_Ut3jKw94_BisyyDtNZPRJWeOALXVzcJz=ZFTAhvQ@mail.gmail.com  

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

oauth: Correct test dependency on oauth_hook_client

commit   : c6a10a89feab903b03e2eb664bd6e931b28416a2    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 27 Jan 2026 11:56:44 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Tue, 27 Jan 2026 11:56:44 -0800    

Click here for diff

The oauth_validator tests missed the lessons of c89525d57 et al, so  
certain combinations of command-line build order and `meson test`  
options can result in  
  
    Command 'oauth_hook_client' not found in [...] at src/test/perl/PostgreSQL/Test/Utils.pm line 427.  
  
Add the missing dependency on the test executable. This fixes, for  
example,  
  
    $ ninja clean && ninja meson-test-prereq && PG_TEST_EXTRA=oauth meson test --no-rebuild  
  
Reported-by: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>  
Discussion: https://postgr.es/m/6e8f4f7c23faf77c4b6564c4b7dc5d3de64aa491.camel@gmail.com  
Discussion: https://postgr.es/m/qh4c5tvkgjef7jikjig56rclbcdrrotngnwpycukd2n3k25zi2%4044hxxvtwmgum  
Backpatch-through: 18  

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

pg_waldump: Remove file-level global WalSegSz.

commit   : 9a446d0256dc8f4afb4dba97734b46447c08d918    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Jan 2026 08:31:15 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Jan 2026 08:31:15 -0500    

Click here for diff

It's better style to pass the value around to just the places that  
need it. This makes it easier to determine whether the value is  
always properly initialized before use.  
  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Discussion: http://postgr.es/m/CAAJ_b94+wObPn-z1VECipnSFhjMJ+R2cpTmKVYLjyQuVn+B5QA@mail.gmail.com  

M src/bin/pg_waldump/pg_waldump.c

Prevent invalidation of newly synced replication slots.

commit   : 851f6649cc18c4b482fa2b6afddb65b35d035370    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 27 Jan 2026 05:06:29 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 27 Jan 2026 05:06:29 +0000    

Click here for diff

A race condition could cause a newly synced replication slot to become  
invalidated between its initial sync and the checkpoint.  
  
When syncing a replication slot to a standby, the slot's initial  
restart_lsn is taken from the publisher's remote_restart_lsn. Because slot  
sync happens asynchronously, this value can lag behind the standby's  
current redo pointer. Without any interlocking between WAL reservation and  
checkpoints, a checkpoint may remove WAL required by the newly synced  
slot, causing the slot to be invalidated.  
  
To fix this, we acquire ReplicationSlotAllocationLock before reserving WAL  
for a newly synced slot, similar to commit 006dd4b2e5. This ensures that  
if WAL reservation happens first, the checkpoint process must wait for  
slotsync to update the slot's restart_lsn before it computes the minimum  
required LSN.  
  
However, unlike in ReplicationSlotReserveWal(), this lock alone cannot  
protect a newly synced slot if a checkpoint has already run  
CheckPointReplicationSlots() before slotsync updates the slot. In such  
cases, the remote restart_lsn may be stale and earlier than the current  
redo pointer. To prevent relying on an outdated LSN, we use the oldest  
WAL location available if it is greater than the remote restart_lsn.  
  
This ensures that newly synced slots always start with a safe, non-stale  
restart_lsn and are not invalidated by concurrent checkpoints.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Vitaly Davydov <v.davydov@postgrespro.ru>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Backpatch-through: 17  
Discussion: https://postgr.es/m/TY4PR01MB16907E744589B1AB2EE89A31F94D7A%40TY4PR01MB16907.jpnprd01.prod.outlook.com  

M src/backend/access/transam/xlog.c
M src/backend/replication/logical/slotsync.c
M src/include/access/xlog.h
M src/test/recovery/t/046_checkpoint_logical_slot.pl

Include extended statistics data in pg_dump

commit   : c32fb29e979db4a7b92adb29007725eeacf91f64    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Jan 2026 13:42:32 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Jan 2026 13:42:32 +0900    

Click here for diff

This commit integrates the new pg_restore_extended_stats() function into  
pg_dump, so as the data of extended statistics is detected and included  
in dumps when the --statistics switch is specified.  Currently, the same  
extended stats kinds as the ones supported by the SQL function can be  
dumped: "n_distinct" and "dependencies".  
  
The extended statistics data can be dumped down to PostgreSQL 10, with  
the following changes depending on the backend version dealt with:  
- In v19 and newer versions, the format of pg_ndistinct and  
pg_dependencies has changed, catalogs can be directly queried.  
- In v18 and older versions, the format is translated to the new format  
supported by the backend.  
- In v14 and older versions, inherited extended statistics are not  
supported.  
- In v11 and older versions, the data for ndistinct and dependencies  
was stored in pg_statistic_ext.  These have been moved to pg_stats_ext  
in v12.  
- Extended Statistics have been introduced in v10, no support is needed  
for versions older than that.  
  
The extended statistics data is dumped if it can be found in the  
catalogs.  If the catalogs are empty, then no restore of the stats data  
is attempted.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Remove unnecessary abort() from WalSndShutdown().

commit   : 1ea44d7ddfb6ebacb6fb8ae2f5d6e904b2394f29    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 27 Jan 2026 11:55:32 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 27 Jan 2026 11:55:32 +0900    

Click here for diff

WalSndShutdown() previously called abort() after proc_exit(0) to  
silence compiler warnings. This is no longer needed, because both  
WalSndShutdown() and proc_exit() are declared pg_noreturn,  
allowing the compiler to recognize that the function does not return.  
Also there are already other functions, such as CheckpointerMain(),  
that call proc_exit() without an abort(), and they do not produce warnings.  
  
Therefore this abort() call in WalSndShutdown() is useless and  
this commit removes it.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CAHGQGwHPX1yoixq+YB5rF4zL90TMmSEa3FpHURtqW3Jc5+=oSA@mail.gmail.com  

M src/backend/replication/walsender.c

pgindent fix for 3fccbd94cba

commit   : 09c37015d49665c52ae7eabd5852af36851aede4    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 27 Jan 2026 00:26:36 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Tue, 27 Jan 2026 00:26:36 +0100    

Click here for diff

Backpatch-through: 18  

M contrib/pg_buffercache/pg_buffercache_pages.c

Handle ENOENT status when querying NUMA node

commit   : 3fccbd94cba0e4ee7a28d22eb5eb64b9fa23f234    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 22:20:18 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 22:20:18 +0100    

Click here for diff

We've assumed that touching the memory is sufficient for a page to be  
located on one of the NUMA nodes. But a page may be moved to a swap  
after we touch it, due to memory pressure.  
  
We touch the memory before querying the status, but there is no  
guarantee it won't be moved to the swap in the meantime. The touching  
happens only on the first call, so later calls are more likely to be  
affected. And the batching increases the window too.  
  
It's up to the kernel if/when pages get moved to swap. We have to accept  
ENOENT (-2) as a valid result, and handle it without failing. This patch  
simply treats it as an unknown node, and returns NULL in the two  
affected views (pg_shmem_allocations_numa and pg_buffercache_numa).  
  
Hugepages cannot be swapped out, so this affects only regular pages.  
  
Reported by Christoph Berg, investigation and fix by me. Backpatch to  
18, where the two views were introduced.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Discussion: 18  
Backpatch-through: https://postgr.es/m/aTq5Gt_n-oS_QSpL@msg.df7cb.de  

M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/ipc/shmem.c

Add support for "dependencies" in pg_restore_extended_stats()

commit   : 302879bd68d1156fa27c38d29763ca9e4a1649c4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Jan 2026 08:20:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Jan 2026 08:20:13 +0900    

Click here for diff

This commit adds support for the restore of extended statistics of the  
kind "dependencies", for the following input data:  
[{"attributes": [2], "dependency": 3, "degree": 1.000000},  
 {"attributes": [3], "dependency": 2, "degree": 1.000000}]  
  
This relies on the existing routines of "dependencies" to cross-check  
the input data with the definition of the extended statistics objects  
for the attribute numbers.  An input argument of type "pg_dependencies"  
is required for this new option.  
  
Thanks to the work done in 0e80f3f88dea for the restore function and  
e1405aa5e3ac for the input handling of data type pg_dependencies, this  
addition is straight-forward.  This will be used so as it is possible to  
transfer these statistics across dumps and upgrades, removing the need  
for a post-operation ANALYZE for these kinds of statistics.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Refactor lazy_scan_prune() VM clear logic into helper

commit   : 19af794b660e3711d8b698aeedfc33e13dc235d8    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 17:12:05 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 17:12:05 -0500    

Click here for diff

Encapsulating the cases that clear the visibility map after vacuum phase  
I, when corruption is detected, into in a helper makes the code cleaner  
and enables further refactoring in future commits.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/7ib3sa55sapwjlaz4sijbiq7iezna27kjvvvar4dpgkmadml6t%40gfpkkwmdnepx  

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

Eliminate use of cached VM value in lazy_scan_prune()

commit   : 648a7e28d7c28754ca46caa09864435bc45e543d    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 17:00:13 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 17:00:13 -0500    

Click here for diff

lazy_scan_prune() takes a parameter from lazy_scan_heap() indicating  
whether the page was marked all-visible in the VM at the time it was  
last checked in find_next_unskippable_block(). This behavior is  
historical, dating back to commit 608195a3a365, when we did not pin the  
VM page until deciding we must read it. Now that the VM page is already  
pinned, there is no meaningful benefit to relying on a cached VM status.  
  
Removing this cached value simplifies the logic in both lazy_scan_heap()  
and lazy_scan_prune(). It also clarifies future work that will set the  
visibility map on-access: such paths will not have a cached value  
available, which would make the logic harder to reason about. And  
eliminating it enables us to detect and repair VM corruption on-access.  
  
Along with removing the cached value and unconditionally checking the  
visibility status of the heap page, this commit also moves the VM  
corruption handling to occur first. This reordering should have no  
performance impact, since the checks are inexpensive and performed only  
once per page. It does, however, make the control flow easier to  
understand. The new restructuring also makes it possible to set the VM  
after fixing corruption (if pruning found the page all-visible).  
  
Now that no callers of visibilitymap_set() use its return value, change  
its (and visibilitymap_set_vmbits()) return type to void.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/5CEAA162-67B1-44DA-B60D-8B65717E8B05%40gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/include/access/visibilitymap.h

Combine visibilitymap_set() cases in lazy_scan_prune()

commit   : 21796c267d0a6a9c4adbe74189581bf805cf9dc5    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 15:57:51 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Mon, 26 Jan 2026 15:57:51 -0500    

Click here for diff

lazy_scan_prune() previously had two separate cases that called  
visibilitymap_set() after pruning and freezing. These branches were  
nearly identical except that one attempted to avoid dirtying the heap  
buffer. However, that situation can never occur — the heap buffer cannot  
be clean at that point (and we would hit an assertion if it were).  
  
In lazy_scan_prune(), when we change a previously all-visible page to  
all-frozen and the page was recorded as all-visible in the visibility  
map by find_next_unskippable_block(), the heap buffer will always be  
dirty. Either we have just frozen a tuple and already dirtied the  
buffer, or the buffer was modified between find_next_unskippable_block()  
and heap_page_prune_and_freeze() and then pruned in  
heap_page_prune_and_freeze().  
  
Additionally, XLogRegisterBuffer() asserts that the buffer is dirty, so  
attempting to add a clean heap buffer to the WAL chain would assert out  
anyway.  
  
Since the “clean heap buffer with already set VM” case is impossible,  
the two visibilitymap_set() branches in lazy_scan_prune() can be merged.  
Doing so makes the intent clearer and emphasizes that the heap buffer  
must always be marked dirty before being added to the WAL chain.  
  
This commit also adds a test case for vacuuming when no heap  
modifications are required. Currently this ensures that the heap buffer  
is marked dirty before it is added to the WAL chain, but if we later  
remove the heap buffer from the VM-set WAL chain or pass it with the  
REGBUF_NO_CHANGES flag, this test would guard that behavior.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/5CEAA162-67B1-44DA-B60D-8B65717E8B05%40gmail.com  
Discussion: https://postgr.es/m/flat/CAAKRu_ZWx5gCbeCf7PWCv8p5%3D%3Db7EEws0VD2wksDxpXCvCyHvQ%40mail.gmail.com  

M contrib/pg_visibility/Makefile
M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
M src/backend/access/heap/vacuumlazy.c

Exercise parallel GIN builds in regression tests

commit   : f6e5d21bf73f9928b878e301805b8184c82e0463    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 18:54:12 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 18:54:12 +0100    

Click here for diff

Modify two places creating GIN indexes in regression tests, so that the  
build is parallel. This provides a basic test coverage, even if the  
amounts of data are fairly small.  
  
Reported-by: Kirill Reshke <reshkekirill@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/CALdSSPjUprTj+vYp1tRKWkcLYzdy=N=O4Cn4y_HoxNSqQwBttg@mail.gmail.com  

M src/test/regress/expected/jsonb.out
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/jsonb.sql
M src/test/regress/sql/tsearch.sql

Lookup the correct ordering for parallel GIN builds

commit   : db14dcdec69d560013b326ca3dea45b83a07ccd6    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 18:52:16 +0100    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 26 Jan 2026 18:52:16 +0100    

Click here for diff

When building a tuplesort during parallel GIN builds, the function  
incorrectly looked up the default B-Tree operator, not the function  
associated with the GIN opclass (through GIN_COMPARE_PROC).  
  
Fixed by using the same logic as initGinState(), and the other place  
in parallel GIN builds.  
  
This could cause two types of issues. First, a data type might not have  
a B-Tree opclass, in which case the PrepareSortSupportFromOrderingOp()  
fails with an ERROR. Second, a data type might have both B-Tree and GIN  
opclasses, defining order/equality in different ways. This could lead to  
logical corruption in the index.  
  
Backpatch to 18, where parallel GIN builds were introduced.  
  
Discussion: https://postgr.es/m/73a28b94-43d5-4f77-b26e-0d642f6de777@iki.fi  
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Backpatch-through: 18  

M src/backend/utils/sort/tuplesortvariants.c

Reduce length of TAP test file name.

commit   : 4cbaf4dcd23846f5122356f88305a64329554d21    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 26 Jan 2026 12:43:52 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 26 Jan 2026 12:43:52 -0500    

Click here for diff

Buildfarm member fairywren hit the Windows limitation on the length of a  
file path. While there may be other things we should also do to prevent  
this from happening, it's certainly the case that the length of this  
test file name is much longer than others in the same directory, so make  
it shorter.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: http://postgr.es/m/274e0a1a-d7d2-4bc8-8b56-dd09f285715e@gmail.com  
Backpatch-through: 17  

M src/bin/pg_combinebackup/meson.build
R100 src/bin/pg_combinebackup/t/011_incremental_backup_truncation_block.pl src/bin/pg_combinebackup/t/011_ib_truncation.pl

Fix accidentally cast away qualifiers

commit   : 5ca5f12c2c62090f747b5a7d1f5e4adf7f0d161e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jan 2026 16:02:31 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jan 2026 16:02:31 +0100    

Click here for diff

This fixes cases where a qualifier (const, in all cases here) was  
dropped by a cast, but the cast was otherwise necessary or desirable,  
so the straightforward fix is to add the qualifier into the cast.  
  
Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/b04f4d3a-5e70-4e73-9ef2-87f777ca4aac%40eisentraut.org  

M contrib/intarray/_int_selfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/access/common/toast_compression.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/transam/xloginsert.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_incremental.c
M src/backend/executor/nodeIndexscan.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_walsummary/pg_walsummary.c
M src/common/scram-common.c
M src/common/unicode/case_test.c
M src/common/unicode_case.c
M src/include/access/tupmacs.h
M src/include/common/hashfn_unstable.h
M src/include/utils/memutils.h
M src/include/varatt.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_popcount_aarch64.c
M src/test/isolation/isolationtester.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/test_tidstore/test_tidstore.c

doc: Clarify that \d and \d+ output lists are illustrative, not exhaustive.

commit   : 33a92632b78603271f76b446d23379d44ebc1450    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 26 Jan 2026 20:45:05 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 26 Jan 2026 20:45:05 +0900    

Click here for diff

The psql documentation for the \d and \d+ meta-commands lists objects  
that may be shown, but previously the wording could be read as exhaustive  
even though additional objects can also appear in the output.  
  
This commit clarifies the description by adding phrasing such as "for example"  
or "such as", making it clear that the listed objects are illustrative  
rather than a complete list. While the change is small, it helps avoid  
potential user confusion.  
  
As this is a documentation clarification rather than a bug fix,  
it is not backpatched.  
  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHut+Pt1DBtaUqfJftkkaQLJJJenYJBtb6Ec6s6vu82KEMh46A@mail.gmail.com  

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

Remove deduplication logic from find_window_functions

commit   : 7027dd499dd6a31528f9cb27ba872cec8e9b7bbd    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 26 Jan 2026 23:27:15 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 26 Jan 2026 23:27:15 +1300    

Click here for diff

This code thought it was optimizing WindowAgg evaluation by getting rid  
of duplicate WindowFuncs, but it turns out all it does today is lead to  
cost-underestimations and makes it possible that optimize_window_clauses  
could miss some of the WindowFuncs that must receive an updated winref.  
  
The deduplication likely was useful when it was first added, but since  
the projection code was changed in b8d7f053c, the list of WindowFuncs  
gathered by find_window_functions isn't used during execution.  Instead,  
the expression evaluation code will process the node's targetlist to find  
the WindowFuncs.  
  
The reason the deduplication could cause issues for  
optimize_window_clauses() is because if a WindowFunc is moved to another  
WindowClause, the winref is adjusted to reference the new WindowClause.  
If any duplicate WindowFuncs were discarded in find_window_functions()  
then the WindowFuncLists may not include all the WindowFuncs that need  
their winref adjusted.  This could lead to an error message such as:  
  
ERROR:  WindowFunc with winref 2 assigned to WindowAgg with winref 1  
  
The back-branches will receive a different fix so that the WindowAgg costs  
are not affected.  
  
Author: Meng Zhang <mza117jc@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAErYLFAuxmW0UVdgrz7iiuNrxGQnFK_OP9hBD5CUzRgjrVrz=Q@mail.gmail.com  

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

Disable extended alignment uses on older g++

commit   : 6ceef9408c26b6e188ec88c4303e9bad8ce33bff    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jan 2026 10:23:14 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Jan 2026 10:23:14 +0100    

Click here for diff

Fix for commit a9bdb63bba8.  The previous plan of redefining alignas  
didn't work, because it interfered with other C++ header files (e.g.,  
LLVM).  So now the new workaround is to just disable the affected  
typedefs under the affected compilers.  These are not typically used  
in extensions anyway.  
  
Discussion: https://www.postgresql.org/message-id/3119480.1769189606%40sss.pgh.pa.us  

M src/include/c.h

Add test for MAINTAIN permission with pg_restore_extended_stats()

commit   : d9abd9e1050db4c2fcdce6fcd8dc0ede6769db16    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 16:32:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 16:32:33 +0900    

Click here for diff

Like its cousin functions for the restore of relation and attribute  
stats, pg_restore_extended_stats() needs to be run by a user that is the  
database owner or has MAINTAIN privileges on the table whose stats are  
restored.  This commit adds a regression test ensuring that MAINTAIN is  
required when calling the function.  This test also checks that a  
ShareUpdateExclusive lock is taken on the table whose stats are  
restored.  
  
This has been split from the commit that has introduced  
pg_restore_extended_stats(), for clarity.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

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

Fix missing initialization in pg_restore_extended_stats()

commit   : 114e84c532d1493bbabcaf8ab79a3f1830e8bf9e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 16:13:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 16:13:41 +0900    

Click here for diff

The tuple data upserted into pg_statistic_ext_data was missing an  
initialization for the nulls flag of stxoid and stxdinherit.  This would  
cause an incorrect handling of the stats data restored.  
  
This issue has been spotted by CatalogTupleCheckConstraints(),  
translating to a NOT NULL constraint inconsistency, while playing more  
with the follow-up portions of the patch set.  
  
Oversight in 0e80f3f88dea (mea culpa).  Surprisingly, the buildfarm did  
not complain yet.  
  
Discussion: https://postgr.es/m/CADkLM=c7DY3Jv6ef0n_MGUJ1FyTMUoT697LbkST05nraVGNHYg@mail.gmail.com  

M src/backend/statistics/extended_stats_funcs.c

Add pg_restore_extended_stats()

commit   : 0e80f3f88deaefc03e5fd204190daab6f761e73d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 15:08:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 15:08:15 +0900    

Click here for diff

This function closely mirror its relation and attribute counterparts,  
but for extended statistics (i.e. CREATE STATISTICS) objects, being  
able to restore extended statistics for an extended stats object.  Like  
the other functions, the goal of this feature is to ease the dump or  
upgrade of clusters so as ANALYZE would not be required anymore after  
these operations, stats being directly loaded into the target cluster  
without any post-dump/upgrade computation.  
  
The caller of this function needs the following arguments for the  
extended stats to restore:  
- The name of the relation.  
- The schema name of the relation.  
- The name of the extended stats object.  
- The schema name of the extended stats object.  
- If the stats are inherited or not.  
- One or more extended stats kind with its data.  
  
This commit adds only support for the restore of the extended statistics  
kind "n_distinct", building the basic infrastructure for the restore  
of more extended statistics kinds in follow-up commits, including MVC  
and dependencies.  
  
The support for "n_distinct" is eased in this commit thanks to the  
previous work done particularly in commits 1f927cce4498 and  
44eba8f06e55, that have added the input function for the type  
pg_ndistinct, used as data type in input of this new restore function.  
  
Bump catalog version.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
M src/tools/pgindent/typedefs.list

Add test with multirange type for pg_restore_attribute_stats()

commit   : d4504d6f60e07516cd3b0311054e6f8e74496281    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 13:32:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 13:32:17 +0900    

Click here for diff

This commit adds a test for pg_restore_attribute_stats() with the  
injection of statistics related to a multirange type.  This case is  
supported in statatt_get_type() since its introduction in ce207d2a7901,  
but there was no test in the main regression test suite to check for the  
case where attribute stats is restored for a multirange type, as done by  
multirange_typanalyze().  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=c3JivzHNXLt-X_JicYknRYwLTiOCHOPiKagm2_vdrFUg@mail.gmail.com  

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

Remove PG_MMAP_FLAGS from mem.h

commit   : c100340729b66dc46d4f9d68a794957bf2c468d8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 10:52:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 10:52:02 +0900    

Click here for diff

Based on name of the macro, it was implied that it could be used for all  
mmap() calls on portability grounds.  However, its use is limited to  
sysv_shmem.c, for CreateAnonymousSegment().  This commit removes the  
declaration, reducing the confusion around it as a portability tweak,  
being limited to SysV-style shared memory.  
  
This macro has been introduced in b0fc0df9364d for sysv_shmem.c,  
originally.  It has been moved to mem.h in 0ac5e5a7e152 a bit later.  
  
Suggested by: Peter Eisentraut <peter@eisentraut.org>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://postgr.es/m/CAExHW5vTWABxuM5fbQcFkGuTLwaxuZDEE2vtx2WuMUWk6JnF4g@mail.gmail.com  
Discussion: https://postgr.es/m/12add41a-7625-4639-a394-a5563e349322@eisentraut.org  

M src/backend/port/sysv_shmem.c
M src/include/portability/mem.h

Always inline SeqNext and SeqRecheck

commit   : 83a53572a6fc9f83276d24d8c2747b3d5ce49440    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 26 Jan 2026 14:29:10 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 26 Jan 2026 14:29:10 +1300    

Click here for diff

The intention of the work done in fb9f95502 was that these functions are  
inlined.  I noticed my compiler isn't doing this on -O2 (gcc version  
15.2.0).  Also, clang version 20.1.8 isn't inlining either.  Fix by  
marking both of these functions as pg_attribute_always_inline to avoid  
leaving this up to the compiler's heuristics.  
  
A quick test with a Seq Scan on a table with a single int column running  
a query that filters all 1 million rows in the WHERE clause yields a  
3.9% speedup on my Zen4 machine.  
  
Author: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvrL7Q41B=gv+3wc8+AJGKZugGegUbBo8FPQ+3+NGTPb+w@mail.gmail.com  

M src/backend/executor/nodeSeqscan.c

Add more tests with clause STORAGE on table and TOAST interactions

commit   : 168765e5d42be7d3ef750e9e292e14ef94b489e1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 09:30:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Jan 2026 09:30:22 +0900    

Click here for diff

This commit adds more tests to cover STORAGE MAIN and EXTENDED, checking  
how these use TOAST tables.  EXTENDED is already widely tested as the  
default behavior, but there were no tests where the clause pattern is  
directly specified.  STORAGE MAIN and its interactions with TOAST was  
not covered at all.  
  
This hole in the tests has been noticed for STORAGE MAIN (inline  
compressible varlenas), where I have managed to break the backend  
without the tests able to notice the breakage while playing with the  
varlena structures.  
  
Reviewed-by: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>  
Discussion: https://postgr.es/m/aXMdX1UTHnzYPkHk@paquier.xyz  

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

Work around buggy alignas in older g++

commit   : a9bdb63bba8a631cd4797393307eecf5fcde9167    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 25 Jan 2026 11:16:58 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 25 Jan 2026 11:16:58 +0100    

Click here for diff

Older g++ (<9.3) mishandle the alignas specifier (raise warnings that  
the alignment is too large), but the more or less equivalent attribute  
works.  So as a workaround, #define alignas to that attribute for  
those versions.  
  
see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357>  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/3119480.1769189606%40sss.pgh.pa.us  

M src/include/c.h

pg_stat_statements: Fix test instability with cache-clobbering builds

commit   : 72e3abd082c3ae6db4081137a7431fdd05e55d73    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 25 Jan 2026 19:01:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 25 Jan 2026 19:01:23 +0900    

Click here for diff

Builds with CLOBBER_CACHE_ALWAYS enabled are failing the new test  
introduced in 1572ea96e657, checking the nesting level calculation in  
the planner hook.  The inner query of the function called twice is  
registered as normalized, as such builds would register a PGSS entry in  
the post-parse-analyse hook due to the cached plans requiring  
revalidation.  
  
A trick based on debug_discard_caches cannot work as far as I can, a  
normalized query still being registered.  This commit takes a different  
approach with the addition of a DISCARD PLANS before the first function  
call.  This forces the use of a normalized query in the PGSS entry for  
the inner query of the function with and without CLOBBER_CACHE_ALWAYS,  
which should be enough to stabilize the test.  Note that the test is  
still checking what it should: when removing the nesting level  
calculation in the planner hook of PGSS, one still gets a failure for  
the PGSS entry of the inner query in the function, with "toplevel" being  
flipped to true instead of false (it should be false, as a non-top-level  
entry).  
  
Per buildfarm members avocet and trilobite, at least.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/82dd02bb-4e0f-40ad-a60b-baa1763ff0bd@gmail.com  

M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/sql/level_tracking.sql

Fix trigger transition table capture for MERGE in CTE queries.

commit   : b4307ae2e540847f84147d45b258440eaf570536    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Sat, 24 Jan 2026 11:30:48 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Sat, 24 Jan 2026 11:30:48 +0000    

Click here for diff

When executing a data-modifying CTE query containing MERGE and some  
other DML operation on a table with statement-level AFTER triggers,  
the transition tables passed to the triggers would fail to include the  
rows affected by the MERGE.  
  
The reason is that, when initializing a ModifyTable node for MERGE,  
MakeTransitionCaptureState() would create a TransitionCaptureState  
structure with a single "tcs_private" field pointing to an  
AfterTriggersTableData structure with cmdType == CMD_MERGE. Tuples  
captured there would then not be included in the sets of tuples  
captured when executing INSERT/UPDATE/DELETE ModifyTable nodes in the  
same query.  
  
Since there are no MERGE triggers, we should only create  
AfterTriggersTableData structures for INSERT/UPDATE/DELETE. Individual  
MERGE actions should then use those, thereby sharing the same capture  
tuplestores as any other DML commands executed in the same query.  
  
This requires changing the TransitionCaptureState structure, replacing  
"tcs_private" with 3 separate pointers to AfterTriggersTableData  
structures, one for each of INSERT, UPDATE, and DELETE. Nominally,  
this is an ABI break to a public structure in commands/trigger.h.  
However, since this is a private field pointing to an opaque data  
structure, the only way to create a valid TransitionCaptureState is by  
calling MakeTransitionCaptureState(), and no extensions appear to be  
doing that anyway, so it seems safe for back-patching.  
  
Backpatch to v15, where MERGE was introduced.  
  
Bug: #19380  
Reported-by: Daniel Woelfel <dwwoelfel@gmail.com>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19380-4e293be2b4007248%40postgresql.org  
Backpatch-through: 15  

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

libpq_pipeline: Test the default protocol version

commit   : 9b9eaf08ab2dc22c691b22e59f1574e0f1bcc822    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 23 Jan 2026 12:59:03 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 23 Jan 2026 12:59:03 -0800    

Click here for diff

In preparation for a future change to libpq's default protocol version,  
pin today's default (3.0) in the libpq_pipeline tests.  
  
Patch by Jelte Fennema-Nio, with some additional refactoring of the  
PQconnectdbParams() logic by me.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl  

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

pqcomm.h: Explicitly reserve protocol v3.1

commit   : f7521bf721d169c4a91e765edb52cf4d05a39c16    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 23 Jan 2026 12:57:15 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 23 Jan 2026 12:57:15 -0800    

Click here for diff

Document this unused version alongside the other special protocol  
numbers.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAOYmi%2BkKyw%3Dh-5NKqqpc7HC5M30_QmzFx3kgq2AdipyNj47nUw%40mail.gmail.com  

M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-protocol3.c

Add missing #include.

commit   : 4ce105d9c4bd3d9ac7fb9c858894b778b7a7405c    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 23 Jan 2026 11:00:06 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 23 Jan 2026 11:00:06 -0600    

Click here for diff

Oversight in commit 8eef2df189.  Per buildfarm.  

M src/backend/port/sysv_shmem.c

Fix some rounding code for shared memory.

commit   : 8eef2df1898cc34dfaa69ff200f5112d7eeb7c67    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 23 Jan 2026 10:46:49 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 23 Jan 2026 10:46:49 -0600    

Click here for diff

InitializeShmemGUCs() always added 1 to the value calculated for  
shared_memory_size_in_huge_pages, which is unnecessary if the  
shared memory size is divisible by the huge page size.  
  
CreateAnonymousSegment() neglected to check for overflow when  
rounding up to a multiple of the huge page size.  
  
These are arguably bugs, but they seem extremely unlikely to be  
causing problems in practice, so no back-patch.  
  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAO6_Xqq2vZbva0R9eQSY0p2kfksX2aP4r%3D%2BZ_q1HBYNU%3Dm8bBg%40mail.gmail.com  

M src/backend/port/sysv_shmem.c
M src/backend/storage/ipc/ipci.c

Add WALRCV_CONNECTING state to the WAL receiver

commit   : a36164e7465fd1e10e94569e9c1c07656e38a9de    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 23 Jan 2026 14:17:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 23 Jan 2026 14:17:28 +0900    

Click here for diff

Previously, a WAL receiver freshly started would set its state to  
WALRCV_STREAMING immediately at startup, before actually establishing a  
replication connection.  
  
This commit introduces a new state called WALRCV_CONNECTING, which is  
the state used when the WAL receiver freshly starts, or when a restart  
is requested, with a switch to WALRCV_STREAMING once the connection to  
the upstream server has been established with COPY_BOTH, meaning that  
the WAL receiver is ready to stream changes.  This change is useful for  
monitoring purposes, especially in environments with a high latency  
where a connection could take some time to be established, giving some  
room between the [re]start phase and the streaming activity.  
  
From the point of view of the startup process, that flips the shared  
memory state of the WAL receiver when it needs to be stopped, the  
existing WALRCV_STREAMING and the new WALRCV_CONNECTING states have the  
same semantics: the WAL receiver has started and it can be stopped.  
  
Based on an initial suggestion from Noah Misch, with some input from me  
about the design.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7VQ5tGOSG5TS-Cg+Fb8gLCGFzxJ_eX4qg+WZ3ZPt=FtwQ@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/include/replication/walreceiver.h

Fix bogus ctid requirement for dummy-root partitioned targets

commit   : f9a468c664a4605e3080383ffaa302057d56feb1    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 23 Jan 2026 10:17:43 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 23 Jan 2026 10:17:43 +0900    

Click here for diff

ExecInitModifyTable() unconditionally required a ctid junk column even  
when the target was a partitioned table. This led to spurious "could  
not find junk ctid column" errors when all children were excluded and  
only the dummy root result relation remained.  
  
A partitioned table only appears in the result relations list when all  
leaf partitions have been pruned, leaving the dummy root as the sole  
entry. Assert this invariant (nrels == 1) and skip the ctid requirement.  
Also adjust ExecModifyTable() to tolerate invalid ri_RowIdAttNo for  
partitioned tables, which is safe since no rows will be processed in  
this case.  
  
Bug: #19099  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19099-e05dcfa022fe553d%40postgresql.org  
Backpatch-through: 14  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M src/backend/executor/nodeModifyTable.c

Remove faulty Assert in partitioned INSERT...ON CONFLICT DO UPDATE.

commit   : 4b760a181ab220f425a6fe8e08335891b0ba62d4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 22 Jan 2026 18:35:31 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 22 Jan 2026 18:35:31 -0500    

Click here for diff

Commit f16241bef mistakenly supposed that INSERT...ON CONFLICT DO  
UPDATE rejects partitioned target tables.  (This may have been  
accurate when the patch was written, but it was already obsolete  
when committed.)  Hence, there's an assertion that we can't see  
ItemPointerIndicatesMovedPartitions() in that path, but the assertion  
is triggerable.  
  
Some other places throw error if they see a moved-across-partitions  
tuple, but there seems no need for that here, because if we just retry  
then we get the same behavior as in the update-within-partition case,  
as demonstrated by the new isolation test.  So fix by deleting the  
faulty Assert.  (The fact that this is the fix doubtless explains  
why we've heard no field complaints: the behavior of a non-assert  
build is fine.)  
  
The TM_Deleted case contains a cargo-culted copy of the same Assert,  
which I also deleted to avoid confusion, although I believe that one  
is actually not triggerable.  
  
Per our code coverage report, neither the TM_Updated nor the  
TM_Deleted case were reached at all by existing tests, so this  
patch adds tests for both.  
  
Reported-by: Dmitry Koval <d.koval@postgrespro.ru>  
Author: Joseph Koshakow <koshy44@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/f5fffe4b-11b2-4557-a864-3587ff9b4c36@postgrespro.ru  
Backpatch-through: 14  

M src/backend/executor/nodeModifyTable.c
A src/test/isolation/expected/insert-conflict-do-update-4.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-update-4.spec

Make some use of anonymous unions [reloptions]

commit   : 69f98fce5bfb82260c66bdae88b6293146cf79ec    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 22 Jan 2026 17:04:59 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 22 Jan 2026 17:04:59 +0100    

Click here for diff

In the spirit of commit 4b7e6c73b0df and following, which see for more  
details; it appears to have been quite an uncontroversial C11 feature to  
use and it makes the code nicer to read.  
  
This commit changes the relopt_value struct.  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Note: Yes, this was written twice independently.  
Discussion: https://postgr.es/m/202601192106.zcdi3yu2gzti@alvherre.pgsql  

M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h

Record range constructor functions in pg_range

commit   : c257ba83971892723c5c89955ab0dd1ef7c077d8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 15:17:12 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 15:17:12 +0100    

Click here for diff

When a range type is created, several construction functions are also  
created, two for the range type and three for the multirange type.  
These have an internal dependency, so they "belong" to the range type.  
But there was no way to identify those functions when given a range  
type.  An upcoming patch needs access to the two- or possibly the  
three-argument range constructor function for a given range type.  The  
only way to do that would be with fragile workarounds like matching  
names and argument types.  The correct way to do that kind of thing is  
to record to the links in the system catalogs.  This is what this  
patch does, it records the OIDs of these five constructor functions in  
the pg_range catalog.  (Currently, there is no code that makes use of  
this.)  
  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/7d63ddfa-c735-4dfe-8c7a-4f1e2a621058%40eisentraut.org  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_range.c
M src/backend/commands/typecmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql

Mark commented out code as unused

commit   : a5b40d156edaafa4fe93cdae96592f26bc865bd3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 12:41:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 12:41:52 +0100    

Click here for diff

There were many PG_GETARG_* calls, mostly around gin, gist, spgist  
code, that were commented out, presumably to indicate that the  
argument was unused and to indicate that it wasn't forgotten or  
miscounted.  But keeping commented-out code updated with refactorings  
and style changes is annoying.  So this commit changes them to  
  
    #ifdef NOT_USED  
  
blocks, which is a style already in use.  That way, at least the  
indentation and syntax highlighting works correctly, making some of  
these blocks much easier to read.  
  
An alternative would be to just delete that code, but there is some  
value in making unused arguments explicit, and some of this arguably  
serves as example code for index AM APIs.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/328e4371-9a4c-4196-9df9-1f23afc900df%40eisentraut.org  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_bool.c
M contrib/btree_gist/btree_bytea.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_text.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree_gist.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/seg/seg.c
M doc/src/sgml/gist.sgml
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gist/gistproc.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/varlena.c
M src/test/modules/spgist_name_ops/spgist_name_ops.c

Remove incorrect commented out code

commit   : 846fb3c7901146a5450c08aeadf50566d5d65d09    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 12:41:40 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 12:41:40 +0100    

Click here for diff

These calls, if activated, are happening before null checks, so they  
are not correct.  Also, the "in" variable is shadowed later.  Remove  
them to avoid confusion and bad examples.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: David Geier <geidav.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/328e4371-9a4c-4196-9df9-1f23afc900df%40eisentraut.org  

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

Remove redundant AssertVariableIsOfType uses

commit   : f3c96c9dff0c727afd1ef2ea976592c77cc809b5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 09:19:13 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 09:19:13 +0100    

Click here for diff

The uses of AssertVariableIsOfType in pg_upgrade are unnecessary  
because the calls to upgrade_task_add_step() already check the  
compatibility of the callback functions.  
  
These were apparently copied from a previous coding style, but similar  
removals were already done in commit 30b789eafe.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/3d289481-7f76-409f-81c7-81824219cc75%40eisentraut.org  

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

Detect if flags are needed for C++11 support

commit   : ae4fe737aea36eb3a20e567c75cd70a82d1af230    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 08:39:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 22 Jan 2026 08:39:39 +0100    

Click here for diff

Just like we only support compiling with C11, we only support  
compiling extensions with C++11 and up.  Some compilers support C++11  
but don't enable it by default.  This detects if flags are needed to  
enable C++11 support, in a similar way to how we check the same for  
C11 support.  
  
The C++ test extension module added by commit 476b35d4e31 confirmed  
that C++11 is effectively required.  (This was understood in mailing  
list discussions but not recorded anywhere in the source code.)  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/flat/E1viDt1-001d7E-2I%40gemulon.postgresql.org  

M configure
M configure.ac
M meson.build

doc: List all the possible values of pg_stat_wal_receiver.status

commit   : 1a1e733b623108ebba8a6e6f55235782edb8f4bb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Jan 2026 17:03:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Jan 2026 17:03:21 +0900    

Click here for diff

The possible values of pg_stat_wal_receiver.status have never been  
documented.  Note that the status "stopped" will never show up in this  
view, hence there is no need to document it.  
  
Issue noticed while discussing a patch that aims to add a new status to  
WAL receiver.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/CABPTF7X_Jgmyk1FBVNf3tyAOKqU55LLpLMzWkGtEAb_jQWVN=g@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

doc: Mention pg_get_partition_constraintdef()

commit   : 25be5e8a33233c59230b9633c14260faa4fbdeed    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Jan 2026 16:35:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Jan 2026 16:35:36 +0900    

Click here for diff

All the other SQL functions reconstructing definitions or commands are  
listed in the documentation, except this one.  
  
Oversight in 1848b73d4576.  
  
Author: Todd Liebenschutz-Jones <todd.liebenschutz-jones@starlingbank.com>  
Discussion: https://postgr.es/m/CAGTRfaD6uRQ9iutASDzc_iDoS25sQTLWgXTtR3ta63uwTxq6bA@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/func/func-info.sgml

jit: Add missing inline pass for LLVM >= 17.

commit   : e5d99b4d9ef4b92fb74f05bf783e06766bb661ee    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 22 Jan 2026 15:43:13 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 22 Jan 2026 15:43:13 +1300    

Click here for diff

With LLVM >= 17, transform passes are provided as a string to  
LLVMRunPasses. Only two strings were used: "default<O3>" and  
"default<O0>,mem2reg".  
  
With previous LLVM versions, an additional inline pass was added when  
JIT inlining was enabled without optimization. With LLVM >= 17, the code  
would go through llvm_inline, prepare the functions for inlining, but  
the generated bitcode would be the same due to the missing inline pass.  
  
This patch restores the previous behavior by adding an inline pass when  
inlining is enabled but no optimization is done.  
  
This fixes an oversight introduced by 76200e5e when support for LLVM 17  
was added.  
  
Backpatch-through: 14  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Pierre Ducroquet <p.psql@pinaraf.info>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAO6_XqrNjJnbn15ctPv7o4yEAT9fWa-dK15RSyun6QNw9YDtKg%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c

file_fdw: Support multi-line HEADER option.

commit   : 26cb14aea12a0f0c2f9a49de3865721936b711a7    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Jan 2026 10:14:12 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Jan 2026 10:14:12 +0900    

Click here for diff

Commit bc2f348 introduced multi-line HEADER support for COPY. This commit  
extends this capability to file_fdw, allowing multiple header lines to be  
skipped.  
  
Because CREATE/ALTER FOREIGN TABLE requires option values to be single-quoted,  
this commit also updates defGetCopyHeaderOption() to accept integer values  
specified as strings for HEADER option.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: songjinzhou <tsinghualucky912@foxmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurT+iwC47VHPMS+uJ4WSzvOLPsZ2F2_wopm8M7O+CZa3Xw@mail.gmail.com  

A contrib/file_fdw/data/multiline_header.csv
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/file-fdw.sgml
M src/backend/commands/copy.c
M src/test/regress/expected/copy.out
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy.sql
M src/test/regress/sql/copy2.sql

Improve the error message in COPY with HEADER option.

commit   : f3da70a805f9a9dd2deada728649b2cfbeae9cb3    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Jan 2026 10:13:07 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Jan 2026 10:13:07 +0900    

Click here for diff

The error message reported for invalid values of the HEADER option in COPY  
command previously used the term "non-negative integer", which is  
discouraged by the Error Message Style Guide because it is ambiguous about  
whether zero is allowed.  
  
This commit improves the error message by replacing "non-negative integer"  
there with "an integer value greater than or equal to zero" to make  
the accepted values explicit.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Steven Niu <niushiji@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwE86PcuPZbP=aurmW7Oo=eycF10gxjErWq4NmY-5TTX4Q@mail.gmail.com  

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

Refactor some SIMD and popcount macros.

commit   : 25dc4850747bb12e871af3589736463edd1d2aa6    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    

Click here for diff

This commit does the following:  
  
* Removes TRY_POPCNT_X86_64.  We now assume that the required CPUID  
intrinsics are available when HAVE_X86_64_POPCNTQ is defined, as we  
have done since v16 for meson builds when  
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK is defined and since v17 when  
USE_AVX512_POPCNT_WITH_RUNTIME_CHECK is defined.  
  
* Moves the MSVC check for HAVE_X86_64_POPCNTQ to configure-time.  
This way, we set it for all relevant platforms in one place.  
  
* Moves the #defines for USE_SSE2 and USE_NEON to c.h so that they  
can be used elsewhere without including simd.h.  Consequently, we  
can remove the POPCNT_AARCH64 macro.  
  
* Moves the #includes for pg_bitutils.h to below the system headers  
in pg_popcount_{aarch64,x86}.c, since we no longer depend on macros  
from pg_bitutils.h to decide which system headers to use.  
  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan  

M meson.build
M src/include/c.h
M src/include/port/pg_bitutils.h
M src/include/port/simd.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c

Rename "fast" and "slow" popcount functions.

commit   : 8c6653516c5ad23628cc50d4cee1e6446e7f758d    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    

Click here for diff

Since we now have several implementations of the popcount  
functions, let's give them more descriptive names.  This commit  
replaces "slow" with "portable" and "fast" with "sse42".  While the  
POPCNT instruction is technically not part of SSE4.2, this naming  
scheme is close enough in practice and is arguably easier to  
understand than using "popcnt" instead.  
  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan  

M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c

Move x86-64-specific popcount code to pg_popcount_x86.c.

commit   : 79e232ca013c7f357704f8af9782fe72466c216e    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    

Click here for diff

This moves the remaining x86-64-specific popcount implementations  
in pg_bitutils.c to pg_popcount_x86.c.  
  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan  

M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c

Rename pg_popcount_avx512.c to pg_popcount_x86.c.

commit   : fbe327e5b465dff0fe5ce66ceff08ab9de9ef758    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 21 Jan 2026 14:21:00 -0600    

Click here for diff

This is preparatory work for a follow-up commit that will move the  
rest of the x86-64-specific popcount code to this file.  
  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan  

M src/port/Makefile
M src/port/meson.build
R098 src/port/pg_popcount_avx512.c src/port/pg_popcount_x86.c

Force standard_conforming_strings to always be ON.

commit   : 45762084545ec14dbbe66ace1d69d7e89f8978ac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jan 2026 15:08:38 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jan 2026 15:08:38 -0500    

Click here for diff

Continuing to support this backwards-compatibility feature has  
nontrivial costs; in particular it is potentially a security hazard  
if an application somehow gets confused about which setting the  
server is using.  We changed the default to ON fifteen years ago,  
which seems like enough time for applications to have adapted.  
Let's remove support for the legacy string syntax.  
  
We should not remove the GUC altogether, since client-side code will  
still test it, pg_dump scripts will attempt to set it to ON, etc.  
Instead, just prevent it from being set to OFF.  There is precedent  
for this approach (see commit de66987ad).  
  
This patch does remove the related GUC escape_string_warning, however.  
That setting does nothing when standard_conforming_strings is on,  
so it's now useless.  We could leave it in place as a do-nothing  
setting to avoid breaking clients that still set it, if there are any.  
But it seems likely that any such client is also trying to turn off  
standard_conforming_strings, so it'll need work anyway.  
  
The client-side changes in this patch are pretty minimal, because even  
though we are dropping the server's support, most of our clients still  
need to be able to talk to older server versions.  We could remove  
dead client code only once we disclaim compatibility with pre-v19  
servers, which is surely years away.  One change of note is that  
pg_dump/pg_dumpall now set standard_conforming_strings = on in their  
source session, rather than accepting the source server's default.  
This ensures that literals in view definitions and such will be  
printed in a way that's acceptable to v19+.  In particular,  
pg_upgrade will work transparently even if the source installation has  
standard_conforming_strings = off.  (However, pg_restore will behave  
the same as before if given an archive file containing  
standard_conforming_strings = off.  Such an archive will not be safely  
restorable into v19+, but we shouldn't break the ability to extract  
valid data from it for use with an older server.)  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us  

M contrib/hstore/expected/hstore.out
M contrib/hstore/sql/hstore.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func/func-matching.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/syntax.sgml
M src/backend/commands/variable.c
M src/backend/parser/scan.l
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc_parameters.dat
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_dump/pg_dumpall.c
M src/fe_utils/string_utils.c
M src/include/parser/parser.h
M src/include/parser/scanner.h
M src/include/utils/guc_hooks.h
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-quote.stderr
M src/interfaces/ecpg/test/expected/sql-quote.stdout
M src/interfaces/ecpg/test/expected/sql-show.c
M src/interfaces/ecpg/test/expected/sql-show.stderr
M src/interfaces/ecpg/test/expected/sql-show.stdout
M src/interfaces/ecpg/test/sql/quote.pgc
M src/interfaces/ecpg/test/sql/show.pgc
M src/test/examples/testlibpq3.c
M src/test/examples/testlibpq3.sql
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/expected/test_regex_utf8.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/modules/test_regex/sql/test_regex_utf8.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/regex.out
M src/test/regress/expected/strings.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/regex.sql
M src/test/regress/sql/strings.sql
M src/tutorial/syscat.source

Allow Boolean reloptions to have ternary values

commit   : 4d6a66f675815a5d40a650d4dcfb5ddb89c6ad2f    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 21 Jan 2026 20:06:01 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 21 Jan 2026 20:06:01 +0100    

Click here for diff

From the user's point of view these are just Boolean values; from the  
implementation side we can now distinguish an option that hasn't been  
set.  Reimplement the vacuum_truncate reloption using this type.  
  
This could also be used for reloptions vacuum_index_cleanup and  
buffering, but those additionally need a per-option "alias" for the  
state where the variable is unset (currently the value "auto").  
  
Author: Nikolay Shaplov <dhyan@nataraj.su>  
Reviewed-by: Timur Magomedov <t.magomedov@postgrespro.ru>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/3474141.usfYGdeWWP@thinkpad-pgpro  

M src/backend/access/common/reloptions.c
M src/backend/commands/vacuum.c
M src/include/access/reloptions.h
M src/include/postgres.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/README
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/expected/reloptions.out
M src/test/modules/dummy_index_am/sql/reloptions.sql
M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql
M src/tools/pgindent/typedefs.list

Remove useless flag PVC_INCLUDE_CONVERTROWTYPES.

commit   : cec5fe0d1e192b3b0005063011f113ac99f6908c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jan 2026 13:26:19 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 21 Jan 2026 13:26:19 -0500    

Click here for diff

This was introduced in the SJE patch (fc069a3a6), but it doesn't  
do anything because pull_var_clause() never tests it.  Apparently  
it snuck in from somebody's private fork.  Remove it again, but  
only in HEAD -- seems best to let it be in v18.  
  
Author: Alexander Pyhalov <a.pyhalov@postgrespro.ru>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/70008c19d22e3dd1565ca57f8436c0ba@postgrespro.ru  

M src/backend/optimizer/path/equivclass.c
M src/include/optimizer/optimizer.h

amcheck: Fix snapshot usage in bt_index_parent_check

commit   : 1f28982e409451249646910e585469076c43ba8f    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 21 Jan 2026 18:55:43 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 21 Jan 2026 18:55:43 +0100    

Click here for diff

We were using SnapshotAny to do some index checks, but that's wrong and  
causes spurious errors when used on indexes created by CREATE INDEX  
CONCURRENTLY.  Fix it to use an MVCC snapshot, and add a test for it.  
  
Backpatch of 6bd469d26aca to branches 14-16.  I previously misidentified  
the bug's origin: it came in with commit 7f563c09f890 (pg11-era, not  
5ae2087202af as claimed previously), so all live branches are affected.  
  
Also take the opportunity to fix some comments that we failed to update  
in the original commits and apply pgperltidy.  In branch 14, remove the  
unnecessary test plan specification (which would have need to have been  
changed anyway; c.f. commit 549ec201d613.)  
  
Diagnosed-by: Donghang Lin <donghanglin@gmail.com>  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Backpatch-through: 17  
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com  

M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/verify_nbtree.c

Remove more leftovers of AIX support

commit   : e6bb491bf2aa96e4cfb879641bd765b5f6312c3c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jan 2026 14:45:20 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jan 2026 14:45:20 +0100    

Click here for diff

The make variables MKLDEXPORT and POSTGRES_IMP were only used for AIX,  
so they should have been removed with commit 0b16bb8776b.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/7a48b624-2236-4e11-9b9d-6a3c658d77a1%40eisentraut.org  

M src/backend/Makefile

pg_stat_statements: Add more tests for level tracking

commit   : 1572ea96e65731eee3227fbc3c119bd9f39e8e50    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 18:18:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 18:18:15 +0900    

Click here for diff

This commit adds tests to verify the computation of the nesting level  
for two code paths: the planner hook and the ExecutorFinish() hook.  The  
nesting level is essential to save a correct "toplevel" status for the  
added PGSS entries.  
  
The author has noticed that removing the manipulations of nesting_level  
in these two code paths did not cause the tests to complain, meaning  
that we never had coverage for the assumptions taken by the code.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0uK1PSrgf52bWCtDpzaqbWt04o6ZA7zBm6UQyv7vyvf9w@mail.gmail.com  

M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/sql/level_tracking.sql

Fix for C++ compatibility

commit   : b4555cb070f134c04328df54ce31d4ef1970f3bb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jan 2026 08:32:45 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Jan 2026 08:32:45 +0100    

Click here for diff

After commit 476b35d4e31, some buildfarm members are complaining about  
not recognizing _Noreturn when building the new C++ module  
test_cplusplusext.  This is not a C++ feature, but it was gated like  
  
    #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L  
    #define pg_noreturn _Noreturn  
  
But apparently that was not sufficient.  Some platforms define  
__STDC_VERSION__ even in C++ mode.  (In this particular case, it was  
g++ on Solaris, but apparently this is also done by some other  
platforms, and it is allowed by the C++ standard.)  To fix, add a  
  
    ... && !defined(__cplusplus)  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M src/include/c.h

Update some comments for fasthash

commit   : 7892e25924719097d96940d38e3aec862adc9e59    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 21 Jan 2026 14:11:40 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 21 Jan 2026 14:11:40 +0700    

Click here for diff

- Add advice about hashing multiple inputs with the incremental API  
- Generalize statements that were specific to C strings to include  
  all variable length inputs, where applicable.  
- Update comments about the standalone functions and make it easy to  
  find them.  
  
Reported-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/CANWCAZZgKnf8dNOd_w03n88NqOfmMnMv2=D8_Oy6ADGyiMq+cg@mail.gmail.com  
Discussion: https://postgr.es/m/CANWCAZa-2mEUY27xBw2TpsybpvVu3Ez4ABrHCBqZpAs_UDTj2Q@mail.gmail.com  

M src/include/common/hashfn_unstable.h

Improve errdetail for logical replication conflict messages.

commit   : 48efefa6caacba49ca5b7b84e20c900776e56c50    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Jan 2026 04:58:03 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Jan 2026 04:58:03 +0000    

Click here for diff

This change enhances the clarity and usefulness of error detail messages  
generated during logical replication conflicts. The following improvements  
have been made:  
  
1. Eliminate redundant output: Avoid printing duplicate remote row and  
replica identity values for the multiple_unique_conflicts conflict type.  
2. Improve message structure: Append tuple values directly to the main  
error message, separated by a colon (:), for better readability.  
3. Simplify local row terminology: Remove the word 'existing' when  
referring to the local row, as this is already implied by context.  
4. General code refinements: Apply miscellaneous code cleanups to improve  
how conflict detail messages are constructed and formatted.  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Discussion: https://postgr.es/m/CAHut+Psgkwy5-yGRJC15izecySGGysrbCszv_z93ess8XtCDOQ@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/replication/logical/conflict.c
M src/include/replication/conflict.h
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/035_conflicts.pl

pg_stat_statements: Clean up REGRESS list in Makefile

commit   : 905ef401d5e068a1e6d246f9d96435c9d750c8be    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 11:29:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 11:29:34 +0900    

Click here for diff

The "wal" and "entry_timestamp" items were still on the same line, which  
was not intentional.  
  
Thinko in f9afd56218af.  
  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/aW6_Xc8auuu5iAPi@paquier.xyz  

M contrib/pg_stat_statements/Makefile

pg_stat_statements: Rework test order

commit   : f9afd56218af0d704c12540a1b5e893d196f6aa7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 07:47:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Jan 2026 07:47:38 +0900    

Click here for diff

The test "squashing" was the last item of the REGRESS list, but  
"cleanup" should be the second to last, dropping the extension.  
"oldextversions" is the last item.  
  
In passing, the REGRESS list is cleaned up to include one item per line,  
so as diffs are minimized when adding new test files.  
  
Noticed while playing with this area of the code.  
  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/aW6_Xc8auuu5iAPi@paquier.xyz  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/squashing.out
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/sql/squashing.sql

tests: Add a test C++ extension module

commit   : 476b35d4e311a3d77a550280d93393e518908b27    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 20 Jan 2026 16:24:57 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 20 Jan 2026 16:24:57 +0100    

Click here for diff

While we already test that our headers are valid C++ using  
headerscheck, it turns out that the macros we define might still  
expand to invalid C++ code.  This adds a minimal test extension that  
is compiled using C++ to test that it's actually possible to build and  
run extensions written in C++.  Future commits will improve C++  
compatibility of some of our macros and add usage of them to this  
extension make sure that they don't regress in the future.  
  
The test module is for the moment disabled when using MSVC.  In  
particular, the use of designated initializers in PG_MODULE_MAGIC  
would require C++20, for which we are currently not set up.  (GCC and  
Clang support it as extensions.)  It is planned to fix this.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com  

M configure
M configure.ac
M src/Makefile.global.in
M src/makefiles/meson.build
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_cplusplusext/.gitignore
A src/test/modules/test_cplusplusext/Makefile
A src/test/modules/test_cplusplusext/README
A src/test/modules/test_cplusplusext/expected/test_cplusplusext.out
A src/test/modules/test_cplusplusext/meson.build
A src/test/modules/test_cplusplusext/sql/test_cplusplusext.sql
A src/test/modules/test_cplusplusext/test_cplusplusext–1.0.sql
A src/test/modules/test_cplusplusext/test_cplusplusext.control
A src/test/modules/test_cplusplusext/test_cplusplusext.cpp

Use integer backend type when exec'ing a postmaster child

commit   : f1cd34f95272fe62aa9378f9164431399e94a135    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 20 Jan 2026 16:41:04 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 20 Jan 2026 16:41:04 +0100    

Click here for diff

This way we don't have to walk the entire process type array and  
strcmp() the string with the names therein.  The integer value can be  
directly used as array index instead.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Discussion: https://postgr.es/m/202512090935.k3xrtr44hxkn@alvherre.pgsql  

M src/backend/postmaster/launch_backend.c

Remove redundant pg_unreachable() after elog(ERROR) from ExecWaitStmt()

commit   : 30776ca46865f9e04ff6eb5cfdd64eb8bf5c4ff1    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 20 Jan 2026 16:10:25 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 20 Jan 2026 16:10:25 +0200    

Click here for diff

elog(ERROR) never returns.  Compilers don't always understand this.  So,  
sometimes, we have to append pg_unreachable() to keep the compiler quiet  
about returning from a non-void function without a value.  But  
pg_unreachable() is redundant for ExecWaitStmt(), which is void.  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Discussion: https://postgr.es/m/8d72a2b3-7423-4a15-a981-e130bf60b1a6%40eisentraut.org  
Discussion: https://postgr.es/m/CABPTF7UcuVD0L-X%3DjZFfeygjPaZWWkVRwtWOaJw2tcXbEN2xsA%40mail.gmail.com  

M src/backend/commands/wait.c

Fix concurrent sequence drops during sequence synchronization.

commit   : 1ba3eee89a7534a895187f6484f2f5e04f9c3c62    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 20 Jan 2026 09:40:13 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 20 Jan 2026 09:40:13 +0000    

Click here for diff

A recent BF failure showed that commit 7a485bd641 did not handle the case  
where a sequence is dropped concurrently during sequence synchronization  
on the subscriber. Previously, pg_get_sequence_data() would ERROR out if  
the sequence was dropped concurrently. After 7a485bd641, it instead  
returns NULL, which leads to an assertion failure on the subscriber.  
  
To handle this change, update sequence synchronization to skip sequences  
for which pg_get_sequence_data() returns NULL.  
  
Author: vignesh C <vignesh21@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm0FoGdt+1mzua0t-=wYdup5_zmFrvfNf-L=MGBnj9HAcg@mail.gmail.com  

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

Add routine to free MCVList

commit   : 7ebb64c557570647e3fcf6f5f1549e882ed26489    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jan 2026 13:13:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jan 2026 13:13:47 +0900    

Click here for diff

This addition is in the same spirit as 32e27bd32082 for MVNDistinct and  
MVDependencies, except that we were missing a free routine for the third  
type of extended statistics, MCVList.  I was not sure if we needed an  
equivalent for MCVList, but after more review of the main patch set for  
the import of extended statistics, it has become clear that we do.  
  
This is introduced as its own change as this routine can be useful on  
its own.  This one is a piece that has not been written by Corey  
Huinker, I have just noticed it by myself on the way.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h

doc: revert "xreflabel" used for PL/Python & libpq chapters

commit   : 2e937eeb93af7539f2d65abc170d1c0369d46f12    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 19 Jan 2026 22:59:10 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 19 Jan 2026 22:59:10 -0500    

Click here for diff

This reverts d8aa21b74ff, which was added for the PG 18 release notes,  
and adjusts the PG 18 release notes for this change.  This is necessary  
since the "xreflabel" affected other references to these chapters.  
  
Reported-by: Robert Treat  
  
Author: Robert Treat  
  
Discussion: https://postgr.es/m/CABV9wwNEZDdp5QtrW5ut0H+MOf6U1PvrqBqmgSTgcixqk+Q73A@mail.gmail.com  
  
Backpatch-through: 18  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/plpython.sgml

pg_stat_statements: Fix crash in list squashing with Vars

commit   : 5d95219faa1a95b78202be9e25bdb2aeb30cb4dc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jan 2026 08:11:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Jan 2026 08:11:12 +0900    

Click here for diff

When IN/ANY clauses contain both constants and variable expressions, the  
optimizer transforms them into separate structures: constants become  
an array expression while variables become individual OR conditions.  
  
This transformation was creating an overlap with the token locations,  
causing pg_stat_statements query normalization to crash because it  
could not calculate the amount of bytes remaining to write for the  
normalized query.  
  
This commit disables squashing for mixed IN list expressions when  
constructing a scalar array op, by setting list_start and list_end  
to -1 when both variables and non-variables are present.  Some  
regression tests are added to PGSS to verify these patterns.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0ts9qiONnHjjHxPxtePs22GBo4d3jZ_s2BQC59AN7XbAA@mail.gmail.com  
Backpatch-through: 18  

M contrib/pg_stat_statements/expected/squashing.out
M contrib/pg_stat_statements/sql/squashing.sql
M src/backend/parser/parse_expr.c

Don't set the truncation block length greater than RELSEG_SIZE.

commit   : ecd275718be0908c8f5af871d28052e7e71c729e    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Jan 2026 12:02:08 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Jan 2026 12:02:08 -0500    

Click here for diff

When faced with a relation containing more than 1 physical segment  
(i.e. >1GB, with normal settings), the previous code could compute a  
truncation block length greater than RELSEG_SIZE, which could lead to  
restore failures of this form:  
  
file "%s" has truncation block length %u in excess of segment size %u  
  
The fix is simply to clamp the maximum computed truncation_block_length  
to RELSEG_SiZE. I have also added some comments to clarify the logic.  
  
The test case was written by Oleg Tkachenko, but I have rewritten its  
comments.  
  
Reported-by: Oleg Tkachenko <oatkachenko@gmail.com>  
Diagnosed-by: Oleg Tkachenko <oatkachenko@gmail.com>  
Co-authored-by: Robert Haas <rhaas@postgresql.org>  
Co-authored-by: Oleg Tkachenko <oatkachenko@gmail.com>  
Reviewed-by: Amul Sul <sulamul@gmail.com>  
Backpatch-through: 17  
Discussion: http://postgr.es/m/00FEFC88-EA1D-4271-B38F-EB741733A84A@gmail.com  

M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/meson.build
A src/bin/pg_combinebackup/t/011_incremental_backup_truncation_block.pl

Fix unsafe pushdown of quals referencing grouping Vars

commit   : 34740b90bc123d645a3a71231b765b778bdcf049    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 19 Jan 2026 11:13:23 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 19 Jan 2026 11:13:23 +0900    

Click here for diff

When checking a subquery's output expressions to see if it's safe to  
push down an upper-level qual, check_output_expressions() previously  
treated grouping Vars as opaque Vars.  This implicitly assumed they  
were stable and scalar.  
  
However, a grouping Var's underlying expression corresponds to the  
grouping clause, which may be volatile or set-returning.  If an  
upper-level qual references such an output column, pushing it down  
into the subquery is unsafe.  This can cause strange results due to  
multiple evaluation of a volatile function, or introduce SRFs into  
the subquery's WHERE/HAVING quals.  
  
This patch teaches check_output_expressions() to look through grouping  
Vars to their underlying expressions.  This ensures that any  
volatility or set-returning properties in the grouping clause are  
detected, preventing the unsafe pushdown.  
  
We do not need to recursively examine the Vars contained in these  
underlying expressions.  Even if they reference outputs from  
lower-level subqueries (at any depth), those references are guaranteed  
not to expand to volatile or set-returning functions, because  
subqueries containing such functions in their targetlists are never  
pulled up.  
  
Backpatch to v18, where this issue was introduced.  
  
Reported-by: Eric Ridge <eebbrr@gmail.com>  
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com  
Backpatch-through: 18  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/var.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

Update time zone data files to tzdata release 2025c.

commit   : 228fe0c3e68ef37b7e083fcb513664b9737c4d93    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 18 Jan 2026 14:54:33 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 18 Jan 2026 14:54:33 -0500    

Click here for diff

This is pretty pro-forma for our purposes, as the only change  
is a historical correction for pre-1976 DST laws in  
Baja California.  (Upstream made this release mostly to update  
their leap-second data, which we don't use.)  But with minor  
releases coming up, we should be up-to-date.  
  
Backpatch-through: 14  

M src/timezone/data/tzdata.zi

commit   : 6bca4b50d000e840cad17a9dd6cb46785fb2cedb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Jan 2026 17:24:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Jan 2026 17:24:25 +0900    

Click here for diff

The code adding the WAL information included in a backup manifest is  
cross-checked with the contents of the timeline history file of the end  
timeline.  A check based on the end timeline, when it fails, reported  
the value of the start timeline in the error message.  This error is  
fixed to show the correct timeline number in the report.  
  
This error report would be confusing for users if seen, because it would  
provide an incorrect information, so backpatch all the way down.  
  
Oversight in 0d8c9c1210c4.  
  
Author: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/tencent_0F2949C4594556F672CF4658@qq.com  
Backpatch-through: 14  

M src/backend/backup/backup_manifest.c

Remove useless asserts in report_namespace_conflict()

commit   : 2a6ce34b55e1cbb16a507c2e90c626eef71018b7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Jan 2026 16:11:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Jan 2026 16:11:46 +0900    

Click here for diff

An assertion is used in this routine to check that a valid namespace OID  
is given by the caller, but it was repeated twice: once at the top of  
the routine and a second time multiple times in a switch/case.  This  
commit removes the assertions within the switch/case.  
  
Thinko in commit 765cbfdc9263.  
  
Author: Man Zeng <zengman@halodbtech.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/tencent_40F8C1D82E2EE28065009AAA@qq.com  

M src/backend/commands/alter.c

Fix PL/Python build on MSVC with older Meson

commit   : 6831cd9e3b082d7b830c3196742dd49e3540c49b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Jan 2026 17:21:32 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Jan 2026 17:21:32 +0100    

Click here for diff

Amendment for commit 2bc60f86219.  With older Meson versions, we need  
to specify the Python include directory directly to cc.check_header  
instead of relying on the dependency to pass it through.  
  
Author: Bryan Green <dbryan.green@gmail.com>  
Discussion: https://www.postgresql.org/message-id/0de98c41-4145-44c1-aac5-087cf5b3e4a9%40gmail.com  

M meson.build

Fix crash in test function on removable_cutoff(NULL)

commit   : 71379663fe25aa90049726e913f48daa30a03ff0    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 16 Jan 2026 14:42:22 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 16 Jan 2026 14:42:22 +0200    

Click here for diff

The function is part of the injection_points test module and only used  
in tests. None of the current tests call it with a NULL argument, but  
it is supposed to work.  
  
Backpatch-through: 17  

M src/test/modules/injection_points/regress_injection.c

Fix rare test failure in nbtree_half_dead_pages

commit   : 1c64d2fcbe7b27758772c7bc335f29263771ba1d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 16 Jan 2026 14:09:22 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 16 Jan 2026 14:09:22 +0200    

Click here for diff

If auto-analyze kicks in at just the right moment, it can hold a  
snapshot and prevent the VACUUM command in the test from removing the  
deleted tuples. The test needs the tuples to be removed, otherwise no  
half-dead page is generated. To fix, introduce a helper procedure to  
wait for the removable cutoff to advance, like the one used in the  
syscache-update-pruned test for similar purposes.  
  
Thanks to Alexander Lakhin for reproducing and analyzing the test  
failure, and Tom Lane for the report.  
  
Discussion: https://www.postgresql.org/message-id/307198.1767408023@sss.pgh.pa.us  

M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql

bufmgr: Avoid spurious compiler warning after fcb9c977aa5

commit   : 84705b37273da016633fc5c0a06e848bd6e1e71b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Jan 2026 06:58:35 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Jan 2026 06:58:35 -0500    

Click here for diff

Some compilers, e.g. gcc with -Og or -O1, warn about the wait_event in  
BufferLockAcquire() possibly being uninitialized. That can't actually happen,  
as the switch() covers all legal lock mode values, but we still need to  
silence the warning.  We could add a default:, but we'd like to get a warning  
if we were to get a new lock mode in the future.  So just initialize  
wait_event to 0.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/934395.1768518154@sss.pgh.pa.us  

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

Improve pg_clear_extended_stats() with incorrect relation/stats combination

commit   : 395b73c045e02bbe5a33c10f57f528a4468a56f4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 15:24:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 15:24:59 +0900    

Click here for diff

Issue fat-fingered in d756fa1019ff, noticed while doing more review of  
the main patch set proposed.  I have missed the fact that this can be  
triggered by specifying an extended stats object that does not match  
with the relation specified and already locked.  Like the cases where  
an object defined in input is missing, the code is changed to issue a  
WARNING instead of a confusing cache lookup failure.  
  
A regression test is added to cover this case.  
  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

Fix rowmark handling for non-relation RTEs during executor init

commit   : 889676a0d553974d8f46816844e80e5c9deacd0e    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jan 2026 14:53:50 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jan 2026 14:53:50 +0900    

Click here for diff

Commit cbc127917e introduced tracking of unpruned relids to skip  
processing of pruned partitions. PlannedStmt.unprunableRelids is  
computed as the difference between PlannerGlobal.allRelids and  
prunableRelids, but allRelids only contains RTE_RELATION entries.  
This means non-relation RTEs (VALUES, subqueries, CTEs, etc.) are  
never included in unprunableRelids, and consequently not in  
es_unpruned_relids at runtime.  
  
As a result, rowmarks attached to non-relation RTEs were incorrectly  
skipped during executor initialization. This affects any DML statement  
that has rowmarks on such RTEs, including MERGE with a VALUES or  
subquery source, and UPDATE/DELETE with joins against subqueries or  
CTEs. When a concurrent update triggers an EPQ recheck, the missing  
rowmark leads to incorrect results.  
  
Fix by restricting the es_unpruned_relids membership check to  
RTE_RELATION entries only, since partition pruning only applies to  
actual relations. Rowmarks for other RTE kinds are now always  
processed.  
  
Bug: #19355  
Reported-by: Bihua Wang <wangbihua.cn@gmail.com>  
Diagnosed-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Diagnosed-by: Tender Wang <tndrwang@gmail.com>  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/19355-57d7d52ea4980dc6@postgresql.org  
Backpatch-through: 18  

M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

Fix segfault from releasing locks in detached DSM segments

commit   : 9cbb1d21d67ec3cb2d5342073d220a0c1e0ad82c    
  
author   : Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jan 2026 13:01:52 +0900    
  
committer: Amit Langote <amitlan@postgresql.org>    
date     : Fri, 16 Jan 2026 13:01:52 +0900    

Click here for diff

If a FATAL error occurs while holding a lock in a DSM segment (such  
as a dshash lock) and the process is not in a transaction, a  
segmentation fault can occur during process exit.  
  
The problem sequence is:  
  
 1. Process acquires a lock in a DSM segment (e.g., via dshash)  
 2. FATAL error occurs outside transaction context  
 3. proc_exit() begins, calling before_shmem_exit callbacks  
 4. dsm_backend_shutdown() detaches all DSM segments  
 5. Later, on_shmem_exit callbacks run  
 6. ProcKill() calls LWLockReleaseAll()  
 7. Segfault: the lock being released is in unmapped memory  
  
This only manifests outside transaction contexts because  
AbortTransaction() calls LWLockReleaseAll() during transaction  
abort, releasing locks before DSM cleanup. Background workers and  
other non-transactional code paths are vulnerable.  
  
Fix by calling LWLockReleaseAll() unconditionally at the start of  
shmem_exit(), before any callbacks run. Releasing locks before  
callbacks prevents the segfault - locks must be released before  
dsm_backend_shutdown() detaches their memory. This is safe because  
after an error, held locks are protecting potentially inconsistent  
data anyway, and callbacks can acquire fresh locks if needed.  
  
Also add a comment noting that LWLockReleaseAll() must be safe to  
call before LWLock initialization (which it is, since  
num_held_lwlocks will be 0), plus an Assert for the post-condition.  
  
This fix aligns with the original design intent from commit  
001a573a2, which noted that backends must clean up shared memory  
state (including releasing lwlocks) before unmapping dynamic shared  
memory segments.  
  
Reported-by: Rahila Syed <rahilasyed90@gmail.com>  
Author: Rahila Syed <rahilasyed90@gmail.com>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAH2L28uSvyiosL+kaic9249jRVoQiQF6JOnaCitKFq=xiFzX3g@mail.gmail.com  
Backpatch-through: 14  

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

pg_recvlogical: remove unnecessary OutputFsync() return value checks.

commit   : b98cc4a14e538d0bc139f50606249b99cc9215cd    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:37:05 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:37:05 +0900    

Click here for diff

Commit 1e2fddfa33d changed OutputFsync() so that it always returns true.  
However, pg_recvlogical.c still contained checks of its boolean return  
value, which are now redundant.  
  
This commit removes those checks and changes the type of return value of  
OutputFsync() to void, simplifying the code.  
  
Suggested-by: Yilin Zhang <jiezhilove@126.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com  

M src/bin/pg_basebackup/pg_recvlogical.c

Add test for pg_recvlogical reconnection behavior.

commit   : d89b1d817513025e2c1f821090c4262fcedf5be2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:36:34 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:36:34 +0900    

Click here for diff

This commit adds a test to verify that data already received and flushed by  
pg_recvlogical is not streamed again even after the connection is lost,  
reestablished, and logical replication is restarted.  
  
Author: Mircea Cadariu <cadariu.mircea@gmail.com>  
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com  

M src/bin/pg_basebackup/t/030_pg_recvlogical.pl

Add a new helper function wait_for_file() to Utils.pm.

commit   : 0b10969db610c607227b23710d556b595d7eb34a    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:35:56 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:35:56 +0900    

Click here for diff

wait_for_file() waits for the contents of a specified file, starting at an  
optional offset, to match a given regular expression. If no offset is  
provided, the entire file is checked. The function times out after  
$PostgreSQL::Test::Utils::timeout_default seconds. It returns the total  
file length on success.  
  
The existing wait_for_log() function contains almost identical logic, but  
is limited to reading the cluster's log file. This commit also refactors  
wait_for_log() to call wait_for_file() instead, avoiding code duplication.  
  
This helper will be used by upcoming changes.  
  
Suggested-by: Mircea Cadariu <cadariu.mircea@gmail.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com  

M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm

pg_recvlogical: Prevent flushed data from being re-sent.

commit   : 41cbdab0ab6d04e8ec42d10335ef9635eb9c2c67    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:35:26 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 16 Jan 2026 12:35:26 +0900    

Click here for diff

Previously, when pg_recvlogical lost connection, reconnected, and restarted  
replication, data that had already been flushed could be streamed again.  
This happened because the replication start position used when restarting  
replication was taken from the last standby status message, which could be  
older than the position of the last flushed data. As a result, some flushed  
data newer than the replication start position could exist and be re-sent.  
  
This commit fixes the issue by ensuring all written data is flushed to disk  
before restarting replication, and by using the last flushed position as  
the replication start point. This prevents already flushed data from being  
re-sent.  
  
Additionally, previously when the --no-loop option was used, pg_recvlogical  
could exit without flushing written data, potentially losing data. To fix  
this issue, this commit also ensures all data is flushed to disk before  
exiting due to --no-loop.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>  
Reviewed-by: Yilin Zhang <jiezhilove@126.com>  
Reviewed-by: Dewei Dai <daidewei1970@163.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com  

M src/bin/pg_basebackup/pg_recvlogical.c

Fix stability issue with new TAP test of pg_createsubscriber

commit   : a7c63e486050636925f81123b1427f1cb49644a2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 12:12:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 12:12:26 +0900    

Click here for diff

The test introduced in 639352d904c8 has added a direct pg_ctl command to  
start a node, a method that is incompatible with the teardown() routine  
used at the end of the test as the PID saved in the Cluster object would  
prevent the node to be shut down.  This can ultimately prevent the test  
to perform its cleanup, failing on timeout.  
  
Like pg_ctl's 001_start_stop or ssl_passphrase_callback's 001_testfunc,  
this commit changes the test so a direct pg_ctl command is used to stop  
the rogue node.  That should be hopefully enough to cool down the  
buildfarm.  
  
Per report from buildfarm member fairywren, which is the only animal  
that is showing this issue.  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/TY7PR01MB1455452AE9053DD2B77B74FEAF58CA@TY7PR01MB14554.jpnprd01.prod.outlook.com  

M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

Add pg_clear_extended_stats()

commit   : d756fa1019ff6131944ab263a93a14c4e3b68c39    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 08:13:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 16 Jan 2026 08:13:30 +0900    

Click here for diff

This function is able to clear the data associated to an extended  
statistics object, making things so as the object looks as  
newly-created.  
  
The caller of this function needs the following arguments for the  
extended stats to clear:  
- The name of the relation.  
- The schema name of the relation.  
- The name of the extended stats object.  
- The schema name of the extended stats object.  
- If the stats are inherited or not.  
  
The first two parameters are especially important to ensure a consistent  
lookup and ACL checks for the relation on which is based the extended  
stats object that will be cleared, relying first on a RangeVar lookup  
where permissions are checked without locking a relation, critical to  
prevent denial-of-service attacks when using this kind of function (see  
also 688dc6299a5b for a similar concern).  The third to fifth arguments  
give a way to target the extended stats records to clear.  
  
This has been extracted from a larger patch by the same author, for a  
piece which is again useful on its own.  I have rewritten large portions  
of it.  The tests have been extended while discussing this piece,  
resulting on what this commit includes.  The intention behind this  
feature is to add support for the import of extended statistics across  
dumps and upgrades, this change building one piece that we will be able  
to rely on for the rest of the changes.  
  
Bump catalog version.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/Makefile
A src/backend/statistics/extended_stats_funcs.c
M src/backend/statistics/meson.build
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql

lwlock: Remove support for disowned lwlwocks

commit   : d40fd85187d06f7bd16fb4d0067bad0b1d248718    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    

Click here for diff

This reverts commit f8d7f29b3e81db59b95e4b5baaa6943178c89fd8, plus parts of  
subsequent commits fixing a typo in a parameter name.  
  
Support for disowned lwlocks was added for the benefit of AIO, to be able to  
have content locks "owned" by the AIO subsystem. But as of commit fcb9c977aa5,  
content locks do not use lwlocks anymore.  
  
It does not seem particularly likely that we need this facility outside of the  
AIO use-case, therefore remove the now unused functions.  
  
I did choose to keep the comment added in the aforementioned commit about  
lock->owner intentionally being left pointing to the last owner.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/cj5mcjdpucvw4a54hehslr3ctukavrbnxltvuzzhqnimvpju5e@cy3g3mnsefwz  

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

lwlock: Remove ForEachLWLockHeldByMe

commit   : 55fbfb738b00be8779949595065cb85aa471ea80    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    

Click here for diff

As of commit fcb9c977aa5, ForEachLWLockHeldByMe(), introduced in f4ece891fc2f,  
is not used anymore, as content locks are now implemented in bufmgr.c.  It  
doesn't seem that likely that a new user of the functionality will appear all  
that soon, making removal of the function seem like the most sensible path. It  
can easily be added back if necessary.  
  
Discussion: https://postgr.es/m/lneuyxqxamqoayd2ntau3lqjblzdckw6tjgeu4574ezwh4tzlg%40noioxkquezdw  

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

pgindent fix for 8077649907d

commit   : 335f2231a30cb5002219888eef14f4dfce5b0391    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:54:16 -0500    

Click here for diff

Per buildfarm member koel.  
  
Backpatch-through: 18  

M src/backend/storage/aio/method_io_uring.c

bufmgr: Implement buffer content locks independently of lwlocks

commit   : fcb9c977aa5f1eefe7444e423e833ff64a5d1d8f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:09:08 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 14:09:08 -0500    

Click here for diff

Until now buffer content locks were implemented using lwlocks. That has the  
obvious advantage of not needing a separate efficient implementation of  
locks. However, the time for a dedicated buffer content lock implementation  
has come:  
  
1) Hint bits are currently set while holding only a share lock. This leads to  
   having to copy pages while they are being written out if checksums are  
   enabled, which is not cheap. We would like to add AIO writes, however once  
   many buffers can be written out at the same time, it gets a lot more  
   expensive to copy them, particularly because that copy needs to reside in  
   shared buffers (for worker mode to have access to the buffer).  
  
   In addition, modifying buffers while they are being written out can cause  
   issues with unbuffered/direct-IO, as some filesystems (like btrfs) do not  
   like that, due to filesystem internal checksums getting corrupted.  
  
   The solution to this is to require a new share-exclusive lock-level to set  
   hint bits and to write out buffers, making those operations mutually  
   exclusive. We could introduce such a lock-level into the generic lwlock  
   implementation, however it does not look like there would be other users,  
   and it does add some overhead into important code paths.  
  
2) For AIO writes we need to be able to race-freely check whether a buffer is  
   undergoing IO and whether an exclusive lock on the page can be acquired. That  
   is rather hard to do efficiently when the buffer state and the lock state  
   are separate atomic variables. This is a major hindrance to allowing writes  
   to be done asynchronously.  
  
3) Buffer locks are by far the most frequently taken locks. Optimizing them  
   specifically for their use case is worth the effort. E.g. by merging  
   content locks into buffer locks we will be able to release a buffer lock  
   and pin in one atomic operation.  
  
4) There are more complicated optimizations, like long-lived "super pinned &  
   locked" pages, that cannot realistically be implemented with the generic  
   lwlock implementation.  
  
Therefore implement content locks inside bufmgr.c. The lockstate is stored as  
part of BufferDesc.state. The implementation of buffer content locks is fairly  
similar to lwlocks, with a few important differences:  
  
1) An additional lock-level share-exclusive has been added. This lock-level  
   conflicts with exclusive locks and itself, but not share locks.  
  
2) Error recovery for content locks is implemented as part of the already  
   existing private-refcount tracking mechanism in combination with resowners,  
   instead of a bespoke mechanism as the case for lwlocks. This means we do  
   not need to add dedicated error-recovery code paths to release all content  
   locks (like done with LWLockReleaseAll() for lwlocks).  
  
3) The lock state is embedded in BufferDesc.state instead of having its own  
   struct.  
  
4) The wakeup logic is a tad more complicated due to needing to support the  
   additional lock-level  
  
This commit unfortunately introduces some code that is very similar to the  
code in lwlock.c, however the code is not equivalent enough to easily merge  
it. The future wins that this commit makes possible seem worth the cost.  
  
As of this commit nothing uses the new share-exclusive lock mode. It will be  
used in a future commit. It seemed too complicated to introduce the lock-level  
in a separate commit.  
  
It's worth calling out one wart in this commit: Despite content locks not  
being lwlocks anymore, they continue to use PGPROC->lw* - that seemed better  
than duplicating the relevant infrastructure.  
  
Another thing worth pointing out is that, after this change, content locks are  
not reported as LWLock wait events anymore, but as new wait events in the  
"Buffer" wait event class (see also 6c5c393b740). The old BufferContent lwlock  
tranche has been removed.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/lwlocklist.h
M src/include/storage/proc.h

bufmgr: Change BufferDesc.state to be a 64-bit atomic

commit   : dac328c8a682d38b509b8fd966b280c5f47ea287    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 12:53:50 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 12:53:50 -0500    

Click here for diff

This is motivated by wanting to merge buffer content locks into  
BufferDesc.state in a future commit, rather than having a separate lwlock (see  
commit c75ebc657ff for more details). As this change is rather mechanical, it  
seems to make sense to split it out into a separate commit, for easier review.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h
M src/include/storage/procnumber.h
M src/test/modules/test_aio/test_aio.c

Optimize LISTEN/NOTIFY via shared channel map and direct advancement.

commit   : 282b1cde9dedf456ecf02eb27caf086023a7bb71    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Jan 2026 14:12:03 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Jan 2026 14:12:03 -0500    

Click here for diff

This patch reworks LISTEN/NOTIFY to avoid waking backends that have  
no need to process the notification messages we just sent.  
  
The primary change is to create a shared hash table that tracks  
which processes are listening to which channels (where a "channel" is  
defined by a database OID and channel name).  This allows a notifying  
process to accurately determine which listeners are interested,  
replacing the previous weak approximation that listeners in other  
databases couldn't be interested.  
  
Secondly, if a listener is known not to be interested and is  
currently stopped at the old queue head, we avoid waking it at all  
and just directly advance its queue pointer past the notifications  
we inserted.  
  
These changes permit very significant improvements (integer multiples)  
in NOTIFY throughput, as well as a noticeable reduction in latency,  
when there are many listeners but only a few are interested in any  
specific message.  There is no improvement for the simplest case where  
every listener reads every message, but any loss seems below the noise  
level.  
  
Author: Joel Jacobson <joel@compiler.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com  

M src/backend/commands/async.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlocklist.h
M src/test/isolation/expected/async-notify.out
M src/test/isolation/specs/async-notify.spec
M src/tools/pgindent/typedefs.list

Fix 'unexpected data beyond EOF' on replica restart

commit   : 23b25586dccfe81b6ac46ba8b4e505d48192732b    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 20:57:12 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 20:57:12 +0200    

Click here for diff

On restart, a replica can fail with an error like 'unexpected data  
beyond EOF in block 200 of relation T/D/R'. These are the steps to  
reproduce it:  
  
- A relation has a size of 400 blocks.  
  - Blocks 201 to 400 are empty.  
  - Block 200 has two rows.  
  - Blocks 100 to 199 are empty.  
- A restartpoint is done  
- Vacuum truncates the relation to 200 blocks  
- A FPW deletes a row in block 200  
- A checkpoint is done  
- A FPW deletes the last row in block 200  
- Vacuum truncates the relation to 100 blocks  
- The replica restarts  
  
When the replica restarts:  
  
- The relation on disk starts at 100 blocks, because all the  
  truncations were applied before restart.  
- The first truncate to 200 blocks is replayed. It silently fails, but  
  it will still (incorrectly!) update the cache size to 200 blocks  
- The first FPW on block 200 is applied. XLogReadBufferForRead relies  
  on the cached size and incorrectly assumes that the page already  
  exists in the file, and thus won't extend the relation.  
- The online checkpoint record is replayed, calling smgrdestroyall  
  which causes the cached size to be discarded  
- The second FPW on block 200 is applied. This time, the detected size  
  is 100 blocks, an extend is attempted. However, the block 200 is  
  already present in the buffer cache due to the first FPW. This  
  triggers the 'unexpected data beyond EOF'.  
  
To fix, update the cached size in SmgrRelation with the current size  
rather than the requested new size, when the requested new size is  
greater.  
  
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>  
Discussion: https://www.postgresql.org/message-id/CAO6_Xqrv-snNJNhbj1KjQmWiWHX3nYGDgAc=vxaZP3qc4g1Siw@mail.gmail.com  
Backpatch-through: 14  

M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c

Remove #include <math.h> where not needed

commit   : 35e3fae738e63f4154814dd51d3806d8d8b7b673    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 15 Jan 2026 19:09:47 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 15 Jan 2026 19:09:47 +0100    

Click here for diff

Liujinyang reported the one in binaryheap.c, I then found and analyzed  
the rest.  
  
For future patches, we require git archaelogical analysis before we  
accept patches of this nature.  
  
Co-authored-by: liujinyang <21043272@qq.com>  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/tencent_6B302BFCAF6F010E00AB5C2C0ECB7AA3F205@qq.com  

M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_utils_var.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/commands/define.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/lib/knapsack.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/tid.c
M src/common/binaryheap.c
M src/include/utils/date.h

aio: io_uring: Fix danger of completion getting reused before being read

commit   : 8077649907d40b9831358d0c5121a8c58267a988    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 10:17:51 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 15 Jan 2026 10:17:51 -0500    

Click here for diff

We called io_uring_cqe_seen(..., cqe) before reading cqe->res. That allows the  
completion to be reused, which in turn could lead to cqe->res being  
overwritten. The window for that is very narrow and the likelihood of it  
happening is very low, as we should never actually utilize all CQEs, but the  
consequences would be bad.  
  
This bug was reported to me privately.  
  
Backpatch-through: 18  
Discussion: https://postgr.es/m/bwo3e5lj2dgi2wzq4yvbyzu7nmwueczvvzioqsqo6azu6lm5oy@pbx75g2ach3p  

M src/backend/storage/aio/method_io_uring.c

Wake up autovacuum launcher from postmaster when a worker exits

commit   : d9c3c943653740d1df44385c3cd658ed67bb4fb2    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 18:02:25 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 18:02:25 +0200    

Click here for diff

When an autovacuum worker exits, the launcher needs to be notified  
with SIGUSR2, so that it can rebalance and possibly launch a new  
worker. The launcher must be notified only after the worker has  
finished ProcKill(), so that the worker slot is available for a new  
worker. Before this commit, the autovacuum worker was responsible for  
that, which required a slightly complicated dance to pass the  
launcher's PID from FreeWorkerInfo() to ProcKill() in a global  
variable.  
  
Simplify that by moving the responsibility of the signaling to the  
postmaster. The postmaster was already doing it when it failed to fork  
a worker process, so it seems logical to make it responsible for  
notifying the launcher on worker exit too. That's also how the  
notification on background worker exit is done.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: li carol <carol.li2025@outlook.com>  
Discussion: https://www.postgresql.org/message-id/a5e27d25-c7e7-45d5-9bac-a17c8f462def@iki.fi  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/proc.c
M src/include/postmaster/autovacuum.h

Add check for invalid offset at multixid truncation

commit   : 102bdaa9be13e65de898991f69ddeea517789fb3    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 16:48:45 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 16:48:45 +0200    

Click here for diff

If a multixid with zero offset is left behind after a crash, and that  
multixid later becomes the oldest multixid, truncation might try to  
look up its offset and read the zero value. In the worst case, we  
might incorrectly use the zero offset to truncate valid SLRU segments  
that are still needed. I'm not sure if that can happen in practice, or  
if there are some other lower-level safeguards or incidental reasons  
that prevent the caller from passing an unwritten multixid as the  
oldest multi. But better safe than sorry, so let's add an explicit  
check for it.  
  
In stable branches, we should perhaps do the same check for  
'oldestOffset', i.e. the offset of the old oldest multixid (in master,  
'oldestOffset' is gone). But if the old oldest multixid has an invalid  
offset, the damage has been done already, and we would never advance  
past that point. It's not clear what we should do in that case. The  
check that this commit adds will prevent such an multixid with invalid  
offset from becoming the oldest multixid in the first place, which  
seems enough for now.  
  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: Discussion: https://www.postgresql.org/message-id/000301b2-5b81-4938-bdac-90f6eb660843@iki.fi  
Backpatch-through: 14  

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

Remove some unnecessary code from multixact truncation

commit   : c4b71e6f60c005b54bd025ee30aaee3f22496622    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 13:34:50 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 15 Jan 2026 13:34:50 +0200    

Click here for diff

With 64-bit multixact offsets, PerformMembersTruncation() doesn't need  
the starting offset anymore. The 'oldestOffset' value that  
TruncateMultiXact() calculates is no longer used for anything. Remove  
it, and the code to calculate it.  
  
'oldestOffset' was included in the WAL record as 'startTruncMemb',  
which sounds nice if you e.g. look at the WAL with pg_waldump, but it  
was also confusing because we didn't actually use the value for  
determining what to truncate. Replaying the WAL would remove all  
segments older than 'endTruncMemb', regardless of  
'startTruncMemb'. The 'startTruncOff' stored in the WAL record was  
similarly unnecessary even before 64-bit multixid offsets, it was  
stored just for the sake of symmetry with 'startTruncMemb'. Remove  
both from the WAL record, and rename the remaining 'endTruncOff' to  
'oldestMulti' and 'endTruncMemb' to 'oldestOffset', for consistency  
with the variable names used for them in other places.  
  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://www.postgresql.org/message-id/000301b2-5b81-4938-bdac-90f6eb660843@iki.fi  

M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/transam/multixact.c
M src/include/access/multixact.h
M src/include/access/xlog_internal.h

plpython: Streamline initialization

commit   : da265a87175be469db6c178b57862ad1fb26dd04    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 12:11:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 12:11:52 +0100    

Click here for diff

The initialization of PL/Python (the Python interpreter, the global  
state, the plpy module) was arranged confusingly across different  
functions with unclear and confusing boundaries.  For example,  
PLy_init_interp() said "Initialize the Python interpreter ..." but it  
didn't actually do this, and PLy_init_plpy() said "initialize plpy  
module" but it didn't do that either.  After this change, all the  
global initialization is called directly from _PG_init(), and the plpy  
module initialization is all called from its registered initialization  
function PyInit_plpy().  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: li carol <carol.li2025@outlook.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org  

M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_plpymodule.h

plpython: Remove duplicate PyModule_Create()

commit   : 3263a893fb1d2b36a44c13da701e44c805ed03f6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    

Click here for diff

This seems to have existed like this since Python 3 support was  
added (commit dd4cd55c158), but it's unclear what this second call is  
supposed to accomplish.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: li carol <carol.li2025@outlook.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org  

M src/pl/plpython/plpy_plpymodule.c

plpython: Clean up PyModule_AddObject() uses

commit   : 34d8111c3abe97daea014f5587f405cde00d9e48    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    

Click here for diff

The comments "PyModule_AddObject does not add a refcount to the  
object, for some odd reason" seem distracting.  Arguably, this  
behavior is expected, not odd.  Also, the additional references  
created by the existing code are apparently not necessary.  But we  
should clean up the reference in the error case, as suggested by the  
Python documentation.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: li carol <carol.li2025@outlook.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org  

M src/pl/plpython/plpy_plpymodule.c

plpython: Remove commented out code

commit   : 8cb95a06455446ebc25c6e3b169881955afc3887    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 15 Jan 2026 10:24:49 +0100    

Click here for diff

This code has been commented out since the first commit of plpython.  
It doesn't seem worth keeping.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: li carol <carol.li2025@outlook.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org  

M src/pl/plpython/plpy_plpymodule.c

Introduce routines to validate and free MVNDistinct and MVDependencies

commit   : 32e27bd320821df49dd212912b9e90d3d98e24f1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jan 2026 09:36:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 15 Jan 2026 09:36:05 +0900    

Click here for diff

These routines are useful to perform some basic validation checks on  
each object structure, working currently on attribute numbers for  
non-expression and expression attnums.  These checks could be extended  
in the future.  
  
Note that this code is not used yet in the tree, and that these  
functions will become handy for an upcoming patch for the import of  
extended statistics data.  However, they are worth their own independent  
change as they are actually useful by themselves, with at least the  
extension code argument in mind (or perhaps I am just feeling more  
pedantic today).  
  
Extracted from a larger patch by the same author, with many adjustments  
and fixes by me.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/include/statistics/extended_stats_internal.h

Remove redundant assignment in CreateWorkExprContext

commit   : ed425b5a200ac00488940f2354d3cf9f11091926    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 14 Jan 2026 12:01:36 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 14 Jan 2026 12:01:36 -0800    

Click here for diff

In CreateWorkExprContext(), maxBlockSize is initialized to  
ALLOCSET_DEFAULT_MAXSIZE, and it then immediately reassigned,  
thus the initialization is a redundant.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reported-by: Chao Li <lic@highgo.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/83a14f3c-f347-4769-9c01-30030b31f1eb@gmail.com  

M src/backend/executor/execUtils.c

lwlock: Improve local variable name

commit   : 556c92a68972818b24d31d060175ae8131d3297b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 14 Jan 2026 11:15:38 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 14 Jan 2026 11:15:38 -0500    

Click here for diff

In 9a385f61666 I used the variable name new_release_in_progress, but  
new_wake_in_progress makes more sense given the flag name.  
  
Suggested-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/AC5E365D-7AD9-47AE-B2C6-25756712B188@gmail.com  

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

Revert "Replace pg_restrict by standard restrict"

commit   : fa16e7fd84886643f480c36614fa11d45fc6d26f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 15:12:25 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 15:12:25 +0100    

Click here for diff

This reverts commit f0f2c0c1aef95757c4e7f144d5577e2b0d814279.  
  
The original problem that led to the use of pg_restrict was that MSVC  
couldn't handle plain restrict, and defining it to something else  
would conflict with its __declspec(restrict) that is used in system  
header files.  In C11 mode, this is no longer a problem, as MSVC  
handles plain restrict.  This led to the commit to replace pg_restrict  
with restrict.  But this did not take C++ into account.  Standard C++  
does not have restrict, so we defined it as something else (for  
example, MSVC supports __restrict).  But this then again conflicts  
with __declspec(restrict) in system header files.  So we have to  
revert this attempt.  The comments are updated to clarify that the  
reason for this is now C++ only.  
  
Reported-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/CAGECzQRoD7chJP1-dneSrhxUJv%2BBRcigoGOO4UwGzaShLot2Yw%40mail.gmail.com  

M configure
M configure.ac
M meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/common/logging.c
M src/common/string.c
M src/include/c.h
M src/include/common/logging.h
M src/include/common/string.h
M src/include/libpq/pqformat.h
M src/include/pg_config.h.in

doc: Slightly correct advice on C/C++ linkage

commit   : 794ba8b6a4c8ce409a37e84444c9519f7f1e5385    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 15:05:29 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 15:05:29 +0100    

Click here for diff

The documentation was writing that <literal>extern C</literal> should  
be used, but it should be <literal>extern "C"</literal>.  

M doc/src/sgml/xfunc.sgml

Enable Python Limited API for PL/Python on MSVC

commit   : 2bc60f86219b00a9ba23efab8f4bb8de21e64e2a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 10:17:36 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Jan 2026 10:17:36 +0100    

Click here for diff

Previously, the Python Limited API was disabled on MSVC due to build  
failures caused by Meson not knowing to link against python3.lib  
instead of python3XX.lib when using the Limited API.  
  
This commit works around the Meson limitation by explicitly finding  
and linking against python3.lib on MSVC, and removes the preprocessor  
guard that was disabling the Limited API on MSVC in plpython.h.  
  
This requires python3.lib to be present in the Python installation,  
which is included when Python is installed.  
  
Author: Bryan Green <dbryan.green@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/ee410de1-1e0b-4770-b125-eeefd4726a24%40eisentraut.org  

M meson.build
M src/pl/plpython/plpython.h

Reword confusing comment to avoid "typo fixes"

commit   : 4196d6178a125f2e80863a7ecd1d918207a9fe7b    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 14 Jan 2026 10:07:44 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 14 Jan 2026 10:07:44 +0100    

Click here for diff

Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Discussion: https://postgr.es/m/CAApHDvqPmpa53jcTmfU8arFFm7=hB5cFoXX5dcUH=1qV0tRFHA@mail.gmail.com  

M src/backend/utils/sort/tuplesort.c

Use more consistent *GetDatum() macros for some unsigned numbers

commit   : 6dcfac9696cbb72a975ec964e88b78e6e90870c0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 17:07:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 17:07:49 +0900    

Click here for diff

This patch switches some code paths to use GetDatum() macros more in  
line with the data types of the variables they manipulate.  This set of  
changes does not fix a problem, but it is always nice to be more  
consistent across the board.  
  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Roman Khapov <rkhapov@yandex-team.ru>  
Reviewed-by: Yuan Li <carol.li2025@outlook.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com  

M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gist/gistget.c
M src/backend/utils/adt/lockfuncs.c

Prevent unintended dropping of active replication origins.

commit   : e385a4e2fd8ead796014a82dd6165f6027255b46    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 14 Jan 2026 07:13:35 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 14 Jan 2026 07:13:35 +0000    

Click here for diff

Commit 5b148706c5 exposed functionality that allows multiple processes to  
use the same replication origin, enabling non-builtin logical replication  
solutions to implement parallel apply for large transactions.  
  
With this functionality, if two backends acquire the same replication  
origin and one of them resets it first, the acquired_by flag is cleared  
without acknowledging that another backend is still actively using the  
origin. This can lead to the origin being unintentionally dropped. If the  
shared memory for that dropped origin is later reused for a newly created  
origin, the remaining backend that still holds a pointer to the old memory  
may inadvertently advance the LSN of a completely different origin,  
causing unpredictable behavior.  
  
Although the underlying issue predates commit 5b148706c5, it did not  
surface earlier because the internal parallel apply worker mechanism  
correctly coordinated origin resets and drops.  
  
This commit resolves the problem by introducing a reference counter for  
replication origins. The reference count increases when a backend sets the  
origin and decreases when it resets it. Additionally, the backend that  
first acquires the origin will not release it until all other backends  
using the origin have released it as well.  
  
The patch also prevents dropping a replication origin when acquired_by is  
zero but the reference counter is nonzero, covering the scenario where the  
first session exits without properly releasing the origin.  
  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/TY4PR01MB169077EE72ABE9E55BAF162D494B5A@TY4PR01MB16907.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/CAMPB6wfe4zLjJL8jiZV5kjjpwBM2=rTRme0UCL7Ra4L8MTVdOg@mail.gmail.com  

M contrib/test_decoding/expected/parallel_session_origin.out
M contrib/test_decoding/specs/parallel_session_origin.spec
M src/backend/replication/logical/origin.c

pg_waldump: Relax LSN comparison check in TAP test

commit   : 4fe1ea7777c8161c655364345d0429cf74f21db4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 16:02:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 16:02:30 +0900    

Click here for diff

The test 002_save_fullpage.pl, checking --save-fullpage fails with  
wal_consistency_checking enabled, due to the fact that the block saved  
in the file has the same LSN as the LSN used in the file name.  The test  
required that the block LSN is stritly lower than file LSN.  This commit  
relaxes the check a bit, by allowing the LSNs to match.  
  
While on it, the test name is reworded to include some information about  
the file and block LSNs, which is useful for debugging.  
  
Author: Andrey Borodin <x4mmm@yandex-team.ru>  
Discussion: https://postgr.es/m/4226AED7-E38F-419B-AAED-9BC853FB55DE@yandex-team.ru  
Backpatch-through: 16  

M src/bin/pg_waldump/t/002_save_fullpage.pl

commit   : ff219c19878960d6af3fb8e08789018745f91895    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Jan 2026 19:38:29 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Jan 2026 19:38:29 -0500    

Click here for diff

This is in preparation to widening the buffer state to 64 bits, which in turn  
is preparation for implementing content locks in bufmgr. This commit aims to  
make the subsequent commits a bit easier to review, by separating out  
reformatting etc from the actual changes.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf  

M src/include/storage/buf_internals.h

lwlock: Invert meaning of LW_FLAG_RELEASE_OK

commit   : 9a385f61666c426f595a953499d5dc9c6e142c9a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Jan 2026 19:38:29 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Jan 2026 19:38:29 -0500    

Click here for diff

Previously, a flag was set to indicate that a lock release should wake up  
waiters. Since waking waiters is the default behavior in the majority of  
cases, this logic has been inverted. The new LW_FLAG_WAKE_IN_PROGRESS flag is  
now set iff wakeups are explicitly inhibited.  
  
The motivation for this change is that in an upcoming commit, content locks  
will be implemented independently of lwlocks, with the lock state stored as  
part of BufferDesc.state. As all of a buffer's flags are cleared when the  
buffer is invalidated, without this change we would have to re-add the  
RELEASE_OK flag after clearing the flags; otherwise, the next lock release  
would not wake waiters.  
  
It seems good to keep the implementation of lwlocks and buffer content locks  
as similar as reasonably possible.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf  

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

Fix query jumbling with GROUP BY clauses

commit   : e217dc7484e5e46f4b9bcef1e1bb03acc4a1834a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 08:44:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Jan 2026 08:44:12 +0900    

Click here for diff

RangeTblEntry.groupexprs was marked with the node attribute  
query_jumble_ignore, causing a list of GROUP BY expressions to be  
ignored during the query jumbling.  For example, these two queries could  
be grouped together within the same query ID:  
SELECT count(*) FROM t GROUP BY a;  
SELECT count(*) FROM t GROUP BY b;  
  
However, as such queries use different GROUP BY clauses, they should be  
split across multiple entries.  
  
This fixes an oversight in 247dea89f761, that has introduced an RTE for  
GROUP BY clauses.  Query IDs are documented as being stable across minor  
releases, but as this is a regression new to v18 and that we are still  
early in its support cycle, a backpatch is exceptionally done as this  
has broken a behavior that exists since query jumbling is supported in  
core, since its introduction in pg_stat_statements.  
  
The tests of pg_stat_statements are expanded to cover this area, with  
patterns involving GROUP BY and GROUPING clauses.  
  
Author: Jian He <jian.universality@gmail.com>  
Discussion: https://postgr.es/m/CACJufxEy2W+tCqC7XuJ94r3ivWsM=onKJp94kRFx3hoARjBeFQ@mail.gmail.com  
Backpatch-through: 18  

M contrib/pg_stat_statements/expected/select.out
M contrib/pg_stat_statements/sql/select.sql
M src/include/nodes/parsenodes.h

doc: Document DEFAULT option in file_fdw.

commit   : ad381d0d9244b1490efccca2126ba3f82e144605    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 13 Jan 2026 22:54:45 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 13 Jan 2026 22:54:45 +0900    

Click here for diff

Commit 9f8377f7a introduced the DEFAULT option for file_fdw but did not  
update the documentation. This commit adds the missing description of  
the DEFAULT option to the file_fdw documentation.  
  
Backpatch to v16, where the DEFAULT option was introduced.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CAOzEurT_PE7QEh5xAdb7Cja84Rur5qPv2Fzt3Tuqi=NU0WJsbg@mail.gmail.com  
Backpatch-through: 16  

M doc/src/sgml/file-fdw.sgml

Fix test_misc/010_index_concurrently_upsert for cache-clobbering builds

commit   : 8a47d9ee7fa25bb10b8cde46dc7a4d28e95e354e    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 13 Jan 2026 10:03:33 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 13 Jan 2026 10:03:33 +0100    

Click here for diff

The test script added by commit e1c971945d62 failed to handle the case  
of cache-clobbering builds (CLOBBER_CACHE_ALWAYS and  
CATCACHE_FORCE_RELEASE) properly -- it would only exit a loop on  
timeout, which is slow, and unfortunate because I (Álvaro) increased the  
timeout for that loop to the complete default TAP test timeout, causing  
the buildfarm to report the whole test run as a timeout failure.  We can  
be much quicker: exit the loop as soon as the backend is seen as waiting  
on the injection point.  
  
In this commit we still reduce the timeout (of that loop and a nearby  
one just to be safe) to half of the default.  
  
I (Álvaro) had also changed Mihail's "sleep(1)" to "sleep(0.1)", which  
apparently turns a 1s sleep into a 0s sleep, because Perl -- probably  
making this a busy loop.  Use Time::HiRes::usleep instead, like we do in  
other tests.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CADzfLwWOVyJygX6BFuyuhTKkJ7uw2e8OcVCDnf6iqnOFhMPE%2BA%40mail.gmail.com  

M src/test/modules/test_misc/t/010_index_concurrently_upsert.pl

Improve some comment wording and grammar in extension.c

commit   : 94a24b4ee5aa42a80a1aacc8eec1fc6a6938894f    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Jan 2026 12:33:08 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Jan 2026 12:33:08 +0700    

Click here for diff

Noted while looking at reports of grammatical errors.  
  
Reported-by: albert tan <alterttan1223@gmail.com>  
Reported-by: Yuan Li(carol) <carol.li2025@outlook.com>  
Discussion: https://postgr.es/m/CAEzortnJB7aue6miGT_xU2KLb3okoKgkBe4EzJ6yJ%3DY8LMB7gw%40mail.gmail.com  

M src/backend/commands/extension.c

Fix error message typo.

commit   : a00a25b6ce4e75314e8ba399c69dd9c86e96a99d    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 12 Jan 2026 19:05:29 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 12 Jan 2026 19:05:29 -0800    

Click here for diff

Reported-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2mMmm9fTZYgE-r_T-KPTFR1rKO029QV-S-6n=7US_9EMA@mail.gmail.com  

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

heapam: Add batch mode mvcc check and use it in page mode

commit   : 0b96e734c5904ee26b8f622b3348620dda4bfee5    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 13:14:58 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 13:14:58 -0500    

Click here for diff

There are two reasons for doing so:  
  
1) It is generally faster to perform checks in a batched fashion and making  
   sequential scans faster is nice.  
  
2) We would like to stop setting hint bits while pages are being written  
   out. The necessary locking becomes visible for page mode scans, if done for  
   every tuple. With batching, the overhead can be amortized to only happen  
   once per page.  
  
There are substantial further optimization opportunities along these  
lines:  
  
- Right now HeapTupleSatisfiesMVCCBatch() simply uses the single-tuple  
  HeapTupleSatisfiesMVCC(), relying on the compiler to inline it. We could  
  instead write an explicitly optimized version that avoids repeated xid  
  tests.  
  
- Introduce batched version of the serializability test  
  
- Introduce batched version of HeapTupleSatisfiesVacuum  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list

heapam: Use exclusive lock on old page in CLUSTER

commit   : 852558b9ec9d54194195a7b7418d57e83a2fda70    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 11:50:05 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 11:50:05 -0500    

Click here for diff

To be able to guarantee that we can set the hint bit, acquire an exclusive  
lock on the old buffer. This is required as a future commit will only allow  
hint bits to be set with a new lock level, which is acquired as-needed in a  
non-blocking fashion.  
  
We need the hint bits, set in heapam_relation_copy_for_cluster() ->  
HeapTupleSatisfiesVacuum(), to be set, as otherwise reform_and_rewrite_tuple()  
-> rewrite_heap_tuple() will get confused. Specifically, rewrite_heap_tuple()  
checks for HEAP_XMAX_INVALID in the old tuple to determine whether to check  
the old-to-new mapping hash table.  
  
It'd be better if we somehow could avoid setting hint bits on the old page. A  
common reason to use VACUUM FULL is very bloated tables - rewriting most of  
the old table during VACUUM FULL doesn't exactly help.  
  
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/4wggb7purufpto6x35fd2kwhasehnzfdy3zdcu47qryubs2hdz@fa5kannykekr  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/rewriteheap.c

freespace: Don't modify page without any lock

commit   : 45f658dacb9c2d333893fcf0d6b5a5e4f8ee5752    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 11:32:17 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 12 Jan 2026 11:32:17 -0500    

Click here for diff

Before this commit fsm_vacuum_page() modified the page without any lock on the  
page. Historically that was kind of ok, as we didn't rely on the freespace to  
really stay consistent and we did not have checksums. But these days pages are  
checksummed and there are ways for FSM pages to be included in WAL records,  
even if the FSM itself is still not WAL logged. If a FSM page ever were  
modified while a WAL record referenced that page, we'd be in trouble, as the  
WAL CRC could end up getting corrupted.  
  
The reason to address this right now is a series of patches with the goal to  
only allow modifications of pages with an appropriate lock level. Obviously  
not having any lock is not appropriate :)  
  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://postgr.es/m/4wggb7purufpto6x35fd2kwhasehnzfdy3zdcu47qryubs2hdz@fa5kannykekr  
Discussion: https://postgr.es/m/e6a8f734-2198-4958-a028-aba863d4a204@iki.fi  

M src/backend/storage/freespace/freespace.c

Stop including {brin,gin}_tuple.h in tuplesort.h

commit   : 225d1df1d299061498182714d207fae77436702c    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 12 Jan 2026 18:09:36 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 12 Jan 2026 18:09:36 +0100    

Click here for diff

Doing this meant that those two headers, which are supposed to be  
internal to their corresponding index AMs, were being included pretty  
much universally, because tuplesort.h is included by execnodes.h which  
is very widely used.  Stop that, and fix fallout.  
  
We also change indexing.h to no longer include execnodes.h (tuptable.h  
is sufficient), and relscan.h to no longer include buf.h (pointless  
since c2fe139c201c).  
  
Author: Mario González <gonzalemario@gmail.com>  
Discussion: https://postgr.es/m/CAFsReFUcBFup=Ohv_xd7SNQ=e73TXi8YNEkTsFEE2BW7jS1noQ@mail.gmail.com  

M contrib/pageinspect/gistfuncs.c
M src/backend/access/gin/gininsert.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_largeobject.c
M src/backend/commands/collationcmds.c
M src/backend/commands/user.c
M src/backend/executor/execReplication.c
M src/backend/parser/parse_expr.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/sequencesync.c
M src/backend/statistics/stat_utils.c
M src/include/access/relscan.h
M src/include/catalog/indexing.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h

fuzzystrmatch: use pg_ascii_toupper().

commit   : b96a9fd76f321b638e5d4b566718189dc42fc532    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 12 Jan 2026 08:54:04 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 12 Jan 2026 08:54:04 -0800    

Click here for diff

fuzzystrmatch is designed for ASCII, so no need to rely on the global  
LC_CTYPE setting.  
  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/dd0cdd1f-e786-426e-b336-1ffa9b2f1fc6%40eisentraut.org  

M contrib/fuzzystrmatch/fuzzystrmatch.c

commit   : 2defd00062555c03f7ac4d8f004b98b36b876c5d    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 12 Jan 2026 16:59:28 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 12 Jan 2026 16:59:28 +0100    

Click here for diff

Some structs and enums related to parallel query instrumentation had  
organically grown scattered across various files, and were causing  
header pollution especially through execnodes.h.  Create a single file  
where they can live together.  
  
This only moves the structs to the new file; cleaning up the pollution  
by removing no-longer-necessary cross-header inclusion will be done in  
future commits.  
  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Co-authored-by: Mario González <gonzalemario@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/202510051642.wwmn4mj77wch@alvherre.pgsql  
Discussion: https://postgr.es/m/CAFsReFUr4KrQ60z+ck9cRM4WuUw1TCghN7EFwvV0KvuncTRc2w@mail.gmail.com  

M contrib/bloom/blscan.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/spgist/spgscan.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/genam.h
A src/include/executor/instrument_node.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h

Avoid casting void * function arguments

commit   : c3c240537f6da498186bfb07017a7b01b9a2c24f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 16:12:56 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 16:12:56 +0100    

Click here for diff

In many cases, the cast would silently drop a const qualifier.  To  
fix, drop the unnecessary cast and let the compiler check the types  
and qualifiers.  Add const to read-only local variables, preserving  
the const qualifiers from the function signatures.  
  
Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/heaptuple.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/cache/typcache.c
M src/bin/pg_dump/pg_dump.c
M src/test/modules/injection_points/injection_points.c

Add const to read only TableInfo pointers in pg_dump

commit   : 707f905399b4e47c295fe247f76fbbe53c737984    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 14:26:26 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 14:26:26 +0100    

Click here for diff

Functions that dump table data receive their parameters through const  
void * but were casting away const.  Add const qualifiers to functions  
that only read the table information.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/bin/pg_dump/pg_dump.c

Make dmetaphone collation-aware

commit   : e39ece0343fef7bf5a689d75bbafff9386e6e3da    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 08:35:48 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Jan 2026 08:35:48 +0100    

Click here for diff

The dmetaphone() SQL function internally upper-cases the argument  
string.  It did this using the toupper() function.  That way, it has a  
dependency on the global LC_CTYPE locale setting, which we want to get  
rid of.  
  
The "double metaphone" algorithm specifically supports the "C with  
cedilla" letter, so just using ASCII case conversion wouldn't work.  
  
To fix that, use the passed-in collation and use the str_toupper()  
function, which has full awareness of collations and collation  
providers.  
  
Note that this does not change the fact that this function only works  
correctly with single-byte encodings.  The change to str_toupper()  
makes the case conversion multibyte-enabled, but the rest of the  
function is still not ready.  
  
Reviewed-by: Jeff Davis <pgsql@j-davis.com>  
Discussion: https://www.postgresql.org/message-id/108e07a2-0632-4f00-984d-fe0e0d0ec726%40eisentraut.org  

M contrib/fuzzystrmatch/dmetaphone.c

pg_dump: Fix memory leak in dumpSequenceData().

commit   : 5d1f5079ab5308373420f0995864c09216de4e8f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 11 Jan 2026 13:52:50 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 11 Jan 2026 13:52:50 -0600    

Click here for diff

Oversight in commit 7a485bd641.  Per Coverity.  
  
Backpatch-through: 18  

M src/bin/pg_dump/pg_dump.c

doc: Improve description of pg_restore --jobs

commit   : 540c39cc56f51b27bff9a6fc78d6524564953c6c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 11 Jan 2026 15:24:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 11 Jan 2026 15:24:02 +0900    

Click here for diff

The parameter name used for the option value was named "number-of-jobs",  
which was inconsistent with what all the other tools with an option  
called --jobs use.  This commit updates the parameter name to "njobs".  
  
Author: Tatsuro Yamada <yamatattsu@gmail.com>  
Discussion: https://postgr.es/m/CAOKkKFvHqA6Tny0RKkezWVfVV91nPJyj4OGtMi3C1RznDVXqrg@mail.gmail.com  

M doc/src/sgml/ref/pg_restore.sgml

Fix some typos across the board

commit   : 1c0f6c387928a27f6c84cc0b79e141a3b97f4504    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 11 Jan 2026 08:16:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 11 Jan 2026 08:16:46 +0900    

Click here for diff

Found while browsing the code.  

M src/test/authentication/t/006_login_trigger.pl
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

instrumentation: Keep time fields as instrtime, convert in callers

commit   : e5a5e0a90750d665cab417322b9f85c806430d85    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Jan 2026 12:10:53 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Jan 2026 12:10:53 -0500    

Click here for diff

Previously the instrumentation logic always converted to seconds, only for  
many of the callers to do unnecessary division to get to milliseconds. As an  
upcoming refactoring will split the Instrumentation struct, utilize instrtime  
always to keep things simpler. It's also a bit faster to not have to first  
convert to a double in functions like InstrEndLoop(), InstrAggNode().  
  
Author: Lukas Fittl <lukas@fittl.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAP53PkzZ3UotnRrrnXWAv=F4avRq9MQ8zU+bxoN9tpovEu6fGQ@mail.gmail.com  

M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h
M src/include/portability/instr_time.h

Inline ginCompareAttEntries for speed

commit   : bba81f9d3d4f512280bd55751a450dac6f02d406    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 9 Jan 2026 20:31:43 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 9 Jan 2026 20:31:43 +0200    

Click here for diff

It is called in tight loops during GIN index build.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/5d366878-2007-4d31-861e-19294b7a583b@gmail.com  

M src/backend/access/gin/ginutil.c
M src/include/access/gin_private.h

doc: Improve description of publish_via_partition_root

commit   : e2aae8d68f6ba13a9ed9b2bd5d324a72a77ebe0b    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 9 Jan 2026 09:59:15 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Fri, 9 Jan 2026 09:59:15 -0800    

Click here for diff

Reword publish_via_partition_root's opening paragraph. Describe its  
behavior more clearly, and directly state that its default is false.  
  
Per complaint by Peter Smith; final text of the patch made in  
collaboration with Chao Li.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Author: Peter Smith <peter.b.smith@fujitsu.com>  
Reported-by: Peter Smith <peter.b.smith@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAHut%2BPu7SpK%2BctOYoqYR3V4w5LKc9sCs6c_qotk9uTQJQ4zp6g%40mail.gmail.com  
Backpatch-through: 14  

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

Improve "constraint must include all partitioning columns" message.

commit   : 7a1d422e39baac3627f5a67e7e16dcc6110830dc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Jan 2026 12:59:35 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Jan 2026 12:59:35 -0500    

Click here for diff

This formerly said "unique constraint must ...", which was accurate  
enough when it only applied to UNIQUE and PRIMARY KEY constraints.  
However, now we use it for exclusion constraints too, and in that  
case it's a tad confusing.  Do what we already did in the errdetail  
message: print the constraint_type, so that it looks like "UNIQUE  
constraint ...", "EXCLUDE constraint ...", etc.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CACJufxH6VhAf65Vghg4T2q315gY=Rt4BUfMyunkfRj0n2S9n-g@mail.gmail.com  

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

pg_dump: Fix gathering of sequence information.

commit   : 7a485bd641b7bbf072146b97f70f9eb2c89f606a    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 9 Jan 2026 10:12:54 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 9 Jan 2026 10:12:54 -0600    

Click here for diff

Since commit bd15b7db48, pg_dump uses pg_get_sequence_data() (née  
pg_sequence_read_tuple()) to gather all sequence data in a single  
query as opposed to a query per sequence.  Two related bugs have  
been identified:  
  
* If the user lacks appropriate privileges on the sequence, pg_dump  
generates a setval() command with garbage values instead of  
failing as expected.  
  
* pg_dump can fail due to a concurrently dropped sequence, even if  
the dropped sequence's data isn't part of the dump.  
  
This commit fixes the above issues by 1) teaching  
pg_get_sequence_data() to return nulls instead of erroring for a  
missing sequence and 2) teaching pg_dump to fail if it tries to  
dump the data of a sequence for which pg_get_sequence_data()  
returned nulls.  Note that pg_dump may still fail due to a  
concurrently dropped sequence, but it should now only do so when  
the sequence data is part of the dump.  This matches the behavior  
before commit bd15b7db48.  
  
Bug: #19365  
Reported-by: Paveł Tyślacki <pavel.tyslacki@gmail.com>  
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19365-6245240d8b926327%40postgresql.org  
Discussion: https://postgr.es/m/2885944.1767029161%40sss.pgh.pa.us  
Backpatch-through: 18  

M src/backend/commands/sequence.c
M src/bin/pg_dump/pg_dump.c

Use IsA() macro in define.c, for sake of consistency.

commit   : 24cb3a08a43b5a48f5fba4a83d297218e2e748c5    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 9 Jan 2026 20:24:00 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 9 Jan 2026 20:24:00 +0900    

Click here for diff

Commit 63d1b1cf7f1 replaced a direct nodeTag() comparison with the IsA()  
macro in copy.c, but a similar direct comparison remained in define.c.  
  
This commit replaces that comparison with IsA() for consistency.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwGjWGS89_sTx=sbPm0FQemyQQrfTKm=taUhAJFV5k-9cw@mail.gmail.com  

M src/backend/commands/define.c

Decouple C++ support in Meson's PGXS from LLVM enablement

commit   : 69d76fb2ab788d1715c82aece7b1dff10f483882    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 10:25:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 10:25:02 +0100    

Click here for diff

This is important for Postgres extensions that are written in C++,  
such as pg_duckdb, which uses PGXS as the build system currently.  In  
the autotools build, C++ is not coupled to LLVM.  If the autotools  
build is configured without --with-llvm, the C++ compiler and the  
various flags get persisted into the Makefile.global.  
  
Author: Tristan Partin <tristan@partin.io>  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io  

M meson.build
M src/include/meson.build
M src/makefiles/meson.build

ci: Configure g++ with 32-bit for 32-bit build

commit   : 831bbb9bf50561283ffb0bb0af1a0871dc227034    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 08:58:50 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 08:58:50 +0100    

Click here for diff

In future commits, we'll start to make improvements to C++  
infrastructure.  This requires that for our 32-bit builds we also  
build C++ code for the 32-bit architecture.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io  

M .cirrus.tasks.yml

meson: Rename cpp variable to cxx

commit   : 1f08d687c39607d8dfa4bfd0fcb1a6ad47a1ef56    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 08:58:23 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 9 Jan 2026 08:58:23 +0100    

Click here for diff

Since CPP is also used to mean C PreProcessor in our meson.build  
files, it's confusing to use it to also mean C PlusPlus.  This uses  
the non-ambiguous cxx wherever possible.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io  

M meson.build
M src/backend/meson.build

Fix possible incorrect column reference in ERROR message

commit   : 349107537d22a04c94c6fec5b993461178b39c13    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 9 Jan 2026 11:01:36 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 9 Jan 2026 11:01:36 +1300    

Click here for diff

When creating a partition for a RANGE partitioned table, the reporting  
of errors relating to converting the specified range values into  
constant values for the partition key's type could display the name of a  
previous partition key column when an earlier range was specified as  
MINVALUE or MAXVALUE.  
  
This was caused by the code not correctly incrementing the index that  
tracks which partition key the foreach loop was working on after  
processing MINVALUE/MAXVALUE ranges.  
  
Fix by using foreach_current_index() to ensure the index variable is  
always set to the List element being worked on.  
  
Author: myzhen <zhenmingyang@yeah.net>  
Reviewed-by: zhibin wang <killerwzb@gmail.com>  
Discussion: https://postgr.es/m/273cab52.978.19b96fc75e7.Coremail.zhenmingyang@yeah.net  
Backpatch-through: 14  

M src/backend/parser/parse_utilcmd.c

Remove now-useless btree_gist--1.2.sql script.

commit   : b8ccd29152f5e00250869499daab226f6ce55fdd    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 14:09:58 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 14:09:58 -0500    

Click here for diff

In the wake of the previous commit, this script will fail  
if executed via CREATE EXTENSION, so it's useless.  Remove it,  
but keep the delta scripts, allowing old (even very old)  
versions of the btree_gist SQL objects to be upgraded to 1.9  
via ALTER EXTENSION UPDATE after a pg_upgrade.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us  

M contrib/btree_gist/Makefile
D contrib/btree_gist/btree_gist–1.2.sql
M contrib/btree_gist/meson.build

Mark GiST inet_ops as opcdefault, and deal with ensuing fallout.

commit   : b352d3d80b94269be6e627b5223902fe785d766f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 14:03:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 14:03:56 -0500    

Click here for diff

This patch completes the transition to making inet_ops be default for  
inet/cidr columns, rather than btree_gist's opclasses.  Once we do  
that, though, pg_upgrade has a big problem.  A dump from an older  
version will see btree_gist's opclasses as being default, so it will  
not mention the opclass explicitly in CREATE INDEX commands, which  
would cause the restore to create the indexes using inet_ops.  Since  
that's not compatible with what's actually in the files, havoc would  
ensue.  
  
This isn't readily fixable, because the CREATE INDEX command strings  
are built by the older server's pg_get_indexdef() function; pg_dump  
hasn't nearly enough knowledge to modify those strings successfully.  
Even if we cared to put in the work to make that happen in pg_dump,  
it would be counterproductive because the end goal here is to get  
people off of these opclasses.  Allowing such indexes to persist  
through pg_upgrade wouldn't advance that goal.  
  
Therefore, this patch just adds code to pg_upgrade to detect indexes  
that would be problematic and refuse to upgrade.  
  
There's another issue too: even without any indexes to worry about,  
pg_dump in binary-upgrade mode will reproduce the "CREATE OPERATOR  
CLASS ... DEFAULT" commands for btree_gist's opclasses, and those  
will fail because now we have a built-in opclass that provides a  
conflicting default.  We could ask users to drop the btree_gist  
extension altogether before upgrading, but that would carry very  
severe penalties.  It would affect perfectly-valid indexes for other  
data types, and it would drop operators that might be relied on in  
views or other database objects.  Instead, put a hack in DefineOpClass  
to ignore the DEFAULT clauses for these opclasses when in  
binary-upgrade mode.  This will result in installing a version of  
btree_gist that isn't quite the version it claims to be, but that can  
be fixed by issuing ALTER EXTENSION UPDATE afterwards.  
  
Since we don't apply that hack when not in binary-upgrade mode,  
it is now impossible to install any version of btree_gist  
less than 1.9 via CREATE EXTENSION.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us  

M doc/src/sgml/btree-gist.sgml
M src/backend/commands/opclasscmds.c
M src/bin/pg_upgrade/check.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_opclass.dat
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm

Create btree_gist v1.9, in which inet/cidr opclasses aren't default.

commit   : b3b0b45717ef37205b301ae78e288ebeb43fe486    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 13:56:08 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 8 Jan 2026 13:56:08 -0500    

Click here for diff

btree_gist's gist_inet_ops and gist_cidr_ops opclasses are  
fundamentally broken: they rely on an approximate representation of  
the inet values and hence sometimes miss rows they should return.  
We want to eventually get rid of them altogether, but as the first  
step on that journey, we should mark them not-opcdefault.  
  
To do that, roll up the preceding deltas since 1.2 into a new base  
script btree_gist--1.9.sql.  This will allow installing 1.9 without  
going through a transient situation where gist_inet_ops and  
gist_cidr_ops are marked as opcdefault; trying to create them that  
way will fail if there's already a matching default opclass in the  
core system.  Additionally provide btree_gist--1.8--1.9.sql, so  
that a database that's been pg_upgraded from an older version can  
be migrated to 1.9.  
  
I noted along the way that commit 57e3c5160 had missed marking the  
gist_bool_ops support functions as PARALLEL SAFE.  While that probably  
has little harmful effect (since AFAIK we don't check that when  
calling index support functions), this seems like a good time to make  
things consistent.  
  
Readers will also note that I removed the former habit of installing  
some opclass operators/functions with ALTER OPERATOR FAMILY, instead  
just rolling them all into the CREATE OPERATOR CLASS steps.  The  
comment in btree_gist--1.2.sql that it's necessary to use ALTER for  
pg_upgrade reproducibility has been obsolete since we invented the  
amadjustmembers infrastructure.  Nowadays, gistadjustmembers will  
force all operators and non-required support functions to have "soft"  
opfamily dependencies, regardless of whether they are installed by  
CREATE or ALTER.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us  

M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.8–1.9.sql
A contrib/btree_gist/btree_gist–1.9.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/expected/cidr.out
M contrib/btree_gist/expected/inet.out
M contrib/btree_gist/meson.build
M contrib/btree_gist/sql/cidr.sql
M contrib/btree_gist/sql/inet.sql

Use IsA macro, for sake of consistency

commit   : 63d1b1cf7f1e3d7834d3914114c23c27023e6840    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:58:28 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:58:28 +0200    

Click here for diff

Reported-by: Shinya Kato <shinya11.kato@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAOzEurS=PzRzGba3mpNXgEhbnQFA0dxXaU0ujCJ0aa9yMSH6Pw@mail.gmail.com  

M src/backend/commands/copy.c

Fix misc typos, mostly in comments

commit   : ad853bb877370d406864380491dfe95672867c98    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:10:08 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:10:08 +0200    

Click here for diff

The only user-visible change is the fix in the "malformed  
pg_dependencies" error detail. That one is new in commit e1405aa5e3ac,  
so no backpatching required.  

M src/backend/replication/slot.c
M src/backend/storage/aio/aio_init.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/init/postinit.c
M src/common/unicode_norm.c
M src/include/lib/ilist.h
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/lock.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/pg_dependencies.out
M src/test/regress/expected/without_overlaps.out
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/lock.sql
M src/test/regress/sql/partition_join.sql
M src/test/regress/sql/without_overlaps.sql

Improve comments around _bt_checkkeys

commit   : d3304921db3022b531208b59581ee02ed0b1e695    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:10:05 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 8 Jan 2026 18:10:05 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/f5388839-99da-465a-8744-23cdfa8ce4db@iki.fi  

M src/backend/access/nbtree/nbtreadpage.c

Fix typos in the code.

commit   : 31ddbb38eeff60ad5353768c7416fea3a0ecafce    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Jan 2026 09:43:50 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Jan 2026 09:43:50 +0000    

Click here for diff

Author: "Dewei Dai" <daidewei1970@163.com>  
Author: zengman <zengman@halodbtech.com>  
Author: Zhiyuan Su <suzhiyuan_pg@126.com>  
Discussion: https://postgr.es/m/2026010719201902382410@163.com  
Discussion: https://postgr.es/m/tencent_4DC563C83443A4B1082D2BFF@qq.com  
Discussion: https://postgr.es/m/44656d72.2a63.19b9b92b0a3.Coremail.suzhiyuan_pg@126.com  

M src/backend/replication/logical/origin.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/cache/lsyscache.c

Remove use of rindex() function

commit   : 6ade3cd459f5d310a248be2047b2d321015058c3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 8 Jan 2026 08:45:59 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 8 Jan 2026 08:45:59 +0100    

Click here for diff

rindex() has been removed from POSIX 2008.  Replace the one remaining  
use with the equivalent and more standard strrchr().  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/98ce805c-6103-421b-adc3-fcf8f3dddbe3%40eisentraut.org  

M src/backend/jit/llvm/llvmjit.c

strnlen() is now required

commit   : 5e7abdac99136c63850a23c0dfdec24d81f503f1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 8 Jan 2026 08:45:59 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 8 Jan 2026 08:45:59 +0100    

Click here for diff

Remove all configure checks and workarounds for strnlen() missing.  It  
is required by POSIX 2008.  
  
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/98ce805c-6103-421b-adc3-fcf8f3dddbe3%40eisentraut.org  

M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/include/port.h
M src/port/meson.build
D src/port/strnlen.c

pg_createsubscriber: Improve handling of automated recovery configuration

commit   : 639352d904c8a3d233989253f569cccbea0be123    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 8 Jan 2026 10:12:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 8 Jan 2026 10:12:33 +0900    

Click here for diff

When repurposing a standby to a logical replica, pg_createsubscriber  
uses for the new replica a set of configuration parameters saved into  
postgresql.auto.conf, to force recovery patterns when the physical  
replica is promoted.  
  
While not wrong in practice, this approach can cause issues when forcing  
again recovery on a logical replica or its base backup as the recovery  
parameters are not reset on the target server once pg_createsubscriber  
is done with the node.  
  
This commit aims at improving the situation, by changing the way  
recovery parameters are saved on the target node.  Instead of writing  
all the configuration to postgresql.auto.conf, this file now uses an  
include_if_exists, that points to a pg_createsubscriber.conf.  This new  
file contains all the recovery configuration, and is renamed to  
pg_createsubscriber.conf.disabled when pg_createsubscriber exits.  This  
approach resets the recovery parameters, and offers the benefit to keep  
a trace of the setup used when the target node got promoted, for  
debugging purposes.  If pg_createsubscriber.conf cannot be renamed  
(unlikely scenario), a warning is issued to inform users that a manual  
intervention may be required to reset this configuration.  
  
This commit includes a test case to demonstrate the problematic case: a  
standby node created from a base backup of what was the target node of  
pg_createsubscriber does not get confused when started.  If removing  
this new logic, the test fails with the standby not able to start due  
to an incorrect recovery target setup, where the startup process fails  
quickly with a FATAL.  
  
I have provided the design idea for the patch, that Alyona has written  
(with some code adjustments from me).  This could be considered as a  
bug, but after discussion this is put into the bucket for improvements.  
Redesigning pg_createsubscriber would not be acceptable in the stable  
branches anyway.  
  
Author: Alyona Vinter <dlaaren8@gmail.com>  
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Andrey Rudometov <unlimitedhikari@gmail.com>  
Discussion: https://postgr.es/m/CAGWv16K6L6Pzm99i1KiXLjFWx2bUS3DVsR6yV87-YR9QO7xb3A@mail.gmail.com  

M doc/src/sgml/ref/pg_createsubscriber.sgml
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

psql: Add tab completion for pstdin and pstdout in \copy.

commit   : 28c4b8a05ba5431168e4bc8683f07e03ac911a2c    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 7 Jan 2026 16:22:42 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 7 Jan 2026 16:22:42 -0800    

Click here for diff

This commit adds tab completion support for the keywords "pstdin" and  
"pstdout" in the \copy command. "pstdin" is now suggested after FROM,  
and "pstdout" is suggested after TO, alongside filenames and other  
keywords.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/20251231183953.95132e171e43abd5e9b78084@sraoss.co.jp  

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

Replace flaky CIC/RI isolation tests with a TAP test

commit   : e1c971945d62d3150ecfe353ce7bb4263916b489    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 7 Jan 2026 19:44:57 -0300    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 7 Jan 2026 19:44:57 -0300    

Click here for diff

The isolation tests for INSERT ON CONFLICT behavior during CREATE INDEX  
CONCURRENTLY and REINDEX CONCURRENTLY (added by bc32a12e0db2,  
2bc7e886fc1b, and 90eae926abbb) were disabled in 77038d6d0b49 due to  
persistent CI flakiness, after several attempts at stabilization.  
  
This commit removes them and introduces a TAP test in test_misc module  
(010_index_concurrently_upsert.pl) that covers the same scenarios.  This  
new test should hopefully be more stable while providing assurance that  
the fixes in all those commits (plus 81f72115cf18) continue to work.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/ccssrhafzbp3a3beju3ptyc56a7gbfimj4vwkbokoldofckrc7@bso37rxskjtf  
Discussion: https://postgr.es/m/CANtu0ogv+6wqRzPK241jik4U95s1pW3MCZ3rX5ZqbFdUysz7Qw@mail.gmail.com  
Discussion: https://postgr.es/m/202512112014.icpomgc37zx4@alvherre.pgsql  

M src/test/modules/injection_points/Makefile
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
D src/test/modules/injection_points/expected/index-concurrently-upsert.out
D src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert-on-constraint.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert-partitioned.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert.out
M src/test/modules/injection_points/meson.build
D src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
D src/test/modules/injection_points/specs/index-concurrently-upsert.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert-on-constraint.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert.spec
M src/test/modules/test_misc/Makefile
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/010_index_concurrently_upsert.pl

MSVC: Support building for AArch64.

commit   : a516b3f00d7469cbd1885a2c5903fbd62430a2ac    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 7 Jan 2026 13:42:57 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 7 Jan 2026 13:42:57 -0600    

Click here for diff

This commit does the following to get tests passing for  
MSVC/AArch64:  
  
* Implements spin_delay() with an ISB instruction (like we do for  
gcc/clang on AArch64).  
  
* Sets USE_ARMV8_CRC32C unconditionally.  Vendor-supported versions  
of Windows for AArch64 require at least ARMv8.1, which is where CRC  
extension support became mandatory.  
  
* Implements S_UNLOCK() with _InterlockedExchange().  The existing  
implementation for MSVC uses _ReadWriteBarrier() (a compiler  
barrier), which is insufficient for this purpose on non-TSO  
architectures.  
  
There are likely other changes required to take full advantage of  
the hardware (e.g., atomics/arch-arm.h, simd.h,  
pg_popcount_aarch64.c), but those can be dealt with later.  
  
Author: Niyas Sait <niyas.sait@linaro.org>  
Co-authored-by: Greg Burd <greg@burd.me>  
Co-authored-by: Dave Cramer <davecramer@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Tested-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/A6152C7C-F5E3-4958-8F8E-7692D259FF2F%40greg.burd.me  
Discussion: https://postgr.es/m/CAFPTBD-74%2BAEuN9n7caJ0YUnW5A0r-KBX8rYoEJWqFPgLKpzdg%40mail.gmail.com  

M doc/src/sgml/installation.sgml
M meson.build
M src/include/storage/s_lock.h
M src/port/pg_crc32c_armv8.c
M src/tools/msvc_gendef.pl

Fix nbtree skip array transformation comments.

commit   : 8aed8e168fd2d2075a8f2622a980ed8991a69895    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 7 Jan 2026 12:53:07 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 7 Jan 2026 12:53:07 -0500    

Click here for diff

Fix comments that incorrectly described transformations performed by the  
"Avoid extra index searches through preprocessing" mechanism introduced  
by commit b3f1a13f.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-By: Chao Li <li.evan.chao@gmail.com>  
Reviewed-By: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/20251230190145.c3c88c5eb0f88b136adda92f@sraoss.co.jp  
Backpatch-through: 18  

M src/backend/access/nbtree/nbtpreprocesskeys.c

doc: Remove deprecated clauses from CREATE USER/GROUP syntax synopsis.

commit   : 1b795ef0329d64427f3e779e38c7c492c0a15e5d    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 8 Jan 2026 01:10:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 8 Jan 2026 01:10:36 +0900    

Click here for diff

The USER and IN GROUP clauses of CREATE ROLE are deprecated, and  
commit 8e78f0a1 removed them from the CREATE ROLE syntax syntax  
synopsis in the docs. However, previously CREATE USER and  
CREATE GROUP docs still listed these clauses.  
  
Since CREATE USER is equivalent to CREATE ROLE ... WITH LOGIN and  
CREATE GROUP is equivalent to CREATE ROLE, their documented syntax  
synopsis should match CREATE ROLE to avoid confusion.  
  
Therefore this commit removes the deprecated USER and IN GROUP  
clauses from the CREATE USER and CREATE GROUP syntax synopsis  
in the docs.  
  
Author: Japin Li <japinli@hotmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/MEAPR01MB3031C30E72EF16CFC08C8565B687A@MEAPR01MB3031.ausprd01.prod.outlook.com  

M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_user.sgml

Revert "Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()"

commit   : e54ce0b2da62ac71e3b2a5212f32e82b07bf39a5    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 7 Jan 2026 16:29:58 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 7 Jan 2026 16:29:58 +0200    

Click here for diff

This reverts commit f30848cb05d4d63e1a5a2d6a9d72604f3b63370d.  Due to  
buildfarm failures related to recovery conflicts while executing the  
WAIT FOR command.  It appears that WAIT FOR still holds xmin for a while.  
  
Reported-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL0OQR8dQtsNBSaA3FNNyQeFabdeRVzurm0b7Xtp592g%40mail.gmail.com  

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

Fix typo

commit   : 6675f41c18a7730d90d29a3c4c2ed9e1021f64e0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jan 2026 15:47:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Jan 2026 15:47:02 +0100    

Click here for diff

Reported-by: Xueyu Gao <gaoxueyu_hope@163.com>  
Discussion: https://www.postgresql.org/message-id/42b5c99a.856d.19b73d858e2.Coremail.gaoxueyu_hope%40163.com  

M .cirrus.tasks.yml

createuser: Update docs to reflect defaults

commit   : ece25c2611d2a58fdeed07b6a42b607e5e99910b    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 7 Jan 2026 16:02:19 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 7 Jan 2026 16:02:19 +0700    

Click here for diff

Commit c7eab0e97 changed the default password_encryption setting to  
'scram-sha-256', so update the example for creating a user with an  
assigned password.  
  
In addition, commit 08951a7c9 added new options that in turn pass  
default tokens NOBYPASSRLS and NOREPLICATION to the CREATE ROLE  
command, so fix this omission as well for v16 and later.  
  
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/cff1ea60-c67d-4320-9e33-094637c2c4fb%40iki.fi  
Backpatch-through: 14  

M doc/src/sgml/ref/createuser.sgml

Fix unexpected reversal of lists during catcache rehash

commit   : 68119480a763d761a9cf2413f4320d9a5d4b34d5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 17:52:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 17:52:54 +0900    

Click here for diff

During catcache searches, the most-recently searched entries are kept at  
the head of the list to speed up subsequent searches, keeping the  
"freshest" entries at its beginning.  A rehash of the catcache was doing  
the opposite: fresh entries were moved to the tail of the newly-created  
buckets, causing a rehash to slow down a bit.  
  
When a rehash is done, this commit switches the code to use  
dlist_push_tail() instead of dlist_push_head(), so as fresh entries are  
kept at the head of the lists, not their tail.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/tencent_9EA10D8512B5FE29E7323F780A0749768708@qq.com  

M src/backend/utils/cache/catcache.c

Fix grammar in datatype.sgml

commit   : ba887a8cdb5b4ebaebd7d5c9ce790563659e710e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 14:13:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 14:13:18 +0900    

Click here for diff

Introduced in b139bd3b6ef0.  
  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/tencent_121C1BB152CAF3195C99D56C@qq.com  

M doc/src/sgml/datatype.sgml

Further doc updates to reflect MD5 deprecation

commit   : e171405afe951f67d289b1d846c0895d589ef800    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 7 Jan 2026 11:55:01 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 7 Jan 2026 11:55:01 +0700    

Click here for diff

Followup to 44f49511b.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/CAHGQGwH_UfN96vcvLGA%3DYro%2Bo6qCn0nEgEGoviwzEiLTHtt2Pw%40mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml

doc: Add glossary and index entries for GUC.

commit   : 0a7c37b847e239c2709db5ada78ac62e078c94d2    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 7 Jan 2026 13:58:07 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 7 Jan 2026 13:58:07 +0900    

Click here for diff

GUC is a commonly used term but previously appeared only  
in the acronym documentation. This commit adds glossary and  
documentation index entries for GUC to make it easier to find  
and understand.  
  
Author: Robert Treat <rob@xzilla.net>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CABV9wwPQnkeo_G6-orMGnHPK9SXGVWm7ajJPzsbE6944tDx=hQ@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/glossary.sgml

doc: Add index entry for Git.

commit   : 466347ad28d858ff49b36b9a5b1e98ea9ce5d58c    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 7 Jan 2026 13:57:36 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 7 Jan 2026 13:57:36 +0900    

Click here for diff

This commit adds Git to the documentation index, pointing to  
the source code repository documentation.  
  
Author: Robert Treat <rob@xzilla.net>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/CABV9wwPQnkeo_G6-orMGnHPK9SXGVWm7ajJPzsbE6944tDx=hQ@mail.gmail.com  

M doc/src/sgml/sourcerepo.sgml

Improve portability of test with oid8 comparison function

commit   : a2e632ece1691be18771644182f769b525991f97    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 12:55:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 12:55:16 +0900    

Click here for diff

Oversight in b139bd3b6ef0, per reports from buildfarm members longfin  
and prion, that use -DSTRESS_SORT_INT_MIN.  Thanks to Tom Lane for the  
poke.  
  
Discussion: https://postgr.es/m/1656709.1767754981@sss.pgh.pa.us  

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

Add data type oid8, 64-bit unsigned identifier

commit   : b139bd3b6ef000ab5d00dd47128e366a726da5f9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 11:37:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 7 Jan 2026 11:37:00 +0900    

Click here for diff

This new identifier type provides support for 64-bit unsigned values,  
to be used in catalogs, like OIDs.  An advantage of a new data type is  
that it becomes easier to grep for it in the code when assigning this  
type to a catalog attribute, linking it to dedicated APIs and internal  
structures.  
  
The following operators are added in this commit, with dedicated tests:  
- Casts with integer types and OID.  
- btree and hash operators  
- min/max functions.  
- C type with related macros and defines, named around "Oid8".  
  
This has been mentioned as useful on its own on the thread to add  
support for 64-bit TOAST values, so as it becomes possible to attach  
this data type to the TOAST code and catalog definitions.  However, as  
this concept can apply to many more areas, it is implemented as its own  
independent change.  This is based on a discussion with Andres Freund  
and Tom Lane.  
  
Bump catalog version.  
  
Author: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Greg Burd <greg@burd.me>  
Reviewed-by: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>  
Discussion: https://postgr.es/m/1891064.1754681536@sss.pgh.pa.us  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/func/func-aggregate.sgml
M src/backend/access/nbtree/nbtcompare.c
M src/backend/bootstrap/bootstrap.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/oid8.c
M src/fe_utils/print.c
M src/include/c.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/fmgr.h
M src/include/postgres.h
M src/test/regress/expected/hash_func.out
A src/test/regress/expected/oid8.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/hash_func.sql
A src/test/regress/sql/oid8.sql
M src/test/regress/sql/type_sanity.sql

Clean up ICU includes.

commit   : af2d4ca191a4552217eceace21fde6ebc2b85770    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 6 Jan 2026 17:19:51 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 6 Jan 2026 17:19:51 -0800    

Click here for diff

Remove ICU includes from pg_locale.h, and instead include them in the  
few C files that need ICU. Clean up a few other includes in passing.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/48911db71d953edec66df0d2ce303563d631fbe0.camel@j-davis.com  

M src/backend/commands/collationcmds.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/varlena.c
M src/include/utils/pg_locale.h

Fix buggy interaction between array subscripts and subplan params

commit   : 75609fded35e4d95a0e8b9875a46a496a03437cf    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 6 Jan 2026 19:51:10 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 6 Jan 2026 19:51:10 -0500    

Click here for diff

In a7f107df2 I changed subplan param evaluation to happen within the  
containing expression. As part of that, ExecInitSubPlanExpr() was changed to  
evaluate parameters via a new EEOP_PARAM_SET expression step. These parameters  
were temporarily stored into ExprState->resvalue/resnull, with some reasoning  
why that would be fine. Unfortunately, that analysis was wrong -  
ExecInitSubscriptionRef() evaluates the input array into "resv"/"resnull",  
which will often point to ExprState->resvalue/resnull. This means that the  
EEOP_PARAM_SET, if inside an array subscript, would overwrite the input array  
to array subscript.  
  
The fix is fairly simple - instead of evaluating into  
ExprState->resvalue/resnull, store the temporary result of the subplan in the  
subplan's return value.  
  
Bug: #19370  
Reported-by: Zepeng Zhang <redraiment@gmail.com>  
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Diagnosed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/19370-7fb7a5854b7618f1@postgresql.org  
Backpatch-through: 18  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql

ICU: use UTF8-optimized case conversion API

commit   : c4ff35f10441de7dbed4e87737bca205dcca698e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 6 Jan 2026 14:09:07 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 6 Jan 2026 14:09:07 -0800    

Click here for diff

Initializes a UCaseMap object once for use across calls, and uses  
UTF8-optimized APIs.  
  
Author: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/5a010b27-8ed9-4739-86fe-1562b07ba564@proxel.se  

M src/backend/utils/adt/pg_locale_icu.c
M src/common/unicode/case_test.c
M src/include/utils/pg_locale.h
M src/tools/pgindent/typedefs.list

Improve portability of new worker_spi test

commit   : 0547aeae0fd6f6d03dd7499c84145ad9e3aa51b9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 20:24:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 20:24:17 +0900    

Click here for diff

The new test 002_worker_terminate relies on the generation of a LOG  
entry to check that a worker has been started, but missed the fact that  
a node set with log_error_verbosity = verbose would add an error code.  
The regexp used for the matching check did not take this case into  
account, making the test fail on a timeout.  The regexp is now fixed to  
handle the verbose case correctly.  
  
Per buildfarm member prion, that uses log_error_verbosity = verbose.  
The error was reproducible by setting this GUC the same way in the test.  
  
Oversight in f1e251be80a0.  

M src/test/modules/worker_spi/t/002_worker_terminate.pl

Add test coverage for indirection transformation

commit   : 64492917280a1f6227ed9cf43d39095e2cec5cab    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 6 Jan 2026 09:37:19 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 6 Jan 2026 09:37:19 +0100    

Click here for diff

These tests cover nested arrays of composite data types,  
single-argument functions, and casting using dot-notation, providing a  
baseline for future enhancements to jsonb dot-notation support.  
  
Author: Alexandra Wang <alexandra.wang.oss@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAK98qZ1JNNAx4QneJG+eX7iLesOhd6A68FNQVvvHP6Up_THf3A@mail.gmail.com  

M src/test/regress/expected/arrays.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/jsonb.sql

Fix variable usage in wakeupWaiters()

commit   : bf308639bfcfa38541e24733e074184153a8ab7f    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 6 Jan 2026 10:03:26 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Tue, 6 Jan 2026 10:03:26 +0200    

Click here for diff

Mistakenly, `i` was used both as an integer representation of lsnType and  
an index in wakeUpProcs array.  
  
Discussion: https://postgr.es/m/CA%2BhUKG%2BL0OQR8dQtsNBSaA3FNNyQeFabdeRVzurm0b7Xtp592g%40mail.gmail.com  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Ruikai Peng <ruikai@pwno.io>  

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

Use relation_close() more consistently in contrib/

commit   : 8b9b93e39b10ce32577eca3c84face880fc8aff0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 16:17:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 16:17:59 +0900    

Click here for diff

All the code paths updated here have been using index_close() to  
close a relation that was opened with relation_open(), in pgstattuple  
and pageinspect.  index_close() does the same thing as relation_close(),  
so there is no harm, but being inconsistent could lead to issues if the  
internals of these close() functions begin to introduce some specific  
logic in the future.  
  
In passing, this commit adds some comments explaining why we are using  
relation_open() instead of index_open() in a few places, which is due to  
the fact that partitioned indexes are not allowed in these functions.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Discussion: https://postgr.es/m/aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal  

M contrib/pageinspect/hashfuncs.c
M contrib/pgstattuple/pgstatindex.c

commit   : f1e251be80a05cb66191d5ea48f2cdc3acff72b5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 14:24:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 14:24:29 +0900    

Click here for diff

Background workers gain a new flag, called BGWORKER_INTERRUPTIBLE, that  
offers the possibility to terminate the workers when these are connected  
to a database that is involved in one of the following commands:  
ALTER DATABASE RENAME TO  
ALTER DATABASE SET TABLESPACE  
CREATE DATABASE  
DROP DATABASE  
  
This is useful to give background workers the same behavior as backends  
and autovacuum workers, which are stopped when these commands are  
executed.  The default behavior, that exists since 9.3, is still to  
never terminate bgworkers connected to the database involved in any of  
these commands.  The new flag has to be set to terminate the workers.  
  
A couple of tests are added to worker_spi to track the commands that  
impact the termination of the workers.  There is a test case for a  
non-interruptible worker, additionally, that relies on an injection  
point to make the wait time in CountOtherDBBackends() reduced from 5s to  
0.3s for faster test runs.  The tests rely on the contents of the server  
logs to check if a worker has been started or terminated:  
- LOG generated by worker_spi_main() at startup, once connection to  
database is done.  
- FATAL in bgworker_die() when terminated.  
A couple of tests run in the CI have showed that this method is stable  
enough.  The safe_psql() calls that scan pg_stat_activity could be  
replaced with some poll_query_until() for more stability, if the current  
method proves to be an issue in the buildfarm.  
  
Author: Aya Iwata <iwata.aya@fujitsu.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Ryo Matsumura <matsumura.ryo@fujitsu.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/OS7PR01MB11964335F36BE41021B62EAE8EAE4A@OS7PR01MB11964.jpnprd01.prod.outlook.com  

M doc/src/sgml/bgworker.sgml
M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/procarray.c
M src/include/postmaster/bgworker.h
M src/test/modules/worker_spi/Makefile
M src/test/modules/worker_spi/meson.build
A src/test/modules/worker_spi/t/002_worker_terminate.pl
M src/test/modules/worker_spi/worker_spi–1.0.sql
M src/test/modules/worker_spi/worker_spi.c

Update comments atop ReplicationSlotCreate.

commit   : c970bdc037f4f35f1ff852b4c032f5fb3f6f6622    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 6 Jan 2026 05:02:25 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 6 Jan 2026 05:02:25 +0000    

Click here for diff

Since commit 1462aad2e4, which introduced the ability to modify the  
two_phase property of a slot, the comments above ReplicationSlotCreate  
have become outdated. We have now added a cautionary note in the comments  
above ReplicationSlotAlter explaining when it is safe to modify the  
two_phase property of a slot.  
  
Author: Daniil Davydov <3danissimo@gmail.com>  
Author: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/CAJDiXggZXQZ7bD0QcTizDt6us9aX6ZKK4dWxzgb5x3+TsVHjqQ@mail.gmail.com  

M src/backend/replication/slot.c

Fix issue with EVENT TRIGGERS and ALTER PUBLICATION

commit   : 6ca8506ea59e396b0efa43edf439d4d3c77d8311    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 17:29:12 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 17:29:12 +1300    

Click here for diff

When processing the "publish" options of an ALTER PUBLICATION command,  
we call SplitIdentifierString() to split the options into a List of  
strings.  Since SplitIdentifierString() modifies the delimiter  
character and puts NULs in their place, this would overwrite the memory  
of the AlterPublicationStmt.  Later in AlterPublicationOptions(), the  
modified AlterPublicationStmt is copied for event triggers, which would  
result in the event trigger only seeing the first "publish" option  
rather than all options that were specified in the command.  
  
To fix this, make a copy of the string before passing to  
SplitIdentifierString().  
  
Here we also adjust a similar case in the pgoutput plugin.  There's no  
known issues caused by SplitIdentifierString() here, so this is being  
done out of paranoia.  
  
Thanks to Henson Choi for putting together an example case showing the  
ALTER PUBLICATION issue.  
  
Author: sunil s <sunilfeb26@gmail.com>  
Reviewed-by: Henson Choi <assam258@gmail.com>  
Reviewed-by: zengman <zengman@halodbtech.com>  
Backpatch-through: 14  

M src/backend/commands/publicationcmds.c
M src/backend/replication/pgoutput/pgoutput.c

Fix typo in slot.c.

commit   : 63ed3bc7f9a66035e0b741aaa542de35a90fe1cc    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 6 Jan 2026 04:13:40 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 6 Jan 2026 04:13:40 +0000    

Click here for diff

Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/AC9B87F1-ED04-4547-B85C-9443B4253A08@gmail.com  
Discussion: https://postgr.es/m/CAJDiXggZXQZ7bD0QcTizDt6us9aX6ZKK4dWxzgb5x3+TsVHjqQ@mail.gmail.com  

M src/backend/replication/slot.c

Fix typo in planner.c

commit   : ae283736025c2d0b41a4106788b4e45ffba6c82d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 12:30:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Jan 2026 12:30:01 +0900    

Click here for diff

b8cfcb9e00da did not get this change right.  
  
Author: Alexander Law <exclusion@gmail.com>  
Discussion: https://postgr.es/m/CAJ0YPFFWhJXs-e-=7iJz-FLp=b1dXfJA_qtrVAgto=bZmzD9zQ@mail.gmail.com  

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

Add TAP test for GUC settings passed via CONNECTION in logical replication.

commit   : 5f13999aa11d95018dd9ff5c41aad4bcb15d4222    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:57:12 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:57:12 +0900    

Click here for diff

Commit d926462d819 restored the behavior of passing GUC settings from  
the CONNECTION string to the publisher's walsender, allowing per-connection  
configuration.  
  
This commit adds a TAP test to verify that behavior works correctly.  
  
Since commit d926462d819 was recently applied and backpatched to v15,  
this follow-up commit is also backpatched accordingly.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <lic@highgo.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Discussion: https://postgr.es/m/CAHGQGwGYV+-abbKwdrM2UHUe-JYOFWmsrs6=QicyJO-j+-Widw@mail.gmail.com  
Backpatch-through: 15  

M src/test/subscription/t/001_rep_changes.pl

Honor GUC settings specified in CREATE SUBSCRIPTION CONNECTION.

commit   : d926462d8190a81cc1f39c7fce65055f329e9419    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:52:22 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:52:22 +0900    

Click here for diff

Prior to v15, GUC settings supplied in the CONNECTION clause of  
CREATE SUBSCRIPTION were correctly passed through to  
the publisher's walsender. For example:  
  
        CREATE SUBSCRIPTION mysub  
            CONNECTION 'options=''-c wal_sender_timeout=1000'''  
            PUBLICATION ...  
  
would cause wal_sender_timeout to take effect on the publisher's walsender.  
  
However, commit f3d4019da5d changed the way logical replication  
connections are established, forcing the publisher's relevant  
GUC settings (datestyle, intervalstyle, extra_float_digits) to  
override those provided in the CONNECTION string. As a result,  
from v15 through v18, GUC settings in the CONNECTION string were  
always ignored.  
  
This regression prevented per-connection tuning of logical replication.  
For example, using a shorter timeout for walsender connecting  
to a nearby subscriber and a longer one for walsender connecting  
to a remote subscriber.  
  
This commit restores the intended behavior by ensuring that  
GUC settings in the CONNECTION string are again passed through  
and applied by the walsender, allowing per-connection configuration.  
  
Backpatch to v15, where the regression was introduced.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Chao Li <lic@highgo.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Discussion: https://postgr.es/m/CAHGQGwGYV+-abbKwdrM2UHUe-JYOFWmsrs6=QicyJO-j+-Widw@mail.gmail.com  
Backpatch-through: 15  

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

Simplify GetOperatorFromCompareType() code

commit   : 7f9acc9bccfe2dc4d7d8ba75057c91ef09a7ebf2    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 15:25:13 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 15:25:13 +1300    

Click here for diff

The old code would set *opid = InvalidOid to determine if the  
get_opclass_opfamily_and_input_type() worked or not.  This means more  
moving parts that what's really needed here.  Let's just fail  
immediately if the get_opclass_opfamily_and_input_type() lookup fails.  
  
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>  
Discussion: https://postgr.es/m/CA+renyXOrjLacP_nhqEQUf2W+ZCoY2q5kpQCfG05vQVYzr8b9w@mail.gmail.com  

M src/backend/commands/indexcmds.c

Fix misleading comment for GetOperatorFromCompareType

commit   : e8d4e94a47ea0f02e180208ec7daf03bdd2f751e    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 15:16:14 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 15:16:14 +1300    

Click here for diff

The comment claimed *strat got set to InvalidStrategy when the function  
lookup fails.  This isn't true; an ERROR is raised when that happens.  
  
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>  
Discussion: https://postgr.es/m/CA+renyXOrjLacP_nhqEQUf2W+ZCoY2q5kpQCfG05vQVYzr8b9w@mail.gmail.com  
Backpatch-through: 18  

M src/backend/commands/indexcmds.c

doc: Fix outdated doc in pg_rewind.

commit   : b9ee5f2dcba2ae2e6bfca6c873fb2708970f2c81    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:00:54 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Tue, 6 Jan 2026 11:00:54 +0900    

Click here for diff

Update pg_rewind documentation to reflect the change that data checksums are  
now enabled by default during initdb.  
  
Backpatch to v18, where data checksums were changed to be enabled by default.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/TY4PR01MB16907D62F3A0A377B30FDBEA794B2A@TY4PR01MB16907.jpnprd01.prod.outlook.com  
Backpatch-through: 18  

M doc/src/sgml/ref/pg_rewind.sgml

Clarify where various catcache.h dlist_nodes are used

commit   : c5af141cd4344d52ad8afbd6ecffe509227559a9    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 14:39:36 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Jan 2026 14:39:36 +1300    

Click here for diff

Also remove a comment which mentions we don't currently divide the  
per-cache lists into hash buckets.  Since 473182c95, we do.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Discussion: https://postgr.es/m/tencent_7732789707C8768EA13785A7B5EA29103208@qq.com  

M src/include/utils/catcache.h

pg_visibility: Fix incorrect buffer lock description in comment.

commit   : e212a0f8e6ba95b403aa0ceacc05793449f5e742    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 5 Jan 2026 15:49:43 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 5 Jan 2026 15:49:43 -0800    

Click here for diff

Although the comment in collect_corrupt_items() stated that the buffer  
is locked in exclusive mode, it is actually locked in shared mode.  
  
Author: Chao Li <lic@highgo.com>  
Discussion: https://postgr.es/m/CAEoWx2kkhxgfp=kinPMetnwHaa0JjR6YBkO_0gg0oiy6mu7Zjw@mail.gmail.com  

M contrib/pg_visibility/pg_visibility.c

Fix meson build of snowball code.

commit   : b85d5dc0e7e9d0857aaf4ba712fc2186e7684e5f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 5 Jan 2026 16:51:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 5 Jan 2026 16:51:36 -0500    

Click here for diff

include/snowball/libstemmer has to be in the -I search path,  
as it is in the autoconf build.  It's not apparent to me how  
this ever worked before, nor why my recent commit made it  
stop working.  
  
Discussion: https://postgr.es/m/ld2iurl7kzexwydxmdfhdgarpa7xxsfrgvggqhbblt4rvt3h6t@bxsk6oz5x7cc  

M src/backend/snowball/meson.build

Update to latest Snowball sources.

commit   : 7dc95cc3b94f2f558606e5ec307466a4e3dbc832    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 5 Jan 2026 15:22:12 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 5 Jan 2026 15:22:12 -0500    

Click here for diff

It's been almost a year since we last did this, and upstream has  
been busy.  They've added stemmers for Polish and Esperanto,  
and also deprecated their old Dutch stemmer in favor of the  
Kraaij-Pohlmann algorithm.  (The "dutch" stemmer is now the  
latter, and "dutch_porter" is the old algorithm.)  
  
Upstream also decided to rename their internal header "header.h"  
to something less generic: "snowball_runtime.h".  Seems like a good  
thing, but it complicates this patch a bit because we were relying on  
interposing our own version of "header.h" to control system header  
inclusion order.  (We're partially failing at that now, because now the  
generated stemmer files include <stddef.h> before snowball_runtime.h.  
I think that'll be okay, but if the buildfarm complains then we'll  
have to do more-extensive editing of the generated files.)  
  
I realized that we weren't documenting the available stemmers in  
any user-visible place, except indirectly through sample \dFd output.  
That's incomplete because we only provide built-in dictionaries for  
the recommended stemmers for each language, not alternative stemmers  
such as dutch_porter.  So I added a list to the documentation.  
  
I did not do anything with the stopword lists.  If those are still  
available from snowballstem.org, they are mighty well hidden.  
  
Discussion: https://postgr.es/m/1185975.1767569534@sss.pgh.pa.us  

M doc/src/sgml/textsearch.sgml
M src/backend/snowball/Makefile
M src/backend/snowball/README
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/libstemmer/api.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_basque.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_catalan.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c
A src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_indonesian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_irish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_swedish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_2_hungarian.c
A src/backend/snowball/libstemmer/stem_ISO_8859_2_polish.c
M src/backend/snowball/libstemmer/stem_KOI8_R_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_arabic.c
M src/backend/snowball/libstemmer/stem_UTF_8_armenian.c
M src/backend/snowball/libstemmer/stem_UTF_8_basque.c
M src/backend/snowball/libstemmer/stem_UTF_8_catalan.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_dutch.c
A src/backend/snowball/libstemmer/stem_UTF_8_dutch_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_english.c
A src/backend/snowball/libstemmer/stem_UTF_8_esperanto.c
M src/backend/snowball/libstemmer/stem_UTF_8_estonian.c
M src/backend/snowball/libstemmer/stem_UTF_8_finnish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_german.c
M src/backend/snowball/libstemmer/stem_UTF_8_greek.c
M src/backend/snowball/libstemmer/stem_UTF_8_hindi.c
M src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c
M src/backend/snowball/libstemmer/stem_UTF_8_indonesian.c
M src/backend/snowball/libstemmer/stem_UTF_8_irish.c
M src/backend/snowball/libstemmer/stem_UTF_8_italian.c
M src/backend/snowball/libstemmer/stem_UTF_8_lithuanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_nepali.c
M src/backend/snowball/libstemmer/stem_UTF_8_norwegian.c
A src/backend/snowball/libstemmer/stem_UTF_8_polish.c
M src/backend/snowball/libstemmer/stem_UTF_8_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c
M src/backend/snowball/libstemmer/stem_UTF_8_romanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_serbian.c
M src/backend/snowball/libstemmer/stem_UTF_8_spanish.c
M src/backend/snowball/libstemmer/stem_UTF_8_swedish.c
M src/backend/snowball/libstemmer/stem_UTF_8_tamil.c
M src/backend/snowball/libstemmer/stem_UTF_8_turkish.c
M src/backend/snowball/libstemmer/stem_UTF_8_yiddish.c
M src/backend/snowball/libstemmer/utilities.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball_create.pl
M src/bin/initdb/initdb.c
M src/include/snowball/libstemmer/api.h
D src/include/snowball/libstemmer/header.h
A src/include/snowball/libstemmer/snowball_runtime.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_basque.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_catalan.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_danish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_dutch.h
A src/include/snowball/libstemmer/stem_ISO_8859_1_dutch_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_english.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_finnish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_french.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_german.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_indonesian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_irish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_italian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_norwegian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_portuguese.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_spanish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_swedish.h
M src/include/snowball/libstemmer/stem_ISO_8859_2_hungarian.h
A src/include/snowball/libstemmer/stem_ISO_8859_2_polish.h
M src/include/snowball/libstemmer/stem_KOI8_R_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_arabic.h
M src/include/snowball/libstemmer/stem_UTF_8_armenian.h
M src/include/snowball/libstemmer/stem_UTF_8_basque.h
M src/include/snowball/libstemmer/stem_UTF_8_catalan.h
M src/include/snowball/libstemmer/stem_UTF_8_danish.h
M src/include/snowball/libstemmer/stem_UTF_8_dutch.h
A src/include/snowball/libstemmer/stem_UTF_8_dutch_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_english.h
A src/include/snowball/libstemmer/stem_UTF_8_esperanto.h
M src/include/snowball/libstemmer/stem_UTF_8_estonian.h
M src/include/snowball/libstemmer/stem_UTF_8_finnish.h
M src/include/snowball/libstemmer/stem_UTF_8_french.h
M src/include/snowball/libstemmer/stem_UTF_8_german.h
M src/include/snowball/libstemmer/stem_UTF_8_greek.h
M src/include/snowball/libstemmer/stem_UTF_8_hindi.h
M src/include/snowball/libstemmer/stem_UTF_8_hungarian.h
M src/include/snowball/libstemmer/stem_UTF_8_indonesian.h
M src/include/snowball/libstemmer/stem_UTF_8_irish.h
M src/include/snowball/libstemmer/stem_UTF_8_italian.h
M src/include/snowball/libstemmer/stem_UTF_8_lithuanian.h
M src/include/snowball/libstemmer/stem_UTF_8_nepali.h
M src/include/snowball/libstemmer/stem_UTF_8_norwegian.h
A src/include/snowball/libstemmer/stem_UTF_8_polish.h
M src/include/snowball/libstemmer/stem_UTF_8_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_portuguese.h
M src/include/snowball/libstemmer/stem_UTF_8_romanian.h
M src/include/snowball/libstemmer/stem_UTF_8_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_serbian.h
M src/include/snowball/libstemmer/stem_UTF_8_spanish.h
M src/include/snowball/libstemmer/stem_UTF_8_swedish.h
M src/include/snowball/libstemmer/stem_UTF_8_tamil.h
M src/include/snowball/libstemmer/stem_UTF_8_turkish.h
M src/include/snowball/libstemmer/stem_UTF_8_yiddish.h
R070 src/include/snowball/header.h src/include/snowball/snowball_runtime.h

ci: Remove ulimit -p for netbsd/openbsd

commit   : bb048e31dc17202faaab37132420a0740f9ca85c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 5 Jan 2026 13:09:03 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 5 Jan 2026 13:09:03 -0500    

Click here for diff

Previously the ulimit -p 256 was needed to increase the limit on  
openbsd. However, sometimes the limit actually was too low, causing  
  "could not fork new process for connection: Resource temporarily unavailable"  
errors.  Most commonly on netbsd, but also on openbsd.  
  
The ulimit on openbsd couldn't trivially be increased with ulimit, because of  
hitting the hard limit.  
  
Instead of increasing the limit in the CI script, the CI image generation now  
increases the limits: https://github.com/anarazel/pg-vm-images/pull/129  
  
Backpatch-through: 18  

M .cirrus.tasks.yml

Fix typo in parallel.c.

commit   : d351063e49ac79399338b3aa5b9da39cde746030    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 5 Jan 2026 10:16:28 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 5 Jan 2026 10:16:28 -0800    

Click here for diff

Author: kelan <ke_lan1@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/tencent_38B5875E2D440C8DA8C0C022ABD999F9C207@qq.com  

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

Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()

commit   : f30848cb05d4d63e1a5a2d6a9d72604f3b63370d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:41:31 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:41:31 +0200    

Click here for diff

When the standby is passed as a PostgreSQL::Test::Cluster instance,  
use the WAIT FOR LSN command on the standby server to implement  
wait_for_catchup() for replay, write, and flush modes.  This is more  
efficient than polling pg_stat_replication on the upstream, as the  
WAIT FOR LSN command uses a latch-based wakeup mechanism.  
  
The optimization applies when:  
- The standby is passed as a Cluster object (not just a name string)  
- The mode is 'replay', 'write', or 'flush' (not 'sent')  
- The standby is in recovery  
  
For 'sent' mode, when the standby is passed as a string (e.g., a  
subscription name for logical replication), or when the standby has  
been promoted, the function falls back to the original polling-based  
approach using pg_stat_replication on the upstream.  
  
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  

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

Add tab completion for the WAIT FOR LSN MODE option

commit   : 76948337f724fe92c937d3ccefe2cd08a45f4734    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:41:09 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:41:09 +0200    

Click here for diff

Update psql tab completion to support the optional MODE option in the  
WAIT FOR LSN command.  After specifying an LSN value, completion now offers  
both MODE and WITH keywords.  The MODE option specifies which LSN type to wait  
for.  In particular, it controls whether the wait is evaluated from the  
standby or primary perspective.  
  
When MODE is specified, the completion suggests the valid mode values:  
standby_replay, standby_write, standby_flush, and primary_flush.  
  
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  

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

Add the MODE option to the WAIT FOR LSN command

commit   : 49a181b5d634340fcfb7c762c387c03f6405367e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:40:44 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:40:44 +0200    

Click here for diff

This commit extends the WAIT FOR LSN command with an optional MODE option in  
the WITH clause that specifies which LSN type to wait for:  
  
  WAIT FOR LSN '<lsn>' [WITH (MODE '<mode>', ...)]  
  
where mode can be:  
 - 'standby_replay' (default): Wait for WAL to be replayed to the specified  
   LSN,  
 - 'standby_write': Wait for WAL to be written (received) to the specified  
   LSN,  
 - 'standby_flush': Wait for WAL to be flushed to disk at the specified LSN,  
 - 'primary_flush': Wait for WAL to be flushed to disk on the primary server.  
  
The default mode is 'standby_replay', matching the original behavior when MODE  
is not specified. This follows the pattern used by COPY and EXPLAIN  
commands, where options are specified as string values in the WITH clause.  
  
Modes are explicitly named to distinguish between primary and standby  
operations:  
- Standby modes ('standby_replay', 'standby_write', 'standby_flush') can only  
  be used during recovery (on a standby server),  
- Primary mode ('primary_flush') can only be used on a primary server.  
  
The 'standby_write' and 'standby_flush' modes are useful for scenarios where  
applications need to ensure WAL has been received or persisted on the standby  
without necessarily waiting for replay to complete. The 'primary_flush' mode  
allows waiting for WAL to be flushed on the primary server.  
  
This commit also includes includes:  
- Documentation updates for the new syntax and mode descriptions,  
- Test coverage for all four modes, including error cases and concurrent  
  waiters,  
- Wakeup logic in walreceiver for standby write/flush waiters,  
- Wakeup logic in WAL writer for primary flush waiters.  
  
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  

M doc/src/sgml/ref/wait_for.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/wait.c
M src/backend/replication/walreceiver.c
M src/test/recovery/t/049_wait_for_lsn.pl

Extend xlogwait infrastructure with write and flush wait types

commit   : 7a39f43d885b44a78f366aa50535944c4e38bdbb    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:40:31 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:40:31 +0200    

Click here for diff

Add support for waiting on WAL write and flush LSNs in addition to the  
existing replay LSN wait type. This provides the foundation for  
extending the WAIT FOR command with MODE parameter.  
  
Key changes are following.  
- Add WAIT_LSN_TYPE_STANDBY_WRITE and WAIT_LSN_TYPE_STANDBY_FLUSH to  
  WaitLSNType.  
- Add GetCurrentLSNForWaitType() to retrieve the current LSN for each wait  
  type.  
- Add new wait events WAIT_EVENT_WAIT_FOR_WAL_WRITE and  
  WAIT_EVENT_WAIT_FOR_WAL_FLUSH for pg_stat_activity visibility.  
- Update WaitForLSN() to use GetCurrentLSNForWaitType() internally.  
  
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com  
Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/commands/wait.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/access/xlogwait.h

Adjust errcode in checkPartition()

commit   : d51a5d8e56922a4343af8e31abef4a3faf95352f    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:38:03 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 5 Jan 2026 19:38:03 +0200    

Click here for diff

Replace ERRCODE_UNDEFINED_TABLE with ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE  
for the case where we don't find a parent-child relationship between the  
partitioned table and its partition.  In this case, tables are present, but  
they are not in a prerequisite state (no relationship).  
  
Discussion: https://postgr.es/m/CAHewXNmBM%2B5qbrJMu60NxPn%2B0y-%3D2wXM-QVVs3xRp8NxFvDb9A%40mail.gmail.com  
Author: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  

M src/backend/parser/parse_utilcmd.c

Remove redundant SET enable_partitionwise_join = on.

commit   : 3f33b63de278615130367d182c38e29661d588e2    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 5 Jan 2026 11:57:24 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 5 Jan 2026 11:57:24 -0500    

Click here for diff

partition_join.sql keeps partitionwise join enabled for the entire file,  
so we don't need to enable it for this test case individually.  
  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: http://postgr.es/m/CAExHW5uRW=Z==bmLR=NXm6Vv3JGH4rUvb+Rfft8TfjrfzUUm3g@mail.gmail.com  

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

Fix comment in tableam.c

commit   : 877ae5db8968555d7a5634e69018dfe6c55976eb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 19:15:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 19:15:55 +0900    

Click here for diff

Author: shiyu qin <qinshy510@gmail.com>  
Discussion: https://postgr.es/m/CAJUCM3uJjoLR1zfKoZD4J71T-hdeFdFw1kTQoMkywKZP0hZsvw@mail.gmail.com  

M src/backend/access/table/tableam.c

Separate read and write pointers in pg_saslprep

commit   : de746e0d2a5856f162deed042420ca15e6683cdd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 5 Jan 2026 10:50:27 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 5 Jan 2026 10:50:27 +0100    

Click here for diff

Use separate pointers for reading const input ('p') and writing to  
mutable output ('outp'), avoiding the need to cast away const on the  
input parameter.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/common/saslprep.c

Tighten up assertion on a local variable

commit   : 461b8cc95252ff0177a44be20b06c21ff07af4fa    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 5 Jan 2026 11:33:35 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 5 Jan 2026 11:33:35 +0200    

Click here for diff

'lineindex' is 0-based, as mentioned in the comments.  
  
Backpatch to v18 where the assertion was added.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/tencent_A84F3C810365BB9BD08442955AE494141907@qq.com  
Backpatch-through: 18  

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

Use the GetPGProcByNumber() macro when possible

commit   : 4c144e0452daa2508a008bb4cde520613bbd386d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Jan 2026 21:19:03 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Jan 2026 21:19:03 +1300    

Click here for diff

A few places were accessing &ProcGlobal->allProcs directly, so adjust  
them to use the accessor macro instead.  
  
Author: Maksim Melnikov <m.melnikov@postgrespro.ru>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/80621c00-aba6-483c-88b1-a845461d1165@postgrespro.ru  

M src/backend/access/transam/clog.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c

Improve the comments atop build_replindex_scan_key().

commit   : 3f906d3af99d4d926c942ebdca7b2f92a209d346    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 5 Jan 2026 03:06:55 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 5 Jan 2026 03:06:55 +0000    

Click here for diff

Author: zourenli <398740848@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/tencent_C2DC8157CC05C8F5C36E12678A7864554809@qq.com  

M src/backend/executor/execReplication.c

Remove unneeded probes from configure and meson

commit   : 8ab4b864c13f76512bd14591cc358df8c3d7c3a0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 11:03:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 11:03:43 +0900    

Click here for diff

7d854bdc5b72 has removed two symbols from pg_config.h.in.  This file is  
automatically generated.  The correct cleanup needs to be done in the  
build scripts, instead.  autoheader produces now a consistent  
pg_config.h.in, without the symbols that were removed in the previous  
commit.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1193764.1767573683@sss.pgh.pa.us  

M configure
M configure.ac
M meson.build

Remove unneeded defines from pg_config.h.in

commit   : 7d854bdc5b72b30ae58041d88c2be509950b99d4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 09:27:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 09:27:19 +0900    

Click here for diff

This commit removes HAVE_ATOMIC_H and HAVE_MBARRIER_H from  
pg_config.h.in, cleanup that could have been done in 25f36066dd2a.  
  
Author: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/b2c0d0b7-3944-487d-a03d-d155851958ff@gmail.com  

M src/include/pg_config.h.in

Fix typos and inconsistencies in code and comments

commit   : b8cfcb9e00da6f2149f5977e99bdcf3121fea0aa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 09:19:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 5 Jan 2026 09:19:15 +0900    

Click here for diff

This change is a cocktail of harmonization of function argument names,  
grammar typos, renames for better consistency and unused code (see  
ltree).  All of these have been spotted by the author.  
  
Author: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/b2c0d0b7-3944-487d-a03d-d155851958ff@gmail.com  

M contrib/ltree/ltxtquery_io.c
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/commands/subscriptioncmds.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/partitioning/partbounds.c
M src/backend/replication/logical/slotsync.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/include/access/heapam.h
M src/include/c.h
M src/include/commands/sequence.h
M src/include/common/int128.h
M src/include/jit/llvmjit.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/geqo_recombination.h
M src/include/port.h
M src/include/port/win32/sys/socket.h
M src/include/port/win32_port.h
M src/include/replication/logicalctl.h
M src/include/replication/worker_internal.h
M src/include/statistics/stat_utils.h
M src/include/storage/predicate.h
M src/include/utils/guc.h
M src/test/modules/brin/t/01_workitems.pl
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/tools/valgrind.supp

Allow role created by new test to log in on Windows.

commit   : e3fbc9a8de75206805a4252969a5896e6f6e5929    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 18:14:02 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 18:14:02 -0500    

Click here for diff

We must tell init about each role name we plan to connect as,  
else SSPI auth fails.  Similar to previous patches such as  
da44d71e7.  
  
Oversight in f3c9e341c, per buildfarm member drongo.  

M src/test/modules/test_extensions/t/001_extension_control_path.pl

Include error location in errors from ComputeIndexAttrs().

commit   : ba75f717526cbaa9000b546aac456e43d03aaf53    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 14:16:15 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 14:16:15 -0500    

Click here for diff

Make use of IndexElem's new location field to localize these  
errors better.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CACJufxH3OgXF1hrzGAaWyNtye2jHEmk9JbtrtGv-KJK6tsGo5w@mail.gmail.com  

M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/collate.windows.win1252.out
M src/test/regress/expected/sqljson_queryfuncs.out

Add parse location to IndexElem.

commit   : 62299bbd90d69e2273d3e2ba35af5953d20ca037    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 13:23:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 4 Jan 2026 13:23:26 -0500    

Click here for diff

This patch mostly just fills in the field, although a few error  
reports in resolve_unique_index_expr() are adjusted to use it.  
The next commit will add more uses.  
  
catversion bump out of an abundance of caution: I'm not sure  
IndexElem can appear in stored rules, but I'm not sure it can't  
either.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Co-authored-by: jian he <jian.universality@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CACJufxH3OgXF1hrzGAaWyNtye2jHEmk9JbtrtGv-KJK6tsGo5w@mail.gmail.com  
Discussion: https://postgr.es/m/202512121327.f2zimsr6guso@alvherre.pgsql  

M src/backend/bootstrap/bootparse.y
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/insert_conflict.out

Fix partial read handling in pg_upgrade's multixact conversion

commit   : ac94ce8194e501c1ace7115e5e4720e0da4b5168    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 4 Jan 2026 20:04:36 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Sun, 4 Jan 2026 20:04:36 +0200    

Click here for diff

Author: Man Zeng <zengman@halodbtech.com>  
Discussion: https://www.postgresql.org/message-id/tencent_566562B52163DB1502F4F7A4@qq.com  

M src/bin/pg_upgrade/slru_io.c

Remove bogus const qualifier on PageGetItem() argument

commit   : 0eadf1767ab8dec03135feaff8cd9e38881c1960    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 4 Jan 2026 16:00:15 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 4 Jan 2026 16:00:15 +0100    

Click here for diff

The function ends up casting away the const qualifier, so it was a  
lie.  No callers appear to rely on the const qualifier on the  
argument, so the simplest solution is to just remove it.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/beusplf77varvhip6ryuhd2fchsx26qmmhduqz432bnglq634b%402dx4k6yxj4cm  

M src/include/storage/bufpage.h

Doc: add missing punctuation

commit   : 07e0e9ac270562b13743952c3e9c50ced00a2406    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 4 Jan 2026 21:12:23 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 4 Jan 2026 21:12:23 +1300    

Click here for diff

Author: Daisuke Higuchi <higuchi.daisuke11@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Discussion: https://postgr.es/m/CAEVT6c-yWYstu76YZ7VOxmij2XA8vrOEvens08QLmKHTDjEPBw@mail.gmail.com  
Backpatch-through: 14  

M doc/src/sgml/config.sgml
M doc/src/sgml/history.sgml

Fix selectivity estimation integer overflow in contrib/intarray

commit   : 4f49e4b55e709e9aa758312da5b84bbbb674f30a    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 4 Jan 2026 20:32:40 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 4 Jan 2026 20:32:40 +1300    

Click here for diff

This fixes a poorly written integer comparison function which was  
performing subtraction in an attempt to return a negative value when  
a < b and a positive value when a > b, and 0 when the values were equal.  
Unfortunately that didn't always work correctly due to two's complement  
having the INT_MIN 1 further from zero than INT_MAX.  This could result  
in an overflow and cause the comparison function to return an incorrect  
result, which would result in the binary search failing to find the  
value being searched for.  
  
This could cause poor selectivity estimates when the statistics stored  
the value of INT_MAX (2147483647) and the value being searched for was  
large enough to result in the binary search doing a comparison with that  
INT_MAX value.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2ng1Ot5LoKbVU-Dh---dFTUZWJRH8wv2chBu29fnNDMaQ@mail.gmail.com  
Backpatch-through: 14  

M contrib/intarray/_int_selfuncs.c

Improve a couple of error messages.

commit   : 54315fde73915a2468eaa22a2fa38927a23ac4ec    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 3 Jan 2026 17:18:39 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 3 Jan 2026 17:18:39 -0500    

Click here for diff

Change "function" to "function or procedure" in  
PreventInTransactionBlock, and improve grammar of ExecWaitStmt's  
complaint about having an active snapshot.  
  
Author: Pavel Stehule <pavel.stehule@gmail.com>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Marcos Pegoraro <marcos@f10.com.br>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAFj8pRCveWPR06bbad9GnMb0Kcr6jnXPttv9XOaOB+oFCD1Tsg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/commands/wait.c
M src/test/recovery/t/049_wait_for_lsn.pl
M src/test/regress/expected/subscription.out

Fix spelling mistake in fk-snapshot-3.spec

commit   : 094b61ce3ebbb1258675cb9b4eca9198628e2177    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 2 Jan 2026 17:53:07 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 2 Jan 2026 17:53:07 +1300    

Click here for diff

Author: Aditya Gollamudi <adigollamudi@gmail.com>  
Discussion: https://postgr.es/m/CAD-KL_EdOOWp_cmPk9%3D5vNxo%2BabTTRpNx4vex-gVUm8u3GnkTg%40mail.gmail.com  

M src/test/isolation/specs/fk-snapshot-3.spec

commit   : 451c43974f8e199097d97624a4952ad0973cea61    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jan 2026 13:24:10 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 1 Jan 2026 13:24:10 -0500    

Click here for diff

Backpatch-through: 14  

M COPYRIGHT
M config/check_modules.pl
M configure
M configure.ac
M contrib/amcheck/meson.build
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/t/005_pitr.pl
M contrib/amcheck/t/006_verify_gin.pl
M contrib/amcheck/verify_common.c
M contrib/amcheck/verify_common.h
M contrib/amcheck/verify_gin.c
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auth_delay/meson.build
M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/meson.build
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/meson.build
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/basic_archive/meson.build
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/bloom/meson.build
M contrib/bloom/t/001_wal.pl
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/dblink.c
M contrib/dblink/meson.build
M contrib/dblink/t/001_auth_scram.pl
M contrib/dict_int/dict_int.c
M contrib/dict_int/meson.build
M contrib/dict_xsyn/dict_xsyn.c
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/daitch_mokotoff.c
M contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/hstore_subs.c
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intagg/meson.build
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/intarray/meson.build
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/meson.build
M contrib/oid2name/meson.build
M contrib/oid2name/t/001_basic.pl
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/meson.build
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/meson.build
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_logicalinspect/meson.build
M contrib/pg_logicalinspect/pg_logicalinspect.c
M contrib/pg_overexplain/meson.build
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/meson.build
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/t/010_restart.pl
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/meson.build
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_visibility/t/001_concurrent_transaction.pl
M contrib/pg_visibility/t/002_corrupt_vm.pl
M contrib/pg_walinspect/meson.build
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/meson.build
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/postgres_fdw/t/001_auth_scram.pl
M contrib/seg/meson.build
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/meson.build
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/t/001_sepgsql.pl
M contrib/sepgsql/uavc.c
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tablefunc/tablefunc.c
M contrib/tcn/meson.build
M contrib/tcn/tcn.c
M contrib/test_decoding/meson.build
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/meson.build
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/meson.build
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/meson.build
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/meson.build
M contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M contrib/xml2/meson.build
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/generate-targets-meson.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/meson.build
M doc/src/sgml/targets-meson.txt
M meson.build
M meson_options.txt
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/brin/meson.build
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/meson.build
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/syncscan.c
M src/backend/access/common/tidstore.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gin/meson.build
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/gist/meson.build
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/hash/meson.build
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/meson.build
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/index/meson.build
M src/backend/access/meson.build
M src/backend/access/nbtree/meson.build
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/meson.build
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/sequence/meson.build
M src/backend/access/sequence/sequence.c
M src/backend/access/spgist/meson.build
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/meson.build
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/meson.build
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/meson.build
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/access/transam/xlogwait.c
M src/backend/archive/meson.build
M src/backend/archive/shell_archive.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_sink.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/meson.build
M src/backend/backup/walsummary.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/bootstrap/meson.build
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/meson.build
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_tablespace.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/explain_dr.c
M src/backend/commands/explain_format.c
M src/backend/commands/explain_state.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/meson.build
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/sequence_xlog.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/commands/wait.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/meson.build
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/foreign/meson.build
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/jit/llvm/meson.build
M src/backend/jit/meson.build
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/meson.build
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/meson.build
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/main/meson.build
M src/backend/meson.build
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/meson.build
M src/backend/nodes/multibitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/geqo/meson.build
M src/backend/optimizer/meson.build
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/meson.build
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/meson.build
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/meson.build
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/extendplan.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/meson.build
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/gramparse.h
M src/backend/parser/meson.build
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/meson.build
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/po/meson.build
M src/backend/port/atomics.c
M src/backend/port/meson.build
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/meson.build
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pmchild.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/meson.build
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalctl.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/meson.build
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_create.pl
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/attribute_stats.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/meson.build
M src/backend/statistics/mvdistinct.c
M src/backend/statistics/relation_stats.c
M src/backend/statistics/stat_utils.c
M src/backend/storage/aio/aio.c
M src/backend/storage/aio/aio_callback.c
M src/backend/storage/aio/aio_funcs.c
M src/backend/storage/aio/aio_init.c
M src/backend/storage/aio/aio_io.c
M src/backend/storage/aio/aio_target.c
M src/backend/storage/aio/meson.build
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/aio/method_sync.c
M src/backend/storage/aio/method_worker.c
M src/backend/storage/aio/read_stream.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/buffer/meson.build
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/meson.build
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/freespace/meson.build
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/large_object/meson.build
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/meson.build
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/meson.build
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/page/meson.build
M 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
M src/backend/storage/sync/meson.build
M src/backend/storage/sync/sync.c
M src/backend/tcop/backend_startup.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/meson.build
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/meson.build
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/bytea.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/multixactfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_ndistinct.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudorandomfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/skipsupport.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/waitfuncs.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/funccache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/meson.build
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/error/meson.build
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/fmgr/meson.build
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/meson.build
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/meson.build
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/init/usercontext.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/meson.build
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/meson.build
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/gen_guc_tables.pl
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_internal.h
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/meson.build
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/stack_depth.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/meson.build
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/postprocess_dtrace.sed
M src/backend/utils/probes.d
M src/backend/utils/resowner/meson.build
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/meson.build
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/meson.build
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/initdb/meson.build
M src/bin/initdb/po/meson.build
M src/bin/initdb/t/001_initdb.pl
M src/bin/meson.build
M src/bin/pg_amcheck/Makefile
M src/bin/pg_amcheck/meson.build
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/astreamer_inject.c
M src/bin/pg_basebackup/astreamer_inject.h
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/011_in_place_tablespace.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/meson.build
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_combinebackup/Makefile
M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/backup_label.h
M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/copy_file.h
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_combinebackup/load_manifest.h
M src/bin/pg_combinebackup/meson.build
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/po/meson.build
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/reconstruct.h
M src/bin/pg_combinebackup/t/001_basic.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_combinebackup/t/003_timeline.pl
M src/bin/pg_combinebackup/t/004_manifest.pl
M src/bin/pg_combinebackup/t/005_integrity.pl
M src/bin/pg_combinebackup/t/006_db_file_copy.pl
M src/bin/pg_combinebackup/t/007_wal_level_minimal.pl
M src/bin/pg_combinebackup/t/008_promote.pl
M src/bin/pg_combinebackup/t/009_no_full_file.pl
M src/bin/pg_combinebackup/t/010_hardlink.pl
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_combinebackup/write_manifest.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/meson.build
M src/bin/pg_config/pg_config.c
M src/bin/pg_config/po/meson.build
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/meson.build
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_gzip.h
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_lz4.h
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_none.h
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/connectdb.c
M src/bin/pg_dump/connectdb.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/filter.c
M src/bin/pg_dump/filter.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/po/meson.build
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pg_dump/t/006_pg_dump_compress.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/meson.build
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_rewind/rewind_source.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/010_keep_recycled_wals.pl
M src/bin/pg_rewind/t/011_wal_copy.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/multixact_read_v18.c
M src/bin/pg_upgrade/multixact_read_v18.h
M src/bin/pg_upgrade/multixact_rewrite.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/slru_io.c
M src/bin/pg_upgrade/slru_io.h
M src/bin/pg_upgrade/t/001_basic.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pg_upgrade/t/005_char_signedness.pl
M src/bin/pg_upgrade/t/006_transfer_modes.pl
M src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/task.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/po/meson.build
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
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/po/meson.build
M src/bin/pg_walsummary/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/meson.build
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/pgevent/Makefile
M src/bin/pgevent/meson.build
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/gen_tabcomplete.pl
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/meson.build
M src/bin/psql/po/meson.build
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/t/030_pager.pl
M src/bin/psql/tab-complete.h
M src/bin/psql/tab-complete.in.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/meson.build
M src/bin/scripts/pg_isready.c
M src/bin/scripts/po/meson.build
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h
M src/common/archive.c
M src/common/base64.c
M src/common/binaryheap.c
M src/common/blkreftable.c
M src/common/checksum_helper.c
M src/common/compression.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/encnames.c
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/hashfn.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/ip.c
M src/common/jsonapi.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/md5_common.c
M src/common/md5_int.h
M src/common/meson.build
M src/common/parse_manifest.c
M src/common/percentrepl.c
M src/common/pg_get_line.c
M src/common/pg_lzcompress.c
M src/common/pg_prng.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha1.c
M src/common/sha1_int.h
M src/common/sha2.c
M src/common/sha2_int.h
M src/common/sprompt.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/case_test.c
M src/common/unicode/category_test.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_case_table.pl
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/generate-unicode_version.pl
M src/common/unicode/meson.build
M src/common/unicode/norm_test.c
M src/common/unicode_case.c
M src/common/unicode_category.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/common/wchar.c
M src/fe_utils/Makefile
M src/fe_utils/archive.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_tar.c
M src/fe_utils/astreamer_zstd.c
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/connect_utils.c
M src/fe_utils/mbprint.c
M src/fe_utils/meson.build
M src/fe_utils/option_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/fe_utils/version.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/cmptype.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gin_tuple.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/multixact_internal.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrdesc_utils.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/sequence.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/syncscan.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/tidstore.h
M src/include/access/timeline.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogarchive.h
M src/include/access/xlogbackup.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/access/xlogwait.h
M src/include/archive/archive_module.h
M src/include/archive/shell_archive.h
M src/include/backup/backup_manifest.h
M src/include/backup/basebackup.h
M src/include/backup/basebackup_incremental.h
M src/include/backup/basebackup_sink.h
M src/include/backup/basebackup_target.h
M src/include/backup/walsummary.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/meson.build
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/copyapi.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/explain_dr.h
M src/include/commands/explain_format.h
M src/include/commands/explain_state.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/proclang.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/sequence_xlog.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/commands/wait.h
M src/include/common/archive.h
M src/include/common/base64.h
M src/include/common/blkreftable.h
M src/include/common/checksum_helper.h
M src/include/common/compression.h
M src/include/common/config_info.h
M src/include/common/connect.h
M src/include/common/controldata_utils.h
M src/include/common/cryptohash.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/hashfn.h
M src/include/common/hashfn_unstable.h
M src/include/common/hmac.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/jsonapi.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/oauth-common.h
M src/include/common/openssl.h
M src/include/common/parse_manifest.h
M src/include/common/percentrepl.h
M src/include/common/pg_prng.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha1.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_case.h
M src/include/common/unicode_case_table.h
M src/include/common/unicode_category.h
M src/include/common/unicode_category_table.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_version.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execAsync.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execScan.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMemoize.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidrangescan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/archive.h
M src/include/fe_utils/astreamer.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect_utils.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/option_utils.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/query_utils.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fe_utils/version.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/radixtree.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/sort_template.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be-fe-helpers.h
M src/include/libpq/libpq-be-fe.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/oauth.h
M src/include/libpq/pg-gssapi.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/protocol.h
M src/include/libpq/sasl.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/meson.build
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/meson.build
M src/include/nodes/miscnodes.h
M src/include/nodes/multibitmapset.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/queryjumble.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/extendplan.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pch/meson.build
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/pg_iovec.h
M src/include/port/pg_lfind.h
M src/include/port/pg_numa.h
M src/include/port/simd.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/proctypelist.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walsummarizer.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/conflict.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalctl.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/slotsync.h
M src/include/replication/snapbuild.h
M src/include/replication/snapbuild_internal.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSearchCycle.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/stat_utils.h
M src/include/statistics/statistics.h
M src/include/statistics/statistics_format.h
M src/include/storage/aio.h
M src/include/storage/aio_internal.h
M src/include/storage/aio_subsys.h
M src/include/storage/aio_types.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/bulk_write.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/dsm_registry.h
M src/include/storage/fd.h
M src/include/storage/fileset.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/io_worker.h
M src/include/storage/ipc.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/lwlocklist.h
M src/include/storage/md.h
M src/include/storage/meson.build
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procnumber.h
M src/include/storage/procsignal.h
M src/include/storage/read_stream.h
M src/include/storage/reinit.h
M src/include/storage/relfilelocator.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/storage/waiteventset.h
M src/include/tcop/backend_startup.h
M src/include/tcop/cmdtag.h
M src/include/tcop/cmdtaglist.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/conffiles.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/funccache.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/injection_point.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/meson.build
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_locale_c.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pgstat_internal.h
M src/include/utils/pgstat_kind.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenumbermap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/skipsupport.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/wait_classes.h
M src/include/utils/wait_event.h
M src/include/utils/xid8.h
M src/include/utils/xml.h
M src/include/varatt.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/meson.build
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/ecpg/preproc/t/001_ecpg_err_warn_msg.pl
M src/interfaces/ecpg/preproc/t/002_ecpg_err_warn_msg_informix.pl
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/compat_oracle/meson.build
M src/interfaces/ecpg/test/connect/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/ecpg/test/pgtypeslib/meson.build
M src/interfaces/ecpg/test/preproc/meson.build
M src/interfaces/ecpg/test/sql/meson.build
M src/interfaces/ecpg/test/thread/meson.build
M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build
M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq-oauth/oauth-curl.h
M src/interfaces/libpq-oauth/oauth-utils.c
M src/interfaces/libpq-oauth/oauth-utils.h
M src/interfaces/libpq-oauth/t/001_oauth.pl
M src/interfaces/libpq-oauth/test-oauth-curl.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/fe-trace.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq_check.pl
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/interfaces/libpq/t/005_negotiate_encryption.pl
M src/interfaces/libpq/t/006_service.pl
M src/interfaces/libpq/test/libpq_testclient.c
M src/interfaces/libpq/test/libpq_uri_regress.c
M src/interfaces/libpq/test/meson.build
M src/interfaces/libpq/win32.c
M src/interfaces/meson.build
M src/makefiles/meson.build
M src/meson.build
M src/pl/meson.build
M src/pl/plperl/meson.build
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/plperl_system.h
M src/pl/plperl/po/meson.build
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/meson.build
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/meson.build
M src/pl/plpython/plpython.h
M src/pl/plpython/plpython_system.h
M src/pl/plpython/po/meson.build
M src/pl/tcl/generate-pltclerrcodes.pl
M src/pl/tcl/meson.build
M src/pl/tcl/po/meson.build
M src/port/bsearch_arg.c
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/explicit_bzero.c
M src/port/getpeereid.c
M src/port/kill.c
M src/port/meson.build
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_loongarch.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_localeconv_r.c
M src/port/pg_numa.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_avx512.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pthread_barrier_wait.c
M src/port/quotes.c
M src/port/snprintf.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/win32common.c
M src/port/win32dlopen.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32fdatasync.c
M src/port/win32fseek.c
M src/port/win32gai_strerror.c
M src/port/win32getrusage.c
M src/port/win32link.c
M src/port/win32ntdll.c
M src/port/win32pread.c
M src/port/win32pwrite.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32stat.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/authentication/meson.build
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/authentication/t/005_sspi.pl
M src/test/authentication/t/006_login_trigger.pl
M src/test/authentication/t/007_pre_auth.pl
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/icu/Makefile
M src/test/icu/meson.build
M src/test/icu/t/010_database.pl
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/meson.build
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/kerberos/meson.build
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl
M src/test/ldap/t/003_ldap_connection_param_lookup.pl
M src/test/locale/sort-test.pl
M src/test/meson.build
M src/test/modules/brin/meson.build
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/modules/commit_ts/meson.build
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/gin/meson.build
M src/test/modules/index/meson.build
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/meson.build
M src/test/modules/injection_points/regress_injection.c
M src/test/modules/ldap_password_func/Makefile
M src/test/modules/ldap_password_func/ldap_password_func.c
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/meson.build
M src/test/modules/nbtree/meson.build
M src/test/modules/oauth_validator/Makefile
M src/test/modules/oauth_validator/fail_validator.c
M src/test/modules/oauth_validator/magic_validator.c
M src/test/modules/oauth_validator/meson.build
M src/test/modules/oauth_validator/oauth_hook_client.c
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/t/002_client.pl
M src/test/modules/oauth_validator/t/OAuth/Server.pm
M src/test/modules/oauth_validator/validator.c
M src/test/modules/plsample/meson.build
M src/test/modules/plsample/plsample.c
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_aio/meson.build
M src/test/modules/test_aio/t/001_aio.pl
M src/test/modules/test_aio/t/002_io_workers.pl
M src/test/modules/test_aio/test_aio.c
M src/test/modules/test_binaryheap/meson.build
M src/test/modules/test_binaryheap/test_binaryheap.c
M src/test/modules/test_bitmapset/meson.build
M src/test/modules/test_bitmapset/test_bitmapset.c
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_cloexec/t/001_cloexec.pl
M src/test/modules/test_cloexec/test_cloexec.c
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_copy_callbacks/test_copy_callbacks.c
M src/test/modules/test_custom_rmgrs/meson.build
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_custom_stats/meson.build
M src/test/modules/test_custom_stats/t/001_custom_stats.pl
M src/test/modules/test_custom_stats/test_custom_fixed_stats.c
M src/test/modules/test_custom_stats/test_custom_var_stats.c
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_dsa/meson.build
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_dsm_registry/meson.build
M src/test/modules/test_dsm_registry/test_dsm_registry.c
M src/test/modules/test_escape/t/001_test_escape.pl
M src/test/modules/test_escape/test_escape.c
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_int128/meson.build
M src/test/modules/test_int128/t/001_test_int128.pl
M src/test/modules/test_int128/test_int128.c
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_json_parser/meson.build
M src/test/modules/test_json_parser/t/001_test_json_parser_incremental.pl
M src/test/modules/test_json_parser/t/002_inline.pl
M src/test/modules/test_json_parser/t/003_test_semantic.pl
M src/test/modules/test_json_parser/t/004_test_parser_perf.pl
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_json_parser/test_json_parser_perf.c
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_lfind/test_lfind.c
M src/test/modules/test_lwlock_tranches/meson.build
M src/test/modules/test_lwlock_tranches/test_lwlock_tranches.c
M src/test/modules/test_misc/meson.build
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_misc/t/004_io_direct.pl
M src/test/modules/test_misc/t/005_timeouts.pl
M src/test/modules/test_misc/t/006_signal_autovacuum.pl
M src/test/modules/test_misc/t/007_catcache_inval.pl
M src/test/modules/test_misc/t/008_replslot_single_user.pl
M src/test/modules/test_misc/t/009_log_temp_files.pl
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_parser/meson.build
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_radixtree/meson.build
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_regex/meson.build
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_resowner/meson.build
M src/test/modules/test_resowner/test_resowner_basic.c
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/test_slru/meson.build
M src/test/modules/test_slru/t/001_multixact.pl
M src/test/modules/test_slru/t/002_multixact_wraparound.pl
M src/test/modules/test_slru/test_multixact.c
M src/test/modules/test_slru/test_slru.c
M src/test/modules/test_tidstore/meson.build
M src/test/modules/test_tidstore/test_tidstore.c
M src/test/modules/typcache/meson.build
M src/test/modules/unsafe_tests/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi.c
M src/test/modules/xid_wraparound/meson.build
M src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/modules/xid_wraparound/t/003_wraparounds.pl
M src/test/modules/xid_wraparound/t/004_notify_freeze.pl
M src/test/modules/xid_wraparound/xid_wraparound.c
M src/test/perl/Makefile
M src/test/perl/PostgreSQL/Test/AdjustDump.pm
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Kerberos.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/perl/meson.build
M src/test/postmaster/Makefile
M src/test/postmaster/meson.build
M src/test/postmaster/t/001_basic.pl
M src/test/postmaster/t/002_connection_limits.pl
M src/test/postmaster/t/003_start_stop.pl
M src/test/recovery/Makefile
M src/test/recovery/meson.build
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/036_truncated_dropped.pl
M src/test/recovery/t/037_invalid_database.pl
M src/test/recovery/t/038_save_logical_slots_shutdown.pl
M src/test/recovery/t/039_end_of_wal.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/recovery/t/041_checkpoint_at_promote.pl
M src/test/recovery/t/042_low_level_backup.pl
M src/test/recovery/t/043_no_contrecord_switch.pl
M src/test/recovery/t/044_invalidate_inactive_slots.pl
M src/test/recovery/t/045_archive_restartpoint.pl
M src/test/recovery/t/046_checkpoint_logical_slot.pl
M src/test/recovery/t/047_checkpoint_physical_slot.pl
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/test/recovery/t/050_redo_segment_missing.pl
M src/test/recovery/t/051_effective_wal_level.pl
M src/test/regress/GNUmakefile
M src/test/regress/meson.build
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/po/meson.build
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/meson.build
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/Makefile
M src/test/subscription/meson.build
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/034_temporal.pl
M src/test/subscription/t/035_conflicts.pl
M src/test/subscription/t/036_sequences.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/meson.build
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/tznames/meson.build
M src/tools/PerfectHash.pm
M src/tools/add_commit_links.pl
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/gen_export.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/ifaddrs/Makefile
M src/tools/mark_pgdllimport.pl
M src/tools/msvc_gendef.pl
M src/tools/pg_bsd_indent/Makefile
M src/tools/pg_bsd_indent/meson.build
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pginclude/headerscheck
M src/tools/pgindent/pgindent
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source

Add paths of extensions to pg_available_extensions

commit   : f3c9e341cdf167ae3378e74e770558e81f9aa48e    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 1 Jan 2026 12:11:37 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 1 Jan 2026 12:11:37 -0500    

Click here for diff

Add a new "location" column to the pg_available_extensions and  
pg_available_extension_versions views, exposing the directory where  
the extension is located.  
  
The default system location is shown as '$system', the same value  
that can be used to configure the extension_control_path GUC.  
  
User-defined locations are only visible for super users, otherwise  
'<insufficient privilege>' is returned as a column value, the same  
behaviour that we already use in pg_stat_activity.  
  
I failed to resist the temptation to do a little extra editorializing of  
the TAP test script.  
  
Catalog version bumped.  
  
Author: Matheus Alcantara <mths.dev@pm.me>  
Reviewed-By: Chao Li <li.evan.chao@gmail.com>  
Reviewed-By: Rohit Prasad <rohit.prasad@arm.com>  
Reviewed-By: Michael Banck <mbanck@gmx.net>  
Reviewed-By: Manni Wood <manni.wood@enterprisedb.com>  
Reviewed-By: Euler Taveira <euler@eulerto.com>  
Reviewed-By: Quan Zongliang <quanzongliang@yeah.net>  

M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/extension.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Fix macro name for io_uring_queue_init_mem check.

commit   : 85d5bd308bf5dc3068a4c28aa0f12cc22272f789    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 31 Dec 2025 11:18:14 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 31 Dec 2025 11:18:14 -0800    

Click here for diff

Commit f54af9f2679d added a check for  
io_uring_queue_init_mem(). However, it used the macro name  
HAVE_LIBURING_QUEUE_INIT_MEM in both meson.build and the C code, while  
the Autotools build script defined HAVE_IO_URING_QUEUE_INIT_MEM. As a  
result, the optimization was never enabled in builds configured with  
Autotools, as the C code checked for the wrong macro name.  
  
This commit changes the macro name to HAVE_IO_URING_QUEUE_INIT_MEM in  
meson.build and the C code. This matches the actual function  
name (io_uring_queue_init_mem), following the standard HAVE_<FUNCTION>  
convention.  
  
Backpatch to 18, where the macro was introduced.  
  
Bug: #19368  
Reported-by: Evan Si <evsi@amazon.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19368-016d79a7f3a1c599@postgresql.org  
Backpatch-through: 18  

M meson.build
M src/backend/storage/aio/method_io_uring.c

Doc: remove obsolete, confused <note> about rowtype I/O syntax.

commit   : d6542f8dfc6c7db9b491a4f0b1ea082cfa4537eb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Dec 2025 13:19:27 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Dec 2025 13:19:27 -0500    

Click here for diff

This <note> was originally written to describe the double levels  
of de-backslashing encountered when a backslash-aware string  
literal is used to hold the text representation of a composite  
value.  It still made sense when we switched to mostly using E'...'  
syntax for that type of literal.  However, commit f77de4b0c mangled  
it completely by changing the example literal to be SQL-standard.  
The extra pass of de-backslashing described in the text doesn't  
actually occur with the example as written, unless you happen to  
be using standard_conforming_strings = off.  
  
We could restore this <note> to self-consistency by reverting the  
change from f77de4b0c, but on the whole I judge that its time has  
passed.  standard_conforming_strings = off is nearly obsolete,  
and may soon be fully so.  But without that, the behavior isn't  
so complicated as to justify a discursive note.  I observe that  
the nearby section about array I/O syntax has no equivalent text,  
although that syntax is equally subject to this issue.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/2998401.1767038920@sss.pgh.pa.us  
Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us  

M doc/src/sgml/rowtypes.sgml

jit: Fix jit_profiling_support when unavailable.

commit   : 915711c8a4e60f606a8417ad033cea5385364c07    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 31 Dec 2025 13:24:17 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 31 Dec 2025 13:24:17 +1300    

Click here for diff

jit_profiling_support=true captures profile data for Linux perf.  On  
other platforms, LLVMCreatePerfJITEventListener() returns NULL and the  
attempt to register the listener would crash.  
  
Fix by ignoring the setting in that case.  The documentation already  
says that it only has an effect if perf support is present, and we  
already did the same for older LLVM versions that lacked support.  
  
No field reports, unsurprisingly for an obscure developer-oriented  
setting.  Noticed in passing while working on commit 1a28b4b4.  
  
Backpatch-through: 14  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com  

M src/backend/jit/llvm/llvmjit.c

Change IndexAmRoutines to be statically-allocated structs.

commit   : bc6374cd76abb2e6a48c4b57c0b5a7baa5babd67    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Dec 2025 18:26:23 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Dec 2025 18:26:23 -0500    

Click here for diff

Up to now, index amhandlers were expected to produce a new, palloc'd  
struct on each call.  That requires palloc/pfree overhead, and creates  
a risk of memory leaks if the caller fails to pfree, and the time  
taken to fill such a large structure isn't nil.  Moreover, we were  
storing these things in the relcache, eating several hundred bytes for  
each cached index.  There is not anything in these structs that needs  
to vary at runtime, so let's change the definition so that an  
amhandler can return a pointer to a "static const" struct of which  
there's only one copy per index AM.  Mark all the core code's  
IndexAmRoutine pointers const so that we catch anyplace that might  
still try to change or pfree one.  
  
(This is similar to the way we were already handling TableAmRoutine  
structs.  This commit does fix one comment that was infelicitously  
copied-and-pasted into tableamapi.c.)  
  
This commit needs to be called out in the v19 release notes as an API  
change for extension index AMs.  An un-updated AM will still work  
(as of now, anyway) but it risks memory leaks and will be slower than  
necessary.  
  
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAEoWx2=vApYk2LRu8R0DdahsPNEhWUxGBZ=rbZo1EXE=uA+opQ@mail.gmail.com  

M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/amapi.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/tableamapi.c
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/executor/execAmi.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/include/access/amapi.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c

Add dead items memory usage to VACUUM (VERBOSE) and autovacuum logs.

commit   : 736f754eed01ca81198b6cd7421321088cbe5ded    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 30 Dec 2025 13:12:10 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 30 Dec 2025 13:12:10 -0800    

Click here for diff

This commit adds the total memory allocated during vacuum, the number  
of times the dead items storage was reset, and the configured memory  
limit. This helps users understand how much memory VACUUM required,  
and such information can be used to avoid multiple index scans.  
  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAHza6qcPitBCkyiKJosDTt3bmxMvzZOTONoebwCkBZrr3rk65Q%40mail.gmail.com  

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

Fix a race condition in updating procArray->replication_slot_xmin.

commit   : 2a5225b99d7659b4e641f5397ca9e7ad625e6726    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 30 Dec 2025 10:56:30 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 30 Dec 2025 10:56:30 -0800    

Click here for diff

Previously, ReplicationSlotsComputeRequiredXmin() computed the oldest  
xmin across all slots without holding ProcArrayLock (when  
already_locked is false), acquiring the lock just before updating the  
replication slot xmin.  
  
This could lead to a race condition: if a backend created a new slot  
and updates the global replication slot xmin, another backend  
concurrently running ReplicationSlotsComputeRequiredXmin() could  
overwrite that update with an invalid or stale value. This happens  
because the concurrent backend might have computed the aggregate xmin  
before the new slot was accounted for, but applied the update after  
the new slot had already updated the global value.  
  
In the reported failure, a walsender for an apply worker computed  
InvalidTransactionId as the oldest xmin and overwrote a valid  
replication slot xmin value computed by a walsender for a tablesync  
worker. Consequently, the tablesync worker computed a transaction ID  
via GetOldestSafeDecodingTransactionId() effectively without  
considering the replication slot xmin. This led to the error "cannot  
build an initial slot snapshot as oldest safe xid %u follows  
snapshot's xmin %u", which was an assertion failure prior to commit  
240e0dbacd3.  
  
To fix this, we acquire ReplicationSlotControlLock in exclusive mode  
during slot creation to perform the initial update of the slot  
xmin. In ReplicationSlotsComputeRequiredXmin(), we hold  
ReplicationSlotControlLock in shared mode until the global slot xmin  
is updated in ProcArraySetReplicationSlotXmin(). This prevents  
concurrent computations and updates of the global xmin by other  
backends during the initial slot xmin update process, while still  
permitting concurrent calls to ReplicationSlotsComputeRequiredXmin().  
  
Backpatch to all supported versions.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Pradeep Kumar <spradeepkumar29@gmail.com>  
Reviewed-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAA4eK1L8wYcyTPxNzPGkhuO52WBGoOZbT0A73Le=ZUWYAYmdfw@mail.gmail.com  
Backpatch-through: 14  

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

Fix comment in lsyscache.c

commit   : ffdcc9c638eeb71d2e6990e27f91623736603b58    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 16:42:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 16:42:21 +0900    

Click here for diff

Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2miv0KGcM9j29ANRN45-Vz-2qAqrM0cv9OtaLx8e_WCMQ@mail.gmail.com  

M src/backend/utils/cache/lsyscache.c

jit: Drop redundant LLVM configure probes.

commit   : 1a28b4b455df41725ea2115ae2a2fd9b33a20ae5    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 30 Dec 2025 16:39:19 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 30 Dec 2025 16:39:19 +1300    

Click here for diff

We currently require LLVM 14, so these probes for LLVM 9 functions  
always succeeded.  Even when the features aren't enabled in an LLVM  
build, dummy functions are defined (a problem for a later commit).  
  
The whole PGAC_CHECK_LLVM_FUNCTIONS macro and Meson equivalent are  
removed, because we switched to testing LLVM_VERSION_MAJOR at compile  
time in subsequent work and these were the last holdouts.  That suits  
the nature of LLVM API evolution better, and also allows for strictly  
mechanical pruning in future commits like 820b5af7 and 972c2cd2.  They  
advanced the minimum LLVM version but failed to spot these.  
  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com  

M config/llvm.m4
M configure
M configure.ac
M meson.build
M src/backend/jit/llvm/llvmjit.c
M src/include/pg_config.h.in

Add pg_get_multixact_stats()

commit   : 97b101776ce23dd6c4abbdae213806bc24ed6133    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 15:38:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 15:38:50 +0900    

Click here for diff

This new function exposes at SQL level some information related to  
multixacts, not available until now.  This data is useful for monitoring  
purposes, especially for workloads that make a heavy use of multixacts:  
- num_mxids, number of MultiXact IDs in use.  
- num_members, number of member entries in use.  
- members_size, bytes used by num_members in pg_multixact/members/.  
- oldest_multixact: oldest MultiXact still needed.  
  
This patch has been originally proposed when MultiXactOffset was still  
32 bits, to monitor wraparound.  This part is not relevant anymore since  
bd8d9c9bdfa0 that has widen MultiXactOffset to 64 bits.  The monitoring  
of disk space usage for the members is still relevant.  
  
Some tests are added to check this function, in the shape of one  
isolation test with concurrent transactions that take a ROW SHARE lock,  
and some SQL tests for pg_read_all_stats.  Some documentation is added  
to explain some patterns that can come from the information provided by  
the function.  
  
Bump catalog version.  
  
Author: Naga Appani <nagnrik@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>  
Discussion: https://postgr.es/m/CA+QeY+AAsYK6WvBW4qYzHz4bahHycDAY_q5ECmHkEV_eB9ckzg@mail.gmail.com  

M doc/src/sgml/func/func-info.sgml
M doc/src/sgml/maintenance.sgml
M src/backend/utils/adt/multixactfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
A src/test/isolation/expected/multixact-stats.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/multixact-stats.spec
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

Add MultiXactOffsetStorageSize() to multixact_internal.h

commit   : 0e3ad4b96aedee57fc2694e28486fe0ceca8110a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 14:13:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 14:13:40 +0900    

Click here for diff

This function calculates in bytes the storage taken between two  
multixact offsets.  This will be used in an upcoming patch, introduced  
separately here as this piece can be useful on its own.  
  
Author: Naga Appani <nagnrik@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz  

M src/include/access/multixact_internal.h

Change GetMultiXactInfo() to return the next multixact offset

commit   : 9cf746a453c15ffdf652a6d50683bfd82e654950    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 14:03:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Dec 2025 14:03:49 +0900    

Click here for diff

This routine returned a number of members as a MultiXactOffset,  
calculated based on the difference between the next-to-be-assigned  
offset and the oldest offset.  However, this number is not actually an  
offset but a number.  
  
This type confusion comes from the original implementation of  
MultiXactMemberFreezeThreshold(), in 53bb309d2d5a.  The number of  
members is now defined as a uint64, large enough for MultiXactOffset.  
This change will be used in a follow-up patch.  
  
Reviewed-by: Naga Appani <nagnrik@gmail.com>  
Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz  

M src/backend/access/transam/multixact.c
M src/include/access/multixact.h

jit: Remove -Wno-deprecated-declarations in 18+.

commit   : 7da9d8f2db655eefba8757a66097bfabd3660a82    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 30 Dec 2025 14:11:37 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 30 Dec 2025 14:11:37 +1300    

Click here for diff

REL_18_STABLE and master have commit ee485912, so they always use the  
newer LLVM opaque pointer functions.  Drop -Wno-deprecated-declarations  
(commit a56e7b660) for code under jit/llvm in those branches, to catch  
any new deprecation warnings that arrive in future version of LLVM.  
  
Older branches continued to use functions marked deprecated in LLVM 14  
and 15 (ie switched to the newer functions only for LLVM 16+), as a  
precaution against unforeseen compatibility problems with bitcode  
already shipped.  In those branches, the comment about warning  
suppression is updated to explain that situation better.  In theory we  
could suppress warnings only for LLVM 14 and 15 specifically, but that  
isn't done here.  
  
Backpatch-through: 14  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1407185.1766682319%40sss.pgh.pa.us  

M src/backend/jit/llvm/Makefile

Ensure sanity of hash-join costing when there are no MCV statistics.

commit   : bd3e3e9e56830e1b1448b559743b0f0a90a6e38d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Dec 2025 13:01:27 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Dec 2025 13:01:27 -0500    

Click here for diff

estimate_hash_bucket_stats is defined to return zero to *mcv_freq if  
it cannot obtain a value for the frequency of the most common value.  
Its sole caller final_cost_hashjoin ignored this provision and would  
blindly believe the zero value, resulting in computing zero for the  
largest bucket size.  In consequence, the safety check that intended  
to prevent the largest bucket from exceeding get_hash_memory_limit()  
was ineffective, allowing very silly plans to be chosen if statistics  
were missing.  
  
After fixing final_cost_hashjoin to disregard zero results for  
mcv_freq, a second problem appeared: some cases that should use hash  
joins failed to.  This is because estimate_hash_bucket_stats was  
unaware of the fact that ANALYZE won't store MCV statistics if it  
doesn't find any multiply-occurring values.  Thus the lack of an MCV  
stats entry doesn't necessarily mean that we know nothing; we may  
well know that the column is unique.  The former coding returned zero  
for *mcv_freq in this case, which was pretty close to correct, but now  
final_cost_hashjoin doesn't believe it and disables the hash join.  
So check to see if there is a HISTOGRAM stats entry; if so, ANALYZE  
has in fact run for this column and must have found it to be unique.  
In that case report the MCV frequency as 1 / rows, instead of claiming  
ignorance.  
  
Reporting a more accurate *mcv_freq in this case can also affect the  
bucket-size skew adjustment further down in estimate_hash_bucket_stats,  
causing hash-join cost estimates to change slightly.  This affects  
some plan choices in the core regression tests.  The first diff in  
join.out corresponds to a case where we have no stats and should not  
risk a hash join, but the remaining changes are caused by producing  
a better bucket-size estimate for unique join columns.  Those are all  
harmless changes so far as I can tell.  
  
The existing behavior was introduced in commit 4867d7f62 in v11.  
It appears from the commit log that disabling the bucket-size safety  
check in the absence of statistics was intentional; but we've now seen  
a case where the ensuing behavior is bad enough to make that seem like  
a poor decision.  In any case the lack of other problems with that  
safety check after several years helps to justify enforcing it more  
strictly.  However, we won't risk back-patching this, in case any  
applications are depending on the existing behavior.  
  
Bug: #19363  
Reported-by: Jinhui Lai <jinhui.lai@qq.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/2380165.1766871097@sss.pgh.pa.us  
Discussion: https://postgr.es/m/19363-8dd32fc7600a1153@postgresql.org  

M src/backend/optimizer/path/costsize.c
M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/expected/join_hash.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/join_hash.sql

Further stabilize a postgres_fdw test case.

commit   : cb77bc04422fbbd1be48dde9794bfc0d0e5d7ad5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Dec 2025 12:53:49 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Dec 2025 12:53:49 -0500    

Click here for diff

This patch causes one postgres_fdw test case to revert to the plan  
it used before aa86129e1, i.e., using a remote sort in preference to  
local sort.  That decision is actually a coin-flip because cost_sort()  
will give the same answer on both sides, so that the plan choice comes  
down to little more than roundoff error.  In consequence, the test  
output can change as a result of even minor changes in nearby costs,  
as we saw in aa86129e1 (compare also b690e5fac and 4b14e1871).  
  
b690e5fac's solution to stabilizing the adjacent test case was to  
disable sorting locally, and here we extend that to the currently-  
problematic case.  Without this, the following patch would cause this  
plan choice to change back in this same way, for even less apparent  
reason.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/2551253.1766952956@sss.pgh.pa.us  

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

Fix Mkvcbuild.pm builds of test_cloexec.c.

commit   : 45d92b76dc4ac31d44e46ca38bee12d5d8fac1f5    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 29 Dec 2025 15:22:16 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 29 Dec 2025 15:22:16 +1300    

Click here for diff

Mkvcbuild.pm scrapes Makefile contents, but couldn't understand the  
change made by commit bec2a0aa.  Revealed by BF animal hamerkop in  
branch REL_16_STABLE.  
  
1.  It used += instead of =, which didn't match the pattern that  
Mkvcbuild.pm looks for.  Drop the +.  
  
2.  Mkvcbuild.pm doesn't link PROGRAM executables with libpgport.  Apply  
a local workaround to REL_16_STABLE only (later branches dropped  
Mkvcbuild.pm).  
  
Backpatch-through: 16  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/175163.1766357334%40sss.pgh.pa.us  

M src/test/modules/test_cloexec/Makefile

Ignore PlaceHolderVars when looking up statistics

commit   : 559f9e90dbbd5d72b1da802703317913280c5080    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 29 Dec 2025 11:40:45 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 29 Dec 2025 11:40:45 +0900    

Click here for diff

When looking up statistical data about an expression, we failed to  
look through PlaceHolderVar nodes, treating them as opaque.  This  
could prevent us from matching an expression to base columns, index  
expressions, or extended statistics, as examine_variable() relies on  
strict structural matching.  
  
As a result, queries involving PlaceHolderVar nodes often fell back to  
default selectivity estimates, potentially leading to poor plan  
choices.  
  
This patch updates examine_variable() to strip PlaceHolderVars before  
analysis.  This is safe during estimation because PlaceHolderVars are  
transparent for the purpose of statistics lookup: they do not alter  
the value distribution of the underlying expression.  
  
To minimize performance overhead on this hot path, a lightweight  
walker first checks for the presence of PlaceHolderVars.  The more  
expensive mutator is invoked only when necessary.  
  
There is one ensuing plan change in the regression tests, which is  
expected and demonstrates the fix: the rowcount estimate becomes much  
more accurate with this patch.  
  
Back-patch to v18.  Although this issue exists before that, changes in  
this version made it common enough to notice.  Given the lack of field  
reports for older versions, I am not back-patching further.  
  
Reported-by: Haowu Ge <gehaowu@bitmoe.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/62af586c-c270-44f3-9c5e-02c81d537e3d.gehaowu@bitmoe.com  
Backpatch-through: 18  

M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Strip PlaceHolderVars from index operands

commit   : ad66f705fa6796b40311a8210e9f37144df02ef5    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Mon, 29 Dec 2025 11:38:49 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Mon, 29 Dec 2025 11:38:49 +0900    

Click here for diff

When pulling up a subquery, we may need to wrap its targetlist items  
in PlaceHolderVars to enforce separate identity or as a result of  
outer joins.  However, this causes any upper-level WHERE clauses  
referencing these outputs to contain PlaceHolderVars, which prevents  
indxpath.c from recognizing that they could be matched to index  
columns or index expressions, potentially affecting the planner's  
ability to use indexes.  
  
To fix, explicitly strip PlaceHolderVars from index operands.  A  
PlaceHolderVar appearing in a relation-scan-level expression is  
effectively a no-op.  Nevertheless, to play it safe, we strip only  
PlaceHolderVars that are not marked nullable.  
  
The stripping is performed recursively to handle cases where  
PlaceHolderVars are nested or interleaved with other node types.  To  
minimize performance impact, we first use a lightweight walker to  
check for the presence of strippable PlaceHolderVars.  The expensive  
mutator is invoked only if a candidate is found, avoiding unnecessary  
memory allocation and tree copying in the common case where no  
PlaceHolderVars are present.  
  
Back-patch to v18.  Although this issue exists before that, changes in  
this version made it common enough to notice.  Given the lack of field  
reports for older versions, I am not back-patching further.  
  
Reported-by: Haowu Ge <gehaowu@bitmoe.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/62af586c-c270-44f3-9c5e-02c81d537e3d.gehaowu@bitmoe.com  
Backpatch-through: 18  

M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/include/optimizer/paths.h
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

Change some Datum to void * for opaque pass-through pointer

commit   : b7057e43467ff2d7c04c3abcf5ec35fcc7db9611    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Dec 2025 14:34:12 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Dec 2025 14:34:12 +0100    

Click here for diff

Here, Datum was used to pass around an opaque pointer between a group  
of functions.  But one might as well use void * for that; the use of  
Datum doesn't achieve anything here and is just distracting.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/1c5d23cb-288b-4154-b1cd-191fe2301707%40eisentraut.org  

M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/tsquery.c
M src/include/tsearch/ts_utils.h

Split some long Makefile lists

commit   : 9adf32da6b48e423e632ac24d6c634021e1ab154    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Dec 2025 09:17:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Dec 2025 09:17:42 +0900    

Click here for diff

This change makes more readable code diffs when adding new items or  
removing old items, while ensuring that lines do not get excessively  
long.  Some SUBDIRS, PROGRAMS and REGRESS lists are split.  
  
Note that there are a few more REGRESS lists that could be split,  
particularly in contrib/.  
  
Author: Jelte Fennema-Nio <postgres@jeltef.nl>  
Co-Authored-By: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/DF6HDGB559U5.3MPRFCWPONEAE@jeltef.nl  

M contrib/pageinspect/Makefile
M src/backend/Makefile
M src/backend/access/Makefile
M src/backend/optimizer/Makefile
M src/backend/storage/Makefile
M src/bin/scripts/Makefile
M src/include/Makefile
M src/interfaces/ecpg/Makefile
M src/pl/tcl/Makefile
M src/test/Makefile
M src/test/examples/Makefile

Fix incorrectly spelled city name

commit   : a9123db14a12e2e2dfb93dbbef4f2cdc2986023b    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 27 Dec 2025 23:47:40 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 27 Dec 2025 23:47:40 +0100    

Click here for diff

The correct spelling is Beijing, fix in regression test  
and docs.  
  
Author: JiaoShuntian <jiaoshuntian@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/ebfa3ec2-dc3c-4adb-be2a-4a882c2e85a7@gmail.com  

M doc/src/sgml/ref/alter_table.sgml
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_merge.sql
M src/test/regress/sql/partition_split.sql

Remove MsgType type

commit   : b63443718a4a3a50304610e6ccda93bbfa06a1e6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 27 Dec 2025 22:50:46 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 27 Dec 2025 22:50:46 +0100    

Click here for diff

Presumably, the C type MsgType was meant to hold the protocol message  
type in the pre-version-3 era, but this was never fully developed even  
then, and the name is pretty confusing nowadays.  It has only one  
vestigial use for cancel requests that we can get rid of.  Since a  
cancel request is indicated by a special protocol version number, we  
can use the ProtocolVersion type, which MsgType was based on.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/505e76cb-0ca2-4e22-ba0f-772b5dc3f230%40eisentraut.org  

M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-cancel.c
M src/tools/pgindent/typedefs.list

Add oauth_validator_libraries to variable_is_guc_list_quote

commit   : ec0da9b89377960553a3d9054ec79c0512742275    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 27 Dec 2025 23:05:48 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 27 Dec 2025 23:05:48 +0100    

Click here for diff

The variable_is_guc_list_quote function need to know about all  
GUC_QUOTE variables, this adds oauth_validator_libraries which  
was missing.  Backpatch to v18 where OAuth was introduced.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/tencent_03D4D2A5C0C8DCE0CD1DB4D945858E15420A@qq.com  
Backpatch-through: 18  

M src/bin/pg_dump/dumputils.c

Fix pg_stat_get_backend_activity() to use multi-byte truncated result

commit   : 36b8f4974a884a7206df97f37ea62d2adc0b77f0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Dec 2025 17:23:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Dec 2025 17:23:30 +0900    

Click here for diff

pg_stat_get_backend_activity() calls pgstat_clip_activity() to ensure  
that the reported query string is correctly truncated when it finishes  
with an incomplete multi-byte sequence.  However, the result returned by  
the function was not what pgstat_clip_activity() generated, but the  
non-truncated, original, contents from PgBackendStatus.st_activity_raw.  
  
Oversight in 54b6cd589ac2, so backpatch all the way down.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2mDzwc48q2EK9tSXS6iJMJ35wvxNQnHX+rXjy5VgLvJQw@mail.gmail.com  
Backpatch-through: 14  

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

doc: warn about the use of "ctid" queries beyond the examples

commit   : e82e9aaa6a2942505c2c328426778787e4976ea6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 26 Dec 2025 17:34:17 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 26 Dec 2025 17:34:17 -0500    

Click here for diff

Also be more assertive that "ctid" should not be used for long-term  
storage.  
  
Reported-by: Bernice Southey  
  
Discussion: https://postgr.es/m/CAEDh4nyn5swFYuSfcnGAbpQrKOc47Hh_ZyKVSPYJcu2P=51Luw@mail.gmail.com  
  
Backpatch-through: 17  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/update.sgml

doc: Remove duplicate word in ECPG description

commit   : f8a4cad8f42ea5232b56199f677a4752940d76ea    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 15:25:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 15:25:46 +0900    

Click here for diff

Author: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/d6d6a800f8b503cd78d5f4fa721198e40eec1677.camel@cybertec.at  
Backpatch-through: 14  

M doc/src/sgml/ecpg.sgml

Upgrade BufFile to use int64 for byte positions

commit   : bde3a4616072534fd03c75f9019d5165665ed211    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 08:41:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 08:41:56 +0900    

Click here for diff

This change has the advantage of removing some weird type casts, caused  
by offset calculations based on pgoff_t but saved as int (on older  
branches we use off_t, which could be 4 or 8 bytes depending on the  
environment).  These are safe currently because capped by  
MAX_PHYSICAL_FILESIZE, but we would run into problems when to make  
MAX_PHYSICAL_FILESIZE larger or allow callers of these routines to use a  
larger physical max size on demand.  
  
While on it, this improves BufFileDumpBuffer() so as we do not use an  
offset for "availbytes".  It is not a file offset per-set, but a number  
of available bytes.  
  
This change should lead to no functional changes.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz  

M src/backend/storage/file/buffile.c

Fix typo in stat_utils.c

commit   : eee19a30d60dacf571f44c252f3f8d455fee2b4f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 07:53:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 26 Dec 2025 07:53:46 +0900    

Click here for diff

Introduced by 213a1b895270.  
  
Reported-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAHewXNku-jz-FPKeJVk25fZ1pV2buYh5vpeqGDOB=bFQhKxXhw@mail.gmail.com  

M src/backend/statistics/stat_utils.c

Move attribute statistics functions to stat_utils.c

commit   : 213a1b89527049cb27bbcd6871fdb0c0916b43e1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 25 Dec 2025 15:13:39 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 25 Dec 2025 15:13:39 +0900    

Click here for diff

Many of the operations done for attribute stats in attribute_stats.c  
share the same logic as extended stats, as done by a patch under  
discussion to add support for extended stats import and export.  All the  
pieces necessary for extended statistics are moved to stats_utils.c,  
which is the file where common facilities are shared for stats files.  
  
The following renames are done:  
* get_attr_stat_type() -> statatt_get_type()  
* init_empty_stats_tuple() -> statatt_init_empty_tuple()  
* set_stats_slot() -> statatt_set_slot()  
* get_elem_stat_type() -> statatt_get_elem_type()  
  
While on it, this commit adds more documentation for all these  
functions, describing more their internals and the dependencies that  
have been implied for attribute statistics.  The same concepts apply to  
extended statistics, at some degree.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Yu Wang <wangyu_runtime@163.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com  

M src/backend/statistics/attribute_stats.c
M src/backend/statistics/stat_utils.c
M src/include/statistics/stat_utils.h

Fix planner error with SRFs and grouping sets

commit   : 325808cac9b379869099f47fe4f8198ddd7805c0    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Thu, 25 Dec 2025 12:12:52 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Thu, 25 Dec 2025 12:12:52 +0900    

Click here for diff

If there are any SRFs in a PathTarget, we must separate it into  
SRF-computing and SRF-free targets.  This is because the executor can  
only handle SRFs that appear at the top level of the targetlist of a  
ProjectSet plan node.  
  
If we find a subexpression that matches an expression already computed  
in the previous plan level, we should treat it like a Var and should  
not split it again.  setrefs.c will later replace the expression with  
a Var referencing the subplan output.  
  
However, when processing the grouping target for grouping sets, the  
planner can fail to recognize that an expression is already computed  
in the scan/join phase.  The root cause is a mismatch in the  
nullingrels bits.  Expressions in the grouping target carry the  
grouping nulling bit in their nullingrels to indicate that they can be  
nulled by the grouping step.  However, the corresponding expressions  
in the scan/join target do not have these bits.  
  
As a result, the exact match check in list_member() fails, leading the  
planner to incorrectly believe that the expression needs to be  
re-evaluated from its arguments, which are often not available in the  
subplan.  This can lead to planner errors such as "variable not found  
in subplan target list".  
  
To fix, ignore the grouping nulling bit when checking whether an  
expression from the grouping target is available in the pre-grouping  
input target.  This aligns with the matching logic in setrefs.c.  
  
Backpatch to v18, where this issue was introduced.  
  
Bug: #19353  
Reported-by: Marian MULLER REBEYROL <marian.muller@serli.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/19353-aaa179bba986a19b@postgresql.org  
Backpatch-through: 18  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/tlist.h
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

psql: Fix tab completion for VACUUM option values.

commit   : c5c808f9b30b098421ad9f255954c4b16d121ab4    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 24 Dec 2025 13:55:29 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 24 Dec 2025 13:55:29 -0800    

Click here for diff

Commit 8a3e4011 introduced tab completion for the ONLY option of  
VACUUM and ANALYZE, along with some code simplification using  
MatchAnyN. However, it caused a regression in tab completion for  
VACUUM option values. For example, neither ON nor OFF was suggested  
after "VACUUM (VERBOSE". In addition, the ONLY keyword was not  
suggested immediately after a completed option list.  
  
Backpatch to v18.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Discussion: https://postgr.es/m/20251223021509.19bba68ecbbc70c9f983c2b4@sraoss.co.jp  
Backpatch-through: 18  

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

doc: change "can not" to "cannot"

commit   : 41808377fec7e6d5bb80f550f3640a503470da23    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 Dec 2025 15:12:01 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 24 Dec 2025 15:12:01 -0500    

Click here for diff

Reported-by: Chao Li  
  
Author: Chao Li  
  
Discussion: https://postgr.es/m/CAEoWx2kyiD+7-vUoOYhH=y2Hrmvqyyhm4EhzgKyrxGBXOMWCxw@mail.gmail.com  

M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func/func-aggregate.sgml

Fix regression test failure when wal_level is set to minimal.

commit   : 0de5f0d869d1e06f172f10adf441e504174cf2fe    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 24 Dec 2025 10:48:27 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Wed, 24 Dec 2025 10:48:27 -0800    

Click here for diff

Commit 67c209 removed the WARNING for insufficient wal_level from the  
expected output, but the WARNING may still appear on buildfarm members  
that run with wal_level=minimal.  
  
To avoid unstable test output depending on wal_level, this commit the  
test to use ALTER PUBLICATION for verifying the same behavior,  
ensuring the output remains consistent regardless of the wal_level  
setting.  
  
Per buildfarm member thorntail.  
  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Discussion: https://postgr.es/m/TY4PR01MB16907680E27BAB146C8EB1A4294B2A@TY4PR01MB16907.jpnprd01.prod.outlook.com  

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

doc: Use proper tags in pg_overexplain documentation.

commit   : 008beba005c9990e2ba2a729c08585f051a24950    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Dec 2025 00:27:19 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 25 Dec 2025 00:27:19 +0900    

Click here for diff

The pg_overexplain documentation previously used the <literal> tag for  
some file names, struct names, and commands. Update the markup to  
use the more appropriate tags: <filename>, <structname>, and <command>.  
  
Backpatch to v18, where pg_overexplain was introduced.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Shixin Wang <wang-shi-xin@outlook.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEyYUzz0LjBV_fMcdwU3wgmu0NCoT+JJiozPa8DG6eeog@mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/pgoverexplain.sgml

Fix CREATE SUBSCRIPTION failure when the publisher runs on pre-PG19.

commit   : d1b35952da0fa94329b66f8a7768c61a416c6271    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 24 Dec 2025 23:43:30 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 24 Dec 2025 23:43:30 +0900    

Click here for diff

CREATE SUBSCRIPTION with copy_data=true and origin='none' previously  
failed when the publisher was running a version earlier than PostgreSQL 19,  
even though this combination should be supported.  
  
The failure occurred because the command issued a query calling  
pg_get_publication_sequences function on the publisher. That function  
does not exist before PG19 and the query is only needed for logical  
replication sequence synchronization, which is supported starting in PG19.  
  
This commit fixes this issue by skipping that query when the  
publisher runs a version earlier than PG19.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEx4twHtJdiPWTyAXJhcBPLaH467SH2ajGSe-41m65giA@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Fix version check for retain_dead_tuples subscription option.

commit   : 5e813edb55ed16f3b5540f099319bcca7ca1b816    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Wed, 24 Dec 2025 23:25:00 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Wed, 24 Dec 2025 23:25:00 +0900    

Click here for diff

The retain_dead_tuples subscription option is supported only when  
the publisher runs PostgreSQL 19 or later. However, it could previously  
be enabled even when the publisher was running an earlier version.  
  
This was caused by check_pub_dead_tuple_retention() comparing  
the publisher server version against 19000 instead of 190000.  
  
Fix this typo so that the version check correctly enforces the PG19+  
requirement.  
  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Discussion: https://postgr.es/m/CAHGQGwEx4twHtJdiPWTyAXJhcBPLaH467SH2ajGSe-41m65giA@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Update comments to reflect changes in 8e0d32a4a1.

commit   : 98e8fe57c24f69f9248a1fea09f618f10cc168d7    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 10:29:53 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 10:29:53 +0000    

Click here for diff

Commit 8e0d32a4a1 fixed an issue by allowing the replication origin to be  
created while marking the table sync state as SUBREL_STATE_DATASYNC.  
Update the comment in check_old_cluster_subscription_state() to accurately  
describe this corrected behavior.  
  
Author: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Backpatch-through: 17, where the code was introduced  
Discussion: https://postgr.es/m/CAA4eK1+KaSf5nV_tWy+SDGV6MnFnKMhdt41jJjSDWm6yCyOcTw@mail.gmail.com  
Discussion: https://postgr.es/m/aUTekQTg4OYnw-Co@paquier.xyz  

M src/bin/pg_upgrade/check.c

Doc: Clarify publication privilege requirements.

commit   : dc6c879455e2db9adb7cf656ac29fdddeac39d77    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 09:22:00 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 09:22:00 +0000    

Click here for diff

Update the logical replication documentation to explicitly outline the  
privilege requirements for each publication syntax. This will ensure users  
understand the necessary permissions when creating or managing  
publications.  
  
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Discussion: https://postgr.es/m/CANhcyEXODen4U0XLk0aAwFTwGxjAfE9eRaynREenLp-JBSaFHw@mail.gmail.com  

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

Teach expr_is_nonnullable() to handle more expression types

commit   : c8d2f68cc800e02f858f8f59e3e9ba46ce43e880    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 18:00:44 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 18:00:44 +0900    

Click here for diff

Currently, the function expr_is_nonnullable() checks only Const and  
Var expressions to determine if an expression is non-nullable.  This  
patch extends the detection logic to handle more expression types.  
  
This can enable several downstream optimizations, such as reducing  
NullTest quals to constant truth values (e.g., "COALESCE(var, 1) IS  
NULL" becomes FALSE) and converting "COUNT(expr)" to the more  
efficient "COUNT(*)" when the expression is proven non-nullable.  
  
This breaks a test case in test_predtest.sql, since we now simplify  
"ARRAY[] IS NULL" to constant FALSE, preventing it from weakly  
refuting a strict ScalarArrayOpExpr ("x = any(ARRAY[])").  To ensure  
the refutation logic is still exercised as intended, wrap the array  
argument in opaque_array().  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/sql/test_predtest.sql
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql

Optimize ROW(...) IS [NOT] NULL using non-nullable fields

commit   : cb7b7ec7a1c6d8933b7e731be2dd101080822cf8    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 18:00:02 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 18:00:02 +0900    

Click here for diff

We break ROW(...) IS [NOT] NULL into separate tests on its component  
fields.  During this breakdown, we can improve efficiency by utilizing  
expr_is_nonnullable() to detect fields that are provably non-nullable.  
  
If a component field is proven non-nullable, it affects the outcome  
based on the test type.  For an IS NULL test, a single non-nullable  
field refutes the whole NullTest, reducing it to constant FALSE.  For  
an IS NOT NULL test, the check for that specific field is guaranteed  
to succeed, so we can discard it from the list of component tests.  
  
This extends the existing optimization logic, which previously only  
handled Const fields, to support any expression that can be proven  
non-nullable.  
  
In passing, update the existing constant folding of NullTests to use  
expr_is_nonnullable() instead of var_is_nonnullable(), enabling it to  
benefit from future improvements to that function.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com  

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

Simplify COALESCE expressions using non-nullable arguments

commit   : 10c4fe074a92eccf9fa6f7a39fe4d3f97b9b87e2    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 17:58:49 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Wed, 24 Dec 2025 17:58:49 +0900    

Click here for diff

The COALESCE function returns the first of its arguments that is not  
null.  When an argument is proven non-null, if it is the first  
non-null-constant argument, the entire COALESCE expression can be  
replaced by that argument.  If it is a subsequent argument, all  
following arguments can be dropped, since they will never be reached.  
  
Currently, we perform this simplification only for Const arguments.  
This patch extends the simplification to support any expression that  
can be proven non-nullable.  
  
This can help avoid the overhead of evaluating unreachable arguments.  
It can also lead to better plans when the first argument is proven  
non-nullable and replaces the expression, as the planner no longer has  
to treat the expression as non-strict, and can also leverage index  
scans on the resulting expression.  
  
There is an ensuing plan change in generated_virtual.out, and we have  
to modify the test to ensure that it continues to test what it is  
intended to.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tender Wang <tndrwang@gmail.com>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/predicate.out
M src/test/regress/sql/generated_virtual.sql
M src/test/regress/sql/predicate.sql

Improve comment in pgstatfuncs.c

commit   : b947dd5c75b1f9681d07bf58969233e7c9a73eff    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Dec 2025 17:09:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Dec 2025 17:09:13 +0900    

Click here for diff

Author: Zizhen Qiao <zizhen_qiao@163.com>  
Discussion: https://postgr.es/m/5ee635f9.49f7.19b4ed9e803.Coremail.zizhen_qiao@163.com  

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

Don't advance origin during apply failure.

commit   : 1528b0d899d65e0b01120f7d06c23256d390e4fe    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 04:36:39 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 24 Dec 2025 04:36:39 +0000    

Click here for diff

The logical replication parallel apply worker could incorrectly advance  
the origin progress during an error or failed apply. This behavior risks  
transaction loss because such transactions will not be resent by the  
server.  
  
Commit 3f28b2fcac addressed a similar issue for both the apply worker and  
the table sync worker by registering a before_shmem_exit callback to reset  
origin information. This prevents the worker from advancing the origin  
during transaction abortion on shutdown. This patch applies the same fix  
to the parallel apply worker, ensuring consistent behavior across all  
worker types.  
  
As with 3f28b2fcac, we are backpatching through version 16, since parallel  
apply mode was introduced there and the issue only occurs when changes are  
applied before the transaction end record (COMMIT or ABORT) is received.  
  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Backpatch-through: 16  
Discussion: https://postgr.es/m/TY4PR01MB169078771FB31B395AB496A6B94B4A@TY4PR01MB16907.jpnprd01.prod.outlook.com  
Discussion: https://postgr.es/m/TYAPR01MB5692FAC23BE40C69DA8ED4AFF5B92@TYAPR01MB5692.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/worker.c
M src/test/subscription/t/023_twophase_stream.pl

Fix another case of indirectly casting away const.

commit   : 9f7565c6c2d45df9705556c60f41394a8356cdf9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Dec 2025 21:38:43 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Dec 2025 21:38:43 -0500    

Click here for diff

This one was missed in 8f1791c61, because the machines that  
detected those issues don't compile this function.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us  

M src/port/getopt.c

C comment: fix psql "pstdout" duplicate to "pstdin"

commit   : 2214a207ee8170afce79478df3b37114a94d976e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 Dec 2025 20:35:51 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 Dec 2025 20:35:51 -0500    

Click here for diff

Reported-by: Ignat Remizov  
  
Author: Ignat Remizov  
  
Discussion: https://postgr.es/m/CAKiC8XbbR2_YqmbxmYWuEA+MmWP3c=obV5xS1Hye3ZHS-Ss_DA@mail.gmail.com  

M src/bin/psql/copy.c

pg_visibility: Use visibilitymap_count instead of loop.

commit   : 55c46bbf3a09a20d09d423c5dd4fded64d179d3e    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 23 Dec 2025 10:33:06 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 23 Dec 2025 10:33:06 -0800    

Click here for diff

This commit updates pg_visibility_map_summary() to use the  
visibilitymap_count() API, replacing its own counting mechanism. This  
simplifies the function and improves performance by leveraging the  
vectorized implementation introduced in commit 41c51f0c68.  
  
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/CAEze2WgPu-EYYuYQimy=AHQHGa7w8EvLVve5DM5eGMR6zh-7sw@mail.gmail.com  

M contrib/pg_visibility/pg_visibility.c

Toggle logical decoding dynamically based on logical slot presence.

commit   : 67c20979ce72b8c236622e5603f9775968ff501c    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 23 Dec 2025 10:13:16 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 23 Dec 2025 10:13:16 -0800    

Click here for diff

Previously logical decoding required wal_level to be set to 'logical'  
at server start. This meant that users had to incur the overhead of  
logical-level WAL logging even when no logical replication slots were  
in use.  
  
This commit adds functionality to automatically control logical  
decoding availability based on logical replication slot presence. The  
newly introduced module logicalctl.c allows logical decoding to be  
dynamically activated when needed when wal_level is set to  
'replica'.  
  
When the first logical replication slot is created, the system  
automatically increases the effective WAL level to maintain  
logical-level WAL records. Conversely, after the last logical slot is  
dropped or invalidated, it decreases back to 'replica' WAL level.  
  
While activation occurs synchronously right after creating the first  
logical slot, deactivation happens asynchronously through the  
checkpointer process. This design avoids a race condition at the end  
of recovery; a concurrent deactivation could happen while the startup  
process enables logical decoding at the end of recovery, but WAL  
writes are still not permitted until recovery fully completes. The  
checkpointer will handle it after recovery is done. Asynchronous  
deactivation also avoids excessive toggling of the logical decoding  
status in workloads that repeatedly create and drop a single logical  
slot. On the other hand, this lazy approach can delay changes to  
effective_wal_level and the disabling logical decoding, especially  
when the checkpointer is busy with other tasks. We chose this lazy  
approach in all deactivation paths to keep the implementation simple,  
even though laziness is strictly required only for end-of-recovery  
cases. Future work might address this limitation either by using a  
dedicated worker instead of the checkpointer, or by implementing  
synchronous waiting during slot drops if workloads are significantly  
affected by the lazy deactivation of logical decoding.  
  
The effective WAL level, determined internally by XLogLogicalInfo, is  
allowed to change within a transaction until an XID is assigned. Once  
an XID is assigned, the value becomes fixed for the remainder of the  
transaction. This behavior ensures that the logging mode remains  
consistent within a writing transaction, similar to the behavior of  
GUC parameters.  
  
A new read-only GUC parameter effective_wal_level is introduced to  
monitor the actual WAL level in effect. This parameter reflects the  
current operational WAL level, which may differ from the configured  
wal_level setting.  
  
Bump PG_CONTROL_VERSION as it adds a new field to CheckPoint struct.  
  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoCVLeLYq09pQPaWs+Jwdni5FuJ8v2jgq-u9_uFbcp6UbA@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/pg_createsubscriber.sgml
M doc/src/sgml/system-views.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
A src/backend/replication/logical/logicalctl.c
M src/backend/replication/logical/meson.build
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/ipc/ipci.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/cache/inval.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
A src/include/replication/logicalctl.h
M src/include/replication/slot.h
M src/include/storage/lwlocklist.h
M src/include/storage/procsignal.h
M src/include/utils/guc_hooks.h
M src/test/recovery/meson.build
M src/test/recovery/t/035_standby_logical_decoding.pl
A src/test/recovery/t/051_effective_wal_level.pl
M src/test/regress/expected/publication.out
M src/test/subscription/t/001_rep_changes.pl
M src/tools/pgindent/typedefs.list

Fix bug in following update chain when locking a heap tuple

commit   : 955f5506863dce0a3416e3fae7c3297dbbaa946d    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 23 Dec 2025 13:37:16 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 23 Dec 2025 13:37:16 +0200    

Click here for diff

After waiting for a concurrent updater to finish, heap_lock_tuple()  
followed the update chain to lock all tuple versions. However, when  
stepping from the initial tuple to the next one, it failed to check  
that the next tuple's XMIN matches the initial tuple's XMAX. That's an  
important check whenever following an update chain, and the recursive  
part that follows the chain did it, but the initial step missed it.  
Without the check, if the updating transaction aborts, the updated  
tuple is vacuumed away and replaced by an unrelated tuple, the  
unrelated tuple might get incorrectly locked.  
  
Author: Jasper Smit <jasper.smit@servicenow.com>  
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail.com  
Backpatch-through: 14  

M src/backend/access/heap/heapam.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/heap_lock_update.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/heap_lock_update.spec

Fix orphaned origin in shared memory after DROP SUBSCRIPTION

commit   : 8e0d32a4a1bfbae7f8340679c3586626b5fe3a08    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Dec 2025 14:32:14 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Dec 2025 14:32:14 +0900    

Click here for diff

Since ce0fdbfe9722, a replication slot and an origin are created by each  
tablesync worker, whose information is stored in both a catalog and  
shared memory (once the origin is set up in the latter case).  The  
transaction where the origin is created is the same as the one that runs  
the initial COPY, with the catalog state of the origin becoming visible  
for other sessions only once the COPY transaction has committed.  The  
catalog state is coupled with a state in shared memory, initialized at  
the same time as the origin created in the catalogs.  Note that the  
transaction doing the initial data sync can take a long time, time that  
depends on the amount of data to transfer from a publication node to its  
subscriber node.  
  
Now, when a DROP SUBSCRIPTION is executed, all its workers are stopped  
with the origins removed.  The removal of each origin relies on a  
catalog lookup.  A worker still running the initial COPY would fail its  
transaction, with the catalog state of the origin rolled back while the  
shared memory state remains around.  The session running the DROP  
SUBSCRIPTION should be in charge of cleaning up the catalog and the  
shared memory state, but as there is no data in the catalogs the shared  
memory state is not removed.  This issue would leave orphaned origin  
data in shared memory, leading to a confusing state as it would still  
show up in pg_replication_origin_status.  Note that this shared memory  
data is sticky, being flushed on disk in replorigin_checkpoint at  
checkpoint.  This prevents other origins from reusing a slot position  
in the shared memory data.  
  
To address this problem, the commit moves the creation of the origin at  
the end of the transaction that precedes the one executing the initial  
COPY, making the origin immediately visible in the catalogs for other  
sessions, giving DROP SUBSCRIPTION a way to know about it.  A different  
solution would have been to clean up the shared memory state using an  
abort callback within the tablesync worker.  The solution of this commit  
is more consistent with the apply worker that creates an origin in a  
short transaction.  
  
A test is added in the subscription test 004_sync.pl, which was able to  
display the problem.  The test fails when this commit is reverted.  
  
Reported-by: Tenglong Gu <brucegu@amazon.com>  
Reported-by: Daisuke Higuchi <higudai@amazon.com>  
Analyzed-by: Michael Paquier <michael@paquier.xyz>  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/aUTekQTg4OYnw-Co@paquier.xyz  
Backpatch-through: 14  

M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/004_sync.pl

doc: add "DO" to "ON CONFLICT" in CREATE VIEW text

commit   : ea97154fc2f5ff830b1b9a6fc6cf540042c28cbc    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 Dec 2025 19:41:52 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 Dec 2025 19:41:52 -0500    

Click here for diff

This is done for consistency.  
  
Reported-by: jian he  
  
Author: Laurenz Albe  
  
Discussion: https://postgr.es/m/CACJufxEW1RRDD9ZWGcW_Np_Z9VGPE-YC7u0C6RcsEY8EKiTdBg@mail.gmail.com  

M doc/src/sgml/ref/create_view.sgml

Switch buffile.c/h to use pgoff_t instead of off_t

commit   : e5f3839af685c303d8ebcc1ea0d407c124372931    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Dec 2025 07:41:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 23 Dec 2025 07:41:34 +0900    

Click here for diff

off_t was previously used for offsets, which is 4 bytes on Windows,  
hence limiting the backend code to a hard limit for files longer than  
2GB.  This leads to some simplification in these files, removing some  
casts based on long, also 4 bytes on Windows.  
  
This commit removes one comment introduced in db3c4c3a2d98, not relevant  
anymore as pgoff_t is a safe 8-byte alternative on Windows.  
  
This change is surprisingly not invasive, as the callers of  
BufFileTell(), BufFileSeek() and BufFileTruncateFileSet() (worker.c,  
tuplestore.c, etc.) track offsets in local structures that just to  
switch from off_t to pgoff_t for the most part.  
  
The file is still relying on a maximum file size of  
MAX_PHYSICAL_FILESIZE (1GB).  This change allows the code to make this  
maximum potentially larger in the future, or larger on a per-demand  
basis.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz  

M src/backend/replication/logical/worker.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/tuplestore.c
M src/include/storage/buffile.h

psql: Improve tab completion for COPY option lists.

commit   : c6a7d3bab493e8d589f24d239db00ce5c2934178    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 22 Dec 2025 14:28:12 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 22 Dec 2025 14:28:12 -0800    

Click here for diff

Previously, only the first option in a parenthesized option list was  
suggested by tab completion. This commit enhances tab completion for  
both COPY TO and COPY FROM commands to suggest options after each  
comma.  
  
Also add completion for HEADER and FREEZE option value candidates.  
  
Author: Yugo Nagata <nagata@sraoss.co.jp>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/20250605100835.b396f9d656df1018f65a4556@sraoss.co.jp  

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

Add missing .gitignore for src/test/modules/test_cloexec.

commit   : 37a1688a1bae6e6ce6e09d2ac1a5f2420f1b5775    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 Dec 2025 14:06:54 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 Dec 2025 14:06:54 -0500    

Click here for diff

A src/test/modules/test_cloexec/.gitignore

doc: Fix incorrect reference in pg_overexplain documentation.

commit   : c5d162435ab7a6d8f992009810dfe869cfdb9dd6    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Mon, 22 Dec 2025 17:56:28 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Mon, 22 Dec 2025 17:56:28 +0900    

Click here for diff

Correct the referenced location of the RangeTblEntry definition  
in the pg_overexplain documentation.  
  
Backpatched to v18, where pg_overexplain was introduced.  
  
Author: Julien Tachoires <julien@tachoires.me>  
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>  
Discussion: https://postgr.es/m/20251218092319.tht64ffmcvzqdz7u@poseidon.home.virt  
Backpatch-through: 18  

M doc/src/sgml/pgoverexplain.sgml

Fix another typo in gininsert.c

commit   : d31276f0e290a58c3df999116bc59d2332ca3148    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 22 Dec 2025 12:38:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 22 Dec 2025 12:38:40 +0900    

Click here for diff

Reported-by: Tender Wang <tndrwang@gmail.com>  
Discussion: https://postgr.es/m/CAHewXNkRJ9DMFZMQKWQ32U+OTBR78KeGh2=9Wy5jEeWDxMVFcQ@mail.gmail.com  

M src/backend/access/gin/gininsert.c

Remove obsolete name_ops index-only scan comments.

commit   : fab5cd3dd1323f9e66efeb676c4bb212ff340204    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 21 Dec 2025 12:27:38 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 21 Dec 2025 12:27:38 -0500    

Click here for diff

nbtree index-only scans of an index that uses btree/name_ops as one of  
its index column's input opclasses are no longer at any risk of reading  
past the end of currTuples.  We're no longer reliant on such scans being  
able to at least read from the start of markTuples storage (which uses  
space from the same allocation as currTuples) to avoid a segfault:  
StoreIndexTuple (from nodeIndexonlyscan.c) won't actually read past the  
end of a cstring datum from a name_ops index.  In other words, we  
already have the "special-case treatment for name_ops" that the removed  
comment supposed we could avoid by relying on markTuples in this way.  
  
Oversight in commit a63224be49, which added special case handling of  
name_ops cstrings to StoreIndexTuple, but missed these comments.  

M src/backend/access/nbtree/nbtree.c

Clean up test_cloexec.c and Makefile.

commit   : bec2a0aa306599c59f2b7d35b26eba9864f29c10    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 21 Dec 2025 15:40:07 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 21 Dec 2025 15:40:07 +1300    

Click here for diff

An unused variable caused a compiler warning on BF animal fairywren, an  
snprintf() call was redundant, and some buffer sizes were inconsistent.  
Per code review from Tom Lane.  
  
The Makefile's test ifeq ($(PORTNAME), win32) never succeeded due to a  
circularity, so only Meson builds were actually compiling the new test  
code, partially explaining why CI didn't tell us about the warning  
sooner (the other problem being that CompilerWarnings only makes  
world-bin, a problem for another commit).  Simplify.  
  
Backpatch-through: 16, like commit c507ba55  
Author: Bryan Green <dbryan.green@gmail.com>  
Co-authored-by: Thomas Munro <tmunro@gmail.com>  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1086088.1765593851%40sss.pgh.pa.us  

M src/test/modules/test_cloexec/Makefile
M src/test/modules/test_cloexec/test_cloexec.c

heapam: Move logic to handle HEAP_MOVED into a helper function

commit   : 548de59d93d5593d5ef5354241510d57b68959db    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Dec 2025 13:28:34 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Dec 2025 13:28:34 -0500    

Click here for diff

Before we dealt with this in 6 near identical and one very similar copy.  
  
The helper function errors out when encountering a  
HEAP_MOVED_IN/HEAP_MOVED_OUT tuple with xvac considered current or  
in-progress. It'd be preferrable to do that change separately, but otherwise  
it'd not be possible to deduplicate the handling in  
HeapTupleSatisfiesVacuum().  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: https://postgr.es/m/lxzj26ga6ippdeunz6kuncectr5gfuugmm2ry22qu6hcx6oid6@lzx3sjsqhmt6  
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar  

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

bufmgr: Optimize & harmonize LockBufHdr(), LWLockWaitListLock()

commit   : 09ae2c8bac8db409a8cd0b8ee438ea7526deb4c3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Dec 2025 13:23:13 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 19 Dec 2025 13:23:13 -0500    

Click here for diff

The main optimization is for LockBufHdr() to delay initializing  
SpinDelayStatus, similar to what LWLockWaitListLock already did. The  
initialization is sufficiently expensive & buffer header lock acquisitions are  
sufficiently frequent, to make it worthwhile to instead have a fastpath (via a  
likely() branch) that does not initialize the SpinDelayStatus.  
  
While LWLockWaitListLock() already the aforementioned optimization, it did not  
use likely(), and inspection of the assembly shows that this indeed leads to  
worse code generation (also observed in a microbenchmark). Fix that by adding  
the likely().  
  
While the LockBufHdr() improvement is a small gain on its own, it mainly is  
aimed at preventing a regression after a future commit, which requires  
additional locking to set hint bits.  
  
While touching both, also make the comments more similar to each other.  
  
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

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

doc: clarify when physical/logical replication is used

commit   : 80f08a6e6a6c11ac3530c473cfb963f646d0891a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 Dec 2025 12:01:23 -0500    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 Dec 2025 12:01:23 -0500    

Click here for diff

The imprecision caused some text to be only partially accurate.  
  
Reported-by: Paul A Jungwirth  
  
Author: Robert Treat  
  
Discussion: https://postgr.es/m/CA%2BrenyULt3VBS1cRFKUfT2%3D5dr61xBOZdAZ-CqX3XLGXqY-aTQ%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml

Use proper type for RestoreTransactionSnapshot's PGPROC arg

commit   : 47a9f61fcafcf26bd3d68740ca05ba69ac729d93    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 19 Dec 2025 13:40:02 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 19 Dec 2025 13:40:02 +0200    

Click here for diff

Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/08cbaeb5-aaaf-47b6-9ed8-4f7455b0bc4b@iki.fi  

M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h

Update pg_hba.conf example to reflect MD5 deprecation

commit   : 44f49511b7940adf3be4337d4feb2de38fe92297    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Fri, 19 Dec 2025 15:48:18 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Fri, 19 Dec 2025 15:48:18 +0700    

Click here for diff

In the wake of commit db6a4a985, remove most use of 'md5' from the  
example configuration file. The only remainder is an example exception  
for a client that doesn't support SCRAM.  
  
Author: Mikael Gustavsson <mikael.gustavsson@smhi.se>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Andreas Karlsson <andreas@proxel.se>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Discussion: https://postgr.es/m/176595607507.978865.11597773194269211255@wrigleys.postgresql.org  
Discussion: https://postgr.es/m/4ed268473fdb4cf9b0eced6c8019d353@smhi.se  
Backpatch-through: 18  

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

Fix typos in gininsert.c

commit   : 5cdbec5aa9dcf5b30ad68485abdb1ec88324999f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Dec 2025 14:33:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Dec 2025 14:33:38 +0900    

Click here for diff

Introduced by 8492feb98f6d.  
  
Author: Xingbin She <xingbin.she@qq.com>  
Discussion: https://postgr.es/m/tencent_C254AE962588605F132DB4A6F87205D6A30A@qq.com  

M src/backend/access/gin/gininsert.c

Add guard to prevent recursive memory context logging.

commit   : b3ccb0a2cb2ef53571021d6c8f9b70809a6bf20c    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 19 Dec 2025 12:05:37 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 19 Dec 2025 12:05:37 +0900    

Click here for diff

Previously, if memory context logging was triggered repeatedly and  
rapidly while a previous request was still being processed, it could  
result in recursive calls to ProcessLogMemoryContextInterrupt().  
This could lead to infinite recursion and potentially crash the process.  
  
This commit adds a guard to prevent such recursion.  
If ProcessLogMemoryContextInterrupt() is already in progress and  
logging memory contexts, subsequent calls will exit immediately,  
avoiding unintended recursive calls.  
  
While this scenario is unlikely in practice, it's not impossible.  
This change adds a safety check to prevent such failures.  
  
Back-patch to v14, where memory context logging was introduced.  
  
Reported-by: Robert Haas <robertmhaas@gmail.com>  
Author: Fujii Masao <masao.fujii@gmail.com>  
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Artem Gavrilov <artem.gavrilov@percona.com>  
Discussion: https://postgr.es/m/CA+TgmoZMrv32tbNRrFTvF9iWLnTGqbhYSLVcrHGuwZvCtph0NA@mail.gmail.com  
Backpatch-through: 14  

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

Use table/index_close() more consistently

commit   : 9d0f7996e58c2a92efe06c901c6dfe1f6ced0a1d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Dec 2025 07:55:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Dec 2025 07:55:58 +0900    

Click here for diff

All the code paths updated here have been using relation_close() to  
close a relation that has already been opened with table_open() or  
index_open(), where a relkind check is enforced.  
  
table_close() and index_open() do the same thing as relation_close(), so  
there was no harm, but being inconsistent could lead to issues if the  
internals of these close() functions begin to introduce some logic  
specific to each relkind in the future.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/brin/brin.c
M src/backend/parser/parse_utilcmd.c

Sort DO_SUBSCRIPTION_REL dump objects independent of OIDs.

commit   : d49936f3028b0bb6ac8ff83e07e421ca2a4f5c3f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Thu, 18 Dec 2025 10:23:47 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Thu, 18 Dec 2025 10:23:47 -0800    

Click here for diff

Commit 0decd5e89db9f5edb9b27351082f0d74aae7a9b6 missed  
DO_SUBSCRIPTION_REL, leading to assertion failures.  In the unlikely use  
case of diffing "pg_dump --binary-upgrade" output, spurious diffs were  
possible.  As part of fixing that, align the DumpableObject naming and  
sort order with DO_PUBLICATION_REL.  The overall effect of this commit  
is to change sort order from (subname, srsubid) to (rel, subname).  
Since DO_SUBSCRIPTION_REL is only for --binary-upgrade, accept that  
larger-than-usual dump order change.  Back-patch to v17, where commit  
9a17be1e244a45a77de25ed2ada246fd34e4557d introduced DO_SUBSCRIPTION_REL.  
  
Reported-by: vignesh C <vignesh21@gmail.com>  
Author: vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com  
Backpatch-through: 17  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/t/004_subscription.pl

Do not emit WAL for unlogged BRIN indexes

commit   : 951b60f7abdcdeb37f2d73ad4822f278d2687c1c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 18 Dec 2025 15:08:48 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 18 Dec 2025 15:08:48 +0200    

Click here for diff

Operations on unlogged relations should not be WAL-logged. The  
brin_initialize_empty_new_buffer() function didn't get the memo.  
  
The function is only called when a concurrent update to a brin page  
uses up space that we're just about to insert to, which makes it  
pretty hard to hit. If you do manage to hit it, a full-page WAL record  
is erroneously emitted for the unlogged index. If you then crash,  
crash recovery will fail on that record with an error like this:  
  
    FATAL:  could not create file "base/5/32819": File exists  
  
Author: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CALdSSPhpZXVFnWjwEBNcySx_vXtXHwB2g99gE6rK0uRJm-3GgQ@mail.gmail.com  
Backpatch-through: 14  

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

Fix intermittent BF failure in 040_standby_failover_slots_sync.

commit   : b47c50e5667b489bec3affb55ecdf4e9c306ca2d    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 18 Dec 2025 05:06:55 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 18 Dec 2025 05:06:55 +0000    

Click here for diff

Commit 0d2d4a0ec3 introduced a test that verifies replication slot  
synchronization to a standby server via SQL API. However, the test did not  
configure synchronized_standby_slots. Without this setting, logical  
failover slots can advance beyond the physical replication slot, causing  
intermittent synchronization failures.  
  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Discussion: https://postgr.es/m/TY4PR01MB16907DF70205308BE918E0D4494ABA@TY4PR01MB16907.jpnprd01.prod.outlook.com  

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

btree_gist: Fix memory allocation formula

commit   : 5cf03552fbb43b2d2d11369d779f9b168ea9b87a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 18 Dec 2025 11:01:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 18 Dec 2025 11:01:43 +0900    

Click here for diff

This change has been suggested by the two authors listed in this commit,  
both of them providing an incomplete solution (David's formula relied on  
a "bytea *", while Bertrand's did not use palloc_array()).  The solution  
provided in this commit uses GBT_VARKEY instead of the inconsistent  
bytea for the allocation size, with a palloc_array().  
  
The change related to Vsrt is one I am flipping to a more consistent  
style, in passing.  
  
Author: David Geier <geidav.pg@gmail.com>  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  
Discussion: https://postgr.es/m/aTrG3Fi4APtfiCvQ@ip-10-97-1-34.eu-west-3.compute.internal  

M contrib/btree_gist/btree_utils_var.c

Fix const correctness in pgstat data serialization callbacks

commit   : 167cb26718e3eae4fef470900b4cd1d434f15649    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 18 Dec 2025 07:33:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 18 Dec 2025 07:33:40 +0900    

Click here for diff

4ba012a8ed9c defined the "header" (pointer to the stats data) of  
from_serialized_data() as a const, even though it is fine (and  
expected!) for the callback to modify the shared memory entry when  
loading the stats at startup.  
  
While on it, this commit updates the callback to_serialized_data() in  
the test module test_custom_stats to make the data extracted from the  
"header" parameter a const since it should never be modified: the stats  
are written to disk and no modifications are expected in the shared  
memory entry.  
  
This clarifies the API contract of these new callbacks.  
  
Reported-By: Peter Eisentraut <peter@eisentraut.org>  
Author: Michael Paquier <michael@paquier.xyz>  
Co-authored-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/d87a93b0-19c7-4db6-b9c0-d6827e7b2da1@eisentraut.org  

M src/include/utils/pgstat_internal.h
M src/test/modules/test_custom_stats/test_custom_var_stats.c

oauth_validator: Avoid races in log_check()

commit   : ab8af1db43031544a5c01314bef9f0392bfde7f9    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:46:05 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:46:05 -0800    

Click here for diff

Commit e0f373ee4 fixed up races in Cluster::connect_fails when using  
log_like. t/002_client.pl didn't get the memo, though, because it  
doesn't use Test::Cluster to perform its custom hook tests. (This is  
probably not an issue at the moment, since the log check is only done  
after authentication success and not failure, but there's no reason to  
wait for someone to hit it.)  
  
Introduce the fix, based on debug2 logging, to its use of log_check() as  
well, and move the logic into the test() helper so that any additions  
don't need to continually duplicate it.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  
Backpatch-through: 18  

M src/test/modules/oauth_validator/t/002_client.pl

libpq-oauth: use correct c_args in meson.build

commit   : 781ca72139d6f7d91629d09f55fb9c94822aa404    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:46:01 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:46:01 -0800    

Click here for diff

Copy-paste bug from b0635bfda: libpq-oauth.so was being built with  
libpq_so_c_args, rather than libpq_oauth_so_c_args. (At the moment, the  
two lists are identical, but that won't be true forever.)  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  
Backpatch-through: 18  

M src/interfaces/libpq-oauth/meson.build

libpq-fe.h: Don't claim SOCKTYPE in the global namespace

commit   : 8b217c96ea2d0cf5046092aef03612f46bb136e4    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:45:52 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Wed, 17 Dec 2025 11:45:52 -0800    

Click here for diff

The definition of PGoauthBearerRequest uses a temporary SOCKTYPE macro  
to hide the difference between Windows and Berkeley socket handles,  
since we don't surface pgsocket in our public API. This macro doesn't  
need to escape the header, because implementers will choose the correct  
socket type based on their platform, so I #undef'd it immediately after  
use.  
  
I didn't namespace that helper, though, so if anyone else needs a  
SOCKTYPE macro, libpq-fe.h will now unhelpfully get rid of it. This  
doesn't seem too far-fetched, given its proximity to existing POSIX  
macro names.  
  
Add a PQ_ prefix to avoid collisions, update and improve the surrounding  
documentation, and backpatch.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/libpq-fe.h

Rename regress.so's .mo file to postgresql-regress-VERSION.mo.

commit   : 5b4fb2b97d2d953629f2a83adb6b7292b4745476    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Dec 2025 14:10:42 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Dec 2025 14:10:42 -0500    

Click here for diff

I originally used just "regress-VERSION.mo", but that seems too  
generic considering that some packagers will put this file into  
a system-wide directory.  Per suggestion from Christoph Berg.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/aULSW7Xqx5MqDW_1@msg.df7cb.de  

M src/test/regress/nls.mk
M src/test/regress/po/meson.build
M src/test/regress/regress.c

Make postmaster 003_start_stop.pl test less flaky

commit   : 5cbaa00592d4c1e8ef519bf0d89c415bfa3b3473    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 17 Dec 2025 16:23:13 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 17 Dec 2025 16:23:13 +0200    

Click here for diff

The test is very sensitive to how backends start and exit, because it  
tests dead-end backends which occur when all the connection slots are  
in use. The test failed occasionally in the CI, when the backend that  
was launched for the raw_connect_works() check lingered for a while,  
and exited only later during the test. When it exited, it released a  
connection slot, when the test expected all the slots to be in use at  
that time.  
  
The 002_connection_limits.pl test had a similar issue: if the backend  
launched for safe_psql() in the test initialization lingers around, it  
uses up a connection slot during the test, messing up the test's  
connection counting. I haven't seen that in the CI, but when I added a  
"sleep(1);" to proc_exit(), the test failed.  
  
To make the tests more robust, restart the server to ensure that the  
lingering backends doesn't interfere with the later test steps.  
  
In the passing, fix a bogus test name.  
  
Report and analysis by Jelte Fennema-Nio, Andres Freund, Thomas Munro.  
  
Discussion: https://www.postgresql.org/message-id/CAGECzQSU2iGuocuP+fmu89hmBmR3tb-TNyYKjCcL2M_zTCkAFw@mail.gmail.com  
Backpatch-through: 18  

M src/test/postmaster/t/002_connection_limits.pl
M src/test/postmaster/t/003_start_stop.pl

Support existing publications in pg_createsubscriber.

commit   : 85ddcc2f4cdef490276d151c80459e287bceb782    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 17 Dec 2025 09:43:53 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 17 Dec 2025 09:43:53 +0000    

Click here for diff

Allow pg_createsubscriber to reuse existing publications instead of  
failing when they already exist on the publisher.  
  
Previously, pg_createsubscriber would fail if any specified publication  
already existed. Now, existing publications are reused as-is with their  
current configuration, and non-existing publications are created  
automatically with FOR ALL TABLES.  
  
This change provides flexibility when working with mixed scenarios of  
existing and new publications. Users should verify that existing  
publications have the desired configuration before reusing them, and can  
use --dry-run with verbose mode to see which publications will be reused  
and which will be created.  
  
Only publications created by pg_createsubscriber are cleaned up during  
error cleanup operations. Pre-existing publications are preserved unless  
'--clean=publications' is explicitly specified, which drops all  
publications.  
  
This feature would be helpful for pub-sub configurations where users want  
to subscribe to a subset of tables from the publisher.  
  
Author: Shubham Khanna <khannashubham1197@gmail.com>  
Reviewed-by: Euler Taveira <euler@eulerto.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: vignesh C <vignesh21@gmail.com>  
Reviewed-by: tianbing <tian_bing_0531@163.com>  
Discussion: https://postgr.es/m/CAHv8Rj%2BsxWutv10WiDEAPZnygaCbuY2RqiLMj2aRMH-H3iZwyA%40mail.gmail.com  

M doc/src/sgml/ref/pg_createsubscriber.sgml
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

Change pgstat_report_vacuum() to use Relation

commit   : f4e797171eac645eeae2a5e95bf3361bb7f7f0cc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Dec 2025 11:26:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Dec 2025 11:26:17 +0900    

Click here for diff

This change makes pgstat_report_vacuum() more consistent with  
pgstat_report_analyze(), that also uses a Relation.  This enforces a  
policy that callers of this routine should open and lock the relation  
whose statistics are updated before calling this routine.  We will  
unlikely have a lot of callers of this routine in the tree, but it seems  
like a good idea to imply this requirement in the long run.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aUEA6UZZkDCQFgSA@ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/heap/vacuumlazy.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/pgstat.h

Remove useless code in InjectionPointAttach()

commit   : 1d325ad99cb2dec0e8b45ba36909ee0a497d2a57    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Dec 2025 08:58:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Dec 2025 08:58:58 +0900    

Click here for diff

strlcpy() ensures that a target string is zero-terminated, so there is  
no need to enforce it a second time in this code.  This simplification  
could have been done in 0eb23285a257.  
  
Author: Feilong Meng <feelingmeng@foxmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/tencent_771178777C5BC17FCB7F7A1771CD1FFD5708@qq.com  

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

Avoid global LC_CTYPE dependency in pg_locale_icu.c.

commit   : 0a90df58cf38cf68d59c6841513be98aeeff250e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 15:32:57 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 15:32:57 -0800    

Click here for diff

ICU still depends on libc for compatibility with certain historical  
behavior for single-byte encodings. Make the dependency explicit by  
holding a locale_t object when required.  
  
We should consider a better solution in the future, such as decoding  
the text to UTF-32 and using u_tolower(). That would be a behavior  
change and require additional infrastructure though; so for now, just  
avoid the global LC_CTYPE dependency.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

M src/backend/utils/adt/pg_locale_icu.c
M src/include/utils/pg_locale.h

downcase_identifier(): use method table from locale provider.

commit   : 87b2968df0f866aaccb6ba69adf284e3c4a79454    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 15:32:41 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 15:32:41 -0800    

Click here for diff

Previously, libc's tolower() was always used for lowercasing  
identifiers, regardless of the database locale (though only characters  
beyond 127 in single-byte encodings were affected). Refactor to allow  
each provider to supply its own implementation of identifier  
downcasing.  
  
For historical compatibility, when using a single-byte encoding, ICU  
still relies on tolower().  
  
One minor behavior change is that, before the database default locale  
is initialized, it uses ASCII semantics to downcase the  
identifiers. Previously, it would use the postmaster's LC_CTYPE  
setting from the environment. While that could have some effect during  
GUC processing, for example, it would have been fragile to rely on the  
environment setting anyway. (Also, it only matters when the encoding  
is single-byte.)  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

M src/backend/parser/scansup.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h

ltree: fix case-insensitive matching.

commit   : 7f007e4a044a713df5320fca09621d6ba8e632ba    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 11:13:17 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 11:13:17 -0800    

Click here for diff

Previously, ltree_prefix_eq_ci() used lowercasing with the default  
collation; while ltree_crc32_sz() used tolower() directly. These were  
equivalent only if the default collation provider was libc and the  
encoding was single-byte.  
  
Change both to use casefolding with the default collation.  
  
Backpatch through 18, where the casefolding APIs were introduced. The  
bug exists in earlier versions, but would require some adaptation.  
  
A REINDEX is required for ltree indexes where the database default  
collation is not libc.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  
Discussion: https://postgr.es/m/01fc00fd66f641b9693d4f9f1af0ccf44cbdfbdf.camel@j-davis.com  

M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c

Clarify a #define introduced in 8d299052fe.

commit   : 24bf379cb15162514b01fc9fd05420a0203b82e9    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 12:48:53 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 12:48:53 -0800    

Click here for diff

The value is the same, but use the right symbol for clarity.  

M src/include/utils/pg_locale.h

Fix multibyte issue in ltree_strncasecmp().

commit   : 84d5efa7e3ebcf04694d312b0f14ceb35dcdfb8e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 10:35:40 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 16 Dec 2025 10:35:40 -0800    

Click here for diff

Previously, the API for ltree_strncasecmp() took two inputs but only  
one length (that of the smaller input). It truncated the larger input  
to that length, but that could break a multibyte sequence.  
  
Change the API to be a check for prefix equality (possibly  
case-insensitive) instead, which is all that's needed by the  
callers. Also, provide the lengths of both inputs.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/5f65b85740197ba6249ea507cddf609f84a6188b.camel%40j-davis.com  
Backpatch-through: 14  

M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltxtquery_op.c

Switch memory contexts in ReinitializeParallelDSM.

commit   : f1a6e622bd94735c36d72c663813b55c442739b4    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 16 Dec 2025 10:40:53 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 16 Dec 2025 10:40:53 -0500    

Click here for diff

We already do this in CreateParallelContext, InitializeParallelDSM, and  
LaunchParallelWorkers. I suspect the reason why the matching logic was  
omitted from ReinitializeParallelDSM is that I failed to realize that  
any memory allocation was happening here -- but shm_mq_attach does  
allocate, which could result in a shm_mq_handle being allocated in a  
shorter-lived context than the ParallelContext which points to it.  
  
That could result in a crash if the shorter-lived context is freed  
before the parallel context is destroyed. As far as I am currently  
aware, there is no way to reach a crash using only code that is  
present in core PostgreSQL, but extensions could potentially trip  
over this. Fixing this in the back-branches appears low-risk, so  
back-patch to all supported versions.  
  
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Co-authored-by: Jeevan Chalke <jeevan.chalke@enterprisedb.com>  
Backpatch-through: 14  
Discussion: http://postgr.es/m/CAKZiRmwfVripa3FGo06=5D1EddpsLu9JY2iJOTgbsxUQ339ogQ@mail.gmail.com  

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

Test PRI* macros even when we can't test NLS translation.

commit   : 462e2476525e71aa028c4a079bd77d2cac8a36b7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Dec 2025 12:01:46 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 Dec 2025 12:01:46 -0500    

Click here for diff

Further research shows that the reason commit 7db6809ce failed  
is that recent glibc versions short-circuit translation attempts  
when LC_MESSAGES is 'C.<encoding>', not only when it's 'C'.  
There seems no way around that, so we'll have to live with only  
testing NLS when a suitable real locale is installed.  
  
However, something can still be salvaged: it still seems like a  
good idea to verify that the PRI* macros work as-expected even when  
we can't check their translations (see f8715ec86 for motivation).  
Hence, adjust the test to always run the ereport calls, and tweak  
the parameter values in hopes of detecting any cases where there's  
confusion about the actual widths of the parameters.  
  
Discussion: https://postgr.es/m/1991599.1765818338@sss.pgh.pa.us  

M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
M src/test/regress/expected/nls_2.out
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql

Add explanatory comment to prune_freeze_setup()

commit   : bfe5c4bec75091d5c91813ff9c6994a169ceb8ef    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 16 Dec 2025 10:30:14 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 16 Dec 2025 10:30:14 -0500    

Click here for diff

heap_page_prune_and_freeze() fills in PruneState->deadoffsets, the array  
of OffsetNumbers of dead tuples. It is returned to the caller in the  
PruneFreezeResult. To avoid having two copies of the array, the  
PruneState saves only a pointer to the array. This was a bit unusual and  
confusing, so add a clarifying comment.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Suggested-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2=jiD1nqch4JQN+odAxZSD7mRvdoHUGJYN2r6tQG_66yQ@mail.gmail.com  

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

Fix const qualification in prune_freeze_setup()

commit   : 4877391ce894e5b964a69e94e1750cde9df04a07    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 16 Dec 2025 10:29:16 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Tue, 16 Dec 2025 10:29:16 -0500    

Click here for diff

The const qualification of the presult argument to prune_freeze_setup()  
is later cast away, so it was not correct. Remove it and add a comment  
explaining that presult should not be modified.  
  
Author: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/fb97d0ae-a0bc-411d-8a87-f84e7e146488%40eisentraut.org  

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

doc: Update header file mention for CompareType

commit   : b39013b7b1b116b5d9be51f0919b472b58b3a28d    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 Dec 2025 09:46:53 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 Dec 2025 09:46:53 +0100    

Click here for diff

Commit 119fc30 moved CompareType to cmptype.h but the mention in  
the docs still refered to primnodes.h  
  
Author: Daisuke Higuchi <higuchi.daisuke11@gmail.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAEVT6c8guXe5P=L_Un5NUUzCgEgbHnNcP+Y3TV2WbQh-xjiwqA@mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/gist.sgml

Separate out bytea sort support from varlena.c

commit   : 9303d62c6db0207b8c2649205f7bc9350c1f62db    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Dec 2025 15:19:16 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Dec 2025 15:19:16 +0700    

Click here for diff

In the wake of commit b45242fd3, bytea_sortsupport() still called out  
to varstr_sortsupport(). Treating bytea as a kind of text/varchar  
required varstr_sortsupport() to allow for the possibility of  
NUL bytes, but only for C collation. This was confusing. For  
better separation of concerns, create an independent sortsupport  
implementation in bytea.c.  
  
The heuristics for bytea_abbrev_abort() remain the same as for  
varstr_abbrev_abort(). It's possible that the bytea case warrants  
different treatment, but that is left for future investigation.  
  
In passing, adjust some strange looking comparisons in  
varstr_abbrev_abort().  
  
Author: Aleksander Alekseev <aleksander@tigerdata.com>  
Reviewed-by: John Naylor <johncnaylorls@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAJ7c6TP1bAbEhUJa6+rgceN6QJWMSsxhg1=mqfSN=Nb-n6DAKg@mail.gmail.com  

M src/backend/utils/adt/bytea.c
M src/backend/utils/adt/varlena.c
M src/tools/pgindent/typedefs.list

Add TAP test to check recovery when redo LSN is missing

commit   : 15f68cebdcecf5a5508aaa12780526232c13c3f0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Dec 2025 14:28:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Dec 2025 14:28:05 +0900    

Click here for diff

This commit provides test coverage for dc7c77f825d7, where the redo  
record and the checkpoint record finish on different WAL segments with  
the start of recovery able to detect that the redo record is missing.  
  
This test uses a wait injection point done in the critical section of a  
checkpoint, method that requires not one but actually two wait injection  
points to avoid any memory allocations within the critical section of  
the checkpoint:  
- Checkpoint run with a background psql.  
- One first wait point is run by the checkpointer before the critical  
section, allocating the shared memory required by the DSM registry for  
the wait machinery in the library injection_points.  
- First point is woken up.  
- Second wait point is loaded before the critical section, allocating  
the memory to build the path to the library loaded, then run in the  
critical section once the checkpoint redo record has been logged.  
- WAL segment is switched while waiting on the second point.  
- Checkpoint completes.  
- Stop cluster with immediate mode.  
- The segment that includes the redo record is removed.  
- Start, recovery fails as the redo record cannot be found.  
  
The error message introduced in dc7c77f825d7 is now reduced to a FATAL,  
meaning that the information is still provided while being able to use a  
test for it.  Nitin has provided a basic version of the test, that I  
have enhanced to make it portable with two points.  Without  
dc7c77f825d7, the cluster crashes in this test, not on a PANIC but due  
to the pointer dereference at the beginning of recovery, failure  
mentioned in the other commit.  
  
Author: Nitin Jadhav <nitinjadhavpostgres@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAMm1aWaaJi2w49c0RiaDBfhdCL6ztbr9m=daGqiOuVdizYWYaA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/meson.build
A src/test/recovery/t/050_redo_segment_missing.pl

Fail recovery when missing redo checkpoint record without backup_label

commit   : dc7c77f825d778cd49d35544c21e7efe1cd240af    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Dec 2025 13:29:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 Dec 2025 13:29:28 +0900    

Click here for diff

This commit adds an extra check at the beginning of recovery to ensure  
that the redo record of a checkpoint exists before attempting WAL  
replay, logging a PANIC if the redo record referenced by the checkpoint  
record could not be found.  This is the same level of failure as when a  
checkpoint record is missing.  This check is added when a cluster is  
started without a backup_label, after retrieving its checkpoint record.  
The redo LSN used for the check is retrieved from the checkpoint record  
successfully read.  
  
In the case where a backup_label exists, the startup process already  
fails if the redo record cannot be found after reading a checkpoint  
record at the beginning of recovery.  
  
Previously, the presence of the redo record was not checked.  If the  
redo and checkpoint records were located on different WAL segments, it  
would be possible to miss a entire range of WAL records that should have  
been replayed but were just ignored.  The consequences of missing the  
redo record depend on the version dealt with, these becoming worse the  
older the version used:  
- On HEAD, v18 and v17, recovery fails with a pointer dereference at the  
beginning of the redo loop, as the redo record is expected but cannot be  
found.  These versions are good students, because we detect a failure  
before doing anything, even if the failure is misleading in the shape of  
a segmentation fault, giving no information that the redo record is  
missing.  
- In v16 and v15, problems show at the end of recovery within  
FinishWalRecovery(), the startup process using a buggy LSN to decide  
from where to start writing WAL.  The cluster gets corrupted, still it  
is noisy about it.  
- v14 and older versions are worse: a cluster gets corrupted but it is  
entirely silent about the matter.  The redo record missing causes the  
startup process to skip entirely recovery, because a missing record is  
the same as not redo being required at all.  This leads to data loss, as  
everything is missed between the redo record and the checkpoint record.  
  
Note that I have tested that down to 9.4, reproducing the issue with a  
version of the author's reproducer slightly modified.  The code is wrong  
since at least 9.2, but I did not look at the exact point of origin.  
  
This problem has been found by debugging a cluster where the WAL segment  
including the redo segment was missing due to an operator error, leading  
to a crash, based on an investigation in v15.  
  
Requesting archive recovery with the creation of a recovery.signal or  
a standby.signal even without a backup_label would mitigate the issue:  
if the record cannot be found in pg_wal/, the missing segment can be  
retrieved with a restore_command when checking that the redo record  
exists.  This was already the case without this commit, where recovery  
would re-fetch the WAL segment that includes the redo record.  The check  
introduced by this commit makes the segment to be retrieved earlier to  
make sure that the redo record can be found.  
  
On HEAD, the code will be slightly changed in a follow-up commit to not  
rely on a PANIC, to include a test able to emulate the original problem.  
This is a minimal backpatchable fix, kept separated for clarity.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Analyzed-by: Andres Freund <andres@anarazel.de>  
Author: Nitin Jadhav <nitinjadhavpostgres@gmail.com>  
Discussion: https://postgr.es/m/20231023232145.cmqe73stvivsmlhs@awork3.anarazel.de  
Discussion: https://postgr.es/m/CAMm1aWaaJi2w49c0RiaDBfhdCL6ztbr9m=daGqiOuVdizYWYaA@mail.gmail.com  
Backpatch-through: 14  

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

Revert "Avoid requiring Spanish locale to test NLS infrastructure."

commit   : 84a3778c79c2d28b4dc281d03ef2ab019b16483b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 18:36:29 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 18:36:29 -0500    

Click here for diff

This reverts commit 7db6809ced4406257a80766e4109c8be8e1ea744.  
That doesn't seem to work with recent (last couple of years)  
glibc, and the reasons are obscure.  I can't let the farm stay  
this broken for long.  

M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
A src/test/regress/expected/nls_2.out
D src/test/regress/po/C.po
M src/test/regress/po/LINGUAS
A src/test/regress/po/es.po
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql

libpq: Align oauth_json_set_error() with other NLS patterns

commit   : f7fbd02d32c46ee1cada6c3faf94414657b7a19a    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:22:04 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:22:04 -0800    

Click here for diff

Now that the prior commits have fixed missing OAuth translations, pull  
the bespoke usage of libpq_gettext() for OAUTHBEARER parsing into  
oauth_json_set_error() itself, and make that a gettext trigger as well,  
to better match what the other sites are doing. Add an _internal()  
variant to handle the existing untranslated case.  
  
Suggested-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/0EEBCAA8-A5AC-4E3B-BABA-0BA7A08C361B%40yesql.se  
Backpatch-through: 18  

M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/nls.mk

libpq-oauth: Don't translate internal errors

commit   : 301a1dcf00c82350aad642b872d263730cd87f8f    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:21:00 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:21:00 -0800    

Click here for diff

Some error messages are generated when OAuth multiplexer operations fail  
unexpectedly in the client. Álvaro pointed out that these are both  
difficult to translate idiomatically (as they use internal terminology  
heavily) and of dubious translation value to end users (since they're  
going to need to get developer help anyway). The response parsing engine  
has a similar issue.  
  
Remove these from the translation files by introducing internal variants  
of actx_error() and oauth_parse_set_error().  
  
Suggested-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CAOYmi%2BkQQ8vpRcoSrA5EQ98Wa3G6jFj1yRHs6mh1V7ohkTC7JA%40mail.gmail.com  
Backpatch-through: 18  

M src/interfaces/libpq-oauth/oauth-curl.c

libpq: Add missing OAuth translations

commit   : ea3370b18ebea536a100ae6dce25add3f5eb6565    
  
author   : Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:17:10 -0800    
  
committer: Jacob Champion <jchampion@postgresql.org>    
date     : Mon, 15 Dec 2025 13:17:10 -0800    

Click here for diff

Several strings that should have been translated as they passed through  
libpq_gettext were not actually being pulled into the translation files,  
because I hadn't directly wrapped them in one of the GETTEXT_TRIGGERS.  
  
Move the responsibility for calling libpq_gettext() to the code that  
sets actx->errctx. Doing the same in report_type_mismatch() would result  
in double-translation, so mark those strings with gettext_noop()  
instead. And wrap two ternary operands with gettext_noop(), even though  
they're already in one of the triggers, since xgettext sees only the  
first.  
  
Finally, fe-auth-oauth.c was missing from nls.mk, so none of that file  
was being translated at all. Add it now.  
  
Original patch by Zhijie Hou, plus suggested tweaks by Álvaro Herrera  
and small additions by me.  
  
Reported-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Author: Zhijie Hou <houzj.fnst@fujitsu.com>  
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>  
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/TY4PR01MB1690746DB91991D1E9A47F57E94CDA%40TY4PR01MB16907.jpnprd01.prod.outlook.com  
Backpatch-through: 18  

M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq/nls.mk

Allow passing a pointer to GetNamedDSMSegment()'s init callback.

commit   : 48d4a1423d2e92d10077365532d92e059ba2eb2e    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 15 Dec 2025 14:27:16 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Mon, 15 Dec 2025 14:27:16 -0600    

Click here for diff

This commit adds a new "void *arg" parameter to  
GetNamedDSMSegment() that is passed to the initialization callback  
function.  This is useful for reusing an initialization callback  
function for multiple DSM segments.  
  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAN4CZFMjh8TrT9ZhWgjVTzBDkYZi2a84BnZ8bM%2BfLPuq7Cirzg%40mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/dsm_registry.c
M src/include/storage/dsm_registry.h
M src/test/modules/injection_points/injection_points.c
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_dsm_registry/test_dsm_registry.c

Revisit cosmetics of "For inplace update, send nontransactional invalidations."

commit   : 64bf53dd61ea3224020bb340725a4df6a27bc974    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Dec 2025 12:19:49 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Dec 2025 12:19:49 -0800    

Click here for diff

This removes a never-used CacheInvalidateHeapTupleInplace() parameter.  
It adds README content about inplace update visibility in logical  
decoding.  It rewrites other comments.  
  
Back-patch to v18, where commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704  
first appeared.  Since this removes a CacheInvalidateHeapTupleInplace()  
parameter, expect a v18 ".abi-compliance-history" edit to follow.  PGXN  
contains no calls to that function.  
  
Reported-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reported-by: Ilyasov Ian <ianilyasov@outlook.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Surya Poondla <s_poondla@apple.com>  
Discussion: https://postgr.es/m/CA+renyU+LGLvCqS0=fHit-N1J-2=2_mPK97AQxvcfKm+F-DxJA@mail.gmail.com  
Backpatch-through: 18  

M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
M src/backend/replication/logical/decode.c
M src/backend/utils/cache/inval.c
M src/include/utils/inval.h

Correct comments of "Fix data loss at inplace update after heap_update()".

commit   : 0839fbe400d7807196d1442f4c781f9234ac2a4c    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Dec 2025 12:19:49 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 15 Dec 2025 12:19:49 -0800    

Click here for diff

This corrects commit a07e03fd8fa7daf4d1356f7cb501ffe784ea6257.  
  
Reported-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Reported-by: Surya Poondla <s_poondla@apple.com>  
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://postgr.es/m/CA+renyWCW+_2QvXERBQ+mna6ANwAVXXmHKCA-WzL04bZRsjoBA@mail.gmail.com  

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

Avoid requiring Spanish locale to test NLS infrastructure.

commit   : 7db6809ced4406257a80766e4109c8be8e1ea744    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 15:16:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 15:16:26 -0500    

Click here for diff

I had supposed that the majority of machines with gettext installed  
would have most language locales installed, but at least in the  
buildfarm it turns out less than half have es_ES installed.  So  
depending on that to run the test now seems like a bad idea.  But it  
turns out that gettext can be persuaded to "translate" even in the C  
locale, as long as you fake out its short-circuit logic by spelling  
the locale name like "C.UTF-8" or similar.  (Many thanks to Bryan  
Green for correcting my misconceptions about that.)  Quick testing  
suggests that that spelling is accepted by most platforms, though  
again the buildfarm may show that "most" isn't "all".  
  
Hence, remove the es_ES dependency and instead create a "C" message  
catalog.  I've made the test unconditionally set lc_messages to  
'C.UTF-8'.  That approach might need adjustment depending on what  
the buildfarm shows, but let's keep it simple until proven wrong.  
  
While at it, tweak the test so that we run the various ereport's  
even when !ENABLE_NLS.  This is useful to verify that the macros  
provided by <inttypes.h> are compatible with snprintf.c, as we  
now know is worth questioning.  
  
Discussion: https://postgr.es/m/1991599.1765818338@sss.pgh.pa.us  

M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
D src/test/regress/expected/nls_2.out
A src/test/regress/po/C.po
M src/test/regress/po/LINGUAS
D src/test/regress/po/es.po
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql

Remove incorrect declarations in pg_wchar.h.

commit   : 95a19fefdcbe8d7c511971fe3b9554d0bdd4e26a    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:38:55 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:38:55 -0800    

Click here for diff

Oversight in commit 9acae56ce0.  
  
Discussion: https://postgr.es/m/541F240E-94AD-4D65-9794-7D6C316BC3FF@gmail.com  

M src/include/mb/pg_wchar.h

Remove unused single-byte char_is_cased() API.

commit   : 54c41a6deb9df0868da078490ef9c26d1290e490    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:24:57 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:24:57 -0800    

Click here for diff

https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h

Use multibyte-aware extraction of pattern prefixes.

commit   : 9c8de1596912b36a8b22d880766ac660b66d03c7    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:24:47 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 15 Dec 2025 10:24:47 -0800    

Click here for diff

Previously, like_fixed_prefix() used char-at-a-time logic, which  
forced it to be too conservative for case-insensitive matching.  
  
Introduce like_fixed_prefix_ci(), and use that for case-insensitive  
pattern prefixes. It uses multibyte and locale-aware logic, along with  
the new pg_iswcased() API introduced in 630706ced0.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

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

Add offnum range checks to suppress compile warnings with UBSAN.

commit   : 8191937082a2d4738afc7a232ac08789eea151a3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 12:40:09 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 15 Dec 2025 12:40:09 -0500    

Click here for diff

Late-model gcc with -fsanitize=undefined enabled issues warnings  
about uses of PageGetItemId() when it can't prove that the  
offsetNumber is > 0.  The call sites where this happens are  
checking that the offnum is <= PageGetMaxOffsetNumber(page), so  
it seems reasonable to add an explicit check that offnum >= 1 too.  
  
While at it, rearrange the code to be less contorted and avoid  
duplicate checks on PageGetMaxOffsetNumber.  Maybe the compiler  
would optimize away the duplicate logic or maybe not, but the  
existing coding has little to recommend it anyway.  
  
There are multiple instances of this identical coding pattern in  
heapam.c and heapam_xlog.c.  Current gcc only complains about two  
of them, but I fixed them all in the name of consistency.  
  
Potentially this could be back-patched in the name of silencing  
warnings; but I think enabling UBSAN is mainly something people  
would do on HEAD, so for now it seems not worth the trouble.  
  
Discussion: https://postgr.es/m/1699806.1765746897@sss.pgh.pa.us  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/nbtree/nbtsearch.c

Increase timeout in multixid_conversion upgrade test

commit   : bd43940b02b292c836e912a8f9423f771ec15fab    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 18:06:24 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 18:06:24 +0200    

Click here for diff

The workload to generate multixids before upgrade is very slow on  
buildfarm members running with JIT enabled. The workload runs a lot of  
small queries, so it's unsurprising that JIT makes it slower. On my  
laptop it nevertheless runs in under 10 s even with JIT enabled, while  
some buildfarm members have been hitting the 180 s timeout. That seems  
extreme, but I suppose it's still expected on very slow and busy  
buildfarm animals. The timeout applies to the BackgroundPsql sessions  
as whole rather than the individual queries.  
  
Bump up the timeout to avoid the test failures. Add periodic progress  
reports to the test output so that we get a better picture of just how  
slow the test is.  
  
In the passing, also fix comments about how many multixids and members  
the workload generates. The comments were written based on 10 parallel  
connections, but it actually uses 20.  
  
Discussion: https://www.postgresql.org/message-id/b7faf07c-7d2c-4f35-8c43-392e057153ef@gmail.com  

M src/bin/pg_upgrade/t/007_multixact_conversion.pl

Improve sanity checks on multixid members length

commit   : ecb553ae8211e3d135e0c9d42b90cc22be51d27c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 13:30:17 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 13:30:17 +0200    

Click here for diff

In the server, check explicitly for multixids with zero members. We  
used to have an assertion for it, but commit d4b7bde418 replaced it  
with more extensive runtime checks, but it missed the original case of  
zero members.  
  
In the upgrade code, a negative length never makes sense, so better  
check for it explicitly. Commit d4b7bde418 added a similar sanity  
check to the corresponding server code on master, and in backbranches,  
the 'length' is passed to palloc which would fail with "invalid memory  
alloc request size" error. Clarify the comments on what kind of  
invalid entries are tolerated by the upgrade code and which ones are  
reported as fatal errors.  
  
Coverity complained about 'length' in the upgrade code being  
tainted. That's bogus because we trust the data on disk at least to  
some extent, but hopefully this will silence the complaint. If not,  
I'll dismiss it manually.  
  
Discussion: https://www.postgresql.org/message-id/7b505284-c6e9-4c80-a7ee-816493170abc@iki.fi  

M src/backend/access/transam/multixact.c
M src/bin/pg_upgrade/multixact_read_v18.c

Disable recently added CIC/RI isolation tests

commit   : 77038d6d0b49622e719fc00ed46db0ab47d2b747    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 15 Dec 2025 12:17:37 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 15 Dec 2025 12:17:37 +0100    

Click here for diff

We have tried to stabilize them several times already, but they are very  
flaky -- apparently there's some intrinsic instability that's hard to  
solve with the isolationtester framework.  They are very noisy in CI  
runs (whereas buildfarm has not registered any such failures).  They may  
need to be rewritten completely.  In the meantime just comment them out  
in Makefile/meson.build, leaving the spec files around.  
  
Per complaint from Andres Freund.  
  
Discussion: https://postgr.es/m/202512112014.icpomgc37zx4@alvherre.pgsql  

M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/meson.build

Refactor static_assert() support.

commit   : 17f446784d54da827f74c2acc0fa772a41b92354    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 Dec 2025 11:43:11 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 Dec 2025 11:43:11 +0100    

Click here for diff

HAVE__STATIC_ASSERT was really a test for GCC statement expressions,  
as needed for StaticAssertExpr() now that _Static_assert could be  
assumed to be available through our C11 requirement.  This  
artificially prevented Visual Studio from being able to use  
static_assert() in other contexts.  
  
Instead, make a new test for HAVE_STATEMENT_EXPRESSIONS, and use that  
to control only whether StaticAssertExpr() uses fallback code, not the  
other variants.  This improves the quality of failure messages in the  
(much more common) other variants under Visual Studio.  
  
Also get rid of the two separate implementations for C++, since the C  
implementation is also also valid as C++11.  While it is a stretch to  
apply HAVE_STATEMENT_EXPRESSIONS tested with $CC to a C++ compiler,  
the previous C++ coding assumed that the C++ compiler had them  
unconditionally, so it isn't a new stretch.  In practice, the C and  
C++ compilers are very likely to agree, and if a combination is ever  
reported that falsifies this assumption we can always reconsider that.  
  
Author: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in

Clarify comment on multixid offset wraparound check

commit   : 366dcdaf5779792f522d1d18a8e558244850afdf    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 11:47:04 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 15 Dec 2025 11:47:04 +0200    

Click here for diff

Coverity complained that offset cannot be 0 here because there's an  
explicit check for "offset == 0" earlier in the function, but it  
didn't see the possibility that offset could've wrapped around to 0.  
The code is correct, but clarify the comment about it.  
  
The same code exists in backbranches in the server  
GetMultiXactIdMembers() function and in 'master' in the pg_upgrade  
GetOldMultiXactIdSingleMember function. In backbranches Coverity  
didn't complain about it because the check was merely an assertion,  
but change the comment in all supported branches for consistency.  
  
Per Tom Lane's suggestion.  
  
Discussion: https://www.postgresql.org/message-id/1827755.1765752936@sss.pgh.pa.us  

M src/bin/pg_upgrade/multixact_read_v18.c

Fix typo in tablecmds.c

commit   : cd83ed9a91bbd4d05fffd059161b060b7473f5ad    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 15 Dec 2025 17:17:04 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 15 Dec 2025 17:17:04 +1300    

Click here for diff

Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2%3DAib%2BcatZn6wHKmz0BWe8-q10NAhpxu8wUDT19SddKNA%40mail.gmail.com  

M src/backend/commands/tablecmds.c

Add retry logic to pg_sync_replication_slots().

commit   : 0d2d4a0ec3eca64e7f5ce7f7630b56a561b2663c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 15 Dec 2025 02:50:21 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 15 Dec 2025 02:50:21 +0000    

Click here for diff

Previously, pg_sync_replication_slots() would finish without synchronizing  
slots that didn't meet requirements, rather than failing outright. This  
could leave some failover slots unsynchronized if required catalog rows or  
WAL segments were missing or at risk of removal, while the standby  
continued removing needed data.  
  
To address this, the function now waits for the primary slot to advance to  
a position where all required data is available on the standby before  
completing synchronization. It retries cyclically until all failover slots  
that existed on the primary at the start of the call are synchronized.  
Slots created after the function begins are not included. If the standby  
is promoted during this wait, the function exits gracefully and the  
temporary slots will be removed.  
  
Author: Ajin Cherian <itsajin@gmail.com>  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Yilin Zhang <jiezhilove@126.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com  

M doc/src/sgml/func/func-admin.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/replication/logical/slotsync.c
M src/backend/utils/activity/wait_event_names.txt
M src/test/recovery/t/040_standby_failover_slots_sync.pl

test_custom_stats: Fix compilation warning

commit   : 33980eaa6df0b1358ba2e70edbe9efd56dbd7fa6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 10:34:18 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 10:34:18 +0900    

Click here for diff

I have fat-fingered an error message related to an offset while  
switching the code to use pgoff_t.  Let's switch to the same error  
message used in the rest of the tree for similar failures with fseeko(),  
instead.  
  
Per buildfarm members running macos: longfin, sifaka and indri.  

M src/test/modules/test_custom_stats/test_custom_var_stats.c

pageinspect: use index_close() for GiST index relation

commit   : 171198ff2a57fafe0772ec9d3dfbf061cffffacd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 10:28:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 10:28:28 +0900    

Click here for diff

gist_page_items() opens its target relation with index_open(), but  
closed it using relation_close() instead of index_close().  This was  
harmless because index_close() and relation_close() do the exact same  
work, still inconsistent with the rest of the code tree as routines  
opening and closing a relation based on a relkind are expected to match,  
at least in name.  
  
Author: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAEoWx2=bL41WWcD-4Fxx-buS2Y2G5=9PjkxZbHeFMR6Uy2WNvw@mail.gmail.com  

M contrib/pageinspect/gistfuncs.c

test_custom_stats: Add tests with read/write of auxiliary data

commit   : 481783e69f144936f1ebbc3259809bee518c6c0c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 09:47:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 09:47:30 +0900    

Click here for diff

This commit builds upon 4ba012a8ed9c, giving an example of what can be  
achieved with the new callbacks.  This provides coverage for the new  
pgstats APIs, while serving as a reference template.  
  
Note that built-in stats kinds could use them, we just don't have a  
use-case there yet.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s9SDOu+Z6veoJCHWk+kDeTktAtC-KY9fQ9Z6BJdDUirQ@mail.gmail.com  

M src/test/modules/test_custom_stats/t/001_custom_stats.pl
M src/test/modules/test_custom_stats/test_custom_var_stats–1.0.sql
M src/test/modules/test_custom_stats/test_custom_var_stats.c

Allow cumulative statistics to read/write auxiliary data from/to disk

commit   : 4ba012a8ed9c4214bd35b221c087f02efb1ac424    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 09:40:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 Dec 2025 09:40:56 +0900    

Click here for diff

Cumulative stats kinds gain the capability to write additional per-entry  
data when flushing the stats at shutdown, and read this data when  
loading back the stats at startup.  This can be fit for example in the  
case of variable-length data (like normalized query strings), so as it  
becomes possible to link the shared memory stats entries to data that is  
stored in a different area, like a DSA segment.  
  
Three new optional callbacks are added to PgStat_KindInfo, available to  
variable-numbered stats kinds:  
* to_serialized_data: writes auxiliary data for an entry.  
* from_serialized_data: reads auxiliary data for an entry.  
* finish: performs actions after read/write/discard operations.  This is  
invoked after processing all the entries of a kind, allowing extensions  
to close file handles and clean up resources.  
  
Stats kinds have the option to store this data in the existing pgstats  
file, but can as well store it in one or more additional files whose  
names can be built upon the entry keys.  The new serialized callbacks  
are called once an entry key is read or written from the main stats  
file.  A file descriptor to the main pgstats file is available in the  
arguments of the callbacks.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s9SDOu+Z6veoJCHWk+kDeTktAtC-KY9fQ9Z6BJdDUirQ@mail.gmail.com  

M src/backend/utils/activity/pgstat.c
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

Update typedefs.list to match what the buildfarm currently reports.

commit   : 58dad7f349b3fdbadda6bead21d596a448db1950    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 17:03:53 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 17:03:53 -0500    

Click here for diff

The current list from the buildfarm includes quite a few typedef  
names that it used to miss.  The reason is a bit obscure, but it  
seems likely to have something to do with our recent increased  
use of palloc_object and palloc_array.  In any case, this makes  
the relevant struct declarations be much more nicely formatted,  
so I'll take it.  Install the current list and re-run pgindent  
to update affected code.  
  
Syncing with the current list also removes some obsolete  
typedef names and fixes some alphabetization errors.  
  
Discussion: https://postgr.es/m/1681301.1765742268@sss.pgh.pa.us  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/twophase.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/partitioning/partdesc.c
M src/backend/utils/adt/arrayfuncs.c
M src/include/access/gin_private.h
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/skipsupport.h
M src/include/utils/tuplesort.h
M src/test/modules/test_int128/test_int128.c
M src/tools/pgindent/typedefs.list

Make "pgoff_t" be a typedef not a #define.

commit   : 66b2282b0c2237bccd933804da2e1dd0321ac151    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 16:53:34 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 16:53:34 -0500    

Click here for diff

There doesn't seem to be any great reason why this has been a macro  
rather than a typedef.  But doing it like that means our buildfarm  
typedef tooling doesn't capture the name as a typedef.  That would  
result in pgindent glitches, except that we've seemingly kept it  
in typedefs.list manually.  That's obviously error-prone, so let's  
convert it to a typedef now.  
  
Discussion: https://postgr.es/m/1681301.1765742268@sss.pgh.pa.us  

M src/include/port.h
M src/include/port/win32_port.h

Looks like we can't test NLS on machines that lack any es_ES locale.

commit   : fe7ede45f125af271fb3fef3cc5ee507d4c40d87    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 14:30:34 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 14:30:34 -0500    

Click here for diff

While commit 5b275a6e1 fixed a few unhappy buildfarm animals,  
it looks like the remainder simply don't have any es_ES locale  
at all.  There's little point in running the test in that case,  
so minimize the number of variant expected-files by bailing out.  
Also emit a log entry so that it's possible to tell from buildfarm  
postmaster logs which case occurred.  
  
Possibly, the scope of this testing could be improved by providing  
additional translations.  But I think it's likely that the failing  
animals have no non-C locales installed at all.  
  
In passing, update typedefs.list so that koel doesn't think  
regress.c is misformatted.  
  
Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org  

M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
A src/test/regress/expected/nls_2.out
M src/test/regress/sql/nls.sql
M src/tools/pgindent/typedefs.list

bufmgr: Add one-entry cache for private refcount

commit   : 30df61990c67f0cf7450e36c1e038d513960f148    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 14 Dec 2025 13:09:43 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 14 Dec 2025 13:09:43 -0500    

Click here for diff

The private refcount entry for a buffer is often looked up repeatedly for the  
same buffer, e.g. to pin and then unpin a buffer. Benchmarking shows that it's  
worthwhile to have a one-entry cache for that case. With that cache in place,  
it's worth splitting GetPrivateRefCountEntry() into a small inline  
portion (for the cache hit case) and an out-of-line helper for the rest.  
  
This is helpful for some workloads today, but becomes more important in an  
upcoming patch that will utilize the private refcount infrastructure to also  
store whether the buffer is currently locked, as that increases the rate of  
lookups substantially.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar  

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

bufmgr: Separate keys for private refcount infrastructure

commit   : edbaaea0a95ef1c32ffe8aa62e1556588c7a714b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 14 Dec 2025 13:09:43 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 14 Dec 2025 13:09:43 -0500    

Click here for diff

This makes lookups faster, due to allowing auto-vectorized lookups. It is also  
beneficial for an upcoming patch, independent of auto-vectorization, as the  
upcoming patch wants to track more information for each pinned buffer, making  
the existing loop, iterating over an array of PrivateRefCountEntry, more  
expensive due to increasing its size.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

M src/backend/storage/buffer/bufmgr.c
M src/tools/pgindent/typedefs.list

Try a few different locale name spellings in nls.sql.

commit   : 5b275a6e154833803d3beb49da0879d2fe8b1d6c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 12:54:57 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 12:54:57 -0500    

Click here for diff

While CI testing in advance of commit 8c498479d suggested that all  
Unix-ish platforms would accept 'es_ES.UTF-8', the buildfarm has  
a different opinion.  Let's dynamically select something that works,  
if possible.  
  
Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org  

M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
M src/test/regress/sql/nls.sql

Fix double assignment.

commit   : b853e644d78d99ef1779c9bf7bc3944694460aa2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 12:09:56 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 12:09:56 -0500    

Click here for diff

Coverity complained about this, not without reason:  
  
	OldMultiXactReader *state = state = pg_malloc(sizeof(*state));  
  
(I'm surprised this is even legal C ... why is "state" in-scope  
in its initialization expression?)  
  
While at it, convert to use our newly-preferred "pg_malloc_object"  
macro instead of an explicit sizeof().  

M src/bin/pg_upgrade/multixact_read_v18.c

Add a regression test to verify that NLS translation works.

commit   : 8c498479d70f963533d57d8bb1b3a58e00fe0d03    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 11:55:18 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 14 Dec 2025 11:55:18 -0500    

Click here for diff

We've never actually had a formal test for this facility.  
It seems worth adding one now, mainly because we are starting  
to depend on gettext() being able to handle the PRI* macros  
from <inttypes.h>, and it's not all that certain that that  
works everywhere.  So the test goes to a bit of effort to  
check all the PRI* macros we are likely to use.  
  
(This effort has indeed found one problem already, now fixed  
in commit f8715ec86.)  
  
Discussion: https://postgr.es/m/3098752.1765221796@sss.pgh.pa.us  
Discussion: https://postgr.es/m/292844.1765315339@sss.pgh.pa.us  

A src/test/regress/expected/nls.out
A src/test/regress/expected/nls_1.out
M src/test/regress/meson.build
A src/test/regress/nls.mk
M src/test/regress/parallel_schedule
A src/test/regress/po/LINGUAS
A src/test/regress/po/es.po
A src/test/regress/po/meson.build
M src/test/regress/regress.c
A src/test/regress/sql/nls.sql

Refactor WaitLSNType enum to use a macro for type count

commit   : b27e48213fbc1d0ff698be4ae5a0eb3e161d9172    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 17:18:32 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 17:18:32 +0200    

Click here for diff

Change WAIT_LSN_TYPE_COUNT from an enum sentinel to a macro definition,  
in a similar way to IOObject, IOContext, and BackendType enums.  Remove  
explicit enum value assignments well.  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  

M src/backend/access/transam/xlogwait.c
M src/include/access/xlogwait.h

Fix usage of palloc() in MERGE/SPLIT PARTITION(s) code

commit   : c5ae07a90a0f3594e5053a26f3c99b041df427d3    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 16:10:25 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 16:10:25 +0200    

Click here for diff

f2e4cc427951 and 4b3d173629f4 implement ALTER TABLE ... MERGE/SPLIT  
PARTITION(s) commands.  In several places, these commits use palloc(),  
where we should use palloc_object() and palloc_array().  This commit  
provides appropriate usage of palloc_object() and palloc_array().  
  
Reported-by: Man Zeng <zengman@halodbtech.com>  
Discussion: https://postgr.es/m/tencent_3661BB522D5466B33EA33666%40qq.com  

M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c

Implement ALTER TABLE ... SPLIT PARTITION ... command

commit   : 4b3d173629f4cd7ab6cd700d1053af5d5c7c9e37    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 13:29:38 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 13:29:38 +0200    

Click here for diff

This new DDL command splits a single partition into several partitions.  Just  
like the ALTER TABLE ... MERGE PARTITIONS ... command, new partitions are  
created using the createPartitionTable() function with the parent partition  
as the template.  
  
This commit comprises a quite naive implementation which works in a single  
process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all  
the operations, including the tuple routing.  This is why the new DDL command  
can't be recommended for large, partitioned tables under high load.  However,  
this implementation comes in handy in certain cases, even as it is.  Also, it  
could serve as a foundation for future implementations with less locking and  
possibly parallelism.  
  
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru  
Author: Dmitry Koval <d.koval@postgrespro.ru>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Co-authored-by: Tender Wang <tndrwang@gmail.com>  
Co-authored-by: Richard Guo <guofenglinux@gmail.com>  
Co-authored-by: Dagfinn Ilmari Mannsaker <ilmari@ilmari.org>  
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>  
Co-authored-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Robert Haas <rhaas@postgresql.org>  
Reviewed-by: Stephane Tachoires <stephane.tachoires@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Daniel Gustafsson <dgustafsson@postgresql.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Noah Misch <noah@leadboat.com>  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/bin/psql/tab-complete.in.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
A src/test/isolation/expected/partition-split.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-split.spec
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_split.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_split.sql
M src/tools/pgindent/typedefs.list

Implement ALTER TABLE ... MERGE PARTITIONS ... command

commit   : f2e4cc427951b7c46629fb7625a22f7898586f3a    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 13:29:17 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 14 Dec 2025 13:29:17 +0200    

Click here for diff

This new DDL command merges several partitions into a single partition of the  
target table.  The target partition is created using the new  
createPartitionTable() function with the parent partition as the template.  
  
This commit comprises a quite naive implementation which works in a single  
process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all  
the operations, including the tuple routing.  This is why this new DDL  
command can't be recommended for large partitioned tables under a high load.  
However, this implementation comes in handy in certain cases, even as it is.  
Also, it could serve as a foundation for future implementations with less  
locking and possibly parallelism.  
  
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru  
Author: Dmitry Koval <d.koval@postgrespro.ru>  
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>  
Co-authored-by: Tender Wang <tndrwang@gmail.com>  
Co-authored-by: Richard Guo <guofenglinux@gmail.com>  
Co-authored-by: Dagfinn Ilmari Mannsaker <ilmari@ilmari.org>  
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>  
Co-authored-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Robert Haas <rhaas@postgresql.org>  
Reviewed-by: Stephane Tachoires <stephane.tachoires@gmail.com>  
Reviewed-by: Jian He <jian.universality@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Daniel Gustafsson <dgustafsson@postgresql.org>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Noah Misch <noah@leadboat.com>  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/dependency.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
A src/test/isolation/expected/partition-merge.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-merge.spec
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_merge.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_merge.sql

doc: Fix incorrect documentation for test_custom_stats

commit   : 5b3ef3055d8ec22610af399715128361a65c845f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 14 Dec 2025 11:21:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 14 Dec 2025 11:21:01 +0900    

Click here for diff

The reference to the test module test_custom_stats  should have been  
added under the section "Custom Cumulative Statistics", but the section  
"Injection Points" has been updated instead, reversing the references  
for both test modules.  
  
d52c24b0f808 has removed a paragraph that was correct, and 31280d96a648  
has added a paragraph that was incorrect.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0s4heX926+ZNh63u12gLd9jgauU6yiirKc7xGo1G01PXQ@mail.gmail.com  

M doc/src/sgml/xfunc.sgml

Fix jsonb_object_agg crash after eliminating null-valued pairs.

commit   : ef5f559b95e2883c32d20d309d316f0572fd84b5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 13 Dec 2025 16:18:23 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 13 Dec 2025 16:18:23 -0500    

Click here for diff

In commit b61aa76e4 I added an assumption in jsonb_object_agg_finalfn  
that it'd be okay to apply uniqueifyJsonbObject repeatedly to a  
JsonbValue.  I should have studied that code more closely first,  
because in skip_nulls mode it removed leading nulls by changing the  
"pairs" array start pointer.  This broke the data structure's  
invariants in two ways: pairs no longer references a repalloc-able  
chunk, and the distance from pairs to the end of its array is less  
than parseState->size.  So any subsequent addition of more pairs is  
at high risk of clobbering memory and/or causing repalloc to crash.  
Unfortunately, adding more pairs is exactly what will happen when the  
aggregate is being used as a window function.  
  
Fix by rewriting uniqueifyJsonbObject to not do that.  The prior  
coding had little to recommend it anyway.  
  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/ec5e96fb-ee49-4e5f-8a09-3f72b4780538@gmail.com  

M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql

Use correct preprocessor conditional in relptr.h

commit   : 315342ffedf6b81f629c42e87bfaedbcc7211646    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 19:56:09 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 19:56:09 +0100    

Click here for diff

When relptr.h was added (commit fbc1c12a94a), there was no check for  
HAVE_TYPEOF, so it used HAVE__BUILTIN_TYPES_COMPATIBLE_P, which  
already existed (commit ea473fb2dee) and which was thought to cover  
approximately the same compilers.  But the guarded code can also work  
without HAVE__BUILTIN_TYPES_COMPATIBLE_P, and we now have a check for  
HAVE_TYPEOF (commit 4cb824699e1), so let's fix this up to use the  
correct logic.  
  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGL7trhWiJ4qxpksBztMMTWDyPnP1QN%2BLq341V7QL775DA%40mail.gmail.com  

M src/include/utils/relptr.h

Fix out-of-date comment on makeRangeConstructors

commit   : abb331da0a3454aebdb416fd19baf289063c254b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 16:56:07 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 16:56:07 +0100    

Click here for diff

We did define 4 functions in 4429f6a9e3, but in df73584431e7 we got  
rid of the 0- and 1-arg versions.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CA%2BrenyVQti3iC7LE4UxtQb4ROLYMs6%2Bu-d4LrN5U4idH1Ghx6Q%40mail.gmail.com  

M src/backend/commands/typecmds.c

Clarify comment about temporal foreign keys

commit   : ff30bad7f6f085598e61bb06a8433cb33b3400c7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 16:44:33 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 13 Dec 2025 16:44:33 +0100    

Click here for diff

In RI_ConstraintInfo, period_contained_by_oper and  
period_intersect_oper can take either anyrange or anymultirange.  
  
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>  
Discussion: https://www.postgresql.org/message-id/CA%2BrenyWzDth%2BjqLZA2L2Cezs3wE%2BWX-5P8W2EOVx_zfFD%3Daicg%40mail.gmail.com  

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

Reject opclass options in ON CONFLICT clause

commit   : 630a93799d538c35c94187e07ef64d566a573a4e    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 12 Dec 2025 14:26:42 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 12 Dec 2025 14:26:42 +0100    

Click here for diff

It's as pointless as ASC/DESC and NULLS FIRST/LAST are, so reject all of  
them in the same way.  While at it, normalize the others' error messages  
to have less translatable strings.  Add tests for these errors.  
  
Noticed while reviewing recent INSERT ON CONFLICT patches.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/202511271516.oiefpvn3z27m@alvherre.pgsql  

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

Replace most StaticAssertStmt() with StaticAssertDecl()

commit   : 493eb0da31be4520252e1af723342dc7ead0c3e5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 Dec 2025 08:58:34 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 Dec 2025 08:58:34 +0100    

Click here for diff

Similar to commit 75f49221c22, it is preferable to use  
StaticAssertDecl() instead of StaticAssertStmt() when possible.  
  
Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com  

M contrib/hstore/hstore_compat.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/parallel.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/utils/adt/mac.c
M src/backend/utils/cache/inval.c
M src/include/storage/fd.h

Never store 0 as the nextMXact

commit   : 87a350e1f284bb99591f9185c0be0ae28899f38a    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 12 Dec 2025 10:47:34 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 12 Dec 2025 10:47:34 +0200    

Click here for diff

Before this commit, when multixid wraparound happens,  
MultiXactState->nextMXact goes to 0, which is invalid. All the readers  
need to deal with that possibility and skip over the 0. That's  
error-prone and we've missed it a few times in the past. This commit  
changes the responsibility so that all the writers of  
MultiXactState->nextMXact skip over the zero already, and readers can  
trust that it's never 0.  
  
We were already doing that for MultiXactState->oldestMultiXactId; none  
of its writers would set it to 0. ReadMultiXactIdRange() was  
nevertheless checking for that possibility. For clarity, remove that  
check.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Maxim Orlov <orlovmg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/3624730d-6dae-42bf-9458-76c4c965fb27@iki.fi  

M src/backend/access/transam/multixact.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl

Fix some comments.

commit   : b4cbc106a6ced69a0a13a980e1b4b212bb127458    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 11 Dec 2025 15:13:04 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 11 Dec 2025 15:13:04 -0600    

Click here for diff

Like commit 123661427b, these were discovered while reviewing  
Aleksander Alekseev's proposed changes to pgindent.  

M src/backend/libpq/pqformat.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/file/fileset.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/executor/executor.h
M src/include/libpq/libpq-be-fe-helpers.h

Fix infer_arbiter_index for partitioned tables

commit   : 81f72115cf189b0a428d3efca2e4beb02b825111    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Dec 2025 20:56:37 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 11 Dec 2025 20:56:37 +0100    

Click here for diff

The fix for concurrent index operations in bc32a12e0db2 started  
considering indexes that are not yet marked indisvalid as arbiters for  
INSERT ON CONFLICT.  For partitioned tables, this leads to including  
indexes that may not exist in partitions, causing a trivially  
reproducible "invalid arbiter index list" error to be thrown because of  
failure to match the index.  To fix, it suffices to ignore !indisvalid  
indexes on partitioned tables.  There should be no risk that the set of  
indexes will change for concurrent transactions, because in order for  
such an index to be marked valid, an ALTER INDEX ATTACH PARTITION must  
run which requires AccessExclusiveLock.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/17622f79-117a-4a44-aa8e-0374e53faaf0%40gmail.com  

M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/partition_info.out
M src/test/regress/sql/partition_info.sql

Fix comment on how temp files and subtransactions are handled

commit   : b65f1ad9b12767dbd45d9588ce8ed2e593dbddbf    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Dec 2025 15:57:11 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Dec 2025 15:57:11 +0200    

Click here for diff

The comment was accurate a long time ago, but not any more. I failed  
to update the comment in commit ab3148b712.  

M src/backend/storage/file/fd.c

Add runtime checks for bogus multixact offsets

commit   : d4b7bde4183bc39c6d7a22d22188fc4aab2ba8d1    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Dec 2025 11:18:14 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Thu, 11 Dec 2025 11:18:14 +0200    

Click here for diff

It's not far-fetched that we'd try to read a multixid with an invalid  
offset in case of bugs or corruption. Or if you call  
pg_get_multixact_members() after a crash that left behind invalid but  
unused multixids. Better to get a somewhat descriptive error message  
if that happens.  
  
Discussion: https://www.postgresql.org/message-id/3624730d-6dae-42bf-9458-76c4c965fb27@iki.fi  

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

Make <assert.h> consistently available in frontend and backend

commit   : 795e94c70cf13f60b2cb4010f29a1bca542d2031    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 11 Dec 2025 09:19:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 11 Dec 2025 09:19:17 +0100    

Click here for diff

Previously, c.h made <assert.h> only available in frontends (#ifdef  
FRONTEND), which was probably reasonable, because the only thing it  
would give you is assert(), which you generally shouldn't use in the  
backend.  But with C11, <assert.h> also makes available  
static_assert(), which would be useful everywhere.  So this patch  
moves <assert.h> to the commonly available header files in c.h and  
fixes a small complication in regcustom.h that resulted from that.  
  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com  

M src/include/c.h
M src/include/regex/regcustom.h

Use palloc_object() and palloc_array(), the last change

commit   : 4f7dacc5b82af19788599671abe4ac633fd7ea4c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 14:29:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 14:29:12 +0900    

Click here for diff

This is the last batch of changes that have been suggested by the  
author, this part covering the non-trivial changes.  Some of the changes  
suggested have been discarded as they seem to lead to more instructions  
generated, leaving the parts that can be qualified as in-place  
replacements.  
  
Similar work has been done in 1b105f9472bd, 0c3c5c3b06a3 and  
31d3847a37be.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  

M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partprune.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/bufmgr.c

pg_buffercache: Fix memory allocation formula

commit   : 3f83de20ba2e1d4bd557d92b3436ca04b7c947a8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 14:11:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 14:11:06 +0900    

Click here for diff

The code over-allocated the memory required for os_page_status, relying  
on uint64 for its element size instead of an int, hence doubling what  
was required.  This could mean quite a lot of memory if dealing with a  
lot of NUMA pages.  
  
Oversight in ba2a3c2302f1.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  
Backpatch-through: 18  

M contrib/pg_buffercache/pg_buffercache_pages.c

Enhance slot synchronization API to respect promotion signal.

commit   : 1362bc33e025fd2848ff38558f5672e2f0f0c7de    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 11 Dec 2025 03:49:28 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 11 Dec 2025 03:49:28 +0000    

Click here for diff

Previously, during a promotion, only the slot synchronization worker was  
signaled to shut down. The backend executing slot synchronization via the  
pg_sync_replication_slots() SQL function was not signaled, allowing it to  
complete its synchronization cycle before exiting.  
  
An upcoming patch improves pg_sync_replication_slots() to wait until  
replication slots are fully persisted before finishing. This behaviour  
requires the backend to exit promptly if a promotion occurs.  
  
This patch ensures that, during promotion, a signal is also sent to the  
backend running pg_sync_replication_slots(), allowing it to be interrupted  
and exit immediately.  
  
Author: Ajin Cherian <itsajin@gmail.com>  
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com  

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

Clarify why _bt_killitems sorts its items array.

commit   : e16c6f024718cf854f5b76a4a2ed402f1a7911f1    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 20:50:47 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 20:50:47 -0500    

Click here for diff

Make it clear why _bt_killitems sorts the scan's so->killedItems[]  
array.  Also add an assertion to the _bt_killitems loop (that iterates  
through this array) to verify it accesses tuples in leaf page order.  
  
Follow-up to commit bfb335df58.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Suggested-by: Victor Yegorov <vyegorov@gmail.com>  
Discussion: https://postgr.es/m/CAGnEboirgArezZDNeFrR8FOGvKF-Xok333s2iVwWi65gZf8MEA@mail.gmail.com  

M src/backend/access/nbtree/nbtutils.c

Fix allocation formula in llvmjit_expr.c

commit   : 06761b6096b661e838512e3a83f71345b59710b9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 10:25:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 11 Dec 2025 10:25:21 +0900    

Click here for diff

An array of LLVMBasicBlockRef is allocated with the size used for an  
element being "LLVMBasicBlockRef *" rather than "LLVMBasicBlockRef".  
LLVMBasicBlockRef is a type that refers to a pointer, so this did not  
directly cause a problem because both should have the same size, still  
it is incorrect.  
  
This issue has been spotted while reviewing a different patch, and  
exists since 2a0faed9d702, so backpatch all the way down.  
  
Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com  
Backpatch-through: 14  

M src/backend/jit/llvm/llvmjit_expr.c

Fix MULTIXACT_DEBUG builds.

commit   : 473cb1b9512ef8ae5ec3ea42bcebeb7d39e79ce4    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 19:31:13 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 19:31:13 -0500    

Click here for diff

Oversight in commit bd8d9c9b.  
  
Discussion: https://postgr.es/m/CAH2-WzmvwVKZ+0Z=RL_+g_aOku8QxWddDCXmtyLj02y+nYaD0g@mail.gmail.com  

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

Allow PG_PRINTF_ATTRIBUTE to be different in C and C++ code.

commit   : 0909380e4c9aa22b75dfe5a7e33393b48078db81    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Dec 2025 17:09:10 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 10 Dec 2025 17:09:10 -0500    

Click here for diff

Although clang claims to be compatible with gcc's printf format  
archetypes, this appears to be a falsehood: it likes __syslog__  
(which gcc does not, on most platforms) and doesn't accept  
gnu_printf.  This means that if you try to use gcc with clang++  
or clang with g++, you get compiler warnings when compiling  
printf-like calls in our C++ code.  This has been true for quite  
awhile, but it's gotten more annoying with the recent appearance  
of several buildfarm members that are configured like this.  
  
To fix, run separate probes for the format archetype to use with the  
C and C++ compilers, and conditionally define PG_PRINTF_ATTRIBUTE  
depending on __cplusplus.  
  
(We could alternatively insist that you not mix-and-match C and  
C++ compilers; but if the case works otherwise, this is a poor  
reason to insist on that.)  
  
No back-patch for now, but we may want to do that if this  
patch survives buildfarm testing.  
  
Discussion: https://postgr.es/m/986485.1764825548@sss.pgh.pa.us  

M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in

Return TIDs in desc order during backwards scans.

commit   : bfb335df58ea4274702039083c7e08fe3dba9e10    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 15:35:30 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 Dec 2025 15:35:30 -0500    

Click here for diff

Always return TIDs in descending order when returning groups of TIDs  
from an nbtree posting list tuple during nbtree backwards scans.  This  
makes backwards scans tend to require fewer buffer hits, since the scan  
is less likely to repeatedly pin and unpin the same heap page/buffer  
(we'll get exactly as many buffer hits as we get with a similar forwards  
scan case).  
  
Commit 0d861bbb, which added nbtree deduplication, originally did things  
this way to avoid interfering with _bt_killitems's approach to setting  
LP_DEAD bits on posting list tuples.  _bt_killitems makes a soft  
assumption that it can always iterate through posting lists in ascending  
TID order, finding corresponding killItems[]/so->currPos.items[] entries  
in that same order.  This worked out because of the prior _bt_readpage  
backwards scan behavior.  If we just changed the backwards scan posting  
list logic in _bt_readpage, without altering _bt_killitems itself, it  
would break its soft assumption.  
  
Avoid that problem by sorting the so->killedItems[] array at the start  
of _bt_killitems.  That way the order that dead items are saved in from  
btgettuple can't matter; so->killedItems[] will always be in the same  
order as so->currPos.items[] in the end.  Since so->currPos.items[] is  
now always in leaf page order, regardless of the scan direction used  
within _bt_readpage, and since so->killedItems[] is always in that same  
order, the _bt_killitems loop can continue to make a uniform assumption  
about everything being in page order.  In fact, sorting like this makes  
the previous soft assumption about item order into a hard invariant.  
  
Also deduplicate the so->killedItems[] array after it is sorted.  That  
way there's no risk of the _bt_killitems loop becoming confused by a  
duplicate dead item/TID.  This was possible in cases that involved a  
scrollable cursor that encountered the same dead TID more than once  
(within the same leaf page/so->currPos context).  This doesn't come up  
very much in practice, but it seems best to be as consistent as possible  
about how and when _bt_killitems will LP_DEAD-mark index tuples.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Mircea Cadariu <cadariu.mircea@gmail.com>  
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>  
Discussion: https://postgr.es/m/CAH2-Wz=Wut2pKvbW-u3hJ_LXwsYeiXHiW8oN1GfbKPavcGo8Ow@mail.gmail.com  

M src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtutils.c

Add pg_iswcased().

commit   : 630706ced04e3a7a7f0070f4e8fb88f7503a1016    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 10 Dec 2025 11:56:11 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 10 Dec 2025 11:56:11 -0800    

Click here for diff

True if character has multiple case forms. Will be a useful  
multibyte-aware replacement for char_is_cased().  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h

Remove char_tolower() API.

commit   : 1e493158d3d25771ed066028c00cbbdb41573496    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 10 Dec 2025 11:55:59 -0800    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 10 Dec 2025 11:55:59 -0800    

Click here for diff

It's only useful for an ILIKE optimization for the libc provider using  
a single-byte encoding and a non-C locale, but it creates significant  
internal complexity.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com  

M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h

Fix bogus extra arguments to query_safe in test

commit   : 820343bab30852142ddc50db3aa81ef58d7cb676    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 19:38:07 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 19:38:07 +0200    

Click here for diff

The test seemed to incorrectly think that query_safe() takes an  
argument that describes what the query does, similar to e.g.  
command_ok(). Until commit bd8d9c9bdf the extra arguments were  
harmless and were just ignored, but when commit bd8d9c9bdf introduced  
a new optional argument to query_safe(), the extra arguments started  
clashing with that, causing the test to fail.  
  
Backpatch to v17, that's the oldest branch where the test exists. The  
extra arguments didn't cause any trouble on the older branches, but  
they were clearly bogus anyway.  

M src/test/modules/xid_wraparound/t/004_notify_freeze.pl

Improve DDL deparsing test

commit   : 343693c3c116688970be550fcbf15f7ddf55525b    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 19:27:02 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 19:27:02 +0200    

Click here for diff

1. The test initially focuses on the "parent" table, then switches to  
the "part" table, and goes back to the "parent" table. That seems a  
little weird, so move the tests around so that all the commands on the  
"parent" table are done first, followed by the "part" table.  
  
2. ALTER TABLE ALTER COLUMN SET EXPRESSION was not tested, so add  
that.  
  
Author: jian he <jian.universality@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CACJufxFDi7fnwB-8xXd_ExML7-7pKbTaK4j46AJ=4-14DXvtVg@mail.gmail.com  

M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql

Add comment about keeping PD_ALL_VISIBLE and VM in sync

commit   : eebec3ca4b5ef13d01837966f51b391143670131    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 10 Dec 2025 11:10:13 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 10 Dec 2025 11:10:13 -0500    

Click here for diff

The comment above heap_xlog_visible() about the critical integrity  
requirement for PD_ALL_VISIBLE and the visibility map should also be in  
heap_xlog_prune_freeze() where we set PD_ALL_VISIBLE.  
  
Oversight in add323da40a6bf9e  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com  

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

Simplify vacuum visibility assertion

commit   : bd298f54a0d60a0376959e10074aa07cbad267f2    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 10 Dec 2025 11:10:01 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Wed, 10 Dec 2025 11:10:01 -0500    

Click here for diff

Phase I vacuum gives the page a once-over after pruning and freezing to  
check that the values of all_visible and all_frozen agree with the  
result of heap_page_is_all_visible(). This is meant to keep the logic in  
phase I for determining visibility in sync with the logic in phase III.  
  
Rewrite the assertion to avoid an Assert(false).  
  
Suggested by Andres Freund.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/mhf4vkmh3j57zx7vuxp4jagtdzwhu3573pgfpmnjwqa6i6yj5y%40sy4ymcdtdklo  

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

Fix comment in GetPublicationRelations

commit   : 70b4d9043931a5c4cdbf7bb08b7e3cb6e8beee1b    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 15:33:29 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 15:33:29 +0200    

Click here for diff

This function gets the list of relations associated with the  
publication but the comment said the opposite.  
  
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CANhcyEV3C_CGBeDtjvKjALDJDMH-Uuc9BWfSd=eck8SCXnE=fQ@mail.gmail.com  

M src/backend/catalog/pg_publication.c

commit   : fa44b8b7fbb7eb0f13546aa13976f9919a4ca201    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 11:43:16 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 11:43:16 +0200    

Click here for diff

These functions took a ResourceOwner argument, but only checked if it  
was NULL, and then used CurrentResourceOwner for the actual work.  
Surely the intention was to use the passed-in resource owner. All  
current callers passed CurrentResourceOwner or NULL, so this has no  
consequences at the moment, but it's an accident waiting to happen for  
future caller and extensions.  
  
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CAEze2Whnfv8VuRZaohE-Af+GxBA1SNfD_rXfm84Jv-958UCcJA@mail.gmail.com  
Backpatch-through: 17  

M src/backend/storage/aio/aio.c
M src/backend/utils/cache/catcache.c

libpq: Authorize pthread_exit() in libpq_check

commit   : 8268e66ac64cb846517580e0808f971343391fdf    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 13:56:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 13:56:33 +0900    

Click here for diff

pthread_exit() is added to the list of symbols allowed when building  
libpq.  This has been reported as possible when libpq is statically  
linked to libcrypto, where pthread_exit() could be called.  
  
Reported-by: Torsten Rupp <torsten.rupp@gmx.net>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org  

M src/interfaces/libpq/libpq_check.pl

Fix failures with cross-version pg_upgrade tests

commit   : 1d7b00dc14b8efd22f6e971756c2d9c052863234    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 12:46:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 12:46:45 +0900    

Click here for diff

Buildfarm members skimmer and crake have reported that pg_upgrade  
running from v18 fails due to the changes of d52c24b0f808, with the  
expectations that the objects removed in the test module  
injection_points should still be present post upgrades, but the test  
module does not have them anymore.  
  
The origin of the issue is that the following test modules depend on  
injection_points, but they do not drop the extension once the tests  
finish, leaving its traces in the dumps used for the upgrades:  
- gin, down to v17  
- typcache, down to v18  
- nbtree, HEAD-only  
Test modules have no upgrade requirements, as they are used only for..  
Tests, so there is no point in keeping them around.  
  
An alternative solution would be to drop the databases created by these  
modules in AdjustUpgrade.pm, but the solution of this commit to drop the  
extension is simpler.  Note that there would be a catch if using a  
solution based on AdjustUpgrade.pm as the database name used for the  
test runs differs between configure and meson:  
- configure relies on USE_MODULE_DB for the database name unicity, that  
would build a database name based on the *first* entry of REGRESS, that  
lists all the SQL tests.  
- meson relies on a "name" field.  
  
For example, for the test module "gin", the regression database is named  
"regression_gin" under meson, while it is more complex for configure, as  
of "contrib_regression_gin_incomplete_splits".  So a AdjustUpgrade.pm  
would need a set of DROP DATABASE IF EXISTS to solve this issue, to cope  
with each build system.  
  
The failure has been caused by d52c24b0f808, and the problem can happen  
with upgrade dumps from v17 and v18 to HEAD.  This problem is not  
currently reachable in the back-branches, but it could be possible that  
a future change in injection_points in stable branches invalidates this  
theory, so this commit is applied down to v17 in the test modules that  
matter.  
  
Per discussion with Tom Lane and Heikki Linnakangas.  
  
Discussion: https://postgr.es/m/2899652.1765167313@sss.pgh.pa.us  
Backpatch-through: 17  

M src/test/modules/gin/expected/gin_incomplete_splits.out
M src/test/modules/gin/sql/gin_incomplete_splits.sql
M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql
M src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql
M src/test/modules/typcache/expected/typcache_rel_type_cache.out
M src/test/modules/typcache/sql/typcache_rel_type_cache.sql

Fix two issues with recently-introduced nbtree test

commit   : 06817fc8a4b739cc2d1aa87071d9e20d483fd678    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 11:56:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 11:56:42 +0900    

Click here for diff

REGRESS has forgotten about the test nbtree_half_dead_pages, and a  
.gitignore was missing from the module.  
  
Oversights in c085aab27819 for REGRESS and 1e4e5783e7d7 for the missing  
.gitignore.  
  
Discussion: https://postgr.es/m/aTipJA1Y1zVSmH3H@paquier.xyz  

A src/test/modules/nbtree/.gitignore
M src/test/modules/nbtree/Makefile

Fix meson warning due to missing declaration of NM

commit   : 801b4ee7fae1caa962b789e72be11dcead79dcbf    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 08:10:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 08:10:28 +0900    

Click here for diff

The warning was showing up in the early stages of the meson build, when  
the contents of Makefile.global is generated based on the configuration  
of meson for PGXS.  
  
NM is added to pgxs_empty.  This declaration is only used internally for  
the libpq sanity check, so there is no point in exposing it in PGXS.  
  
Oversight in 4a8e6f43a6b5.  
  
Reported-by: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Discussion: https://postgr.es/m/4423e01f-1e52-4f47-a6ca-05cc8081c888@eisentraut.org  

M src/makefiles/meson.build

Fix typo in comment

commit   : bae9d2f892bc7733667fa68f416b5abd8dd2fc57    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 01:06:03 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 10 Dec 2025 01:06:03 +0200    

Click here for diff

Author: Xuneng Zhou <xunengzhou@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CABPTF7V8CbOXGePqrad6EH3Om7DRhNiO3C0rQ-62UuT7RdU-GQ@mail.gmail.com  

M src/backend/storage/aio/read_stream.c

Fix misleading comment in tuplesort.c

commit   : f275afc997d77ada991307d22703b08f1dedef13    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 10 Dec 2025 12:01:14 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 10 Dec 2025 12:01:14 +1300    

Click here for diff

A comment in tuplesort.c was claiming that the code was defining  
INITIAL_MEMTUPSIZE so that it *does not* exceed  
ALLOCSET_SEPARATE_THRESHOLD, but the code actually ensures that we  
purposefully *do* exceed ALLOCSET_SEPARATE_THRESHOLD for the initial  
allocation of the tuples array, as per reasons detailed in the  
commentary of grow_memtuples().  
  
Also, there's not much need to repeat the mention about  
ALLOCSET_SEPARATE_THRESHOLD in each location where INITIAL_MEMTUPSIZE is  
used, so remove those comments.  
  
Author: ChangAo Chen <cca5507@qq.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>  
Discussion: https://postgr.es/m/tencent_6FA14F85D6B5B5291532D6789E07F4765C08%40qq.com  

M src/backend/utils/sort/tuplesort.c

Use palloc_object() and palloc_array() in backend code

commit   : 1b105f9472bdb9a68f709778afafb494997267bd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 07:36:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 Dec 2025 07:36:46 +0900    

Click here for diff

The idea is to encourage more the use of these new routines across the  
tree, as these offer stronger type safety guarantees than palloc().  
This batch of changes includes most of the trivial changes suggested by  
the author for src/backend/.  
  
A total of 334 files are updated here.  Among these files, 48 of them  
have their build change slightly; these are caused by line number  
changes as the new allocation formulas are simpler, shaving around 100  
lines of code in total.  
  
Similar work has been done in 0c3c5c3b06a3 and 31d3847a37be.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/attmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/tidstore.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/system.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_server.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/walsummary.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/storage.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/explain_dr.c
M src/backend/commands/explain_state.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execExpr.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execReplication.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_recombination.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/extendplan.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/snowball/dict_snowball.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/bulk_write.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/pquery.c
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/multixactfuncs.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale_libc.c
M src/backend/utils/adt/pg_ndistinct.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/skipsupport.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/snapmgr.c

Fix O_CLOEXEC flag handling in Windows port.

commit   : c507ba55f5bfae900baa94f1c657e1d99da5c6dc    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Dec 2025 09:01:35 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 10 Dec 2025 09:01:35 +1300    

Click here for diff

PostgreSQL's src/port/open.c has always set bInheritHandle = TRUE  
when opening files on Windows, making all file descriptors inheritable  
by child processes.  This meant the O_CLOEXEC flag, added to many call  
sites by commit 1da569ca1f (v16), was silently ignored.  
  
The original commit included a comment suggesting that our open()  
replacement doesn't create inheritable handles, but it was a mis-  
understanding of the code path.  In practice, the code was creating  
inheritable handles in all cases.  
  
This hasn't caused widespread problems because most child processes  
(archive_command, COPY PROGRAM, etc.) operate on file paths passed as  
arguments rather than inherited file descriptors.  Even if a child  
wanted to use an inherited handle, it would need to learn the numeric  
handle value, which isn't passed through our IPC mechanisms.  
  
Nonetheless, the current behavior is wrong.  It violates documented  
O_CLOEXEC semantics, contradicts our own code comments, and makes  
PostgreSQL behave differently on Windows than on Unix.  It also creates  
potential issues with future code or security auditing tools.  
  
To fix, define O_CLOEXEC to _O_NOINHERIT in master, previously used by  
O_DSYNC.  We use different values in the back branches to preserve  
existing values.  In pgwin32_open_handle() we set bInheritHandle  
according to whether O_CLOEXEC is specified, for the same atomic  
semantics as POSIX in multi-threaded programs that create processes.  
  
Backpatch-through: 16  
Author: Bryan Green <dbryan.green@gmail.com>  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com> (minor adjustments)  
Discussion: https://postgr.es/m/e2b16375-7430-4053-bda3-5d2194ff1880%40gmail.com  

M src/include/port.h
M src/include/port/win32_port.h
M src/port/open.c
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_cloexec/Makefile
A src/test/modules/test_cloexec/meson.build
A src/test/modules/test_cloexec/t/001_cloexec.pl
A src/test/modules/test_cloexec/test_cloexec.c

vacuumdb: Add --dry-run.

commit   : d107176d27c73ea3589b949dde07b6bc38b8f583    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    

Click here for diff

This new option instructs vacuumdb to print, but not execute, the  
VACUUM and ANALYZE commands that would've been sent to the server.  
  
Author: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com  

M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h

Add ParallelSlotSetIdle().

commit   : 750816971b35270971dd77f37ed1e9655fce4ed9    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    

Click here for diff

This commit refactors the code for marking a ParallelSlot as idle  
to a new static inline function.  This can be used to mark a slot  
that was obtained via ParallelSlotGetIdle() but that we don't  
intend to actually use for a query as idle again.  
  
This is preparatory work for a follow-up commit that will add a  
--dry-run option to vacuumdb.  
  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com  
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com  

M src/fe_utils/parallel_slot.c
M src/include/fe_utils/parallel_slot.h

vacuumdb: Move some variables to the vacuumingOptions struct.

commit   : cf1450e57799afb683ccbfc482c6f1b5827c81e7    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 13:34:22 -0600    

Click here for diff

Presently, the "echo" and "quiet" variables are carted around to  
various functions, which is a bit tedious.  To simplify things,  
this commit moves them into the vacuumingOptions struct and removes  
the related function parameters.  While at it, remove some  
redundant initialization code in vacuumdb's main() function.  
  
This is preparatory work for a follow-up commit that will add a  
--dry-run option to vacuumdb.  
  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com  

M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h

Add started_by column to pg_stat_progress_analyze view.

commit   : ab40db3852dfa093b64c9266dd372fee414e993f    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Dec 2025 11:23:45 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Dec 2025 11:23:45 -0800    

Click here for diff

The new column, started_by, indicates the initiator of the  
analyze ('manual' or 'autovacuum'), helping users and monitoring tools  
to better understand ANALYZE behavior.  
  
Bump catalog version.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Yu Wang <wangyu_runtime@163.com>  
Discussion: https://postgr.es/m/CAA5RZ0suoicwxFeK_eDkUrzF7s0BVTaE7M%2BehCpYcCk5wiECpw%40mail.gmail.com  

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

Add mode and started_by columns to pg_stat_progress_vacuum view.

commit   : 0d789520619803cf6629ebf980e116d733b6756f    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Dec 2025 10:51:14 -0800    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Tue, 9 Dec 2025 10:51:14 -0800    

Click here for diff

The new columns, mode and started_by, indicate the vacuum  
mode ('normal', 'aggressive', or 'failsafe') and the initiator of the  
vacuum ('manual', 'autovacuum', or 'autovacuum_wraparound'),  
respectively. This allows users and monitoring tools to better  
understand VACUUM behavior.  
  
Bump catalog version.  
  
Author: Shinya Kato <shinya11.kato@gmail.com>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Robert Treat <rob@xzilla.net>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Reviewed-by: Yu Wang <wangyu_runtime@163.com>  
Discussion: https://postgr.es/m/CAOzEurQcOY-OBL_ouEVfEaFqe_md3vB5pXjR_m6L71Dcp1JKCQ@mail.gmail.com  

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

doc: Fix titles of some pg_buffercache functions.

commit   : b237f5422bc0667754f986f9d5bfc34a13401bc1    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 11:01:38 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 9 Dec 2025 11:01:38 -0600    

Click here for diff

As in commit 59d6c03956, use <function> rather than <structname> in  
the <title> to be consistent with how other functions in this  
module are documented.  
  
Oversights in commits dcf7e1697b and 9ccc049dfe.  
  
Author: Noboru Saito <noborusai@gmail.com>  
Discussion: https://postgr.es/m/CAAM3qn%2B7KraFkCyoJCHq6m%3DurxcoHPEPryuyYeg%3DQ0EjJxjdTA%40mail.gmail.com  
Backpatch-through: 18  

M doc/src/sgml/pgbuffercache.sgml

Support "j" length modifier in snprintf.c.

commit   : f8715ec86608fc5f6c80f5dec3369b4cc56481a8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Dec 2025 11:43:25 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 9 Dec 2025 11:43:25 -0500    

Click here for diff

POSIX has for a long time defined the "j" length modifier for  
printf conversions as meaning the size of intmax_t or uintmax_t.  
We got away without supporting that so far, because we were not  
using intmax_t anywhere.  However, commit e6be84356 re-introduced  
upstream's use of intmax_t and PRIdMAX into zic.c.  It emerges  
that on some platforms (at least FreeBSD and macOS), <inttypes.h>  
defines PRIdMAX as "jd", so that snprintf.c falls over if that is  
used.  (We hadn't noticed yet because it would only be apparent  
if bad data is fed to zic, resulting in an error report, and even  
then the only visible symptom is a missing line number in the  
error message.)  
  
We could revert that decision from our copy of zic.c, but  
on the whole it seems better to update snprintf.c to support  
this standard modifier.  There might well be extensions,  
now or in future, that expect it to work.  
  
I did this in the lazy man's way of translating "j" to either  
"l" or "ll" depending on a compile-time sizeof() check, just  
as was done long ago to support "z" for size_t.  One could  
imagine promoting intmax_t to have full support in snprintf.c,  
for example converting fmtint()'s value argument and internal  
arithmetic to use [u]intmax_t not [unsigned] long long.  But  
that'd be more work and I'm hesitant to do it anyway: if there  
are any platforms out there where intmax_t is actually wider  
than "long long", this would doubtless result in a noticeable  
speed penalty to snprintf().  Let's not go there until we have  
positive evidence that there's a reason to, and some way to  
measure what size of penalty we're taking.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3210703.1765236740@sss.pgh.pa.us  

M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/port/snprintf.c

Add wait event for the group commit delay before WAL flush

commit   : 3cb5808bd11c5a7ef697922335f7642f643a4e7f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 17:06:40 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 17:06:40 +0200    

Click here for diff

Author: Rafia Sabih <rafia.pghackers@gmail.com>  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CA%2BFpmFf-hWXtrC0Q3Cr_Xo78zuP_M_VC5xgWPOYOkwqOD0T8eg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/utils/activity/wait_event_names.txt

Fix warning about wrong format specifier for off_t type

commit   : f231a4e8c7f2ce93203cedea7a02ef3eeb744647    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 14:05:13 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 14:05:13 +0200    

Click here for diff

Per OS X buildfarm members.  

M src/bin/pg_upgrade/slru_io.c

Widen MultiXactOffset to 64 bits

commit   : bd8d9c9bdfa0c2168bb37edca6fa88168cacbbaa    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 13:53:03 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 13:53:03 +0200    

Click here for diff

This eliminates MultiXactOffset wraparound and the 2^32 limit on the  
total number of multixid members. Multixids are still limited to 2^31,  
but this is a nice improvement because 'members' can grow much faster  
than the number of multixids. On such systems, you can now run longer  
before hitting hard limits or triggering anti-wraparound vacuums.  
  
Not having to deal with MultiXactOffset wraparound also simplifies the  
code and removes some gnarly corner cases.  
  
We no longer need to perform emergency anti-wraparound freezing  
because of running out of 'members' space, so the offset stop limit is  
gone. But you might still not want 'members' to consume huge amounts  
of disk space. For that reason, I kept the logic for lowering vacuum's  
multixid freezing cutoff if a large amount of 'members' space is  
used. The thresholds for that are roughly the same as the "safe" and  
"danger" thresholds used before, 2 billion transactions and 4 billion  
transactions. This keeps the behavior for the freeze cutoff roughly  
the same as before. It might make sense to make this smarter or  
configurable, now that the threshold is only needed to manage disk  
usage, but that's left for the future.  
  
Add code to pg_upgrade to convert multitransactions from the old to  
the new format, rewriting the pg_multixact SLRU files. Because  
pg_upgrade now rewrites the files, we can get rid of some hacks we had  
put in place to deal with old bugs and upgraded clusters. Bump catalog  
version for the pg_multixact/offsets format change.  
  
Author: Maxim Orlov <orlovmg@gmail.com>  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>  
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CACG%3DezaWg7_nt-8ey4aKv2w9LcuLthHknwCawmBgEeTnJrJTcw@mail.gmail.com  

M doc/src/sgml/ref/pg_resetwal.sgml
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/meson.build
A src/bin/pg_upgrade/multixact_read_v18.c
A src/bin/pg_upgrade/multixact_read_v18.h
A src/bin/pg_upgrade/multixact_rewrite.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
A src/bin/pg_upgrade/slru_io.c
A src/bin/pg_upgrade/slru_io.h
A src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/include/access/multixact.h
M src/include/access/multixact_internal.h
M src/include/c.h
M src/include/catalog/catversion.h
M src/test/modules/test_slru/t/002_multixact_wraparound.pl
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/pgindent/typedefs.list

Move pg_multixact SLRU page format definitions to a separate header

commit   : bb3b1c4f64620ca05d86a20a26c8fa4ca1cf7b78    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 13:45:01 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 9 Dec 2025 13:45:01 +0200    

Click here for diff

This makes them accessible from pg_upgrade, needed by the next commit.  
I'm doing this mechanical move as a separate commit to make the next  
commit's changes to these definitions more obvious.  
  
Author: Maxim Orlov <orlovmg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CACG%3DezbZo_3_fnx%3DS5BfepwRftzrpJ%2B7WET4EkTU6wnjDTsnjg@mail.gmail.com  

M src/backend/access/transam/multixact.c
A src/include/access/multixact_internal.h

doc: Fix statement about ON CONFLICT and deferrable constraints.

commit   : e9443a55265fbf3726f7ba4d961399b7dff3ea9f    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Tue, 9 Dec 2025 10:49:16 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Tue, 9 Dec 2025 10:49:16 +0000    

Click here for diff

The description of deferrable constraints in create_table.sgml states  
that deferrable constraints cannot be used as conflict arbitrators in  
an INSERT with an ON CONFLICT DO UPDATE clause, but in fact this  
restriction applies to all ON CONFLICT clauses, not just those with DO  
UPDATE. Fix this, and while at it, change the word "arbitrators" to  
"arbiters", to match the terminology used elsewhere.  
  
Author: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/CAEZATCWsybvZP3ce8rGcVNx-QHuDOJZDz8y=p1SzqHwjRXyV4Q@mail.gmail.com  
Backpatch-through: 14  

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

Fix distinctness check for queries with grouping sets

commit   : f00484c170f56199c3eeacc82bd72f8c1e3baf6b    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 9 Dec 2025 17:09:27 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 9 Dec 2025 17:09:27 +0900    

Click here for diff

query_is_distinct_for() is intended to determine whether a query never  
returns duplicates of the specified columns.  For queries using  
grouping sets, if there are no grouping expressions, the query may  
contain one or more empty grouping sets.  The goal is to detect  
whether there is exactly one empty grouping set, in which case the  
query would return a single row and thus be distinct.  
  
The previous logic in query_is_distinct_for() was incomplete because  
the check was insufficiently thorough and could return false when it  
could have returned true.  It failed to consider cases where the  
DISTINCT clause is used on the GROUP BY, in which case duplicate empty  
grouping sets are removed, leaving only one.  It also did not  
correctly handle all possible structures of GroupingSet nodes that  
represent a single empty grouping set.  
  
To fix, add a check for the groupDistinct flag, and expand the query's  
groupingSets tree into a flat list, then verify that the expanded list  
contains only one element.  
  
No backpatch as this could result in plan changes.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAMbWs480Z04NtP8-O55uROq2Zego309+h3hhaZhz6ztmgWLEBw@mail.gmail.com  

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

Fix const-simplification for index expressions and predicate

commit   : c925ad30b047ec1388247539e86729d584c34b8d    
  
author   : Richard Guo <rguo@postgresql.org>    
date     : Tue, 9 Dec 2025 16:56:26 +0900    
  
committer: Richard Guo <rguo@postgresql.org>    
date     : Tue, 9 Dec 2025 16:56:26 +0900    

Click here for diff

Similar to the issue with constraint and statistics expressions fixed  
in 317c117d6, index expressions and predicate can also suffer from  
incorrect reduction of NullTest clauses during const-simplification,  
due to unfixed varnos and the use of a NULL root.  It has been  
reported that this issue can cause the planner to fail to pick up a  
partial index that it previously matched successfully.  
  
Because we need to cache the const-simplified index expressions and  
predicate in the relcache entry, we cannot fix the Vars before  
applying eval_const_expressions.  To ensure proper reduction of  
NullTest clauses, this patch runs eval_const_expressions a second time  
-- after the Vars have been fixed and with a valid root.  
  
It could be argued that the additional call to eval_const_expressions  
might increase planning time, but I don't think that's a concern.  It  
only runs when index expressions and predicate are present; it is  
relatively cheap when run on small expression trees (which is  
typically the case for index expressions and predicate), and it runs  
on expressions that have already been const-simplified once, making  
the second pass even cheaper.  In return, in cases like the one  
reported, it allows the planner to match and use partial indexes,  
which can lead to significant execution-time improvements.  
  
Bug: #19007  
Reported-by: Bryan Fox <bryfox@gmail.com>  
Author: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/19007-4cc6e252ed8aa54a@postgresql.org  

M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/join.out
M src/test/regress/expected/predicate.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/predicate.sql

Fix LOCK_TIMEOUT handling in slotsync worker.

commit   : 04396eacd3faeaa4fa3d084a6749e4e384bdf0db    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 Dec 2025 07:25:20 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 Dec 2025 07:25:20 +0000    

Click here for diff

Previously, the slotsync worker relied on SIGINT for graceful shutdown  
during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler  
to cancel queries. Since the slotsync worker can lock catalog tables while  
parsing libpq tuples, this overlap caused it to ignore LOCK_TIMEOUT  
signals and potentially wait indefinitely on locks.  
  
This patch replaces the slotsync worker's SIGINT handler with  
StatementCancelHandler to correctly process query-cancel interrupts.  
Additionally, the startup process now uses SIGUSR1 to signal the slotsync  
worker to stop during promotion. The worker exits after detecting that the  
shared memory flag stopSignaled is set.  
  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Reviewed-by: shveta malik <shveta.malik@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Backpatch-through: 17, here it was introduced  
Discussion: https://postgr.es/m/TY4PR01MB169078F33846E9568412D878C94A2A@TY4PR01MB16907.jpnprd01.prod.outlook.com  

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

Remove useless casts in format arguments

commit   : 2268f2b91b5513cbf430d1cca488203d66103b3a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    

Click here for diff

There were a number of useless casts in format arguments, either  
where the input to the cast was already in the right type, or  
seemingly uselessly casting between types instead of just using the  
right format placeholder to begin with.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org  

M contrib/amcheck/verify_heapam.c
M src/backend/access/common/printtup.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/define.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c
M src/backend/parser/parse_type.c
M src/backend/replication/walreceiver.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/xid.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/common.c

commit   : 907caf5c392ad75177bdfd48d38cf0cc6904e8e1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    

Click here for diff

Remove some gratuitous uses of INT64_FORMAT.  Make use of  
PRIu64/PRId64 were appropriate, remove unnecessary casts.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org  

M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/btreefuncs.c
M src/backend/backup/basebackup.c
M src/bin/pg_rewind/pg_rewind.c

Remove unnecessary casts in printf format arguments (%zu/%zd)

commit   : 2b117bb014d066549c319dcd73bd538e32b0c408    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 9 Dec 2025 06:58:39 +0100    

Click here for diff

Many of these are probably left over from before use of %zu/%zd was  
portable.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org  

M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/backup/basebackup_server.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/outfuncs.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/misc/guc.c
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c

Use palloc_object() and palloc_array() in more areas of the tree

commit   : 0c3c5c3b06a37c13a811ea93044202e06523b705    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 9 Dec 2025 14:53:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 9 Dec 2025 14:53:17 +0900    

Click here for diff

The idea is to encourage more the use of these new routines across the  
tree, as these offer stronger type safety guarantees than palloc().  
  
The following paths are included in this batch, treating all the areas  
proposed by the author for the most trivial changes, except src/backend  
(by far the largest batch):  
src/bin/  
src/common/  
src/fe_utils/  
src/include/  
src/pl/  
src/test/  
src/tutorial/  
  
Similar work has been done in 31d3847a37be.  
  
The code compiles the same before and after this commit, with the  
following exceptions due to changes in line numbers because some of the  
new allocation formulas are shorter:  
blkreftable.c  
pgfnames.c  
pl_exec.c  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  

M doc/src/sgml/gist.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xtypes.sgml
M src/bin/pg_basebackup/astreamer_inject.c
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_dump/common.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/scripts/vacuuming.c
M src/common/blkreftable.c
M src/common/parse_manifest.c
M src/common/pgfnames.c
M src/common/rmtree.c
M src/common/stringinfo.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_tar.c
M src/fe_utils/astreamer_zstd.c
M src/include/lib/radixtree.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/test_bitmapset/test_bitmapset.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/regress.c
M src/timezone/pgtz.c
M src/tutorial/complex.c
M src/tutorial/funcs.c

Improve documentation for pg_atomic_unlocked_write_u32()

commit   : aa749bde323364039f369784071f315ad53c1325    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Dec 2025 23:03:54 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 8 Dec 2025 23:03:54 -0500    

Click here for diff

After my recent commit 7902a47c20b, Nathan noticed that  
pg_atomic_unlocked_write_u64() was not accurately described by the comments  
for the 32bit version. Turns out the 32bit version has suffered from  
copy-and-paste-itis since its introduction. Fix.  
  
Reported-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/aTGt7q4Jvn97uGAx@nathan  

M src/include/port/atomics.h

Doc: fix typo in hash index documentation

commit   : 52382feb782b76c42552e96f0bc382a87fd7c1e4    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 9 Dec 2025 14:41:30 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 9 Dec 2025 14:41:30 +1300    

Click here for diff

Plus a similar fix to the README.  
  
Backpatch as far back as the sgml issue exists.  The README issue does  
exist in v14, but that seems unlikely to harm anyone.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c7d3@gmail.com  
Backpatch-through: 15  

M doc/src/sgml/hash.sgml
M src/backend/access/hash/README

libpq: Refactor logic checking for exit() in shared library builds

commit   : 4a8e6f43a6b56289cd3806b239c20ae31aa4cf2e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 9 Dec 2025 10:39:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 9 Dec 2025 10:39:08 +0900    

Click here for diff

This commit refactors the sanity check done by libpq to ensure that  
there is no exit() reference in the build, moving the check from a  
standalone Makefile rule to a perl script.  
  
Platform-specific checks are now part of the script, avoiding most of  
the duplication created by the introduction of this check for meson, but  
not all of them:  
- Solaris and Windows skipped in the script.  
- Whitelist of symbols is in the script.  
- nm availability, with its path given as an option of the script.  Its  
execution is checked in the script.  
- Check is disabled if coverage reports are enabled.  This part is not  
pushed down to the script.  
- Check is disabled for static builds of libpq.  This part is filtered  
out in each build script.  
  
A trick is required for the stamp file, in the shape of an optional  
argument that can be given to the script.  Meson expects the stamp in  
output and uses this argument, generating the stamp file in the script.  
Meson is able to handle the removal of the stamp file internally when  
libpq needs to be rebuilt and the check done again.  
  
This refactoring piece has come up while discussing the addition of more  
items in the symbols considered as acceptable.  
  
This sanity check has never been run by meson since its introduction in  
dc227eb82ea8, so it is possible that this fails in some of the buildfarm  
members.  At least the CI is happy with it, but let's see how it goes.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Co-authored-by: VASUKI M <vasukim1992002@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org  

M configure
M configure.ac
M meson.build
M src/Makefile.global.in
M src/interfaces/libpq/Makefile
A src/interfaces/libpq/libpq_check.pl
M src/interfaces/libpq/meson.build

Fix minor portability issue in pg_resetwal.c.

commit   : c004d68c9395812bfcff82c2d7c4e56d36e72f1c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Dec 2025 19:06:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 Dec 2025 19:06:36 -0500    

Click here for diff

The argument of isspace() (like other <ctype.h> functions)  
must be cast to unsigned char to ensure portable results.  
  
Per NetBSD buildfarm members.  Oversight in 636c1914b.  

M src/bin/pg_resetwal/pg_resetwal.c

Avoid pointer chasing in _bt_readpage inner loop.

commit   : 83a26ba59b1819cbd61705a3ff6aa572081ccc4b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 Dec 2025 13:48:09 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 Dec 2025 13:48:09 -0500    

Click here for diff

Make _bt_readpage pass down the current scan direction to various  
utility functions within its pstate variable.  Also have _bt_readpage  
work off of a local copy of scan->ignore_killed_tuples within its  
per-tuple loop (rather than using scan->ignore_killed_tuples directly).  
  
Testing has shown that this significantly benefits large range scans,  
which are naturally able to take full advantage of the pstate.startikey  
optimization added by commit 8a510275.  Running a pgbench script with a  
"SELECT abalance FROM pgbench_accounts WHERE aid BETWEEN ..." query  
shows an increase in transaction throughput of over 5%.  There also  
appears to be a small performance benefit when running pgbench's  
built-in select-only script.  
  
Follow-up to commit 65d6acbc.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzmwMwcwKFgaf+mYPwiz3iL4AqpXnwtW_O0vqpWPXRom9Q@mail.gmail.com  

M src/backend/access/nbtree/nbtreadpage.c

Unify some more messages

commit   : d0d0ba6cf66c4043501f6f7bf508ad920645e415    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Dec 2025 19:23:38 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Dec 2025 19:23:38 +0100    

Click here for diff

No backpatch here because of message wording changes.  
  
Author: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://postgr.es/m/202512081537.ahw5gwoencou@alvherre.pgsql  

M src/backend/commands/matview.c
M src/backend/postmaster/checkpointer.c
M src/test/regress/expected/matview.out
M src/test/regress/expected/stats.out

commit   : 65d6acbc564989af15102f69978c63c3cdb5fdbc    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 Dec 2025 13:15:00 -0500    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 Dec 2025 13:15:00 -0500    

Click here for diff

Quite a bit of code within nbtutils.c is only called by _bt_readpage.  
Move _bt_readpage and all of the nbtutils.c functions it depends on into  
a new .c file, nbtreadpage.c.  Also reorder some of the functions within  
the new file for clarity.  
  
This commit has no functional impact.  It is strictly mechanical.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzmwMwcwKFgaf+mYPwiz3iL4AqpXnwtW_O0vqpWPXRom9Q@mail.gmail.com  

M src/backend/access/nbtree/Makefile
M src/backend/access/nbtree/meson.build
A src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h

Unify error messages

commit   : 502e256f2262351e92994878eea3332da64834b0    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Dec 2025 16:30:52 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Mon, 8 Dec 2025 16:30:52 +0100    

Click here for diff

No visible changes, just refactor how messages are constructed.  

M src/backend/catalog/aclchk.c
M src/backend/commands/cluster.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain_state.c
M src/backend/commands/indexcmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c

pg_resetwal: Use separate flags for whether an option is given

commit   : 978cf02bb8caeafd6fe5178e67016ffd898599b4    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 8 Dec 2025 16:54:54 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 8 Dec 2025 16:54:54 +0200    

Click here for diff

Currently, we use special values that are otherwise invalid for each  
option to indicate "option was not given". Replace that with separate  
boolean variables for each option. It seems more clear to be explicit.  
  
We were already doing that for the -m option, because there were no  
invalid values for nextMulti that we could use (since commit  
94939c5f3a).  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/81adf5f3-36ad-4bcd-9ba5-1b95c7b7a807@iki.fi  

M src/bin/pg_resetwal/pg_resetwal.c

pg_resetwal: Reject negative and out of range arguments

commit   : 636c1914b483bab0eaabdec30cf1f2c743606d7f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 8 Dec 2025 16:54:50 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 8 Dec 2025 16:54:50 +0200    

Click here for diff

The strtoul() function that we used to parse many of the options  
accepts negative values, and silently wraps them to the equivalent  
unsigned values. For example, -1 becomes 0xFFFFFFFF, on platforms  
where unsigned long is 32 bits wide. Also, on platforms where  
"unsigned long" is 64 bits wide, we silently casted values larger than  
UINT32_MAX to the equivalent 32-bit value. Both of those behaviors  
seem undesirable, so tighten up the parsing to reject them.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/81adf5f3-36ad-4bcd-9ba5-1b95c7b7a807@iki.fi  

M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl

Make ecpg parse.pl more robust with braces

commit   : 7f88553ceaca4af0e5bd483ab77f9f442578c18a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Dec 2025 15:53:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Dec 2025 15:53:52 +0100    

Click here for diff

When parse.pl processes braces, it does not take into account that  
braces could also be their own token if single quoted ('{', '}').  
This is not currently used but a future patch wants to make use of it.  
  
This fixes that by using lookaround assertions to detect the quotes.  
  
To make sure all Perl versions in play support this and to avoid  
surprises later on, let's give this a spin on the buildfarm now.  It  
can exist independently of future work.  
  
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org  

M src/interfaces/ecpg/preproc/parse.pl

Use PGAlignedXLogBlock for some code simplification

commit   : 804046b39a27973751c920f8f41504697f3f52d5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Dec 2025 13:52:42 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 Dec 2025 13:52:42 +0100    

Click here for diff

The code in BootStrapXLOG() and in pg_test_fsync.c tried to align WAL  
buffers in complicated ways.  Also, they still used XLOG_BLCKSZ for  
the alignment, even though that should now be PG_IO_ALIGN_SIZE.  This  
can now be simplified and made more consistent by using  
PGAlignedXLogBlock, either directly in BootStrapXLOG() and using  
alignas in pg_test_fsync.c.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/f462a175-b608-44a1-b428-bdf351e914f4%40eisentraut.org  

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

test_custom_stats: Test module for custom cumulative statistics

commit   : 31280d96a64850f5a9a924088890ab43a2905237    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 15:23:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 15:23:09 +0900    

Click here for diff

This test module acts as a replacement that existed prior to  
d52c24b0f808 in the test module injection_points.  It uses a more  
flexible structure than its ancestor:  
- Two libraries are built, one for fixed-sized stats and one for  
variable-sized stats.  
- No GUCs required.  The stats are enabled only if one or both libraries  
are loaded with shared_preload_libraries.  
- Same kind IDs reserved: 25 (variable-sized) and 26 (fixed-sized)  
  
The goal of this redesign is to be able to easier extend the code  
coverage provided by this module for other changes that are currently  
under discussion, and injection_points was not suited for these.  
Injection points are also now widely used in the tree now, so extending  
more the test coverage for custom pgstats in the test module  
injection_points would be a riskier long-term move.  
  
The new code is mostly a copy of what existed previously in the test  
module injection_points, with the same callbacks defined for fixed-sized  
and variable-sized stats, but a simpler overall structure in terms of  
the stats counters updated.  
  
The test coverage should remain the same as previously: one TAP test is  
used to check data reports, crash recovery and clean restart scenarios.  
Tests are added for the manual reset of fixed-sized stats, something  
not tested until now.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAA5RZ0sJgO6GAwgFxmzg9MVP=rM7Us8KKcWpuqxe-f5qxmpE0g@mail.gmail.com  

M doc/src/sgml/xfunc.sgml
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_custom_stats/.gitignore
A src/test/modules/test_custom_stats/Makefile
A src/test/modules/test_custom_stats/meson.build
A src/test/modules/test_custom_stats/t/001_custom_stats.pl
A src/test/modules/test_custom_stats/test_custom_fixed_stats–1.0.sql
A src/test/modules/test_custom_stats/test_custom_fixed_stats.c
A src/test/modules/test_custom_stats/test_custom_fixed_stats.control
A src/test/modules/test_custom_stats/test_custom_var_stats–1.0.sql
A src/test/modules/test_custom_stats/test_custom_var_stats.c
A src/test/modules/test_custom_stats/test_custom_var_stats.control
M src/tools/pgindent/typedefs.list

Prevent invalidation of newly created replication slots.

commit   : 006dd4b2e5b33a3d0c2780f0bf307f6311ed776b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Dec 2025 05:19:28 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 8 Dec 2025 05:19:28 +0000    

Click here for diff

A race condition could cause a newly created replication slot to become  
invalidated between WAL reservation and a checkpoint.  
  
Previously, if the required WAL was removed, we retried the reservation  
process. However, the slot could still be invalidated before the retry if  
the WAL was not yet removed but the checkpoint advanced the redo pointer  
beyond the slot's intended restart LSN and computed the minimum LSN that  
needs to be preserved for the slots.  
  
The fix is to acquire an exclusive lock on ReplicationSlotAllocationLock  
during WAL reservation to serialize WAL reservation and checkpoint's  
minimum restart_lsn computation. This ensures that, if WAL reservation  
occurs first, the checkpoint waits until restart_lsn is updated before  
removing WAL. If the checkpoint runs first, subsequent WAL reservations  
pick a position at or after the latest checkpoint's redo pointer.  
  
We can't use the same fix for branch 17 and prior because commit  
2090edc6f3 changed to compute to the minimum restart_LSN among slot's at  
the beginning of checkpoint (or restart point). The fix for 17 and prior  
branches is under discussion and will be committed separately.  
  
Reported-by: suyu.cmj <mengjuan.cmj@alibaba-inc.com>  
Author: Hou Zhijie <houzj.fnst@fujitsu.com>  
Reviewed-by: Vitaly Davydov <v.davydov@postgrespro.ru>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Backpatch-through: 18  
Discussion: https://postgr.es/m/5e045179-236f-4f8f-84f1-0f2566ba784c.mengjuan.cmj@alibaba-inc.com  

M src/backend/replication/slot.c

commit   : d52c24b0f808a6644fd839c507625eafd6bb9f12    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 12:45:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 12:45:20 +0900    

Click here for diff

The test module injection_points has been used as a landing spot to  
provide coverage for the custom pgstats APIs, for both fixed-sized and  
variable-sized stats kinds.  Some recent work related to pgstats is  
proving that this structure makes the implementation of new tests  
harder.  
  
This commit removes the code related to pgstats from injection_points,  
and an equivalent will be reintroduced as a separate test module in a  
follow-up commit.  This removal is done in its own commit for clarity.  
  
Using injection_points for this test coverage was perhaps not the best  
way to design things, but this was good enough while working on the  
first flavor of the custom pgstats APIs.  Using a new test module will  
make easier the introduction of new tests, and we will not need to worry  
about the impact of new changes related to custom pgstats could have  
with the internals of injection_points.  
  
Author: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/CAA5RZ0sJgO6GAwgFxmzg9MVP=rM7Us8KKcWpuqxe-f5qxmpE0g@mail.gmail.com  

M doc/src/sgml/xfunc.sgml
M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
D src/test/modules/injection_points/injection_stats.c
D src/test/modules/injection_points/injection_stats.h
D src/test/modules/injection_points/injection_stats_fixed.c
M src/test/modules/injection_points/meson.build
D src/test/modules/injection_points/t/001_stats.pl
M src/tools/pgindent/typedefs.list

Improve error messages of input functions for pg_dependencies and pg_ndistinct

commit   : f68597ee777d0a177e84cf86b8386ea51c66b52e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 10:23:48 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 Dec 2025 10:23:48 +0900    

Click here for diff

The error details updated in this commit can be reached in the  
regression tests.  They did not follow the project style, and they  
should be written them as full sentences.  
  
Some of the errors are switched to use an elog(), for cases that involve  
paths that cannot be reached based on the previous state of the parser  
processing the input data (array start, object end, etc.).  The error  
messages for these cases use now a more consistent style across the  
board, with the state of the parser reported for debugging.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Author: Michael Paquier <michael@paquier.xyz>  
Co-authored-by: Corey Huinker <corey.huinker@gmail.com>  
Discussion: https://postgr.es/m/1353179.1764901790@sss.pgh.pa.us  

M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_ndistinct.c
M src/test/regress/expected/pg_dependencies.out
M src/test/regress/expected/pg_ndistinct.out

ecpg: refactor to eliminate cast-away-const in find_variable().

commit   : 4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 14:32:36 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 14:32:36 -0500    

Click here for diff

find_variable() and its subroutines transiently scribble on the  
passed-in "name" string, even though we've declared that "const".  
The string is in fact temporary, so this is not very harmful,  
but it's confusing and will produce compiler warnings with  
late-model gcc.  Rearrange the code so that instead of modifying  
the given string, we make temporary copies of the parts that we  
need separated out.  (I used loc_alloc so that the copies are  
short-lived and don't need to be freed explicitly.)  
  
This code is poorly structured and confusing, to the point where  
my first attempt to fix it was wrong.  It is also under-tested,  
allowing the broken v1 patch to nonetheless pass regression.  
I'll restrain myself from rewriting it completely, and just add  
some comments and more test cases.  
  
We will probably want to back-patch this once gcc 15.2 becomes  
more widespread, but for now just put it in master.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us  

M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr
M src/interfaces/ecpg/test/preproc/array_of_struct.pgc
M src/interfaces/ecpg/test/preproc/pointer_to_struct.pgc

Micro-optimize datatype conversions in datum_to_jsonb_internal.

commit   : 005a2907dc304eadb00719e5b6e08cd2cf329829    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:54:33 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:54:33 -0500    

Click here for diff

The general case for converting to a JSONB numeric value is to run the  
source datatype's output function and then numeric_in, but we can do  
substantially better than that for integer and numeric source values.  
This patch improves the speed of jsonb_agg by 30% for integer input,  
and nearly 2X for numeric input.  
  
Sadly, the obvious idea of using float4_numeric and float8_numeric  
to speed up those cases doesn't work: they are actually slower than  
the generic coerce-via-I/O method, and not by a small amount.  
They might round off differently than this code has historically done,  
too.  Leave that alone pending possible changes in those functions.  
  
We can also do better than the existing code for text/varchar/bpchar  
source data; this optimization is similar to one that already exists  
in the json_agg() code.  That saves 20% or so for such inputs.  
  
Also make a couple of other minor improvements, such as not giving  
JSONTYPE_CAST its own special case outside the switch when it could  
perfectly well be handled inside, and not using dubious string hacking  
to detect infinity and NaN results.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us  

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

Remove fundamentally-redundant processing in jsonb_agg() et al.

commit   : b61aa76e4585b4b71098b0990b208813a85dbbf5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:52:22 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:52:22 -0500    

Click here for diff

The various variants of jsonb_agg() operate as follows,  
for each aggregate input value:  
  
1. Build a JsonbValue tree representation of the input value.  
2. Flatten the JsonbValue tree into a Jsonb in on-disk format.  
3. Iterate through the Jsonb, building a JsonbValue that is part  
of the aggregate's state stored in aggcontext, but is otherwise  
identical to what phase 1 built.  
  
This is very slightly less silly than it sounds, because phase 1  
involves calling non-JSONB code such as datatype output functions,  
which are likely to leak memory, and we don't want to leak into the  
aggcontext.  Nonetheless, phases 2 and 3 are accomplishing exactly  
nothing that is useful if we can make phase 1 put the JsonbValue  
tree where we need it.  We could probably do that with a bunch of  
MemoryContextSwitchTo's, but what seems more robust is to give  
pushJsonbValue the responsibility of building the JsonbValue tree  
in a specified non-current memory context.  The previous patch  
created the infrastructure for that, and this patch simply makes  
the aggregate functions use it and then rips out phases 2 and 3.  
  
For me, this makes jsonb_agg() with a text column as input run  
about 2X faster than before.  It's not yet on par with json_agg(),  
but this removes a whole lot of the difference.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us  

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

Revise APIs for pushJsonbValue() and associated routines.

commit   : 0986e95161cec929d8f39c01e9848f34526be421    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:46:49 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:46:49 -0500    

Click here for diff

Instead of passing "JsonbParseState **" to pushJsonbValue(),  
pass a pointer to a JsonbInState, which will contain the  
parseState stack pointer as well as other useful fields.  
Also, instead of returning a JsonbValue pointer that is often  
meaningless/ignored, return the top-level JsonbValue pointer  
in the "result" field of the JsonbInState.  
  
This involves a lot of (mostly mechanical) edits, but I think  
the results are notationally cleaner and easier to understand.  
Certainly the business with sometimes capturing the result of  
pushJsonbValue() and sometimes not was bug-prone and incapable of  
mechanical verification.  In the new arrangement, JsonbInState.result  
remains null until we've completed a valid sequence of pushes, so  
that an incorrect sequence will result in a null-pointer dereference,  
not mistaken use of a partial result.  
  
However, this isn't simply an exercise in prettier notation.  
The real reason for doing it is to provide a mechanism whereby  
pushJsonbValue() can be told to construct the JsonbValue tree  
in a context that is not CurrentMemoryContext.  That happens  
when a non-null "outcontext" is specified in the JsonbInState.  
No callers exercise that option in this patch, but the next  
patch in the series will make use of it.  
  
I tried to improve the comments in this area too.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: jian he <jian.universality@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us  

M contrib/hstore/hstore_io.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/jsonb.h

Add a macro for the declared typlen of type timetz.

commit   : 3628af42107d588af73280d7e96d1c6188aadad7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:33:35 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 Dec 2025 11:33:35 -0500    

Click here for diff

pg_type.typlen says 12 for the size of timetz, but sizeof(TimeTzADT)  
will be 16 on most platforms due to alignment padding.  Using the  
sizeof number is no problem for usages such as palloc'ing a result  
datum, but in usages such as datumCopy we really ought to match  
what pg_type says.  Add a macro TIMETZ_TYPLEN so that we have a  
symbolic way to write that rather than hard-coding "12".  
  
I cannot find any place where we've needed this so far, but an  
upcoming patch requires it.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/2329959.1765047648@sss.pgh.pa.us  

M src/include/utils/date.h

commit   : 6498287696dafc1ebd380ea4eb249124989294d3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Dec 2025 18:31:26 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Dec 2025 18:31:26 -0500    

Click here for diff

The SQL standard says that corr() and friends should return NULL in  
the mathematically-undefined case where all the inputs in one of  
the columns have the same value.  We were checking that by seeing  
if the sums Sxx and Syy were zero, but that approach is very  
vulnerable to roundoff error: if a sum is close to zero but not  
exactly that, we'd come out with a pretty silly non-NULL result.  
  
Instead, directly track whether the inputs are all equal by  
remembering the common value in each column.  Once we detect  
that a new input is different from before, represent that by  
storing NaN for the common value.  (An objection to this scheme  
is that if the inputs are all NaN, we will consider that they  
were not all equal.  But under IEEE float arithmetic rules,  
one NaN is never equal to another, so this behavior is arguably  
correct.  Moreover it matches what we did before in such cases.)  
Then, leave the sums at their exact value of zero for as long  
as we haven't detected different input values.  
  
This solution requires the aggregate transition state to contain  
8 float values not 6, which is not problematic, and it seems to add  
less than 1% to the aggregates' runtime, which seems acceptable.  
  
While we're here, improve corr()'s final function to cope with  
overflow/underflow in the final calculation, and to clamp its  
result to [-1, 1] in case of roundoff error.  
  
Although this is arguably a bug fix, it requires a catversion bump  
due to the change in aggregates' initial states, so it can't be  
back-patched.  
  
Patch written by me, but many of the ideas are due to Dean Rasheed,  
who also did a deal of testing.  
  
Bug: #19340  
Reported-by: Oleg Ivanov <o15611@gmail.com>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Co-authored-by: Dean Rasheed <dean.a.rasheed@gmail.com>  
Discussion: https://postgr.es/m/19340-6fb9f6637f562092@postgresql.org  

M src/backend/utils/adt/float.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Doc: include JSON in the list of SQL-standard types.

commit   : 25303961d09c7e2354a48cbce511a06cce691907    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Dec 2025 13:34:48 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 6 Dec 2025 13:34:48 -0500    

Click here for diff

Oversight I guess, it's been in the standard for awhile.  
  
Reported-by: Bob Kline <bkline@rksystems.com>  
Discussion: https://postgr.es/m/CAGjKmVoP4qVeJgkaBtQ6L46+OLARzmym53uQGhp5COw4wp65yQ@mail.gmail.com  

M doc/src/sgml/datatype.sgml

Improve error reporting of recovery test 027_stream_regress

commit   : 47da198934e9a764ad3c60c5e573ab13b4e2d591    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Dec 2025 14:41:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Dec 2025 14:41:29 +0900    

Click here for diff

Previously, the 027_stream_regress test reported the full contents of  
regression.diffs upon a test failure, when the standby and the primary  
were still alive.  If a test fails quite badly, the amount of  
information reported can be really high, bloating the reports in the  
buildfarm, the CI, or even local runs.  
  
In most cases, we have noticed that having all this information is not  
necessary when attempting to identify the source of a problem in this  
test.  This commit changes the situation by including the head and tail  
of regression.diffs in the reports generated on failure rather than its  
full contents, building upon b93f4e2f98b3 to optionally control the size  
of the reports with the new environment variable  
PG_TEST_FILE_READ_LINES.  
  
This will perhaps require some more tuning, but the hope is to reduce  
some of the buildfarm report bloat while making the information good  
enough to deduce what is happening when something is going wrong, be it  
in the buildfarm or some tests run in the CI, at least.  
  
Suggested-by: Andres Freund <andres@anarazel.de>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com  

M src/test/recovery/t/027_stream_regress.pl

Add PostgreSQL::Test::Cluster::read_head_tail() helper to PostgreSQL/Utils.pm

commit   : b93f4e2f98b384596a307b6ce54ce2affadc518a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Dec 2025 14:27:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 6 Dec 2025 14:27:53 +0900    

Click here for diff

This function reads the lines from a file and filters its contents to  
report its head and tail contents.  The amount of contents to read from  
a file can be tuned by the environment variable PG_TEST_FILE_READ_LINES,  
that can be used to override the default of 50 lines.  If the file whose  
content is read has less lines than two times PG_TEST_FILE_READ_LINES,  
the whole file is returned.  
  
This will be used in a follow-up commit to limit the amount of  
information reported by some of the TAP tests on failure, where we have  
noticed that the contents reported by the buildfarm can be heavily  
bloated in some cases, with the head and tail contents of a report being  
able to provide enough information to be useful for debugging.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Co-authored-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com  

M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Utils.pm

Fix text substring search for non-deterministic collations.

commit   : 6dfce8420e99d8cf41ffb7da698caee57fd73eb7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Dec 2025 20:10:33 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Dec 2025 20:10:33 -0500    

Click here for diff

Due to an off-by-one error, the code failed to find matches at the  
end of the haystack.  Fix by rewriting the loop.  
  
While at it, fix a comment that claimed that the function could find  
a zero-length match.  Such a match could send a caller into an endless  
loop.  However, zero-length matches only make sense with an empty  
search string, and that case is explicitly excluded by all callers.  
To make sure it stays that way, add an Assert and a comment.  
  
Bug: #19341  
Reported-by: Adam Warland <adam.warland@infor.com>  
Author: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/19341-1d9a22915edfec58@postgresql.org  
Backpatch-through: 18  

M src/backend/utils/adt/varlena.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Fix test to work with non-8kB block sizes

commit   : 7c2061bdfba7c738dac1e2c14db51faeef3f34b1    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 5 Dec 2025 23:39:01 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 5 Dec 2025 23:39:01 +0200    

Click here for diff

Author: Maxim Orlov <orlovmg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/CACG%3Dezbtm%2BLOzEMyLX7rzGcAv3ez3F6nNpSJjvZeMzed0Oe6Pw%40mail.gmail.com  

M src/test/modules/test_slru/t/002_multixact_wraparound.pl

Add commit 86b276a4a9 to .git-blame-ignore-revs.

commit   : d0d873c382cd23f3a49511e2bda35b4bf068c92d    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 5 Dec 2025 14:21:12 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 5 Dec 2025 14:21:12 -0600    

Click here for diff

M .git-blame-ignore-revs

Don't reset the pathlist of partitioned joinrels.

commit   : 014f9a831a320666bf2195949f41710f970c54ad    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 5 Dec 2025 11:05:12 -0500    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 5 Dec 2025 11:05:12 -0500    

Click here for diff

apply_scanjoin_target_to_paths wants to avoid useless work and  
platform-specific dependencies by throwing away the path list created  
prior to applying the final scan/join target and constructing a whole  
new one using the final scan/join target. However, this is only valid  
when we'll consider all the same strategies after the pathlist reset  
as before.  
  
After resetting the path list, we reconsider Append and MergeAppend  
paths with the modified target list; therefore, it's only valid for a  
partitioned relation. However, what the previous coding missed is that  
it cannot be a partitioned join relation, because that also has paths  
that are not Append or MergeAppend paths and will not be reconsidered.  
Thus, before this patch, we'd sometimes choose a partitionwise strategy  
with a higher total cost than cheapest non-partitionwise strategy,  
which is not good.  
  
We had a surprising number of tests cases that were relying on this  
bug to work as they did. A big part of the reason for this is that row  
counts in regression test cases tend to be low, which brings the cost  
of partitionwise and non-partitionwise strategies very close together,  
especially for merge joins, where the real and perceived advantages of  
a partitionwise approach are minimal. In addition, one test case  
included a row-count-inflating join. In such cases, a partitionwise  
join can easily be a loser on cost, because the total number of tuples  
passing through an Append node is much higher than it is with a  
non-partitionwise strategy. That test case is adjusted by adding  
additional join clauses to avoid the row count inflation.  
  
Although the failure of the planner to choose the lowest-cost path is a  
bug, we generally do not back-patch fixes of this type, because planning  
is not an exact science and there is always a possibility that some user  
will end up with a plan that has a lower estimated cost but actually  
runs more slowly. Hence, no backpatch here, either.  
  
The code change here is exactly what was originally proposed by  
Ashutosh, but the changes to the comments and test cases have been  
very heavily rewritten by me, helped along by some very useful advice  
from Richard Guo.  
  
Reported-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>  
Author: Robert Haas <rhaas@postgresql.org>  
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>  
Reviewed-by: Arne Roland <arne.roland@malkut.net>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: http://postgr.es/m/CAExHW5toze58+jL-454J3ty11sqJyU13Sz5rJPQZDmASwZgWiA@mail.gmail.com  

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

Fix some cases of indirectly casting away const.

commit   : 8f1791c61836d213acbf85d368c8762705ad9d51    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Dec 2025 11:17:14 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 5 Dec 2025 11:17:14 -0500    

Click here for diff

Newest versions of gcc are able to detect cases where code implicitly  
casts away const by assigning the result of strchr() or a similar  
function applied to a "const char *" value to a target variable  
that's just "char *".  This of course creates a hazard of not getting  
a compiler warning about scribbling on a string one was not supposed  
to, so fixing up such cases is good.  
  
This patch fixes a dozen or so places where we were doing that.  
Most are trivial additions of "const" to the target variable,  
since no actually-hazardous change was occurring.  There is one  
place in ecpg.trailer where we were indeed violating the intention  
of not modifying a string passed in as "const char *".  I believe  
that's harmless not a live bug, but let's fix it by copying the  
string before modifying it.  
  
There is a remaining trouble spot in ecpg/preproc/variable.c,  
which requires more complex surgery.  I've left that out of this  
commit because I want to study that code a bit more first.  
  
We probably will want to back-patch this once compilers that detect  
this pattern get into wider circulation, but for now I'm just  
going to apply it to master to see what the buildfarm says.  
  
Thanks to Bertrand Drouvot for finding a couple more spots than  
I had.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us  

M src/backend/catalog/pg_type.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/common/compression.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/port/chklocale.c
M src/port/getopt_long.c
M src/port/win32setlocale.c
M src/test/regress/pg_regress.c
M src/timezone/zic.c

Stabilize tests some more

commit   : a4a0fa0c7587eb05b36c1f184d966dd5524a4b74    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 5 Dec 2025 16:16:27 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Fri, 5 Dec 2025 16:16:27 +0100    

Click here for diff

Tests added by commits 90eae926abbb, 2bc7e886fc1b, bc32a12e0db2  
have occasionally failed, depending on timing.  Add some dependency  
markers to the spec to try and remove the instability.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Discussion: https://postgr.es/m/202512041739.sgg3tb2yobe2@alvherre.pgsql  

M src/test/modules/injection_points/specs/reindex-concurrently-upsert-on-constraint.spec
M src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec
M src/test/modules/injection_points/specs/reindex-concurrently-upsert.spec

Fix setting next multixid's offset at offset wraparound

commit   : 4d936c3fff1ac8dead2cc240ba3da2ed6337257c    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 5 Dec 2025 11:32:38 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Fri, 5 Dec 2025 11:32:38 +0200    

Click here for diff

In commit 789d65364c, we started updating the next multixid's offset  
too when recording a multixid, so that it can always be used to  
calculate the number of members. I got it wrong at offset wraparound:  
we need to skip over offset 0. Fix that.  
  
Discussion: https://www.postgresql.org/message-id/d9996478-389a-4340-8735-bfad456b313c@iki.fi  
Backpatch-through: 14  

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

Use more palloc_object() and palloc_array() in contrib/

commit   : 31d3847a37bec060fb4177b2fc6c0fdfc7a08011    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 16:40:26 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 16:40:26 +0900    

Click here for diff

The idea is to encourage more the use of these new routines across the  
tree, as these offer stronger type safety guarantees than palloc().  In  
an ideal world, palloc() would then act as an internal routine of these  
flavors, whose footprint in the tree is minimal.  
  
The patch sent by the author is very large, and this chunk of changes  
represents something like 10% of the overall patch submitted.  
  
The code compiled is the same before and after this commit, using  
objdump to do some validation with a difference taken in-between.  There  
are some diffs, which are caused by changes in line numbers because some  
of the new allocation formulas are shorter, for the following files:  
trgm_regexp.c, xpath.c and pg_walinspect.c.  
  
Author: David Geier <geidav.pg@gmail.com>  
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com  

M contrib/amcheck/verify_gin.c
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree/ltxtquery_io.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgp-cfb.c
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-pubkey.c
M contrib/pgcrypto/px-hmac.c
M contrib/pgcrypto/px.c
M contrib/seg/seg.c
M contrib/sepgsql/label.c
M contrib/sepgsql/uavc.c
M contrib/spi/refint.c
M contrib/sslinfo/sslinfo.c
M contrib/tablefunc/tablefunc.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c

Improve test output of extended statistics for ndistinct and dependencies

commit   : 2f04110225ab30fbd9889d6f5d73fd6b3e1b308b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 14:15:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 14:15:21 +0900    

Click here for diff

Corey Huinker has come up with a recipe that is more compact and more  
pleasant to the eye for extended stats because we know that all of them  
are 1-dimension JSON arrays.  This commit switches the extended stats  
tests to use replace() instead of jsonb_pretty(), splitting the data so  
as one line is used for each item in the extended stats object.  
  
This results in the removal of a good chunk of test output, that is now  
easier to debug with one line used for each item in a stats object.  
This patch has not been provided by Corey.  This is some post-commit  
cleanup work that I have noticed as good enough to do on its own while  
reviewing the rest of the patch set Corey has posted.  
  
Discussion: https://postgr.es/m/CADkLM=csMd52i39Ye8-PUUHyzBb3546eSCUTh-FBQ7bzT2uZ4Q@mail.gmail.com  

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

Rename column slotsync_skip_at to slotsync_last_skip.

commit   : 5db6a344abc2dfbc5df454cd93a096443ea4dd3e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 5 Dec 2025 04:12:55 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 5 Dec 2025 04:12:55 +0000    

Click here for diff

Commit 76b78721ca introduced two new columns in pg_stat_replication_slots  
to improve monitoring of slot synchronization. One of these columns was  
named slotsync_skip_at, which is inconsistent with the naming convention  
used for similar columns in other system views.  
  
Columns that store timestamps of the most recent event typically use the  
'last_' in the column name (e.g., last_autovacuum, checksum_last_failure).  
Renaming slotsync_skip_at to slotsync_last_skip aligns with this pattern,  
making the purpose of the column clearer and improving overall consistency  
across the views.  
  
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Reviewed-by: Michael Banck <mbanck@gmx.net>  
Discussion: https://postgr.es/m/20251128091552.GB13635@p46.dedyn.io;lightning.p46.dedyn.io  
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com  

M contrib/test_decoding/expected/stats.out
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out

Fix some compiler warnings

commit   : 7bc88c3d6f3af3af5330c0e209c8a3c411267d00    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 12:30:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 12:30:43 +0900    

Click here for diff

Some of the buildfarm members with some old gcc versions have been  
complaining about an always-true test for a NULL pointer caused by a  
combination of SOFT_ERROR_OCCURRED() and a local ErrorSaveContext  
variable.  
  
These warnings are taken care of by removing SOFT_ERROR_OCCURRED(),  
switching to a direct variable check, like 56b1e88c804b.  
  
Oversights in e1405aa5e3ac and 44eba8f06e55.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1341064.1764895052@sss.pgh.pa.us  

M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_ndistinct.c

Show version of nodes in output of TAP tests

commit   : 83f2f8413e8d9687fda7d5881c82b89b8d9d4043    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 09:21:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 Dec 2025 09:21:13 +0900    

Click here for diff

This commit adds the version information of a node initialized by  
Cluster.pm, that may vary depending on the install_path given by the  
test.  The code was written so as the node information, that includes  
the version number, was dumped before the version number was set.  
  
This is particularly useful for the pg_upgrade TAP tests, that may mix  
several versions for cross-version runs.  The TAP infrastructure also  
allows mixing nodes with different versions, so this information can be  
useful for out-of-core tests.  
  
Backpatch down to v15, where Cluster.pm and the pg_upgrade TAP tests  
have been introduced.  
  
Author: Potapov Alexander <a.potapov@postgrespro.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/e59bb-692c0a80-5-6f987180@170377126  
Backpatch-through: 15  

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

Suppress spurious Coverity warning in prune freeze logic

commit   : 904f9f5ea0e00a88e2429682d01f2ec946bf553a    
  
author   : Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 4 Dec 2025 18:55:02 -0500    
  
committer: Melanie Plageman <melanieplageman@gmail.com>    
date     : Thu, 4 Dec 2025 18:55:02 -0500    

Click here for diff

Adjust the prune_freeze_setup() parameter types of new_relfrozen_xid and  
new_relmin_mxid to prevent misleading Coverity analysis.  
heap_page_prune_and_freeze() compared these values against NULL when  
passing them to prune_freeze_setup(), causing Coverity to assume they  
could be NULL and flag a possible null-pointer dereference later, even  
though it occurs inside a directly related conditional.  
  
Reported-by: Coverity  
Author: Melanie Plageman <melanieplageman@gmail.com>  

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

Fix key size of PrivateRefCountHash.

commit   : 80f6e2fb4addb03e2e163a380b5e6e1f4b321286    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Dec 2025 15:42:18 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 4 Dec 2025 15:42:18 -0600    

Click here for diff

The key is the first member of PrivateRefCountEntry, which has type  
Buffer.  This commit changes the key size from sizeof(int32) to  
sizeof(Buffer).  This appears to be an oversight in commit  
4b4b680c3d, but it's of no consequence because Buffer has been a  
signed 32-bit integer for a long time.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/aS77DTpl0fOkIKSZ%40ip-10-97-1-34.eu-west-3.compute.internal  

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

Remove no longer needed casts from Pointer

commit   : e158fd4d68f44d0872c1d2053067fe306cc9d2b2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 20:44:52 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 20:44:52 +0100    

Click here for diff

These casts used to be required when Pointer was char *, but now it's  
void * (commit 1b2bb5077e9), so they are not needed anymore.  
  
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M contrib/amcheck/verify_gin.c
M contrib/pg_trgm/trgm_gin.c
M src/backend/access/gin/ginentrypage.c
M src/backend/utils/adt/jsonb_gin.c

Remove no longer needed casts to Pointer

commit   : c6be3daa054a2fac67331f3bfc348b9bfd6f690c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 19:40:08 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 19:40:08 +0100    

Click here for diff

These casts used to be required when Pointer was char *, but now it's  
void * (commit 1b2bb5077e9), so they are not needed anymore.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M contrib/btree_gist/btree_utils_var.h
M src/backend/access/heap/heaptoast.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_constraint.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/cache/evtcache.c
M src/include/fmgr.h

amcheck: Fix snapshot usage in bt_index_parent_check

commit   : 6bd469d26aca6ea413b35bfcb611dfa3a8f5ea45    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 4 Dec 2025 18:12:08 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Thu, 4 Dec 2025 18:12:08 +0100    

Click here for diff

We were using SnapshotAny to do some index checks, but that's wrong and  
causes spurious errors when used on indexes created by CREATE INDEX  
CONCURRENTLY.  Fix it to use an MVCC snapshot, and add a test for it.  
  
This problem came in with commit 5ae2087202af, which introduced  
uniqueness check.  Backpatch to 17.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Backpatch-through: 17  
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com  

M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml

headerscheck ccache support

commit   : 40bdd839f52a3e18a0e003f556cab3512510f633    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 11:23:23 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 Dec 2025 11:23:23 +0100    

Click here for diff

Currently, headerscheck and cpluspluscheck are very slow, and they  
defeat use of ccache.  This fixes that, and now they are much faster.  
  
The problem was that the test files are created in a randomly-named  
directory (`mktemp -d /tmp/$me.XXXXXX`), and this directory is  
mentioned on the compiler command line, which is part of the cache  
key.  
  
The solution is to create the test files in the build directory.  For  
example, for src/include/storage/ipc.h, we generate  
  
    tmp_headerscheck_c/src_include_storage_ipc_h.c (or .cpp)  
  
Now ccache works.  (And it's also a bit easier to debug everything  
with this naming.)  
  
(The subdirectory is used to keep the cleanup trap simple.)  
  
The observed speedup on Cirrus CI for headerscheck plus cpluspluscheck  
is from about 1min 20s to only 20s.  In local use, the speedups are  
similar.  
  
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/b49e74d4-3cf9-4d1c-9dce-09f75e55d026%40eisentraut.org  

M .cirrus.tasks.yml
M src/tools/pginclude/headerscheck

headerscheck: Use LLVM_CPPFLAGS

commit   : d0b7a0b4c8f49ea96f171883d09e902483083d98    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 28 Nov 2025 11:36:41 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 28 Nov 2025 11:36:41 +0100    

Click here for diff

Otherwise, headerscheck will fail if the LLVM headers are in a  
location not reached by the normal CFLAGS/CPPFLAGS.  
  
Discussion: https://www.postgresql.org/message-id/flat/b49e74d4-3cf9-4d1c-9dce-09f75e55d026%40eisentraut.org  

M src/tools/pginclude/headerscheck

Fix incorrect assertion bound in WaitForLSN()

commit   : d6ef8ee3ee29ffa404bcd920e02fb4b196e07b0d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 4 Dec 2025 10:38:12 +0200    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 4 Dec 2025 10:38:12 +0200    

Click here for diff

The assertion checking MyProcNumber used MaxBackends as the upper  
bound, but the procInfos array is allocated with size  
MaxBackends + NUM_AUXILIARY_PROCS. This inconsistency would cause  
a false assertion failure if an auxiliary process calls WaitForLSN().  
  
Author: Xuneng Zhou <xunengzhou@gmail.com>  

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

Rename BUFFERPIN wait event class to BUFFER

commit   : 6c5c393b74031351721f8a44e55bfaf6f249eefb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    

Click here for diff

In an upcoming patch more wait events will be added to the wait event  
class (for buffer locking), making the current name too  
specific. Alternatively we could introduce a dedicated wait event class for  
those, but it seems somewhat confusing to have a BUFFERPIN and a BUFFER wait  
event class.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/utils/wait_classes.h
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/test/regress/expected/sysviews.out
M src/tools/pgindent/typedefs.list

Add pg_atomic_unlocked_write_u64

commit   : 7902a47c20b1d5c0b7d20071f9ada6a0185bf39b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    

Click here for diff

The 64bit equivalent of pg_atomic_unlocked_write_u32(), to be used in an  
upcoming patch converting BufferDesc.state into a 64bit atomic.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

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

bufmgr: Turn BUFFER_LOCK_* into an enum

commit   : 156680055dc523425f28ff5e61acf0f5bc99294b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 3 Dec 2025 18:38:20 -0500    

Click here for diff

It seems cleaner to use an enum to tie the different values together. It also  
helps to have a more descriptive type in the argument to various functions.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Make stats_ext test faster under cache-clobbering test conditions.

commit   : 8d61228717e619b90b8ebd1d219d006b920e00e5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Dec 2025 13:23:45 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 3 Dec 2025 13:23:45 -0500    

Click here for diff

Commit 1eccb9315 added a test case that will cause a large number  
of evaluations of a plpgsql function.  With -DCLOBBER_CACHE_ALWAYS,  
that takes an unreasonable amount of time (hours) because the  
function's cache entries are repeatedly deleted and rebuilt.  
That doesn't add any useful test coverage --- other test cases  
already exercise plpgsql well enough --- and it's not part of what  
this test intended to cover.  We can get the same planner coverage,  
if not more, by making the test directly invoke numeric_lt().  
  
Reported-by: Tomas Vondra <tomas@vondra.me>  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/baf1ae02-83bd-4f5d-872a-1d04f11a9073@vondra.me  

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

Add test for multixid wraparound

commit   : 7b81be9b42678c7ab69c3e8f565172f1d8d9e86f    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 3 Dec 2025 19:39:34 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 3 Dec 2025 19:39:34 +0200    

Click here for diff

Author: Andrey Borodin <amborodin@acm.org>  
Discussion: https://www.postgresql.org/message-id/7de697df-d74d-47db-9f73-e069b7349c4b@iki.fi  

M src/test/modules/test_slru/meson.build
A src/test/modules/test_slru/t/002_multixact_wraparound.pl

Set next multixid's offset when creating a new multixid

commit   : 789d65364cdecd81e4bf822eec468ea3d34d28af    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 3 Dec 2025 19:15:08 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Wed, 3 Dec 2025 19:15:08 +0200    

Click here for diff

With this commit, the next multixid's offset will always be set on the  
offsets page, by the time that a backend might try to read it, so we  
no longer need the waiting mechanism with the condition variable. In  
other words, this eliminates "corner case 2" mentioned in the  
comments.  
  
The waiting mechanism was broken in a few scenarios:  
  
- When nextMulti was advanced without WAL-logging the next  
  multixid. For example, if a later multixid was already assigned and  
  WAL-logged before the previous one was WAL-logged, and then the  
  server crashed. In that case the next offset would never be set in  
  the offsets SLRU, and a query trying to read it would get stuck  
  waiting for it. Same thing could happen if pg_resetwal was used to  
  forcibly advance nextMulti.  
  
- In hot standby mode, a deadlock could happen where one backend waits  
  for the next multixid assignment record, but WAL replay is not  
  advancing because of a recovery conflict with the waiting backend.  
  
The old TAP test used carefully placed injection points to exercise  
the old waiting code, but now that the waiting code is gone, much of  
the old test is no longer relevant. Rewrite the test to reproduce the  
IPC/MultixactCreation hang after crash recovery instead, and to verify  
that previously recorded multixids stay readable.  
  
Backpatch to all supported versions. In back-branches, we still need  
to be able to read WAL that was generated before this fix, so in the  
back-branches this includes a hack to initialize the next offsets page  
when replaying XLOG_MULTIXACT_CREATE_ID for the last multixid on a  
page. On 'master', bump XLOG_PAGE_MAGIC instead to indicate that the  
WAL is not compatible.  
  
Author: Andrey Borodin <amborodin@acm.org>  
Reviewed-by: Dmitry Yurichev <dsy.075@yandex.ru>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Reviewed-by: Ivan Bykov <i.bykov@modernsys.ru>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://www.postgresql.org/message-id/172e5723-d65f-4eec-b512-14beacb326ce@yandex.ru  
Backpatch-through: 14  

M src/backend/access/transam/multixact.c
M src/include/access/xlog_internal.h
M src/test/modules/test_slru/t/001_multixact.pl
M src/test/modules/test_slru/test_multixact.c

Use "foo(void)" for definitions of functions with no parameters.

commit   : 9b05e2ec08a3d174accb2a9e1c59e52e94799acc    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 Dec 2025 10:54:37 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 Dec 2025 10:54:37 -0600    

Click here for diff

Standard practice in PostgreSQL is to use "foo(void)" instead of  
"foo()", as the latter looks like an "old-style" function  
declaration.  Similar changes were made in commits cdf4b9aff2,  
0e72b9d440, 7069dbcc31, f1283ed6cc, 7b66e2c086, e95126cf04, and  
9f7c527af3.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/aTBObQPg%2Bps5I7vl%40ip-10-97-1-34.eu-west-3.compute.internal  

M src/backend/access/common/heaptuple.c
M src/backend/access/index/genam.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/uuid.c
M src/bin/pg_basebackup/pg_createsubscriber.c

Put back alternative-output expected files

commit   : be25c77677285d3b1365bd19280b27771a1efbce    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 3 Dec 2025 16:37:06 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Wed, 3 Dec 2025 16:37:06 +0100    

Click here for diff

These were removed in 5dee7a603f66, but that was too optimistic, per  
buildfarm member prion as reported by Tom Lane.  Mea (Álvaro's) culpa.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Discussion: https://postgr.es/m/570630.1764737028@sss.pgh.pa.us  

A src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
A src/test/modules/injection_points/expected/index-concurrently-upsert_1.out

doc: Consistently use restartpoint in the documentation

commit   : 64527a17a5053fdd52322dfe32a5a13e5d3f577c    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 3 Dec 2025 15:22:38 +0100    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 3 Dec 2025 15:22:38 +0100    

Click here for diff

The majority of cases already used "restartpoint" with just a few  
instances of "restart point". Changing the latter spelling to the  
former ensures consistency in the user facing documentation. Code  
comments are not affected by this since it is not worth the churn  
to change anything there.  
  
Author: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/0F6E38D0-649F-4489-B2C1-43CD937E6636@yesql.se  

M doc/src/sgml/config.sgml

Fix stray references to SubscriptRef

commit   : 9790affcce032710c907aced834e968f2fc41bce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 14:41:12 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 14:41:12 +0100    

Click here for diff

This type never existed.  SubscriptingRef was meant instead.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/2eaa45e3-efc5-4d75-b082-f8159f51445f%40eisentraut.org  

M contrib/hstore/hstore_subs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/jsonbsubs.c
M src/include/nodes/subscripting.h

Change Pointer to void *

commit   : 1b2bb5077e9e9deac60a3e92e742465e7bcd3a21    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 10:22:17 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 10:22:17 +0100    

Click here for diff

The comment for the Pointer type said 'XXX Pointer arithmetic is done  
with this, so it can't be void * under "true" ANSI compilers.'.  This  
has been fixed in the previous commit 756a4368932.  This now changes  
the definition of the type from char * to void *, as envisaged by that  
comment.  
  
Extension code that relies on using Pointer for pointer arithmetic  
will need to make changes similar to commit 756a4368932, but those  
changes would be backward compatible.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M src/include/c.h

Don't rely on pointer arithmetic with Pointer type

commit   : 756a43689324b473ee07549a6eb7a53a203df5ad    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 09:54:15 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 09:54:15 +0100    

Click here for diff

The comment for the Pointer type says 'XXX Pointer arithmetic is done  
with this, so it can't be void * under "true" ANSI compilers.'.  This  
fixes that.  Change from Pointer to use char * explicitly where  
pointer arithmetic is needed.  This makes the meaning of the code  
clearer locally and removes a dependency on the actual definition of  
the Pointer type.  (The definition of the Pointer type is not changed  
in this commit.)  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c

Use more appropriate DatumGet* function

commit   : 8c6bbd674ed810df9af5ec42f6b38c205e3ad365    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 08:52:28 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 08:52:28 +0100    

Click here for diff

Use DatumGetCString() instead of DatumGetPointer() for returning a C  
string.  Right now, they are the same, but that doesn't always have to  
be so.  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M src/test/modules/test_resowner/test_resowner_basic.c

Remove useless casts to Pointer

commit   : 623801b3bdb4e16df39f945b6aa5f109744c7b6b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 08:40:33 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 Dec 2025 08:40:33 +0100    

Click here for diff

in arguments of memcpy() and memmove() calls  
  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org  

M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/utils/adt/multirangetypes.c

Fix shadow variable warning in subscriptioncmds.c.

commit   : c252d37d8ca8f254fa715ec24fcb23a035a88993    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 Dec 2025 03:31:31 +0000    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 Dec 2025 03:31:31 +0000    

Click here for diff

Author: Shlok Kyal <shlok.kyal.oss@gmail.com>  
Author: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Reviewed-by: Vignesh C <vignesh21@gmail.com>  
Discussion: https://postgr.es/m/CAHut+PsF8R0Bt4J3c92+T2F0mun0rRfK=-GH+iBv2s-O8ahJJw@mail.gmail.com  

M src/backend/commands/subscriptioncmds.c

Use LW_SHARED in dsa.c where possible.

commit   : a6d05c819380b0940fcfb428aa298f2d7e76e5c6    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 2 Dec 2025 16:40:23 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 2 Dec 2025 16:40:23 -0600    

Click here for diff

Both dsa_get_total_size() and dsa_get_total_size_from_handle() take  
an exclusive lock just to read a variable.  This commit reduces the  
lock level to LW_SHARED in those functions.  
  
Reviewed-by: Sami Imseih <samimseih@gmail.com>  
Discussion: https://postgr.es/m/aS8fMzWs9e8iHxk2%40nathan  

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

Fix amcheck's handling of half-dead B-tree pages

commit   : cbe04e5d729f292bcf9b06f5d774884b4511b18a    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:11:15 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:11:15 +0200    

Click here for diff

amcheck incorrectly reported the following error if there were any  
half-dead pages in the index:  
  
ERROR:  mismatch between parent key and child high key in index  
"amchecktest_id_idx"  
  
It's expected that a half-dead page does not have a downlink in the  
parent level, so skip the test.  
  
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Discussion: https://www.postgresql.org/message-id/33e39552-6a2a-46f3-8b34-3f9f8004451f@garret.ru  
Backpatch-through: 14  

M contrib/amcheck/verify_nbtree.c
M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql

Add a test for half-dead pages in B-tree indexes

commit   : c085aab2781989f487364fab2978d9ee791559a4    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:11:05 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:11:05 +0200    

Click here for diff

To increase our test coverage in general, and because I will use this  
in the next commit to test a bug we currently have in amcheck.  
  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://www.postgresql.org/message-id/33e39552-6a2a-46f3-8b34-3f9f8004451f@garret.ru  

M src/backend/access/nbtree/nbtpage.c
A src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/meson.build
A src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql

Fix amcheck's handling of incomplete root splits in B-tree

commit   : 6c05ef5729c04d47400660cd994305bc44a3c757    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:10:51 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:10:51 +0200    

Click here for diff

When the root page is being split, it's normal that root page  
according to the metapage is not marked BTP_ROOT. Fix bogus error in  
amcheck about that case.  
  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi  
Backpatch-through: 14  

M contrib/amcheck/verify_nbtree.c
M src/test/modules/nbtree/Makefile
M src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
M src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql

Add a test for incomplete splits in B-tree indexes

commit   : 1e4e5783e7d77adb283ae7fa1ac99b0910a041b2    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:10:47 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Tue, 2 Dec 2025 21:10:47 +0200    

Click here for diff

To increase our test coverage in general, and because I will add onto  
this in the next commit to also test amcheck with incomplete splits.  
  
This is copied from the similar test we had for GIN indexes. B-tree's  
incomplete splits work similarly to GIN's, so with small changes, the  
same test works for B-tree too.  
  
Reviewed-by: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi  

M src/backend/access/nbtree/nbtinsert.c
M src/test/modules/meson.build
A src/test/modules/nbtree/Makefile
A src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
A src/test/modules/nbtree/meson.build
A src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql

Show size of DSAs and dshashes in pg_dsm_registry_allocations.

commit   : f894acb24a12cf1f369a45af36c8f4049f9af571    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 2 Dec 2025 10:29:45 -0600    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Tue, 2 Dec 2025 10:29:45 -0600    

Click here for diff

Presently, this view reports NULL for the size of DSAs and dshash  
tables because 1) the current backend might not be attached to them  
and 2) the registry doesn't save the pointers to the dsa_area or  
dshash_table in local memory.  Also, the view doesn't show  
partially-initialized entries to avoid ambiguity, since those  
entries would report a NULL size as well.  
  
This commit introduces a function that looks up the size of a DSA  
given its handle (transiently attaching to the control segment if  
needed) and teaches pg_dsm_registry_allocations to use it to show  
the size of successfully-initialized DSA and dshash entries.  
Furthermore, the view now reports partially-initialized entries  
with a NULL size.  
  
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Chao Li <li.evan.chao@gmail.com>  
Discussion: https://postgr.es/m/aSeEDeznAsHR1_YF%40nathan  

M doc/src/sgml/system-views.sgml
M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h
M src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
M src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql

Remove doc and code comments about ON CONFLICT deficiencies

commit   : 758479213d574d6e2fbbdfee5328edef3d60da61    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 16:47:18 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 16:47:18 +0100    

Click here for diff

They have been fixed, so we don't need this text anymore.  This reverts  
commit 8b18ed6dfbb8.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Discussion: https://postgr.es/m/CADzfLwWo+FV9WSeOah9F1r=4haa6eay1hNvYYy_WfziJeK+aLQ@mail.gmail.com  

M doc/src/sgml/ref/insert.sgml
M src/backend/optimizer/util/plancat.c

Avoid use of NOTICE to wait for snapshot invalidation

commit   : 5dee7a603f664115f8fe9819b0c19abd8209cd02    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 16:43:27 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 16:43:27 +0100    

Click here for diff

This idea (implemented in commits and bc32a12e0db2 and 9e8fa05d3412) of  
using notices to detect that a session is sleeping was unreliable, so  
simplify the concurrency controller session to just look at  
pg_stat_activity for a process sleeping on the injection point we want  
it to hit.  This change allows us to remove a secondary injection point  
and the alternative expected output files.  
  
Reproduced by Alexander Lakhin following a report in buildfarm member  
skink (which runs the server under valgrind).  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/3e302c96-cdd2-45ec-af84-03dbcdccde4a@gmail.com  

M src/backend/utils/time/snapmgr.c
M src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
M src/test/modules/injection_points/expected/index-concurrently-upsert.out
D src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
M src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
M src/test/modules/injection_points/specs/index-concurrently-upsert.spec

Fix ON CONFLICT with REINDEX CONCURRENTLY and partitions

commit   : 90eae926abbbcedbbea2ad5302722185e8652dca    
  
author   : Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 13:51:19 +0100    
  
committer: Álvaro Herrera <alvherre@kurilemu.de>    
date     : Tue, 2 Dec 2025 13:51:19 +0100    

Click here for diff

When planning queries with ON CONFLICT on partitioned tables, the  
indexes to consider as arbiters for each partition are determined based  
on those found in the parent table.  However, it's possible for an index  
on a partition to be reindexed, and in that case, the auxiliary indexes  
created on the partition must be considered as arbiters as well; failing  
to do that may result in spurious "duplicate key" errors given  
sufficient bad luck.  
  
We fix that in this commit by matching every index that doesn't have a  
parent to each initially-determined arbiter index.  Every unparented  
matching index is considered an additional arbiter index.  
  
Closely related to the fixes in bc32a12e0db2 and 2bc7e886fc1b, and for  
identical reasons, not backpatched (for now) even though it's a  
longstanding issue.  
  
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>  
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>  
Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/reindex-concurrently-upsert-partitioned.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec

Remove useless casting to same type

commit   : 4f941d432b42eccd99ba0d22e3a59c073ac2406a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Dec 2025 10:05:12 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Dec 2025 10:05:12 +0100    

Click here for diff

This removes some casts where the input already has the same type as  
the type specified by the cast.  Their presence could cause risks of  
hiding actual type mismatches in the future or silently discarding  
qualifiers.  It also improves readability.  Same kind of idea as  
7f798aca1d5 and ef8fe693606.  (This does not change all such  
instances, but only those hand-picked by the author.)  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>  
Discussion: https://www.postgresql.org/message-id/flat/aSQy2JawavlVlEB0%40ip-10-97-1-34.eu-west-3.compute.internal  

M contrib/btree_gist/btree_utils_num.c
M contrib/cube/cube.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/pgcrypto/mbuf.c
M src/backend/access/common/indextuple.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/gininsert.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/transam/twophase.c
M src/backend/catalog/aclchk.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_expr.c
M src/backend/port/sysv_shmem.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/aio/aio.c
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/pg_dump.c
M src/common/sha1.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/port/win32ntdll.c
M src/test/modules/test_radixtree/test_radixtree.c

Simplify hash_xlog_split_allocate_page()

commit   : 35988b31db7767ba446009611b9928add1d40f98    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Dec 2025 09:10:02 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 Dec 2025 09:10:02 +0100    

Click here for diff

Instead of complicated pointer arithmetic, overlay a uint32 array and  
just access the array members.  That's safe thanks to  
XLogRecGetBlockData() returning a MAXALIGNed buffer.  
  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>  
Discussion: https://www.postgresql.org/message-id/flat/aSQy2JawavlVlEB0%40ip-10-97-1-34.eu-west-3.compute.internal  

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

Replace pointer comparisons and assignments to literal zero with NULL

commit   : ec782f56b0c30ef493e8356b46e1131612f01d9f    
  
author   : Peter Eisentraut &l