PostgreSQL 17.0 (upcoming) commit log

Add ORDER BY to new test query

commit   : 74e12db19cbc78258a92da8be637a3fb0106b126    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jul 2024 13:44:19 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jul 2024 13:44:19 +0200    

Click here for diff

Per buildfarm.  

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

Fix ALTER TABLE DETACH for inconsistent indexes

commit   : 83917791385a601bfe8afe95f250cb2ae6c1fde7    
  
author   : Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jul 2024 12:54:01 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Fri, 12 Jul 2024 12:54:01 +0200    

Click here for diff

When a partitioned table has an index that doesn't support a constraint,  
but a partition has an equivalent index that does, then a DETACH  
operation would misbehave: a crash in assertion-enabled systems (because  
we fail to find the constraint in the parent that we expect to), or a  
broken coninhcount value (-1) in production systems (because we blindly  
believe that we've successfully detached the parent).  
  
While we should reject an ATTACH of a partition with such an index, we  
have failed to do so in existing releases, so adding an error in stable  
releases might break the (unlikely) existing applications that rely on  
this behavior.  At this point I don't even want to reject them in  
master, because it'd break pg_upgrade if such databases exist, and there  
would be no easy way to fix existing databases without expensive index  
rebuilds.  
  
(Later on we could add ALTER TABLE ... ADD CONSTRAINT USING INDEX to  
partitioned tables, which would allow the user to fix such patterns.  At  
that point we could add more restrictions to prevent the problem from  
its root.)  
  
Also, add a test case that leaves one table in this condition, so that  
we can verify that pg_upgrade continues to work if we later decide to  
change the policy on the master branch.  
  
Backpatch to all supported branches.  
  
Co-authored-by: Tender Wang <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Tender Wang <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Add assertion in pgstat_write_statsfile() about processes allowed

commit   : 734c057a8935fca10ff67173c8b969ef799ea7d2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jul 2024 15:09:53 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jul 2024 15:09:53 +0900    

Click here for diff

This routine can currently only be called from the postmaster in  
single-user mode or the checkpointer, but there was no sanity check to  
make sure that this was always the case.  
  
This has proved to be useful when hacking the zone (at least to me), to  
make sure that the write of the pgstats file happens at shutdown, as  
wanted by design, in the correct process context.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix a typo in logicalrep_write_typ().

commit   : 63909da9783a4736b01911fe3ee829651ff3c7d8    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 12 Jul 2024 10:20:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 12 Jul 2024 10:20:59 +0530    

Click here for diff

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

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

Fix unstable test in 040_pg_createsubscriber.

commit   : 9fd8b331dfe151b7c833e2c8fa17ce753830b891    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 12 Jul 2024 09:29:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 12 Jul 2024 09:29:21 +0530    

Click here for diff

The slot synchronization failed because the local slot's (created during  
slot synchronization) catalog_xmin on standby is ahead of remote slot.  
This happens because the INSERT before slot synchronization results in the  
generation of a new xid that could be replicated to the standby. Now  
before the xmin of the physical slot on the primary catches up via  
hot_standby_feedback, the test has created a logical slot that got some  
prior value of catalog_xmin.  
  
To fix this we could try to ensure that the physical slot's catalog_xmin  
is caught up to latest value before creating a logical slot but we took a  
simpler path to move the INSERT after synchronizing the logical slot.  
  
Reported-by: Alexander Lakhin as per buildfarm  
Diagnosed-by: Amit Kapila, Hou Zhijie, Alexander Lakhin  
Author: Hou Zhijie  
Backpatch-through: 17  
Discussion: https://postgr.es/m/[email protected]  

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

Consider materializing the cheapest inner path in parallel nestloop

commit   : 22d946b0f86f9c13f869bb8b75444a77a20134d8    
  
author   : Richard Guo <[email protected]>    
date     : Fri, 12 Jul 2024 11:16:43 +0900    
  
committer: Richard Guo <[email protected]>    
date     : Fri, 12 Jul 2024 11:16:43 +0900    

Click here for diff

When generating non-parallel nestloop paths for each available outer  
path, we always consider materializing the cheapest inner path if  
feasible.  Similarly, in this patch, we also consider materializing  
the cheapest inner path when building partial nestloop paths.  This  
approach potentially reduces the need to rescan the inner side of a  
partial nestloop path for each outer tuple.  
  
Author: Tender Wang  
Reviewed-by: Richard Guo, Robert Haas, David Rowley, Alena Rybakina  
Reviewed-by: Tomasz Rybak, Paul Jungwirth, Yuki Fujii  
Discussion: https://postgr.es/m/CAHewXNkPmtEXNfVQMou_7NqQmFABca9f4etjBtdbbm0ZKDmWvw@mail.gmail.com  

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

Improve comment of pgstat_read_statsfile()

commit   : 72c0b24b2ddd2d2a2b85d19222845c8c7ae3cbdb    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 12 Jul 2024 09:31:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 12 Jul 2024 09:31:33 +0900    

Click here for diff

The comment at the top of pgstat_read_statsfile() mentioned that the  
stats are read from the on-disk file into the pgstats dshash.  This is  
incorrect for fix-numbered stats as these are loaded directly into  
shared memory.  This commit simplifies the comment to be more general.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/Zo/[email protected]  

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

Improve logical replication connection-failure messages.

commit   : 0d8bd0a72ea284ffb1d1154efbe799241cc5edc6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jul 2024 13:21:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jul 2024 13:21:13 -0400    

Click here for diff

These messages mostly said "could not connect to the publisher: %s"  
which is lacking context.  Add some verbiage to indicate which  
subscription or worker process is failing.  
  
Nisha Moond  
  
Discussion: https://postgr.es/m/CABdArM7q1=zqL++cYd0hVMg3u_tc0S=0Of=Um-KvDhLony0cSg@mail.gmail.com  

M src/backend/commands/subscriptioncmds.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/replication/slotfuncs.c
M src/backend/replication/walreceiver.c
M src/test/regress/expected/subscription.out

Add min and max aggregates for composite types (records).

commit   : a0f1fce80c0373c16b22a1bdc9b0b61958fc9b6a    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 11 Jul 2024 11:50:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 11 Jul 2024 11:50:50 -0400    

Click here for diff

Like min/max for arrays, these are just thin wrappers around  
the existing btree comparison function for records.  
  
Aleksander Alekseev  
  
Discussion: https://postgr.es/m/CAO=iB8L4WYSNxCJ8GURRjQsrXEQ2-zn3FiCsh2LMqvWq2WcONg@mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/utils/adt/rowtypes.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

Fix possibility of logical decoding partial transaction changes.

commit   : bb19b70081e2248f242cd00227abff5b1e105eb6    
  
author   : Masahiko Sawada <[email protected]>    
date     : Thu, 11 Jul 2024 22:48:23 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Thu, 11 Jul 2024 22:48:23 +0900    

Click here for diff

When creating and initializing a logical slot, the restart_lsn is set  
to the latest WAL insertion point (or the latest replay point on  
standbys). Subsequently, WAL records are decoded from that point to  
find the start point for extracting changes in the  
DecodingContextFindStartpoint() function. Since the initial  
restart_lsn could be in the middle of a transaction, the start point  
must be a consistent point where we won't see the data for partial  
transactions.  
  
Previously, when not building a full snapshot, serialized snapshots  
were restored, and the SnapBuild jumps to the consistent state even  
while finding the start point. Consequently, the slot's restart_lsn  
and confirmed_flush could be set to the middle of a transaction. This  
could lead to various unexpected consequences. Specifically, there  
were reports of logical decoding decoding partial transactions, and  
assertion failures occurred because only subtransactions were decoded  
without decoding their top-level transaction until decoding the commit  
record.  
  
To resolve this issue, the changes prevent restoring the serialized  
snapshot and jumping to the consistent state while finding the start  
point.  
  
On v17 and HEAD, a flag indicating whether snapshot restores should be  
skipped has been added to the SnapBuild struct, and SNAPBUILD_VERSION  
has been bumpded.  
  
On backbranches, the flag is stored in the LogicalDecodingContext  
instead, preserving on-disk compatibility.  
  
Backpatch to all supported versions.  
  
Reported-by: Drew Callahan  
Reviewed-by: Amit Kapila, Hayato Kuroda  
Discussion: https://postgr.es/m/2444AA15-D21B-4CCE-8052-52C7C2DAFE5C%40amazon.com  
Backpatch-through: 12  

M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/skip_snapshot_restore.out
M contrib/test_decoding/meson.build
A contrib/test_decoding/specs/skip_snapshot_restore.spec
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Change pg_regress.c back to using diff -w on Windows

commit   : c194de0713ebe71aaeeb5ebed4af2390cc1b521c    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 11 Jul 2024 09:34:27 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 11 Jul 2024 09:34:27 -0400    

Click here for diff

This partially reverts commit 628c1d1f2c.  
  
It appears that there are non line-end differences in some regression  
tests on Windows. To keep the buildfarm and CI clients happy, change  
this back for now, pending further investigation.  
  
Per reports from Tatsuo Ishii and Nazir Bilal Yavuz.  

M src/test/regress/pg_regress.c

Add a new 'F' entry type for fixed-numbered stats in pgstats file

commit   : 9e4664d950c125a1ff7bb29cd1593ca37f8b0c01    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Jul 2024 16:12:04 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Jul 2024 16:12:04 +0900    

Click here for diff

This new entry type is used for all the fixed-numbered statistics,  
making possible support for custom pluggable stats.  In short, we need  
to be able to detect more easily if a stats kind exists or not when  
reading back its data from the pgstats file without a dependency on the  
order of the entries read.  The kind ID of the stats is added to the  
data written.  
  
The data is written in the same fashion as previously, with the  
fixed-numbered stats first and the dshash entries next.  The read part  
becomes more flexible, loading fixed-numbered stats into shared memory  
based on the new entry type found.  
  
Bump PGSTAT_FILE_FORMAT_ID.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Add PgStat_KindInfo.init_shmem_cb

commit   : 21471f18e9d9aa3383314ed8bc9163bc369109ae    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 11 Jul 2024 09:21:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 11 Jul 2024 09:21:40 +0900    

Click here for diff

This new callback gives fixed-numbered stats the possibility to take  
actions based on the area of shared memory allocated for them.  
  
This removes from pgstat_shmem.c any knowledge specific to the types  
of fixed-numbered stats, and the initializations happen in their own  
files.  Like b68b29bc8fec, this change is useful to make this area of  
the code more pluggable, so as custom fixed-numbered stats can take  
actions after their shared memory area is initialized.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/utils/pgstat_internal.h

Revamp documentation for predefined roles.

commit   : cc2236854e2bb4f2120927c390c63cc2aad77762    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 10 Jul 2024 16:35:25 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 10 Jul 2024 16:35:25 -0500    

Click here for diff

Presently, the page for predefined roles contains a table with  
brief descriptions of what each role allows.  Below the table,  
there is a separate section with more detailed information about  
some of the roles.  As the set of predefined roles has grown over  
the years, this page has (IMHO) become less readable.  
  
This commit attempts to improve the predefined roles documentation  
by abandoning the table in favor of listing each role with its own  
complete description, similar to how we document GUCs.  Besides  
merging the information that was split between the table and the  
section below it, this commit also alphabetizes the roles.  The  
alphabetization is imperfect because some of the roles are grouped  
(e.g., pg_read_all_data and pg_write_all_data), and we order such  
groups by the first role mentioned, but that seemed like a better  
choice than breaking the groups apart.  Finally, this commit makes  
some stylistic adjustments to the text.  
  
Reviewed-by: David G. Johnston, Robert Haas  
Discussion: https://postgr.es/m/ZmtM-4-eRtq8DRf6%40nathan  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/user-manag.sgml

Improve the numeric width_bucket() computation.

commit   : 0dcf753bd82a786922f4149248117b113353e257    
  
author   : Dean Rasheed <[email protected]>    
date     : Wed, 10 Jul 2024 20:07:20 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Wed, 10 Jul 2024 20:07:20 +0100    

Click here for diff

Formerly, the computation of the bucket index involved calling  
div_var() with a scale determined by select_div_scale(), and then  
taking the floor of the result. That involved computing anything from  
16 to 1000 digits after the decimal point, only for floor_var() to  
throw them away. In addition, the quotient was computed with rounding  
in the final digit, which meant that in rare cases the whole result  
could round up to the wrong bucket, and could exceed count. Thus it  
was also necessary to clamp the result to the range [1, count], though  
that didn't prevent the result being in the wrong internal bucket.  
  
Instead, compute the quotient using floor division, which guarantees  
the correct result, as specified by the SQL spec, and doesn't need to  
be clamped. This is both much simpler and more efficient, since it no  
longer computes any quotient digits after the decimal point.  
  
In addition, it is not necessary to have separate code to handle  
reversed bounds, since the signs cancel out when dividing.  
  
As with b0e9e4d76c and a2a0c7c29e, no back-patch.  
  
Dean Rasheed, reviewed by Joel Jacobson.  
  
Discussion: https://postgr.es/m/CAEZATCVbJH%2BLE9EXW8Rk3AxLe%3DjbOk2yrT_AUJGGh5Rah6zoeg%40mail.gmail.com  

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

Use diff's --strip-trailing-cr flag where appropriate on Windows

commit   : 628c1d1f2c82f1983e5248b5dfe53170dc23d90a    
  
author   : Andrew Dunstan <[email protected]>    
date     : Wed, 10 Jul 2024 09:53:47 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Wed, 10 Jul 2024 09:53:47 -0400    

Click here for diff

Test result files might be checked out using Unix or Windows style line  
endings, depening on git flags, so on Windows we use the  
--strip-trailing-cr flag to tell diff to ignore line endings  
differences.  
  
The flag is added to the diff invocation for the test_json_parser module  
tests and the pg_bsd_indent tests. in pg_regress.c we replace the  
current use of the "-w" flag, which ignore all white space differences,  
with this one which only ignores line end differences.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_json_parser/t/003_test_semantic.pl
M src/test/regress/pg_regress.c
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl

doc: Update track_io_timing documentation to mention pg_stat_io.

commit   : 05506510de6ae24ba6de00cef2f458920c8a72ea    
  
author   : Fujii Masao <[email protected]>    
date     : Wed, 10 Jul 2024 15:56:07 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Wed, 10 Jul 2024 15:56:07 +0900    

Click here for diff

The I/O timing information collected when track_io_timing is  
enabled is now documented to appear in the pg_stat_io view,  
which was previously not mentioned.  
  
This commit also enhances the description of track_io_timing  
to clarify that it monitors not only block read and write  
but also block extend and fsync operations. Additionally,  
the description of track_wal_io_timing has been improved  
to mention both WAL write and WAL fsync monitoring.  
  
Backpatch to v16 where pg_stat_io was added.  
  
Author: Hajime Matsunaga  
Reviewed-by: Melanie Plageman, Nazir Bilal Yavuz, Fujii Masao  
Discussion: https://postgr.es/m/TYWPR01MB10742EE4A6F34C33061429D38A4D52@TYWPR01MB10742.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml

Extend pg_get_acl() to handle sub-object IDs

commit   : d898665bf7591514158954038ac43cea3240beaa    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2024 10:14:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 10 Jul 2024 10:14:37 +0900    

Click here for diff

This patch modifies the pg_get_acl() function to accept a third argument  
called "objsubid", bringing it on par with similar functions in this  
area like pg_describe_object().  This enables the retrieval of ACLs for  
relation attributes when scanning dependencies.  
  
Bump catalog version.  
  
Author: Joel Jacobson  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/objectaddress.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Prevent CRLF conversion of inputs in json_parser test module

commit   : f7bd0a381de12a5c309f3c19d8c966b77e87cff3    
  
author   : Andrew Dunstan <[email protected]>    
date     : Tue, 9 Jul 2024 17:29:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Tue, 9 Jul 2024 17:29:48 -0400    

Click here for diff

Do this by opening the file in PG_BINARY_R mode. This prevents us from  
getting wrong byte count from stat().  
  
Per complaint from Andres Freund  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to rlease 17 where this code was introduced  

M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_json_parser/test_json_parser_perf.c

Remove new XML test cases added by e7192486d.

commit   : 896cd266fd34c2dfbf06297b9f2ea89ae8e5a0b1    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jul 2024 16:31:15 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jul 2024 16:31:15 -0400    

Click here for diff

These turn out to produce libxml2-version-dependent error reports.  
They aren't adding value that would justify dealing with that,  
so just remove them again.  (I had in fact guessed wrong about  
what versions matching xml_2.out would produce, but it doesn't  
matter because there are other discrepancies.)  
  
Per buildfarm.  
  
Discussion: https://postgr.es/m/trinity-b0161630-d230-4598-9ebc-7a23acdb37cb-1720186432160@3c-app-gmx-bap25  
Discussion: https://postgr.es/m/trinity-361ba18b-541a-4fe7-bc63-655ae3a7d599-1720259822452@3c-app-gmx-bs01  

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

Fix missing invalidations for search_path cache.

commit   : b3bd18294ee471c5a6f1db69be57f08c1e00f1a6    
  
author   : Jeff Davis <[email protected]>    
date     : Tue, 9 Jul 2024 11:27:17 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Tue, 9 Jul 2024 11:27:17 -0700    

Click here for diff

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

M src/backend/catalog/namespace.c

Suppress "chunk is not well balanced" errors from libxml2.

commit   : e7192486dded0ca82824fef95eb88b4231bdd4d2    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 9 Jul 2024 15:01:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 9 Jul 2024 15:01:05 -0400    

Click here for diff

libxml2 2.13 has an entirely different rule than earlier versions  
about when to emit "chunk is not well balanced" errors.  This  
causes regression test output discrepancies for three test cases  
that formerly provoked that error (along with others) and now don't.  
  
Closer inspection shows that at least in 2.13, this error is pretty  
useless because it can only be emitted after some other more-relevant  
error.  So let's get rid of the cross-version discrepancy by just  
suppressing it.  In case some older libxml2 version is capable of  
emitting this error by itself, suppress only when some other error  
has already been captured.  
  
Like 066e8ac6e and 6082b3d5d, this will need to be back-patched,  
but let's check the results in HEAD first.  (The patch for xml_2.out,  
in particular, is blind since I can't test it here.)  
  
Erik Wienhold and Tom Lane, per report from Frank Streitzig.  
  
Discussion: https://postgr.es/m/trinity-b0161630-d230-4598-9ebc-7a23acdb37cb-1720186432160@3c-app-gmx-bap25  
Discussion: https://postgr.es/m/trinity-361ba18b-541a-4fe7-bc63-655ae3a7d599-1720259822452@3c-app-gmx-bs01  

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/expected/xml_2.out
M src/test/regress/sql/xml.sql

Introduce pg_signal_autovacuum_worker.

commit   : ccd38024bc3c61e62af2097d408a670661713e68    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 9 Jul 2024 13:03:40 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 9 Jul 2024 13:03:40 -0500    

Click here for diff

Since commit 3a9b18b309, roles with privileges of pg_signal_backend  
cannot signal autovacuum workers.  Many users treated the ability  
to signal autovacuum workers as a feature instead of a bug, so we  
are reintroducing it via a new predefined role.  Having privileges  
of this new role, named pg_signal_autovacuum_worker, only permits  
signaling autovacuum workers.  It does not permit signaling other  
types of superuser backends.  
  
Bumps catversion.  
  
Author: Kirill Reshke  
Reviewed-by: Anthony Leung, Michael Paquier, Andrey Borodin  
Discussion: https://postgr.es/m/CALdSSPhC4GGmbnugHfB9G0%3DfAxjCSug_-rmL9oUh0LTxsyBfsg%40mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/storage/ipc/signalfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat

Fix comment in libpqrcv_check_conninfo().

commit   : 629520be5f9da9d0192c7f6c8796bfddb4746760    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 9 Jul 2024 21:03:56 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 9 Jul 2024 21:03:56 +0900    

Click here for diff

Previously, the comment incorrectly stated that libpqrcv_check_conninfo()  
returns true or false based on the connection string check.  
However, this function actually has a void return type and  
raises an error if the check fails.  
  
Author: Rintaro Ikeda  
Reviewed-by: Jelte Fennema-Nio, Fujii Masao  
Discussion: https://postgr.es/m/[email protected]  

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

Optimise numeric multiplication for short inputs.

commit   : ca481d3c9ab7bf69ff0c8d71ad3951d407f6a33c    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 9 Jul 2024 10:00:42 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 9 Jul 2024 10:00:42 +0100    

Click here for diff

When either input has a small number of digits, and the exact product  
is requested, the speed of numeric multiplication can be increased  
significantly by using a faster direct multiplication algorithm. This  
works by fully computing each result digit in turn, starting with the  
least significant, and propagating the carry up. This save cycles by  
not requiring a temporary buffer to store digit products, not making  
multiple passes over the digits of the longer input, and not requiring  
separate carry-propagation passes.  
  
For now, this is used when the shorter input has 1-4 NBASE digits (up  
to 13-16 decimal digits), and the longer input is of any size, which  
covers a lot of common real-world cases. Also, the relative benefit  
increases as the size of the longer input increases.  
  
Possible future work would be to try extending the technique to larger  
numbers of digits in the shorter input.  
  
Joel Jacobson and Dean Rasheed.  
  
Discussion: https://postgr.es/m/[email protected]  

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

SQL/JSON: Various improvements to SQL/JSON query function docs

commit   : 42de72fa7b80645347cd7ef3fbb6b0b58d0870f2    
  
author   : Amit Langote <[email protected]>    
date     : Tue, 9 Jul 2024 16:12:22 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Tue, 9 Jul 2024 16:12:22 +0900    

Click here for diff

1. Remove the keyword SELECT from the examples to be consistent  
with the examples of other JSON-related functions listed on the  
same page.  
  
2. Add <synopsis> tags around the functions' syntax definition  
  
3. Capitalize function names in the syntax synopsis and the examples  
  
4. Use <itemizedlist> lists for dividing the descriptions of  
   individual functions into bullet points  
  
5. Significantly rewrite the description of wrapper clauses of  
   JSON_QUERY  
  
6. Significantly rewrite the descriptions of ON ERROR / EMPTY  
   clauses of JSON_QUERY() and JSON_VALUE() functions  
  
7. Add a note about how JSON_VALUE() and JSON_QUERY() differ when  
   returning a JSON null result  
  
8. Move the description of the PASSING clause from the descriptions  
   of individual functions into the top paragraph  
  
And other miscellaneous text improvements, typo fixes.  
  
Suggested-by: Thom Brown <[email protected]>  
Suggested-by: David G. Johnston <[email protected]>  
Reviewed-by: Jian He <[email protected]>  
Reviewed-by: Erik Rijkers <[email protected]>  
Discussion: https://postgr.es/m/CAA-aLv7Dfy9BMrhUZ1skcg=OdqysWKzObS7XiDXdotJNF0E44Q@mail.gmail.com  
Discussion: https://postgr.es/m/CAKFQuwZNxNHuPk44zDF7z8qZec1Aof10aA9tWvBU5CMhEKEd8A@mail.gmail.com  

M doc/src/sgml/func.sgml

To improve the code, move the error check in logical_read_xlog_page().

commit   : 571f7f70865cdaf1a49e7934208ad139575e3f03    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 9 Jul 2024 09:00:45 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 9 Jul 2024 09:00:45 +0530    

Click here for diff

Commit 0fdab27ad6 changed the code to wait for WAL to be available before  
determining the timeline but forgot to move the failure check.  
  
This change is to make the related code easier to understand and enhance  
otherwise there is no bug in the current code.  
  
In the passing, improve the nearby comments to explain why we determine  
am_cascading_walsender after waiting for the required WAL.  
  
Author: Peter Smith  
Reviewed-by: Bertrand Drouvot, Amit Kapila  
Discussion: https://postgr.es/m/CAHut+PvqX49fusLyXspV1Mmd_EekPtXG0oT146vZjcb9XDvNgw@mail.gmail.com  

M src/backend/replication/walsender.c

Use pgstat_kind_infos to write fixed shared statistics

commit   : b68b29bc8feca0eb340cb857ff1d28d4099c7878    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 9 Jul 2024 10:27:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 9 Jul 2024 10:27:12 +0900    

Click here for diff

This is similar to 9004abf6206e, but this time for the write part of the  
stats file.  The code is changed so as, rather than referring to  
individual members of PgStat_Snapshot in an order based on their  
PgStat_Kind value, a loop based on pgstat_kind_infos is used to retrieve  
the contents to write from the snapshot structure, for a size of  
PgStat_KindInfo's shared_data_len.  
  
This requires the addition to PgStat_KindInfo of an offset to track the  
location of each fixed-numbered stats in PgStat_Snapshot.  This change  
is useful to make this area of the code more easily pluggable, and  
reduces the knowledge of specific fixed-numbered kinds in pgstat.c.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

commit   : c048cd992c69ed20acbd9059763735e51781e95a    
  
author   : David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 12:46:48 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 12:46:48 +1200    

Click here for diff

036bdcec9 added some code to perform some verification on portions of  
the planner costs in EXPLAIN ANALYZE but failed to consider that some  
buildfarm animals such as bushmaster and taipan are running very low jit  
thresholds.  This caused these animals to fail as they were outputting  
JIT-related details in EXPLAIN ANALYZE for the newly added tests.  
  
Here we avoid that by disabling JIT for the plans in question.  
  
Discussion: https://postgr.es/m/CAApHDvpxV4rrO3XUCgGS5N9Wg6f2r0ojJPD2tX2FRV-o9sRTJA@mail.gmail.com  

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

Fix limit block handling in pg_wal_summary_contents().

commit   : c8d5d6c78af4a55c5c36e2fa8e73d1f2b2e9d777    
  
author   : Fujii Masao <[email protected]>    
date     : Tue, 9 Jul 2024 09:26:54 +0900    
  
committer: Fujii Masao <[email protected]>    
date     : Tue, 9 Jul 2024 09:26:54 +0900    

Click here for diff

Previously, pg_wal_summary_contents() had two issues,  
causing discrepancies between pg_wal_summary_contents()  
and the pg_walsummary command on the same WAL summary file:  
  
(1) It did not emit the limit block when that's the only data for  
     a particular relation fork.  
(2) It emitted the same limit block multiple times if the list of  
     block numbers was long enough.  
  
This commit fixes these issues.  
  
Backpatch to v17 where pg_wal_summary_contents() was added.  
  
Author: Fujii Masao  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/backup/walsummaryfuncs.c

Show Parallel Bitmap Heap Scan worker stats in EXPLAIN ANALYZE

commit   : 5a1e6df3b84c91957f80b19edb497a5eec83c403    
  
author   : David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 12:15:47 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 12:15:47 +1200    

Click here for diff

Nodes like Memoize report the cache stats for each parallel worker, so it  
makes sense to show the exact and lossy pages in Parallel Bitmap Heap Scan  
in a similar way.  Likewise, Sort shows the method and memory used for  
each worker.  
  
There was some discussion on whether the leader stats should include the  
totals for each parallel worker or not.  I did some analysis on this to  
see what other parallel node types do and it seems only Parallel Hash does  
anything like this.  All the rest, per what's supported by  
ExecParallelRetrieveInstrumentation() are consistent with each other.  
  
Author: David Geier <[email protected]>  
Author: Heikki Linnakangas <[email protected]>  
Author: Donghang Lin <[email protected]>  
Author: Alena Rybakina <[email protected]>  
Author: David Rowley <[email protected]>  
Reviewed-by: Dmitry Dolgov <[email protected]>  
Reviewed-by: Michael Christofides <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Dilip Kumar <[email protected]>  
Reviewed-by: Tomas Vondra <[email protected]>  
Reviewed-by: Melanie Plageman <[email protected]>  
Reviewed-by: Donghang Lin <[email protected]>  
Reviewed-by: Masahiro Ikeda <[email protected]>  
Discussion: https://postgr.es/m/b3d80961-c2e5-38cc-6a32-61886cdf766d%40gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/include/executor/nodeBitmapHeapscan.h
M src/include/nodes/execnodes.h
M src/tools/pgindent/typedefs.list

Perform forgotten cat version bump

commit   : e41f7130979442362d9053d1ae24b2f87980e842    
  
author   : David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 09:56:46 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 09:56:46 +1200    

Click here for diff

I missed this in 036bdcec9  

M src/include/catalog/catversion.h

Teach planner how to estimate rows for timestamp generate_series

commit   : 036bdcec9f9998a6e50711fadce69e482ff18f55    
  
author   : David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 09:54:59 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 9 Jul 2024 09:54:59 +1200    

Click here for diff

This provides the planner with row estimates for  
generate_series(TIMESTAMP, TIMESTAMP, INTERVAL),  
generate_series(TIMESTAMPTZ, TIMESTAMPTZ, INTERVAL) and  
generate_series(TIMESTAMPTZ, TIMESTAMPTZ, INTERVAL, TEXT) when the input  
parameter values can be estimated during planning.  
  
Author: David Rowley  
Reviewed-by: jian he <[email protected]>  
Discussion: https://postgr.es/m/CAApHDvrBE%3D%2BASo_sGYmQJ3GvO8GPvX5yxXhRS%3Dt_ybd4odFkhQ%40mail.gmail.com  

M src/backend/utils/adt/timestamp.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql

commit   : 5193ca8e155ac0140d20361bdafa27744c016252    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 13:46:21 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 13:46:21 -0400    

Click here for diff

This reverts commit e9f15bc9. Instead of a hacky solution that didn't  
work on Windows, we avoid trying to move the directory possibly across  
drives, and instead remove it and recreate it in the new location.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to release 14 like the previous patch.  

M src/bin/pg_basebackup/t/010_pg_basebackup.pl

Use CREATE DATABASE ... STRATEGY = FILE_COPY in pg_upgrade.

commit   : 64f34eb2e2ce4bca7351d8c88a6999aeed000c4a    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 8 Jul 2024 16:18:00 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 8 Jul 2024 16:18:00 -0500    

Click here for diff

While this strategy is ordinarily quite costly because it requires  
performing two checkpoints, testing shows that it tends to be a  
faster choice than WAL_LOG during pg_upgrade, presumably because  
fsync is turned off.  Furthermore, we can skip the checkpoints  
altogether because the problems they are intended to prevent don't  
apply to pg_upgrade.  Instead, we just need to CHECKPOINT once in  
the new cluster after making any changes to template0 and before  
restoring the rest of the databases.  This ensures that said  
template0 changes are written out to disk prior to creating the  
databases via FILE_COPY.  
  
Co-authored-by: Matthias van de Meent  
Reviewed-by: Ranier Vilela, Dilip Kumar, Robert Haas, Michael Paquier  
Discussion: https://postgr.es/m/Zl9ta3FtgdjizkJ5%40nathan  

M src/backend/commands/dbcommands.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/pg_upgrade.c

Choose ports for test servers less likely to result in conflicts

commit   : 4b4b931bcdf23f5facd49809278a3048c4fdba1f    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 11:18:06 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 11:18:06 -0400    

Click here for diff

If we choose ports in the range typically used for ephemeral ports there  
is a danger of encountering a port conflict due to a race condition  
between the time we choose the port in a range below that typically used  
to allocate ephemeral ports, but higher than the range typically used by  
well known services.  
  
Author: Jelte Fenema-Nio, with some editing by me.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches (12 and up)  

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

Force nodes for SSL tests to start in TCP mode

commit   : e4f4c5424cf9564b934ac6f632c6c90a2edddb77    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 05:51:26 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 8 Jul 2024 05:51:26 -0400    

Click here for diff

Currently they are started in unix socket mode in ost cases, and then  
converted to run in TCP mode. This can result in port collisions, and  
there is no virtue in startng in unix socket mode, so start as we will  
be going on.  
  
Discussion: https://postgr.es/m/[email protected]  
  
Backpatch to all live branches (12 and up).  

M src/test/ssl/t/SSL/Server.pm

Use xmlParseInNodeContext not xmlParseBalancedChunkMemory.

commit   : 6082b3d5d3d141aa1ec67ff98955a0d8e12d0e1a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 8 Jul 2024 14:04:00 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 8 Jul 2024 14:04:00 -0400    

Click here for diff

xmlParseInNodeContext has basically the same functionality with  
a different API: we have to supply an xmlNode that's attached to a  
document rather than just the document.  That's not hard though.  
The benefits are two:  
  
* Early 2.13.x releases of libxml2 contain a bug that causes  
xmlParseBalancedChunkMemory to return the wrong status value in some  
cases.  This breaks our regression tests.  While that bug is now fixed  
upstream and will probably never be seen in any production-oriented  
distro, it is currently a problem on some more-bleeding-edge-friendly  
platforms.  
  
* xmlParseBalancedChunkMemory is considered to depend on libxml2's  
semi-deprecated SAX1 APIs, and will go away when and if they do.  
There may already be libxml2 builds out there that lack this function.  
  
So there are both short- and long-term reasons to make this change.  
  
While here, avoid allocating an xmlParserCtxt in DOCUMENT parse mode,  
since that code path is not going to use it.  
  
Like 066e8ac6e, this will need to be back-patched.  This is just a  
trial commit to see if the buildfarm agrees that we can use  
xmlParseInNodeContext unconditionally.  
  
Erik Wienhold and Tom Lane, per report from Frank Streitzig.  
  
Discussion: https://postgr.es/m/trinity-b0161630-d230-4598-9ebc-7a23acdb37cb-1720186432160@3c-app-gmx-bap25  
Discussion: https://postgr.es/m/trinity-361ba18b-541a-4fe7-bc63-655ae3a7d599-1720259822452@3c-app-gmx-bs01  

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

Fix scale clamping in numeric round() and trunc().

commit   : 1ff39f4ff2b68625cdc37076e5c8281a4eab7f4f    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 8 Jul 2024 17:48:45 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 8 Jul 2024 17:48:45 +0100    

Click here for diff

The numeric round() and trunc() functions clamp the scale argument to  
the range between +/- NUMERIC_MAX_RESULT_SCALE (2000), which is much  
smaller than the actual allowed range of type numeric. As a result,  
they return incorrect results when asked to round/truncate more than  
2000 digits before or after the decimal point.  
  
Fix by using the correct upper and lower scale limits based on the  
actual allowed (and documented) range of type numeric.  
  
While at it, use the new NUMERIC_WEIGHT_MAX constant instead of  
SHRT_MAX in all other overflow checks, and fix a comment thinko in  
power_var() introduced by e54a758d24 -- the minimum value of  
ln_dweight is -NUMERIC_DSCALE_MAX (-16383), not -SHRT_MAX, though this  
doesn't affect the point being made in the comment, that the resulting  
local_rscale value may exceed NUMERIC_MAX_DISPLAY_SCALE (1000).  
  
Back-patch to all supported branches.  
  
Dean Rasheed, reviewed by Joel Jacobson.  
  
Discussion: https://postgr.es/m/CAEZATCXB%2BrDTuMjhK5ZxcouufigSc-X4tGJCBTMpZ3n%3DxxQuhg%40mail.gmail.com  

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

Typo fix

commit   : 519d710720159046c90c08095e70fdb486d38053    
  
author   : Amit Langote <[email protected]>    
date     : Mon, 8 Jul 2024 22:12:55 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Mon, 8 Jul 2024 22:12:55 +0900    

Click here for diff

Reported-by: Junwang Zhao <[email protected]>  
Discussion: https://postgr.es/m/CAEG8a3KPi=LayiTwJ11ikF7bcqnZUrcj8NgX0V8nO1mQKZ9GfQ@mail.gmail.com  
Backpatch-through: 17  

M src/common/jsonapi.c

Fix outdated comment after removal of direct SSL fallback

commit   : cc68ca6d420e750fd90e76bafb64dd19e51823ac    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Jul 2024 12:44:45 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Mon, 8 Jul 2024 12:44:45 +0300    

Click here for diff

The option to fall back from direct SSL to negotiated SSL or a  
plaintext connection was removed in commit fb5718f35f.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Renumber pg_get_acl() in pg_proc.dat

commit   : e311c6e53955e4529a47a36a4f26b0c3f7a29513    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2024 15:34:33 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2024 15:34:33 +0900    

Click here for diff

a6417078c414 has introduced as project policy that new features  
committed during the development cycle should use new OIDs in the  
[8000,9999] range.  
  
4564f1cebd43 did not respect that rule, so let's renumber pg_get_acl()  
to use an OID in the correct range.  
  
Bump catalog version.  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

Widen lossy and exact page counters for Bitmap Heap Scan

commit   : 7340d9362a792d3cb5f38a512d8cecacc7aceb59    
  
author   : David Rowley <[email protected]>    
date     : Mon, 8 Jul 2024 14:43:09 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 8 Jul 2024 14:43:09 +1200    

Click here for diff

Both of these counters were using the "long" data type.  On MSVC that's  
a 32-bit type.  On modern hardware, I was able to demonstrate that we can  
wrap those counters with a query that only takes 15 minutes to run.  
  
This issue may manifest itself either by not showing the values of the  
counters because they've wrapped and are less than zero, resulting in  
them being filtered by the > 0 checks in show_tidbitmap_info(), or bogus  
numbers being displayed which are modulus 2^32 of the actual number.  
  
Widen these counters to uint64.  
  
Discussion: https://postgr.es/m/CAApHDvpS_97TU+jWPc=T83WPp7vJa1dTw3mojEtAVEZOWh9bjQ@mail.gmail.com  

M src/backend/commands/explain.c
M src/include/nodes/execnodes.h

Remove an extra period in code comment

commit   : d7db04dfdae361479e77054670ee9d806c6a6420    
  
author   : Richard Guo <[email protected]>    
date     : Mon, 8 Jul 2024 11:17:22 +0900    
  
committer: Richard Guo <[email protected]>    
date     : Mon, 8 Jul 2024 11:17:22 +0900    

Click here for diff

Author: Junwang Zhao  
Discussion: https://postgr.es/m/CAEG8a3L9GgfKc+XT+NMHPY7atAOVYqjUqKEFQKhcPHFYRW=PuQ@mail.gmail.com  

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

Fix right-anti-joins when the inner relation is proven unique

commit   : 0ffc0acaf3bf301ba8fd43dc0e004b8b7c9ecd3a    
  
author   : Richard Guo <[email protected]>    
date     : Mon, 8 Jul 2024 10:11:46 +0900    
  
committer: Richard Guo <[email protected]>    
date     : Mon, 8 Jul 2024 10:11:46 +0900    

Click here for diff

For an inner_unique join, we always assume that the executor will stop  
scanning for matches after the first match.  Therefore, for a mergejoin  
that is inner_unique and whose mergeclauses are sufficient to identify a  
match, we set the skip_mark_restore flag to true, indicating that the  
executor need not do mark/restore calls.  However, merge-right-anti-join  
did not get this memo and continues scanning the inner side for matches  
after the first match.  If there are duplicates in the outer scan, we  
may incorrectly skip matching some inner tuples, which can lead to wrong  
results.  
  
Here we fix this issue by ensuring that merge-right-anti-join also  
advances to next outer tuple after the first match in inner_unique  
cases.  This also saves cycles by avoiding unnecessary scanning of inner  
tuples after the first match.  
  
Although hash-right-anti-join does not suffer from this wrong results  
issue, we apply the same change to it as well, to help save cycles for  
the same reason.  
  
Per bug #18522 from Antti Lampinen, and bug #18526 from Feliphe Pozzer.  
Back-patch to v16 where right-anti-join was introduced.  
  
Author: Richard Guo  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMergejoin.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Re-enable autoruns for cmd.exe on Windows

commit   : 74b8e6a698025fbea5a5e22ea09d07d97188c1d6    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2024 09:43:59 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 8 Jul 2024 09:43:59 +0900    

Click here for diff

This acts as a revert of b83747a8a65b and 9886744a361b.  As pointed out  
by Noah, HEAD and REL_17_STABLE are in a weird state where the code  
paths adding /D would limit the spawn of child processes, but we still  
have code paths where the spawn of more than one child process(es) would  
be possible.  
  
Let's remove these /D switches for now, to bring back the code into a  
state consistent with how autorun is configured on a Windows host.  
  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 17  

M src/bin/pg_ctl/pg_ctl.c
M src/test/regress/pg_regress.c

Use xmlAddChildList not xmlAddChild in XMLSERIALIZE.

commit   : 066e8ac6ea8bc2af79dc86273a09ba7c1a39f7fd    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2024 15:16:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 6 Jul 2024 15:16:13 -0400    

Click here for diff

It looks like we should have been doing this all along,  
but we got away with the wrong coding until libxml2 2.13.0  
tightened up xmlAddChild's behavior.  
  
There is more stuff to be fixed to be compatible with 2.13.0,  
and it will all need to be back-patched.  This is just a  
trial commit to see if the buildfarm agrees that we can use  
xmlAddChildList unconditionally.  
  
Erik Wienhold, per report from Frank Streitzig.  
  
Discussion: https://postgr.es/m/trinity-b0161630-d230-4598-9ebc-7a23acdb37cb-1720186432160@3c-app-gmx-bap25  
Discussion: https://postgr.es/m/trinity-361ba18b-541a-4fe7-bc63-655ae3a7d599-1720259822452@3c-app-gmx-bs01  

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

Adjust tuplestore.c not to allocate BufFiles in generation context

commit   : 04bcf9e19a4261fe9c7df37c777592c2e10c32a7    
  
author   : David Rowley <[email protected]>    
date     : Sat, 6 Jul 2024 17:40:05 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 6 Jul 2024 17:40:05 +1200    

Click here for diff

590b045c3 made it so tuplestore.c would store tuples inside a  
generation.c memory context.  After fixing a bug report in 97651b013, it  
seems that it's probably best not to allocate BufFile related  
allocations in that context.  Let's keep it just for tuple data.  
  
This adjusts the code to switch to the Tuplestorestate.context's parent,  
which is the MemoryContext that tuplestore_begin_common() was called in.  
It does not seem worth adding a new field in Tuplestorestate to store  
this when we can access it by looking at the Tuplestorestate's  
context's parent.  
  
Discussion: https://postgr.es/m/CAApHDvqFt_CdJtSr+E9YLZb7jZAyRCy3hjQ+ktM+dcOFVq-xkg@mail.gmail.com  

M src/backend/utils/sort/tuplestore.c

Fix incorrect sentinel byte logic in GenerationRealloc()

commit   : 97651b0139cfa511eaf063b60c900c2ba81b8ba2    
  
author   : David Rowley <[email protected]>    
date     : Sat, 6 Jul 2024 13:59:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Sat, 6 Jul 2024 13:59:34 +1200    

Click here for diff

This only affects MEMORY_CONTEXT_CHECKING builds.  
  
This fixes an off-by-one issue in GenerationRealloc() where the  
fast-path code which tries to reuse the existing allocation if the  
existing chunk is >= the new requested size.  The code there thought it  
was always ok to use the existing chunk, but when oldsize == size there  
isn't enough space to store the sentinel byte.  If both sizes matched  
exactly set_sentinel() would overwrite the first byte beyond the chunk  
and then subsequent GenerationRealloc() calls could then fail the  
Assert(chunk->requested_size < oldsize) check which is trying to ensure  
the chunk is large enough to store the sentinel.  
  
The same issue does not exist in aset.c as the sentinel checking code  
only adds a sentinel byte if there's enough space in the chunk.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16, where the problem was introduced by 0e480385e  

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

Cope with <regex.h> name clashes.

commit   : 2a5ef09830401071be64d4eff3f6db421263a880    
  
author   : Thomas Munro <[email protected]>    
date     : Sat, 6 Jul 2024 10:24:49 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Sat, 6 Jul 2024 10:24:49 +1200    

Click here for diff

macOS 15's SDK pulls in headers related to <regex.h> when we include  
<xlocale.h>.  This causes our own regex_t implementation to clash with  
the OS's regex_t implementation.  Luckily our function names already had  
pg_ prefixes, but the macros and typenames did not.  
  
Include <regex.h> explicitly on all POSIX systems, and fix everything  
that breaks.  Then we can prove that we are capable of fully hiding and  
replacing the system regex API with our own.  
  
1.  Deal with standard-clobbering macros by undefining them all first.  
POSIX says they are "symbolic constants".  If they are macros, this  
allows us to redefine them.  If they are enums or variables, our macros  
will hide them.  
  
2.  Deal with standard-clobbering types by giving our types pg_  
prefixes, and then using macros to redirect xxx_t -> pg_xxx_t.  
  
After including our "regex/regex.h", the system <regex.h> is hidden,  
because we've replaced all the standard names.  The PostgreSQL source  
tree and extensions can continue to use standard prefix-less type and  
macro names, but reach our implementation, if they included our  
"regex/regex.h" header.  
  
Back-patch to all supported branches, so that macOS 15's tool chain can  
build them.  
  
Reported-by: Stan Hu <[email protected]>  
Suggested-by: Tom Lane <[email protected]>  
Tested-by: Aleksander Alekseev <[email protected]>  
Discussion: https://postgr.es/m/CAMBWrQnEwEJtgOv7EUNsXmFw2Ub4p5P%2B5QTBEgYwiyjy7rAsEQ%40mail.gmail.com  

M src/include/regex/regex.h
M src/tools/pgindent/typedefs.list

Fix placement of "static".

commit   : 8212625e53f28ce2fb9f779f9fa5c003dba904d4    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 17:32:55 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 17:32:55 -0400    

Click here for diff

Various buildfarm critters were complaining about  
  
pgbench.c:304:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]  
  
Evidently a thinko in 720b0eaae.  

M src/bin/pgbench/pgbench.c

Remove check hooks for GUCs that contribute to MaxBackends.

commit   : 0b1fe1413ea84a381489ed1d1f718cb710229ab3    
  
author   : Nathan Bossart <[email protected]>    
date     : Fri, 5 Jul 2024 14:42:55 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Fri, 5 Jul 2024 14:42:55 -0500    

Click here for diff

Each of max_connections, max_worker_processes,  
autovacuum_max_workers, and max_wal_senders has a GUC check hook  
that verifies the sum of those GUCs does not exceed a hard-coded  
limit (see the comment for MAX_BACKENDS in postmaster.h).  In  
general, the hooks effectively guard against egregious  
misconfigurations.  
  
However, this approach has some problems.  Since these check hooks  
are called as each GUC is assigned its user-specified value, only  
one of the hooks will be called with all the relevant GUCs set.  If  
one or more of the user-specified values are less than the initial  
values of the GUCs' underlying variables, false positives can  
occur.  
  
Furthermore, the error message emitted when one of the check hooks  
fails is not tremendously helpful.  For example, the command  
  
	$ pg_ctl -D . start -o "-c max_connections=262100 -c max_wal_senders=10000"  
  
fails with the following error:  
  
	FATAL:  invalid value for parameter "max_wal_senders": 10000  
  
Fortunately, there is an extra copy of this check in  
InitializeMaxBackends() that we can rely on, so this commit removes  
the aforementioned GUC check hooks in favor of that one.  It also  
enhances the error message to clearly show the values of the  
relevant GUCs and the hard-coded limit their sum may not exceed.  
The downside of this change is that server startup progresses  
further before failing due to such misconfigurations (thus taking  
longer), but these failures are expected to be rare, so we don't  
anticipate any real harm in practice.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/ZnMr2k-Nk5vj7T7H%40nathan  

M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h

Improve PL/Tcl's method for choosing Tcl names of procedures.

commit   : ba8f00eef6d6199b1d01f4b1eb6ed955dc4bd17e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 14:14:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 14:14:42 -0400    

Click here for diff

Previously, the internal name of a PL/Tcl function was just  
"__PLTcl_proc_NNNN", where NNNN is the function OID.  That's pretty  
unhelpful when reading an error report.  Plus it prevents us from  
testing the CONTEXT output for PL/Tcl errors, since the OIDs shown  
in the regression tests wouldn't be stable.  
  
Instead, base the internal name on the result of format_procedure(),  
which will be unique in most cases.  For the edge cases where it's  
not, we can append the function OID to make it unique.  
  
Sadly, the pltcl_trigger.sql test script still has to suppress the  
context reports, because they'd include trigger arguments which  
contain relation OIDs per PL/Tcl's longstanding API for triggers.  
  
I had to modify one existing test case to throw a different error  
than before, because I found that Tcl 8.5 and Tcl 8.6 spell the  
context message for the original error slightly differently.  
We might have to make more adjustments in that vein once this  
gets wider testing.  
  
Patch by me; thanks to Pavel Stehule for the idea to use  
format_procedure() rather than just the proname.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/pltcl.sgml
M src/pl/tcl/expected/pltcl_queries.out
M src/pl/tcl/expected/pltcl_transaction.out
M src/pl/tcl/expected/pltcl_trigger.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_queries.sql
M src/pl/tcl/sql/pltcl_transaction.sql
M src/pl/tcl/sql/pltcl_trigger.sql

Doc: minor improvements for our "Brief History" chapter.

commit   : aaab3ee9c64129b5afb2c35e743fba322a052bff    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 13:12:34 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 5 Jul 2024 13:12:34 -0400    

Click here for diff

Add a link to Joe Hellerstein's paper "Looking Back at Postgres",  
which is quite an interesting take on the history of Postgres.  
  
The reference to Appendix E was written when we were still keeping  
the entire release-note history there, which we stopped doing some  
years ago when the O(N^2) cost of that started to become apparent.  
Instead, point to the release note archives on the website.  
(This per suggestion from Daniel Gustafsson.)  
  
In passing, move the "ports12" biblioentry to be in alphabetical  
order within that section.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/biblio.sgml
M doc/src/sgml/history.sgml

Support loading of injection points

commit   : 4b211003ecc2946dc0052b650141ea4e8f35254c    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2024 17:41:49 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 5 Jul 2024 17:41:49 +0900    

Click here for diff

This can be used to load an injection point and prewarm the  
backend-level cache before running it, to avoid issues if the point  
cannot be loaded due to restrictions in the code path where it would be  
run, like a critical section where no memory allocation can happen  
(load_external_function() can do allocations when expanding a library  
name).  
  
Tests can use a macro called INJECTION_POINT_LOAD() to load an injection  
point.  The test module injection_points gains some tests, and a SQL  
function able to load an injection point.  
  
Based on a request from Andrey Borodin, who has implemented a test for  
multixacts requiring this facility.  
  
Reviewed-by: Andrey Borodin  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/utils/misc/injection_point.c
M src/include/utils/injection_point.h
M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/sql/injection_points.sql

commit   : 98347b5a3ab116dd0892d112531e376cff5066fd    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Jul 2024 11:21:46 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 5 Jul 2024 11:21:46 +0300    

Click here for diff

Since commit 5764f611e1, we've been using the ilist.h functions for  
handling the linked list. There's no need for 'links' to be the first  
element of the struct anymore, except for one call in InitProcess  
where we used a straight cast from the 'dlist_node *' to PGPROC *,  
without the dlist_container() macro. That was just an oversight in  
commit 5764f611e1, fix it.  
  
There no imminent need to move 'links' from being the first field, but  
let's be tidy.  
  
Reviewed-by: Aleksander Alekseev, Andres Freund  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

Improve memory management and performance of tuplestore.c

commit   : 590b045c37aad44915f7f472343f24c2bafbe5d8    
  
author   : David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 17:51:27 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 17:51:27 +1200    

Click here for diff

Here we make tuplestore.c use a generation.c memory context rather than  
allocating tuples into the CurrentMemoryContext, which primarily is the  
ExecutorState or PortalHoldContext memory context.  Not having a  
dedicated context can cause the CurrentMemoryContext context to become  
bloated when pfree'd chunks are not reused by future tuples.  Using  
generation speeds up users of tuplestore.c, such as the Materialize,  
WindowAgg and CTE Scan executor nodes.  The main reason for the speedup is  
due to generation.c being more memory efficient than aset.c memory  
contexts.  Specifically, generation does not round sizes up to the next  
power of 2 value.  This both saves memory, allowing more tuples to fit in  
work_mem, but also makes the memory usage more compact and fit on fewer  
cachelines.  One benchmark showed up to a 22% performance increase in a  
query containing a Materialize node.  Much higher gains are possible if  
the memory reduction prevents tuplestore.c from spilling to disk.  This is  
especially true for WindowAgg nodes where improvements of several thousand  
times are possible if the memory reductions made here prevent tuplestore  
from spilling to disk.  
  
Additionally, a generation.c memory context is much better suited for this  
job as it works well with FIFO palloc/pfree patterns, which is exactly how  
tuplestore.c uses it.  Because of the way generation.c allocates memory,  
tuples consecutively stored in tuplestores are much more likely to be  
stored consecutively in memory.  This allows the CPU's hardware prefetcher  
to work more efficiently as it provides a more predictable pattern to  
allow cachelines for the next tuple to be loaded from RAM in advance of  
them being needed by the executor.  
  
Using a dedicated memory context for storing tuples also allows us to more  
efficiently clean up the memory used by the tuplestore as we can reset or  
delete the context rather than looping over all stored tuples and  
pfree'ing them one by one.  
  
Also, remove a badly placed USEMEM call in readtup_heap().  The tuple  
wasn't being allocated in the Tuplestorestate's context, so no need to  
adjust the memory consumed by the tuplestore there.  
  
Author: David Rowley  
Reviewed-by: Matthias van de Meent, Dmitry Dolgov  
Discussion: https://postgr.es/m/CAApHDvp5Py9g4Rjq7_inL3-MCK1Co2CRt_YWFwTU2zfQix0p4A@mail.gmail.com  

M src/backend/utils/sort/tuplestore.c

Fix newly introduced issue in EXPLAIN for Materialize nodes

commit   : 53abb1e0ebc38818f31f2ddb15a06feba8e19e6c    
  
author   : David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 16:56:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 16:56:16 +1200    

Click here for diff

The code added in 1eff8279d was lacking a check to see if the tuplestore  
had been created.  In nodeMaterial.c this is done by ExecMaterial() rather  
than by ExecInitMaterial(), so the tuplestore won't be created unless  
the node has been executed at least once, as demonstrated by Alexander  
in his report.  
  
Here we skip showing any of the new EXPLAIN ANALYZE information when the  
Materialize node has not been executed.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/explain.c

Add simple codepoint redirections to unaccent.rules.

commit   : 18501841bcb4e693b9f1e9da2b2fb524c78940d8    
  
author   : Thomas Munro <[email protected]>    
date     : Fri, 5 Jul 2024 15:25:31 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Fri, 5 Jul 2024 15:25:31 +1200    

Click here for diff

Previously we searched for code points where the Unicode data file  
listed an equivalent combining character sequence that added accents.  
Some codepoints redirect to a single other codepoint, instead of doing  
any combining.  We can follow those references recursively to get the  
answer.  
  
Per bug report #18362, which reported missing Ancient Greek characters.  
Specifically, precomposed characters with oxia (from the polytonic  
accent system used for old Greek) just point to precomposed characters  
with tonos (from the monotonic accent system for modern Greek), and we  
have to follow the extra hop to find out that they are composed with  
an acute accent.  
  
Besides those, the new rule also:  
  
* pulls in a lot of 'Mathematical Alphanumeric Symbols', which are  
  copies of the Latin and Greek alphabets and numbers rendered  
  in different typefaces, and  
  
* corrects a single mathematical letter that previously came from the  
  CLDR transliteration file, but the new rule extracts from the main  
  Unicode database file, where clearly the latter is right and the  
  former is a wrong (reported to CLDR).  
  
Reported-by: Cees van Zeeland <[email protected]>  
Reviewed-by: Robert Haas <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/18362-be6d0cfe122b6354%40postgresql.org  

M contrib/unaccent/expected/unaccent.out
M contrib/unaccent/generate_unaccent_rules.py
M contrib/unaccent/unaccent.rules

Add memory/disk usage for Material nodes in EXPLAIN

commit   : 1eff8279d494b96f0073df78abc74954a2f6ee54    
  
author   : David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 14:05:08 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 5 Jul 2024 14:05:08 +1200    

Click here for diff

Up until now, there was no ability to easily determine if a Material  
node caused the underlying tuplestore to spill to disk or even see how  
much memory the tuplestore used if it didn't.  
  
Here we add some new functions to tuplestore.c to query this information  
and add some additional output in EXPLAIN ANALYZE to display this  
information for the Material node.  
  
There are a few other executor node types that use tuplestores, so we  
could also consider adding these details to the EXPLAIN ANALYZE for  
those nodes too.  Let's consider those independently from this.  Having  
the tuplestore.c infrastructure in to allow that is step 1.  
  
Author: David Rowley  
Reviewed-by: Matthias van de Meent, Dmitry Dolgov  
Discussion: https://postgr.es/m/CAApHDvp5Py9g4Rjq7_inL3-MCK1Co2CRt_YWFwTU2zfQix0p4A@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/utils/sort/tuplestore.c
M src/include/utils/tuplestore.h
M src/test/regress/expected/partition_prune.out
M src/test/regress/sql/partition_prune.sql

Support "Right Semi Join" plan shapes

commit   : aa86129e19d704afb93cb84ab9638f33d266ee9d    
  
author   : Richard Guo <[email protected]>    
date     : Fri, 5 Jul 2024 09:26:48 +0900    
  
committer: Richard Guo <[email protected]>    
date     : Fri, 5 Jul 2024 09:26:48 +0900    

Click here for diff

Hash joins can support semijoin with the LHS input on the right, using  
the existing logic for inner join, combined with the assurance that only  
the first match for each inner tuple is considered, which can be  
achieved by leveraging the HEAP_TUPLE_HAS_MATCH flag.  This can be very  
useful in some cases since we may now have the option to hash the  
smaller table instead of the larger.  
  
Merge join could likely support "Right Semi Join" too.  However, the  
benefit of swapping inputs tends to be small here, so we do not address  
that in this patch.  
  
Note that this patch also modifies a test query in join.sql to ensure it  
continues testing as intended.  With this patch the original query would  
result in a right-semi-join rather than semi-join, compromising its  
original purpose of testing the fix for neqjoinsel's behavior for  
semi-joins.  
  
Author: Richard Guo  
Reviewed-by: wenhui qiu, Alena Rybakina, Japin Li  
Discussion: https://postgr.es/m/CAMbWs4_X1mN=ic+SxcyymUqFx9bB8pqSLTGJ-F=MHy4PW3eRXw@mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/executor/nodeHashjoin.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/join.sql

Doc: small improvements in discussion of geometric data types.

commit   : 5a519abeddfe34659a8c0478f04a0acfd0d80ec6    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 4 Jul 2024 13:23:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 4 Jul 2024 13:23:32 -0400    

Click here for diff

State explicitly that the coordinates in our geometric data types are  
float8.  Also explain that polygons store their bounding box.  
  
While here, fix the table of geometric data types to show type  
"line"'s size correctly: it's 24 bytes not 32.  This has somehow  
escaped notice since that table was made in 1998.  
  
Per suggestion from Sebastian Skałacki.  The size error seems  
important enough to justify back-patching.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/datatype.sgml

Fix copy/paste mistake in comment

commit   : 2ef575c7803a55101352c0f6cb8f745af063a66c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Jul 2024 13:57:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Jul 2024 13:57:47 +0200    

Click here for diff

Backpatch to 17  
  
Author: Yugo NAGATA <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Remove bogus assertion in pg_atomic_monotonic_advance_u64

commit   : 768f0c3e21b31f92ebb510a7e4d0c2cd1c1ecb97    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 4 Jul 2024 13:25:31 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 4 Jul 2024 13:25:31 +0200    

Click here for diff

This code wanted to ensure that the 'exchange' variable passed to  
pg_atomic_compare_exchange_u64 has correct alignment, but apparently  
platforms don't actually require anything that doesn't come naturally.  
  
While messing with pg_atomic_monotonic_advance_u64: instead of using  
Max() to determine the value to return, just use  
pg_atomic_compare_exchange_u64()'s return value to decide; also, use  
pg_atomic_compare_exchange_u64 instead of the _impl version; also remove  
the unnecessary underscore at the end of variable name "target".  
  
Backpatch to 17, where this code was introduced by commit bf3ff7bf83bc.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/include/port/atomics.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-sunpro.h

doc: Specify when ssl_prefer_server_ciphers was added

commit   : ab0ae6432062ed318774981987272b4561b5616c    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Thu, 4 Jul 2024 11:38:37 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Thu, 4 Jul 2024 11:38:37 +0200    

Click here for diff

The ssl_prefer_server_ciphers setting is quite important from a  
security point of view, so simply stating that older versions  
doesn't have it isn't very helpful.  This adds the version when  
the GUC was added to help readers.  
  
Backpatch to all supported versions since this setting has been  
around since 9.4.  
  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v12  

M doc/src/sgml/config.sgml

Add pg_get_acl() to get the ACL for a database object

commit   : 4564f1cebd437d93590027c9ff46ef60bc3286ae    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2024 17:09:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2024 17:09:06 +0900    

Click here for diff

This function returns the ACL for a database object, specified by  
catalog OID and object OID.  This is useful to be able to  
retrieve the ACL associated to an object specified with a  
(class_id,objid) couple, similarly to the other functions for object  
identification, when joined with pg_depend or pg_shdepend.  
  
Original idea by Álvaro Herrera.  
  
Bump catalog version.  
  
Author: Joel Jacobson  
Reviewed-by: Isaac Morland, Michael Paquier, Ranier Vilela  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/func.sgml
M src/backend/catalog/objectaddress.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

SQL/JSON: Fix some obsolete comments.

commit   : 3a8a1f3254b2e3e981a91cb021ea0e9fdb5c3b9c    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 15:09:59 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 15:09:59 +0900    

Click here for diff

JSON_OBJECT(), JSON_OBJETAGG(), JSON_ARRAY(), and JSON_ARRAYAGG()  
added in 7081ac46ace are not transformed into direct calls to  
user-defined functions as the comments claim. Fix by mentioning  
instead that they are transformed into JsonConstructorExpr nodes,  
which may call them, for example, for the *AGG() functions.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://postgr.es/m/058c856a-e090-ac42-ff00-ffe394f52a87%40gmail.com  
Backpatch-through: 16  

M src/backend/parser/parse_expr.c

Assign error codes where missing for user-facing failures

commit   : b81a71aa05f294705e1b1d4fe24548f175f9bfe9    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2024 09:48:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 4 Jul 2024 09:48:40 +0900    

Click here for diff

All the errors triggered in the code paths patched here would cause the  
backend to issue an internal_error errcode, which is a state that should  
be used only for "can't happen" situations.  However, these code paths  
are reachable by the regression tests, and could be seen by users in  
valid cases.  Some regression tests expect internal errcodes as they  
manipulate the backend state to cause corruption (like checksums), or  
use elog() because it is more convenient (like injection points), these  
have no need to change.  
  
This reduces the number of internal failures triggered in a check-world  
by more than half, while providing correct errcodes for these valid  
cases.  
  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/commands/matview.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/user.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/replication/slotfuncs.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/tid.c

Optimize memory access in GetRunningTransactionData()

commit   : 6897f0ec024582a570868939d3f34a6853374723    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 4 Jul 2024 02:05:37 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 4 Jul 2024 02:05:37 +0300    

Click here for diff

e85662df44 made GetRunningTransactionData() calculate the oldest running  
transaction id within the current database.  This commit optimized this  
calculation by performing a cheap transaction id comparison before fetching  
the process database id, while the latter could cause extra cache misses.  
  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/20240630231816.bf.nmisch%40google.com  

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

Fix typo in GetRunningTransactionData()

commit   : 6c1af5482e6943a5f29b7f4ca773c720ec8202b0    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 4 Jul 2024 02:05:27 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 4 Jul 2024 02:05:27 +0300    

Click here for diff

e85662df44 made GetRunningTransactionData() calculate the oldest running  
transaction id within the current database.  However, because of the typo,  
the new code uses oldestRunningXid instead of oldestDatabaseRunningXid  
in comparison before updating oldestDatabaseRunningXid.  This commit fixes  
that issue.  
  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/20240630231816.bf.nmisch%40google.com  
Backpatch-through: 17  

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

Remove incorrect Asserts in buffile.c

commit   : 4331a11c62eca7426ad4472be051fe512a04fc80    
  
author   : David Rowley <[email protected]>    
date     : Thu, 4 Jul 2024 09:44:34 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 4 Jul 2024 09:44:34 +1200    

Click here for diff

Both BufFileSize() and BufFileAppend() contained Asserts to ensure the  
given BufFile(s) had a valid fileset.  A valid fileset isn't required in  
either of these functions, so remove the Asserts and adjust the  
comments accordingly.  
  
This was noticed while work was being done on a new patch to call  
BufFileSize() on a BufFile without a valid fileset.  It seems there's  
currently no code in the tree which could trigger these Asserts, so no  
need to backpatch this, for now.  
  
Reviewed-by: Peter Geoghegan, Matthias van de Meent, Tom Lane  
Discussion: https://postgr.es/m/CAApHDvofgZT0VzydhyGH5MMb-XZzNDqqAbzf1eBZV5HDm3%2BosQ%40mail.gmail.com  

M src/backend/storage/file/buffile.c

Improve performance of binary_upgrade_set_pg_class_oids().

commit   : 2329cad1b93f268c0ec6848732c6db43eb46156c    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 3 Jul 2024 14:21:50 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 3 Jul 2024 14:21:50 -0500    

Click here for diff

This function generates the commands that preserve the OIDs and  
relfilenodes of relations during pg_upgrade.  It is called once per  
relevant relation, and each such call executes a relatively  
expensive query to retrieve information for a single pg_class_oid.  
This can cause pg_dump to take significantly longer when  
--binary-upgrade is specified, especially when there are many  
tables.  
  
This commit improves the performance of this function by gathering  
all the required pg_class information with a single query at the  
beginning of pg_dump.  This information is stored in a sorted array  
that binary_upgrade_set_pg_class_oids() can bsearch() for what it  
needs.  This follows a similar approach as commit d5e8930f50, which  
introduced a sorted array for role information.  
  
With this patch, 'pg_dump --binary-upgrade' will use more memory,  
but that isn't expected to be too egregious.  Per the mailing list  
discussion, folks feel that this is worth the trade-off.  
  
Reviewed-by: Corey Huinker, Michael Paquier, Daniel Gustafsson  
Discussion: https://postgr.es/m/20240418041712.GA3441570%40nathanxps13  

M src/bin/pg_dump/pg_dump.c
M src/tools/pgindent/typedefs.list

Remove is_index parameter from binary_upgrade_set_pg_class_oids().

commit   : 6e1c4a03a978ed3574124d8f2be22ba2e5a4b1e9    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 3 Jul 2024 10:58:26 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 3 Jul 2024 10:58:26 -0500    

Click here for diff

Since commit 9a974cbcba, this function retrieves the relkind before  
it needs to know whether the relation is an index, so we no longer  
need callers to provide this information.  
  
Suggested-by: Daniel Gustafsson  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/20240418041712.GA3441570%40nathanxps13  

M src/bin/pg_dump/pg_dump.c

Avoid 0-length memcpy to NULL with EXEC_BACKEND

commit   : f3412a61f3f92d795ce0c8bb715831ec02124bfb    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Jul 2024 15:58:14 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Jul 2024 15:58:14 +0300    

Click here for diff

memcpy(NULL, src, 0) is forbidden by POSIX, even though every  
production version of libc allows it. Let's be tidy.  
  
Per report from Thomas Munro, running UBSan with EXEC_BACKEND.  
Backpatch to v17, where this code was added.  
  
Discussion: https://www.postgresql.org/message-id/CA%2BhUKG%2Be-dV7YWBzfBZXsgovgRuX5VmvmOT%[email protected]  

M src/backend/postmaster/launch_backend.c

Tighten check for --forkchild argument when spawning child process

commit   : a06e8f84a1ac1158ca7d7a95d9df289fe5219502    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Jul 2024 15:53:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Wed, 3 Jul 2024 15:53:30 +0300    

Click here for diff

Commit aafc05de1b removed all the other --fork* arguments. Altough  
this is inconsequential, backpatch to v17 since this is new.  
  
Author: Nathan Bossart  
Discussion: https://www.postgresql.org/message-id/ZnCCEN0l3qWv-XpW@nathan  

M src/backend/main/main.c

Fix the testcase introduced in commit 81d20fbf7a.

commit   : ae395f0f7edbbf8e9ebe92e2ed3a471192789f0c    
  
author   : Amit Kapila <[email protected]>    
date     : Wed, 3 Jul 2024 15:04:59 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Wed, 3 Jul 2024 15:04:59 +0530    

Click here for diff

The failed test was syncing failover replication slot to standby to test  
that we remove such slots after the standby is converted to subscriber by  
pg_createsubscriber.  
  
In one of the buildfarm members, the sync of the slot failed because the  
LSN on the standby was before the syncslot's LSN. We need to wait for  
standby to catch up before trying to sync the slot with  
pg_sync_replication_slots().  
  
The other buildfarm failed because autovacuum generated a xid which is  
replicated to the standby at some random point making slots at primary  
lag behind standby during slot sync.  
  
Both these failures wouldn't have occurred if we had used built-in  
slotsync worker as it would have waited for the standby to sync with  
primary but for this test, it is sufficient to use  
pg_sync_replication_slots().  
  
Reported-by: Alexander Lakhin as per buildfarm  
Author: Kuroda Hayato  
Reviewed-by: Amit Kapila  
Backpatch-through: 17  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/OSBPR01MB25528300C71FDD83EA1DCA12F5DD2@OSBPR01MB2552.jpnprd01.prod.outlook.com  

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

Replace hardcoded identifiers of pgstats file by #defines

commit   : 9fd02525793f3e06c72ee0da45303c21f7067ccf    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2024 13:09:20 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2024 13:09:20 +0900    

Click here for diff

This changes pgstat.c so as the three types of entries that can exist in  
a pgstats file are not hardcoded anymore, replacing them with  
descriptively-named macros, when reading and writing stats files:  
- 'N' for named entries, like replication slot stats.  
- 'S' for entries identified by a hash.  
- 'E' for the end-of-file  
  
This has come up while working on making this area of the code more  
pluggable.  The format of the stats file is unchanged, hence there is no  
need to bump PGSTAT_FILE_FORMAT_ID.  
  
Reviewed-by: Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  

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

Clean up more unused variables in perl code

commit   : dd569214aa7d057a9676c49ddbf2da74ad9924e3    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2024 12:43:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 3 Jul 2024 12:43:57 +0900    

Click here for diff

This is a continuation of 0c1aca461481, with some cleanup in:  
- msvc_gendef.pl  
- pgindent  
- 005_negotiate_encryption.pl, as of an oversight of d39a49c1e459 that  
has removed %params in test_matrix(), making also $server_config  
useless.  
  
Author: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M src/interfaces/libpq/t/005_negotiate_encryption.pl
M src/tools/msvc_gendef.pl
M src/tools/pgindent/pgindent

Add CODE_OF_CONDUCT.md, CONTRIBUTING.md, and SECURITY.md.

commit   : dec9d4acdb7d758c3cbe989ad80cf0367f4e166d    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 2 Jul 2024 13:03:58 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 2 Jul 2024 13:03:58 -0500    

Click here for diff

These "community health files" provide important information about  
the project and will be displayed prominently on the PostgreSQL  
GitHub mirror.  For now, they just point to the website, but we may  
want to expand on the content in the future.  
  
Reviewed-by: Peter Eisentraut, Alvaro Herrera, Tom Lane  
Discussion: https://postgr.es/m/20240417023609.GA3228660%40nathanxps13  

A .github/CODE_OF_CONDUCT.md
A .github/CONTRIBUTING.md
A .github/SECURITY.md

Remove redundant SetProcessingMode(InitProcessing) calls

commit   : eb21f5bc67a02eb6f7de1bd2f07acdd471a4d320    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Jul 2024 20:14:40 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Jul 2024 20:14:40 +0300    

Click here for diff

After several refactoring iterations, auxiliary processes are no  
longer initialized from the bootstrapper. Using the InitProcessing  
mode for initializing auxiliary processes is more appropriate. Since  
the global variable Mode is initialized to InitProcessing, we can just  
remove the redundant calls of SetProcessingMode(InitProcessing).  
  
Author: Xing Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CACpMh%2BDBHVT4xPGimzvex%3DwMdMLQEu9PYhT%2BkwwD2x2nu9dU_Q%40mail.gmail.com  

M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/slotsync.c
M src/backend/tcop/postgres.c

Move bgworker specific logic to bgworker.c

commit   : 4d22173ec08cfdb83f61cfff1d6fa67fe7d83296    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Jul 2024 20:12:05 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Tue, 2 Jul 2024 20:12:05 +0300    

Click here for diff

For clarity, we've been slowly moving functions that are not called  
from the postmaster process out of postmaster.c.  
  
Author: Xing Guo <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CACpMh%2BDBHVT4xPGimzvex%3DwMdMLQEu9PYhT%2BkwwD2x2nu9dU_Q%40mail.gmail.com  

M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c

pg_dump: Remove some unused return values.

commit   : 8213df9effaf0767efa7faf9b75fa500d4f45985    
  
author   : Nathan Bossart <[email protected]>    
date     : Tue, 2 Jul 2024 11:22:06 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Tue, 2 Jul 2024 11:22:06 -0500    

Click here for diff

getSchemaData() does not use the return values of many of its get*  
helper functions because they store the data elsewhere.  For  
example, commit 92316a4582 introduced a separate hash table for  
dumpable objects that said helper functions populate.  This commit  
changes these functions to return void and removes their "int *"  
parameters that returned the number of objects found.  
  
Reviewed-by: Neil Conway, Tom Lane, Daniel Gustafsson  
Discussion: https://postgr.es/m/ZmCAtVaOrHpf31PJ%40nathan  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h

Use safe string copy routine

commit   : e930c872b65c19c8950556fa94aa9ab53b2919b0    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 2 Jul 2024 11:16:56 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 2 Jul 2024 11:16:56 +0200    

Click here for diff

Using memcpy with strlen as the size parameter will not take the  
NULL terminator into account, relying instead on the destination  
buffer being properly initialized. Replace with strlcpy which is  
a safer alternative, and more in line with how we handle copying  
strings elsewhere.  
  
Author: Ranier Vilela <[email protected]>  
Discussion: https://postgr.es/m/CAEudQApAsbLsQ+gGiw-hT+JwGhgogFa_=5NUkgFO6kOPxyNidQ@mail.gmail.com  

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

Remove too demanding test

commit   : da3ea048ca568f570cb579c090cf1a84554b8bec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 10:43:12 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 10:43:12 +0200    

Click here for diff

Remove the test from commit 9c2e660b07.  This test ends up allocating  
quite a bit of memory, which can make the test fail with out of memory  
errors on some build farm machines.  

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

Limit max parameter number with MaxAllocSize

commit   : 9c2e660b07fc16bdd79c25047cce6cde2acb3f37    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 09:24:04 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 09:24:04 +0200    

Click here for diff

MaxAllocSize puts an upper bound on the largest possible parameter  
number ($268435455).  Use that limit instead of INT_MAX to report that  
no parameters exist beyond that point instead of reporting an error  
about the maximum allocation size being exceeded.  
  
Author: Erik Wienhold <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/parse_param.c
M src/test/regress/expected/prepare.out
M src/test/regress/sql/prepare.sql

Fix overflow in parsing of positional parameter

commit   : d35cd061998434747c0d1c0f6f2aa1f736f0edb4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 09:16:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 09:16:36 +0200    

Click here for diff

Replace atol with pg_strtoint32_safe in the backend parser and with  
strtoint in ECPG to reject overflows when parsing the number of a  
positional parameter.  With atol from glibc, parameters $2147483648 and  
$4294967297 turn into $-2147483648 and $1, respectively.  
  
Author: Erik Wienhold <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Peter Eisentraut <[email protected]>  
Reviewed-by: Alexander Lakhin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/parser/scan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/numerology.out
M src/test/regress/sql/numerology.sql

Drop pre-existing subscriptions from the converted subscriber.

commit   : 4867f8a555cea1bc6de1726b0030896aa4cd3c70    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Jul 2024 11:36:21 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Jul 2024 11:36:21 +0530    

Click here for diff

We don't need the pre-existing subscriptions on the newly formed  
subscriber by using pg_createsubscriber. The apply workers corresponding  
to these subscriptions can connect to other publisher nodes and either get  
some unwarranted data or can lead to ERRORs in connecting to such nodes.  
  
Author: Kuroda Hayato  
Reviewed-by: Amit Kapila, Shlok Kyal, Vignesh C  
Backpatch-through: 17  
Discussion: https://postgr.es/m/OSBPR01MB25526A30A1FBF863ACCDDA3AF5C92@OSBPR01MB2552.jpnprd01.prod.outlook.com  

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

Improve some global variable declarations

commit   : 8f8bcb88833eecfffbbb0d048ff0b6c33e64f7ce    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:55:56 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:55:56 +0200    

Click here for diff

We have in launch_backend.c:  
  
    /*  
     * The following need to be available to the save/restore_backend_variables  
     * functions.  They are marked NON_EXEC_STATIC in their home modules.  
     */  
    extern slock_t *ShmemLock;  
    extern slock_t *ProcStructLock;  
    extern PGPROC *AuxiliaryProcs;  
    extern PMSignalData *PMSignalState;  
    extern pg_time_t first_syslogger_file_time;  
    extern struct bkend *ShmemBackendArray;  
    extern bool redirection_done;  
  
That comment is not completely true: ShmemLock, ShmemBackendArray, and  
redirection_done are not in fact NON_EXEC_STATIC.  ShmemLock once was,  
but was then needed elsewhere.  ShmemBackendArray was static inside  
postmaster.c before launch_backend.c was created.  redirection_done  
was never static.  
  
This patch moves the declaration of ShmemLock and redirection_done to  
a header file.  
  
ShmemBackendArray gets a NON_EXEC_STATIC.  This doesn't make a  
difference, since it only exists if EXEC_BACKEND anyway, but it makes  
it consistent.  
  
After that, the comment is now correct.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/error/elog.c
M src/include/postmaster/postmaster.h
M src/include/storage/shmem.h

Add missing includes for some global variables

commit   : 881455e57b1210174b89bb3b13cad6b30b236d50    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:53:48 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:53:48 +0200    

Click here for diff

src/backend/libpq/pqcomm.c: "postmaster/postmaster.h" for Unix_socket_group, Unix_socket_permissions  
src/backend/utils/init/globals.c: "postmaster/postmaster.h" for MyClientSocket  
src/backend/utils/misc/guc_tables.c: "utils/rls.h" for row_security  
src/backend/utils/sort/tuplesort.c: "utils/guc.h" for trace_sort  
  
Nothing currently diagnoses missing includes for global variables, but  
this is being cleaned up, and these ones had an obvious header file  
available.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/libpq/pqcomm.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/sort/tuplesort.c

Convert some extern variables to static

commit   : 720b0eaae9b8a8326b2b6a6ff88fca4f47c631d4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:53:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 2 Jul 2024 06:53:19 +0200    

Click here for diff

These probably should have been static all along, it was only  
forgotten out of sloppiness.  
  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M contrib/isn/EAN13.h
M contrib/isn/ISBN.h
M contrib/isn/ISMN.h
M contrib/isn/ISSN.h
M contrib/isn/UPC.h
M src/backend/commands/user.c
M src/backend/postmaster/launch_backend.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/worker.c
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_test_timing/pg_test_timing.c
M src/bin/pgbench/pgbench.c
M src/bin/scripts/vacuumdb.c
M src/pl/plpgsql/src/pl_handler.c
M src/test/isolation/isolation_main.c
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/test_json_parser/test_json_parser_incremental.c

Remove unused structure member in pg_createsubscriber.c.

commit   : a4c87df43a45a407a1f3fd584a7ffb32342628cc    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 2 Jul 2024 10:28:51 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 2 Jul 2024 10:28:51 +0530    

Click here for diff

Author: Kuroda Hayato  
Backpatch-through: 17  
Discussion: https://postgr.es/m/OSBPR01MB25526A30A1FBF863ACCDDA3AF5C92@OSBPR01MB2552.jpnprd01.prod.outlook.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

Use TupleDescAttr macro consistently

commit   : 65b71dec2d577e9ef7423773a88fdd075f3eb97f    
  
author   : David Rowley <[email protected]>    
date     : Tue, 2 Jul 2024 13:41:47 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 2 Jul 2024 13:41:47 +1200    

Click here for diff

A few places were directly accessing the attrs[] array. This goes  
against the standards set by 2cd708452. Fix that.  
  
Discussion: https://postgr.es/m/CAApHDvrBztXP3yx=NKNmo3xwFAFhEdyPnvrDg3=M0RhDs+4vYw@mail.gmail.com  

M contrib/pageinspect/gistfuncs.c
M src/backend/catalog/heap.c
M src/backend/commands/prepare.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/optimizer/util/plancat.c

Cleanup perl code from unused variables and routines

commit   : 0c1aca461481216ff5a0e65538c4880bcf346433    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2024 09:47:16 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2024 09:47:16 +0900    

Click here for diff

This commit removes unused variables and routines from some perl code  
that have accumulated across the years.  This touches the following  
areas:  
- Wait event generation script.  
- AdjustUpgrade.pm.  
- TAP perl code  
  
Author: Alexander Lakhin  
Reviewed-by: Dagfinn Ilmari Mannsåker  
Discussion: https://postgr.es/m/[email protected]  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M src/backend/utils/activity/generate-wait_event_types.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/035_standby_logical_decoding.pl

Add information about access method for partitioned relations in \dP+

commit   : 978f38c771fb3a19fdd5cb73cb662441eb9e551c    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2024 09:01:38 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 2 Jul 2024 09:01:38 +0900    

Click here for diff

Since 374c7a229042, it is possible to set a table AM on a partitioned  
table.  This information was showing up already in psql with \d+, while  
\dP+ provided no information.  
  
This commit extends \dP+ to show the access method used by a partitioned  
table or index, if set.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/ZkyivySXnbvOogZz@pryzbyj2023  

M src/bin/psql/describe.c

Remove support for HPPA (a/k/a PA-RISC) architecture.

commit   : edadeb0710e838f6ce1f95973fae683a56fdba06    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2024 13:55:52 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2024 13:55:52 -0400    

Click here for diff

This old CPU architecture hasn't been produced in decades, and  
whatever instances might still survive are surely too underpowered  
for anyone to consider running Postgres on in production.  We'd  
nonetheless continued to carry code support for it (largely at my  
insistence), because its unique implementation of spinlocks seemed  
like a good edge case for our spinlock infrastructure.  However,  
our last buildfarm animal of this type was retired last year, and  
it seems quite unlikely that another will emerge.  Without the ability  
to run tests, the argument that this is useful test code fails to  
hold water.  Furthermore, carrying code support for an untestable  
architecture has costs not to be ignored.  So, remove HPPA-specific  
code, in the same vein as commits 718aa43a4 and 92d70b77e.  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pgcrypto/crypt-blowfish.c
M doc/src/sgml/installation.sgml
M src/backend/storage/lmgr/s_lock.c
M src/include/port/atomics.h
D src/include/port/atomics/arch-hppa.h
M src/include/port/atomics/fallback.h
M src/include/storage/s_lock.h
M src/tools/pginclude/headerscheck

Remove redundant privilege check from pg_sequences system view.

commit   : 7967d10c5b49ccb82f67a0b80678a1a932bccdee    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 1 Jul 2024 11:47:40 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 1 Jul 2024 11:47:40 -0500    

Click here for diff

This commit adjusts pg_sequence_last_value() to return NULL instead  
of ERROR-ing for sequences for which the current user lacks  
privileges.  This allows us to remove the call to  
has_sequence_privilege() in the definition of the pg_sequences  
system view.  
  
Bumps catversion.  
  
Suggested-by: Michael Paquier  
Reviewed-by: Michael Paquier, Tom Lane  
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13  

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

Preserve CurrentMemoryContext across Start/CommitTransactionCommand.

commit   : 1afe31f03cd268a0bbb7a340d56b8eef6419bcb0    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2024 11:55:19 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 1 Jul 2024 11:55:19 -0400    

Click here for diff

Up to now, committing a transaction has caused CurrentMemoryContext to  
get set to TopMemoryContext.  Most callers did not pay any particular  
heed to this, which is problematic because TopMemoryContext is a  
long-lived context that never gets reset.  If the caller assumes it  
can leak memory because it's running in a limited-lifespan context,  
that behavior translates into a session-lifespan memory leak.  
  
The first-reported instance of this involved ProcessIncomingNotify,  
which is called from the main processing loop that normally runs in  
MessageContext.  That outer-loop code assumes that whatever it  
allocates will be cleaned up when we're done processing the current  
client message --- but if we service a notify interrupt, then whatever  
gets allocated before the next switch to MessageContext will be  
permanently leaked in TopMemoryContext.  sinval catchup interrupts  
have a similar problem, and I strongly suspect that some places in  
logical replication do too.  
  
To fix this in a generic way, let's redefine the behavior as  
"CommitTransactionCommand restores the memory context that was current  
at entry to StartTransactionCommand".  This clearly fixes the issue  
for the notify and sinval cases, and it seems to match the mental  
model that's in use in the logical replication code, to the extent  
that anybody thought about it there at all.  
  
For consistency, likewise make subtransaction exit restore the context  
that was current at subtransaction start (rather than always selecting  
the CurTransactionContext of the parent transaction level).  This case  
has less risk of resulting in a permanent leak than the outer-level  
behavior has, but it would not meet the principle of least surprise  
for some CommitTransactionCommand calls to restore the previous  
context while others don't.  
  
While we're here, also change xact.c so that we reset  
TopTransactionContext at transaction exit and then re-use it in later  
transactions, rather than dropping and recreating it in each cycle.  
This probably doesn't save a lot given the context recycling mechanism  
in aset.c, but it should save a little bit.  Per suggestion from David  
Rowley.  (Parenthetically, the text in src/backend/utils/mmgr/README  
implies that this is how I'd planned to implement it as far back as  
commit 1aebc3618 --- but the code actually added in that commit just  
drops and recreates it each time.)  
  
This commit also cleans up a few places outside xact.c that were  
needlessly making TopMemoryContext current, and thus risking more  
leaks of the same kind.  I don't think any of them represent  
significant leak risks today, but let's deal with them while the  
issue is top-of-mind.  
  
Per bug #18512 from wizardbrony.  Commit to HEAD only, as this change  
seems to have some risk of breaking things for some callers.  We'll  
apply a narrower fix for the known-broken cases in the back branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/transam/xact.c
M src/backend/replication/walsender.c
M src/backend/tcop/backend_startup.c
M src/backend/tcop/postgres.c
M src/backend/utils/mmgr/mcxt.c

Add --no-sync to pg_upgrade's uses of pg_dump and pg_dumpall.

commit   : 6e16b1e42003d811562d30b572ac3972238e2957    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 1 Jul 2024 10:18:26 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 1 Jul 2024 10:18:26 -0500    

Click here for diff

There's no reason to ensure that the files pg_upgrade generates  
with pg_dump and pg_dumpall have been written safely to disk.  If  
there is a crash during pg_upgrade, the upgrade must be restarted  
from the beginning; dump files left behind by previous pg_upgrade  
attempts cannot be reused.  
  
Reviewed-by: Peter Eisentraut, Tom Lane, Michael Paquier, Daniel Gustafsson  
Discussion: https://postgr.es/m/20240503171348.GA1731524%40nathanxps13  

M src/bin/pg_upgrade/dump.c

Remove useless extern keywords

commit   : 3fb59e789dd9f21610101d1ec106ad58095e24f3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 16:40:25 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 16:40:25 +0200    

Click here for diff

An extern keyword on a function definition (not declaration) is  
useless and not the normal style.  
  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/backup/basebackup_incremental.c
M src/backend/storage/file/fd.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_tar.c

Fix copy-paste mistake in PQcancelCreate

commit   : 3497c87b05a6ba31e8d760591900d550b2ef98bc    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 1 Jul 2024 13:58:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 1 Jul 2024 13:58:22 +0200    

Click here for diff

When an OOM occurred, this function was incorrectly setting a status of  
CONNECTION_BAD on the passed in PGconn instead of on the newly created  
PGcancelConn.  
  
Mistake introduced with 61461a300c1c.  Backpatch to 17.  
  
Author: Jelte Fennema-Nio <[email protected]>  
Reported-by: Noah Misch <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

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

Add context type field to pg_backend_memory_contexts

commit   : 12227a1d5f8ecad296c4204cc924d33c6a6bcd34    
  
author   : David Rowley <[email protected]>    
date     : Mon, 1 Jul 2024 21:19:01 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 1 Jul 2024 21:19:01 +1200    

Click here for diff

Since we now (as of v17) have 4 MemoryContext types, the type of context  
seems like useful information to include in the pg_backend_memory_contexts  
view.  Here we add that.  
  
Reviewed-by: David Christensen, Michael Paquier  
Discussion: https://postgr.es/m/CAApHDvrXX1OR09Zjb5TnB0AwCKze9exZN%3D9Nxxg1ZCVV8W-3BA%40mail.gmail.com  

M doc/src/sgml/system-views.sgml
M src/backend/utils/adt/mcxtfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Remove useless code

commit   : e26d313bad92e71e2b59cc2e81870bf6d750de1f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:50:29 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:50:29 +0200    

Click here for diff

BuildDescForRelation() goes out of its way to fill in  
->constr->has_not_null, but that value is not used for anything later,  
so this code can all be removed.  Note that BuildDescForRelation()  
doesn't make any effort to fill in the rest of ->constr, so there is  
no claim that that structure is completely filled in.  
  
Reviewed-by: Tomasz Rybak <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

M src/backend/commands/tablecmds.c

Remove useless initializations

commit   : da2aeba8f53379e84a8f3f656b6c2ffe5878eff5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:50:10 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:50:10 +0200    

Click here for diff

The struct is already initialized to all zeros right before this, and  
randomly initializing a few but not all fields to zero again has no  
technical or educational value.  
  
Reviewed-by: Tomasz Rybak <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/[email protected]  

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

doc: Clarify that pg_attrdef also stores generation expressions

commit   : da486d360103fbb3cd0d3f3b70134d47e9bb652a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:39:07 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 08:39:07 +0200    

Click here for diff

This was documented with pg_attribute but not with pg_attrdef.  
  
Reported-by: jian he <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CACJufxE+E-iYmBnZVZHiYA+WpyZZVv7BfiBLpo=T70EZHDU9rw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml

Rename standby_slot_names to synchronized_standby_slots.

commit   : 2357c9223b710c91b0f05cbc56bd435baeac961f    
  
author   : Amit Kapila <[email protected]>    
date     : Mon, 1 Jul 2024 11:36:56 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Mon, 1 Jul 2024 11:36:56 +0530    

Click here for diff

The standby_slot_names GUC allows the specification of physical standby  
slots that must be synchronized before the logical walsenders associated  
with logical failover slots. However, for this purpose, the GUC name is  
too generic.  
  
Author: Hou Zhijie  
Reviewed-by: Bertrand Drouvot, Masahiko Sawada  
Backpatch-through: 17  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/slot.h
M src/include/replication/walsender_private.h
M src/include/utils/guc_hooks.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/tools/pgindent/typedefs.list

Apply COPT to CXXFLAGS as well

commit   : 0c3930d0768943ad1dedb5a6ace250ce9b65915c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 07:30:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 1 Jul 2024 07:30:38 +0200    

Click here for diff

The main use of that make variable is to pass in -Werror.  It makes  
sense to apply this to C++ as well.  
  
Reviewed-by: Tom Lane <[email protected]>  
Reviewed-by: Andres Freund <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/fe3e200c-edee-44e0-a6e3-d45dca72873b%40eisentraut.org  

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

Use pgstat_kind_infos to read fixed shared statistics

commit   : 9004abf6206e815d25b7b763c756cf97b457f3cd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 14:26:25 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 14:26:25 +0900    

Click here for diff

Shared statistics with a fixed number of objects are read from the stats  
file in pgstat_read_statsfile() using members of PgStat_ShmemControl and  
following an order based on their PgStat_Kind value.  
  
Instead of being explicit, this commit changes the stats read to iterate  
over the pgstat_kind_infos array to find the memory locations to read  
into, based on a new shared_ctl_off in PgStat_KindInfo that can be used  
to define the position of this stats kind in shared memory.  This makes  
the read logic simpler, and eases the introduction of future  
improvements aimed at making this area more pluggable for external  
modules.  
  
Original idea suggested by Andres Freund.  
  
Author: Tristan Partin  
Reviewed-by: Andres Freund, Michael Paquier  
Discussion: https://postgr.es/m/[email protected]  

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

Further weaken new pg_createsubscriber test on Windows.

commit   : a1333ec048fb95ff47a5fc10a9cfde69fdbd2b01    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 23:20:57 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 23:20:57 -0400    

Click here for diff

Also omit backslashes (\) in the generated database names on Windows.  
As before, perhaps we can revert this after updating affected  
buildfarm animals.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Format better code for xact_decode()'s XLOG_XACT_INVALIDATIONS

commit   : 797adaf0febe02e097353fa6b21dd67fd6bd73c9    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 10:08:00 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 10:08:00 +0900    

Click here for diff

This makes the code more consistent with the surroundings.  
  
Author: ChangAo Chen  
Reviewed-by: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAExHW5tNTevUh58SKddTtcX3yU_5_PDSC8Mdp-Q2hc9PpZHRJg@mail.gmail.com  

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

doc: Add ACL acronym for "Access Control List"

commit   : 00d819d46a6f5b7e9d2e02948a1c80d11c4ce260    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 09:55:37 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 09:55:37 +0900    

Click here for diff

Five places across the docs use this abbreviation, so let's use a proper  
acronym entry for it.  
  
Per suggestion from me.  
  
Author: Joel Jacobson  
Reviewed-by: Nathan Bossart, David G. Johnston  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml

Remove PgStat_KindInfo.named_on_disk

commit   : b19db55bd687af243dd1edf021ffb166e5270a06    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 09:35:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 09:35:36 +0900    

Click here for diff

This field is used to track if a stats kind can use a custom format  
representation on disk when reading or writing its stats case.  On HEAD,  
this exists for replication slots stats, that need a mapping between an  
internal index ID and the slot names.  
  
named_on_disk is currently used nowhere and the callbacks  
to_serialized_name and from_serialized_name are in charge of checking if  
the serialization of the stats data should apply, so let's remove it.  
  
Reviewed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  

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

Improve enlargeStringInfo's ERROR message

commit   : 1029bdec2d641f378eaa59f00a93b136f191f3c7    
  
author   : David Rowley <[email protected]>    
date     : Mon, 1 Jul 2024 12:11:10 +1200    
  
committer: David Rowley <[email protected]>    
date     : Mon, 1 Jul 2024 12:11:10 +1200    

Click here for diff

Until now, when an enlargeStringInfo() call would cause the StringInfo to  
exceed its maximum size, we reported an "out of memory" error.  This is  
misleading as it's no such thing.  
  
Here we remove the "out of memory" text and replace it with something  
more relevant to better indicate that it's a program limitation that's  
been reached.  
  
Reported-by: Michael Banck  
Reviewed-by: Daniel Gustafsson, Tom Lane  
Discussion: https://postgr.es/m/[email protected]  

M src/common/stringinfo.c

Stamp HEAD as 18devel.

commit   : e26810d01d441a457217a6eae9c2989fba29b80f    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 07:56:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 07:56:10 +0900    

Click here for diff

Let the hacking begin ...  

M configure
M configure.ac
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-17.sgml
A doc/src/sgml/release-18.sgml
M doc/src/sgml/release.sgml
M meson.build
M src/tools/git_changelog
M src/tools/version_stamp.pl

Run pgperltidy

commit   : 7dcc6f8e6d7a0eb0ce90802311278723843b4bbd    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 07:35:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 1 Jul 2024 07:35:01 +0900    

Click here for diff

This is required before the creation of a new branch.  pgindent is  
clean, as well as is reformat-dat-files.  
  
perltidy version is v20230309, as documented in pgindent's README.  

M src/bin/pg_basebackup/t/040_pg_createsubscriber.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_rewind/t/003_extrafiles.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/test/recovery/t/009_twophase.pl

Temporarily(?) weaken new pg_createsubscriber test on Windows.

commit   : 54508209178bc73a497c460bd0ffd1645dceb1a2    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 17:33:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 17:33:06 -0400    

Click here for diff

Don't include double-quotes (") in the generated database names  
on Windows.  Doing so tickles a bug in older versions of IPC::Run,  
which fail to quote command line arguments correctly for that  
platform.  Possibly we can revert this after updating affected  
buildfarm animals.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Add PG_TEST_PG_COMBINEBACKUP_MODE

commit   : 35a7b288b975f8b13084307c4b610e3bed5ca046    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:26:12 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:26:12 +0200    

Click here for diff

Introduces an environment variable PG_TEST_PG_COMBINEBACKUP_MODE, that  
determines copy mode used by pg_combinebackup in TAP tests. Defaults to  
"--copy" but may be set to "--clone" or "--copy-file-range" to use the  
alternative stategies.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/48da4a1f-ccd9-4988-9622-24f37b1de2b4%40eisentraut.org  

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/test/perl/PostgreSQL/Test/Cluster.pm

Add pg_combinebackup --copy option

commit   : a9577bae6b5c88c6865597aacd33b93d1b17e497    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:20:02 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:20:02 +0200    

Click here for diff

Introduces --copy as an alternative to --clone and --copy-file-range.  
This option simply picks the default mode to copy files, as if none of  
the options was specified. This makes pg_combinebackup options more  
consistent with pg_upgrade, and it makes testing simpler.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/48da4a1f-ccd9-4988-9622-24f37b1de2b4%40eisentraut.org  

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

Add headers needed by pg_combinebackup --clone

commit   : e99e840b82756bc6858222d97453639cef929b53    
  
author   : Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:02:00 +0200    
  
committer: Tomas Vondra <[email protected]>    
date     : Sun, 30 Jun 2024 19:02:00 +0200    

Click here for diff

The code for file cloning existed, but was not reachable as it relied on  
constants from missing headers. Due to that, on Linux --clone always  
failed with  
  
  error: file cloning not supported on this platform  
  
Fixed by including the missing headers to relevant places. Adding the  
headers revealed a couple compile errors in copy_file_clone(), so fix  
those too.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/48da4a1f-ccd9-4988-9622-24f37b1de2b4%40eisentraut.org  

M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/pg_combinebackup.c

Make pg_createsubscriber warn if publisher has two-phase commit enabled.

commit   : 917754557cc0002bb042341720a7ce18fe5b0a09    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 14:24:14 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 14:24:14 -0400    

Click here for diff

pg_createsubscriber currently always sets up logical replication  
with two-phase commit disabled.  Improving that is not going to  
happen for v17.  In the meantime, document the deficiency, and  
adjust pg_createsubscriber so that it will emit a warning if  
the source installation has max_prepared_transactions > 0.  
  
Hayato Kuroda (some mods by Amit Kapila and me), per complaint from  
Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  

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

Make pg_createsubscriber more wary about quoting connection parameters.

commit   : b3f5ccebd79d9c7b73f4e04611cdf31fdf87420b    
  
author   : Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 13:45:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sun, 30 Jun 2024 13:45:24 -0400    

Click here for diff

The original coding here could fail with database names, user names,  
etc that contain spaces or other special characters.  
  
As partial test coverage, extend the 040_pg_createsubscriber.pl  
test script so that it uses a generated database name containing  
funny characters.  
  
Hayato Kuroda (some mods by me), per complaint from Noah Misch  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix .gitignore for new injection suite.

commit   : db0c96cc18aec417101e37e59fcc53d4bf647915    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 28 Jun 2024 11:17:50 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 28 Jun 2024 11:17:50 -0700    

Click here for diff

Commit c35f419d6efbdf1a050250d84b687e6705917711 missed this.  

M src/test/modules/injection_points/.gitignore

Remove configuration-dependent output from new inplace-inval test.

commit   : b99414de90520e9605dff9cb645a2a228876862f    
  
author   : Noah Misch <[email protected]>    
date     : Fri, 28 Jun 2024 09:33:40 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Fri, 28 Jun 2024 09:33:40 -0700    

Click here for diff

Per buildfarm members prion and trilobite.  Back-patch to v12 (all  
supported versions), like commit  
0844b3968985447ed0a6937cfc8639e379da2fe6.  
  
Strategy reviewed by Tom Lane.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/isolation/expected/inplace-inval.out
M src/test/isolation/specs/inplace-inval.spec

pgindent, because I forgot to do that.

commit   : b48f275f18d7da4f4863888ad047cbd699698880    
  
author   : Robert Haas <[email protected]>    
date     : Fri, 28 Jun 2024 10:45:51 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Fri, 28 Jun 2024 10:45:51 -0400    

Click here for diff

Commit 065583cf460f980a182498941ac52810f709a897 should have  
included these changes.  

M src/backend/postmaster/walsummarizer.c

SQL/JSON: Always coerce JsonExpr result at runtime

commit   : 716bd12d22c53d1943d41309f2dd061ec601dd5e    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 21:58:13 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 21:58:13 +0900    

Click here for diff

Instead of looking up casts at parse time for converting the result  
of JsonPath* query functions to the specified or the default  
RETURNING type, always perform the conversion at runtime using either  
the target type's input function or the function  
json_populate_type().  
  
There are two motivations for this change:  
  
1. json_populate_type() coerces to types with typmod such that any  
   string values that exceed length limit cause an error instead of  
   silent truncation, which is necessary to be standard-conforming.  
  
2. It was possible to end up with a cast expression that doesn't  
   support soft handling of errors causing bugs in the of handling  
   ON ERROR clause.  
  
JsonExpr.coercion_expr which would store the cast expression is no  
longer necessary, so remove.  
  
Bump catversion because stored rules change because of the above  
removal.  
  
Reported-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Jian He <[email protected]>  
Discussion: Discussion: https://postgr.es/m/202405271326.5a5rprki64aw%40alvherre.pgsql  

M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/jsonfuncs.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/nodes/execnodes.h
M src/include/nodes/primnodes.h
M src/include/utils/jsonfuncs.h
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_jsontable.sql
M src/test/regress/sql/sqljson_queryfuncs.sql

SQL/JSON: Fix coercion of constructor outputs to types with typmod

commit   : c2d93c3802b205d135d1ae1d7ac167d74e08a274    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 21:37:14 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 21:37:14 +0900    

Click here for diff

Ensure SQL/JSON constructor functions that allow specifying the  
target type using the RETURNING clause perform implicit cast to  
that type.  This ensures that output values that exceed the specified  
length produce an error rather than being  silently truncated. This  
behavior conforms to the SQL standard.  
  
Reported-by: Alvaro Herrera <[email protected]>  
Reviewed-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/202405271326.5a5rprki64aw%40alvherre.pgsql  

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

Prevent summarizer hang when summarize_wal turned off and back on.

commit   : 065583cf460f980a182498941ac52810f709a897    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 25 Jun 2024 15:42:36 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 25 Jun 2024 15:42:36 -0400    

Click here for diff

Before this commit, when the WAL summarizer started up or recovered  
from an error, it would resume summarization from wherever it left  
off. That was OK normally, but wrong if summarize_wal=off had been  
turned off temporary, allowing some WAL to be removed, and then turned  
back on again. In such cases, the WAL summarizer would simply hang  
forever. This commit changes the reinitialization sequence for WAL  
summarizer to rederive the starting position in the way we were  
already doing at initial startup, fixing the problem.  
  
Per report from Israel Barth Rubio. Reviewed by Tom Lane.  
  
Discussion: http://postgr.es/m/CA+TgmoYN6x=YS+FoFOS6=nr6=qkXZFWhdiL7k0oatGwug2hcuA@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/postmaster/walsummarizer.c
M src/include/postmaster/walsummarizer.h

SQL/JSON: Validate values in ON ERROR/EMPTY clauses

commit   : 55e56c84da99fe7becda2194563f48bb3083c2d1    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 13:59:57 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 13:59:57 +0900    

Click here for diff

Currently, the grammar allows any supported values in the ON ERROR  
and ON EMPTY clauses for SQL/JSON functions, regardless of whether  
the values are appropriate for the function. This commit ensures  
that during parse analysis, the provided value is checked for  
validity for the given function and throws a syntax error if it is  
not.  
  
While at it, this fixes some omissions in the documentation of the  
ON ERROR/EMPTY clauses for JSON_TABLE().  
  
Reported-by: Jian He <[email protected]>  
Reviewed-by: Jian He <[email protected]>  
Discussion: https://postgr.es/m/CACJufxFgWGqpESSYzyJ6tSurr3vFYBSNEmCfkGyB_dMdptFnZQ%40mail.gmail.com  

M doc/src/sgml/func.sgml
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_jsontable.sql
M src/test/regress/sql/sqljson_queryfuncs.sql

SQL/JSON: Prevent ON EMPTY for EXISTS columns in JSON_TABLE()

commit   : e3c1393efc31ac70de7b68e9a283ec3f2d7f9bd2    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 13:59:13 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 13:59:13 +0900    

Click here for diff

Due to an oversight in de3600452b61, the ON EMPTY clause was  
incorrectly allowed in the EXISTS column. Fix the grammar to prevent  
this.  
  
Discussion: https://postgr.es/m/CA%2BHiwqHh3YDXTpccgAo4CdfV9Mhy%2Bmg%3Doh6t8rfM5uLW1BJN4g%40mail.gmail.com  

M src/backend/parser/gram.y
M src/test/regress/expected/sqljson_jsontable.out
M src/test/regress/sql/sqljson_jsontable.sql

Update modules/injection_points/.gitignore

commit   : 0ad8153c1f4c7129ff19e8a41d142001d35c8514    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 13:41:39 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 13:41:39 +0900    

Click here for diff

Thinko in c35f419d6efb, where an isolation test has been added to the  
module.  

M src/test/modules/injection_points/.gitignore

Fix comments in heaptuple.c

commit   : 526b54ece3f6b0bc474c0498d94780a38a6648a2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 13:30:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 13:30:47 +0900    

Click here for diff

Since e27f4ee0a701, fastgetattr() and heap_getattr() are not macros, but  
inlined functions.  
  
Author: Junwang Zhao  
Reviewed-by: Stepan Neretin  
Discussion: https://postgr.es/m/CAEG8a3JS-JKWWyOcM7BU=vPqFXa3W7mZSHnvc3CBqx=tC+3SCA@mail.gmail.com  

M src/backend/access/common/heaptuple.c

Improve locking around InjectionPointRun()

commit   : d85fc4be11b38afd6d3abb586a6799299ed29470    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 12:31:29 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 28 Jun 2024 12:31:29 +0900    

Click here for diff

As coded, an injection point could be loaded into the local cache  
without the LWLock InjectionPointLock taken, hence a point detached and  
re-attached concurrently of a point running calling InjectionPointRun()  
may finish by loading a callback it did no set initially.  Based on all  
the cases discussed until now on the lists, it is fine to delay the lock  
release until the callback is run, so let's do that.  
  
While on it, remove a useless LWLockRelease() called before an error in  
InjectionPointAttach().  
  
Per discussion with Heikki Linnakangas and Noah Misch.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Remove comment about xl_heap_inplace "AT END OF STRUCT".

commit   : 4a7f91b3d3141e8898211a5b145b3c210b05c288    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:06 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:06 -0700    

Click here for diff

Commit 2c03216d831160bedd72d45f712601b6f7d03f1c moved the tuple data  
from there to the buffer-0 data.  Back-patch to v12 (all supported  
versions), the plan for the next change to this struct.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/include/access/heapam_xlog.h

Cope with inplace update making catcache stale during TOAST fetch.

commit   : f9f47f0d93d1a493a3365625f96026c7b18d7cf5    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:06 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:06 -0700    

Click here for diff

This extends ad98fb14226ae6456fbaed7990ee7591cbe5efd2 to invals of  
inplace updates.  Trouble requires an inplace update of a catalog having  
a TOAST table, so only pg_database was at risk.  (The other catalog on  
which core code performs inplace updates, pg_class, has no TOAST table.)  
Trouble would require something like the inplace-inval.spec test.  
Consider GRANT ... ON DATABASE fetching a stale row from cache and  
discarding a datfrozenxid update that vac_truncate_clog() has already  
relied upon.  Back-patch to v12 (all supported versions).  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/catalog.c
M src/backend/utils/cache/catcache.c
M src/include/catalog/catalog.h

AccessExclusiveLock new relations just after assigning the OID.

commit   : 5b823b179e5e8ab32f140658698ca08f8c83f06e    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

This has no user-visible, important consequences, since other sessions'  
catalog scans can't find the relation until we commit.  However, this  
unblocks introducing a rule about locks required to heap_update() a  
pg_class row.  CREATE TABLE has been acquiring this lock eventually, but  
it can heap_update() pg_class.relchecks earlier.  create_toast_table()  
has been acquiring only ShareLock.  Back-patch to v12 (all supported  
versions), the plan for the commit relying on the new rule.  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/heap.c

Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX.

commit   : 0cecc908e9749101b5e93ba58d76a62c9f226f9e    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

Commit 5b562644fec696977df4a82790064e8287927891 added a comment that  
SetRelationHasSubclass() callers must hold this lock.  When commit  
17f206fbc824d2b4b14480199ca9ff7dea417eda extended use of this column to  
partitioned indexes, it didn't take the lock.  As the latter commit  
message mentioned, we currently never reset a partitioned index to  
relhassubclass=f.  That largely avoids harm from the lock omission.  The  
cause for fixing this now is to unblock introducing a rule about locks  
required to heap_update() a pg_class row.  This might cause more  
deadlocks.  It gives minor user-visible benefits:  
  
- If an ALTER INDEX SET TABLESPACE runs concurrently with ALTER TABLE  
  ATTACH PARTITION or CREATE PARTITION OF, one transaction blocks  
  instead of failing with "tuple concurrently updated".  (Many cases of  
  DDL concurrency still fail that way.)  
  
- Match ALTER INDEX ATTACH PARTITION in choosing to lock the index.  
  
While not user-visible today, we'll need this if we ever make something  
set the flag to false for a partitioned index, like ANALYZE does today  
for tables.  Back-patch to v12 (all supported versions), the plan for  
the commit relying on the new rule.  In back branches, add  
LockOrStrongerHeldByMe() instead of adding a LockHeldByMe() parameter.  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/include/storage/lmgr.h
M src/include/storage/lock.h

Lock owned sequences during ALTER TABLE SET { LOGGED | UNLOGGED }.

commit   : f88cdb36c457f673a1966a22883ce47e565a37db    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

These commands already make the persistence of owned sequences follow  
owned table persistence changes.  They didn't lock those sequences.  
They lost the effect of nextval() calls that other sessions make after  
the ALTER TABLE command, before the ALTER TABLE transaction commits.  
Fix by acquiring the same lock that ALTER SEQUENCE SET { LOGGED |  
UNLOGGED } acquires.  This might cause more deadlocks.  Back-patch to  
v15, where commit 344d62fb9a978a72cf8347f0369b9ee643fd0b31 introduced  
unlogged sequences.  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/sequence.c

Expand comments and add an assertion in nodeModifyTable.c.

commit   : d5f788b41dc2cbdde6e7694c70dda54d829a5ed5    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

Most comments concern RELKIND_VIEW.  One addresses the ExecUpdate()  
"tupleid" parameter.  A later commit will rely on these facts, but they  
hold already.  Back-patch to v12 (all supported versions), the plan for  
that commit.  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/nodeModifyTable.c

Add an injection_points isolation test suite.

commit   : c35f419d6efbdf1a050250d84b687e6705917711    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

Make the isolation harness recognize injection_points wait events as a  
type of blocked state.  Test an extant inplace-update bug.  
  
Reviewed by Robert Haas and Michael Paquier.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/heap/heapam.c
M src/backend/utils/adt/waitfuncs.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/inplace.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/inplace.spec

Create waitfuncs.c for pg_isolation_test_session_is_blocked().

commit   : abfbd13af0e971e8789bc89e7c83ad53a85fa74b    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

The next commit makes the function inspect an additional non-lock  
contention source, so it no longer fits in lockfuncs.c.  
  
Reviewed by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/Makefile
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/waitfuncs.c

Add wait event type "InjectionPoint", a custom type like "Extension".

commit   : bb93640a681c2cc709e9836e169c8f3eb556df57    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

Both injection points and customization of type "Extension" are new in  
v17, so this just changes a detail of an unreleased feature.  
  
Reported by Robert Haas.  Reviewed by Michael Paquier.  
  
Discussion: https://postgr.es/m/CA+TgmobfMU5pdXP36D5iAwxV5WKE_vuDLtp_1QyH+H5jMMt21g@mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/ipci.c
M src/backend/utils/activity/generate-wait_event_types.pl
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/storage/lwlocklist.h
M src/include/utils/wait_event.h
M src/test/modules/injection_points/injection_points.c
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql
M src/tools/pgindent/typedefs.list

Improve test coverage for changes to inplace-updated catalogs.

commit   : 0844b3968985447ed0a6937cfc8639e379da2fe6    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:05 -0700    

Click here for diff

This covers both regular and inplace changes, since bugs arise at their  
intersection.  Where marked, these witness extant bugs.  Back-patch to  
v12 (all supported versions).  
  
Reviewed (in an earlier version) by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/test/isolation/expected/eval-plan-qual.out
A src/test/isolation/expected/inplace-inval.out
A src/test/isolation/expected/intra-grant-inplace-db.out
A src/test/isolation/expected/intra-grant-inplace.out
M src/test/isolation/isolation_schedule
M src/test/isolation/specs/eval-plan-qual.spec
A src/test/isolation/specs/inplace-inval.spec
A src/test/isolation/specs/intra-grant-inplace-db.spec
A src/test/isolation/specs/intra-grant-inplace.spec
M src/test/recovery/t/027_stream_regress.pl
A src/test/regress/expected/database.out
M src/test/regress/expected/merge.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/database.sql
M src/test/regress/sql/merge.sql

Make TAP todo_start effects the same under Meson and prove_check.

commit   : 22a4b104ba70f6f486197ab28a28cd9bcdd4f4ad    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:04 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 27 Jun 2024 19:21:04 -0700    

Click here for diff

This could have caused spurious failures only on SPARC Linux, because  
today's only todo_start tests for that platform.  Back-patch to v16,  
where Meson support first appeared.  
  
Reviewed by Robert Haas.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/testwrap

SQL/JSON: Document behavior when input document is not jsonb

commit   : 473a352fb393519f22cd4d31839ad3d74b1aeea1    
  
author   : Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 09:42:13 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Fri, 28 Jun 2024 09:42:13 +0900    

Click here for diff

The input document to functions JSON_EXISTS(), JSON_QUERY(),  
JSON_VALUE(), and JSON_TABLE() can be specified as character or  
UTF8-encoded bytea strings. These are automatically converted to  
jsonb with an implicit cast before being passed to the jsonpath  
machinery.  
  
In the current implementation, errors that occur when parsing the  
specified string into a valid JSON document are thrown  
unconditionally. This means they are not subject to the explicit or  
implicit ON ERROR clause of those functions, which is a standard-  
conforming behavior.  Add a note to the documentation to mention  
that.  
  
Reported-by: Markus Winand  
Discussion: https://postgr.es/m/F7DD1442-265C-4220-A603-CB0DEB77E91D%40winand.at  

M doc/src/sgml/func.sgml

Avoid crashing when a JIT-inlined backend function throws an error.

commit   : 5d6c64d290978dab76c00460ba809156874be035    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 27 Jun 2024 14:43:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 27 Jun 2024 14:43:59 -0400    

Click here for diff

errfinish() assumes that the __FUNC__ and __FILE__ arguments it's  
passed are compile-time constant strings that can just be pointed  
to rather than physically copied.  However, it's possible for LLVM  
to generate code in which those pointers point into a dynamically  
loaded code segment.  If that segment gets unloaded before we're  
done with the ErrorData struct, we have dangling pointers that  
will lead to SIGSEGV.  In simple cases that won't happen, because we  
won't unload LLVM code before end of transaction.  But it's possible  
to happen if the error is thrown within end-of-transaction code run by  
_SPI_commit or _SPI_rollback, because since commit 2e517818f those  
functions clean up by ending the transaction and starting a new one.  
  
Rather than fixing this by adding pstrdup() overhead to every  
elog/ereport sequence, let's fix it by copying the risky pointers  
in CopyErrorData().  That solves it for _SPI_commit/_SPI_rollback  
because they use that function to preserve the error data across  
the transaction end/restart sequence; and it seems likely that  
any other code doing something similar would need to do that too.  
  
I'm suspicious that this behavior amounts to an LLVM bug (or a  
bug in our use of it?), because it implies that string constant  
references that should be pointer-equal according to a naive  
understanding of C semantics will sometimes not be equal.  
However, even if it is a bug and someday gets fixed, we'll have  
to cope with the current behavior for a long time to come.  
  
Report and patch by me.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix MVCC bug with prepared xact with subxacts on standby

commit   : cbfbda78413a5b2f4807e029407dcc98a0e63162    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 27 Jun 2024 21:06:32 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 27 Jun 2024 21:06:32 +0300    

Click here for diff

We did not recover the subtransaction IDs of prepared transactions  
when starting a hot standby from a shutdown checkpoint. As a result,  
such subtransactions were considered as aborted, rather than  
in-progress. That would lead to hint bits being set incorrectly, and  
the subtransactions suddenly becoming visible to old snapshots when  
the prepared transaction was committed.  
  
To fix, update pg_subtrans with prepared transactions's subxids when  
starting hot standby from a shutdown checkpoint. The snapshots taken  
from that state need to be marked as "suboverflowed", so that we also  
check the pg_subtrans.  
  
Backport to all supported versions.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/include/storage/standby.h
M src/test/recovery/t/009_twophase.pl
M src/tools/pgindent/typedefs.list

tests: Trim newline from result returned by BackgroundPsql->query

commit   : ecbf6ac51df27275fb0db493bf163ef98ac00c6a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 27 Jun 2024 21:06:27 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 27 Jun 2024 21:06:27 +0300    

Click here for diff

This went unnoticed, because only a few existing callers of  
BackgroundPsql->query used the result, and the ones that did were not  
bothered by an extra newline. I noticed because I was about to add a  
new test that checks the result.  
  
Backport to all supported versions, since I just backported the  
BackgroundPsql facility to all supported versions too.  

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

Fix thinkos in comments

commit   : a2dff271ebe2a0547d46e90dcb02c088cf2f031c    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 27 Jun 2024 19:51:47 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 27 Jun 2024 19:51:47 +0200    

Click here for diff

The first one was noticed by Tender Wang and introduced with  
8aba9322511f; the other one was newly introduced with dbca3469ebf8.  

M src/backend/executor/execPartition.c

Drop the temporary tuple slots allocated by pgoutput.

commit   : 3e53492aa7084bceaa92757c90e067d79768797e    
  
author   : Amit Kapila <[email protected]>    
date     : Thu, 27 Jun 2024 11:35:00 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Thu, 27 Jun 2024 11:35:00 +0530    

Click here for diff

In pgoutput, when converting the child table's tuple format to match the  
parent table's, we temporarily create a new slot to store the converted  
tuple. However, we missed to drop such temporary slots, leading to  
resource leakage.  
  
Reported-by: Bowen Shi  
Author: Hou Zhijie  
Reviewed-by: Amit Kapila  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CAM_vCudv8dc3sjWiPkXx5F2b27UV7_YRKRbtSCcE-pv=cVACGA@mail.gmail.com  

M src/backend/replication/pgoutput/pgoutput.c

Fix overflow with pgstats DSA reference count

commit   : 7467939ea226ebc5608285486501b136b642c02b    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 27 Jun 2024 09:44:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 27 Jun 2024 09:44:47 +0900    

Click here for diff

When pgstats is initialized for a backend, it uses dsa_attach_in_place()  
without a "segment" provided.  Hence, no callback is registered to  
automatically release the DSA attached once a backend exits.  Not doing  
any cleanup causes the reference count of the pgstats DSA to  
continuously increment, at some point overflowing it (the more the  
number of connections, the faster it is to reach this state).  Once the  
reference count overflows and then gets back to 0, new backends are not  
able to attach to the pgstats DSA, failing startup.  
  
This issue is resolved by adding in the pgstats shutdown hook a call to  
dsa_release_in_place(), ensuring that the DSA attached at backend  
startup is correctly released, keeping the reference count at bay.  
  
The author of this patch has been able to see this issue on a server  
with a long uptime and a high connection turnover.  
  
Issue introduced by 5891c7a8ed8f, so backpatch down to 15.  
  
Author: Anthonin Bonnefoy  
Discussion: https://postgr.es/m/CAO6_XqqJbJBL=M7Ym13TcB4Xnq58vRa2jcC+gwEPBgbAda6B1Q@mail.gmail.com  
Backpatch-through: 15  

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

Fix bugs in MultiXact truncation

commit   : b1ffe3ff0b7ed87b34ae0fc6eba71bf032e41b59    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Jun 2024 18:31:15 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Jun 2024 18:31:15 +0300    

Click here for diff

1. TruncateMultiXact() performs the SLRU truncations in a critical  
section. Deleting the SLRU segments calls ForwardSyncRequest(), which  
will try to compact the request queue if it's full  
(CompactCheckpointerRequestQueue()). That in turn allocates memory,  
which is not allowed in a critical section. Backtrace:  
  
    TRAP: failed Assert("CritSectionCount == 0 || (context)->allowInCritSection"), File: "../src/backend/utils/mmgr/mcxt.c", Line: 1353, PID: 920981  
    postgres: autovacuum worker template0(ExceptionalCondition+0x6e)[0x560a501e866e]  
    postgres: autovacuum worker template0(+0x5dce3d)[0x560a50217e3d]  
    postgres: autovacuum worker template0(ForwardSyncRequest+0x8e)[0x560a4ffec95e]  
    postgres: autovacuum worker template0(RegisterSyncRequest+0x2b)[0x560a50091eeb]  
    postgres: autovacuum worker template0(+0x187b0a)[0x560a4fdc2b0a]  
    postgres: autovacuum worker template0(SlruDeleteSegment+0x101)[0x560a4fdc2ab1]  
    postgres: autovacuum worker template0(TruncateMultiXact+0x2fb)[0x560a4fdbde1b]  
    postgres: autovacuum worker template0(vac_update_datfrozenxid+0x4b3)[0x560a4febd2f3]  
    postgres: autovacuum worker template0(+0x3adf66)[0x560a4ffe8f66]  
    postgres: autovacuum worker template0(AutoVacWorkerMain+0x3ed)[0x560a4ffe7c2d]  
    postgres: autovacuum worker template0(+0x3b1ead)[0x560a4ffecead]  
    postgres: autovacuum worker template0(+0x3b620e)[0x560a4fff120e]  
    postgres: autovacuum worker template0(+0x3b3fbb)[0x560a4ffeefbb]  
    postgres: autovacuum worker template0(+0x2f724e)[0x560a4ff3224e]  
    /lib/x86_64-linux-gnu/libc.so.6(+0x27c8a)[0x7f62cc642c8a]  
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85)[0x7f62cc642d45]  
    postgres: autovacuum worker template0(_start+0x21)[0x560a4fd16f31]  
  
To fix, bail out in CompactCheckpointerRequestQueue() without doing  
anything, if it's called in a critical section. That covers the above  
call path, as well as any other similar cases where  
RegisterSyncRequest might be called in a critical section.  
  
2. After fixing that, another problem became apparent: Autovacuum  
process doing that truncation can deadlock with the checkpointer  
process. TruncateMultiXact() sets "MyProc->delayChkptFlags |=  
DELAY_CHKPT_START". If the sync request queue is full and cannot be  
compacted, the process will repeatedly sleep and retry, until there is  
room in the queue. However, if the checkpointer is trying to start a  
checkpoint at the same time, and is waiting for the DELAY_CHKPT_START  
processes to finish, the queue will never shrink.  
  
More concretely, the autovacuum process is stuck here:  
  
    #0  0x00007fc934926dc3 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6  
    #1  0x000056220b24348b in WaitEventSetWaitBlock (set=0x56220c2e4b50, occurred_events=0x7ffe7856d040, nevents=1, cur_timeout=<optimized out>) at ../src/backend/storage/ipc/latch.c:1570  
    #2  WaitEventSetWait (set=0x56220c2e4b50, timeout=timeout@entry=10, occurred_events=<optimized out>, occurred_events@entry=0x7ffe7856d040, nevents=nevents@entry=1,  
        wait_event_info=wait_event_info@entry=150994949) at ../src/backend/storage/ipc/latch.c:1516  
    #3  0x000056220b243224 in WaitLatch (latch=<optimized out>, latch@entry=0x0, wakeEvents=wakeEvents@entry=40, timeout=timeout@entry=10, wait_event_info=wait_event_info@entry=150994949)  
        at ../src/backend/storage/ipc/latch.c:538  
    #4  0x000056220b26cf46 in RegisterSyncRequest (ftag=ftag@entry=0x7ffe7856d0a0, type=type@entry=SYNC_FORGET_REQUEST, retryOnError=true) at ../src/backend/storage/sync/sync.c:614  
    #5  0x000056220af9db0a in SlruInternalDeleteSegment (ctl=ctl@entry=0x56220b7beb60 <MultiXactMemberCtlData>, segno=segno@entry=11350) at ../src/backend/access/transam/slru.c:1495  
    #6  0x000056220af9dab1 in SlruDeleteSegment (ctl=ctl@entry=0x56220b7beb60 <MultiXactMemberCtlData>, segno=segno@entry=11350) at ../src/backend/access/transam/slru.c:1566  
    #7  0x000056220af98e1b in PerformMembersTruncation (oldestOffset=<optimized out>, newOldestOffset=<optimized out>) at ../src/backend/access/transam/multixact.c:3006  
    #8  TruncateMultiXact (newOldestMulti=newOldestMulti@entry=3221225472, newOldestMultiDB=newOldestMultiDB@entry=4) at ../src/backend/access/transam/multixact.c:3201  
    #9  0x000056220b098303 in vac_truncate_clog (frozenXID=749, minMulti=<optimized out>, lastSaneFrozenXid=749, lastSaneMinMulti=3221225472) at ../src/backend/commands/vacuum.c:1917  
    #10 vac_update_datfrozenxid () at ../src/backend/commands/vacuum.c:1760  
    #11 0x000056220b1c3f76 in do_autovacuum () at ../src/backend/postmaster/autovacuum.c:2550  
    #12 0x000056220b1c2c3d in AutoVacWorkerMain (startup_data=<optimized out>, startup_data_len=<optimized out>) at ../src/backend/postmaster/autovacuum.c:1569  
  
and the checkpointer is stuck here:  
  
    #0  0x00007fc9348ebf93 in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6  
    #1  0x00007fc9348fe353 in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6  
    #2  0x000056220b40ecb4 in pg_usleep (microsec=microsec@entry=10000) at ../src/port/pgsleep.c:50  
    #3  0x000056220afb43c3 in CreateCheckPoint (flags=flags@entry=108) at ../src/backend/access/transam/xlog.c:7098  
    #4  0x000056220b1c6e86 in CheckpointerMain (startup_data=<optimized out>, startup_data_len=<optimized out>) at ../src/backend/postmaster/checkpointer.c:464  
  
To fix, add AbsorbSyncRequests() to the loops where the checkpointer  
waits for DELAY_CHKPT_START or DELAY_CHKPT_COMPLETE operations to  
finish.  
  
Backpatch to v14. Before that, SLRU deletion didn't call  
RegisterSyncRequest, which avoided this failure. I'm not sure if there  
are other similar scenarios on older versions, but we haven't had  
any such reports.  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

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

doc PG 17 relnotes: fix system catalog name mistake

commit   : f92fd1830715ac2039443756475169a45cae2874    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Jun 2024 15:08:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Jun 2024 15:08:06 -0400    

Click here for diff

Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwYgkaOuao4DXuQwhbg+vyu4Xb5TGpuDNDOfMa0AftyweQ@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: add item about pg_collation column renames

commit   : d537b2e037e580b03c284bf3fcb02be6c3d5c8f2    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 26 Jun 2024 13:13:46 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 26 Jun 2024 13:13:46 -0400    

Click here for diff

Reported-by: David G. Johnston  
  
Discussion: https://postgr.es/m/CAKFQuwYRw30QaWrSsL57k3L_=zdQ4JTgY9pGnnhm42B7fGJX1A@mail.gmail.com  
  
Backpatch-through: master  

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

Use PqMsg_* macros in fe-auth.c.

commit   : 32f07991b728c25bcd2543ef22ec96105e558477    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 26 Jun 2024 11:25:38 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 26 Jun 2024 11:25:38 -0500    

Click here for diff

Commit f4b54e1ed9, which introduced macros for protocol characters,  
missed updating a few places in fe-auth.c.  
  
Author: Jelte Fennema-Nio  
Discussion: https://postgr.es/m/CAGECzQSoPHtZ4xe0raJ6FYSEiPPS%2BYWXBhOGo%2BY1YecLgknF3g%40mail.gmail.com  

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

Fix nbtree array unsatisfied inequality check.

commit   : 486c2ea25c5e7e248c31b2dbb5db8ebcd3c7d813    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 26 Jun 2024 10:45:52 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 26 Jun 2024 10:45:52 -0400    

Click here for diff

_bt_advance_array_keys didn't take sufficient care at the point where it  
decides whether to start a new primitive index scan based on a call to  
_bt_check_compare against finaltup (a call with the scan direction  
flipped around).  The final decision was conditioned on rules about how  
the scan key offset sktrig that initially triggered array advancement  
(passed to _bt_advance_array_keys from its _bt_checkkeys caller)  
compared to the offset set by its own _bt_check_compare finaltup call.  
This approach was faulty, in that it allowed _bt_advance_array_keys to  
incorrectly start a new primitive index scan, that landed on the same  
leaf page (on assert-enabled builds it led to an assertion failure).  
  
In general, scans with array keys are expected to never have to read the  
same leaf page more than once (barring cases involving cursors, and  
cases where the scan restores a marked position for the inner side of a  
merge join).  This principle was established by commit 5bf748b8.  
  
To fix, make the final decision based on whether the scan key offset set  
by the _bt_check_compare finaltup call is an offset to an inequality  
strategy scan key.  An unsatisfied required inequality strategy scan key  
indicates that all of the scan's required equality strategy scan keys  
must also be satisfied by finaltup (not just by caller's tuple), and  
that there is a decent chance that _bt_first will be able to reposition  
the scan to a position many leaf pages ahead of the current leaf page.  
  
Oversight in commit 5bf748b8.  
  
Discussion: https://postgr.es/m/CAH2-Wz=DyHbcg7o6zXqzyiin8WE8vzk4tvU8Lrnh-a=EAvO0TQ@mail.gmail.com  

M src/backend/access/nbtree/nbtutils.c

Fix partition pruning setup during DETACH CONCURRENTLY

commit   : dbca3469ebf8ac523f401dd0c2eaffd9df64078f    
  
author   : Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jun 2024 13:40:26 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Wed, 26 Jun 2024 13:40:26 +0200    

Click here for diff

When detaching partition in concurrent mode, it's possible for partition  
descriptors to not match the set that was recently seen when the plan  
was made, causing an assertion failure or (in production builds) failure  
to construct a working plan.  The case that was reported involves  
prepared statements, but I think it may be possible to hit this bug  
without that too.  
  
The problem is that CreatePartitionPruneState is constructing a  
PartitionPruneState under the assumption that new partitions can be  
added, but never removed, but it turns out that this isn't true: a  
prepared statement gets replanned when the DETACH CONCURRENTLY session  
sends out its invalidation message, but if the invalidation message  
arrives after ExecInitAppend started, we would build a partition  
descriptor without the partition, and then CreatePartitionPruneState  
would refuse to work with it.  
  
CreatePartitionPruneState already contains code to deal with the new  
descriptor having more partitions than before (and behaving for the  
extra partitions as if they had been pruned), but doesn't have code to  
deal with less partitions than before, and it is naïve about the case  
where the number of partitions is the same.  We could simply add that a  
new stanza for less partitions than before, and in simple testing it  
works to do that; but it's possible to press the test scripts even  
further and hit the case where one partition is added and a partition is  
removed quickly enough that we see the same number of partitions, but  
they don't actually match, causing hangs during execution.  
  
To cope with both these problems, we now memcmp() the arrays of  
partition OIDs, and do a more elaborate mapping (relying on the fact  
that both OID arrays are in partition-bounds order) if they're not  
identical.  
  
This fix was already pushed in backbranches earlier.  
  
Reported-by: yajun Hu <[email protected]>  
Reviewed-by: Tender Wang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Improve comment in gram.y.

commit   : 1bf29f51fa1a15bd5d28e64070e6e8d105338fc3    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2024 17:53:41 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 25 Jun 2024 17:53:41 -0400    

Click here for diff

"As so-and-so" isn't bad English, but it has a faintly archaic  
whiff to it, and confuses some non-native speakers.  Write  
"Like so-and-so" instead.  
  
Per complaint from Tatsuo Ishii.  
  
Discussion: https://postgr.es/m/20240623.130154.1867056921698616251.t-ishii@sranhm.sra.co.jp.sranhm  

M src/backend/parser/gram.y

Stamp 17beta2.

commit   : 23c5a0e7d43bc925c6001538f04a458933a11fc1    
  
author   : Joe Conway <[email protected]>    
date     : Mon, 24 Jun 2024 17:24:14 -0400    
  
committer: Joe Conway <[email protected]>    
date     : Mon, 24 Jun 2024 17:24:14 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Revert "Fix partition pruning setup during DETACH CONCURRENTLY"

commit   : b0ea16528cda1f3a993bbfeb2b93eed9762af4e6    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jun 2024 17:20:21 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jun 2024 17:20:21 +0200    

Click here for diff

This reverts commit 27162a64b386; this branch is in code freeze due to a  
nearing release.  We can commit again after the release is out.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Fix partition pruning setup during DETACH CONCURRENTLY

commit   : 27162a64b386a1f639a4f2b96c7cc3b1db192d92    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jun 2024 15:56:32 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 24 Jun 2024 15:56:32 +0200    

Click here for diff

When detaching partition in concurrent mode, it's possible for partition  
descriptors to not match the set that was recently seen when the plan  
was made, causing an assertion failure or (in production builds) failure  
to construct a working plan.  The case that was reported involves  
prepared statements, but I think it may be possible to hit this bug  
without that too.  
  
The problem is that CreatePartitionPruneState is constructing a  
PartitionPruneState under the assumption that new partitions can be  
added, but never removed, but it turns out that this isn't true: a  
prepared statement gets replanned when the DETACH CONCURRENTLY session  
sends out its invalidation message, but if the invalidation message  
arrives after ExecInitAppend started, we would build a partition  
descriptor without the partition, and then CreatePartitionPruneState  
would refuse to work with it.  
  
CreatePartitionPruneState already contains code to deal with the new  
descriptor having more partitions than before (and behaving for the  
extra partitions as if they had been pruned), but doesn't have code to  
deal with less partitions than before, and it is naïve about the case  
where the number of partitions is the same.  We could simply add that a  
new stanza for less partitions than before, and in simple testing it  
works to do that; but it's possible to press the test scripts even  
further and hit the case where one partition is added and a partition is  
removed quickly enough that we see the same number of partitions, but  
they don't actually match, causing hangs during execution.  
  
To cope with both these problems, we now memcmp() the arrays of  
partition OIDs, and do a more elaborate mapping (relying on the fact  
that both OID arrays are in partition-bounds order) if they're not  
identical.  
  
Backpatch to 14, where DETACH CONCURRENTLY appeared.  
  
Reported-by: yajun Hu <[email protected]>  
Reviewed-by: Tender Wang <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/executor/execPartition.c

Translation updates

commit   : f7f4e7e6fa576761f5330963cb7af686957589b4    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 24 Jun 2024 13:11:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 24 Jun 2024 13:11:27 +0200    

Click here for diff

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

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/bin/initdb/po/de.po
M src/bin/initdb/po/ja.po
M src/bin/initdb/po/ka.po
M src/bin/pg_amcheck/po/de.po
M src/bin/pg_amcheck/po/ja.po
M src/bin/pg_amcheck/po/ka.po
M src/bin/pg_archivecleanup/po/de.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/ka.po
M src/bin/pg_checksums/po/de.po
M src/bin/pg_combinebackup/po/de.po
M src/bin/pg_combinebackup/po/ja.po
M src/bin/pg_combinebackup/po/ka.po
M src/bin/pg_config/po/de.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_ctl/po/de.po
M src/bin/pg_dump/po/de.po
M src/bin/pg_dump/po/ja.po
M src/bin/pg_dump/po/ka.po
M src/bin/pg_resetwal/po/de.po
M src/bin/pg_rewind/po/de.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/ja.po
M src/bin/pg_test_timing/po/de.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_verifybackup/po/de.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/ka.po
M src/bin/pg_waldump/po/de.po
M src/bin/pg_walsummary/po/de.po
M src/bin/pg_walsummary/po/ja.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ja.po
M src/bin/psql/po/ka.po
M src/bin/scripts/po/de.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/ka.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ka.po
M src/pl/tcl/po/de.po
M src/pl/tcl/po/ja.po
M src/pl/tcl/po/ka.po

Remove extra comment at TableAmRoutine.scan_analyze_next_block

commit   : 70a845c04a47645b58f8276a6b3ab201ea8ec426    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sat, 22 Jun 2024 16:13:08 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sat, 22 Jun 2024 16:13:08 +0300    

Click here for diff

The extra comment was accidentally copied here by 6377e12a from  
heapam_scan_analyze_next_block().  
  
Reported-by: Matthias van de Meent  
Discussion: https://postgr.es/m/CAEze2WjC5PiweG-4oe0hB_Zr59iF3tRE1gURm8w4Cg5b6JEBGw%40mail.gmail.com  

M src/include/access/tableam.h

commit   : a8ffa32377a765fc8d3c4354cdd5a258f596c810    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Jun 2024 12:08:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Jun 2024 12:08:14 -0400    

Click here for diff

Backpatch-through: master  

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

Fix relcache invalidation when relfilelocator is updated

commit   : 441ef5e1badcc3695de4a865cffb30f0e5057893    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Jun 2024 17:13:10 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Fri, 21 Jun 2024 17:13:10 +0300    

Click here for diff

In commit af0e7deb4a, I removed a call to RelationCloseSmgr(), because  
the dangling SMgrRelation was no longer an issue. However, we still  
need the call when the relation's relfilelocator changes, so that the  
new relfilelocator takes effect immediately.  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/987b1c8c-8c91-4847-ca0e-879f421680ff%40gmail.com  

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

commit   : 90fe7b74df976324d7c0b3d203b25b7333447ca3    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 21 Jun 2024 10:11:12 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 21 Jun 2024 10:11:12 -0400    

Click here for diff

Backpatch-through: master  

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

Add doc entry for the new GUC paramenter enable_group_by_reordering

commit   : 82e79ee46b1c880cb7376cf4399c9883c1ddfaea    
  
author   : Alexander Korotkov <[email protected]>    
date     : Fri, 21 Jun 2024 15:39:13 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Fri, 21 Jun 2024 15:39:13 +0300    

Click here for diff

0452b461bc4 adds alternative orderings of group-by keys during the query  
optimization. This new feature is controlled by the new GUC parameter  
enable_group_by_reordering, which accidentally came without the documentation.  
This commit adds the missing documentation for that GUC.  
  
Reported-by: Bruce Momjian  
Discussion: https://postgr.es/m/ZnDx2FYlba_OafQd%40momjian.us  
Author: Andrei Lepikhov  
Reviewed-by: Pavel Borisov, Alexander Korotkov  

M doc/src/sgml/config.sgml

Prevent access of uninitialized memory in radix tree nodes

commit   : fd49e8f32325c675d9bb6e26fcdbe9754249932f    
  
author   : John Naylor <[email protected]>    
date     : Fri, 21 Jun 2024 14:59:11 +0700    
  
committer: John Naylor <[email protected]>    
date     : Fri, 21 Jun 2024 14:59:11 +0700    

Click here for diff

RT_NODE_16_SEARCH_EQ() performs comparisions using vector registers  
on x64-64 and aarch64. We apply a mask to the resulting bitfield  
to eliminate irrelevant bits that may be set. This ensures correct  
behavior, but Valgrind complains of the partially-uninitialised  
values. So far the warnings have only occurred on aarch64, which  
explains why this hasn't been seen earlier.  
  
To fix this warning, initialize the whole fixed-sized part of the nodes  
upon allocation, rather than just do the minimum initialization to  
function correctly. The initialization for node48 is a bit different  
in that the 256-byte slot index array must be populated with "invalid  
index" rather than zero. Experimentation has shown that compilers  
tend to emit code that uselessly memsets that array twice. To avoid  
pessimizing this path, swap the order of the slot_idxs[] and isset[]  
arrays so we can initialize with two non-overlapping memset calls.  
  
Reported by Tomas Vondra  
Analysis and patch by Tom Lane, reviewed by Masahiko Sawada. I  
investigated the behavior of memset calls to overlapping regions,  
leading to the above tweaks to node48 as discussed in the thread.  
  
Discussion: https://postgr.es/m/120c63ad-3d12-415f-a7bf-3da451c31bf6%40enterprisedb.com  

M src/include/lib/radixtree.h

pg_combinebackup: Error message improvements

commit   : c5c82123d3050c3a5eef0f51e9783f1cc5004ba0    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 09:40:44 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 09:40:44 +0200    

Click here for diff

Make the wordings of some file-related error messages more like those  
used in other files.  

M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/copy_file.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

Remove redundant newlines from error messages

commit   : aea79883c57a522f0234d135fe0a3de19178a964    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 09:29:34 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 09:29:34 +0200    

Click here for diff

M src/bin/pg_combinebackup/pg_combinebackup.c

Fix make build on MinGW

commit   : 58445651dbc6182e1ff4100f6428ba6a261407f9    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 08:17:23 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 08:17:23 +0200    

Click here for diff

Revert a couple of the simplifications done in commit 721856ff24b  
because platforms without ln -s, where LN_S='cp -pR', such as MinGW,  
required the specific previous incantations.  
  
Reported-by: Noah Misch <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/Makefile

parse_manifest: Use const char *

commit   : 02bbc3c83aec597e4b8c873916e9e29f3d02b132    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    

Click here for diff

This adapts the manifest parsing code to take advantage of the  
const-ified jsonapi.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org  

M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_combinebackup/load_manifest.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/common/parse_manifest.c
M src/include/common/parse_manifest.h

jsonapi: Use const char *

commit   : 15cd9a3881b030a1a4bddc809f038f86ec27e66d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    

Click here for diff

Apply const qualifiers to char * arguments and fields throughout the  
jsonapi.  This allows the top-level APIs such as  
pg_parse_json_incremental() to declare their input argument as const.  
It also reduces the number of unconstify() calls.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org  

M src/backend/utils/adt/jsonfuncs.c
M src/common/jsonapi.c
M src/include/common/jsonapi.h

jsonapi: Use size_t

commit   : 0b06bf9fa972e2964401622f1bb4c611dbe92bd5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 21 Jun 2024 07:50:02 +0200    

Click here for diff

Use size_t instead of int for object sizes in the jsonapi.  This makes  
the API better self-documenting.  
  
Reviewed-by: Andrew Dunstan <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/f732b014-f614-4600-a437-dba5a2c3738b%40eisentraut.org  

M src/common/jsonapi.c
M src/common/parse_manifest.c
M src/include/common/jsonapi.h
M src/include/common/parse_manifest.h

Doc: Generated columns are skipped for logical replication.

commit   : 7a089f6e6a14ca3a5dc8822c393c6620279968b9    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 21 Jun 2024 09:55:25 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 21 Jun 2024 09:55:25 +0530    

Click here for diff

Add a note in docs that generated columns are skipped for logical  
replication.  
  
Author: Peter Smith  
Reviewed-by: Peter Eisentraut  
Backpatch-through: 12  
Discussion: https://postgr.es/m/CAHut+PuXb1GLQztQkoWzYjSwkAZZ0dgCJaAHyJtZF3kmtcL=kA@mail.gmail.com  

M doc/src/sgml/ddl.sgml

doc PG 17 relnotes: remove mention of undocumented GUC

commit   : 95cabf542f04b634303f899600ea62fb256a08c2    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 20 Jun 2024 19:53:01 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 20 Jun 2024 19:53:01 -0400    

Click here for diff

GUC is trace_connection_negotiation.  If it is undocumented, we should  
not mention it in the release notes.  
  
Backpatch-through: master  

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

Don't throw an error if a queued AFTER trigger no longer exists.

commit   : e6d0d16adf7fb7e715314d5068db4b875c3edf00    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 20 Jun 2024 14:21:36 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 20 Jun 2024 14:21:36 -0400    

Click here for diff

afterTriggerInvokeEvents and AfterTriggerExecute have always  
treated it as an error if the trigger OID mentioned in a queued  
after-trigger event can't be found.  However, that fails to  
account for the edge case where the trigger's been dropped in  
the current transaction since queueing the event.  There seems  
no very good reason to disallow that case, so instead silently  
do nothing if the trigger OID can't be found.  
  
This does give up a little bit of bug-detection ability, but I don't  
recall that these error messages have ever actually revealed a bug,  
so it seems mostly theoretical.  Alternatives such as marking  
pending events DONE at the time of dropping a trigger would be  
complicated and perhaps introduce bugs of their own.  
  
Per bug #18517 from Alexander Lakhin.  Back-patch to all  
supported branches.  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_combinebackup: Fix small mistake in --help output

commit   : ab4346ebbfef44db857321d74bc0c31e03a72514    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:49:01 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:49:01 +0200    

Click here for diff

It was not showing that the --output option takes an argument.  

M src/bin/pg_combinebackup/pg_combinebackup.c

pg_createsubscriber: Indent --help output correctly

commit   : d048a327890851f37c8a0d0b8522cb8064ad7cfc    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:42:40 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:42:40 +0200    

Click here for diff

It was using 1 space indent instead of the 2 spaces used everywhere  
else.  

M src/bin/pg_basebackup/pg_createsubscriber.c

pg_dump: Fix weird error message composition

commit   : 3639d08e2f36f76e9a626c60b534c7fe204f329c    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:36:38 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:36:38 +0200    

Click here for diff

The previous way could make it look like "stdin" was the actual input  
file name.  Write it as two separate messages instead.  

M src/bin/pg_dump/filter.c

Fix redundancy in error messages

commit   : 16a3415440ecf2f5cd02848fc05cbfe040ce14c2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:17:21 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:17:21 +0200    

Click here for diff

pg_log_error() already prints the program name, so we don't need to  
print it again inside the message.  

M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_walsummary/pg_walsummary.c

Unify some error messages

commit   : 95b44bb025b5d13c673662af68a218bd1873861f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:10:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 11:10:26 +0200    

Click here for diff

M contrib/pg_prewarm/autoprewarm.c
M src/backend/postmaster/bgworker.c

meson: Fix import library name in Windows

commit   : c61c0cb3a99285db36806b592bd8c540c98757e5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 08:09:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 20 Jun 2024 08:09:28 +0200    

Click here for diff

This changes the import library name from 'postgres.exe.lib' to  
'postgres.lib', which is what it was with the old MSVC build system.  
Extension builds use that name.  
  
Bug: #18513  
Reported-by: Muralikrishna Bandaru <[email protected]>  

M meson.build
M src/backend/meson.build

Fix comment in pg_upgrade.h.

commit   : 832dc19ea681a54c153228a96112bea68dbff022    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 19 Jun 2024 16:12:18 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 19 Jun 2024 16:12:18 -0500    

Click here for diff

Contrary to what the comment for the "check" struct member claims,  
'pg_upgrade --check' performs only the checks and does not ask the  
user for permission to make changes.  
  
Reviewed-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/ZnHk7ci5IuTWVc_c%40nathan  

M src/bin/pg_upgrade/pg_upgrade.h

SQL/JSON: Correctly enforce the default ON EMPTY behavior

commit   : 03ec203164119f11f0eab4c83c97a8527e2b108d    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 19 Jun 2024 15:22:59 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 19 Jun 2024 15:22:59 +0900    

Click here for diff

Currently, when the ON EMPTY clause is not present, the ON ERROR  
clause (implicit or explicit) dictates the behavior when jsonpath  
evaluation in ExecEvalJsonExprPath() results in an empty sequence.  
That is an oversight in the commit 6185c9737c.  
  
This commit fixes things so that a NULL is returned instead in that  
case which is the default behavior when the ON EMPTY clause is not  
present.  
  
Reported-by: Markus Winand  
Discussion: https://postgr.es/m/F7DD1442-265C-4220-A603-CB0DEB77E91D%40winand.at  

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

SQL/JSON: Correct jsonpath variable name matching

commit   : 0f271e8e8d9c8db0ea86c0d12b3221009b81d8bf    
  
author   : Amit Langote <[email protected]>    
date     : Wed, 19 Jun 2024 15:22:06 +0900    
  
committer: Amit Langote <[email protected]>    
date     : Wed, 19 Jun 2024 15:22:06 +0900    

Click here for diff

Previously, GetJsonPathVar() allowed a jsonpath expression to  
reference any prefix of a PASSING variable's name. For example, the  
following query would incorrectly work:  
  
SELECT JSON_QUERY(context_item, jsonpath '$xy' PASSING val AS xyz);  
  
The fix ensures that the length of the variable name mentioned in a  
jsonpath expression matches exactly with the name of the PASSING  
variable before comparing the strings using strncmp().  
  
Reported-by: Alvaro Herrera (off-list)  
Discussion: https://postgr.es/m/CA+HiwqFGkLWMvELBH6E4SQ45qUHthgcRH6gCJL20OsYDRtFx_w@mail.gmail.com  

M src/backend/executor/execExpr.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/jsonpath.h
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_queryfuncs.sql

doc PG 17 relnotes: properly wrap SGML text

commit   : 5e05a0e9924e97c24be13c75e4ba12c60bd0e4ad    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 18 Jun 2024 22:41:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 18 Jun 2024 22:41:49 -0400    

Click here for diff

Backpatch-through: master  

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

commit   : 5ade0b8f80cdbb715bc3904ac7d4281a75817911    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 18 Jun 2024 22:09:41 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 18 Jun 2024 22:09:41 -0400    

Click here for diff

Also slightly improve markup instructions.  Indentation is still needed.  
  
Backpatch-through: master  

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

Fix possible Assert failure in cost_memoize_rescan

commit   : aa901a37cf8aaf36b0dabaaea42ea3d068fe3448    
  
author   : David Rowley <[email protected]>    
date     : Wed, 19 Jun 2024 10:20:24 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 19 Jun 2024 10:20:24 +1200    

Click here for diff

In cost_memoize_rescan(), when calculating the hit_ratio using the calls  
and ndistinct estimations, if the value that was set in  
MemoizePath.calls had not been processed through clamp_row_est(), then it  
was possible that it was set to some non-integer value which could result  
in ndistinct being 1 higher than calls due to estimate_num_groups()  
performing clamp_row_est() on its input_rows.  This could result in  
hit_ratio values slightly below 0.0, which would cause an Assert failure.  
  
The value of MemoizePath.calls comes from the final parameter in the  
create_memoize_path() function, of which we only have one true caller of.  
That caller passes outer_path->rows.  All the core code I looked at  
always seems to call clamp_row_est() on the Path.rows, so there might  
have been no issues with any core Paths causing troubles here.  The bug  
report was about a CustomPath with a non-clamped row estimated.  
  
The misbehavior as a result of this seems to be mostly limited to the  
Assert() failing.  Aside from that, it seems the Memoize costs would  
just come out slightly higher than they should have, which is likely  
fairly harmless.  
  
Reported-by: Kohei KaiGai <[email protected]>  
Discussion: https://postgr.es/m/CAOP8fzZnTU+N64UYJYogb1hN-5hFP+PwTb3m_cnGAD7EsQwrKw@mail.gmail.com  
Reviewed-by: Richard Guo  
Backpatch-through: 14, where Memoize was introduced  

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

Fix incorrect punctuation in error message

commit   : 5603e119f4bd4818f8fa432ffc177c3caf9efeb6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jun 2024 14:53:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 18 Jun 2024 14:53:11 +0200    

Click here for diff

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

Fix typo in 029_stats_restart.pl

commit   : ae482a7ec521e09bb0dbfc261da6e6170a5ac29f    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 18 Jun 2024 12:51:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 18 Jun 2024 12:51:36 +0900    

Click here for diff

Oversight in 16acf7f1aaea, where the test has been introduced.  Issue  
noticed while scanning this area of the tree.  

M src/test/recovery/t/029_stats_restart.pl

doc PG 17 relnotes: update to current

commit   : 82ed67a5fe826044bf361ad0425283d05f3dcf95    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 17 Jun 2024 15:05:05 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 17 Jun 2024 15:05:05 -0400    

Click here for diff

Backpatch-through: master  

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

doc PG 17 relnotes: Fix sslnegotation typo

commit   : a6685c5e362eab5d04b8ffe65fff7cfbd21b6034    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 17 Jun 2024 11:53:07 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 17 Jun 2024 11:53:07 -0700    

Click here for diff

I was confused with copy-pasting the parameter name didn't work...  

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

Fix insertion of SP-GiST REDIRECT tuples during REINDEX CONCURRENTLY.

commit   : 92c49d1062f7094f56b80c603233fa4a0ffe2f8b    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 14:30:59 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 14:30:59 -0400    

Click here for diff

Reconstruction of an SP-GiST index by REINDEX CONCURRENTLY may  
insert some REDIRECT tuples.  This will typically happen in  
a transaction that lacks an XID, which leads either to assertion  
failure in spgFormDeadTuple or to insertion of a REDIRECT tuple  
with zero xid.  The latter's not good either, since eventually  
VACUUM will apply GlobalVisTestIsRemovableXid() to the zero xid,  
resulting in either an assertion failure or a garbage answer.  
  
In practice, since REINDEX CONCURRENTLY locks out index scans  
till it's done, it doesn't matter whether it inserts REDIRECTs  
or PLACEHOLDERs; and likewise it doesn't matter how soon VACUUM  
reduces such a REDIRECT to a PLACEHOLDER.  So in non-assert builds  
there's no observable problem here, other than perhaps a little  
index bloat.  But it's not behaving as intended.  
  
To fix, remove the failing Assert in spgFormDeadTuple, acknowledging  
that we might sometimes insert a zero XID; and guard VACUUM's  
GlobalVisTestIsRemovableXid() call with a test for valid XID,  
ensuring that we'll reduce such a REDIRECT the first time VACUUM  
sees it.  (Versions before v14 use TransactionIdPrecedes here,  
which won't fail on zero xid, so they really have no bug at all  
in non-assert builds.)  
  
Another solution could be to not create REDIRECTs at all during  
REINDEX CONCURRENTLY, making the relevant code paths treat that  
case like index build (which likewise knows that no concurrent  
index scans can be happening).  That would allow restoring the  
Assert in spgFormDeadTuple, but we'd still need the VACUUM change  
because redirection tuples with zero xid may be out there already.  
But there doesn't seem to be a nice way for spginsert() to tell that  
it's being called in REINDEX CONCURRENTLY without some API changes,  
so we'll leave that as a possible future improvement.  
  
In HEAD, also rename the SpGistState.myXid field to redirectXid,  
which seems less misleading (since it might not in fact be our  
transaction's XID) and is certainly less uninformatively generic.  
  
Per bug #18499 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h

Remove recordExtensionInitPriv[Worker]'s ownerId argument.

commit   : ba26d156636c84a9674e49dbdfe788b6291985f2    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 13:00:53 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 13:00:53 -0400    

Click here for diff

In the wake of the previous commit, we're not doing anything  
with that argument.  Hence, revert the portions of 534287403  
that added that argument and taught the callers to pass it.  
Passing the ownerId requires additional syscache lookups in  
some code paths, which'd be fine if we were doing anything  
useful with the info, but it seems inadvisable if we're not.  
  
Committed separately since there's some thought that we might  
want to un-revert this in future, in case it's decided that  
storing the original owner ID explicitly in pg_init_privs  
is worth doing.  
  
Discussion: https://postgr.es/m/CAMT0RQSVgv48G5GArUvOVhottWqZLrvC5wBzBa4HrUdXe9VRXw@mail.gmail.com  

M src/backend/catalog/aclchk.c

Improve tracking of role dependencies of pg_init_privs entries.

commit   : 35dd40d34cbdf5aa3e0f5b3493c33d00abb26456    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 12:55:10 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 17 Jun 2024 12:55:10 -0400    

Click here for diff

Commit 534287403 invented SHARED_DEPENDENCY_INITACL entries in  
pg_shdepend, but installed them only for non-owner roles mentioned  
in a pg_init_privs entry.  This turns out to be the wrong thing,  
because there is nothing to cue REASSIGN OWNED to go and update  
pg_init_privs entries when the object's ownership is reassigned.  
That leads to leaving dangling entries in pg_init_privs, as  
reported by Hannu Krosing.  Instead, install INITACL entries for  
all roles mentioned in pg_init_privs entries (except pinned roles),  
and change ALTER OWNER to not touch them, just as it doesn't  
touch pg_init_privs entries.  
  
REASSIGN OWNED will now substitute the new owner OID for the old  
in pg_init_privs entries.  This feels like perhaps not quite the  
right thing, since pg_init_privs ought to be a historical record  
of the state of affairs just after CREATE EXTENSION.  However,  
it's hard to see what else to do, if we don't want to disallow  
dropping the object's original owner.  In any case this is  
better than the previous do-nothing behavior, and we're unlikely  
to come up with a superior solution in time for v17.  
  
While here, tighten up some coding rules about how ACLs in  
pg_init_privs should never be null or empty.  There's not any  
obvious reason to allow that, and perhaps asserting that it's  
not so will catch some bugs.  (We were previously inconsistent  
on the point, with some code paths taking care not to store  
empty ACLs and others not.)  
  
This leaves recordExtensionInitPrivWorker not doing anything  
with its ownerId argument, but we'll deal with that separately.  
  
catversion bump forced because of change of expected contents  
of pg_shdepend when pg_init_privs entries exist.  
  
Discussion: https://postgr.es/m/CAMT0RQSVgv48G5GArUvOVhottWqZLrvC5wBzBa4HrUdXe9VRXw@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_shdepend.c
M src/backend/utils/adt/acl.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/utils/acl.h
M src/test/modules/test_pg_dump/expected/test_pg_dump.out
M src/test/modules/test_pg_dump/sql/test_pg_dump.sql

Teach jsonpath string() to unwrap in lax mode

commit   : 653d3969bb013f14c4a6884a253ad9676caf8166    
  
author   : Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jun 2024 10:31:29 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Mon, 17 Jun 2024 10:31:29 -0400    

Click here for diff

This was an ommission in commit 66ea94e, and brings it into compliance  
with both other methods and the standard.  
  
Per complaint from David Wheeler.  
  
Author: David Wheeler, Jeevan Chalke  
Reviewed-by: Chapman Flack  
  
Discussion: https://postgr.es/m/[email protected]  

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

pg_createsubscriber: Remove failover replication slots on subscriber

commit   : 81d20fbf7a03f5e385700c90aec883c96b32ddc6    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 12:12:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 12:12:49 +0200    

Click here for diff

After running pg_createsubscriber, these replication slots have no use  
on subscriber, so drop them.  
  
Author: Euler Taveira <[email protected]>  
Reviewed-by: Hayato Kuroda <[email protected]>  
Discussion: https://www.postgresql.org/message-id/776c5cac-5ef5-4001-b1bc-5b698bc0c62a%40app.fastmail.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

pg_createsubscriber: Remove replication slot check on primary

commit   : b96391382626306c301b67cbd2d28313d96741f3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 10:48:17 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 10:48:17 +0200    

Click here for diff

It used to check if the replication slot exists and is active on  
primary.  This check might fail on slow hosts because the replication  
slot might not be active at the time of this check.  
  
The current code obtains the replication slot name from the  
primary_slot_name on standby and assumes the replication slot exists  
and is active on primary.  If it doesn't exist, this tool will log an  
error and continue.  
  
Author: Euler Taveira <[email protected]>  
Reviewed-by: Hayato Kuroda <[email protected]>  
Discussion: https://www.postgresql.org/message-id/776c5cac-5ef5-4001-b1bc-5b698bc0c62a%40app.fastmail.com  

M src/bin/pg_basebackup/pg_createsubscriber.c

pg_createsubscriber: Only --recovery-timeout controls the end of recovery process

commit   : 04c8634c0c4d636540c9283efdd695558403dc4e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 09:42:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 17 Jun 2024 09:42:51 +0200    

Click here for diff

It used to check if the target server is connected to the primary  
server (send required WAL) to rapidly react when the process won't  
succeed.  This code is not enough to guarantee that the recovery  
process will complete.  There is a window between the walreceiver  
shutdown and the pg_is_in_recovery() returns false that can reach  
NUM_CONN_ATTEMPTS attempts and fails.  
  
Instead, rely only on the --recovery-timeout option to give up the  
process after the specified number of seconds.  
  
This should help with buildfarm failures on slow machines.  
  
Author: Euler Taveira <[email protected]>  
Reviewed-by: Hayato Kuroda <[email protected]>  
Discussion: https://www.postgresql.org/message-id/776c5cac-5ef5-4001-b1bc-5b698bc0c62a%40app.fastmail.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

Make regress function make_tuple_indirect() able to handle plain attributes

commit   : 8f1888eb6d6023b80525fbf7a8a1053daa6eb31e    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2024 14:26:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2024 14:26:27 +0900    

Click here for diff

The function has been introduced in 368202501539 to test at a low level  
the new kinds of external toast datums, and would fail on OOM when  
dealing with a plain storage attribute.  The existing tests of  
indirect_toast do not test this case, still the error generated was  
confusing.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/regress/regress.c

doc: Mention modules/injection_points as example for injection points

commit   : faaa0d279899f037b4a6472a00fcd14a321e64c7    
  
author   : Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2024 13:49:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Mon, 17 Jun 2024 13:49:40 +0900    

Click here for diff

This should have been added in 49cd2b93d7db, that introduced the module.  
  
Reported-by: Jian He  
Discussion: https://postgr.es/m/CACJufxF+Vfj2Oz2kBR5v1bjHeZxvs63cLogm70v9Uto1Rqiieg@mail.gmail.com  

M doc/src/sgml/xfunc.sgml

Add Windows file version information to test_json_parser programs.

commit   : 645bda2a7155fff57cc3da2ab923202187c72957    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 16 Jun 2024 12:29:30 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 16 Jun 2024 12:29:30 -0700    

Click here for diff

M src/test/modules/test_json_parser/Makefile

Remove use of %z in sscanf.

commit   : 8866ed9560576de9dec628d5bfdb1571ec8d8ef0    
  
author   : Noah Misch <[email protected]>    
date     : Sun, 16 Jun 2024 12:29:25 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Sun, 16 Jun 2024 12:29:25 -0700    

Click here for diff

As in 9d7ded0f4277f5c0063eca8e871a34e2355a8371, it causes warnings on  
some MinGW compilers.  

M src/test/modules/test_json_parser/test_json_parser_incremental.c

Convert confusing macros in multixact.c to static inline functions

commit   : 0099b9408e8c74158976c888854e0caafd6c052a    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sun, 16 Jun 2024 20:47:07 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sun, 16 Jun 2024 20:47:07 +0300    

Click here for diff

The macros were confused about the argument data types. All the  
arguments were called 'xid', and some of the macros included casts to  
TransactionId, even though the arguments were actually either  
MultiXactIds or MultiXactOffsets. It compiles to the same thing,  
because TransactionId, MultiXactId and MultiXactOffset are all  
typedefs of uint32, but it was highly misleading.  
  
Author: Maxim Orlov <[email protected]>  
Discussion: https://www.postgresql.org/message-id/CACG%3DezbLUG-OD1osAW3OchOMxZtdxHh2itYR9Zhh-a13wEBEQw%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/ff143b24-a093-40da-9833-d36b83726bdf%40iki.fi  

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

doc: fix typo in create role manual.

commit   : 92aff003d7f20810d7c8fbe13cbe5fb041cc6242    
  
author   : Tatsuo Ishii <[email protected]>    
date     : Sun, 16 Jun 2024 16:21:46 +0900    
  
committer: Tatsuo Ishii <[email protected]>    
date     : Sun, 16 Jun 2024 16:21:46 +0900    

Click here for diff

There was a small mistake in the create role manual.  
  
Author: Satoru Koizumi  
Reviewed-by: David G. Johnston  
Discussion: https://postgr.es/m/flat/20240616.112523.1208348667552014162.t-ishii%40sranhm.sra.co.jp  
Backpatch-through: 16  

M doc/src/sgml/ref/create_role.sgml

Clean out column-level pg_init_privs entries when dropping tables.

commit   : 76618097a6c027ec603a3dd143f61098e3fb9794    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Jun 2024 16:20:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Jun 2024 16:20:35 -0400    

Click here for diff

DeleteInitPrivs did not get the memo about how, when dropping a  
whole object (with subid == 0), you should drop entries relating  
to its sub-objects too.  This is visible in the test_pg_dump test  
case if one drops the extension at the end: the entry for  
	GRANT SELECT(col1) ON regress_pg_dump_table TO public;  
was still present in pg_init_privs afterwards, although it was  
pointing to a dangling table OID.  
  
Noted while fooling with a fix for REASSIGN OWNED for pg_init_privs  
entries.  This bug is aboriginal in the pg_init_privs feature  
though, and there seems no reason not to back-patch the fix.  

M src/backend/catalog/dependency.c
M src/test/modules/test_pg_dump/expected/test_pg_dump.out
M src/test/modules/test_pg_dump/sql/test_pg_dump.sql

Fix misc_sanity test to accept SHARED_DEPENDENCY_INITACL entries.

commit   : 01aa88f71208c2af143b044553b89df4438de33e    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 14 Jun 2024 15:29:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 14 Jun 2024 15:29:09 -0400    

Click here for diff

Oversight in 534287403.  We missed this up to now because the  
core regression tests create no such entries (at least up to  
this test), so the only way to see the failure is to do  
"make installcheck" in an installation where some other DB  
has such entries.  I happened to do that just now ...  

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

Reintroduce dead tuple counter in pg_stat_progress_vacuum.

commit   : f1affb67055c9b3f31a7ee7eb521a9ba64fff488    
  
author   : Masahiko Sawada <[email protected]>    
date     : Fri, 14 Jun 2024 10:08:15 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Fri, 14 Jun 2024 10:08:15 +0900    

Click here for diff

Commit 667e65aac3 changed both num_dead_tuples and max_dead_tuples  
columns to dead_tuple_bytes and max_dead_tuple_bytes columns,  
respectively. But as per discussion, the number of dead tuples  
collected still provides meaningful insights for users.  
  
This commit reintroduces the column for the count of dead tuples,  
renamed as num_dead_item_ids. It avoids confusion with the number of  
dead tuples removed by VACUUM, which includes dead heap-only tuples  
but excludes any pre-existing LP_DEAD items left behind by  
opportunistic pruning.  
  
Bump catalog version.  
  
Reviewed-by: Peter Geoghegan, Álvaro Herrera, Andrey Borodin  
Discussion: https://postgr.es/m/CAD21AoBL5sJE9TRWPyv%2Bw7k5Ee5QAJqDJEDJBUdAaCzGWAdvZw%40mail.gmail.com  

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

Fix parsing of ignored operators in websearch_to_tsquery().

commit   : 56a8296212b68267dc2bddeb1fb40a893b1aadb3    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 20:34:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 20:34:42 -0400    

Click here for diff

The manual says clearly that punctuation in the input of  
websearch_to_tsquery() is ignored, except for the special cases  
of dashes and quotes.  However, this failed for cases like  
"(foo bar) or something", or in general an ISOPERATOR character  
in front of the "or".  We'd switch back to WAITOPERAND state,  
then ignore the operator character while remaining in that state,  
and then reach the "or" in WAITOPERAND state which (intentionally)  
makes us treat it as data.  
  
The fix is simple enough: if we see an ISOPERATOR character while in  
WAITOPERATOR state, we have to skip it while staying in that state.  
(We don't need to worry about other punctuation characters: those will  
be consumed as though they were words, but then rejected by lexizing.)  
  
In v14 and up (since commit eb086056f) we can simplify the code a bit  
more too, because there is no longer a reason for the WAITOPERAND  
state to distinguish between quoted and unquoted operands.  
  
Per bug #18479 from Manos Emmanouilidis.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/utils/adt/tsquery.c
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/tsearch.sql

doc: Fix description WAL summarizer in glossary

commit   : d872e1b4730b793c9d72c80b65feb988269104e2    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2024 09:28:11 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2024 09:28:11 +0900    

Click here for diff

The WAL summarizer is an auxiliary process.  
  
Oversight in 7b1dbf0a8d1d.  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/glossary.sgml

doc: Fix description WAL writer in glossary

commit   : 3c992361cda184ff635a516832dcc54c569ea6ec    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2024 09:26:32 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 14 Jun 2024 09:26:32 +0900    

Click here for diff

The WAL writer is an auxiliary process, but its description in the  
glossary did not match that.  
  
This is inexact since d3014fff4cd4.  
  
Author: Masahiro Ikeda  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

M doc/src/sgml/glossary.sgml

Improve the granularity of PQsocketPoll's timeout parameter.

commit   : 105024a47238e33647d346264b4f6fe68a7287ed    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 15:14:32 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 15:14:32 -0400    

Click here for diff

Commit f5e4dedfa exposed libpq's internal function PQsocketPoll  
without a lot of thought about whether that was an API we really  
wanted to chisel in stone.  The main problem with it is the use of  
time_t to specify the timeout.  While we do want an absolute time  
so that a loop around PQsocketPoll doesn't have problems with  
timeout slippage, time_t has only 1-second resolution.  That's  
already problematic for libpq's own internal usage --- for example,  
pqConnectDBComplete has long had a kluge to treat "connect_timeout=1"  
as 2 seconds so that it doesn't accidentally round to nearly zero.  
And it's even less likely to be satisfactory for external callers.  
Hence, let's change this while we still can.  
  
The best idea seems to be to use an int64 count of microseconds since  
the epoch --- basically the same thing as the backend's TimestampTz,  
but let's use the standard Unix epoch (1970-01-01) since that's more  
likely for clients to be easy to calculate.  Millisecond resolution  
would be plenty for foreseeable uses, but maybe the day will come that  
we're glad we used microseconds.  
  
Also, since time(2) isn't especially helpful for computing timeouts  
defined this way, introduce a new function PQgetCurrentTimeUSec  
to get the current time in this form.  
  
Remove the hack in pqConnectDBComplete, so that "connect_timeout=1"  
now means what you'd expect.  
  
We can also remove the "#include <time.h>" that f5e4dedfa added to  
libpq-fe.h, since there's no longer a need for time_t in that header.  
It seems better for v17 not to enlarge libpq-fe.h's include footprint  
from what it's historically been, anyway.  
  
I also failed to resist the temptation to do some wordsmithing  
on PQsocketPoll's documentation.  
  
Patch by me, per complaint from Dominique Devienne.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/tools/pgindent/typedefs.list

When replanning a plpgsql "simple expression", check it's still simple.

commit   : 6dfac24401b7143ad5c75f991c18105e1267f88e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 13:37:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 13 Jun 2024 13:37:46 -0400    

Click here for diff

The previous coding here assumed that we didn't need to recheck any  
of the querytree tests made in exec_simple_check_plan().  I think  
we supposed that those properties were fully determined by the  
syntax of the source text and hence couldn't change.  That is true  
for most of them, but at least hasTargetSRFs and hasAggs can change  
by dint of forcibly dropping an originally-referenced function and  
recreating it with new properties.  That leads to "unexpected plan  
node type" or similar failures.  
  
These tests are pretty cheap compared to the cost of replanning, so  
rather than sweat over exactly which properties need to be rechecked,  
let's just recheck them all.  Hence, factor out those tests into a new  
function exec_is_simple_query(), and rearrange callers as needed.  
  
A second problem in the same area was that if we failed during  
replanning or during exec_save_simple_expr(), we'd potentially  
leave behind now-dangling pointers to the old simple expression,  
potentially resulting in crashes later.  To fix, clear those pointers  
before replanning.  
  
The v12 code looks quite different in this area but still has the  
bug about needing to recheck query simplicity.  I chose to back-patch  
all of the plpgsql_simple.sql test script, which formerly didn't exist  
in this branch.  
  
Per bug #18497 from Nikita Kalinin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpgsql/src/expected/plpgsql_simple.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_simple.sql

Clamp result of MultiXactMemberFreezeThreshold

commit   : c425113eebb7dbc7f0031ed97b32f267a9cac75f    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Jun 2024 19:01:30 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 13 Jun 2024 19:01:30 +0300    

Click here for diff

The purpose of the function is to reduce the effective  
autovacuum_multixact_freeze_max_age if the multixact members SLRU is  
approaching wraparound, to make multixid freezing more aggressive.  
The returned value should therefore never be greater than plain  
autovacuum_multixact_freeze_max_age.  
  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/[email protected]  
Backpatch-through: 12, all supported versions  

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

Skip some permissions checks on Cygwin

commit   : f83908798f78c4cafda217ca875602c88ea2ae28    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 13 Jun 2024 07:38:48 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 13 Jun 2024 07:38:48 -0400    

Click here for diff

These are checks that are already skipped on other Windows systems.  
  
Backpatch to all live branches, as appropriate.  

M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_verifybackup/t/003_corruption.pl

Add postgres_inc to meson check for Python.h

commit   : 11b9b8ce44a8cc80cbef6ade2b5ae7438227da79    
  
author   : Andrew Dunstan <[email protected]>    
date     : Thu, 13 Jun 2024 07:30:10 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Thu, 13 Jun 2024 07:30:10 -0400    

Click here for diff

Required for Cygwin.  
  
Backpatch to release 16.  

M meson.build

Fix documentation of initdb --show option

commit   : a41106dab72cbcaa02fce8bda8965d04e85f2d3a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 11:52:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 11:52:35 +0200    

Click here for diff

It wasn't in the documentation at all (even though we document all the  
other debugging-like options).  Also, change the --help output to show  
that it exits after showing, similar to other options.  

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

Add missing source files to nls.mk

commit   : ad8877cb513733d8bb98d24770a094b81c27e4c5    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 10:17:36 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 10:17:36 +0200    

Click here for diff

Files in common/ and fe_utils/ that contain translatable strings need  
to be listed in the nls.mk files of the programs that use them.  (Not  
great, but that's the way it works for now.)  This usually requires  
some manual analysis which is done about once during each major  
release beta period.  This time, I wrote a hackish script that figures  
some of this out more automatically, so this update is a bit larger as  
it also includes some files that were missed in the past.  

M src/bin/initdb/nls.mk
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_archivecleanup/nls.mk
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_config/nls.mk
M src/bin/pg_controldata/nls.mk
M src/bin/pg_ctl/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/pg_test_fsync/nls.mk
M src/bin/pg_test_timing/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_verifybackup/nls.mk
M src/bin/pg_waldump/nls.mk
M src/bin/pg_walsummary/nls.mk
M src/bin/psql/nls.mk
M src/bin/scripts/nls.mk

libpq: Some message style normalization

commit   : 6ac5600a36c1950e1470ccb16038e6b8ca4e6eba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 07:10:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 13 Jun 2024 07:10:35 +0200    

Click here for diff

M src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c

Harmonize pg_bsd_indent parameter names.

commit   : 99b99285e5438ee8b0c065db58e87e6577158d22    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jun 2024 18:04:10 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jun 2024 18:04:10 -0400    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in pg_bsd_indent.  
  
This commit was written with help from clang-tidy, by mechanically  
applying the same rules as similar clean-up commits.  
  
Discussion: https://postgr.es/m/CAH2-WzkaBS8w-vCbG5M5Bx7XikC0WhNLJV_+Z_YAWW9Kef6OBQ@mail.gmail.com  

M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/indent.c

Harmonize function parameter names for Postgres 17.

commit   : 6207f08f700ddc874765919202727fb0171b5403    
  
author   : Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jun 2024 17:01:51 -0400    
  
committer: Peter Geoghegan <[email protected]>    
date     : Wed, 12 Jun 2024 17:01:51 -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.  These  
inconsistencies were all introduced during Postgres 17 development.  
  
pg_bsd_indent still has a couple of similar inconsistencies, which I  
(pgeoghegan) have left untouched for now.  
  
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 src/backend/access/brin/brin.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_zstd.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/path/joinrels.c
M src/backend/parser/parse_expr.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/utils/adt/jsonpath_exec.c
M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/include/access/heapam.h
M src/include/common/unicode_case.h
M src/include/common/unicode_category.h
M src/include/libpq/libpq.h
M src/include/postmaster/postmaster.h
M src/include/storage/bufmgr.h
M src/include/storage/fd.h
M src/include/storage/read_stream.h
M src/include/storage/smgr.h
M src/include/utils/guc.h
M src/include/utils/jsonpath.h
M src/include/utils/pg_locale.h
M src/include/utils/resowner.h
M src/include/utils/tuplesort.h

libpq: Add missing gettext markers

commit   : a0fe90efef91fcd578a85a0f0c5bcab55285b1d7    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 15:31:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 15:31:31 +0200    

Click here for diff

Follow-up to 87d2801d4b: That commit restored some lost error  
messages, but they ended up in a place where xgettext wouldn't find  
them.  Rather than elevating ENCRYPTION_NEGOTIATION_FAILED() to a  
gettext trigger, it's easiest for now to put in some explicit  
libpq_gettext() calls in the couple of call sites.  

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

libpq: Remove a gettext marker

commit   : d112ea46813277351b577ee586c6e84e7de8ab27    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 08:43:43 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 08:43:43 +0200    

Click here for diff

This one error message is just a workaround for a missing OpenSSL  
error string.  But OpenSSL does not have gettext support, so we don't  
need to provide it in our workaround either.  That way, the  
user-facing behavior is consistent whether the user has a fixed  
OpenSSL or not.  

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

Fix typo in error message

commit   : f376996bb7fe621ac53279a81d475b214e492018    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 04:48:39 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 12 Jun 2024 04:48:39 +0200    

Click here for diff

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

Fix segmentation fault in test_tidstore.

commit   : 18404ea60141a2e2eaf58a5ebbd2b99f7a0cd442    
  
author   : Masahiko Sawada <[email protected]>    
date     : Wed, 12 Jun 2024 09:56:13 +0900    
  
committer: Masahiko Sawada <[email protected]>    
date     : Wed, 12 Jun 2024 09:56:13 +0900    

Click here for diff

The do_set_block_offsets() and other functions accessing the tidstore  
did not check if the tidstore was NULL. This led to a segmentation  
fault when these functions are called without calling the  
test_create().  
  
This commit adds NULL checks in relevant functions of test_tidstore to  
raise an error instead if the tidstore is not initialized.  
  
Bug: #18483  
Reported-by: Alexander Kozhemyakin  
Reviewed-by: Michael Paquier  
Discussion: https://postgr.es/m/18483-30bfff42de238000%40postgresql.org  

M src/test/modules/test_tidstore/test_tidstore.c

Fix infer_arbiter_indexes() to not assume resultRelation is 1.

commit   : 915de706d28c433283e9dc63701e8f978488a2b9    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 11 Jun 2024 17:57:46 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 11 Jun 2024 17:57:46 -0400    

Click here for diff

infer_arbiter_indexes failed to renumber varnos in index expressions  
or predicates that it got from the catalogs.  This escaped detection  
up to now because the stored varnos in such trees will be 1, and an  
INSERT's result relation is usually the first rangetable entry,  
so that that was fine.  However, in cases such as inserting through  
an updatable view, it's not fine, leading to failure to match the  
expressions to the query with ensuing "there is no unique or exclusion  
constraint matching the ON CONFLICT specification" errors.  
  
Fix by copy-and-paste from get_relation_info().  
  
Per bug #18502 from Michael Wang.  Back-patch to all supported  
versions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql

Fix creation of partition descriptor during concurrent detach

commit   : c2fab70248d8b9f129d2333c91b7a6e279a591e3    
  
author   : Alvaro Herrera <[email protected]>    
date     : Tue, 11 Jun 2024 11:38:45 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Tue, 11 Jun 2024 11:38:45 +0200    

Click here for diff

When a partition is being detached in concurrent mode, it is possible  
for find_inheritance_children_extended() to return that partition in the  
list, and immediately after that receive an invalidation message that  
sets its relpartbound to NULL just before we read it.  (This can happen  
because table_open() reads invalidation messages.)  Currently we raise  
an error  
  ERROR:  missing relpartbound for relation %u  
about the situation, but that's bogus because the table is no longer a  
partition, so we shouldn't be complaining about it.  A better reaction  
is to retry the find_inheritance_children_extended call to get a new  
list, which will no longer have the partition being detached.  
  
Noticed while investigating bug #18377.  
  
Backpatch to 14, where DETACH CONCURRENTLY appeared.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/partitioning/partdesc.c

Fix an assert in CheckPointReplicationSlots().

commit   : d1ffcc7fa3c54de8b2a677a3e503fc808c7b419c    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Jun 2024 10:51:34 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Jun 2024 10:51:34 +0530    

Click here for diff

Commit e0b2eed047 assumed that the confirmed_flush LSN can't go backward.  
However, it is possible that confirmed_flush LSN can go backward  
temporarily when the client acknowledges a prior value of flush location.  
This can happen when the client (subscriber in this case) acknowledges an  
LSN it doesn't have to do anything for (say for DDLs) and thus didn't  
store persistently. After restart, the client sends the prior value of  
flush LSN which it had stored persistently and the server updates the  
confirmed_flush LSN with that value.  
  
The fix is to remove the assumption and not allow the prior value of  
confirmed_flush LSN to be flushed to the disk.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila, Shlok Kyal  
Discussion: https://postgr.es/m/CALDaNm3hgow2+oEov5jBk4iYP5eQrUCF1yZtW7+dV3J__p4KLQ@mail.gmail.com  

M src/backend/replication/slot.c

Doc: Fix ambuiguity in column lists.

commit   : 3470391e169ed46fa646ea39ade4b9b6898adb17    
  
author   : Amit Kapila <[email protected]>    
date     : Tue, 11 Jun 2024 09:39:52 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Tue, 11 Jun 2024 09:39:52 +0530    

Click here for diff

The behavior for columns added later to the table for publications with no  
specified column lists was not clear.  
  
Reported-by: Koen De Groote  
Author: Peter Smith  
Reviewed-by: Vignesh C, Laurenz Albe  
Backpatch-through: 15  
Discussion: https://postgr.es/m/[email protected]  

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

doc: Mention all options equivalent to pg_dump --filter patterns.

commit   : c50d4f4028e5518511b9bfc3a17860a90dc88357    
  
author   : Dean Rasheed <[email protected]>    
date     : Mon, 10 Jun 2024 14:55:41 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Mon, 10 Jun 2024 14:55:41 +0100    

Click here for diff

In the documentation for pg_dump's new --filter option, added by  
commit a5cf808be5, each object pattern should match some other  
existing pg_dump option, but some had been omitted, so add them.  
  
Noted by Daniel Gustafsson, reviewed by Ayush Vatsa.  
  
Discussion: https://postgr.es/m/CAEZATCWtVUt51B6BjTUQoS4dcNyOBj%2B04ngL7HSH3ehBXTUt%3Dw%40mail.gmail.com  

M doc/src/sgml/ref/pg_dump.sgml

Fix comment about cross-checking the varnullingrels

commit   : 3cb19f45a3f58fb482999be5fae6ecad74f7fa27    
  
author   : Richard Guo <[email protected]>    
date     : Mon, 10 Jun 2024 13:05:20 +0900    
  
committer: Richard Guo <[email protected]>    
date     : Mon, 10 Jun 2024 13:05:20 +0900    

Click here for diff

The nullingrels match checks are not limited to debugging builds.  
Oversight in commit 867be9c07.  
  
Author: Richard Guo  
Reviewed-by: Alvaro Herrera, Tom Lane, Robert Haas  
Discussion: https://postgr.es/m/CAMbWs4_SDsdYD7DdQw7RXc3jv3axbg+RGZ7aSi9GaqX=F8hNVw@mail.gmail.com  

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

Fix RBM_ZERO_AND_LOCK.

commit   : e656657f2b93a96b83fd4038ec5120c5ec9845e5    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 10 Jun 2024 11:43:41 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 10 Jun 2024 11:43:41 +1200    

Click here for diff

Commit 210622c6 accidentally zeroed out pages even if they were found in  
the buffer pool.  It should always lock the page, but it should only  
zero pages that were not already valid.  Otherwise, concurrent readers  
that hold only a pin could see corrupted page contents changing under  
their feet.  
  
While here, rename ZeroAndLockBuffer() to match the RBM_ flag name.  
Also restore a some useful comments lost by 210622c6's refactoring, and  
add some new ones to clarify why we need to use the BM_IO_IN_PROGRESS  
infrastructure despite not doing I/O.  
  
Reported-by: Noah Misch <[email protected]>  
Reported-by: Alexander Lakhin <[email protected]>  
Reviewed-by: Alvaro Herrera <[email protected]> (earlier version)  
Reviewed-by: Robert Haas <[email protected]> (earlier version)  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/7ed10231-ce47-03d5-d3f9-4aea0dc7d5a4%40gmail.com  

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

Tighten test_predtest's input checks, and improve error messages.

commit   : 00ac25a3c365004821e819653c3307acd3294818    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 16:45:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 16:45:56 -0400    

Click here for diff

test_predtest() neglected to consider the possibility that  
SPI_plan_get_cached_plan would return NULL.  This led to a core  
dump if the input (incorrectly) contains more than one SQL  
command.  
  
While here, let's expend more than zero effort on the error  
message for this case and nearby ones.  
  
Per (half of) bug #18483 from Alexander Kozhemyakin.  
Back-patch to all supported branches, not because this is  
very significant (it's merely test scaffolding) but to make  
our world a bit safer for fuzz testing.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/test_predtest/test_predtest.c

Reject modifying a temp table of another session with ALTER TABLE.

commit   : 7ed8ce8a469b02fa58276c6035758749ae469bcf    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 14:50:09 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 14:50:09 -0400    

Click here for diff

Normally this case isn't even reachable by non-superusers, since  
permissions checks prevent naming such a table.  However, it is  
possible to make it happen by altering a parent table whose child  
is another session's temp table.  
  
We definitely can't support any such ALTER that requires modifying  
the contents of such a table, since we lack access to the other  
session's temporary-buffer pool.  But there seems no good reason  
to allow it even if it'd only require changing catalog contents.  
One reason not to allow it is that we'd rather not expose the  
implementation-dependent behavior of whether a specific ALTER  
requires touching the table contents.  Another is that there may  
be (in future, even if not today) optimizations that assume that  
a session's own temp tables won't be modified by other sessions.  
  
Hence, add a RELATION_IS_OTHER_TEMP() check to all the places  
where ALTER TABLE currently does CheckTableNotInUse().  (I looked  
through all other callers of CheckTableNotInUse(), and they seem  
OK already.)  
  
Per bug #18492 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/tablecmds.c

Fix behavior of stable functions called from a CALL's argument list.

commit   : 2dc1deaea0354ce8427abd8c6b11f9c004a65f24    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 13:27:26 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 7 Jun 2024 13:27:26 -0400    

Click here for diff

If the CALL is within an atomic context (e.g. there's an outer  
transaction block), _SPI_execute_plan should acquire a fresh snapshot  
to execute any such functions with.  We failed to do that and instead  
passed them the Portal snapshot, which had been acquired at the start  
of the current SQL command.  This'd lead to seeing stale values of  
rows modified since the start of the command.  
  
This is arguably a bug in 84f5c2908: I failed to see that "are we in  
non-atomic mode" needs to be defined the same way as it is further  
down in _SPI_execute_plan, i.e. check !_SPI_current->atomic not just  
options->allow_nonatomic.  Alternatively the blame could be laid on  
plpgsql, which is unconditionally passing allow_nonatomic = true  
for CALL/DO even when it knows it's in an atomic context.  However,  
fixing it in spi.c seems like a better idea since that will also fix  
the problem for any extensions that may have copied plpgsql's coding  
pattern.  
  
While here, update an obsolete comment about _SPI_execute_plan's  
snapshot management.  
  
Per report from Victor Yegorov.  Back-patch to all supported versions.  
  
Discussion: https://postgr.es/m/CAGnEboiRe+fG2QxuBO2390F7P8e2MQ6UyBjZSL_w1Cej+E4=Vw@mail.gmail.com  

M doc/src/sgml/spi.sgml
M src/backend/executor/spi.c
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql

Add more debugging information when dropping twice pgstats entry

commit   : d92573adcb02564439086d1c257d7821606a3115    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 7 Jun 2024 18:46:13 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 7 Jun 2024 18:46:13 +0900    

Click here for diff

Floris Van Nee has reported a bug in the pgstats facility where a stats  
entry already dropped would get again dropped.  This case should not  
happen, still the error generated did not offer any details about the  
stats entry getting dropped.  
  
This commit improves the error message generated to inform about the  
stats entry kind, database OID, object OID and refcount, which should  
help to debug more the problem reported.  Bertrand Drouvot has been  
independently able to reach this error path while writing a new feature,  
and more details about the failure would have been helpful for  
debugging.  
  
Author: Andres Freund, Bertrand Drouvot  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/ZkM30paAD8Cr/[email protected]  
Backpatch-through: 15  

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

postgres_fdw: Refuse to send FETCH FIRST WITH TIES to remote servers.

commit   : 8cfbac1492bddc6a81c1c3794355e1d7ac82e957    
  
author   : Etsuro Fujita <[email protected]>    
date     : Fri, 7 Jun 2024 17:45:00 +0900    
  
committer: Etsuro Fujita <[email protected]>    
date     : Fri, 7 Jun 2024 17:45:00 +0900    

Click here for diff

Previously, when considering LIMIT pushdown, postgres_fdw failed to  
check whether the query has this clause, which led to pushing false  
LIMIT clauses, causing incorrect results.  
  
This clause has been supported since v13, so we need to do a  
remote-version check before deciding that it will be safe to push such a  
clause, but we do not currently have a way to do the check (without  
accessing the remote server); disable pushing such a clause for now.  
  
Oversight in commit 357889eb1.  Back-patch to v13, where that commit  
added the support.  
  
Per bug #18467 from Onder Kalaci.  
  
Patch by Japin Li, per a suggestion from Tom Lane, with some changes to  
the comments by me.  Review by Onder Kalaci, Alvaro Herrera, and me.  
  
Discussion: https://postgr.es/m/18467-7bb89084ff03a08d%40postgresql.org  

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

meson: Restore implicit warning/debug/optimize flags for extensions

commit   : 3482bab5e30a0cc7fba4c904ba21b4957b2876bd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Jun 2024 08:50:51 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Jun 2024 08:50:51 +0200    

Click here for diff

Meson uses warning/debug/optimize flags such as "-Wall", "-g", and  
"-O2" automatically based on "--warnlevel" and "--buildtype" options.  
And we use "--warning_level=1" and "--buildtype=debugoptimized" by  
default.  
  
But we need these flags for Makefile.global (for extensions) and  
pg_config, so we need to compute them manually based on the  
higher-level options.  
  
Without this change, extensions building using pgxs wouldn't get -Wall  
or optimization options.  
  
Author: Sutou Kouhei <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/20240122.141139.931086145628347157.kou%40clear-code.com  

M meson.build
M src/include/meson.build

Doc: Add the new section "Logical Replication Failover".

commit   : b560a98a17aebf3fabbb8dec89f506b52e61c26b    
  
author   : Amit Kapila <[email protected]>    
date     : Fri, 7 Jun 2024 11:59:27 +0530    
  
committer: Amit Kapila <[email protected]>    
date     : Fri, 7 Jun 2024 11:59:27 +0530    

Click here for diff

This aids the users to ensure that the failover marked slots are synced  
to the standby and subscribers can continue replication even when the  
publisher node goes down.  
  
Author: Hou Zhijie, Shveta Malik, Amit Kapila  
Reviewed-by: Peter Smith, Bertrand Drouvot  
Discussion: https://postgr.es/m/OS0PR01MB57164D6F53FB4F6AD29AD9C594FB2@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml

doc: Fix copy-and-paste mistake

commit   : 4b8791743e0e2c7134ac915ad2aa01ecf6b6571e    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 7 Jun 2024 08:02:15 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 7 Jun 2024 08:02:15 +0200    

Click here for diff

The wording from the "columns" view was copied to the "attributes"  
view without the required adjustments.  

M doc/src/sgml/information_schema.sgml

Collation documentation fixes.

commit   : 8ba34c698d19450ccae9a5aea59a6d0bc8b75c0e    
  
author   : Jeff Davis <[email protected]>    
date     : Thu, 6 Jun 2024 16:40:03 -0700    
  
committer: Jeff Davis <[email protected]>    
date     : Thu, 6 Jun 2024 16:40:03 -0700    

Click here for diff

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

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml

meson: Add user-provided c_args to bitcode_cflags

commit   : 1039352e10caf640b070e8bfe37573630efcaacd    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2024 22:13:18 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2024 22:13:18 +0200    

Click here for diff

This is needed for example to pass an include path set in the CPPFLAGS  
environment variable to the bitcode compile command.  
  
Discussion: https://www.postgresql.org/message-id/flat/c1384a7b-ed12-4862-a0da-a05c7945171a%40eisentraut.org  

M src/backend/jit/llvm/meson.build

Add meson NLS support for pg_walsummary

commit   : b0f2659c7d9bdf3ccfdd1548dfecf602b901f507    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2024 21:21:58 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 6 Jun 2024 21:21:58 +0200    

Click here for diff

M src/bin/pg_walsummary/meson.build
A src/bin/pg_walsummary/po/meson.build

Fix failure with SQL-procedure polymorphic output arguments in v12.

commit   : 7515982636902ad1e945b4606b02ee706dadb83e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 6 Jun 2024 15:16:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 6 Jun 2024 15:16:56 -0400    

Click here for diff

Before the v13-era commit 913bbd88d, check_sql_fn_retval fails to  
resolve polymorphic output types and then just throws up its hands and  
assumes the check will be made at runtime.  I think that's true for  
ordinary functions returning RECORD, but it doesn't happen in CALL,  
potentially resulting in crashes if the actual output of the SQL  
procedure's SELECT doesn't match the type inferred from polymorphism.  
With a little bit of rearrangement, we can use get_call_result_type  
instead of get_func_result_type and thereby infer the correct types.  
  
I'm still unwilling to back-patch all of 913bbd88d, so if the types  
don't match you'll get an error rather than perhaps silently inserting  
a cast as v13 and later can.  That's consistent with prior behavior  
though, so it seems fine.  
  
Prior to 70ffb27b2, you'd typically get other errors due to other  
shortcomings of CALL's management of polymorphism.  Nonetheless,  
this is an independent bug.  
  
Although there is no bug in v13 and up, it seems prudent to add  
the test case for this to the newer branches too.  It's clearly  
an under-tested area.  
  
Per report from Andrew Bille.  
  
Discussion: https://postgr.es/m/CAJnzarw9EeWHAQRm76dXd=7j+rgw6ERqC=nCay8jeFqTwKwhqQ@mail.gmail.com  

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

Make RelationFlushRelation() work without ResourceOwner during abort

commit   : e6cd85772647099563da5ada53bd6ab7d096ce00    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jun 2024 18:56:28 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 6 Jun 2024 18:56:28 +0300    

Click here for diff

ReorderBufferImmediateInvalidation() executes invalidation messages in  
an aborted transaction. However, RelationFlushRelation sometimes  
required a valid resource owner, to temporarily increment the refcount  
of the relache entry. Commit b8bff07daa worked around that in the main  
subtransaction abort function, AbortSubTransaction(), but missed this  
similar case in ReorderBufferImmediateInvalidation().  
  
To fix, introduce a separate function to invalidate a relcache  
entry. It does the same thing as RelationClearRelation(rebuild==true)  
does when outside a transaction, but can be called without  
incrementing the refcount.  
  
Add regression test. Before this fix, it failed with:  
  
ERROR: ResourceOwnerEnlarge called after release started  
  
Reported-by: Alexander Lakhin <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/sql/decoding_in_xact.sql
M src/backend/access/transam/xact.c
M src/backend/utils/cache/relcache.c

Restore preprocess_groupclause()

commit   : 505c008ca37c4f6f2fffcde370b5d8354c4d4dc3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:44:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:44:34 +0300    

Click here for diff

0452b461bc made optimizer explore alternative orderings of group-by pathkeys.  
It eliminated preprocess_groupclause(), which was intended to match items  
between GROUP BY and ORDER BY.  Instead, get_useful_group_keys_orderings()  
function generates orderings of GROUP BY elements at the time of grouping  
paths generation.  The get_useful_group_keys_orderings() function takes into  
account 3 orderings of GROUP BY pathkeys and clauses: original order as written  
in GROUP BY, matching ORDER BY clauses as much as possible, and matching the  
input path as much as possible.  Given that even before 0452b461b,  
preprocess_groupclause() could change the original order of GROUP BY clauses  
we don't need to consider it apart from ordering matching ORDER BY clauses.  
  
This commit restores preprocess_groupclause() to provide an ordering of  
GROUP BY elements matching ORDER BY before generation of paths.  The new  
version of preprocess_groupclause() takes into account an incremental sort.  
The get_useful_group_keys_orderings() function now takes into 2 orderings of  
GROUP BY elements: the order generated preprocess_groupclause() and the order  
matching the input path as much as possible.  
  
Discussion: https://postgr.es/m/CAPpHfdvyWLMGwvxaf%3D7KAp-z-4mxbSH8ti2f6mNOQv5metZFzg%40mail.gmail.com  
Author: Alexander Korotkov  
Reviewed-by: Andrei Lepikhov, Pavel Borisov  

M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/partition_aggregate.out

Rename PathKeyInfo to GroupByOrdering

commit   : 0c1af2c35c7b456bd2fc76bbc9df5aa9c7911bde    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:43:24 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:43:24 +0300    

Click here for diff

0452b461bc made optimizer explore alternative orderings of group-by pathkeys.  
The PathKeyInfo data structure was used to store the particular ordering of  
group-by pathkeys and corresponding clauses.  It turns out that PathKeyInfo  
is not the best name for that purpose.  This commit renames this data structure  
to GroupByOrdering, and revises its comment.  
  
Discussion: https://postgr.es/m/db0fc3a4-966c-4cec-a136-94024d39212d%40postgrespro.ru  
Reported-by: Tom Lane  
Author: Andrei Lepikhov  
Reviewed-by: Alexander Korotkov, Pavel Borisov  

M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/include/nodes/pathnodes.h
M src/tools/pgindent/typedefs.list

Add invariants check to get_useful_group_keys_orderings()

commit   : 91143c03d4ca36406a53e05cd421b19e47d131d1    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:42:47 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:42:47 +0300    

Click here for diff

This commit introduces invariants checking of generated orderings  
in get_useful_group_keys_orderings() for assert-enabled builds.  
  
Discussion: https://postgr.es/m/a663f0f6-cbf6-49aa-af2e-234dc6768a07%40postgrespro.ru  
Reported-by: Tom Lane  
Author: Andrei Lepikhov  
Reviewed-by: Alexander Korotkov, Pavel Borisov  

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

Fix asymmetry in setting EquivalenceClass.ec_sortref

commit   : 199012a3d844c6283e0ab4b1139440840a91433d    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:41:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 6 Jun 2024 13:41:34 +0300    

Click here for diff

0452b461bc made get_eclass_for_sort_expr() always set  
EquivalenceClass.ec_sortref if it's not done yet.  This leads to an asymmetric  
situation when whoever first looks for the EquivalenceClass sets the  
ec_sortref.  It is also counterintuitive that get_eclass_for_sort_expr()  
performs modification of data structures.  
  
This commit makes make_pathkeys_for_sortclauses_extended() responsible for  
setting EquivalenceClass.ec_sortref.  Now we set the  
EquivalenceClass.ec_sortref's needed to explore alternative GROUP BY ordering  
specifically during building pathkeys by the list of grouping clauses.  
  
Discussion: https://postgr.es/m/17037754-f187-4138-8285-0e2bfebd0dea%40postgrespro.ru  
Reported-by: Tom Lane  
Author: Andrei Lepikhov  
Reviewed-by: Alexander Korotkov, Pavel Borisov  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/include/optimizer/paths.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql

doc PG 17 relnotes: adjust integer bin/oct funcs and psql tab

commit   : f654f000ddfd2c8724d0d7085087424f6ab51515    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 5 Jun 2024 20:52:54 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 5 Jun 2024 20:52:54 -0400    

Click here for diff

Reported-by: Dean Rasheed  
  
Discussion: https://postgr.es/m/CAEZATCXiNyExAXxKCO1h6oBB2nbfq9PtdA1nQowRsVFW1eD_MQ@mail.gmail.com  
  
Backpatch-through: master  

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

Prevent inconsistent use of stats entry for replication slots

commit   : cd312adc561a0de056bbc0b0087d275bd3e9f282    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 6 Jun 2024 08:47:40 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 6 Jun 2024 08:47:40 +0900    

Click here for diff

Concurrent activity around replication slot creation and drop could  
cause a replication slot to use a stats entry it should not have used  
when created, triggering an assertion failure when retrieving an  
inconsistent entry from the dshash table used by the stats facility.  
  
The issue is that pgstat_drop_replslot() calls pgstat_drop_entry()  
without checking the result.  If pgstat_drop_entry() cannot free the  
entry related to the object dropped, pgstat_request_entry_refs_gc()  
should be called.  AtEOXact_PgStat_DroppedStats() and surrounding  
routines dropping stats entries already do that.  
  
This is documented in pgstat_internal.h, but let's add a comment at the  
top of pgstat_drop_entry() as that can be easy to miss.  
  
Reported-by: Alexander Lakhin  
Author: Floris Van Nee  
Analyzed-by: Andres Freund  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 15  

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

Fix documentation for POSIX semaphores.

commit   : 8111e80c5d39451c0cbff91d5a6b69fd87c3928c    
  
author   : Nathan Bossart <[email protected]>    
date     : Wed, 5 Jun 2024 15:32:47 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Wed, 5 Jun 2024 15:32:47 -0500    

Click here for diff

The documentation for POSIX semaphores is missing a reference to  
max_wal_senders.  This commit fixes that in the same way that  
commit 4ebe51a5fb fixed the same issue in the documentation for  
System V semaphores.  
  
Discussion: https://postgr.es/m/20240517164452.GA1914161%40nathanxps13  
Backpatch-through: 12  

M doc/src/sgml/runtime.sgml

Move new SLRU buffers GUCs to a better place in postgresql.conf.sample

commit   : b6dbbaa3028f0da01cd4716f8d9c1c766b103cba    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2024 20:24:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 5 Jun 2024 20:24:41 +0200    

Click here for diff

They were under "File Locations", which doesn't make sense.  Move them  
to Resource Usage / Memory, which matches their categorization in the  
source code and in the documentation.  

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

doc: Fix example with database regexp in HBA documentation

commit   : fbff304c574971d15981a080cea8d5a710b81d4d    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 5 Jun 2024 19:56:51 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 5 Jun 2024 19:56:51 +0900    

Click here for diff

This HBA entry was using "local" while specifying an address, which was  
incorrect.  While in it, this adjusts the format of the entry to be  
aligned with the surroundings.  
  
Oversight in 8fea86830e1d.  
  
Reported-by: Stéphane Schildknecht  
Reviewed-by: David G. Johnston  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 16  

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

Fix some grammatical errors in some comments

commit   : 7b71e5bbccd6c86bc12ba0124e7282cfb3aa3226    
  
author   : David Rowley <[email protected]>    
date     : Wed, 5 Jun 2024 21:31:28 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 5 Jun 2024 21:31:28 +1200    

Click here for diff

Introduced by 9f1337639.  
  
Author: James Coleman <[email protected]>  
Discussion: https://postgr.es/m/CAAaqYe9ZQ_1+QiF_Nv7b37opicBu+35ZQK1CetQ54r5UdrF1eg@mail.gmail.com  

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

Fix pl/tcl's handling of errors from Tcl_ListObjGetElements().

commit   : b631d014987b9411ed0eeb7dcba9e0a8599bc3cf    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 4 Jun 2024 18:02:13 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 4 Jun 2024 18:02:13 -0400    

Click here for diff

In a procedure or function returning tuple, we use that function to  
parse the Tcl script's result, which is supposed to be a Tcl list.  
If it isn't, you get an error.  Commit 26abb50c4 incautiously  
supposed that we could use throw_tcl_error() to report such an error.  
That doesn't actually work, because low-level functions like  
Tcl_ListObjGetElements() don't fill Tcl's errorInfo variable.  
The result is either a null-pointer-dereference crash or emission  
of misleading context information describing the previous Tcl error.  
  
Back off to just reporting the interpreter's result string, and  
improve throw_tcl_error()'s comment to explain when to use it.  
  
Also, although the similar code in pltcl_trigger_handler() avoided  
this mistake, it was using a fairly confusing wording of the  
error message.  Improve that while we're here.  
  
Per report from A. Kozhemyakin.  Back-patch to all supported  
branches.  
  
Erik Wienhold and Tom Lane  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/tcl/expected/pltcl_call.out
M src/pl/tcl/pltcl.c
M src/pl/tcl/sql/pltcl_call.sql

Fix PL/pgSQL's handling of integer ranges containing underscores.

commit   : cd2624fd97b0c36b68da278abc5362647f69b07d    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 4 Jun 2024 11:48:01 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 4 Jun 2024 11:48:01 +0100    

Click here for diff

Commit faff8f8e47 allowed integer literals to contain underscores, but  
failed to update the lexer's "numericfail" rule. As a result, a  
decimal integer literal containing underscores would fail to parse, if  
used in an integer range with no whitespace after the first number,  
such as "1_001..1_003" in a PL/pgSQL FOR loop.  
  
Fix and backpatch to v16, where support for underscores in integer  
literals was added.  
  
Report and patch by Erik Wienhold.  
  
Discussion: https://postgr.es/m/808ce947-46ec-4628-85fa-3dd600b2c154%40ewie.name  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/numerology.out
M src/test/regress/sql/numerology.sql

Fix another couple of outdated comments for MERGE RETURNING.

commit   : 5c5bccef211cfc98e0d6c4bc1af40a33c8ac2488    
  
author   : Dean Rasheed <[email protected]>    
date     : Tue, 4 Jun 2024 09:29:42 +0100    
  
committer: Dean Rasheed <[email protected]>    
date     : Tue, 4 Jun 2024 09:29:42 +0100    

Click here for diff

Oversights in c649fa24a4 which added RETURNING support to MERGE.  
  
Discussion: https://postgr.es/m/CAApHDvpqp6vtUzG-_josUEiBGyqnrnVxJ-VdF+hJLXjHdHzsyQ@mail.gmail.com  

M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/utils/portal.h

ci: windows: Use the same image for VS and MinGW tasks

commit   : 83fc61ccfaf38aebe73eacdfc712106797d75b39    
  
author   : Andres Freund <[email protected]>    
date     : Mon, 3 Jun 2024 19:06:50 -0700    
  
committer: Andres Freund <[email protected]>    
date     : Mon, 3 Jun 2024 19:06:50 -0700    

Click here for diff

The VS and MinGW Windows images have been merged, to reduce the space needed  
for images. Before 98811323c8e the split helped boot performance, but now that  
we are using VMs that doesn't appear to be the case anymore.  
  
Author: Nazir Bilal Yavuz <[email protected]>  
Discussion: https://postgr.es/m/CAN55FZ2kWYjPd7uUC5QswrB3tfVJDiURqC%2BMGM6a3oeev%3DVgOA%40mail.gmail.com  
Backpatch: 15-, where CI was added  

M .cirrus.tasks.yml

Improve assertion in mdwritev()

commit   : f04d1c1db01199f02b0914a7ca2962c531935717    
  
author   : Michael Paquier <[email protected]>    
date     : Tue, 4 Jun 2024 07:15:10 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Tue, 4 Jun 2024 07:15:10 +0900    

Click here for diff

The assertion used at the beginning of mdwritev(), that is not enabled  
except by defining -DCHECK_WRITE_VS_EXTEND as mdnblocks() is costly,  
forgot about the total number of blocks to write at location specified  
by the caller.  The calculation is fixed to count for that, and uses  
casts to uint64 to ensure a proper check should the number of blocks  
overflow.  
  
Using a cast is a suggestion from Tom Lane.  
  
Oversight in 4908c5872059.  
  
Author: Xing Guo  
Discussion: https://postgr.es/m/CACpMh+BM-VgKeO7suPG-VHTtpzJ+zsbDPwVHu42PLp-iTk0z+A@mail.gmail.com  

M src/backend/storage/smgr/md.c

Fix documentation for System V semaphores.

commit   : 4ebe51a5fbc3e08861db85fe3868c31c6bc8ed59    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 3 Jun 2024 12:10:43 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 3 Jun 2024 12:10:43 -0500    

Click here for diff

The formulas for SEMMNI and SEMMNS do not include the archiver  
process, which was converted to an auxiliary process in v14, and  
the WAL summarizer process, which was introduced in v17.  This  
commit corrects these formulas and adds a missing reference to  
max_wal_senders nearby.  Since this section of the documentation  
tends to be incorrect quite often, we should likely give up on  
documenting the exact formulas in favor of something less fragile,  
but that is left as a future exercise.  
  
Reported-by: Sami Imseih  
Reviewed-by: Sami Imseih  
Discussion: https://postgr.es/m/20240517164452.GA1914161%40nathanxps13  
Backpatch-through: 12  

M doc/src/sgml/runtime.sgml

doc PG 17 relnotes: adjust IN wording

commit   : 8fea1bd5411b793697a4c9087c403887e050c4ac    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 28 May 2024 00:21:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 28 May 2024 00:21:13 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvqmW0wQRam4paRbHvLQA+w5CJOCno4BCu=NFRLRhYhtRw@mail.gmail.com  
  
Backpatch-through: master  

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

Fix check for memory allocation

commit   : 4013a5ada25241ead6a3265d6edf9aadb654dc00    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Mon, 27 May 2024 19:37:17 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Mon, 27 May 2024 19:37:17 +0200    

Click here for diff

Commit 61461a300c1 accidentally checked memory allocation success  
using the wrong variable.  
  
Author: Ranier Vilela <[email protected]>  
Reviewed-by: Jelte Fennema-Nio <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://postgr.es/m/CAEudQAqQFTH7xCB-+K6zEKjfqbhqCxcr_w4DuJTxVT6h3vzu2w@mail.gmail.com  

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

Fix meson uuid header check so it works with MSVC

commit   : 7c655a04a2dc84b59ed6dce97bd38b79e734ecca    
  
author   : Andrew Dunstan <[email protected]>    
date     : Sun, 26 May 2024 17:34:45 -0400    
  
committer: Andrew Dunstan <[email protected]>    
date     : Sun, 26 May 2024 17:34:45 -0400    

Click here for diff

The OSSP uuid.h file includes unistd.h, so to use it with MSVC we need to  
include the postgres include directories so it picks up our version of  
that in src/include/port/win32_msvc. Adjust the meson test accordingly.  

M meson.build

Fix potential NULL pointer dereference in getIdentitySequence()

commit   : 8285b484a47d829a29fbe0ebe65cdc9f9dfb179d    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 26 May 2024 20:58:27 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 26 May 2024 20:58:27 +0900    

Click here for diff

The function invokes SearchSysCacheAttNum() and SearchSysCacheAttName().  
They may respectively return 0 for the attribute number or NULL for  
the attribute name if the attribute does not exist, without any kind of  
error handling.  The common practice is to check that the data retrieved  
from the syscache is valid.  There is no risk of NULL pointer  
dereferences currently, but let's stick to the practice of making sure  
that this data is always valid, to catch future inconsistency mistakes.  
The code is switched to use get_attnum() and get_attname(), and adds  
some error handling.  
  
Oversight in 509199587df7.  
  
Reported-by: Ranier Vilela  
Author: Ashutosh Bapat  
Discussion: https://postgr.es/m/CAEudQAqh_RZqoFcYKso5d9VhF-Vd64_ZodfQ_2zSusszkEmyRg@mail.gmail.com  

M src/backend/catalog/pg_depend.c

amcheck: Fixes for right page check during unique constraint check

commit   : 945ec4c4bca1e1c4347cd3f93135e96770ac1b4c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 26 May 2024 07:14:12 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 26 May 2024 07:14:12 +0300    

Click here for diff

 * Don't forget to pfree() the right page when it's to be ignored.  
 * Report error on unexpected non-leaf right page even if this page is not  
   to be ignored.  This restores the logic which was unintendedly changed  
   in 97e5b0026f.  
  
Reported-by: Pavel Borisov  

M contrib/amcheck/verify_nbtree.c

doc PG 17 relnotes: improve btree "set/array" matching item

commit   : 4cf9aab2147683100a79bf66a2aa87811674d66c    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:56:06 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:56:06 -0400    

Click here for diff

Reported-by: Peter Geoghegan  
  
Discussion: https://postgr.es/m/CAH2-WznwSs5irUka2deUooSdH7Sts2oPdVv4PCOwhK51fq2ZTg@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: fix "pg_stat_slru_reset" wording

commit   : f3bfa029911c02470bcd8dcc8d707aef52f77de7    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:50:20 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:50:20 -0400    

Click here for diff

Reported-by: Marcos Pegoraro  
  
Discussion: https://postgr.es/m/CAB-JLwYXrL-8FBfVDX8tevyTJ8y1SMmot5A-5cLqXAAne7W0CQ@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnote: adjust "SLRU cache sizes to be configured"

commit   : 232278ca93f95bb6a0ea756bf7cf79928118bc1e    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:48:14 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:48:14 -0400    

Click here for diff

Add Álvaro Herrera as additional item author.  
  
Reported-by: Álvaro Herrera  
  
Discussion: https://postgr.es/m/[email protected]  
  
Author: Álvaro Herrera  
  
Backpatch-through: master  

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

Provide deterministic order for catalog queries in partition_split.sql

commit   : d53a4286d772c50ad7a8ff72ca637de613532592    
  
author   : Alexander Korotkov <[email protected]>    
date     : Sun, 26 May 2024 06:38:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Sun, 26 May 2024 06:38:00 +0300    

Click here for diff

System catalog tables are subject to modification by parallel tests.  This  
is the source of instability when querying them without explicit ORDER BY.  
This commit adds explicit ORDER BY to system catalog queries in  
partition_split.sql to stabilize the result.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/695264.1716578979%40sss.pgh.pa.us  

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

doc PG 17 relnotes: combine items

commit   : 87331c68233425dd02048978e527dcf1ca505c6d    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:40:17 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 25 May 2024 23:40:17 -0400    

Click here for diff

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

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

Fix comment in 024_add_drop_pub.pl

commit   : 53785d2a2aaa7899eb82fb4eba9af6da83680c8d    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 May 2024 13:40:36 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 May 2024 13:40:36 +0900    

Click here for diff

A comment of the test was referring to an incorrect table.  
  
Thinko in 1046a69b3087.  
  
Extracted from a larger patch by the same author.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/[email protected]  

M src/test/subscription/t/024_add_drop_pub.pl

Improve stability of subscription/029_on_error.pl

commit   : ac8c85d04b133509071b1de60a027ebe00654696    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 24 May 2024 11:21:21 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 24 May 2024 11:21:21 +0900    

Click here for diff

This test was failing when using wal_debug=on and -DWAL_DEBUG because of  
additional log entries that made the test grab an LSN not mapping with  
the error expected in the test.  
  
Previously the test would look for the first matching line to get the  
LSN to skip up to.  This is improved by having the test scan the logs  
with a regexp that checks for the expected ERROR string, ensuring that  
the wanted LSN comes from the correct context.  
  
Backpatch down to 15 where this test has been introduced.  
  
Author: Ian Ilyasov  
Discussion: https://postgr.es/m/GV1P251MB100415F17E6B2FDD7188777ECDE32@GV1P251MB1004.EURP251.PROD.OUTLOOK.COM  
Backpatch-through: 15  

M src/test/subscription/t/029_on_error.pl

Remove race conditions between ECPGdebug() and ecpg_log().

commit   : 0162a9bde267a0dc88f35a8d286514c059e1e0e2    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 23 May 2024 15:52:06 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 23 May 2024 15:52:06 -0400    

Click here for diff

Coverity complains that ECPGdebug is accessing debugstream without  
holding debug_mutex, which is a fair complaint: we should take  
debug_mutex while changing the settings ecpg_log looks at.  
  
In some branches it also complains about unlocked use of simple_debug.  
I think it's intentional and safe to have a quick unlocked check of  
simple_debug at the start of ecpg_log, since that early exit will  
always be taken in non-debug cases.  But we should recheck  
simple_debug after acquiring the mutex.  In the worst case, calling  
ECPGdebug concurrently with ecpg_log in another thread could result  
in a null-pointer dereference due to debugstream transiently being  
NULL while simple_debug isn't 0.  
  
This is largely hypothetical, since it's unlikely anybody uses  
ECPGdebug() at all in the field, and our own regression tests  
don't seem to be hitting the theoretical race conditions either.  
Still, if we're going to the trouble of having mutexes here, we ought  
to be using them in a way that's actually safe not just almost safe.  
Hence, back-patch to all supported branches.  

M src/interfaces/ecpg/ecpglib/misc.c

jsonapi: Some message style fixes

commit   : da32f5c4bca7f3447b869de2afbbfa0b74443d45    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 May 2024 09:22:28 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 May 2024 09:22:28 +0200    

Click here for diff

Add missing punctuation, and un-gettext-mark an internal error.  

M src/common/jsonapi.c

doc: Clean up title case use

commit   : 6ef762938eead1a42024b219311f6ede5dc2104a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 23 May 2024 08:34:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 23 May 2024 08:34:05 +0200    

Click here for diff

M doc/src/sgml/file-fdw.sgml

commit   : f7ab71ba0c7bcf237403d40269aeea0a0f2551df    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 May 2024 13:47:12 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 May 2024 13:47:12 +0900    

Click here for diff

The argument of dontWait at the top of ProcSleep() was documented  
backwards, and there was a typo in lock.c.  
  
Thinkos in 2346df6fc373.  
  
Author: Will Mortensen  
Reviewed-by: Jingxian Li, Michael Paquier  
Discussion: https://postgr.es/m/CAMpnoC5f+eiS7tdy8PUpd_LacSTVT-pYpVooKfjHRQQmkHPZ2g@mail.gmail.com  

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

doc: Fix column_name parameter in ALTER MATERIALIZED VIEW

commit   : dd087e1c13bf5f2bcfdc189976aa4e44ed431739    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 23 May 2024 13:02:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 23 May 2024 13:02:57 +0900    

Click here for diff

Parameter column_name must be an existing column because ALTER  
MATERIALIZED VIEW cannot add new columns.  The old description was  
likely copied from ALTER TABLE.  
  
Author: Erik Wienhold  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: 12  

M doc/src/sgml/ref/alter_materialized_view.sgml

Fix a couple of outdated comments now that we have MERGE RETURNING

commit   : 8559252095e17c3cf25a28921a6ef8a14e769519    
  
author   : David Rowley <[email protected]>    
date     : Thu, 23 May 2024 15:24:54 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 23 May 2024 15:24:54 +1200    

Click here for diff

This has been supported since c649fa24a.  
  
Discussion: https://postgr.es/m/CAApHDvpqp6vtUzG-_josUEiBGyqnrnVxJ-VdF+hJLXjHdHzsyQ@mail.gmail.com  

M src/include/nodes/plannodes.h

Don't copy extended statistics during MERGE/SPLIT partition operations

commit   : fbd4321fd5b4400fbbf356d686af6ad6d3208c66    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:22:40 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:22:40 +0300    

Click here for diff

When MERGE/SPLIT created new partitions, it was cloning the extended  
statistics of the parent table.  
  
However, extended stats on partitioned tables don't behave like  
indexes on partitioned tables (which exist only to create physical  
indexes on child tables).  Rather, extended stats on a parent 1) cause  
extended stats to be collected and computed across the whole partition  
hierarchy, and 2) do not cause extended stats to be computed for the  
individual partitions.  
  
"CREATE TABLE ... PARTITION OF" command doesn't copy extended  
statistics.  This commit makes createPartitionTable() behave  
consistently.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/ZiJW1g2nbQs9ekwK%40pryzbyj2023  
Author: Alexander Korotkov, Justin Pryzby  

M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c

Fix the name collision detection in MERGE/SPLIT partition operations

commit   : 3a82c689fd1be9bdf9d60135e5db7d352c051269    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:21:00 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:21:00 +0300    

Click here for diff

Both MERGE and SPLIT partition operations support the case when the name of the  
new partition matches the name of the existing partition to be merged/split.  
But the name collision detection doesn't always work as intended.  The SPLIT  
partition operation finds the namespace to search for an existing partition  
without taking into account the parent's persistence.  The MERGE partition  
operation checks for the name collision with simple equal() on RangeVar's  
simply ignoring the search_path.  
  
This commit fixes this behavior as follows.  
 1. The SPLIT partition operation now finds the namespace to search for  
    an existing partition according to the parent's persistence.  
 2. The MERGE partition operation now checks for the name collision similarly  
    to the SPLIT partition operation using  
    RangeVarGetAndCheckCreationNamespace() and get_relname_relid().  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/86b4f1e3-0b5d-315c-9225-19860d64d685%40gmail.com  
Author: Dmitry Koval, Alexander Korotkov  

M src/backend/commands/tablecmds.c
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

amcheck: Report an error when the next page to a leaf is not a leaf

commit   : 97e5b0026fc276ab1bcde58ae98ae1fcd9c3acc3    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:13:43 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:13:43 +0300    

Click here for diff

This is a very unlikely condition during checking a B-tree unique constraint,  
meaning that the index structure is violated badly, and we shouldn't continue  
checking to avoid endless loops, etc.  So it's worth immediately throwing an  
error.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzk%2B2116uOXdOViA27SHcr31WKPgmjsxXLBs_aTxAeThzg%40mail.gmail.com  
Author: Pavel Borisov  

M contrib/amcheck/verify_nbtree.c

amcheck: Don't load the right sibling page into BtreeCheckState

commit   : 0b5c161248110b164a3333006004c78f9529a109    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:12:45 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:12:45 +0300    

Click here for diff

5ae2087202 implemented a cross-page unique constraint check by loading  
the right sibling to the BtreeCheckState.target variable.  This is wrong,  
because bt_target_page_check() shouldn't change the target page.  Also,  
BtreeCheckState.target shouldn't be changed alone without  
BtreeCheckState.targetblock.  
  
However, the above didn't cause any visible bugs for the following reasons.  
1. We do a cross-page unique constraint check only for leaf index pages.  
2. The only way target page get accessed after a cross-page unique constraint  
   check is loading of the lowkey.  
3. The only place lowkey is used is bt_child_highkey_check(), and that applies  
   only to non-leafs.  
  
The reasons above don't diminish the fact that changing BtreeCheckState.target  
for a cross-page unique constraint check is wrong.  This commit changes this  
check to temporarily store the right sibling to the local variable.  
  
Reported-by: Peter Geoghegan  
Discussion: https://postgr.es/m/CAH2-Wzk%2B2116uOXdOViA27SHcr31WKPgmjsxXLBs_aTxAeThzg%40mail.gmail.com  
Author: Pavel Borisov  

M contrib/amcheck/verify_nbtree.c

amcheck: Refactoring the storage of the last visible entry

commit   : 532d94fec32ac11263b53932365560491d1fd50a    
  
author   : Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:11:14 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Thu, 23 May 2024 02:11:14 +0300    

Click here for diff

This commit introduces a new data structure BtreeLastVisibleEntry comprising  
information about the last visible heap entry with the current value of key.  
Usage of this data structure allows us to avoid passing all this information  
as individual function arguments.  
  
Reported-by: Alexander Korotkov  
Discussion: https://www.postgresql.org/message-id/CAPpHfdsVbB9ToriaB1UHuOKwjKxiZmTFQcEF%3DjuzzC_nby31uA%40mail.gmail.com  
Author: Pavel Borisov, Alexander Korotkov  

M contrib/amcheck/verify_nbtree.c
M src/tools/pgindent/typedefs.list

doc PG 17 relnotes: fix pg_stat_reset_shared quoting

commit   : bac44bc29a64d882e9717672ff788f19e3d2eb1d    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:50:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:50:33 -0400    

Click here for diff

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

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

doc PG 17 relnotes: fix pg_stat_statements typo

commit   : d0155ba41e4204c331486cd9f4564c13987702eb    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:48:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:48:16 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoB_MR=S_Gh=oeJR4ji0GGY+d8747O-5pYcbMbhGOMtAwQ@mail.gmail.com  
  
Author: Masahiko Sawada  
  
Backpatch-through: master  

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

doc PG 17 relnotes: adjust SQL/JSON constructor func. authors

commit   : 29a9a632c5b37c5a27e173496959bd162419b155    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:46:26 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:46:26 -0400    

Click here for diff

Reported-by: Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqHA2_2V-UtdEEjX3wMUcO=pAwH2D=9P9cRYGVcNLJkH+w@mail.gmail.com  
  
Author: Amit Langote  
  
Backpatch-through: master  

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

doc PG 17 relnotes: adjust builtin collation provider item

commit   : 3551da969e8d4ca392de1dd7b43c46dbf3ba2ec1    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:39:19 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 18:39:19 -0400    

Click here for diff

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

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

Fix input of ISO "extended" time format for types time and timetz.

commit   : a9a7c2c3e15ede7a4f6b44d72a32b105b9113f02    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2024 18:22:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2024 18:22:50 -0400    

Click here for diff

Commit 3e1a373e2 missed teaching DecodeTimeOnly the same "ptype"  
manipulations it added to DecodeDateTime.  While likely harmless  
at the time, it became a problem after 5b3c59535 added an error check  
that ptype must be zero once we exit the parsing loop (that is, there  
shouldn't be any unused prefixes).  The consequence was that we'd  
reject time or timetz input like T12:34:56 (the "extended" format  
per ISO 8601-1:2019), even though that still worked in timestamp  
input.  
  
Since this is clearly under-tested code, add test cases covering all  
the ISO 8601 time formats.  (Note: although 8601 allows just "Thh",  
we have never accepted that, and this patch doesn't change that.  
I'm content to leave that as-is because it seems too likely to be  
a mistake rather than intended input.  If anyone wants to allow  
that, it should be a separate patch anyway, and not back-patched.)  
  
Per bug #18470 from David Perez.  Back-patch to v16 where we  
broke it.  
  
Discussion: https://postgr.es/m/[email protected]  

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

doc PG 17 relnotes: add Heikki Linnakangas to vacuum item

commit   : d2a338e0603cd218a070b236e3a9f4bcb77588e6    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 17:59:00 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 22 May 2024 17:59:00 -0400    

Click here for diff

Reported-by: Melanie Plageman  
  
Discussion: https://postgr.es/m/CAAKRu_YYR5MXY-xuCpr7DKKugCExTSjRy9Ax8c-z7LKa8dDfwg@mail.gmail.com  
  
Author: Melanie Plageman  
  
Backpatch-through: master  

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

Fix handling of extended expression statistics in CREATE TABLE LIKE.

commit   : 5278668d7a460d0fac3578d494c039dbc1fc5e89    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 22 May 2024 17:54:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 22 May 2024 17:54:17 -0400    

Click here for diff

transformTableLikeClause believed that it could process extended  
statistics immediately because "the representation of CreateStatsStmt  
doesn't depend on column numbers".  That was true when extended stats  
were first introduced, but it was falsified by the addition of  
extended stats on expressions: the parsed expression tree is fed  
forward by the LIKE option, and that will contain Vars.  So if the  
new table doesn't have attnums identical to the old one's (typically  
because there are some dropped columns in the old one), that doesn't  
work.  The CREATE goes through, but it emits invalid statistics  
objects that will cause problems later.  
  
Fortunately, we already have logic that can adapt expression trees  
to the possibly-new column numbering.  To use it, we have to delay  
processing of CREATE_TABLE_LIKE_STATISTICS into expandTableLikeClause,  
just as for other LIKE options that involve expressions.  
  
Per bug #18468 from Alexander Lakhin.  Back-patch to v14 where  
extended statistics on expressions were added.  
  
Discussion: https://postgr.es/m/[email protected]  

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

Fix generate_union_paths for non-sortable types.

commit   : c37267162e889fe783786b9e28d1b65b82365a00    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:54:09 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:54:09 -0400    

Click here for diff

The previous logic would fail to set groupList when  
grouping_is_sortable() returned false, which could cause queries  
to return wrong answers when some columns were not sortable.  
  
David Rowley, reviewed by Heikki Linnakangas and Álvaro Herrera.  
Reported by Hubert "depesz" Lubaczewski.  
  
Discussion: http://postgr.es/m/[email protected]  
Discussion: http://postgr.es/m/CAApHDvra=c8_zZT0J-TftByWN2Y+OJfnjNJFg4Dfdi2s+QzmqA@mail.gmail.com  

M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql

Re-allow planner to use Merge Append to efficiently implement UNION.

commit   : 12933dc6048902ba891f9572cab96981f50ef669    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:42:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:42:27 -0400    

Click here for diff

This reverts commit 7204f35919b7e021e8d1bc9f2d76fd6bfcdd2070,  
thus restoring 66c0185a3 (Allow planner to use Merge Append to  
efficiently implement UNION) as well as the follow-on commits  
d5d2205c8, 3b1a7eb28, 7487044d6.  
  
Per further discussion on pgsql-release, we wish to ship beta1 with  
this feature, and patch the bug that was found just before wrap,  
rather than shipping beta1 with the feature reverted.  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/union.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/union.sql

Doc: return 66c0185a3 to the release notes.

commit   : 3bd7b2f465deb48c0d37ed6a41bd864771f44390    
  
author   : Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:41:32 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Tue, 21 May 2024 12:41:32 -0400    

Click here for diff

This reverts commit e1e83a71715f1c2f0717bb66e630ca3bda79b9c1.  
  
Per further discussion on pgsql-release, we wish to ship beta1 with  
that feature, and patch the bug, rather than shipping beta1 with  
that feature reverted.  

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

Stamp 17beta1.

commit   : 86a2d2a321215797abd1c67d9f2c52510423a97a    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 17:42:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 17:42:50 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

Doc: remove 66c0185a3 from release notes.

commit   : e1e83a71715f1c2f0717bb66e630ca3bda79b9c1    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 15:16:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 15:16:17 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
(also some private discussion among pgsql-release)  

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

Revert commit 66c0185a3 and follow-on patches.

commit   : 7204f35919b7e021e8d1bc9f2d76fd6bfcdd2070    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 15:08:30 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 20 May 2024 15:08:30 -0400    

Click here for diff

This reverts 66c0185a3 (Allow planner to use Merge Append to  
efficiently implement UNION) as well as the follow-on commits  
d5d2205c8, 3b1a7eb28, 7487044d6.  In addition to those, 07746a8ef  
had to be removed then re-applied in a different place, because  
66c0185a3 moved the relevant code.  
  
The reason for this last-minute thrashing is that depesz found a  
case in which the patched code creates a completely wrong plan  
that silently gives incorrect query results.  It's unclear what  
the cause is or how many cases are affected, but with beta1 wrap  
staring us in the face, there's no time for closer investigation.  
After we figure that out, we can decide whether to un-revert this  
for beta2 or hold it for v18.  
  
Discussion: https://postgr.es/m/[email protected]  
(also some private discussion among pgsql-release)  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/parser/analyze.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/paths.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/union.out
M src/test/regress/sql/collate.icu.utf8.sql
M src/test/regress/sql/union.sql

doc PG 17 relnotes: adjust vacuum items

commit   : d2a04470aa6401c1938cc107e0b2c56c22a2321f    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 20 May 2024 09:36:58 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 20 May 2024 09:36:58 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CANWCAZbPEoFcSjedGsz4AV=_sbwUN4sgjrukVCu-JzrqFC5Hhw@mail.gmail.com  
  
Author: John Naylor  
  
Backpatch-through: master  

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

Translation updates

commit   : 18cbed13d51316184976068f3d8e8da50fc41213    
  
author   : Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2024 12:04:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Mon, 20 May 2024 12:04:11 +0200    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/ka.po
M src/bin/initdb/po/ka.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/ka.po
M src/bin/pg_combinebackup/po/LINGUAS
A src/bin/pg_combinebackup/po/de.po
M src/bin/pg_combinebackup/po/ka.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/ka.po
M src/bin/pg_dump/po/ka.po
M src/bin/pg_rewind/po/ka.po
M src/bin/pg_test_fsync/po/ka.po
M src/bin/pg_upgrade/po/ka.po
M src/bin/pg_verifybackup/po/de.po
M src/bin/pg_verifybackup/po/ka.po
M src/bin/pg_walsummary/po/de.po
M src/bin/psql/po/de.po
M src/bin/psql/po/ka.po
M src/interfaces/libpq/po/ka.po

doc PG 17 relnotes: adjust vacuum item to use "or"

commit   : fa25dfcd7ec1c72cce68e17aae99bb0f0349749f    
  
author   : Bruce Momjian <[email protected]>    
date     : Sun, 19 May 2024 20:12:42 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sun, 19 May 2024 20:12:42 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvrR1ZQ69keUwr5_BGo2iWNqhpZooZSz2g96KnOxO0_GTw@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: adjust "builtin" collation provider

commit   : acecd6746cdc2df5ba8dcc2c2307c6560c7c2492    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 17:52:56 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 17:52:56 -0400    

Click here for diff

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

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

doc PG 17 relnotes: update to current

commit   : 15b4d463083b1afd515f2322de7f1b7496a2c336    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 17:43:16 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 17:43:16 -0400    

Click here for diff

Reported-by: jian he  
  
Discussion: https://postgr.es/m/CACJufxE7fbWckFeXdW86VTia2BV+LOcfNR-aPf1cP2fjxEB0Aw@mail.gmail.com  
  
Backpatch-through: master  

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

Add test case showing that commit d0d44049d fixed a live bug.

commit   : 779ac2c74bd15744aa92b588f70606a1a95256d2    
  
author   : Tom Lane <[email protected]>    
date     : Sat, 18 May 2024 14:26:05 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Sat, 18 May 2024 14:26:05 -0400    

Click here for diff

When I committed d0d44049d (Account for optimized MinMax aggregates  
during SS_finalize_plan), I didn't have a test case showing that it  
was fixing any reachable bug.  Here is one, based on bug #18465 from  
Hal Takahara.  Without the fix, all rows of the result show the same  
"min" value, because the aggregate doesn't get recalculated.  
  
Committed despite beta1 release freeze, with the concurrence of  
pgsql-release.  
  
Discussion: https://postgr.es/m/[email protected]  
Discussion: https://postgr.es/m/[email protected]  

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

doc PG 17 relnotes: add incremental JSON parser item

commit   : 3f49df98d8b97adc37f408ef3942a1523fd33649    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 12:50:22 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 12:50:22 -0400    

Click here for diff

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

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

doc PG 17 relnotes: improve JSON casting item

commit   : 58294448797ead5b9d7ee0cb574963ffec98ba35    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 12:13:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 12:13:59 -0400    

Click here for diff

Reported-by: jian he  
  
Discussion: https://postgr.es/m/CACJufxE0HY19F8Oo-wb-+i4bKDamiaL_aUV8qB69_8mwoScZow@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: adjust vacuum memory item

commit   : b67478b99b7452540023ff2c9f548a39c62b65ea    
  
author   : Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 10:39:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Sat, 18 May 2024 10:39:47 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvpZnr+wRMX5Wic9Na60fZSbruEffMoECVubBjv483jV2w@mail.gmail.com  
  
Backpatch-through: master  

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

Sync typedefs.list with buildfarm, for real this time.

commit   : 70353e463cd32ad3368fc1020c3acde5ee9fb476    
  
author   : Tom Lane <[email protected]>    
date     : Fri, 17 May 2024 11:41:24 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Fri, 17 May 2024 11:41:24 -0400    

Click here for diff

In commit da256a4a7, I manually added some typedef names to the  
buildfarm-generated list so as not to cause any formatting regressions  
compared to the prior manually-updated list.  
  
About half of the additions were injection-point-related names.  
It turns out that those were missing because none of the buildfarm  
animals contributing typedef lists were building with  
--enable-injection-points.  I rectified that on my animal sifaka,  
and now those are in the list available from the buildfarm.  
  
The other half were typedefs that didn't show up in the generated list  
because our method for collecting that doesn't catch names that are  
not used to declare any C variables or fields.  Such a typedef name  
doesn't really add a lot of value, so we decided to get rid of them,  
and that's now been done in commits 110eb4aef and be5942aee.  (Note:  
I'm pretty sure there are some remaining cases of that, but we've  
already accepted the ensuing odd formatting of the typedef declaration  
itself.  The present fixes only dealt with typedefs that had been  
manually added to typedefs.list during the v17 development cycle.)  
  
Hence, we can now install a verbatim copy of the buildfarm's list  
and not have it affect anything.  The only change is to add  
InjectionPointCallback, which I'd omitted from da256a4a7 because  
it chanced not to affect any pgindent decisions.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/tools/pgindent/typedefs.list

A few follow-up fixes for GUC name quoting

commit   : e9b7aee27283e65bd8819cd7a081dbe79eb1c1a3    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 13:48:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 13:48:31 +0200    

Click here for diff

Fixups for 17974ec259: Some messages were missed (and some were new  
since the patch was originally proposed), and there was a typo  
introduced.  

M src/backend/libpq/be-secure-openssl.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/slotsync.c
M src/backend/utils/misc/guc_tables.c

Revise GUC names quoting in messages again

commit   : 17974ec259463869bb6bb4885d46847422fbc9ec    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 11:23:08 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 11:23:08 +0200    

Click here for diff

After further review, we want to move in the direction of always  
quoting GUC names in error messages, rather than the previous (PG16)  
wildly mixed practice or the intermittent (mid-PG17) idea of doing  
this depending on how possibly confusing the GUC name is.  
  
This commit applies appropriate quotes to (almost?) all mentions of  
GUC names in error messages.  It partially supersedes a243569bf65 and  
8d9978a7176, which had moved things a bit in the opposite direction  
but which then were abandoned in a partial state.  
  
Author: Peter Smith <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/CAHut%2BPv-kSN8SkxSdoHano_wPubqcg5789ejhCDZAcLFceBR-w%40mail.gmail.com  

M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/sepgsql/hooks.c
M contrib/test_decoding/expected/slot.out
M doc/src/sgml/sources.sgml
M src/backend/access/gin/ginbulk.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/table/tableamapi.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/vacuum.c
M src/backend/commands/variable.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/parser/scan.l
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.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/origin.c
M src/backend/replication/slot.c
M src/backend/replication/syncrep.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pgbench/pgbench.c
M src/fe_utils/archive.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/test/modules/commit_ts/expected/commit_timestamp_1.out
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_slru/test_slru.c
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/create_am.out
M src/test/regress/expected/json.out
M src/test/regress/expected/jsonb.out
M src/test/regress/expected/prepared_xacts_1.out
M src/test/regress/expected/strings.out
M src/test/ssl/t/001_ssltests.pl
M src/test/subscription/t/001_rep_changes.pl

Remove unused typedefs

commit   : be5942aee7a012ce7f30bc7a6617903127f29e89    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 07:30:19 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 17 May 2024 07:30:19 +0200    

Click here for diff

There were a few typedefs that were never used to define a variable or  
field.  This had the effect that the buildfarm's typedefs.list would  
not include them, and so they would need to be re-added manually to  
keep the overall pgindent result perfectly clean.  
  
We can easily get rid of these typedefs to avoid the issue.  In a few  
cases, we just let the enum or struct stand on its own without a  
typedef around it.  In one case, an enum was abused to define flag  
bits; that's better done with macro definitions.  
  
This fixes all the remaining issues with missing entries in the  
buildfarm's typedefs.list.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/commands/async.c
M src/backend/utils/resowner/resowner.c
M src/include/access/xlog.h
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Remove enum WaitEventExtension

commit   : 110eb4aefbad683c8f512ee8a7168d1718353baa    
  
author   : Michael Paquier <[email protected]>    
date     : Fri, 17 May 2024 12:29:57 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Fri, 17 May 2024 12:29:57 +0900    

Click here for diff

This enum was used to determine the first ID to use when assigning a  
custom wait event for extensions, which is always 1.  It was kept so  
as it would be possible to add new in-core wait events in the category  
"Extension".  There is no such thing currently, so let's remove this  
enum until a case justifying it pops up.  This makes the code simpler  
and easier to understand.  
  
This has as effect to switch back autoprewarm.c to use PG_WAIT_EXTENSION  
rather than WAIT_EVENT_EXTENSION, on par with v16 and older stable  
branches.  
  
Thinko in c9af05465307.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/[email protected]  

M contrib/pg_prewarm/autoprewarm.c
M src/backend/utils/activity/wait_event.c
M src/include/utils/wait_event.h
M src/tools/pgindent/typedefs.list

Fix documentation about DROP DATABASE FORCE process termination rights.

commit   : 372700cf3067254317e7e8060662f8fac11500d5    
  
author   : Noah Misch <[email protected]>    
date     : Thu, 16 May 2024 14:11:00 -0700    
  
committer: Noah Misch <[email protected]>    
date     : Thu, 16 May 2024 14:11:00 -0700    

Click here for diff

Specifically, it terminates a background worker even if the caller  
couldn't terminate the background worker with pg_terminate_backend().  
Commit 3a9b18b3095366cd0c4305441d426d04572d88c1 neglected to update  
this.  Back-patch to v13, which introduced DROP DATABASE FORCE.  
  
Reviewed by Amit Kapila.  Reported by Kirill Reshke.  
  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/ref/drop_database.sgml
M src/backend/storage/ipc/procarray.c

BitmapHeapScan: Remove incorrect assert and reset field

commit   : a3e6c6f929912f928fa405909d17bcbf0c1b03ee    
  
author   : Melanie Plageman <[email protected]>    
date     : Thu, 16 May 2024 10:37:07 -0400    
  
committer: Melanie Plageman <[email protected]>    
date     : Thu, 16 May 2024 10:37:07 -0400    

Click here for diff

04e72ed617be pushed the skip fetch optimization (allowing bitmap heap  
scans to operate like index-only scans if none of the underlying data is  
needed) into heap AM implementations of bitmap table scan callbacks.  
  
04e72ed617be added an assert that all tuples in blocks eligible for the  
optimization had been NULL-filled and emitted by the end of the scan.  
This assert is incorrect when not all tuples need be scanned to execute  
the query; for example: a join in which not all inner tuples need to be  
scanned before skipping to the next outer tuple.  
  
Remove the assert and reset the field on which it previously asserted to  
avoid incorrectly emitting NULL-filled tuples from a previous scan on  
rescan.  
  
Author: Melanie Plageman  
Reviewed-by: Tomas Vondra, Michael Paquier, Alvaro Herrera  
Reported-by: Melanie Plageman  
Reproduced-by: Tomas Vondra, Richard Guo  
Discussion: https://postgr.es/m/CAMbWs48orzZVXa7-vP9Nt7vQWLTE04Qy4PePaLQYsVNQgo6qRg%40mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove option to fall back from direct to postgres SSL negotiation

commit   : fb5718f35ff667104ab0b9dace3a238113666237    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Thu, 16 May 2024 17:17:37 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Thu, 16 May 2024 17:17:37 +0300    

Click here for diff

There were three problems with the sslnegotiation options:  
  
1. The sslmode=prefer and sslnegotiation=requiredirect combination was  
somewhat dangerous, as you might unintentionally fall back to  
plaintext authentication when connecting to a pre-v17 server.  
  
2. There was an asymmetry between 'postgres' and 'direct'  
options. 'postgres' meant "try only traditional negotiation", while  
'direct' meant "try direct first, and fall back to traditional  
negotiation if it fails". That was apparent only if you knew that the  
'requiredirect' mode also exists.  
  
3. The "require" word in 'requiredirect' suggests that it's somehow  
more strict or more secure, similar to sslmode. However, I don't  
consider direct SSL connections to be a security feature.  
  
To address these problems:  
  
- Only allow sslnegotiation='direct' if sslmode='require' or  
stronger. And for the record, Jacob and Robert felt that we should do  
that (or have sslnegotiation='direct' imply sslmode='require') anyway,  
regardless of the first issue.  
  
- Remove the 'direct' mode that falls back to traditional negotiation,  
and rename what was called 'requiredirect' to 'direct' instead. In  
other words, there is no "try both methods" option anymore, 'postgres'  
now means the traditional negotiation and 'direct' means a direct SSL  
connection.  
  
Reviewed-by: Jelte Fennema-Nio, Robert Haas, Jacob Champion  
Discussion: https://www.postgresql.org/message-id/d3b1608a-a1b6-4eda-9ec5-ddb3e4375808%40iki.fi  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/t/005_negotiate_encryption.pl

Document that increasing max_connections uses more resources.

commit   : 8ba346283335f7ee5bac2e904c2daad49a204c7c    
  
author   : Robert Haas <[email protected]>    
date     : Thu, 16 May 2024 08:44:27 -0400    
  
committer: Robert Haas <[email protected]>    
date     : Thu, 16 May 2024 08:44:27 -0400    

Click here for diff

Roberto Mello  
  
Discussion: http://postgr.es/m/CAKz==bJBCWrvN77fmuZ2XqD3jazWEb=E80AA4Yv9C9tQ61YDdQ@mail.gmail.com  

M doc/src/sgml/config.sgml

Doc: use true|false rather than on|off for "failover" option

commit   : fa65a022db26bc446fb67ce1d7ac543fa4bb72e4    
  
author   : David Rowley <[email protected]>    
date     : Fri, 17 May 2024 00:39:15 +1200    
  
committer: David Rowley <[email protected]>    
date     : Fri, 17 May 2024 00:39:15 +1200    

Click here for diff

The CREATE SUBSCRIPTION documentation mentions "false" is the default  
option, so let's use true|false rather than on|off in the text which  
talks about this option in the ALTER SUBSCRIPTION page.  
  
The other boolean options mentioned in create_subscription.sgml use true  
and false so it makes sense to be consistent with these.  The "failover"  
option is new to v17.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Ps-RqrggaJU5w85BbeQzw9CLmmLgADVJoJ=xx_4D5CWvw@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml

pg_amcheck: Put new options in consistent order in --help and man page

commit   : 94af84f00c5fd3ea840759d85a73204d64e28248    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 May 2024 11:29:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 May 2024 11:29:41 +0200    

Click here for diff

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

Revert temporal primary keys and foreign keys

commit   : 8aee330af55d8a759b2b73f5a771d9d34a7b887f    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 16 May 2024 08:15:35 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 16 May 2024 08:15:35 +0200    

Click here for diff

This feature set did not handle empty ranges correctly, and it's now  
too late for PostgreSQL 17 to fix it.  
  
The following commits are reverted:  
  
    6db4598fcb8 Add stratnum GiST support function  
    46a0cd4cefb Add temporal PRIMARY KEY and UNIQUE constraints  
    86232a49a43 Fix comment on gist_stratnum_btree  
    030e10ff1a3 Rename pg_constraint.conwithoutoverlaps to conperiod  
    a88c800deb6 Use daterange and YMD in without_overlaps tests instead of tsrange.  
    5577a71fb0c Use half-open interval notation in without_overlaps tests  
    34768ee3616 Add temporal FOREIGN KEY contraints  
    482e108cd38 Add test for REPLICA IDENTITY with a temporal key  
    c3db1f30cba doc:  clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE  
    144c2ce0cc7 Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes  
  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M contrib/btree_gist/Makefile
D contrib/btree_gist/btree_gist–1.7–1.8.sql
M contrib/btree_gist/btree_gist.c
M contrib/btree_gist/btree_gist.control
D contrib/btree_gist/expected/stratnum.out
D contrib/btree_gist/expected/without_overlaps.out
M contrib/btree_gist/meson.build
D contrib/btree_gist/sql/stratnum.sql
D contrib/btree_gist/sql/without_overlaps.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/gist.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/xindex.sgml
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvalidate.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/typecmds.c
M src/backend/executor/execIndexing.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/access/gist.h
M src/include/catalog/catversion.h
M src/include/catalog/index.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_proc.dat
M src/include/commands/defrem.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/misc_functions.out
D src/test/regress/expected/without_overlaps.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/misc_functions.sql
D src/test/regress/sql/without_overlaps.sql

doc PG 17 relnotes: wording adjustments

commit   : f6ebb418317a1e84be46e7e7b02a26d8c44984de    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2024 22:54:29 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2024 22:54:29 -0400    

Click here for diff

Reported-by: jian he  
  
Discussion: https://postgr.es/m/CACJufxHTJBqDmBC4iPgte_xd4aMgONRm680Ji5m5gCA8+YEmJg@mail.gmail.com  
  
Co-authored-by: jian he  
  
Backpatch-through: master  

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

doc PG 17 relnotes: add item about vacuum storage/limits/WAL

commit   : a8010d03e1f30c657b6c868fa857c7b8b53c3fbc    
  
author   : Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2024 22:47:59 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Wed, 15 May 2024 22:47:59 -0400    

Click here for diff

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

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

jit: Remove {llvm-config,clang}-N configure probes.

commit   : 4dd29b683334739168f60df520dcc9218b6fead7    
  
author   : Thomas Munro <[email protected]>    
date     : Thu, 16 May 2024 13:41:03 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Thu, 16 May 2024 13:41:03 +1200    

Click here for diff

Previously we searched for llvm-config-N and clang-N as well as the  
unversioned names, and maintained a list of expected values of N.  There  
doesn't seem to be any reason to think that the default llvm-config and  
clang won't be good enough, and if they aren't, they can be overridden  
with LLVM_CONFIG and CLANG, so let's stop maintaining that list.  
  
The list had not been updated since LLVM 7 with no complaints, so commit  
820b5af73dc probably should have just removed it when dropping support  
for 7, instead of trying to be helpful by bringing it up to date with  
recent version numbers.  
  
The Meson build system didn't have that, so no change there.  
  
Suggested-by: Peter Eisentraut <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BSOP-aR%3DYF_n0dtXGWeCy6x%2BCn-RMWURU5ySQdmeKW1Q%40mail.gmail.com  

M config/llvm.m4
M configure

Fix some inconsistencies in EXPLAIN output

commit   : 0de37b51065bc5b5848d65a9bb6f932ef392374f    
  
author   : David Rowley <[email protected]>    
date     : Thu, 16 May 2024 12:50:16 +1200    
  
committer: David Rowley <[email protected]>    
date     : Thu, 16 May 2024 12:50:16 +1200    

Click here for diff

06286709e added a SERIALIZE option to EXPLAIN which included showing the  
amount of kilobytes serialized.  The calculation to convert bytes into  
kilobytes wasn't consistent with how that's done in the rest of EXPLAIN.  
Traditionally we round up to the nearest kB, but the new code rounded to  
the nearest kB.  
  
To fix this, invent a macro that does the conversion and use that macro  
everywhere that requires this conversion.  
  
Additionally, 5de890e36 added EXPLAIN (MEMORY) but included the memory  
sizes in bytes.  Convert these values to kilobytes to align with the  
other memory related outputs.  
  
In passing, swap out a "long" type in show_hash_info() and use a uint64  
instead.  We do support platforms where sizeof(Size) == 8 and  
sizeof(long) == 4, so using a long there is questionable.  
  
Reported-by: jian he  
Reviewed-by: jian he  
Discussion: https://www.postgresql.org/message-id/CACJufxE4Sp7xvgOwhqtFx5hS85AxMKobPWDo-xZHZVTpK3EBjA@mail.gmail.com  

M src/backend/commands/explain.c
M src/test/regress/expected/explain.out

doc: Mention more variant --name=value of -c name=value for postgres

commit   : f01e3ba56fd125ccba65b23a1829fc25b6f3fc65    
  
author   : Michael Paquier <[email protected]>    
date     : Thu, 16 May 2024 09:15:01 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Thu, 16 May 2024 09:15:01 +0900    

Click here for diff

postgres --name=value and -c name=value are equivalents.  This commit  
expands the documentation of libpq's "option" connection parameter and  
the server startup sequence for shell interactions to mention both  
rather than only -c.  
  
Extracted from a larger patch by the same authors.  
  
Reported-by: Alexey Palazhchenko  
Author: David Johnston, Aleksander Alekseev  
Reviewed-by: Nathan Bossart, Peter Eisentraut, Álvaro Herrera  
Discussion: https://postgr.es/m/CAJ7c6TMkuLiLfrA+EFCPYfhXoMKRxxssB5c86+ibxfaz6+=Sdg@mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml

Doc: update src/tools/pgindent/README for current practice.

commit   : 3c03ee1a39c0f808cb261a207b6d465c606598bf    
  
author   : Tom Lane <[email protected]>    
date     : Wed, 15 May 2024 19:01:56 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Wed, 15 May 2024 19:01:56 -0400    

Click here for diff

This README explains how to run pgindent, but it was written  
for our former practice of running pgindent only infrequently.  
Nowadays the plan is to keep the tree indent-clean all the time,  
so the typical thing is to do an incremental pgindent run with  
each commit.  Revise to explain that as the normal case, and  
the infrequent full-on process as a separate thing.  
  
For now, pgperltidy is still a run-it-infrequently item.  

M src/tools/pgindent/README

Fix query result leak during binary upgrade

commit   : a8f87d5d21c2f3ddd644c9cb313ecd43290a446e    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Wed, 15 May 2024 22:48:51 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Wed, 15 May 2024 22:48:51 +0200    

Click here for diff

9a974cbcba00 moved the query in binary_upgrade_set_pg_class_oids to the  
outer level, but left the PQclear and query buffer destruction in the  
is_index conditional.  353708e1fb2d fixed the leak of the query buffer  
but left the PGresult leak. This moves clearing the result to the outer  
level ensuring that it will be called.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  
Backpatch-through: v15  

M src/bin/pg_dump/pg_dump.c

Re-forbid underscore in positional parameters

commit   : 98b4f53d156efe09294d6e1d62a5b52f544eee29    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:49:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:49:41 +0200    

Click here for diff

Underscores were added to numeric literals in faff8f8e47.  This change  
also affected the positional parameters (e.g., $1) rule, which uses  
the same production for its digits.  But this did not actually work,  
because the digits for parameters are processed using atol(), which  
does not handle underscores and ignores whatever it cannot parse.  
  
The underscores notation is probably not useful for positional  
parameters, so for simplicity revert that rule to its old form that  
only accepts digits 0-9.  
  
Author: Erik Wienhold <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/5d216d1c-91f6-4cbe-95e2-b4cbd930520c%40ewie.name  

M src/backend/parser/scan.l
M src/fe_utils/psqlscan.l
M src/interfaces/ecpg/preproc/pgc.l
M src/test/regress/expected/numerology.out
M src/test/regress/sql/numerology.sql

doc: Add standard Environment section to pg_upgrade ref page

commit   : 96bc29edfde9b8ad0de573702a6b1c55f73ce912    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    

Click here for diff

Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org  

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

doc: Add standard Environment section to pg_amcheck ref page

commit   : cff942453f21ad13db28d820711a45ec94e856a2    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    

Click here for diff

Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org  

M doc/src/sgml/ref/pg_amcheck.sgml

doc: Remove claims that initdb and pg_ctl use libpq environment variables

commit   : 4f8ff6af1fdca2b33434dd61d4ace7cb480afa21    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 13:05:30 +0200    

Click here for diff

Erroneously introduced by 571df93cff8.  
  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Discussion: https://www.postgresql.org/message-id/flat/8458c9c5-18f1-46d7-94c4-1c30e4f44908%40eisentraut.org  

M doc/src/sgml/ref/initdb.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml

Remove stray blank line among gram.y keywords

commit   : 54cf0c51184fde6e4c01059be0080b5a60ce6802    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 10:52:26 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 10:52:26 +0200    

Click here for diff

introduced by de3600452b  

M src/backend/parser/gram.y

Make all Perl warnings fatal, catch-up

commit   : cc70e170c0213977c106a61c8cedeaac83136c3d    
  
author   : Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 09:44:05 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Wed, 15 May 2024 09:44:05 +0200    

Click here for diff

Apply c5385929593 to new Perl files that had missed the note.  

M src/bin/pg_walsummary/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl
M src/common/unicode/generate-unicode_case_table.pl
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_misc/t/005_timeouts.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

Add missing newline at the end of index_including.sql

commit   : 54b69f1bd730a228a666441592a12d2a0cbe2a06    
  
author   : Michael Paquier <[email protected]>    
date     : Wed, 15 May 2024 14:31:47 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Wed, 15 May 2024 14:31:47 +0900    

Click here for diff

Thinko in a63224be49b8.  

M src/test/regress/sql/index_including.sql

commit   : 8cb653b2457c75d58c4dba578570ba52301c8b78    
  
author   : David Rowley <[email protected]>    
date     : Wed, 15 May 2024 15:01:21 +1200    
  
committer: David Rowley <[email protected]>    
date     : Wed, 15 May 2024 15:01:21 +1200    

Click here for diff

A few patches that were written <= 2023 and committed in 2024 still  
contained 2023 copyright year.  Fix that.  
  
Discussion: https://postgr.es/m/CAApHDvr5egyW3FmHbAg-Uq2p_Aizwco1Zjs6Vbq18KqN64-hRA@mail.gmail.com  

M src/backend/postmaster/launch_backend.c
M src/backend/tcop/backend_startup.c
M src/common/unicode/case_test.c
M src/common/unicode/generate-unicode_case_table.pl
M src/common/unicode_case.c
M src/include/common/unicode_case.h
M src/include/common/unicode_case_table.h
M src/include/tcop/backend_startup.h

doc PG 17 relnotes: add logical replication apply subtrans item

commit   : 771fa58df275d0361fcba2b1f97e4d96617fc345    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 22:12:49 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 22:12:49 -0400    

Click here for diff

Reported-by: Masahiko Sawada  
  
Discussion: https://postgr.es/m/CAD21AoD5jjB+M+BK5JTis8=W1g8KsS1961FyMqRpj=NBFXrJeA@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: remove NOT NULL revert, add ALPN item

commit   : 9bb47338d070105916157528304b79a0ad7baa81    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 22:03:47 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 22:03:47 -0400    

Click here for diff

Make current as of 2024-05-14  
  
Backpatch-through: master  

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

doc PG 17 relnotes: wording fix

commit   : 2b065fc549ed60249f211a7f37f383ff621973ea    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:48:11 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:48:11 -0400    

Click here for diff

Reported-by: Pantelis Theodosiou  
  
Discussion: https://postgr.es/m/CAE3TBxxvkSGJGv7S0SMLSAe0khrQJBHsTca799r=vDJTn+BDAw@mail.gmail.com  
  
Backpatch-through: master  

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

doc PG 17 relnotes: wording fixes

commit   : 78e4841c1bbc4ed4cbd3ae7eb8aac5672190d985    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:42:55 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:42:55 -0400    

Click here for diff

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

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

doc PG 17 relnotes: add two optimizer items

commit   : 1a48f8b40dc0fe0af67303d7e05df5f93cad36fb    
  
author   : Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:36:36 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Tue, 14 May 2024 20:36:36 -0400    

Click here for diff

One is about subqueries becoming joins and the other is about optimizing  
LIMIT by improving startup cost.  
  
Reported-by: Andy Fan  
  
Discussion: https://postgr.es/m/[email protected]  
  
Reviewed-by: David Rowley  
  
Backpatch-through: master  

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

Fix handling of polymorphic output arguments for procedures.

commit   : f535f350c1f9b5a9c4f10583992576c3af505275    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 20:19:20 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 20:19:20 -0400    

Click here for diff

Most of the infrastructure for procedure arguments was already  
okay with polymorphic output arguments, but it turns out that  
CallStmtResultDesc() was a few bricks shy of a load here.  It thought  
all it needed to do was call build_function_result_tupdesc_t, but  
that function specifically disclaims responsibility for resolving  
polymorphic arguments.  Failing to handle that doesn't seem to be  
a problem for CALL in plpgsql, but CALL from plain SQL would get  
errors like "cannot display a value of type anyelement", or even  
crash outright.  
  
In v14 and later we can simply examine the exposed types of the  
CallStmt.outargs nodes to get the right type OIDs.  But it's a lot  
more complicated to fix in v12/v13, because those versions don't  
have CallStmt.outargs, nor do they do expand_function_arguments  
until ExecuteCallStmt runs.  We have to duplicatively run  
expand_function_arguments, and then re-determine which elements  
of the args list are output arguments.  
  
Per bug #18463 from Drew Kimball.  Back-patch to all supported  
versions, since it's busted in all of them.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/functioncmds.c
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/create_procedure.out
M src/test/regress/sql/create_procedure.sql

Do pre-release housekeeping on catalog data.

commit   : 245f1cec59d23032d2eab7019e5d836143383452    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:46:38 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:46:38 -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 6300  

M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_proc.dat

Add da256a4a7 to .git-blame-ignore-revs.

commit   : ce13f54e6055d24e21cc969f498f121c37616921    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:37:22 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:37:22 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification.

commit   : da256a4a7fdcca35fe7ca808686ad3de6ee22306    
  
author   : Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:34:50 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Tue, 14 May 2024 16:34:50 -0400    

Click here for diff

Run pgindent, pgperltidy, and reformat-dat-files.  
  
The pgindent part of this is pretty small, consisting mainly of  
fixing up self-inflicted formatting damage from patches that  
hadn't bothered to add their new typedefs to typedefs.list.  
In order to keep it from making anything worse, I manually added  
a dozen or so typedefs that appeared in the existing typedefs.list  
but not in the buildfarm's list.  Perhaps we should formalize that,  
or better find a way to get those typedefs into the automatic list.  
  
pgperltidy is as opinionated as always, and reformat-dat-files too.  

M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/uavc.c
M src/backend/catalog/Catalog.pm
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_checksums/t/002_actions.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_dump/t/002_pg_dump.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/psql/t/001_basic.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/050_dropdb.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/common/jsonapi.c
M src/common/unicode_case.c
M src/common/unicode_category.c
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/common/unicode_case_table.h
M src/include/common/unicode_category_table.h
M src/interfaces/libpq/t/005_negotiate_encryption.pl
M src/port/pg_popcount_avx512.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Kerberos.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/037_invalid_database.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/029_on_error.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/100_bugs.pl
M src/tools/pgindent/typedefs.list

Add missing gettext triggers

commit   : 3ddbac368c205fce1f293de1fe60c1b479800746    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 12:57:22 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 12:57:22 +0200    

Click here for diff

Commit d6607016c7 moved all the jsonapi.c error messages into  
token_error().  This needs to be added to the various nls.mk files  
that use this.  Since that makes token_error() effectively a globally  
known symbol, the name seems a bit too general, so rename to  
json_token_error() for more clarity.  

M src/backend/nls.mk
M src/bin/pg_combinebackup/nls.mk
M src/bin/pg_verifybackup/nls.mk
M src/common/jsonapi.c

Add missing source files to pg_combinebackup/nls.mk

commit   : 9eb54a258f53dd1d7f198e74c1b11b516ad2e98a    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 11:34:11 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 11:34:11 +0200    

Click here for diff

M src/bin/pg_combinebackup/nls.mk

Remove auth-options support from initdb

commit   : 83ae824c87a59f1183de560b2560641ab804c729    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 14 May 2024 10:50:26 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 14 May 2024 10:50:26 +0200    

Click here for diff

When --auth was added to initdb in commit e7029b212755 it had support  
for auth options separated by space from the auth type, like:  
  
    --auth pam <servicename>  
    --auth ident sameuser  
  
Passing an option to the ident auth type was removed in 01c1a12a5bb4  
which left the pam auth-options support in place. 8a02339e9ba3 broke  
this by inverting a calculation in the strncmp arguments, which went  
unnoticed for a long time.  The ability to pass options to the auth  
type was never documented.  
  
Rather than fixing the support for an undocumented feature which has  
been broken for all supported versions, and which only supports one  
out of many auth types which can take options, it is removed.  
  
Reported-by: Jingxian Li <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Reviewed-by: Aleksander Alekseev <[email protected]>  
Discussion: https://postgr.es/m/[email protected]  

M src/bin/initdb/initdb.c

Fix memory leaks in error reporting with LOG level

commit   : b362d14816699ed05c47355dcb20bbe46f350b86    
  
author   : Daniel Gustafsson <[email protected]>    
date     : Tue, 14 May 2024 10:41:32 +0200    
  
committer: Daniel Gustafsson <[email protected]>    
date     : Tue, 14 May 2024 10:41:32 +0200    

Click here for diff

When loglevel is set to LOG, allocated strings used in the error  
message would leak. Fix by explicitly pfreeing them.  
  
Author: Ranier Vilela <[email protected]>  
Reviewed-by: Daniel Gustafsson <[email protected]>  
Reviewed-by: Michael Paquier <[email protected]>  
Discussion: https://postgr.es/m/CAEudQAqMeE0AHcOsOzZx51Z0eiFJAjhBPRFt+Bxi3ETXWen7ig@mail.gmail.com  

M src/backend/archive/shell_archive.c
M src/backend/libpq/be-secure-common.c

Add missing gettext triggers

commit   : ab4d7a38c36dba3997e9b585448837ccf6384aed    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 10:26:27 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 10:26:27 +0200    

Click here for diff

Due to commit dc212340058, which added use of  
src/common/parse_manifest.c in the backend.  

M src/backend/nls.mk

Make formatting in nls.mk files more consistent

commit   : 2e810bdb7f0a32329a7f3868fae6e81cacc3cd04    
  
author   : Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 09:15:31 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Tue, 14 May 2024 09:15:31 +0200    

Click here for diff

Some of the nls.mk files used different indentation or line breaks  
than the majority, which makes editing these files unnecessarily  
confusing.  

M src/backend/nls.mk
M src/bin/pg_combinebackup/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_rewind/nls.mk
M src/bin/pg_upgrade/nls.mk
M src/bin/pg_waldump/nls.mk
M src/pl/plpython/nls.mk

doc PG 17 relnotes: add item about libpq large data transfers

commit   : e87e7324555a93d7645e831209eee3404b9c05d3    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2024 20:55:13 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2024 20:55:13 -0400    

Click here for diff

Reported-by: Jelte Fennema-Nio  
  
Discussion: https://postgr.es/m/CAGECzQTz5aUqLEL6daLd2Hu2FXS_LOSh4keDndJ1fwThsb_b5w@mail.gmail.com  
  
Reviewed-by: Joe Conway  
  
Backpatch-through: master  

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

Revert "Temporarily install debugging in partition_prune test"

commit   : ec1a405adc24bc20523eef83ccc85232ec23eaa9    
  
author   : David Rowley <[email protected]>    
date     : Tue, 14 May 2024 12:39:30 +1200    
  
committer: David Rowley <[email protected]>    
date     : Tue, 14 May 2024 12:39:30 +1200    

Click here for diff

1db689715 added debugging output to the partition_prune regression test  
to help us figure out why buildfarm member Parula was occasionally  
failing.  
  
We've not seen any failures in around 4 weeks and the best guess as to  
what the problem was is a compiler bug.  Since there are no recent  
failures, there's now no need to keep this debugging code, so revert it.  
  
Discussion: https://postgr.es/m/CAApHDvqyLF881EvDtXT=ossa0i4ioJBtW2c0Wbouzt5d3HDb5Q@mail.gmail.com  

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

doc PG 17 relnotes: add psql connection control-C item

commit   : 6961753381d8b2437195ce40d219a619a61002b6    
  
author   : Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2024 20:01:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Mon, 13 May 2024 20:01:51 -0400    

Click here for diff

Reported-by: Jelte Fennema-Nio  
  
Discussion: https://postgr.es/m/CAGECzQTz5aUqLEL6daLd2Hu2FXS_LOSh4keDndJ1fwThsb_b5w@mail.gmail.com  
  
Reviewed-by: Tom Lane  
  
Backpatch-through: master  

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

Fix pg_sequence_last_value() for unlogged sequences on standbys.

commit   : 3cb2f13ac500983c9c6b1eef3b3c2091c26f3040    
  
author   : Nathan Bossart <[email protected]>    
date     : Mon, 13 May 2024 15:53:50 -0500    
  
committer: Nathan Bossart <[email protected]>    
date     : Mon, 13 May 2024 15:53:50 -0500    

Click here for diff

Presently, when this function is called for an unlogged sequence on  
a standby server, it will error out with a message like  
  
	ERROR:  could not open file "base/5/16388": No such file or directory  
  
Since the pg_sequences system view uses pg_sequence_last_value(),  
it can error similarly.  To fix, modify the function to return NULL  
for unlogged sequences on standby servers.  Since this bug is  
present on all versions since v15, this approach is preferable to  
making the ERROR nicer because we need to repair the pg_sequences  
view without modifying its definition on released versions.  For  
consistency, this commit also modifies the function to return NULL  
for other sessions' temporary sequences.  The pg_sequences view  
already appropriately filters out such sequences, so there's no bug  
there, but we might as well offer some defense in case someone  
invokes this function directly.  
  
Unlogged sequences were first introduced in v15, but temporary  
sequences are much older, so while the fix for unlogged sequences  
is only back-patched to v15, the temporary sequence portion is  
back-patched to all supported versions.  
  
We could also remove the privilege check in the pg_sequences view  
definition in v18 if we modify this function to return NULL for  
sequences for which the current user lacks privileges, but that is  
left as a future exercise for when v18 development begins.  
  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13  
Backpatch-through: 12  

M doc/src/sgml/system-views.sgml
M src/backend/commands/sequence.c
M src/test/recovery/t/001_stream_rep.pl

Remove COMMAND_TAG_NEXTTAG from enum CommandTag.

commit   : 1f7452fa598ee5f1ed32f1fcce101c63c6f1933f    
  
author   : Tom Lane <[email protected]>    
date     : Mon, 13 May 2024 13:52:17 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Mon, 13 May 2024 13:52:17 -0400    

Click here for diff

COMMAND_TAG_NEXTTAG isn't really a valid command tag.  Declaring it  
as if it were one prompts complaints from Coverity and perhaps other  
static analyzers.  Our only use of it is in an entirely-unnecessary  
array sizing declaration, so let's just drop it.  
  
Ranier Vilela  
  
Discussion: https://postgr.es/m/CAEudQAoY0xrKuTAX7W10zsjjUpKBPFRtdCyScb3Z0FB2v6HNmQ@mail.gmail.com  

M src/backend/tcop/cmdtag.c
M src/include/tcop/cmdtag.h

Fix typo

commit   : 11c1984cccad1d41f461d3bb00f9e662332d002b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 13:13:25 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 13:13:25 +0200    

Click here for diff

M doc/src/sgml/catalogs.sgml

Fix regression tests conflict in 3ca43dbbb6

commit   : 2a679ae94e46ea2fa1ff5461c9d0767faecc6c8c    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 13 May 2024 13:26:34 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 13 May 2024 13:26:34 +0300    

Click here for diff

3ca43dbbb6 adds regression tests with permission checks.  The conflict has  
been observed at buildfarm member piculet.  
  
This commit fixes the conflict in the following way.  
1. partition_split.sql now uses role names regress_partition_split_alice and  
   regress_partition_split_bob (it mistakenly used  
   regress_partition_merge_alice and regress_partition_merge_bob before).  
2. Permissions on schemas partitions_merge_schema and partition_split_schema  
   are granted to corresponding roles.  Before, the lack of permissions led to  
   the creation of objects in the public schema and potential conflict.  
  
Reported-by: Daniel Gustafsson  
Discussion: https://postgr.es/m/03A07EF6-98D2-419B-A3AA-A111C64CC207%40yesql.se  

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

Revert structural changes to not-null constraints

commit   : 6f8bb7c1e9610dd7af20cdaf74c4ff6e6d678d44    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 11:31:09 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 11:31:09 +0200    

Click here for diff

There are some problems with the new way to handle these constraints  
that were detected at the last minute, and require fixes that appear too  
invasive to be doing this late in the cycle.  Revert this (again) for  
now, we'll try again with these problems fixed.  
  
The following commits are reverted:  
  
    b0e96f311985  Catalog not-null constraints  
    9b581c534186  Disallow changing NO INHERIT status of a not-null constraint  
    d0ec2ddbe088  Fix not-null constraint test  
    ac22a9545ca9  Move privilege check to the right place  
    b0f7dd915bca  Check stack depth in new recursive functions  
    3af721794272  Update information_schema definition for not-null constraints  
    c3709100be73  Fix propagating attnotnull in multiple inheritance  
    d9f686a72ee9  Fix restore of not-null constraints with inheritance  
    d72d32f52d26  Don't try to assign smart names to constraints  
    0cd711271d42  Better handle indirect constraint drops  
    13daa33fa5a6  Disallow NO INHERIT not-null constraints on partitioned tables  
    d45597f72fe5  Disallow direct change of NO INHERIT of not-null constraints  
    21ac38f498b3  Fix inconsistencies in error messages  
  
Discussion: https://postgr.es/m/[email protected]  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out
M contrib/test_decoding/expected/ddl.out
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/catalog/heap.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/relcache.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/nodes/parsenodes.h
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/expected/create_table.out
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/cluster.out
M src/test/regress/expected/constraints.out
M src/test/regress/expected/create_table.out
M src/test/regress/expected/create_table_like.out
M src/test/regress/expected/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/generated.out
M src/test/regress/expected/identity.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

Fix test case to do what it intends to

commit   : e89f4c66182e409b6643b1e8426371011dc25217    
  
author   : Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 10:32:33 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Mon, 13 May 2024 10:32:33 +0200    

Click here for diff

This test case intended to fail because setting a column as generated to  
the partitioned table while leaving the partition alone is not allowed;  
but instead failed because of a discrepancy of not-null constraint.  Fix  
this by adding the not-null constraint first, then set the column as  
generated in a separate ALTER TABLE command, which gets the expected  
error.  Also, because the next test also wants to set the column as  
not-null, add a BEGIN/ROLLBACK block so that the added not-null is  
removed.  
  
Oversight in 699586315704.  

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

Add permission check for MERGE/SPLIT partition operations

commit   : 3ca43dbbb67fbfb96dec8de2e268b96790555148    
  
author   : Alexander Korotkov <[email protected]>    
date     : Mon, 13 May 2024 00:00:21 +0300    
  
committer: Alexander Korotkov <[email protected]>    
date     : Mon, 13 May 2024 00:00:21 +0300    

Click here for diff

Currently, we check only owner permission for the parent table before  
MERGE/SPLIT partition operations.  This leads to a security hole when users  
can get access to the data of partitions without permission.  This commit  
fixes this problem by requiring owner permission on all the partitions  
involved.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/0520c72e-8d97-245e-53f9-173beca2ab2e%40gmail.com  
Author: Dmitry Koval, Alexander Korotkov  

M src/backend/parser/parse_utilcmd.c
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

Skip citext_utf8 test on Windows.

commit   : cff4e5a36bfe1191a688c5eaff7ba095588ba732    
  
author   : Thomas Munro <[email protected]>    
date     : Mon, 13 May 2024 07:55:20 +1200    
  
committer: Thomas Munro <[email protected]>    
date     : Mon, 13 May 2024 07:55:20 +1200    

Click here for diff

On other Windows build farm animals it is already skipped because they  
don't use UTF-8 encoding.  On "hamerkop", UTF-8 is used, and then the  
test fails.  
  
It is not clear to me (a non-Windows person looking only at buildfarm  
evidence) whether Windows is less sophisticated than other OSes and  
doesn't know how to downcase Turkish İ with the standard Unicode  
database, or if it is more sophisticated than other systems and uses  
locale-specific behavior like ICU does.  
  
Whichever the reason, the result is the same: we need to skip the test  
on Windows, just as we already do for ICU, at least until a  
Windows-savvy developer comes up with a better idea.  The technique for  
detecting the OS is borrowed from collate.windows.win1252.sql.  
  
This was anticipated by commit c2e8bd27, but the problem only surfaced  
when Windows build farm animals started using Meson.  
  
Reviewed-by: Tom Lane <[email protected]>  
Discussion: https://postgr.es/m/CA%2BhUKGJ1LeC3aE2qQYTK95rFVON3ZVoTQpTKJqxkHdtEyawH4A%40mail.gmail.com  

M contrib/citext/expected/citext_utf8.out
M contrib/citext/expected/citext_utf8_1.out
M contrib/citext/sql/citext_utf8.sql

injection_points: Store runtime conditions in private area

commit   : 267d41dc4f4184525353db4069709cfb3df02ceb    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 12 May 2024 19:42:26 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 12 May 2024 19:42:26 +0900    

Click here for diff

This commit fixes a race condition between injection point run and  
detach, where a point detached by a backend and concurrently running in  
a second backend could cause the second backend to do an incorrect  
condition check.  This issue happens because the second backend  
retrieves the callback information in a first step in the shmem hash  
table for injection points, and the condition in a second step within  
the callback.  If the point is detached between these two steps, the  
condition would be removed, causing the point to run while it should  
not.  Storing the condition in the new private_data area introduced in  
33181b48fd0e ensures that the condition retrieved is consistent with its  
callback.  
  
This commit leads to a lot of simplifications in the module  
injection_points, as there is no need to handle the runtime conditions  
inside it anymore.  Runtime conditions have no more a maximum number.  
  
Per discussion with Noah Misch.  
  
Reviewed-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M src/test/modules/injection_points/injection_points.c
M src/tools/pgindent/typedefs.list

Introduce private data area for injection points

commit   : 33181b48fd0ee62bc0a9e39291d5a5c4f8540354    
  
author   : Michael Paquier <[email protected]>    
date     : Sun, 12 May 2024 18:53:06 +0900    
  
committer: Michael Paquier <[email protected]>    
date     : Sun, 12 May 2024 18:53:06 +0900    

Click here for diff

This commit extends the backend-side infrastructure of injection points  
so as it becomes possible to register some input data when attaching a  
point.  This private data can be registered with the function name and  
the library name of the callback when attaching a point, then it is  
given as input argument to the callback.  This gives the possibility for  
modules to pass down custom data at runtime when attaching a point  
without managing that internally, in a manner consistent with the  
callback entry retrieved from the hash shmem table storing the injection  
point data.  
  
InjectionPointAttach() gains two arguments, to be able to define the  
private data contents and its size.  
  
A follow-up commit will rely on this infrastructure to close a race  
condition with the injection point detach in the module  
injection_points.  
  
While on it, this changes InjectionPointDetach() to return a boolean,  
returning false if a point cannot be detached.  This has been mentioned  
by Noah as useful when it comes to implement more complex tests with  
concurrent point detach, solid with the automatic detach done for local  
points in the test module.  
  
Documentation is adjusted in consequence.  
  
Per discussion with Noah Misch.  
  
Reviewed-by: Noah Misch  
Discussion: https://postgr.es/m/[email protected]  

M doc/src/sgml/xfunc.sgml
M src/backend/utils/misc/injection_point.c
M src/include/utils/injection_point.h
M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/injection_points.c

Change ALPN protocol ID to IANA-approved "postgresql"

commit   : 407e0b023cdb449dde65fd370c6cc48f5b8a5579    
  
author   : Heikki Linnakangas <[email protected]>    
date     : Sat, 11 May 2024 18:48:19 +0300    
  
committer: Heikki Linnakangas <[email protected]>    
date     : Sat, 11 May 2024 18:48:19 +0300    

Click here for diff

"TBD-pgsql" was a placeholder until the IANA registration was  
approved.  
  
Discussion: https://www.postgresql.org/message-id/87jzk2hj2n.fsf%40wibble.ilmari.org  
Discussion: https://mailarchive.ietf.org/arch/msg/tls-reg-review/9LWPzQfOpbc8dTT7vc9ahNeNaiw/  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M src/include/libpq/pqcomm.h

doc PG 17 relnotes: move FETCH_COUNT item, and clarify

commit   : 31e8f4e619d9b5856fa2bd5713cb1e2e170a9c7d    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2024 17:34:33 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2024 17:34:33 -0400    

Click here for diff

Backpatch-through: master  

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

doc PG 17 relnotes: add FETCH_COUNT item

commit   : e7b2593bd69b982fc1a8da8905687d30c297786a    
  
author   : Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2024 15:47:08 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Fri, 10 May 2024 15:47:08 -0400    

Click here for diff

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

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

Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes

commit   : 144c2ce0cc75ff99c66749b0ca5235d037df7c09    
  
author   : Peter Eisentraut <[email protected]>    
date     : Fri, 10 May 2024 14:36:49 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Fri, 10 May 2024 14:36:49 +0200    

Click here for diff

A PRIMARY KEY or UNIQUE constraint with WITHOUT OVERLAPS will be a  
GiST index, not a B-Tree, but it will still have indisunique set.  The  
code for ON CONFLICT fails if it sees a non-btree index that has  
indisunique.  This commit fixes that and adds some tests.  But now  
that we can't just test indisunique, we also need some extra checks to  
prevent DO UPDATE from running against a WITHOUT OVERLAPS constraint  
(because the conflict could happen against more than one row, and we'd  
only update one).  
  
Author: Paul A. Jungwirth <[email protected]>  
Discussion: https://www.postgresql.org/message-id/[email protected]  

M src/backend/executor/execIndexing.c
M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/without_overlaps.out
M src/test/regress/sql/without_overlaps.sql

Doc: update the "Using EXPLAIN" examples to match current code.

commit   : 5caa0574963c75cfe7745b1b05f1fd51e3fdf16e    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 18:56:35 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 18:56:35 -0400    

Click here for diff

A lot of the examples in this section are quite ancient and no  
longer match the system's current behavior.  I ran through them  
and updated the sample output to match what I get today.  
  
Notably, it seems that the tenk1 table got a few pages smaller back  
around v12, so that a lot of the cost estimates for queries on that  
table are a little different now.  (This also caused some examples  
to surprisingly not match others, depending on when they were made.)  
  
One mergejoin-based example no longer produces the same plan at all,  
so I had to work around that, including switching to a different  
example of using an enable_xxx setting.  
  
I also changed a couple of examples that were relying on nonexistent  
tables or indexes.  IMO the premise of this section is that the  
examples should be more-or-less reproducible against the regression  
database, so that these examples were unhelpful as given.  It's not  
that hard to find a corresponding example with the tables we do have.  
  
Some of the EXPLAIN ANALYZE examples were out of date in that we show  
more numbers than we did at the time.  
  
Possibly chapter 68 could use similar review, but I'm out of  
energy for today.  

M doc/src/sgml/perform.sgml

doc PG 17 relnotes: fix author of LLVM item

commit   : 6a126d91cd042e708e101acafe23100ffb574251    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 16:37:51 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 16:37:51 -0400    

Click here for diff

Discussion: https://postgr.es/m/CA+hUKG+yU4+YqsCuQuzdCeETPdU+FjebXgV5Fkp6xrtr7EKC3w@mail.gmail.com  
  
Backpatch-through: master  

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

doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE

commit   : c3db1f30cbaff4b96325615557de1f3528d5fd4a    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 16:34:09 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 16:34:09 -0400    

Click here for diff

Discussion: https://postgr.es/m/[email protected]  
  
Author: Paul Jungwirth  
  
Backpatch-through: master  

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

Fix recursive RECORD-returning plpython functions.

commit   : d727c543176c32205372991d3e036e5349fb719d    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 13:16:21 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 13:16:21 -0400    

Click here for diff

If we recursed to a new call of the same function, with a different  
coldeflist (AS clause), it would fail because the inner call would  
overwrite the outer call's idea of what to return.  This is vaguely  
like 1d2fe56e4 and c5bec5426, but it's not due to any API decisions:  
it's just that we computed the actual output rowtype at the start of  
the call, and saved it in the per-procedure data structure.  We can  
fix it at basically zero cost by doing the computation at the end  
of each call instead of the start.  
  
It's not clear that there's any real-world use-case for such a  
function, but given that it doesn't cost anything to fix,  
it'd be silly not to.  
  
Per report from Andreas Karlsson.  Back-patch to all supported  
branches.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/pl/plpython/expected/plpython_composite.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/sql/plpython_composite.sql

doc PG 17 relnotes: Visual Studio clarification

commit   : b538e692493be30132c0ee5984bc53f51920cded    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 12:34:43 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 12:34:43 -0400    

Click here for diff

Reported-by: Andrew Dunstan  
  
Backpatch-through: master  

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

Repair ALTER EXTENSION ... SET SCHEMA.

commit   : 9effc4608e1f6d19546a0e0f64320f4b0dd10c3c    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 12:19:43 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 12:19:43 -0400    

Click here for diff

It turns out that we broke this in commit e5bc9454e, because  
the code was assuming that no dependent types would appear  
among the extension's direct dependencies, and now they do.  
  
This isn't terribly hard to fix: just skip dependent types,  
expecting that we will recurse to them when we process the parent  
object (which should also be among the direct dependencies).  
But a little bit of refactoring is needed so that we can avoid  
duplicating logic about what is a dependent type.  
  
Although there is some testing of ALTER EXTENSION SET SCHEMA,  
it failed to cover interesting cases, so add more tests.  
  
Discussion: https://postgr.es/m/[email protected]  

M src/backend/commands/alter.c
M src/backend/commands/extension.c
M src/backend/commands/tablecmds.c
M src/backend/commands/typecmds.c
M src/include/commands/typecmds.h
M src/test/modules/test_extensions/Makefile
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/sql/test_extensions.sql
A src/test/modules/test_extensions/test_ext_set_schema–1.0.sql
A src/test/modules/test_extensions/test_ext_set_schema.control

doc PG 17 relnotes: Fixes from jian he

commit   : d82ab9fc31aa62d94c26d7df98e65c6ceaadb01f    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 11:43:03 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 11:43:03 -0400    

Click here for diff

Backpatch-through: master  

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

doc PG 17 relnotes: various fixes

commit   : 45ea5b0a2732849ef8bfb695808943d0d940abeb    
  
author   : Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 11:19:35 -0400    
  
committer: Bruce Momjian <[email protected]>    
date     : Thu, 9 May 2024 11:19:35 -0400    

Click here for diff

Fixes suggested by David Rowley, Bertrand Drouvot, Masahiko  
Sawada, Richard Guo, jian he, Dagfinn Ilmari Mannsåker  
  
Backpatch-through: master  

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

Make left-join removal safe under -DREALLOCATE_BITMAPSETS.

commit   : c7be3c015bfe518d0624029e640252248a3c8615    
  
author   : Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 11:01:42 -0400    
  
committer: Tom Lane <[email protected]>    
date     : Thu, 9 May 2024 11:01:42 -0400    

Click here for diff

The initial building of RestrictInfos and SpecialJoinInfos tends to  
create structures that share relid sets (such as syn_lefthand and  
outer_relids).  There's nothing wrong with that in itself, but when  
we modify those relid sets during join removal, we have to be sure  
not to corrupt the values that other structures are pointing at.  
remove_rel_from_query() was careless about this.  It accidentally  
worked anyway because (1) we'd never be reducing the sets to empty,  
so they wouldn't get pfree'd; and (2) the in-place modification is the  
same one that we did or will apply to the other struct's relid set,  
so that there wasn't visible corruption at the end of the process.  
  
While there's no live bug in a standard build, of course this is way  
too fragile to accept going forward.  (Maybe we should back-patch  
this change too for safety, but I've refrained for now.)  
  
This bug was exposed by the recent invention of REALLOCATE_BITMAPSETS.  
Commit e0477837c had installed a fix, but that went away with the  
reversion of SJE, so now we need to fix it again.  
  
David Rowley and Tom Lane  
  
Discussion: https://postgr.es/m/CACJufxFVQmr4=JWHAOSLuKA5Zy9H26nY6tVrRFBOekHoALyCkQ@mail.gmail.com  

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

psql: Add missing punctuation in help output

commit   : e2d5508c501a3cfd47df49ce88669bec7df2e426    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2024 16:35:41 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2024 16:35:41 +0200    

Click here for diff

M src/bin/psql/help.c

doc: Use better placeholder in COPY synopsis

commit   : 1c4429e703b2caf7fc865c2fc0a94f3557e5b356    
  
author   : Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2024 16:34:50 +0200    
  
committer: Peter Eisentraut <[email protected]>    
date     : Thu, 9 May 2024 16:34:50 +0200    

Click here for diff

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

Fix inconsistencies in error messages

commit   : 21ac38f498b33f0231842238b83847ec63dfe07b    
  
author   : Alvaro Herrera <[email protected]>    
date     : Thu, 9 May 2024 13:31:22 +0200    
  
committer: Alvaro Herrera <[email protected]>    
date     : Thu, 9 May 2024 13:31:22