PostgreSQL 16.0 (upcoming) commit log

Use lower case for icu_validation_level values

commit   : 0ffbe6e59197e5e2b3bf026f594fabb8ada9bec3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:33 +0200    

Click here for diff

Similar to client_min_messages etc.  

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

Punctuation improvement in postgresql.conf.sample

commit   : dfe0169988f32e7cb9c48fad9ab3de71c6c39a55    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:19:12 +0200    

Click here for diff

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

Add newline at end of file

commit   : f40177c904f17721c3d33a6c202b74f3f2d4874d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:18:06 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 May 2023 15:18:06 +0200    

Click here for diff

M src/test/ssl/conf/server-rsapss.config

doc: PG 16 relnotes, SIMD improvements

commit   : 5cb54fc310fb84287cbdc74533f3420490a2f63a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 May 2023 00:27:01 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 23 May 2023 00:27:01 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsEuAx4_nq=200u=70S5r83C2hzO-a9+c6YXTCbOFeDAfw@mail.gmail.com  

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

Stamp 16beta1.

commit   : e0b82fc8e8317881ecdd1e28bece55ea0db952da    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 17:08:08 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 17:08:08 -0400    

Click here for diff

M configure
M configure.ac
M meson.build

doc: PG 16 relnotes, add major features list

commit   : 60751aa50313b3498de199a3cd62e5f30e6b6091    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 13:58:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 13:58:24 -0400    

Click here for diff

Reported-by: Jonathan Katz  
  
Discussion: https://postgr.es/m/2fd2cc0e-df39-3e77-8fcf-35aad5796b0a@postgresql.org  

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

Spell the values of libpq's gssdelegation parameter as "0" and "1".

commit   : 1f9f6aa491986ed4e65851e827d021e9c784fd42    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 11:50:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 22 May 2023 11:50:20 -0400    

Click here for diff

That's how other boolean options are handled, so do likewise.  
The previous coding with "enable" and "disable" was seemingly  
modeled on gssencmode, but that's a three-way flag.  
  
While at it, add PGGSSDELEGATION to the set of environment  
variables cleared by pg_regress and Utils.pm.  
  
Abhijit Menon-Sen, per gripe from Alvaro Herrera  
  
Discussion: https://postgr.es/m/20230522091609.nlyuu4nolhycqs2p@alvherre.pgsql  

M doc/src/sgml/libpq.sgml
M doc/src/sgml/release-16.sgml
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/pg_regress.c

doc: PG 16 relnotes, improve desc. of pg_log_standby_snapshot()

commit   : 4123455a9e5463495a6e9be8423e671c874ec19f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 10:20:53 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 22 May 2023 10:20:53 -0400    

Click here for diff

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

Translation updates

commit   : 473e02f6f9ba1863c59a9e40736a633ed52c139f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 May 2023 12:44:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 May 2023 12:44:31 +0200    

Click here for diff

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

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

pg_dump doc: mention 'long' is valid for --compress

commit   : 4042b2e18781532d5dd6ee3cef38c4fbb0249202    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 22 May 2023 12:26:40 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 22 May 2023 12:26:40 +0200    

Click here for diff

Apparently an oversight in 2820adf7755d.  

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

doc: PG 16 relnotes, improve description of standby log. decode

commit   : ac298d3cb56b015acd40d2e015e07a87d8aff124    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 23:39:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 23:39:27 -0400    

Click here for diff

Improve description of "Allow logical decoding on standbys".  

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

Rename some createuser options.

commit   : 2dcd1578c40153250836df62f625863056c28a81    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 21 May 2023 20:03:56 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Sun, 21 May 2023 20:03:56 -0700    

Click here for diff

This change renames --admin to --with-admin, --role to --member-of,  
and --member to --with-member.  Many people found the previous  
names to be confusing.  The --admin and --member options are new in  
v16, but --role has been there for a while, so that one has been  
kept (but left undocumented) for backward compatibility.  
  
Suggested-by: Peter Eisentraut  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/ZFvVZvQDliIWmOwg%40momjian.us  

M doc/src/sgml/ref/createuser.sgml
M src/bin/scripts/createuser.c
M src/bin/scripts/t/040_createuser.pl

doc: PG 16 relnotes, misc merged items and bootstrap detail

commit   : de7c3fd34e0fc0a3f77537e1d12efcd01d255534    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 22:52:42 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 22:52:42 -0400    

Click here for diff

Reported-by: Andres Freund, jian he  
  
Discussion: https://postgr.es/m/20230521171341.jjxykfsefsek4kzj@awork3.anarazel.de, 20230521171341.jjxykfsefsek4kzj@awork3.anarazel.de  

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

doc: PG 16 relnotes, misc. updates

commit   : c822358a256ca1f3b8b08557b9c9f0efa8d41675    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 15:57:37 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 15:57:37 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/277016.1684689065@sss.pgh.pa.us  

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

In clause_is_computable_at(), test required_relids for clone clauses.

commit   : b9c755a2f625b7dca6323804b140b016d95a0b1d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 15:25:43 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 15:25:43 -0400    

Click here for diff

Use the clause's required_relids not clause_relids for testing  
whether it is computable at the current join level, if it is a  
clone clause generated by deconstruct_distribute_oj_quals().  
  
Arguably, this is more correct and we should do it for all clauses;  
that would at least remove the handwavy claim that we are doing  
it to save cycles compared to inspecting Vars individually.  
However, attempting to do that exposes that we are not being careful  
to compute an accurate value for required_relids in all cases.  
I'm unsure whether it's a good idea to attempt to do that for v16,  
or leave it as future clean-up.  In the meantime, this quick hack  
demonstrably fixes some cases, so let's squeeze it in for beta1.  
  
Patch by me, but great thanks to Richard Guo for investigation  
and testing.  The new test cases are all modeled on his examples.  
  
Discussion: https://postgr.es/m/CAMbWs4-_vwkBij4XOQ5ukxUvLgwTm0kS5_DO9CicUeKbEfKjUw@mail.gmail.com  

M src/backend/optimizer/util/restrictinfo.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Remove over-eager assertion in ExtendBufferedRelTo()

commit   : eabb22525efc40ce0d83580584094a0248ac0682    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:48:37 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:48:37 -0700    

Click here for diff

The assertion checked that the size of the relation is not "too large" - but  
the code is explicitly dealing with the possibility of another backend  
extending the relation concurrently. In that case the new relation size could  
be bigger than what the current backend needs, wrongly triggering an assertion  
failure.  
  
Unfortunately it is hard to write a reliable and affordable regression tests  
for this, as a lot of concurrency is needed to encounter the bug.  
  
Introduced in 31966b151e6a.  
  
Reported-by: Melanie Plageman <melanieplageman@gmail.com>  

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

Optimize walsender wake up logic using condition variables

commit   : bc971f4025c378ce500d86597c34b0ef996d4d8c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:44:55 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 21 May 2023 09:44:55 -0700    

Click here for diff

WalSndWakeup() currently loops through all the walsenders slots, with a  
spinlock acquisition and release for every iteration, to wake up waiting  
walsenders.  
  
This commonly was not a problem before e101dfac3a53c. But, to allow logical  
decoding on standbys, we need to wake up logical walsenders after every WAL  
record is applied on the standby, rather just when flushing WAL or switching  
timelines.  This causes a performance regression for workloads replaying a lot  
of WAL records.  
  
To solve this, we use condition variable (CV) to efficiently wake up  
walsenders in WalSndWakeup().  
  
Every walsender prepares to sleep on a shared memory CV. Note that it just  
prepares to sleep on the CV (i.e., adds itself to the CV's waitlist), but does  
not actually wait on the CV (IOW, it never calls ConditionVariableSleep()). It  
still uses WaitEventSetWait() for waiting, because CV infrastructure doesn't  
handle FeBe socket events currently. The processes (startup process,  
walreceiver etc.)  wanting to wake up walsenders use  
ConditionVariableBroadcast(), which in turn calls SetLatch(), helping  
walsenders come out of WaitEventSetWait().  
  
We use separate shared memory CVs for physical and logical walsenders for  
selective wake ups, see WalSndWakeup() for more details.  
  
This approach is simple and reasonably efficient. But not very elegant. But  
for 16 it seems to be a better path than a larger redesign of the CV  
mechanism.  A desirable future improvement would be to add support for CVs  
into WaitEventSetWait().  
  
This still leaves us with a small regression in very extreme workloads (due to  
the spinlock acquisition in ConditionVariableBroadcast() when there are no  
waiters) - but that seems acceptable.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Suggested-by: Andres Freund <andres@anarazel.de>  
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>  
Discussion: https://www.postgresql.org/message-id/20230509190247.3rrplhdgem6su6cg%40awork3.anarazel.de  

M src/backend/replication/walsender.c
M src/include/replication/walsender_private.h

doc: PG 16 relnotes, add commits

commit   : 30579d23b22655e340e9806fb3425e73eed60876    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 11:55:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sun, 21 May 2023 11:55:50 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=hLvQDb53WdigV7OBEBh5tzQ7eA=pG0ZpccoRVBUNCXYA@mail.gmail.com  

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

Doc: fix some rendering problems in the PDF docs build.

commit   : b62381d9a23b4b96259cf560e411137656201704    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 11:21:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 11:21:19 -0400    

Click here for diff

Tweak column widths in a couple of tables to avoid "contents  
... exceed the available area" warnings.  Remove usage of  
some non-Latin-1 characters.  
  
Discussion: https://postgr.es/m/614600.1684537037@sss.pgh.pa.us  

M doc/src/sgml/charset.sgml
M doc/src/sgml/release-16.sgml

Expand some more uses of "deleg" to "delegation" or "delegated".

commit   : a2eb99a01e015a76682911ae3980762f6ee6ac8c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 10:55:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 21 May 2023 10:55:18 -0400    

Click here for diff

Complete the task begun in 9c0a0e2ed: we don't want to use the  
abbreviation "deleg" for GSS delegation in any user-visible places.  
(For consistency, this also changes most internal uses too.)  
  
Abhijit Menon-Sen and Tom Lane  
  
Discussion: https://postgr.es/m/949048.1684639317@sss.pgh.pa.us  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/libpq.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/README
M src/test/kerberos/t/001_auth.pl
M src/test/regress/expected/rules.out

Fix remaining references to gss_accept_deleg.

commit   : f4001a553770b3114dd11846c6789ad6c34ef111    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Sat, 20 May 2023 20:18:51 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Sat, 20 May 2023 20:18:51 -0700    

Click here for diff

These were missed in 9c0a0e2ed9.  
  
Discussion: https://postgr.es/m/20230521031757.GA3835667%40nathanxps13  

M doc/src/sgml/config.sgml
M src/backend/utils/misc/postgresql.conf.sample
M src/test/kerberos/t/001_auth.pl

rename "gss_accept_deleg" to "gss_accept_delegation".

commit   : 9c0a0e2ed92a1a94ec30d36f8ea1ab12c928292b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:32:54 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:32:54 -0400    

Click here for diff

This is more consistent with existing GUC spelling.  
  
Discussion: https://postgr.es/m/ZGdnEsGtNj7+fZoa@momjian.us  

M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M doc/src/sgml/config.sgml
M doc/src/sgml/release-16.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/include/libpq/auth.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h

doc: PG 16 relnotes, misc updates

commit   : cf109ffc205063f82258e0643588491a153c3a45    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:03:13 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Sat, 20 May 2023 21:03:13 -0400    

Click here for diff

*  document to_reg* accepting OIDs  
*  document pg_log_standby_snapshot()  
*  document pg_input_is_valid() and pg_input_error_info()  
*  handle rename of function to pg_split_walfile_name()  
*  fix character encoding problem for Przemyslaw Sztoch  
*  remove partition section  
  
Reported-by: jian he, Tom Lane, Bertrand Drouvot  

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

Add 0245f8db3 to .git-blame-ignore-revs.

commit   : 1c006c067124403d63b6ad3eac687b4217f05691    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:28:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:28:04 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification.

commit   : 0245f8db36f375326c2bae0c3420d3c77714e72d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:24:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 17:24:48 -0400    

Click here for diff

Run pgindent, pgperltidy, and reformat-dat-files.  
  
This set of diffs is a bit larger than typical.  We've updated to  
pg_bsd_indent 2.1.2, which properly indents variable declarations that  
have multi-line initialization expressions (the continuation lines are  
now indented one tab stop).  We've also updated to perltidy version  
20230309 and changed some of its settings, which reduces its desire to  
add whitespace to lines to make assignments etc. line up.  Going  
forward, that should make for fewer random-seeming changes to existing  
code.  
  
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql  

M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/verify_heapam.c
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/dblink/dblink.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_walinspect/pg_walinspect.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/shippable.c
M contrib/seg/seg-validate.pl
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/mk_feature_tables.pl
M src/backend/access/brin/brin.c
M src/backend/access/common/reloptions.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/aclchk.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/indexing.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/alter.c
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/commands/dropcmds.c
M src/backend/commands/explain.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/view.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execSRF.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/hba.c
M src/backend/nodes/gen_node_support.pl
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/relnode.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/fork_process.c
M src/backend/regex/regc_lex.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/snowball_create.pl
M src/backend/statistics/extended_stats.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/smgr/md.c
M src/backend/tsearch/spell.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/init/postinit.c
M src/backend/utils/init/usercontext.c
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/describe.c
M src/bin/psql/settings.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/fe_utils/print.c
M src/include/access/amapi.h
M src/include/access/brin_tuple.h
M src/include/access/gist_private.h
M src/include/access/tableam.h
M src/include/access/xlogreader.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_subscription.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/executor/hashjoin.h
M src/include/executor/tuptable.h
M src/include/fe_utils/print.h
M src/include/funcapi.h
M src/include/nodes/primnodes.h
M src/include/port/win32ntdll.h
M src/include/replication/reorderbuffer.h
M src/include/storage/bufmgr.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/utils/backend_status.h
M src/include/utils/pg_locale.h
M src/include/utils/rel.h
M src/include/utils/varlena.h
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/ecpg/preproc/check_rules.pl
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/text2macro.pl
M src/port/dirmod.c
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/icu/t/010_database.pl
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/t/001_auth.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/regress/pg_regress.c
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/zic.c
M src/tools/PerfectHash.pm
M src/tools/check_bison_recursion.pl
M src/tools/ci/windows_build_config.pl
M src/tools/copyright.pl
M src/tools/gen_export.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/mark_pgdllimport.pl
M src/tools/msvc/Install.pm
M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/Mkvcbuild.pm
M src/tools/msvc/Project.pm
M src/tools/msvc/Solution.pm
M src/tools/msvc/VSObjectFactory.pm
M src/tools/msvc/build.pl
M src/tools/msvc/config_default.pl
M src/tools/msvc/dummylib/Win32/Registry.pm
M src/tools/msvc/dummylib/Win32API/File.pm
M src/tools/msvc/gendef.pl
M src/tools/msvc/pgbison.pl
M src/tools/msvc/vcregress.pl
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pginclude/pgcheckdefines
M src/tools/pgindent/pgindent
M src/tools/pgindent/typedefs.list
M src/tools/win32tzlist.pl
M src/tutorial/funcs.c

Make agreed-on updates in perltidy options.

commit   : df6b19fbbc20d830de91d9bea68715a39635b568    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:43:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:43:57 -0400    

Click here for diff

Our standard version of perltidy is now 20230309.  
Add a --valign-exclusion-list setting to reduce crosstalk  
between nearby lines of Perl code.  
  
Also, update instructions for running pgindent  
(missed in b16259b3c).  
  
Discussion: https://postgr.es/m/20230428092545.qfb3y5wcu4cm75ur@alvherre.pgsql  

M src/tools/pgindent/README
M src/tools/pgindent/perltidyrc

Do pre-release housekeeping on catalog data.

commit   : 722541ead194635d77163bda057cc0064ff81149    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:36:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 16:36: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 6200  

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

Fix thinko in join removal.

commit   : d0f952691ff532aa0c54e9d146fac8d590596646    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 15:24:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 15:24:07 -0400    

Click here for diff

In commit 9df8f903e I (tgl) switched join_is_removable() from  
using the min relid sets of the join under consideration to  
using its full syntactic relid sets.  This was a mistake,  
as it allowed join removal in cases where a reference to the  
join output would survive in some syntactically-lower join  
condition.  Revert to the former coding.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/CAMbWs4-EU9uBGSP7G-iTwLBhRQ=rnZKvFDhD+n+xhajokyPCKg@mail.gmail.com  

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

Fix misbehavior of EvalPlanQual checks with multiple result relations.

commit   : 70b42f2790292cc30aa07563f343f7ba6749af01    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 14:26:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 14:26:34 -0400    

Click here for diff

The idea of EvalPlanQual is that we replace the query's scan of the  
result relation with a single injected tuple, and see if we get a  
tuple out, thereby implying that the injected tuple still passes the  
query quals.  (In join cases, other relations in the query are still  
scanned normally.)  This logic was not updated when commit 86dc90056  
made it possible for a single DML query plan to have multiple result  
relations, when the query target relation has inheritance or partition  
children.  We replaced the output for the current result relation  
successfully, but other result relations were still scanned normally;  
thus, if any other result relation contained a tuple satisfying the  
quals, we'd think the EPQ check passed, even if it did not pass for  
the injected tuple itself.  This would lead to update or delete  
actions getting performed when they should have been skipped due to  
a conflicting concurrent update in READ COMMITTED isolation mode.  
  
Fix by blocking all sibling result relations from emitting tuples  
during an EvalPlanQual recheck.  In the back branches, the fix is  
complicated a bit by the need to not change the size of struct  
EPQState (else we'd have ABI-breaking changes in offsets in  
struct ModifyTableState).  Like the back-patches of 3f7836ff6  
and 4b3e37993, add a separately palloc'd struct to avoid that.  
The logic is the same as in HEAD otherwise.  
  
This is only a live bug back to v14 where 86dc90056 came in.  
However, I chose to back-patch the test cases further, on the  
grounds that this whole area is none too well tested.  I skipped  
doing so in v11 though because none of the test applied cleanly,  
and it didn't quite seem worth extra work for a branch with only  
six months to live.  
  
Per report from Ante Krešić (via Aleksander Alekseev)  
  
Discussion: https://postgr.es/m/CAJ7c6TMBTN3rcz4=AjYhLPD_w3FFT0Wq_C15jxCDn8U4tZnH1g@mail.gmail.com  

M src/backend/executor/execMain.c
M src/backend/executor/execScan.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/backend/replication/logical/worker.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec

psql: Tweak xheader_width and pager_min_lines input parsing

commit   : ed7e686a031e5b9469e0813af2f513dfdd77560b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 19 May 2023 20:19:28 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 19 May 2023 20:19:28 +0200    

Click here for diff

Don't throw away the previous value when an invalid value is proposed.  
  
Discussion: https://postgr.es/m/20230519110205.updpbjiuqgbox6gp@alvherre.pgsql  

M src/bin/psql/command.c

Message style improvements

commit   : 8e7912e73da008862180112cc6ba4d0aa5fa955d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 18:45:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 18:45:29 +0200    

Click here for diff

M src/backend/access/transam/xlogfuncs.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/check.c
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/scripts/createuser.c
M src/common/compression.c
M src/common/rmtree.c
M src/interfaces/libpq/fe-connect.c

doc: PG 16 relnotes, delete reverted grant, adjust version num

commit   : e5f85744eaa5ca83ff4d27509ed094ca33ed485e    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 12:29:50 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 12:29:50 -0400    

Click here for diff

Reported-by: Nathan Bossart, Sehrope Sarkuni  

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

Allocate hash join files in a separate memory context

commit   : 8c4040edf456d9241816176eacb79e4d9a0034fc    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:31:11 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:31:11 +0200    

Click here for diff

Should a hash join exceed memory limit, the hashtable is split up into  
multiple batches. The number of batches is doubled each time a given  
batch is determined not to fit in memory. Each batch file is allocated  
with a block-sized buffer for buffering tuples and parallel hash join  
has additional sharedtuplestore accessor buffers.  
  
In some pathological cases requiring a lot of batches, often with skewed  
data, bad stats, or very large datasets, users can run out-of-memory  
solely from the memory overhead of all the batch files' buffers.  
  
Batch files were allocated in the ExecutorState memory context, making  
it very hard to identify when this batch explosion was the source of an  
OOM. This commit allocates the batch files in a dedicated memory  
context, making it easier to identify the cause of an OOM and work to  
avoid it.  
  
Based on initial draft by Tomas Vondra, with significant reworks and  
improvements by Jehan-Guillaume de Rorthais.  
  
Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Author: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by:  Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20190421114618.z3mpgmimc3rmubi4@development  
Discussion: https://postgr.es/m/20230504193006.1b5b9622%40karst#273020ff4061fc7a2fbb1ba96b281f17  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/utils/sort/sharedtuplestore.c
M src/include/executor/hashjoin.h
M src/include/executor/nodeHashjoin.h

Describe hash join implementation

commit   : 507615fc533b1b65bcecc6218e36436687fe8420    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:19:54 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 16:19:54 +0200    

Click here for diff

Add a high level description of our implementation of the hybrid hash  
join algorithm to the block comment in nodeHashjoin.c.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Discussion: https://postgr.es/m/20230516160051.4267a800%40karst  

M src/backend/executor/nodeHashjoin.c

Avoid naming conflict between transactions.sql and namespace.sql.

commit   : b973f93b6c540f65c960bfb19af55f3d4afe4b72    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 10:57:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 19 May 2023 10:57:46 -0400    

Click here for diff

Commits 681d9e462 et al added a test case in namespace.sql that  
implicitly relied on there not being a table "public.abc".  
However, the concurrently-run transactions.sql test creates precisely  
such a table, so with the right timing you'd get a failure.  
Creating a table named as generically as "abc" in a common schema  
seems like bad practice, so fix this by changing the name of  
transactions.sql's table.  (Compare 2cf8c7aa4.)  
  
Marina Polyakova  
  
Discussion: https://postgr.es/m/80d0201636665d82185942e7112257b4@postgrespro.ru  

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

Remove stray mid-sentence tabs in comments

commit   : 803b4a26ca3fdddbb6e3ce87a23bfbcc8a8669f3    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 15:57:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 15:57:38 +0200    

Click here for diff

M src/backend/executor/nodeIncrementalSort.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/storage/smgr/smgr.c
M src/backend/tsearch/ts_parse.c
M src/include/common/jsonapi.h
M src/include/port/win32_port.h
M src/interfaces/ecpg/pgtypeslib/timestamp.c

doc: PG 16 relnotes, merge REINDEX and reindexdb items

commit   : 6ff33cdbabdf770ca9d6b417c0687c04b2cd4d36    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 09:30:00 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 09:30:00 -0400    

Click here for diff

Reported-by: Vibhor Kumar  

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

doc: PG 16 relnotes, add missing parentheses

commit   : 1a620cbae5c48dc89f7cb08602c331f5751df71a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 08:31:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 19 May 2023 08:31:11 -0400    

Click here for diff

Reported-by: Hans Buschmann  

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

Move mdwriteback() to better place

commit   : 4c9deebd37ecbeb1bbf6baaf43bafc2f84b9011b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 13:42:06 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 13:42:06 +0200    

Click here for diff

The previous order in the file didn't make sense and matched neither  
the header file nor the smgr API.  
  
Discussion: https://www.postgresql.org/message-id/flat/22fed8ba-01c3-2008-a256-4ea912d68fab%40enterprisedb.com  

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

Reindent some comments

commit   : 0b8ace8d773257fffeaceda196ed94877c2b74df    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 10:52:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 May 2023 10:52:04 +0200    

Click here for diff

Most (older) comments in md.c and smgr.c are indented with a leading  
tab on all lines, which isn't the current style and makes updating the  
comments a bit annoying.  This reindents all these lines with a single  
space, as is the normal style.  This issue exists in various shapes  
throughout the code but it's pretty consistent here, and since there  
is a patch pending to refresh some of the comments in these files, it  
seems sensible to clean this up here separately.  
  
Discussion: https://www.postgresql.org/message-id/flat/22fed8ba-01c3-2008-a256-4ea912d68fab%40enterprisedb.com  

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

pageinspect: Fix gist_page_items() with included columns

commit   : e7bff46e50b85c6b37723426188498dab973806c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 May 2023 12:37:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 May 2023 12:37:58 +0900    

Click here for diff

Non-leaf pages of GiST indexes contain key attributes, leaf pages  
contain both key and non-key attributes, and gist_page_items() ignored  
the handling of non-key attributes.  This caused a few problems when  
using gist_page_items() on a GiST index with INCLUDE:  
- On a non-leaf page, the function would crash.  
- On a leaf page, the function would work, but miss to display all the  
values for included attributes.  
  
This commit fixes gist_page_items() to handle such cases in a more  
appropriate way, and now displays the values of key and non-key  
attributes for each item separately in a style consistent with what  
ruleutils.c would generate for the attribute list, depending on the page  
type dealt with.  In a way similar to how a record is displayed, values  
would be double-quoted for key or non-key attributes if required.  
  
ruleutils.c did not provide a routine able to control if non-key  
attributes should be displayed, so an extended() routine for index  
definitions is added to work around the leaf and non-leaf page  
differences.  
  
While on it, this commit fixes a third problem related to the amount of  
data reported for key attributes.  The code originally relied on  
BuildIndexValueDescription() (used for error reports on constraints)  
that would not print all the data stored in the index but the index  
opclass's input type, so this limited the amount of information  
available.  This switch makes gist_page_items() much cheaper as there is  
no need to run ACL checks for each item printed, which is not an issue  
anyway as superuser rights are required to execute the functions of  
pageinspect.  Opclasses whose data cannot be displayed can rely on  
gist_page_items_bytea().  
  
The documentation of this function was slightly incorrect for the  
output results generated on HEAD and v15, so adjust it on these  
branches.  
  
Author: Alexander Lakhin, Michael Paquier  
Discussion: https://postgr.es/m/17884-cb8c326522977acb@postgresql.org  
Backpatch-through: 14  

M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/sql/gist.sql
M doc/src/sgml/pageinspect.sgml
M src/backend/utils/adt/ruleutils.c
M src/include/utils/ruleutils.h

doc: improve pg_walinspect and role membership items

commit   : 613a7eca9ca9f13d1f9fd8a7806bbded1836e58f    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 23:17:03 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 23:17:03 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

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

doc: improve description of adding roles as members

commit   : ce3673daded3fe3a101b0c008235dcf8bfe9ffec    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 22:22:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 22:22:17 -0400    

Click here for diff

Discussion: https://postgr.es/m/ZFvVZvQDliIWmOwg@momjian.us  

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

doc: update PG 16 relnotes for pg_walinspect changes

commit   : f79ee34702d485fb30427816b95e6c944660fc23    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 21:44:22 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 21:44:22 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

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

Show empty BRIN ranges in brin_page_items

commit   : 428c0cae929b7d2b26a830fbba55619c57ceba55    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 01:53:30 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 01:53:30 +0200    

Click here for diff

Commit 3581cbdcd6 added a flag to identify empty BRIN ranges. This adds  
the new flag to brin_page_items() output.  
  
This is kept as a separate commit as it should not be backpatched.  
  
Reviewed-by: Justin Pryzby, Matthias van de Meent, Alvaro Herrera  
Discussion: https://postgr.es/m/402430e4-7d9d-6cf1-09ef-464d80afff3b@enterprisedb.com  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/pageinspect–1.11–1.12.sql
M doc/src/sgml/pageinspect.sgml
M src/test/modules/brin/expected/summarization-and-inprogress-insertion.out

Fix handling of empty ranges and NULLs in BRIN

commit   : 3581cbdcd64f5aceb445f60df23141d08ed50617    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 00:00:22 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Fri, 19 May 2023 00:00:22 +0200    

Click here for diff

BRIN indexes did not properly distinguish between summaries for empty  
(no rows) and all-NULL ranges, treating them as essentially the same  
thing. Summaries were initialized with allnulls=true, and opclasses  
simply reset allnulls to false when processing the first non-NULL value.  
This however produces incorrect results if the range starts with a NULL  
value (or a sequence of NULL values), in which case we forget the range  
contains NULL values when adding the first non-NULL value.  
  
This happens because the allnulls flag is used for two separate  
purposes - to mark empty ranges (not representing any rows yet) and  
ranges containing only NULL values.  
  
Opclasses don't know which of these cases it is, and so don't know  
whether to set hasnulls=true. Setting the flag in both cases would make  
it correct, but it would also make BRIN indexes useless for queries with  
IS NULL clauses. All ranges start empty (and thus allnulls=true), so all  
ranges would end up with either allnulls=true or hasnulls=true.  
  
The severity of the issue is somewhat reduced by the fact that it only  
happens when adding values to an existing summary with allnulls=true.  
This can happen e.g. for small tables (because a summary for the first  
range exists for all BRIN indexes), or for tables with large fraction of  
NULL values in the indexed columns.  
  
Bulk summarization (e.g. during CREATE INDEX or automatic summarization)  
that processes all values at once is not affected by this issue. In this  
case the flags were updated in a slightly different way, not forgetting  
the NULL values.  
  
To identify empty ranges we use a new flag, stored in an unused bit in  
the BRIN tuple header so the on-disk format remains the same. A matching  
flag is added to BrinMemTuple, into a 3B gap after bt_placeholder.  
That means there's no risk of ABI breakage, although we don't actually  
pass the BrinMemTuple to any public API.  
  
We could also skip storing index tuples for empty summaries, but then  
we'd have to always process such ranges - even if there are no rows in  
large parts of the table (e.g. after a bulk DELETE), it would still  
require reading the pages etc. So we store them, but ignore them when  
building the bitmap.  
  
Backpatch to 11. The issue exists since BRIN indexes were introduced in  
9.5, but older releases are already EOL.  
  
Backpatch-through: 11  
Reviewed-by: Justin Pryzby, Matthias van de Meent, Alvaro Herrera  
Discussion: https://postgr.es/m/402430e4-7d9d-6cf1-09ef-464d80afff3b@enterprisedb.com  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_tuple.c
M src/include/access/brin_tuple.h
M src/test/modules/brin/expected/summarization-and-inprogress-insertion.out
M src/test/modules/brin/specs/summarization-and-inprogress-insertion.spec

doc: PG 16 relnotes, add freeze and update walinspect items

commit   : 1158c8c4e350b92ad6fecae894c8c1c777495954    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:53:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:53:28 -0400    

Click here for diff

Reported-by: Peter Geoghegan  

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

docs: re-order some PG 16 relnotes items

commit   : 07ef30a0282064f688a1923ba5e7c850f2ff5776    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:25:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 18:25:21 -0400    

Click here for diff

Reported-by: Jonathan Katz  

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

doc: more PG 16 relnote wording improvements

commit   : d8a81108a87bd5e8e9ca136d3195e146a58b9e4d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 17:42:47 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 17:42:47 -0400    

Click here for diff

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

Fix handling of NULLs when merging BRIN summaries

commit   : 3ec8a3bfb5472ecf93aba416e9f384ea16d340d1    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 18 May 2023 13:00:31 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 18 May 2023 13:00:31 +0200    

Click here for diff

When merging BRIN summaries, union_tuples() did not correctly update the  
target hasnulls/allnulls flags. When merging all-NULL summary into a  
summary without any NULL values, the result had both flags set to false  
(instead of having hasnulls=true).  
  
This happened because the code only considered the hasnulls flags,  
ignoring the possibility the source summary has allnulls=true.  
  
Discovered while investigating issues with handling empty BRIN ranges  
and handling of NULL values, but it's a separate problem (has nothing to  
do with empty ranges).  
  
Fixed by considering both flags on the source summary, and updating the  
hasnulls flag on the target summary.  
  
Backpatch to 11. The bug exists since 9.5 (where BRIN indexes were  
introduced), but those releases are EOL already.  
  
Discussion: https://postgr.es/m/9d993d0d-e431-2196-9ccc-0554d0e60154%40enterprisedb.com  

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

doc: add more sections to PG 16 release notes

commit   : 0791930aaaed2678daf694fa8b06cf81cd72cd69    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:33:05 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:33:05 -0400    

Click here for diff

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

doc: first draft of the PG 16 release notes

commit   : 206a67e27fa15d75bd7b9ddf41d7e18d19bbb9db    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:00:04 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 18 May 2023 16:00:04 -0400    

Click here for diff

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

Fix documentation build broken by 1e16af8ab5.

commit   : c9dc480a21f2746f5a96a8f68a22e633ba69c405    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 11:04:30 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 11:04:30 -0700    

Click here for diff

M doc/src/sgml/charset.sgml

Doc improvements for language tags and custom ICU collations.

commit   : 1e16af8ab5d7f307b66e496eff6ec573d9fd8eb0    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 10:37:55 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 May 2023 10:37:55 -0700    

Click here for diff

Separate the documentation for language tags themselves from the  
available collation settings which can be included in a language tag.  
  
Include tables of the available options, more details about the  
effects of each option, and additional examples.  
  
Also include an explanation of the "levels" of textual features and  
how they relate to collation.  
  
Discussion: https://postgr.es/m/25787ec7-4c04-9a8a-d241-4dc9be0b1ba3@postgresql.org  
Reviewed-by: Jonathan S. Katz  

M doc/src/sgml/charset.sgml

Tweak API of new function clause_is_computable_at().

commit   : 8a2523ff354077180084b43a04be01f10aafdb8c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 May 2023 10:39:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 May 2023 10:39:16 -0400    

Click here for diff

Pass it the RestrictInfo under consideration, not just the  
clause_relids.  This should save some trivial amount of  
code at the call sites, and it gives us more flexibility  
about what clause_is_computable_at() does.  There's no  
actual functional change here, though.  
  
Discussion: https://postgr.es/m/3564467.1684352557@sss.pgh.pa.us  

M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/include/optimizer/restrictinfo.h

ICU: check for U_STRING_NOT_TERMINATED_WARNING.

commit   : 1c634f6647c28354258d114041252475325aea32    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:43:41 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:43:41 -0700    

Click here for diff

Fixes memory error in cases where the length of the language name  
returned by uloc_getLanguage() is exactly ULOC_LANG_CAPACITY, in which  
case the status is set to U_STRING_NOT_TERMINATED_WARNING.  
  
Also check in call sites for other ICU functions that are expected to  
return a C string to be safe (no bug is known at these other call  
sites).  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/2098874d-c111-41e4-9063-30bcf135226b@gmail.com  

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

Reduce icu_validation_level default to WARNING.

commit   : 6de31ce446e59a1f947c7ebe4e4bbe7ca2b842bc    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:18:40 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 17 May 2023 13:18:40 -0700    

Click here for diff

Discussion: https://postgr.es/m/daa9f060aa2349ebc84444515efece49e7b32c5d.camel@j-davis.com  

M doc/src/sgml/config.sgml
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Fix error message wordings

commit   : 009bd237bf6db64ea1131df71f19a529b119fbef    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 17 May 2023 21:33:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 17 May 2023 21:33:13 +0200    

Click here for diff

The original patch for percentrepl.c c96de2ce17 adopted the error  
messages from basebackup_to_shell, but that uses terminology that  
doesn't really fit with the new API naming.  

M src/common/percentrepl.c

Add writeback to pg_stat_io

commit   : 093e5c57d506783a95dd8feddd9a3f2651e1aeba    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:18:35 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:18:35 -0700    

Click here for diff

28e626bde00 added the concept of IOOps but neglected to include writeback  
operations. ac8d53dae5 added time spent doing these I/O operations. Without  
counting writeback, checkpointer write time in the log often differed  
substantially from that in pg_stat_io. To fix this, add IOOp IOOP_WRITEBACK  
and track writeback in pg_stat_io.  
  
Bumps catversion.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20230419172326.dhgyo4wrrhulovt6%40awork3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/storage/buf_internals.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Update parameter name context to wb_context

commit   : 52676dc2e016df5cd842a4f6073b25ee8e681b9f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:12 -0700    

Click here for diff

For clarity of review, renaming the function parameter "context" in  
ScheduleBufferTagForWriteback() and IssuePendingWritebacks() to  
"wb_context" is a separate commit. The next commit adds an "io_context"  
parameter and "wb_context" makes it more clear which is which.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/include/storage/buf_internals.h

Use BUFFER_USAGE_LIMIT to reduce needed test table size

commit   : 322875597c0c15cd85d03c8621038f4945c8caa3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 17 May 2023 11:17:02 -0700    

Click here for diff

Using the minimum BUFFER_USAGE_LIMIT value, we can make one of the pg_stat_io  
test tables smaller while still causing reuses.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_acc6iL4M3hvOTeztf_ZPpsB3Pqio5aVHgZ5q=Pi3BZKg@mail.gmail.com  

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

Revert "Add USER SET parameter values for pg_db_role_setting"

commit   : b9a7a822723aebb16cbe7e5fb874e5124745b07e    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 17 May 2023 20:06:50 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Wed, 17 May 2023 20:06:50 +0300    

Click here for diff

This reverts commit 096dd80f3ccc and its fixups beecbe8e5001, afdd9f7f0e00,  
529da086ba, db93e739ac61.  
  
Catversion is bumped.  
  
Discussion: https://postgr.es/m/d46f9265-ff3c-6743-2278-6772598233c2%40pgmasters.net  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_database.sgml
M doc/src/sgml/ref/alter_role.sgml
M doc/src/sgml/ref/alter_user.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_db_role_setting.h
M src/include/nodes/parsenodes.h
M src/include/utils/guc.h
M src/test/modules/Makefile
M src/test/modules/meson.build
D src/test/modules/test_pg_db_role_setting/.gitignore
D src/test/modules/test_pg_db_role_setting/Makefile
D src/test/modules/test_pg_db_role_setting/expected/test_pg_db_role_setting.out
D src/test/modules/test_pg_db_role_setting/meson.build
D src/test/modules/test_pg_db_role_setting/sql/test_pg_db_role_setting.sql
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting–1.0.sql
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.c
D src/test/modules/test_pg_db_role_setting/test_pg_db_role_setting.control
M src/test/regress/expected/psql.out

pg_dump: Error message improvements

commit   : 58dc80acc5ebf12223be90db1a97dc0b31ca4e1f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 19:13:08 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 19:13:08 +0200    

Click here for diff

Remove spurious semicolon from one error message, and print the  
offending value of a parameter reported as invalid in another.  

M src/bin/pg_dump/compress_zstd.c

pg_dump: Have _EndLO report errno after CFH->write_func() failure

commit   : 98bd4c72fd6c4f9d6a2b3b449cb89f335116ab5a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 18:55:51 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 17 May 2023 18:55:51 +0200    

Click here for diff

Other callers of that function do things this way, but this one didn't  
get the memo.  

M src/bin/pg_dump/pg_backup_directory.c

Track tlist_vinfo.varnullingrels even in non-Assert builds.

commit   : 69c430626b5eb44825a12e8bc90a59a90c4f5a03    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:46:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:46:15 -0400    

Click here for diff

Oversight in commit 867be9c07 (which should get reverted  
along with that, if we ever do revert it).  Per buildfarm.  

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

Fix some issues with improper placement of outer join clauses.

commit   : 9df8f903eb6758be5a19e66cdf77e922e9329c31    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:13:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 11:13:52 -0400    

Click here for diff

After applying outer-join identity 3 in the forward direction,  
it was possible for the planner to mistakenly apply a qual clause  
from above the two outer joins at the now-lower join level.  
This can give the wrong answer, since a value that would get nulled  
by the now-upper join might not yet be null.  
  
To fix, when we perform such a transformation, consider that the  
now-lower join hasn't really completed the outer join it's nominally  
responsible for and thus its relid set should not include that OJ's  
relid (nor should its output Vars have that nullingrel bit set).  
Instead we add those bits when the now-upper join is performed.  
The existing rules for qual placement then suffice to prevent  
higher qual clauses from dropping below the now-upper join.  
There are a few complications from needing to consider transitive  
closures in case multiple pushdowns have happened, but all in all  
it's not a very complex patch.  
  
This is all new logic (from 2489d76c4) so no need to back-patch.  
The added test cases all have the same results as in v15.  
  
Tom Lane and Richard Guo  
  
Discussion: https://postgr.es/m/0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru  

M src/backend/optimizer/README
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql

Convert nullingrels match checks from Asserts to test-and-elog.

commit   : 867be9c0738bef591544d39985f886b7d8e99bf0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 10:50:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 May 2023 10:50:35 -0400    

Click here for diff

It seems like the code that these checks are backstopping may have  
a few bugs left in it.  Use a test-and-elog so that the tests are  
performed even in non-assert builds, and so that we get something  
more informative than "server closed the connection" on failure.  
  
Committed separately with the idea that eventually we'll revert  
this.  It might be awhile though.  
  
Discussion: https://postgr.es/m/3014965.1684293045@sss.pgh.pa.us  

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

Advance input pointer when LZ4 compressing data

commit   : 1a05c1d252993b0a59c58a6daf91a2df9333044f    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:49:31 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:49:31 +0200    

Click here for diff

LZ4File_write() did not advance the input pointer on subsequent invocations of  
LZ4F_compressUpdate(). As a result the generated compressed output would be a  
compressed version of the same input chunk.  
  
Tests failed to catch this error because the data would comfortably fit  
within the default buffer size, as a single chunk. Tests have been added  
to provide adequate coverage of multi-chunk compression.  
  
WriteDataToArchiveLZ4() which is also using LZ4F_compressUpdate() did  
not suffer from this omission.  
  
Author: Georgios Kokolatos <gkokolatos@pm.me>  
Reported-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/ZFhCyn4Gm2eu60rB%40paquier.xyz  

M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/t/002_pg_dump.pl

Null-terminate the output buffer of LZ4Stream_gets

commit   : 3c18d90f8907e53c3021fca13ad046133c480e4d    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:35:17 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 17 May 2023 16:35:17 +0200    

Click here for diff

LZ4Stream_gets did not null-terminate its output buffer. The callers expected  
the buffer to be null-terminated and passed it around to functions such as  
sscanf with unintended consequences.  
  
Author: Georgios Kokolatos <gkokolatos@pm.me>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/94ae9bca-5ebb-1e68-bb7b-4f32e89fefbe@gmail.com  

M src/bin/pg_dump/compress_lz4.c

Add back SQLValueFunction for SQL keywords

commit   : d8c3106bb60e4f87be595f241e173ba3c2b7aa2c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 May 2023 10:19:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 May 2023 10:19:17 +0900    

Click here for diff

This is equivalent to a revert of f193883 and fb32748, with the addition  
that the declaration of the SQLValueFunction node needs to gain a couple  
of node_attr for query jumbling.  The performance impact of removing the  
function call inlining is proving to be too huge for some workloads  
where these are used.  A worst-case test case of involving only simple  
SELECT queries with a SQL keyword is proving to lead to a reduction of  
10% in TPS via pgbench and prepared queries on a high-end machine.  
  
None of the tests I ran back for this set of changes saw such a huge  
gap, but Alexander Lakhin and Andres Freund have found that this can be  
noticeable.  Keeping the older performance would mean to do more  
inlining in the executor when using COERCE_SQL_SYNTAX for a function  
expression, similarly to what SQLValueFunction does.  This requires more  
redesign work and there is little time until 16beta1 is released, so for  
now reverting the change is the best way forward, bringing back the  
previous performance.  
  
Bump catalog version.  
  
Reported-by: Alexander Lakhin  
Discussion: https://postgr.es/m/b32bed1b-0746-9b20-1472-4bdc9ca66d52@gmail.com  

M src/backend/catalog/system_functions.sql
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/nodes/primnodes.h
M src/include/utils/date.h
M src/include/utils/timestamp.h
M src/test/regress/expected/expressions.out
M src/test/regress/sql/expressions.sql
M src/tools/pgindent/typedefs.list

Ensure Soundex difference() function handles empty input sanely.

commit   : 1d369c9e90f311ec98b07a259cac48c404c773d5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 May 2023 10:53:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 16 May 2023 10:53:42 -0400    

Click here for diff

fuzzystrmatch's difference() function assumes that _soundex()  
always initializes its output buffer fully.  This was not so for  
the case of a string containing no alphabetic characters, resulting  
in unstable output and Valgrind complaints.  
  
Fix by using memset() to fill the whole buffer in the early-exit  
case.  Also make some cosmetic improvements (I didn't care for the  
random switches between "instr[0]" and "*instr" notation).  
  
Report and diagnosis by Alexander Lakhin (bug #17935).  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/17935-b99316aa79c18513@postgresql.org  

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

libpq: Error message improvement

commit   : 27debd05dcbdfe3db487ba82568f7f9ae25ddde2    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:50:08 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:50:08 +0200    

Click here for diff

Move a variable name out of the translatable message, to make it  
identical to others.  

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

Mark internal messages as no longer translatable

commit   : c44b59fad453fd4be9656d58dd5f51a11149c961    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:47:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 16 May 2023 11:47:25 +0200    

Click here for diff

The problem that these messages protect against can only occur because  
a corrupted hash spill file was written, i.e., a Postgres bug.  There's  
no reason to have them as translatable.  
  
Backpatch to 15, where these messages were changed by commit c4649cce39a4.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/20230510175407.dwa5v477pw62ikyx@alvherre.pgsql  

M src/backend/executor/nodeAgg.c

Fix reported runtime for single tests in pg_regress

commit   : 8cb94344c3c7130a0cd5e21e83705739f552187e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 May 2023 10:49:48 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 16 May 2023 10:49:48 +0200    

Click here for diff

Commit 558fff0adf got the order of the parameters to test_status_failed  
mixed up which resulted in the runtime being reported as 0 ms.  Fix by  
changing the order to the correct one.  No backpatching is needed since  
this has not been shipped in a release yet.  
  
Discussion: https://postgr.es/m/0134C9EC-5F6B-4EAC-B2D5-BB4249BEBD4D@yesql.se  

M src/test/regress/pg_regress.c

doc: Fix ordering of entries in wait event table for I/O type

commit   : 44e977d7ecb915d1181007e700f2da31acb6ea4c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 May 2023 16:51:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 16 May 2023 16:51:44 +0900    

Click here for diff

Issue spotted while reviewing a different patch touching this area.  
  
Discussion: https://postgr.es/m/ZGM1U5D5EuBUbasi@paquier.xyz  

M doc/src/sgml/monitoring.sgml

libpq: Error message improvement

commit   : c91f3560835f76bd8c9f614bebaa8c634b98b451    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 08:59:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 08:59:34 +0200    

Click here for diff

M src/interfaces/libpq/fe-auth.c
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/005_sspi.pl
M src/test/kerberos/t/001_auth.pl

psql: Adjust capitalization of table heading

commit   : 489b5409e4a0fa36c951561bae8ae4394e7d623f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 06:13:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 16 May 2023 06:13:59 +0200    

Click here for diff

for consistency with surrounding headings  

M src/bin/psql/describe.c
M src/test/regress/expected/subscription.out

doc: Fix incorrect version list for Windows SDK

commit   : 08c45ae235660844167de8730da908d351f4352d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 May 2023 16:02:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 15 May 2023 16:02:07 +0900    

Click here for diff

References to SDK 8.1a should have been cleaned up in 495ed0e, as only  
version 10 and above are supported with Windows 10 and newer versions.  
  
Reported-by: Thomas Munro  
Discussion: https://postgr.es/m/CA+hUKG++qE9uVjQaTTD7oaC8a2T3h8K50=Eqyx9uUZvOHa__ww@mail.gmail.com  

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

Fix incorrect TAP test ordering

commit   : 92155e15d3cfe97758552484acb1583aaf71cda6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 07:07:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 07:07:09 +0200    

Click here for diff

Using a test function before a possible skip_all is incorrect.  If the  
skip_all is called, the test output will become incorrect and the test  
file will fail.  
  
a4f23f9b3c introduced a new test before skip_all.  After discussion,  
this doesn't really need to be a test.  Instead, we just bail out if  
the condition is not satisfied.  
  
Discussion: https://www.postgresql.org/message-id/af5567a1-aea6-fbdb-7e4b-d1e23a43c43b@enterprisedb.com  

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix whitespace inconsistencies

commit   : 1d70fb400c2c8312dac3ff19a1bb1cb5351047ce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 06:27:40 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 15 May 2023 06:27:40 +0200    

Click here for diff

M src/bin/pg_amcheck/t/004_verify_heapam.pl

Fix wal_writer_flush_after initializer value.

commit   : 63932a6d38e5dfa6df2a51a04b7314ec1e4d3de7    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:45:19 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:45:19 +1200    

Click here for diff

Commit a73952b7956 (new in 16) required default values in guc_table.c  
and C variable initializers to match.  This one only matched when  
XLOG_BLCKSZ == 8kB.  Fix by using the same expression in both places  
with a new DEFAULT_XXX macro, as done for other GUCs.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA+hUKGLNmLV=VrT==5MqnbARgx2ifRSFtdd8ofdfrdSLL3yv5A@mail.gmail.com  

M src/backend/postmaster/walwriter.c
M src/backend/utils/misc/guc_tables.c
M src/include/postmaster/walwriter.h

Rename io_direct to debug_io_direct.

commit   : 319bae9a8da66678d80d862440e54cebc7b1cc24    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:31:14 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 15 May 2023 10:31:14 +1200    

Click here for diff

Give the new GUC introduced by d4e71df6 a name that is clearly not  
intended for mainstream use quite yet.  
  
Future proposals would drop the prefix only after adding infrastructure  
to make it efficient.  Having the switch in the tree sooner is good  
because it might lead to new discoveries about the hazards awaiting us  
on a wide range of systems, but that name was too enticing and could  
lead to cross-version confusion in future, per complaints from Noah and  
Justin.  
  
Suggested-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> (the idea, not the patch)  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (ditto)  
Discussion: https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com  

M doc/src/sgml/config.sgml
M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc_tables.c
M src/test/modules/test_misc/t/004_io_direct.pl

Improve error message for pg_create_subscription.

commit   : 4d5105a684ba20bf6a98e6ae48224fe93382c040    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 12 May 2023 13:50:46 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Fri, 12 May 2023 13:50:46 -0700    

Click here for diff

c3afe8cf5a updated this error message, but it didn't use the new  
style established in de4d456b40.  
  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/20230512203721.GA2644063%40nathanxps13.home  

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

Tighten usage of PSQL_WATCH_PAGER.

commit   : 51b2c08798867cb9788090704b37c4698b456240    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 May 2023 16:11:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 12 May 2023 16:11:14 -0400    

Click here for diff

Don't use PSQL_WATCH_PAGER when stdin/stdout are not a terminal.  
This corresponds to the restrictions on when other commands will  
use [PSQL_]PAGER.  There isn't a lot of sense in trying to use a  
pager in non-interactive cases, and doing so allows an environment  
setting to break our tests.  
  
Also, ignore PSQL_WATCH_PAGER if it is set but empty or all-blank,  
for the same reasons we ignore such settings of [PSQL_]PAGER (see  
commit 18f8f784c).  
  
No documentation change is really needed, since there is nothing  
suggesting that these constraints on [PSQL_]PAGER didn't already  
apply to PSQL_WATCH_PAGER too.  But I rearranged the text  
a little to make it read more naturally (IMHO anyway).  
  
Per report from Pavel Stehule.  Back-patch to v15 where  
PSQL_WATCH_PAGER was introduced.  
  
Discussion: https://postgr.es/m/CAFj8pRDTwFzmEWdA-gdAcUh0ZnxUioSfTMre71WyB_wNJy-8gw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c

initdb: Set collversion for standard collation UNICODE

commit   : e32701b8d285cd402f75fc9059d083e89ee8166b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 May 2023 09:45:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 12 May 2023 09:45:50 +0200    

Click here for diff

Since the behavior of the UNICODE collation can change with new  
ICU/Unicode versions, we need to apply the versioning mechanism to it.  
We do this with an UPDATE command in initdb; this is similar to how we  
put the collation version into pg_database already.  
  
Reported-by: Daniel Verite <daniel@manitou-mail.org>  
Discussion: https://www.postgresql.org/message-id/49417853-7bdd-4b23-a4e9-04c7aff33821@manitou-mail.org  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h

Undo faulty attempt at not relying on RINFO_IS_PUSHED_DOWN.

commit   : c8b881d21fd8e0214bc43280d6231cc2c6ef55ef    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 May 2023 13:44:25 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 11 May 2023 13:44:25 -0400    

Click here for diff

I've had a bee in my bonnet for some time about getting rid of  
RestrictInfo.is_pushed_down, because it's squishily defined and  
requires not-inexpensive extra tests to use (cf RINFO_IS_PUSHED_DOWN).  
In commit 2489d76c4, I tried to make remove_rel_from_query() not  
depend on that macro; but the replacement test is buggy,  
as exposed by a report from Rushabh Lathia and Robert Haas.  
That change was pretty incidental to the main goal of 2489d76c4,  
so let's just revert it for now.  (Getting rid of is_pushed_down  
is still far away, anyway.)  
  
Discussion: https://postgr.es/m/CA+TgmoYco=hmg+iX1CW9Y1_CzNoSL81J03wUG-d2_3=rue+L2A@mail.gmail.com  

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

commit   : 375407f4940ba0922513666f00852c54943eb1a0    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 May 2023 10:49:50 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 10 May 2023 10:49:50 -0700    

Click here for diff

Fix a link from the "Heap-Only Tuples" documentation section.  
Previously, its "fillfactor" link pointed to the "CREATE TABLE"  
command's documentation.  Now the link directly points to the fillfactor  
storage parameter documentation (which is about half way into the  
"CREATE TABLE" sect1).  
  
Oversight in commit 115464bb.  
  
Backpatch: 12-, the first version with a usable reloption link.  

M doc/src/sgml/storage.sgml

Fix publication syntax error message

commit   : c39f2f68e95a54e430c6a7b7d1e9f98cedff5aff    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 May 2023 18:26:10 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 10 May 2023 18:26:10 +0200    

Click here for diff

There was some odd wording in corner-case gram.y error messages "some  
error ... at or near", which appears to have been modeled after "syntax  
error" messages.  However, they don't work that way, and they're just  
wrong.  They're also uncovered by tests.  Remove the trailing words,  
and also add tests.  
  
They were introduced with 5a2832465fd8; backpatch to 15.  
  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  

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

Add missing gettext triggers

commit   : d8bcce1b5e99d8f6f12cb7a94190fdc5622355af    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 May 2023 13:51:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 10 May 2023 13:51:51 +0200    

Click here for diff

due to the changes in commit dac048f71e  

M src/backend/nls.mk

Fix assertion failure when updating stats_fetch_consistency in a transaction

commit   : 605994651b6a4209b418cb09d3c223ca269f7cfc    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 11:24:30 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 11:24:30 +0900    

Click here for diff

An update of the GUC stats_fetch_consistency in a transaction would be  
able to trigger an assertion when doing cache->snapshot.  In this case,  
when retrieving a pgstat entry after the switch, a new snapshot would be  
rebuilt, confusing pgstat_build_snapshot() because a snapshot is already  
cached with an unexpected mode ("cache").  
  
In order to fix this problem, this commit adds a flag to force a  
snapshot clear each time this GUC is changed.  Some tests are added to  
check, while on it.  
  
Some optimizations in avoiding the snapshot clear should be possible  
depending on what is cached and the current GUC value, I guess, but this  
solution is simple, and ensures that the state of the cache is updated  
each time a new pgstat entry is fetched, hence being consistent with the  
level wanted by the client that has set the GUC.  
  
Note that cache->none and snapshot->none would not cause issues, as  
fetching a pgstat entry would be retrieved from shared memory on the  
second attempt, however a snapshot would still be cached.  Similarly,  
none->snapshot and none->cache would build a new snapshot on the second  
fetch attempt.  Finally, snapshot->cache would cache a new snapshot on  
the second attempt.  
  
Reported-by: Alexander Lakhin  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/17804-2a118cd046f2d0e5@postgresql.org  
backpatch-through: 15  

M doc/src/sgml/config.sgml
M src/backend/utils/activity/pgstat.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc_hooks.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Document values of stats_fetch_consistency in postgresql.conf.sample

commit   : 4d47eff99cc08255f0ae3cc27dc24cc9b30a32e7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 10:19:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 10 May 2023 10:19:57 +0900    

Click here for diff

Issue noted while looking at a patch related to that.  
  
Discussion: https://postgr.es/m/ZE9LiFc7JdNHokz/@paquier.xyz  

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

Fix the race condition in the test case added by commit a6e04b1d20.

commit   : c5b7f67fcc8c4a01c82660eb0996a3c697fac283    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 14:25:33 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 14:25:33 +0530    

Click here for diff

The commit a6e04b1d20 added a test to ensure that the invalidated logical  
slots don't retain WAL. The test was ensuring that the checkpoint removes  
the WAL files corresponding to invalidated logical slots on the standby  
node but missed the point that the standby node also had a physical slot  
which led to the prevention of WAL file removal. Move the creation of  
physical slot on the standby and initialization of cascading standby closer  
to the test case that actually required it so that other tests don't get  
affected by the presence of the physical slot on standby.  
  
Author: Bertrand Drouvot  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

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

Fix invalid memory access during the shutdown of the parallel apply worker.

commit   : 3d144c6c86025272e1711539f5fafb6fb85c4feb    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 09:28:06 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 9 May 2023 09:28:06 +0530    

Click here for diff

The callback function pa_shutdown() accesses MyLogicalRepWorker which may  
not be initialized if there is an error during the initialization of the  
parallel apply worker. The other problem is that by the time it is invoked  
even after the initialization of the worker, the MyLogicalRepWorker will  
be reset by another callback logicalrep_worker_onexit. So, it won't have  
the required information.  
  
To fix this, register the shutdown callback after we are attached to the  
worker slot.  
  
After this fix, we observed another issue which is that sometimes the  
leader apply worker tries to receive the message from the error queue that  
might already be detached by the parallel apply worker leading to an  
error. To prevent such an error, we ensure that the leader apply worker  
detaches from the parallel apply worker's error queue before stopping it.  
  
Reported-by: Sawada Masahiko  
Author: Hou Zhijie  
Reviewed-by: Sawada Masahiko, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDo+yUwNq6nTrvE2h9bB2vZfcag=jxWc7QxuWCmkDAqcA@mail.gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/include/replication/worker_internal.h

Revert "ICU: do not convert locale 'C' to 'en-US-u-va-posix'."

commit   : 455f948b0d03a556533a7e4a1a8abf45f0eb202e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 20:50:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 20:50:51 -0700    

Click here for diff

This reverts commit f7faa9976cc0504c027a20ed66ceca9018041dd4.  
  
Discussion: https://postgr.es/m/483826.1683582475@sss.pgh.pa.us  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Doc: update VACUUM FREEZE query conflict guidance.

commit   : 5698f07947396e1a7cd6564390306aafa26fc189    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 May 2023 13:17:31 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 8 May 2023 13:17:31 -0700    

Click here for diff

Commit 1de58df4, which added page-level freezing, taught VACUUM to reuse  
each page's "set-visibility-map" snapshotConflictHorizon for freezing  
(at least in the vast majority of cases where freezing went ahead).  
This made VACUUM FREEZE much less prone to generating recovery conflicts  
on standbys; VACUUM FREEZE became only slightly more likely to cause  
recovery conflicts than an equivalent VACUUM.  
  
Update old documentation that specifically warned of the likelihood of  
recovery conflicts from VACUUM FREEZE.  Explain the same general issue  
(the issue of VACUUM generating recovery conflicts even in the absence  
of dead row cleanup) using the example of conflicts caused by VISIBLE  
WAL records.  

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

ICU: do not convert locale 'C' to 'en-US-u-va-posix'.

commit   : f7faa9976cc0504c027a20ed66ceca9018041dd4    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 10:34:51 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 8 May 2023 10:34:51 -0700    

Click here for diff

The conversion was intended to be for convenience, but it's more  
likely to be confusing than useful.  
  
The user can still directly specify 'en-US-u-va-posix' if desired.  
  
Discussion: https://postgr.es/m/f83f089ee1e9acd5dbbbf3353294d24e1f196e95.camel@j-davis.com  
Discussion: https://postgr.es/m/37520ec1ae9591f83132f82dbd625f3fc2d69c16.camel@j-davis.com  

M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Adjust sepgsql expected output for 681d9e462 et al.

commit   : 8d525d7b9545884a3e0d79adcd61543f9ae2ae28    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 11:24:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 11:24:47 -0400    

Click here for diff

Security: CVE-2023-2454  

M contrib/sepgsql/expected/ddl.out

Handle RLS dependencies in inlined set-returning functions properly.

commit   : ca73753b090c33bc69ce299b4d7fff891a77b8ad    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 10:12:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 8 May 2023 10:12:44 -0400    

Click here for diff

If an SRF in the FROM clause references a table having row-level  
security policies, and we inline that SRF into the calling query,  
we neglected to mark the plan as potentially dependent on which  
role is executing it.  This could lead to later executions in the  
same session returning or hiding rows that should have been hidden  
or returned instead.  
  
Our thanks to Wolfgang Walther for reporting this problem.  
  
Stephen Frost and Tom Lane  
  
Security: CVE-2023-2455  

M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql

Replace last PushOverrideSearchPath() call with set_config_option().

commit   : 681d9e4621aac0a9c71364b6f54f00f6d8c4337f    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 8 May 2023 06:14:07 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 8 May 2023 06:14:07 -0700    

Click here for diff

The two methods don't cooperate, so set_config_option("search_path",  
...) has been ineffective under non-empty overrideStack.  This defect  
enabled an attacker having database-level CREATE privilege to execute  
arbitrary code as the bootstrap superuser.  While that particular attack  
requires v13+ for the trusted extension attribute, other attacks are  
feasible in all supported versions.  
  
Standardize on the combination of NewGUCNestLevel() and  
set_config_option("search_path", ...).  It is newer than  
PushOverrideSearchPath(), more-prevalent, and has no known  
disadvantages.  The "override" mechanism remains for now, for  
compatibility with out-of-tree code.  Users should update such code,  
which likely suffers from the same sort of vulnerability closed here.  
Back-patch to v11 (all supported versions).  
  
Alexander Lakhin.  Reported by Alexander Lakhin.  
  
Security: CVE-2023-2454  

M contrib/seg/Makefile
A contrib/seg/expected/security.out
A contrib/seg/sql/security.sql
M src/backend/catalog/namespace.c
M src/backend/commands/schemacmds.c
M src/test/regress/expected/namespace.out
M src/test/regress/sql/namespace.sql

Add missing source file to nls.mk

commit   : b8c3f6df85e78e09c9709fc895aced719aebd7f9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 08:24:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 08:24:42 +0200    

Click here for diff

M src/bin/pg_dump/nls.mk

pg_dump: Restore lost translation marker

commit   : 9f9abfeb10026bc2c2ac7076c6adff201608eab5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 07:43:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 07:43:54 +0200    

Click here for diff

The refactoring in 03d02f54a6 lost a translation marker.  

M src/bin/pg_dump/compress_io.c

doc: Fix some markups in logical replication section

commit   : 0890f7d528c45bcfef7d3edd5618e121f0357250    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 May 2023 13:47:36 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 8 May 2023 13:47:36 +0900    

Click here for diff

Author: Peter Smith  
Reviewed-by: David Zhang  
Discussion: https://postgr.es/m/CAHut+Pst11ac2hcmePt1=oTmBwTT=DAssRR1nsdoy4BT+68=Mg@mail.gmail.com  

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

pg_basebackup: Restore lost translation markers

commit   : 90f0d2881445a266038d349073e571f06def656b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 06:15:26 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 8 May 2023 06:15:26 +0200    

Click here for diff

The refactoring in ebfb814f7c lost some translation markers.  

M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/walmethods.c

Add ruleutils support for decompiling MERGE commands.

commit   : 41e2c52fd6ebed6eff4184f68048813cc8886ec1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 May 2023 11:01:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 7 May 2023 11:01:15 -0400    

Click here for diff

This was overlooked when MERGE was added, but it's essential  
support for MERGE in new-style SQL functions.  
  
Alvaro Herrera  
  
Discussion: https://postgr.es/m/3579737.1683293801@sss.pgh.pa.us  

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

Fix typo with wait event for SLRU buffer of commit timestamps

commit   : 58f5edf849900bc248b7c909ca17da7287306c41    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 May 2023 21:25:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 5 May 2023 21:25:44 +0900    

Click here for diff

This wait event was documented as "CommitTsBuffer" since its  
introduction, but the code named it "CommitTSBuffer".  This commit fixes  
the code to follow the term documented, which is also more consistent  
with the naming of the other wait events used for commit timestamps.  
  
Introduced by 5da1493.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  
Backpatch-through: 13  

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

Fix sepgsql expected test output

commit   : 95f5a7a42c048ec01ba2650496296fe88aacd50f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 5 May 2023 11:10:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 5 May 2023 11:10:25 +0200    

Click here for diff

Commit f75cec4fff87 changed the order in which the relations are  
permission-checked in RI_Initial_Check, which the sepgsql test is  
sensitive to.  Adapt.  
  
Discussion: https://postgr.es/m/3468125.1683238309@sss.pgh.pa.us  

M contrib/sepgsql/expected/alter.out

Fix copy-and-pasto in error message

commit   : b1c4ed2f02b0c4cf1942e6eb2995bdbf8db5cccf    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 07:50:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 07:50:08 +0200    

Click here for diff

from 2fe3bdbd69  

M src/bin/pg_upgrade/option.c

Fix prove_installcheck when used with PGXS

commit   : 5d42a97519581a31bdc1d3d4cf10c07ae18b8296    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 06:29:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 5 May 2023 06:29:49 +0200    

Click here for diff

Commit 153e215677 added the portlock directory.  This is created in  
$ENV{top_builddir} if it is set.  Under PGXS, top_builddir points into  
the installation directory, which is not necessarily writable and in  
any case inappropriate to use by a test suite.  The cause of the  
problem is that the prove_installcheck target in Makefile.global  
exports top_builddir, which isn't useful (since no other Perl code  
actually reads it) and breaks this use case.  The reason this code is  
there is probably that is has been dragged around with various other  
changes, in particular a0fc813266, but without a real purpose of its  
own.  By just removing the exporting of top_builddir in  
prove_installcheck, the portlock directory then ends up under  
tmp_check in the build directory, which is more suitable.  
  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://www.postgresql.org/message-id/78d1cfa6-0065-865d-584b-cde6d8c18aff@enterprisedb.com  

M src/Makefile.global.in

Move return statements out of PG_TRY blocks.

commit   : 57d0051706b897048063acc14c2c3454200c488f    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 May 2023 11:32:43 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Wed, 3 May 2023 11:32:43 -0700    

Click here for diff

If we exit a PG_TRY block early via "continue", "break", "goto", or  
"return", we'll skip unwinding its exception stack.  This change  
moves a couple of such "return" statements in PL/Python out of  
PG_TRY blocks.  This was introduced in d0aa965c0a and affects all  
supported versions.  
  
We might also be able to add compile-time checks to prevent  
recurrence, but that is left as a future exercise.  
  
Reported-by: Mikhail Gribkov, Xing Guo  
Author: Xing Guo  
Reviewed-by: Michael Paquier, Andres Freund, Tom Lane  
Discussion: https://postgr.es/m/CAMEv5_v5Y%2B-D%3DCO1%2Bqoe16sAmgC4sbbQjz%2BUtcHmB6zcgS%2B5Ew%40mail.gmail.com  
Discussion: https://postgr.es/m/CACpMh%2BCMsGMRKFzFMm3bYTzQmMU5nfEEoEDU2apJcc4hid36AQ%40mail.gmail.com  
Backpatch-through: 11 (all supported versions)  

M src/pl/plpython/plpy_exec.c

Fix ExecCheckPermissions call in RI_Initial_Check

commit   : f75cec4fff877ef24e4932a628fc974f3116ed16    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 19:55:56 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 19:55:56 +0200    

Click here for diff

RI_Initial_Check was setting up a list of RTEPermissionInfo for  
ExecCheckPermissions() wrong, and the problem is subtle enough that it  
doesn't have any immediate effect in core code.  However, if an  
extension is using the ExecutorCheckPerms_hook, then it would get the  
wrong parameters and perhaps arrive at a wrong conclusion, or outright  
malfunction.  Fix by constructing that list and the RTE list more  
honestly.  
  
We also add an assertion check to verify that these lists match.  This  
new assertion would have caught this bug.  
  
Co-authored-by: Олег Целебровский (Oleg Tselebrovskii) <o.tselebrovskiy@postgrespro.ru>  
Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/3722b7a2cbe27a1796ee40824bd86dd1@postgrespro.ru  

M src/backend/executor/execMain.c
M src/backend/utils/adt/ri_triggers.c

In array_position()/array_positions(), beware of empty input array.

commit   : 4c40995f61227c579bd7269a829c00013ac66492    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:48:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:48:23 -0400    

Click here for diff

These functions incautiously fetched the array's first lower bound  
even when the array is zero-dimensional, thus fetching the word  
after the allocated array space.  While almost always harmless,  
with very bad luck this could result in SIGSEGV.  Fix by adding  
an early exit for empty input.  
  
Per bug #17920 from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/17920-f7c228c627b6d02e%40postgresql.org  

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

Tighten array dimensionality checks in Python -> SQL array conversion.

commit   : 0553528e7c2bb9eb4148ff9e3c51b9094ab67f70    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:00:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 4 May 2023 11:00:33 -0400    

Click here for diff

Like plperl before f47004add, plpython wasn't being sufficiently  
careful about checking that list-of-list structures represent  
rectangular arrays, so that it would accept some cases in which  
different parts of the "array" are nested to different depths.  
This was exacerbated by Python's weak distinction between  
sequences and lists, so that in some cases strings could get  
treated as though they are lists (and burst into individual  
characters) even though a different ordering of the upper-level  
list would give a different result.  
  
Some of this behavior was unreachable (without risking a crash)  
before 81eaaf65e.  It seems like a good idea to clean it all up  
in the same releases, rather than shipping a non-crashing but  
nonetheless visibly buggy behavior in the name of minimal change.  
Hence, back-patch.  
  
Per bug #17912 and further testing by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_types.sql

Revert "Move PartitionPruneInfo out of plan nodes into PlannedStmt"

commit   : 5472743d9e8583638a897b47558066167cc14583    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 12:09:59 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 4 May 2023 12:09:59 +0200    

Click here for diff

This reverts commit ec386948948c and its fixup 589bb816499e.  
  
This change was intended to support query planning avoiding acquisition  
of locks on partitions that were going to be pruned; however, the  
overall project took a different direction at [1] and this bit is no  
longer needed.  Put things back the way they were as agreed in [2], to  
avoid unnecessary complexity.  
  
Discussion: [1] https://postgr.es/m/4191508.1674157166@sss.pgh.pa.us  
Discussion: [2] https://postgr.es/m/20230502175409.kcoirxczpdha26wt@alvherre.pgsql  

M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/partitioning/partprune.c
M src/include/catalog/catversion.h
M src/include/executor/execPartition.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/partitioning/partprune.h

doc: New glossary entries

commit   : 919c486a275bcdd83d2add77da87b6edbd91418c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 May 2023 06:44:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 4 May 2023 06:44:38 +0200    

Click here for diff

Add:  
  
- "Restartpoint"  
- "Log sequence number"  
  
"LSN" was already listed in the Acronyms appendix, but it is more  
suitable as a glossary entry, so move it there and have the acronyms  
entry link into the glossary.  
  
Also turn on DocBook parameter glossentry.show.acronym to show  
acronyms for glossary entries, which is being used here.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://www.postgresql.org/message-id/flat/60915312-62cd-9c94-0d94-556023ece45f%40enterprisedb.com  

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

Test that invalidated logical slots doesn't retain WAL.

commit   : a6e04b1d20c2e9cece9b64bb5b36ebfdc3a9031b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 4 May 2023 08:33:56 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 4 May 2023 08:33:56 +0530    

Click here for diff

Author: Bertrand Drouvot  
Reviewed-by: Shi yu, Amit Kapila, Vignesh C  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

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

Add missing TAP test name

commit   : 1ab763fc22adc88e5d779817e7b42b25a9dd7c9e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 May 2023 11:08:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 3 May 2023 11:08:24 +0200    

Click here for diff

M src/bin/pg_waldump/t/002_save_fullpage.pl

Fix assertion failure in apply worker.

commit   : de63f8dadee4afa152ce177fd3c562d47373a728    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 May 2023 10:13:13 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 3 May 2023 10:13:13 +0530    

Click here for diff

During exit, the logical replication apply worker tries to release session  
level locks, if any. However, if the apply worker exits due to an error  
before its connection is initialized, trying to release locks can lead to  
assertion failure. The locks will be acquired once the worker is  
initialized, so we don't need to release them till the worker  
initialization is complete.  
  
Reported-by: Alexander Lakhin  
Author: Hou Zhijie based on inputs from Sawada Masahiko and Amit Kapila  
Reviewed-by: Amit Kapila  
Discussion: https://postgr.es/m/2185d65f-5aae-3efa-c48f-fb42b173ef5c@gmail.com  

M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/include/replication/worker_internal.h

Doc: clarify behavior of row-limit arguments in the PLs' SPI wrappers.

commit   : 6489875ce6b16662142bc70e003437b9753c199f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 May 2023 17:55:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 2 May 2023 17:55:01 -0400    

Click here for diff

plperl, plpython, and pltcl all provide query-execution functions  
that are thin wrappers around SPI_execute() or its variants.  
The SPI functions document their row-count limit arguments clearly,  
as "maximum number of rows to return, or 0 for no limit".  However  
the PLs' documentation failed to explain this special behavior of  
zero, so that a reader might well assume it means "fetch zero  
rows".  Improve that.  
  
Daniel Gustafsson and Tom Lane, per report from Kieran McCusker  
  
Discussion: https://postgr.es/m/CAGgUQ6H6qYScctOhktQ9HLFDDoafBKHyUgJbZ6q_dOApnzNTXg@mail.gmail.com  

M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml

Fix overridden callbacks in pg_rewind.

commit   : 08237056f84e3a9ed75e8a698428c669f4d35db4    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 2 May 2023 13:15:29 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 2 May 2023 13:15:29 +0200    

Click here for diff

The <source>_traverse_files functions take a callback for processing  
files, but both the local and libpq source implementations called the  
function directly without using the callback argument. While there is  
no bug right now as the function called is the same as the callback,  
fix by calling the callback to reduce the risk of subtle bugs in the  
future.  
  
Author: Junwang Zhao <zhjwpku@gmail.com>  
Reviewed-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/CAEG8a3Jdwgh+PZr2zh1=t8apA4Yz8tKq+uubPqoCt14nvWKHEw@mail.gmail.com  

M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c

Update SQL features

commit   : e0bb5d0c5bcada63dc9b8a1a72a344a07bf930ce    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 10:59:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 10:59:21 +0200    

Click here for diff

Some updates for SQL:2023 and some new features in PostgreSQL 16.  

M src/backend/catalog/sql_feature_packages.txt
M src/backend/catalog/sql_features.txt

Add missing uninstallation rule for BackgroundPsql.pm

commit   : 7039c7cff6736780c3bbb41a90a6dfea0f581ad2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 09:41:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 2 May 2023 09:41:03 +0200    

Click here for diff

Commit a4c17c8617 added in the install rule but not the uninstall  
rule.  

M src/test/perl/Makefile

Fix typos in comments

commit   : 8961cb9a0315fa23458587b3df547ca8d8e00f85    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 12:23:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 12:23:08 +0900    

Click here for diff

The changes done in this commit impact comments with no direct  
user-visible changes, with fixes for incorrect function, variable or  
structure names.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  

M config/config.sub
M contrib/amcheck/verify_nbtree.c
M contrib/intarray/_int.h
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/nodeAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/optimizer/plan/planagg.c
M src/backend/parser/gram.y
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/syncrep.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/spin.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/mb/mbutils.c
M src/bin/pg_rewind/rewind_source.h
M src/include/access/tableam.h
M src/include/access/toast_helper.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/queryjumble.h
M src/include/pg_config_manual.h
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
M src/pl/plperl/plperl.c
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/subscription/t/004_sync.pl

doc: Fix typo in pg_amcheck for term "schema"

commit   : 6fd8ae6888847da842ee4810fcd83b013cbed27f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 11:40:46 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 2 May 2023 11:40:46 +0900    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/e8c38840-596a-83d6-bd8d-cebc51111572@gmail.com  
Backpatch-through: 14  

M doc/src/sgml/ref/pg_amcheck.sgml

Tighten array dimensionality checks in Perl -> SQL array conversion.

commit   : f47004add16041a9cbd19aef29775ca4d9d6001e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Apr 2023 13:06:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 29 Apr 2023 13:06:44 -0400    

Click here for diff

plperl_array_to_datum() wasn't sufficiently careful about checking  
that nested lists represent a rectangular array structure; it would  
accept inputs such as "[1, []]".  This is a bit related to the  
PL/Python bug fixed in commit 81eaaf65e, but it doesn't seem to  
provide any direct route to a memory stomp.  Instead the likely  
failure mode is for makeMdArrayResult to be passed fewer Datums than  
the claimed array dimensionality requires, possibly leading to a wild  
pointer dereference and SIGSEGV.  
  
Per report from Alexander Lakhin.  It's been broken for a long  
time, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com  

M src/pl/plperl/expected/plperl_array.out
M src/pl/plperl/plperl.c
M src/pl/plperl/sql/plperl_array.sql

Handle zero-length sublist correctly in Python -> SQL array conversion.

commit   : 81eaaf65e393d03f49a781009fba876f81fe9d0b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 28 Apr 2023 12:24:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 28 Apr 2023 12:24:29 -0400    

Click here for diff

If PLySequence_ToArray came across a zero-length sublist, it'd compute  
the overall array size as zero, possibly leading to a memory clobber.  
(This would likely qualify as a security bug, were it not that plpython  
is an untrusted language already.)  
  
I think there are other corner-case issues in this code as well, notably  
that the error messages don't match the core code and for some ranges  
of array sizes you'd get "invalid memory alloc request size" rather than  
the intended message about array size.  
  
Really this code has no business doing its own array size calculation  
at all, so remove the faulty code in favor of using ArrayGetNItems().  
  
Per bug #17912 from Alexander Lakhin.  Bug seems to have come in with  
commit 94aceed31, so back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org  

M src/pl/plpython/expected/plpython_types.out
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/sql/plpython_types.sql

Fix crashes with CREATE SCHEMA AUTHORIZATION and schema elements

commit   : 4dadd660f0719206ce3914d4ad9b6aad69d6db6e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 28 Apr 2023 19:29:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 28 Apr 2023 19:29:12 +0900    

Click here for diff

CREATE SCHEMA AUTHORIZATION with appended schema elements can lead to  
crashes when comparing the schema name of the query with the schemas  
used in the qualification of some clauses in the elements' queries.  
  
The origin of the problem is that the transformation routine for the  
elements listed in a CREATE SCHEMA query uses as new, expected, schema  
name the one listed in CreateSchemaStmt itself.  However, depending on  
the query, CreateSchemaStmt.schemaname may be NULL, being computed  
instead from the role specification of the query given by the  
AUTHORIZATION clause, that could be either:  
- A user name string, with the new schema name being set to the same  
value as the role given.  
- Guessed from CURRENT_ROLE, SESSION_ROLE or CURRENT_ROLE, with a new  
schema name computed from the security context where CREATE SCHEMA is  
running.  
  
Regression tests are added for CREATE SCHEMA with some appended elements  
(some of them with schema qualifications), covering also some role  
specification patterns.  
  
While on it, this simplifies the context structure used during the  
transformation of the elements listed in a CREATE SCHEMA query by  
removing the fields for the role specification and the role type.  They  
were not used, and for the role specification this could be confusing as  
the schema name may by extracted from that at the beginning of  
CreateSchemaCommand().  
  
This issue exists for a long time, so backpatch down to all the versions  
supported.  
  
Reported-by: Song Hongyu  
Author: Michael Paquier  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/17909-f65c12dfc5f0451d@postgresql.org  
Backpatch-through: 11  

M src/backend/commands/schemacmds.c
M src/backend/parser/parse_utilcmd.c
M src/include/parser/parse_utilcmd.h
A src/test/regress/expected/create_schema.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/create_schema.sql

Fix assertion failure in heap_vacuum_rel

commit   : 4a6603cd4650a335ee38d894d7bbb452b1bf822f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 28 Apr 2023 10:30:05 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 28 Apr 2023 10:30:05 +0200    

Click here for diff

Commit 7d71d3dd08 changed resetting the VacuumFailsafeActive flag to an  
assertion since the flag is reset before starting vacuuming a relation.  
This however failed to take recursive calls of vacuum_rel() and vacuum  
of TOAST tables into consideration. Fix by reverting back to resettting  
the flag.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: John Naylor <john.naylor@enterprisedb.com>  
Discussion: https://postgr.es/m/CAFBsxsFz=GqaG5Ens5aNgVYoV2Y+pfMUijX0ku+CCkWfALwiqg@mail.gmail.com  

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

Add unit to vacuum_buffer_usage_limit value in postgresql.conf.sample.

commit   : b72f564d87d10b5e5a91aedec605e48f80cb74ee    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 28 Apr 2023 15:40:12 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Fri, 28 Apr 2023 15:40:12 +0900    

Click here for diff

Also adjust the indentation of the comment to the surrounding parameters.  
  
Author: Masahiko Sawada  
Reviewed-by: David Rowley, Daniel Gustafsson, Melanie Plageman  
Discussion: https://postgr.es/m/CAD21AoCBSqmqOKVH4Q256DeCC_UE50gu1sgixcjLFZGLEbABVA@mail.gmail.com  

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

Improve one of the test cases in 035_standby_logical_decoding.pl.

commit   : 4d26d93ff7fbf7bde5710595255ca9c8033a1402    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 28 Apr 2023 08:45:19 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 28 Apr 2023 08:45:19 +0530    

Click here for diff

The test to ensure that decoding changes via logical slot from another  
database will fail was incorrectly done on the primary node instead of on  
the standby node.  
  
In the passing, make the test to wait for replay catchup by using  
wait_for_replay_catchup(). This will make it consistent with the way we  
wait at other places in the test.  
  
Author: Shi yu  
Reviewed-by: Bertrand Drouvot, Amit Kapila  
Discussion: https://postgr.es/m/OSZPR01MB6310B0A507A0F2A2D379F38CFD6A9@OSZPR01MB6310.jpnprd01.prod.outlook.com  

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

Prevent underflow in KeepLogSeg().

commit   : b72623671d9c0ead4ac219c69762246073fe2185    
  
author   : Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 27 Apr 2023 13:43:48 -0700    
  
committer: Nathan Bossart <nathan@postgresql.org>    
date     : Thu, 27 Apr 2023 13:43:48 -0700    

Click here for diff

The call to XLogGetReplicationSlotMinimumLSN() might return a  
greater LSN than the one given to the function.  Subsequent segment  
number calculations might then underflow, which could result in  
unexpected behavior when removing or recyling WAL files.  This was  
introduced with max_slot_wal_keep_size in c655077639.  To fix, skip  
the block of code for replication slots if the LSN is greater.  
  
Reported-by: Xu Xingwang  
Author: Kyotaro Horiguchi  
Reviewed-by: Junwang Zhao  
Discussion: https://postgr.es/m/17903-4288d439dee856c6%40postgresql.org  
Backpatch-through: 13  

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

Fix wrong construct_array_builtin() call in GUCArrayDelete()

commit   : db93e739ac61332126207b16f14da93f8ecac594    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 27 Apr 2023 22:06:14 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Thu, 27 Apr 2023 22:06:14 +0300    

Click here for diff

The current code unintentionally uses the wrong datum to construct an array.  
The bug was introduced by 096dd80f3c, so no backpatching is needed.  
  
Reported-by: David Steele  
Discussion: https://postgr.es/m/d46f9265-ff3c-6743-2278-6772598233c2%40pgmasters.net  
Author: Nathan Bossart  
Reviewed-by: David Steele, Tom Lane  

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

In hstore_plpython, avoid crashing when return value isn't a mapping.

commit   : df38157d94662a64e2f83aa8a0110fd1ee7c4776    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Apr 2023 11:55:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 27 Apr 2023 11:55:06 -0400    

Click here for diff

Python 3 changed the behavior of PyMapping_Check(), breaking the  
test in plpython_to_hstore() that verifies whether a function result  
to be transformed is acceptable.  A backwards-compatible fix is to  
first verify that the object doesn't pass PySequence_Check().  
  
Perhaps accidentally, our other uses of PyMapping_Check() already  
follow uses of PySequence_Check(), so that no other bugs were  
created by this change.  
  
Per bug #17908 from Alexander Lakhin.  Back-patch to all supported  
branches.  
  
Dmitry Dolgov and Tom Lane  
  
Discussion: https://postgr.es/m/17908-3f19a125d56a11d6@postgresql.org  

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

Add a test to verify that subscription to the standby works.

commit   : 376dc820531bafcbf105fff74c5b14c23d9950af    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 27 Apr 2023 14:22:53 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 27 Apr 2023 14:22:53 +0530    

Click here for diff

Author: Bertrand Drouvot  
Reviewed-by: Vignesh C, Alvaro Herrera, Amit Kapila  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  

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

Rework code defining default compression for dir/custom formats in pg_dump

commit   : bedc1f0564d12c4a89fc9de3044201166542dc3d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Apr 2023 13:34:05 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 27 Apr 2023 13:34:05 +0900    

Click here for diff

As written, pg_dump would call twice parse_compress_specification() for  
the custom and directory formats to build a compression specification if  
no compression option is defined, as these formats should be compressed  
by default when compiled with zlib, or use no compression without zlib.  
This made the code logic quite confusing, and the first compression  
specification built would be incorrect before being overwritten by the  
second one.  
  
Rather than creating two compression specifications, this commit changes  
a bit the order of the checks for the compression options so as  
compression_algorithm_str is now set to a correct value for the custom  
and format directory when no compression option is defined.  This makes  
the code easier to understand, as parse_compress_specification() is now  
called once for all the format, with or without user-specified  
compression methods.  One comment was also confusing for the non-zlib  
case, so remove it while on it.  
  
This code has been introduced in 5e73a60 when adding support for  
compression specifications in pg_dump.  
  
Per discussion with Justin Pryzby and Georgios Kokolatos.  
  
Discussion: https://postgr.es/m/20230225050214.GH1653@telsasoft.com  

M src/bin/pg_dump/pg_dump.c

Fix stop condition for dumping GRANT commands

commit   : 7b7fa85130330128b404eddebd4f33c6739454b0    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 14:24:13 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 14:24:13 +0200    

Click here for diff

Commit ce6b672e44 changed dumping GRANT commands to ensure that  
grantors already have an ADMIN OPTION on the role for which it  
is granting permissions. Looping over the grants per role has a  
stop condition on dumping the grant statements, but accidentally  
missed updating the variable for the conditional check.  
  
Author: Andreas Scherbaum <ads@pgug.de>  
Co-authored-by: Artur Zakirov <zaartur@gmail.com>  
Discussion: https://postgr.es/m/de44299d-cd31-b41f-2c2a-161fa5e586a5@pgug.de  

M src/bin/pg_dump/pg_dumpall.c

doc: Fix grammar.

commit   : 4def50eba99e0a7e9b4c09fa3e33209d6d6fb834    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 26 Apr 2023 20:15:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 26 Apr 2023 20:15:00 +0900    

Click here for diff

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

Fix missing installation rules for BackgroundPsql.pm

commit   : a4c17c86176cfa712f541b81b2a026ae054b275e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 11:40:01 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 26 Apr 2023 11:40:01 +0200    

Click here for diff

Commit 664d75753 added the BackgroundPsql module with helper functions  
for tests running interactive or background psql tasks. The new module  
was however not added to the install rules of the build systems.  
  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/c0ba3008-dbc8-e53f-29f2-2e9abe72b2a2@enterprisedb.com  

M src/test/perl/Makefile
M src/test/perl/meson.build

Remove bogus #include added by d4e71df6d75.

commit   : 828e93a6f2dbf4bc7a24bc3ce166c34879eeb8b1    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 26 Apr 2023 10:39:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 26 Apr 2023 10:39:46 +1200    

Click here for diff

The recently added inclusion of guc.h in smgr.h is not necessary and  
introduces more server-related stuff. Removing the directive helps  
avoid potential issues with including sgmr.h in frontends.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20230425.115748.2130383825066921512.horikyota.ntt%40gmail.com  

M src/include/storage/smgr.h

Re-add tracking of wait event SLRUFlushSync

commit   : 84cc1426745b4bc91242caec9173a2ca19a4af79    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Apr 2023 07:10:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 26 Apr 2023 07:10:06 +0900    

Click here for diff

SLRUFlushSync has been accidently removed during dee663f, that has moved  
the flush of the SLRU files to the checkpointer, so add it back.  The  
issue has been noticed by Thomas when checking for orphaned wait  
events.  
  
Author: Thomas Munro  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CA+hUKGK6tqm59KuF1z+h5Y8fsWcu5v8+84kduSHwRzwjB2aa_A@mail.gmail.com  

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

Fix vacuum_cost_delay check for balance calculation.

commit   : bfac8f8bc4a44c67c9f35b5266676278e4ba1217    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 25 Apr 2023 13:54:10 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 25 Apr 2023 13:54:10 +0200    

Click here for diff

Commit 1021bd6a89 excluded autovacuum workers from cost-limit balance  
calculations when per-relation options were set.  The code checks for  
limit and cost_delay being greater than zero, but since cost_delay can  
be set to -1 the test needs to check for greater than or zero.  
  
Backpatch to all supported branches since 1021bd6a89 was backpatched  
all the way at the time.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com  
Backpatch-through: v11 (all supported branches)  

M src/backend/postmaster/autovacuum.c

Reduce the log level in 035_standby_logical_decoding.pl.

commit   : 3034dc56ef4b9bc1490e2b1e09fcdf3eeae53e8f    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Apr 2023 08:33:09 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 25 Apr 2023 08:33:09 +0530    

Click here for diff

Reduce the log level in 035_standby_logical_decoding.pl as the test  
doesn't require the higher log level. This helps to shrink the output size  
and speed up the test a bit.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/2fefa454-5a70-2174-ddbf-4a0e41537139@gmail.com  
Discussion: https://postgr.es/m/523315.1681245505@sss.pgh.pa.us  

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

Fix buffer refcount leak with FDW bulk inserts

commit   : 806fad7573e2b44de57888e3c04eab8eec4a69a8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 25 Apr 2023 09:42:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 25 Apr 2023 09:42:19 +0900    

Click here for diff

The leak would show up when using batch inserts with foreign tables  
included in a partition tree, as the slots used in the batch were not  
reset once processed.  In order to fix this problem, some  
ExecClearTuple() are added to clean up the slots used once a batch is  
filled and processed, mapping with the number of slots currently in use  
as tracked by the counter ri_NumSlots.  
  
This buffer refcount leak has been introduced in b676ac4 with the  
addition of the executor facility to improve bulk inserts for FDWs, so  
backpatch down to 14.  
  
Alexander has provided the patch (slightly modified by me).  The test  
for postgres_fdw comes from me, based on the test case that the author  
has sent in the report.  
  
Author: Alexander Pyhalov  
Discussion: https://postgr.es/m/b035780a740efd38dc30790c76927255@postgrespro.ru  
Backpatch-through: 14  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/executor/nodeModifyTable.c

Remove vacuum_defer_cleanup_age

commit   : 1118cd37eb61e6a2428f457a8b2026a7bb3f801a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 24 Apr 2023 12:20:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 24 Apr 2023 12:20:52 -0700    

Click here for diff

vacuum_defer_cleanup_age was introduced before hot_standby_feedback and  
replication slots existed. It is hard to use reasonably - commonly it will  
either be set too low (not preventing recovery conflicts, while still causing  
some bloat), or too high (causing a lot of bloat). The alternatives do not  
have that issue.  
  
That on its own might not be sufficient reason to remove  
vacuum_defer_cleanup_age, but it also complicates computation of xid  
horizons. See e.g. the bug fixed in be504a3e974. It also is untested.  
  
This commit removes TransactionIdRetreatSafely(), as there are no users  
anymore. There might be potential future users, hence noting that here.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20230317230930.nhsgk3qfk7f4axls@awork3.anarazel.de  

M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_upgrade/server.c
M src/include/storage/standby.h

Fix memory leakage in plpgsql DO blocks that use cast expressions.

commit   : 441ee1677e6b580794c81943a937cd84363672f3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Apr 2023 14:19:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Apr 2023 14:19:46 -0400    

Click here for diff

Commit 04fe805a1 modified plpgsql so that datatype casts make use of  
expressions cached by plancache.c, in place of older code where these  
expression trees were managed by plpgsql itself.  However, I (tgl)  
forgot that we use a separate, shorter-lived cast info hashtable in  
DO blocks.  The new mechanism thus resulted in session-lifespan  
leakage of the plancache data once a DO block containing one or more  
casts terminated.  To fix, split the cast hash table into two parts,  
one that tracks only the plancache's CachedExpressions and one that  
tracks the expression state trees generated from them.  DO blocks need  
their own expression state trees and hence their own version of the  
second hash table, but there's no reason they can't share the  
CachedExpressions with regular plpgsql functions.  
  
Per report from Ajit Awekar.  Back-patch to v12 where the issue  
was introduced.  
  
Ajit Awekar and Tom Lane  
  
Discussion: https://postgr.es/m/CAHv6PyrNaqdvyWUspzd3txYQguFTBSnhx+m6tS06TnM+KWc_LQ@mail.gmail.com  

M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/plpgsql.h

Rename ExecAggTransReparent, and improve its documentation.

commit   : fce3b26e97ca98de054734e2af7d9125661a9b3f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Apr 2023 13:01:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 24 Apr 2023 13:01:33 -0400    

Click here for diff

The name of this function suggests that it ought to reparent R/W  
expanded objects to be children of the persistent aggcontext, instead  
of copying them.  In fact it does no such thing, and if you try to  
make it do so you will see multiple regression failures.  Rename it  
to the less-misleading ExecAggCopyTransValue, and add commentary  
about why that attractive-sounding optimization won't work.  Also  
adjust comments at call sites, some of which were describing logic  
that has since been moved into ExecAggCopyTransValue.  
  
Discussion: https://postgr.es/m/3004282.1681930251@sss.pgh.pa.us  

M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/executor/execExpr.h

doc: Update SQL features names

commit   : 5a8366ad75eb70cffa791119b404c897983260c6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 24 Apr 2023 15:39:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 24 Apr 2023 15:39:54 +0200    

Click here for diff

Some feature names have been adjusted over time upstream.  This pulls  
in those changes.  

M src/backend/catalog/sql_features.txt

ci: Remove OpenSSL 3.1 workaround for missing system CA

commit   : c5e4ec293ea527394fc1d0006ab88047b3ce580f    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 24 Apr 2023 11:40:23 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 24 Apr 2023 11:40:23 +0200    

Click here for diff

Commit 0b5d1fb36 fixed the SSL test to properly handle the error message  
from OpenSSL when the system CA pool is missing of invalid, so with that  
we can remove the workaround in Cirrus for when Homebrew clears the cert  
from OPENSSLDIR.  
  
Author: Jacob Champion <jchampion@timescale.com>  
Discussion: https://postgr.es/m/CAAWbhmj3JtKuRcHcMuf1eCJmoZxMXdzLaYpEGmzu9+kgRGpu3A@mail.gmail.com  

M .cirrus.yml

Remove duplicate lines of code

commit   : 69537f5d17eab2919c9d88880cb242de1e7a647d    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 24 Apr 2023 11:16:17 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 24 Apr 2023 11:16:17 +0200    

Click here for diff

Commit 6df7a9698bb accidentally included two identical prototypes for  
default_multirange_selectivi() and commit 086cf1458c6 added a break;  
statement where one was already present, thus duplicating it.  While  
there is no bug caused by this, fix by removing the duplicated lines  
as they provide no value.  
  
Backpatch the fix for duplicate prototypes to v14 and the duplicate  
break statement fix to all supported branches to avoid backpatching  
hazards due to the removal.  
  
Reported-by: Anton Voloshin <a.voloshin@postgrespro.ru>  
Discussion: https://postgr.es/m/0e69cb60-0176-f6d0-7e15-6478b7d85724@postgrespro.ru  

M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/interfaces/ecpg/preproc/variable.c

Use elog to report unexpected action in handle_streamed_transaction().

commit   : 781ac42d43ab2b5af07fd720a01c68348a4d1d20    
  
author   : Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 24 Apr 2023 15:37:14 +0900    
  
committer: Masahiko Sawada <msawada@postgresql.org>    
date     : Mon, 24 Apr 2023 15:37:14 +0900    

Click here for diff

An oversight in commit 216a784829c.  
  
Author: Masahiko Sawada  
Reviewed-by: Kyotaro Horiguchi, Amit Kapila  
Discussion: https://postgr.es/m/CAD21AoDDbM8_HJt-nMCvcjTK8K9hPzXWqJj7pyaUvR4mm_NrSg@mail.gmail.com  

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

Display 'password_required' option for \dRs+ command.

commit   : 19e65dff38bdccdf2cac7f2083342101df6bea57    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 24 Apr 2023 08:37:58 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 24 Apr 2023 08:37:58 +0530    

Click here for diff

The commit c3afe8cf5a added a new subscription option 'password_required'  
which should be shown with \dRs+ command.  
  
Author: Vignesh C  
Reviewed-by: Amit Kapila, Robert Haas  
Discussion: https://postgr.es/m/CAA4eK1LRz5sCZxwCW6OtpjLtWPvRwBihQOM4jzQm6ppfpexqGA@mail.gmail.com  
Discussion: https://postgr.es/m/9DFC88D3-1300-4DE8-ACBC-4CEF84399A53@enterprisedb.com  

M src/bin/psql/describe.c
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql

Remove new <para id="contrib-obsolete">.

commit   : 244ab8c00c427d35901a6f1eb97e4e22b2916e7e    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 23 Apr 2023 18:58:19 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 23 Apr 2023 18:58:19 -0700    

Click here for diff

Just intagg is obsolete, and having a one-entry list gives undue weight.  
  
Discussion: https://postgr.es/m/20230409185050.GA949159@rfd.leadboat.com  

M doc/src/sgml/contrib.sgml

Validate ltree siglen GiST option to be int-aligned

commit   : 8bbd0cce92be98de9f4f727b8bf66fe26e5831ea    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 23 Apr 2023 13:58:25 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 23 Apr 2023 13:58:25 +0300    

Click here for diff

Unaligned siglen could lead to an unaligned access to subsequent key fields.  
  
Backpatch to 13, where opclass options were introduced.  
  
Reported-by: Alexander Lakhin  
Bug: 17847  
Discussion: https://postgr.es/m/17847-171232970bea406b%40postgresql.org  
Reviewed-by: Tom Lane, Pavel Borisov, Alexander Lakhin  
Backpatch-through: 13  

M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_gist.c
M contrib/ltree/sql/ltree.sql
M doc/src/sgml/ltree.sgml

Fix custom validators call in build_local_reloptions()

commit   : cd115c3530bd59bb0305d62ccef1c9504207ff4c    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 23 Apr 2023 13:55:49 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sun, 23 Apr 2023 13:55:49 +0300    

Click here for diff

We need to call them only when validate == true.  
  
Backpatch to 13, where opclass options were introduced.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/2656633.1681831542%40sss.pgh.pa.us  
Reviewed-by: Tom Lane, Pavel Borisov  
Backpatch-through: 13  

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

Doc: update pgindent/README some more.

commit   : 0ec0e2095579ca16fb4f3aee086e57fd1a7533eb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Apr 2023 11:52:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 22 Apr 2023 11:52:46 -0400    

Click here for diff

In commit 2e6ba1315, I missed that there was a redundant  
second reference to pg_bsd_indent's old repo.  

M src/tools/pgindent/README

Fix initdb --no-locale.

commit   : 5cd1a5af4d17496a58678c8eb7ab792119c2d723    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 21 Apr 2023 13:11:18 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 21 Apr 2023 13:11:18 -0700    

Click here for diff

Discussion: https://postgr.es/m/878relf7cb.fsf@news-spur.riddles.org.uk  
Reported-by: Andrew Gierth  

M src/bin/initdb/initdb.c

Avoid character classification in regex escape parsing.

commit   : c04c6c5d6f5f213f217f1e356bf1c2d8b4e255a2    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 21 Apr 2023 08:19:41 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 21 Apr 2023 08:19:41 -0700    

Click here for diff

For regex escape sequences, just test directly for the relevant ASCII  
characters rather than using locale-sensitive character  
classification.  
  
This fixes an assertion failure when a locale considers a non-ASCII  
character, such as "൧", to be a digit.  
  
Reported-by: Richard Guo  
Discussion: https://postgr.es/m/CAMbWs49Q6UoKGeT8pBkMtJGJd+16CBFZaaWUk9Du+2ERE5g_YA@mail.gmail.com  
Backpatch-through: 11  

M src/backend/regex/regc_lex.c

Reorder connection markers in loadbalance tests

commit   : a23ab2eebfb19bacb9e8d91edb822a0fec37334c    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 21 Apr 2023 12:29:38 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 21 Apr 2023 12:29:38 +0200    

Click here for diff

Commit 7f5b198 introduced TAP tests that use string literals to mark  
the presence of a query in server logs.  Reorder the markers to make  
sure they are used in alphabetical order for easier debugging.  
  
Author: Gurjeet Singh <gurjeet@singh.im>  
Reviewed-by: Jelte Fennema <postgres@jeltef.nl>  
Discussion: https://postgr.es/m/CABwTF4WcYAENqyUQS2crAYfDuJ497v82ty2-MirjaC+zz9e8nQ@mail.gmail.com  

M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl

Make libpq error messages consistent for translation

commit   : 60ce452729239f10ebbd0803a0ecc460f7f9238a    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 21 Apr 2023 10:23:38 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 21 Apr 2023 10:23:38 +0200    

Click here for diff

The errormessage for an incorrect require_auth method wasn't using the  
common "invalid %s value" errormessage which lessens the burden on our  
translators.  Fix by changing to that format to make use of existing  
translations and to make error messages consistent in wording.  
  
Reported and fixed by Gurjeet Singh with some tweaking by myself.  
  
Author: Gurjeet Singh <gurjeet@singh.im>  
Discussion: https://postgr.es/m/CABwTF4Xu3g9zohJ9obu8m7MKbf8g63NgpRDjwqPHQgAtB+Gb8Q@mail.gmail.com  

M src/interfaces/libpq/fe-connect.c
M src/test/authentication/t/001_password.pl

doc: Add documentation for PGLOADBALANCEHOSTS environment variable in libpq.

commit   : 0a16512d40a58c5046c2ab4ca7eabb8393f31c18    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Fri, 21 Apr 2023 16:46:41 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Fri, 21 Apr 2023 16:46:41 +0900    

Click here for diff

Commit 7f5b19817e introduced the PGLOADBALANCEHOSTS environment  
variable for connection load balancing in libpq. However, documentation  
for this variable was missing.  
  
Author: Fujii Masao  
Reviewed-by: Jelte Fennema  
Discussion: https://postgr.es/m/e2b44cf7-aa16-e726-1d4a-a69508ebf6b9@oss.nttdata.com  

M doc/src/sgml/libpq.sgml

Remove unused global variable

commit   : 84e05beb111335c0755ef37a7f4d64822170b76d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 21 Apr 2023 11:41:58 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 21 Apr 2023 11:41:58 +1200    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/d5f68d19-c0fc-91a9-118d-7c6a5a3f5fad@gmail.com  

M src/test/modules/test_slru/test_slru.c

Fix incorrect function name reference

commit   : d91d1635292a290191339b868bcc71ef42ca50ce    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 21 Apr 2023 10:46:08 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 21 Apr 2023 10:46:08 +1200    

Click here for diff

This function was renamed in 0c9d84427 but this comment wasn't updated.  
  
Author: Alexander Lakhin  
Discussion: https://postgr.es/m/699beab4-a6ca-92c9-f152-f559caf6dc25@gmail.com  

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

Remove io prefix from pg_stat_io columns

commit   : 0ecb87e1fa07a733494e35636e55807b0f3fc1ed    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 21 Apr 2023 07:21:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 21 Apr 2023 07:21:50 +0900    

Click here for diff

a9c70b46 added the statistics view pg_stat_io which contained columns  
"io_context" and "io_object".  Given that the columns are in the  
pg_stat_io view, the "io" prefix is somewhat redundant, so remove it.  
  
The code variables referring to these fields are kept unchanged so as  
they can keep their context about I/O.  
  
Bump catalog version.  
  
Author: Melanie Plageman  
Reviewed-by: Kyotaro Horiguchi, Fabrízio de Royes Mello  
Discussion: https://postgr.es/m/CAAKRu_aAQoJWrvT2BYYQvJChFKra_O-5ra3jhzKJZqWsTR1CPQ@mail.gmail.com  

M contrib/amcheck/expected/check_heap.out
M contrib/amcheck/sql/check_heap.sql
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/adt/pgstatfuncs.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/stats.out
M src/test/regress/sql/stats.sql

Use --strip-unneeded when stripping static libraries with GNU strip.

commit   : eab2d3147e3c13aca4a9aca52c0a9a581a8d224a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 20 Apr 2023 18:12:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 20 Apr 2023 18:12:32 -0400    

Click here for diff

We've long used "--strip-unneeded" for shared libraries but plain  
"-x" for static libraries when stripping symbols with GNU strip.  
There doesn't seem to be any really good reason for that though,  
since --strip-unneeded produces smaller output (as "-x" alone  
does not remove debug symbols).  Moreover it seems that  
llvm-strip, although it identifies as GNU strip, misbehaves when  
given "-x" for this purpose.  It's unclear whether that's  
intentional or a bug in llvm-strip, but in any case it seems like  
changing to use --strip-unneeded in all cases should be a win.  
  
Note that this doesn't change our behavior when dealing with  
non-GNU strip.  
  
Per gripes from Ed Maste and Palle Girgensohn.  Back-patch,  
in case anyone wants to use llvm-strip with stable branches.  
  
Discussion: https://postgr.es/m/17898-5308d09543463266@postgresql.org  
Discussion: https://postgr.es/m/20230420153338.bbj2g5jiyy3afhjz@awork3.anarazel.de  

M config/programs.m4
M configure
M src/makefiles/meson.build

Fix autovacuum cost debug logging

commit   : a9781ae11ba2fdb44a3a72c9a7ebb727140b25c5    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 20 Apr 2023 15:45:44 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 20 Apr 2023 15:45:44 +0200    

Click here for diff

Commit 7d71d3dd0 introduced finer grained updates of autovacuum option  
changes by increasing the frequency of reading the configuration file.  
The debug logging of cost parameter was however changed such that some  
initial values weren't logged.  Fix by changing logging to use the old  
frequency of logging regardless of them changing.  
  
Also avoid taking a log for rendering the log message unless the set  
loglevel is such that the log entry will be emitted.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/CAD21AoBS7o6Ljt_vfqPQPf67AhzKu3fR0iqk8B=vVYczMugKMQ@mail.gmail.com  

M src/backend/postmaster/autovacuum.c

Doc: clarify NULLS NOT DISTINCT use in unique indexes

commit   : 0d0aeb04c1277edb0733cbf5bf4243c47a439015    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 20 Apr 2023 23:51:38 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 20 Apr 2023 23:51:38 +1200    

Click here for diff

indexes-unique.html mentioned nothing about the availability of NULLS NOT  
DISTINCT to modify the NULLs-are-not-equal behavior of unique indexes.  
Add this to the synopsis and clarify what it does regarding NULLs.  
  
Author: David Gilman, David Rowley  
Reviewed-by: Corey Huinker  
Discussion: https://postgr.es/m/CALBH9DDr3NLqzWop1z5uZE-M5G_GYUuAeHFHQeyzFbNd8W0d=Q@mail.gmail.com  
Backpatch-through: 15, where NULLS NOT DISTINCT was added  

M doc/src/sgml/indices.sgml

Restart the apply worker if the 'password_required' option is changed.

commit   : c1cc4e688b60090f194017c6e15e330a725fba3e    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 20 Apr 2023 08:56:18 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 20 Apr 2023 08:56:18 +0530    

Click here for diff

The apply worker is restarted if any subscription option that affects the  
remote connection was changed. In commit c3afe8cf5a, we added the option  
'password_required' which can affect the remote connection, so we should  
restart the worker if it was changed.  
  
Author: Amit Kapila  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/CAA4eK1+z9UDFEynXLsWeMMuUZc1iQkRwj2HNDtxUHTPo-u1F4A@mail.gmail.com  
Discussion: https://postgr.es/m/9DFC88D3-1300-4DE8-ACBC-4CEF84399A53@enterprisedb.com  

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

Remove obsolete defense against strxfrm() bugs.

commit   : 7d3d72b55edd1b7552a9a358991555994efab0e9    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 20 Apr 2023 13:15:23 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 20 Apr 2023 13:15:23 +1200    

Click here for diff

Old versions of Solaris and illumos had buffer overrun bugs in their  
strxfrm() implementations.  The bugs were fixed more than a decade ago  
and the relevant releases are long out of vendor support.  It's time to  
remove the defense added by commit be8b06c3.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA+hUKGJ-ZPJwKHVLbqye92-ZXeLoCHu5wJL6L6HhNP7FkJ=meA@mail.gmail.com  

M src/backend/main/main.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h

Fix list_copy_head() with empty Lists

commit   : e35ded29566f679e52888a8d34468bb51bc78bed    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 20 Apr 2023 10:34:46 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 20 Apr 2023 10:34:46 +1200    

Click here for diff

list_copy_head() given an empty List would crash from trying to  
dereference the List to obtain its length.  Since NIL is how we represent  
an empty List, we should just be returning another empty List in this  
case.  
  
list_copy_head() is new to v16, so let's fix it now before too many people  
start coding around the buggy NIL behavior.  
  
Reported-by: Miroslav Bendik  
Discussion: https://postgr.es/m/CAPoEpV02WhawuWnmnKet6BqU63bEu7oec0pJc=nKMtPsHMzTXQ@mail.gmail.com  

M src/backend/nodes/list.c

Use nbtdesc "level" field name consistently.

commit   : 2584639653eec13726a25d6ea8a4b42153185723    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 19 Apr 2023 12:15:15 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 19 Apr 2023 12:15:15 -0700    

Click here for diff

The "lev" name that appeared in NEWROOT nbtree record desc output was  
inconsistent with the symbol name from the underlying C struct.  It was  
also inconsistent with nbtdesc output for other nearby record types with  
similar level fields.  
  
Standardize on "level" to make everything consistent.  
  
Follow-up to commit 1c453cfd.  

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

Fix wal_consistency_checking enhanced desc output.

commit   : 50547a3fae0ce62e74c1d2175c7949937f2c69fc    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 19 Apr 2023 10:42:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 19 Apr 2023 10:42:39 -0700    

Click here for diff

Recent enhancements to rmgr desc routines that made the output summarize  
certain block data (added by commits 7d8219a4 and 1c453cfd) dealt with  
records that lack relevant block data (and so have nothing to give a  
more detailed summary of) by testing !DecodedBkpBlock.has_image.  As a  
result, more detailed descriptions of block data were not output when  
wal_consistency_checking was enabled.  
  
This bug affected records with summarizable block data that also  
happened to have an FPI that the REDO routine isn't supposed to apply  
(FPIs used for consistency checking purposes only).  The presence of  
such an FPI was incorrectly taken to indicate the absence of block data.  
  
To fix, test DecodedBkpBlock.has_data, not !DecodedBkpBlock.has_image.  
This is the exact condition that we care about, not an inexact proxy.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-Wzm5Sc9cBg1qWV_cEBfLNJCrW9FjS-SoHVt8FLA7Ldn8yg@mail.gmail.com  

M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/include/access/xlogreader.h

Add missed case for tab completion of GRANT/REVOKE MAINTAIN.

commit   : 9e1e9d6560ec60535289ac15729a08e2f7cf4165    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Apr 2023 10:49:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 19 Apr 2023 10:49:53 -0400    

Click here for diff

We failed to offer "ON" after "GRANT MAINTAIN".  
Oversight in commit 60684dd83.  
  
Ken Kato  
  
Discussion: https://postgr.es/m/6afe7712991882a864d6d10003264e7c@oss.nttdata.com  

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

Fix errormessage for missing system CA in OpenSSL 3.1

commit   : 0b5d1fb36adda612bd3d5d032463a6eeb0729237    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 19 Apr 2023 12:54:58 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 19 Apr 2023 12:54:58 +0200    

Click here for diff

The error message for a missing or invalid system CA when using  
sslrootcert=system differs based on the OpenSSL version used.  
  
In OpenSSL 1.0.1-3.0 it is reported as SSL Error, with varying  
degrees of helpfulness in the error message. With OpenSSL 3.1 it  
is reported as an SSL SYSCALL error with "Undefined error" as  
the error message. This fix pulls out the particular error in  
OpenSSL 3.1 as a certificate verify error in order to help the  
user better figure out what happened, and to keep the ssl test  
working. While there is no evidence that extracing the errors  
will clobber errno, this adds a guard against that regardless  
to also make the consistent with how we handle OpenSSL errors  
elsewhere. It also memorizes the output from OpenSSL 3.0 in  
the test in cases where the system CA isn't responding.  
  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/c39be3c5-c1a5-1e33-1024-16f527e251a4@enterprisedb.com  

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

Remove some tabs in SQL code in C string literals

commit   : 77dedeb2c45745f592b504e181fa9d391d9afff0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Apr 2023 09:29:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 19 Apr 2023 09:29:43 +0200    

Click here for diff

This is not handled uniformly throughout the code, but at least nearby  
code can be consistent.  

M src/backend/commands/subscriptioncmds.c

Fix generation of distribution tarball

commit   : dea4343535f9122c66f71944ed593b84e338b174    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Apr 2023 13:59:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 19 Apr 2023 13:59:52 +0900    

Click here for diff

This issue can be reproduced by running `make dist` from the root of the  
tree.  Error introduced in fcb21b3, where additions of links in  
installation.sgml require custom rules in standalone-profile.xsl to make  
sure that ./INSTALL is generated correctly for the distribution tarball,  
where links are replaced by equivalent terms from the profile file  
changed by this commit.  
  
Per buildfarm member guaibasaurus.  
  
Discussion: https://postgr.es/m/ZD859FmcMRCNtz0W@paquier.xyz  

M doc/src/sgml/standalone-profile.xsl

Fix various typos and incorrect/outdated name references

commit   : 3f58a4e2960a9509036b7d94beab64a747dc59dc    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 19 Apr 2023 13:50:33 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 19 Apr 2023 13:50:33 +1200    

Click here for diff

Author: Alexander Lakhin  
Discussion: https://postgr.es/m/699beab4-a6ca-92c9-f152-f559caf6dc25@gmail.com  

M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup_copy.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/replication/logical/tablesync.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/time/snapmgr.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_dump/pg_dump.c
M src/include/utils/pgstat_internal.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-trace.c
M src/pl/plpython/plpy_main.c
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/029_on_error.pl
M src/tools/mark_pgdllimport.pl

Build ICU support by default.

commit   : fcb21b3acdcb9a60313325618fd7080aa36f1626    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 18 Apr 2023 13:20:11 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 18 Apr 2023 13:20:11 -0700    

Click here for diff

Discussion: https://postgr.es/m/82c4c816-06f6-d3e3-ba02-fca4a5cef065%40enterprisedb.com  
Reviewed-by: Peter Eisentraut  

M .cirrus.yml
M configure
M configure.ac
M doc/src/sgml/installation.sgml

Update time zone data files to tzdata release 2023c.

commit   : 4ddee4d9de9ba90bfba5762f635fa21b6edfaf48    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Apr 2023 14:46:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Apr 2023 14:46:39 -0400    

Click here for diff

DST law changes in Egypt, Greenland, Morocco, and Palestine.  
  
When observing Moscow time, Europe/Kirov and Europe/Volgograd now  
use the abbreviations MSK/MSD instead of numeric abbreviations,  
for consistency with other timezones observing Moscow time.  
  
Also, America/Yellowknife is no longer distinct from America/Edmonton;  
this affects some pre-1948 timestamps in that area.  

M src/timezone/data/tzdata.zi
M src/timezone/known_abbrevs.txt

Remove useless argument from nbtree dedup function.

commit   : 06e0652750e347bc3bf1dbb88d6a2a5d9b6f8faa    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 18 Apr 2023 10:33:15 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 18 Apr 2023 10:33:15 -0700    

Click here for diff

_bt_dedup_pass()'s heapRel argument hasn't been needed or used since  
commit cf2acaf4dc made deleting any existing LP_DEAD index tuples the  
caller's responsibility.  

M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/include/access/nbtree.h

Fix Utils.pm's locale-munging so that Perl itself is also affected.

commit   : b124104e73c0e91714969e1ae24d661264c76b96    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Apr 2023 13:31:31 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 18 Apr 2023 13:31:31 -0400    

Click here for diff

Utils.pm has a BEGIN block that editorializes on the locale-related  
environment variables, primarily in order to stabilize the behavior  
of child programs.  It turns out that if the calling test script  
has already done "use locale", this fails to affect the behavior  
of Perl itself, causing locale behavior to be different between  
Perl and child programs.  That breaks commit cd82e5c79's attempt  
to deal with locale-specific behavior in psql.  
  
To fix, we just need to call setlocale() to redo the calculation  
of locale.  
  
Per report from Aleksander Alekseev.  No back-patch for now, since  
there are no locale-dependent TAP tests in prior branches, and  
I'm not yet convinced that this won't have side-effects of its own.  
  
Discussion: https://postgr.es/m/CAJ7c6TO9KpYYxoVVseWEQB5KtjWDkt8NfyAeKPcHoe2Jq+ykpw@mail.gmail.com  

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

Fix pg_basebackup with in-place tablespaces some more.

commit   : 363e8f9115469fe3d30a80b694cd60e9db3b2537    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 18 Apr 2023 11:23:34 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 18 Apr 2023 11:23:34 -0400    

Click here for diff

Commit c6f2f01611d4f2c412e92eb7893f76fa590818e8 purported to make  
this work, but problems remained. In a plain-format backup, the  
files from an in-place tablespace got included in the tar file for  
the main tablespace, which is wrong but it's not clear that it  
has any user-visible consequences. In a tar-format backup, the  
TABLESPACE_MAP option is used, and so we never iterated over  
pg_tblspc and thus never backed up the in-place tablespaces  
anywhere at all.  
  
To fix this, reverse the changes in that commit, so that when we scan  
pg_tblspc during a backup, we create tablespaceinfo objects even for  
in-place tablespaces. We set the field that would normally contain the  
absolute pathname to the relative path pg_tblspc/${TSOID}, and that's  
good enough to make basebackup.c happy without any further changes.  
  
However, pg_basebackup needs a couple of adjustments to make it work.  
First, it needs to understand that a relative path for a tablespace  
means it's an in-place tablespace.  Second, it needs to tolerate the  
situation where restoring the main tablespace tries to create  
pg_tblspc or a subdirectory and finds that it already exists, because  
we restore user-defined tablespaces before the main tablespace.  
  
Since in-place tablespaces are only intended for use in development  
and testing, no back-patch.  
  
Patch by me, reviewed by Thomas Munro and Michael Paquier.  
  
Discussion: http://postgr.es/m/CA+TgmobwvbEp+fLq2PykMYzizcvuNv0a7gPMJtxOTMOuuRLMHg@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/pg_basebackup.c
A src/bin/pg_basebackup/t/011_in_place_tablespace.pl

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

commit   : f18029084784ec71a2e825cfcfd81b06d597ab93    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Apr 2023 11:20:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 18 Apr 2023 11:20:41 +0900    

Click here for diff

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where  
it would incorrectly store the null terminator byte to str[-1] when  
varcharsize is 0, which is something that can happen when using SQLDA.  
This would eat 1 byte from the previous field stored, corrupting the  
results generated.  
  
All the callers of ecpg_get_data() estimate and allocate enough storage  
for the data received, and the fix of this commit relies on this  
assumption.  Note that this maps to the case where no padding or  
truncation is required.  
  
This issue has been introduced by 3b7ab43 with the Oracle compatibility  
option, so backpatch down to v11.  
  
Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com  
Backpatch-through: 11  

M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/test/compat_oracle/char_array.pgc
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.c
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stderr
M src/interfaces/ecpg/test/expected/compat_oracle-char_array.stdout

Fix some typos and some incorrectly duplicated words

commit   : eef231e8161eb8031a928fe48134ef25ab81fe5e    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 18 Apr 2023 14:03:30 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 18 Apr 2023 14:03:30 +1200    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/ZD3D1QxoccnN8A1V@telsasoft.com  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/user-manag.sgml
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/plancat.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c
M src/include/access/tableam.h
M src/include/backup/basebackup_target.h
M src/include/replication/output_plugin.h
M src/include/storage/s_lock.h
M src/test/isolation/specs/serializable-parallel-3.spec
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql
M src/tools/pg_bsd_indent/tests/elsecomment.0
M src/tools/pg_bsd_indent/tests/elsecomment.0.stdout

Fix various typos

commit   : b4dbf3e924b2556acbe103dc61ac71f9985ff24f    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 18 Apr 2023 13:23:23 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 18 Apr 2023 13:23:23 +1200    

Click here for diff

This fixes many spelling mistakes in comments, but a few references to  
invalid parameter names, function names and option names too in comments  
and also some in string constants  
  
Also, fix an #undef that was undefining the incorrect definition  
  
Author: Alexander Lakhin  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/d5f68d19-c0fc-91a9-118d-7c6a5a3f5fad@gmail.com  

M contrib/amcheck/verify_heapam.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M meson.build
M src/backend/backup/basebackup.c
M src/backend/executor/execUtils.c
M src/backend/executor/nodeModifyTable.c
M src/backend/rewrite/rewriteManip.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/resowner/resowner.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/scripts/t/100_vacuumdb.pl
M src/include/access/rmgrdesc_utils.h
M src/include/port/pg_iovec.h
M src/include/regex/regcustom.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/tuplesort.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/port/dirmod.c
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/modules/ldap_password_func/meson.build
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/regress/pg_regress.c

Comment fix for 60684dd834.

commit   : e39d512f3e9b1e34ffba77c8fe120c2675f6873b    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 17 Apr 2023 13:39:32 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 17 Apr 2023 13:39:32 -0700    

Click here for diff

Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/766f3799-0269-162f-ba63-4cae34a5534f@enterprisedb.com  

M src/backend/commands/tablecmds.c

Update Solution.pm for HAVE_GSSAPI[_GSSAPI]_EXT_H, too.

commit   : 38358aab9a09d6304eb78e309a3bb969b68d249c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 16:00:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 16:00:39 -0400    

Click here for diff

Commit d48ac0070 was still a brick shy of a load.  
Per buildfarm (via Andrew Dunstan).  
  
Discussion: https://postgr.es/m/08dd6053-deee-52e9-954b-eb69232905c9@dunslane.net  

M src/tools/msvc/Solution.pm

Avoid trying to write an empty WAL record in log_newpage_range().

commit   : 3e383f9b68f13502789b234c2dc3274958bdbf78    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 14:22:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 14:22:06 -0400    

Click here for diff

If the last few pages in the specified range are empty (all zero),  
then log_newpage_range() could try to emit an empty WAL record  
containing no FPIs.  This at least upsets an Assert in  
ReserveXLogInsertLocation, and might perhaps have bad real-world  
consequences in non-assert builds.  
  
This has been broken since log_newpage_range() was introduced,  
but the case was hard if not impossible to hit before commit 3d6a98457  
decided it was okay to leave VM and FSM pages intentionally zero.  
Nonetheless, it seems prudent to back-patch.  log_newpage_range()  
was added in v12 but later back-patched, so this affects all  
supported branches.  
  
Matthias van de Meent, per report from Justin Pryzby  
  
Discussion: https://postgr.es/m/ZD1daibg4RF50IOj@telsasoft.com  

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

Fix incorrect comment about nbtree WAL record.

commit   : cd7cdc550c2a00027d6ec1810d064ad636250b1f    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 17 Apr 2023 09:58:18 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 17 Apr 2023 09:58:18 -0700    

Click here for diff

The nbtree VACUUM WAL record stores its page offset number payload in  
blk 0 (just like the closely related nbtree DELETE WAL record).  Commit  
ebd551f5 fixed a similar issue with the DELETE WAL record, but missed  
this one.  

M src/include/access/nbtxlog.h

Further cleanup of autoconf output files for GSSAPI changes.

commit   : d48ac0070cff197125088959e5644ed051322f5e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 11:21:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 17 Apr 2023 11:21:50 -0400    

Click here for diff

Running autoheader was missed in f7431bca8.  This is cosmetic since  
we aren't using these HAVE_ symbols, but let's get everything in  
sync while we're looking at this.  
  
Discussion: https://postgr.es/m/2422362.1681741814@sss.pgh.pa.us  

M src/include/pg_config.h.in

Update configure for ab969a376

commit   : ca07a6e7bd2cb1d6ea38a036be8d60e196935428    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Mon, 17 Apr 2023 10:13:08 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Mon, 17 Apr 2023 10:13:08 -0400    

Click here for diff

Commit ab969a376 updated configure.ac but neglected to update the actual  
configure script.  Fix that.  
  
Pointed out by Tom Lane  

M configure

doc: Add additional SQL features codes from SQL:2023

commit   : 1c77de98017022e45a0b12ddb71e202d55551f68    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Apr 2023 16:04:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Apr 2023 16:04:54 +0200    

Click here for diff

These were mysteriously omitted in c9f57541d9.  

M src/backend/catalog/sql_features.txt

Update Kerberos/GSSAPI configure/meson check

commit   : 1c52f9c042fb939ed55ff572daee71036720db57    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Mon, 17 Apr 2023 09:51:04 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Mon, 17 Apr 2023 09:51:04 -0400    

Click here for diff

Instead of checking for the much older gss_init_sec_context, check for  
gss_store_cred_into which was added in MIT Kerberos 1.11 (circa 2012).  
  
Discussion: https://postgr.es/m/2313469.1681695223%40sss.pgh.pa.us  

M configure.ac
M meson.build

Put new command-line option into sensible order in help output

commit   : 2434d60a2ae977a460eda401fd9f99cf619f4743    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Apr 2023 11:09:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 17 Apr 2023 11:09:17 +0200    

Click here for diff

We have two existing conventions for long options: either alphabetical  
among short options, or all long options after all the short options.  
But the convention apparently used here, next to a functionally  
related option, is not one of them.  

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

Doc: remove notes about the version vacuumdb options are valid from

commit   : fde9c068818246f6d79649eff355a2b95106991d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 17 Apr 2023 09:28:34 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 17 Apr 2023 09:28:34 +1200    

Click here for diff

Here we remove the notes which mention which version the given vacuumdb  
option is available from.  There are now 11 of these notes and they're  
both quite untidy and take up far more space than they seem to be worth.  
On running a print preview of the compiled HTML, removing these notes  
saves about 1 A4 page (~20% less space).  
  
If people need to see which options are available on older versions, then  
consulting the documents for that version seems like a good idea.  In any  
case, when using newer vacuumdb versions on older servers, the user will  
receive an error if they try to use an unsupported option.  
  
Additionally, 3 of the notes are warning about the option only being  
available from PostgreSQL 9.6 and later.  That version's support ended 2.5  
years ago.  So, it's quite clear that the value of these notes diminishes  
over time.  
  
Discussion: https://postgr.es/m/CAApHDvrCQn6tupx2R67VL9RP1Qy4dDuWKRvt4jaB0vk2akQchw@mail.gmail.com  

M doc/src/sgml/ref/vacuumdb.sgml

Ensure result of an aggregate's finalfunc is made read-only.

commit   : 78d5952dd0e66afc4447eec07f770991fa406cce    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Apr 2023 14:16:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Apr 2023 14:16:40 -0400    

Click here for diff

The finalfunc might return a read-write expanded object.  If we  
de-duplicate multiple call sites for the aggregate, any function(s)  
receiving the aggregate result earlier could alter or destroy the  
value that reaches the ones called later.  This is a brown-paper-bag  
bug in commit 42b746d4c, because we actually considered the need  
for read-only-ness but failed to realize that it applied to the case  
with a finalfunc as well as the case without.  
  
Per report from Justin Pryzby.  New error in HEAD,  
no need for back-patch.  
  
Discussion: https://postgr.es/m/ZDm5TuKsh3tzoEjz@telsasoft.com  

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

Avoid using non-ASCII commentary in daitch_mokotoff.c.

commit   : 1c54b93a8cf959a826dfabd6cae55dce255df2f5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Apr 2023 12:57:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 16 Apr 2023 12:57:32 -0400    

Click here for diff

Commit d6b5dee42 failed to suppress that warning from MSVC,  
so let's just get rid of all non-ASCII glyphs in the comments.  
The comment for iso8859_1_to_ascii_upper[] is not essential,  
and the other cases can be handled by spelling out the  
Unicode character names.  
  
(I'm now really in the dark as to why MSVC doesn't complain  
about predicate.c's comment.  But whatever.)  
  
Discussion: https://postgr.es/m/1546512.1681495035@sss.pgh.pa.us  

M contrib/fuzzystrmatch/daitch_mokotoff.c

Doc: add note about --buffer-usage-limit being v16 onwards

commit   : e9f451accbde17d106ac6a92c8877992d4410629    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 16 Apr 2023 21:47:01 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 16 Apr 2023 21:47:01 +1200    

Click here for diff

Other vacuumdb options seem to have notes about which version they're  
available from, so let's follow this trend for the newly added  
--buffer-usage-limit option.  

M doc/src/sgml/ref/vacuumdb.sgml

Improve VACUUM/ANALYZE BUFFER_USAGE_LIMIT docs

commit   : c0235013c13b0adc9e7f1998ff5700e26ecdbd1f    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sun, 16 Apr 2023 12:05:34 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sun, 16 Apr 2023 12:05:34 +1200    

Click here for diff

This addresses various deficiencies in the documentation for VACUUM and  
ANALYZE's BUFFER_USEAGE_LIMIT docs.  
  
Here we declare "size" in the syntax synopsis for VACUUM and ANALYZE's  
BUFFER_USAGE_LIMIT option and then define exactly what values can be  
specified for it in the section for that below.  
  
Also, fix the incorrect ordering of vacuumdb options both in the documents  
and in vacuumdb's --help output.  These should be in alphabetical order.  
  
In passing also add the minimum/maximum range for the BUFFER_USAGE_LIMIT  
option.  These will also serve as example values that can be modified and  
used.  
  
Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/16845cb1-b228-e157-f293-5892bced9253@enterprisedb.com  

M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/vacuumdb.c

Fix assignment to array of domain over composite, redux.

commit   : 064eb89e83ea0f59426c92906329f1e6c423dfa4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 15 Apr 2023 12:01:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 15 Apr 2023 12:01:39 -0400    

Click here for diff

Commit 3e310d837 taught isAssignmentIndirectionExpr() to look through  
CoerceToDomain nodes.  That's not sufficient, because since commit  
04fe805a1 it's been possible for the planner to simplify  
CoerceToDomain to RelabelType when the domain has no constraints  
to enforce.  So we need to look through RelabelType too.  
  
Per bug #17897 from Alexander Lakhin.  Although 3e310d837 was  
back-patched to v11, it seems sufficient to apply this change  
to v12 and later, since 04fe805a1 came in in v12.  
  
Dmitry Dolgov  
  
Discussion: https://postgr.es/m/17897-4216c546c3874044@postgresql.org  

M src/backend/executor/execExpr.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql

Remove some non-ASCII symbols from a comment.

commit   : d6b5dee42de71f547090f0cd2968112c50c24203    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 15 Apr 2023 11:20:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 15 Apr 2023 11:20:46 -0400    

Click here for diff

Buildfarm member hamerkop is unhappy that daitch_mokotoff.c "contains  
a character that cannot be represented in the current code page  
(932). Save the file in Unicode format to prevent data loss".  There  
are a lot of non-ASCII characters in comments, but I do not see any  
outside a comment, so this is just cosmetic.  Nonetheless the warning  
is fairly scary and people might waste time trying to understand the  
cause, so we ought to silence it.  
  
We have only one other occurrence of a non-ASCII character in .c or .h  
files in the tree: predicate.c mentions "Uwe Röhm".  It's far from  
clear why hamerkop isn't complaining about that too; but it isn't,  
so maybe there is some special provision for accented Roman letters.  
We can remove the non-letter symbols from the comment for  
iso8859_1_to_ascii_upper without any real loss of usefulness,  
so let's try that first to see if it silences the warning.  
  
Discussion: https://postgr.es/m/1546512.1681495035@sss.pgh.pa.us  

M contrib/fuzzystrmatch/daitch_mokotoff.c

Adjust Valgrind macro usage to protect chunk headers

commit   : 414d66220adb9189951fb4d410470f9f36f9cbd1    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 15 Apr 2023 11:59:52 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 15 Apr 2023 11:59:52 +1200    

Click here for diff

Prior to this commit we only ever protected MemoryChunk's requested_size  
field with Valgrind NOACCESS.  This means that if the hdrmask field is  
ever accessed accidentally then we're not going to get any warnings from  
Valgrind about it.  Valgrind would have warned us about the problem fixed  
in 92957ed98 had we already been doing this.  
  
Per suggestion from Tom Lane  
  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/1650235.1672694719@sss.pgh.pa.us  
Discussion: https://postgr.es/m/CAApHDvr=FZNGbj252Z6M9BSFKoq6BMxgkQ2yEAGUYoo7RquqZg@mail.gmail.com  

M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c

Support RBM_ZERO_AND_CLEANUP_LOCK in ExtendBufferedRelTo(), add tests

commit   : 43a33ef54e503b61f269d088f2623ba3b9484ad7    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 14 Apr 2023 11:30:20 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 14 Apr 2023 11:30:20 -0700    

Click here for diff

For some reason I had not implemented RBM_ZERO_AND_CLEANUP_LOCK support in  
ExtendBufferedRelTo(), likely thinking it not being reachable. But it is  
reachable, e.g. when replaying a WAL record for a page in a relation that  
subsequently is truncated (likely only reachable when doing crash recovery or  
PITR, not during ongoing streaming replication).  
  
As now all of the RBM_* modes are supported, remove assertions checking mode.  
  
As we had no test coverage for this scenario, add a new TAP test. There's  
plenty more that ought to be tested in this area...  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reported-by: Alexander Lakhin <exclusion@gmail.com>  
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>  
Discussion: https://postgr.es/m/392271.1681238924%40sss.pgh.pa.us  
Discussion: https://postgr.es/m/0b5eb82b-cb99-e0a4-b932-3dc60e2e3926@gmail.com  

M src/backend/storage/buffer/bufmgr.c
M src/test/recovery/meson.build
A src/test/recovery/t/036_truncated_dropped.pl

NULL is not an ideal way to spell bool "false".

commit   : e4d905f772f7803d399b6e173ca9aa7ba8a35e5a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 14 Apr 2023 13:31:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 14 Apr 2023 13:31:51 -0400    

Click here for diff

Thinko in commit 6633cfb21, detected by buildfarm member hamerkop.  

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

doc: PQinitOpenSSL and PQinitSSL are obsolete in OpenSSL 1.1.0+

commit   : 928e05ddfd4031c67e101c5e74dbb5c8ec4f9e23    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 14 Apr 2023 10:15:50 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 14 Apr 2023 10:15:50 +0200    

Click here for diff

Starting with OpenSSL 1.1.0 there is no need to call PQinitOpenSSL  
or PQinitSSL to avoid duplicate initialization of OpenSSL.  Add a  
note to the documentation to explain this.  
  
Backpatch to all supported versions as older OpenSSL versions are  
equally likely to be used for all branches.  
  
Reported-by: Sebastien Flaesch <sebastien.flaesch@4js.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/DBAP191MB12895BFFEC4B5FE0460D0F2FB0459@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM  
Backpatch-through: 11, all supported versions  

M doc/src/sgml/libpq.sgml

Fix whitespace

commit   : 12829058c424cba540ac8de33d129d02f8bd3449    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 14 Apr 2023 10:04:57 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 14 Apr 2023 10:04:57 +0200    

Click here for diff

M src/test/modules/ldap_password_func/Makefile

Add missing source files to nls.mk

commit   : 99322d6eee6445665c1fb131ec6130924b7673b6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 14 Apr 2023 09:56:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 14 Apr 2023 09:56:04 +0200    

Click here for diff

M src/bin/pg_dump/nls.mk
M src/bin/pg_rewind/nls.mk

Fix incorrect partition pruning logic for boolean partitioned tables

commit   : e0693faf797f997f45bee8e572e8b4288cc7eaeb    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 14 Apr 2023 16:20:27 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 14 Apr 2023 16:20:27 +1200    

Click here for diff

The partition pruning logic assumed that "b IS NOT true" was exactly the  
same as "b IS FALSE".  This is not the case when considering NULL values.  
Fix this so we correctly include any partition which could hold NULL  
values for the NOT case.  
  
Additionally, this fixes a bug in the partition pruning code which handles  
partitioned tables partitioned like ((NOT boolcol)).  This is a seemingly  
unlikely schema design, and it was untested and also broken.  
  
Here we add tests for the ((NOT boolcol)) case and insert some actual data  
into those tables and verify we do get the correct rows back when running  
queries.  I've also adjusted the existing boolpart tests to include some  
data and verify we get the correct results too.  
  
Both the bugs being fixed here could lead to incorrect query results with  
fewer rows being returned than expected.  No additional rows could have  
been returned accidentally.  
  
In passing, remove needless ternary expression.  It's more simple just to  
pass !is_not_clause to makeBoolConst().  It makes sense to do this so the  
code is consistent with the bug fix in the "else if" condition just below.  
  
David Kimura did submit a patch to fix the first of the issues here, but  
that's not what's being committed here.  
  
Reported-by: David Kimura  
Reviewed-by: Richard Guo, David Kimura  
Discussion: https://postgr.es/m/CAHnPFjQ5qxs6J_p+g8=ww7GQvfn71_JE+Tygj0S7RdRci1uwPw@mail.gmail.com  
Backpatch-through: 11, all supported versions  

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

doc: Fix some grammar for logical decoding description and functions

commit   : c7dc56bd6b36b4d6b3c6cc1bb4735f7777272ca3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Apr 2023 13:08:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Apr 2023 13:08:02 +0900    

Click here for diff

This documentation is has been added for the support of logical decoding  
on standbys.  Some markups were missing, hence add some where required.  
  
Author: Thom Brown  
Reviewed-by: Justin Pryzby, Daniel Gustafsson  
Discussion: https://postgr.es/m/CAA-aLv7xCZ0nBJa-NWe0rxBB28TjFjS2JtjiZMoQ+0wsugG+hQ@mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml

Fix PHJ match bit initialization.

commit   : 558c9d75fe3b38508296840e606737c664fc3b70    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 14 Apr 2023 10:52:58 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 14 Apr 2023 10:52:58 +1200    

Click here for diff

Hash join tuples reuse the HOT status bit to indicate match status  
during hash join execution. Correct reuse requires clearing the bit in  
all tuples. Serial hash join and parallel multi-batch hash join do so  
upon inserting the tuple into the hashtable. Single batch parallel hash  
join and batch 0 of unexpected multi-batch hash joins forgot to do this.  
  
It hadn't come up before because hashtable tuple match bits are only  
used for right and full outer joins and parallel ROJ and FOJ were  
unsupported. 11c2d6fdf5 introduced support for parallel ROJ/FOJ but  
neglected to ensure the match bits were reset.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/flat/CAMbWs48Nde1Mv%3DBJv6_vXmRKHMuHZm2Q_g4F6Z3_pn%2B3EV6BGQ%40mail.gmail.com  

M src/backend/executor/nodeHash.c
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

Remove code in charge of freeing regexps generation by Lab.c

commit   : a28269708844246fb1ec00a536b391cac0a64972    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Apr 2023 07:27:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 14 Apr 2023 07:27:44 +0900    

Click here for diff

bea3d7e has redesigned the regexp engine so as all the allocations go  
through palloc() with a dedicated memory context.  hba.c had to cope  
with the past memory management logic by going through all the HBA and  
ident lines generated, then directly free all the regexps found in  
AuthTokens to ensure that no leaks would happen.  Such leaks could  
happen for example in the postmaster after a SIGHUP, in the event of  
an HBA and/or ident reload failure where all the new content parsed must  
be discarded, including all the regexps that may have been compiled.  
  
Now that regexps are palloc()'d in their own memory context,  
MemoryContextDelete() is enough to ensure that all the compiled regexps  
are properly gone.  Simplifying this logic in hba.c has the effect to  
only remove code.  Most of it is new in v16, except the part for regexps  
compiled in ident entries for the system username, so doing this cleanup  
now rather than when v17 opens for business will reduce future diffs  
with the upcoming REL_16_STABLE.  
  
Some comments were incorrect since bea3d7e, now fixed to reflect the  
reality.  
  
Reviewed-by: Bertrand Drouvot, Álvaro Herrera  
Discussion: https://postgr.es/m/ZDdJ289Ky2qEj4h+@paquier.xyz  

M src/backend/libpq/hba.c

Remove old GUC name mapping for "force_parallel_mode"

commit   : 0981846b9c3ab1dcc351798dcae6a2e35872a6c3    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 14 Apr 2023 10:19:45 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 14 Apr 2023 10:19:45 +1200    

Click here for diff

This GUC was renamed to debug_parallel_query in 5352ca22e.  That commit  
added an entry into map_old_guc_names[] to allow the old name still to  
work.  That was done to allow a transition time where the buildfarm  
configs could be swapped over to use debug_parallel_query instead.  That  
work is now complete.  
  
Here we remove the old name with the intention of breaking any user code  
which is using force_parallel_query.  As mentioned in the commit message  
for 5352ca22e, it appeared many users were misled into thinking that  
setting this GUC was doing something useful for them to make queries run  
more quickly.  
  
Discussion: https://postgr.es/m/CAApHDvoR7EOz7Tvyzrd18FO-Dw2Cp4Uyq25TEWguK+XyCJtzOw@mail.gmail.com  

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

Update Unicode data to CLDR 43

commit   : 83c470665822befb3bda92320defe766936b60df    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 22:10:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 22:10:08 +0200    

Click here for diff

No actual changes result.  

M src/Makefile.global.in

Harmonize some more function parameter names.

commit   : d6f0f95a6bb7fa43731c6db83226a3c574041659    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 13 Apr 2023 10:15:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 13 Apr 2023 10:15:20 -0700    

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 relatively recently, after the code  
base had parameter name mismatches fixed in bulk (see commits starting  
with commits 4274dc22 and 035ce1fe).  
  
pg_bsd_indent still has a couple of similar inconsistencies, which I  
(pgeoghegan) have left untouched for now.  
  
Like all earlier commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  

M src/backend/parser/parse_expr.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pg_locale.c
M src/bin/pg_dump/pg_dump.c
M src/include/pgstat.h
M src/include/replication/worker_internal.h
M src/include/storage/buf_internals.h
M src/pl/plpython/plpy_resultobject.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/worker_spi/worker_spi.c

Explicitly require MIT Kerberos for GSSAPI

commit   : f7431bca8b0138bdbce7025871560d39119565a0    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Thu, 13 Apr 2023 08:55:13 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Thu, 13 Apr 2023 08:55:13 -0400    

Click here for diff

WHen building with GSSAPI support, explicitly require MIT Kerberos and  
check for gssapi_ext.h in configure.ac and meson.build.  Also add  
documentation explicitly stating that we now require MIT Kerberos when  
building with GSSAPI support.  
  
Reveiwed by: Johnathan Katz  
Discussion: https://postgr.es/m/abcc73d0-acf7-6896-e0dc-f5bc12a61bb1@postgresql.org  

M configure
M configure.ac
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/libpq/auth.c
M src/backend/libpq/be-secure-gssapi.c

De-Revert "Add support for Kerberos credential delegation"

commit   : 6633cfb21691840c33816a6dacaca0b504efb895    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Thu, 13 Apr 2023 08:55:07 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Thu, 13 Apr 2023 08:55:07 -0400    

Click here for diff

This reverts commit 3d03b24c3 (Revert Add support for Kerberos  
credential delegation) which was committed on the grounds of concern  
about portability, but on further review and discussion, it's clear that  
we are better off explicitly requiring MIT Kerberos as that appears to  
be the only GSSAPI library currently that's under proper maintenance  
and ongoing development.  The API used for storing credentials was added  
to MIT Kerberos over a decade ago while for the other libraries which  
appear to be mainly based on Heimdal, which exists explicitly to be a  
re-implementation of MIT Kerberos, the API never made it to a released  
version (even though it was added to the Heimdal git repo over 5 years  
ago..).  
  
This post-feature-freeze change was approved by the RMT.  
  
Discussion: https://postgr.es/m/ZDDO6jaESKaBgej0%40tamriel.snowman.net  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

doc: Make HTML ids discoverable

commit   : e2922702a3027945f139f9b0c7b4686423304e21    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 10:15:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 10:15:20 +0200    

Click here for diff

In the HTML output, this decorates section headers and variable list  
terms with a marker ("#") that is a link to the same section/term.  
That way, links inside a page can be discovered for easier sharing.  
The marker only appears when hovering.  
  
This now requires that all elements that are candidates for such a  
link have an id attribute.  Otherwise, an error will be generated.  
All previously missing ids have been added prior to this patch.  
  
Author: Brar Piening <brar@gmx.de>  
Reviewed-by: Karl O. Pinc <kop@karlpinc.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAB8KJ=jpuQU9QJe4+RgWENrK5g9jhoysMw2nvTN_esoOU0=a_w@mail.gmail.com  

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

Add missing XML ID attribute

commit   : a34901dd03edb473ddbd81ee5c7332575f6d8881    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 09:48:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 13 Apr 2023 09:48:38 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/dc813a6f-60d9-991f-eecd-675a0921de11@gmx.de  

M doc/src/sgml/pgbuffercache.sgml

Skip the 004_io_direct.pl test if a pre-flight check fails.

commit   : 6ca8df2d61473327b0e90b9becfe109299f47b8a    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 13 Apr 2023 13:47:39 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 13 Apr 2023 13:47:39 +1200    

Click here for diff

The test previously had a list of OSes that direct I/O was expected to  
work on.  That worked well enough for the systems in our build farm, but  
didn't survive contact with the Debian build bots running on tmpfs via  
overlayfs.  tmpfs does not support O_DIRECT, but we don't want to  
exclude Linux generally.  
  
The new approach is to try to create an empty file with O_DIRECT from  
Perl first.  If that fails, we'll skip the test and report what the  
error was.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/ZDYd4A78cT2ULxZZ%40msg.df7cb.de  

M src/test/modules/test_misc/t/004_io_direct.pl

Remove overzealous assertion from PHJ.

commit   : b37d051b0e59e4324e346655a27509507813db79    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 13 Apr 2023 09:19:54 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 13 Apr 2023 09:19:54 +1200    

Click here for diff

We can't assert that we're the only process attached to a barrier after  
BarrierArriveAndDetachExceptLast().  Although that'll be true almost  
always, a late-starting parallel worker can attach very briefly (that  
is, immediately detach after checking the phase) right at that moment.  
BarrierArriveAndDetachExceptLast() already contains an assertion like  
that, but it holds a spinlock preventing the race.  This thinko caused a  
one-off failure on build farm animal chimaera.  
  
Diagnosed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/3590249.1680971629@sss.pgh.pa.us  

M src/backend/executor/nodeHash.c

Revert "Adjust contrib/sepgsql regression test expected outputs."

commit   : 21e6bf4ddd045bc718c99ae551f25957ae91cb4d    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Apr 2023 20:22:17 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Apr 2023 20:22:17 +0200    

Click here for diff

This reverts commit 76c111a7f166; should have been included in  
9ce04b50e120.  
  
Noted by Joe Conway  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out

Improve error messages introduced in be87200efd9 and 0fdab27ad68

commit   : 5ec69b71f17c353b27754deb8d94bb1f5cf7a029    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Apr 2023 11:00:37 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 12 Apr 2023 11:00:37 -0700    

Click here for diff

Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20230411.120301.93333867350615278.horikyota.ntt@gmail.com  
Discussion: https://postgr.es/m/20230412174244.6njadz4uoiez3l74@awork3.anarazel.de  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/test/recovery/t/035_standby_logical_decoding.pl

Revert "Catalog NOT NULL constraints" and fallout

commit   : 9ce04b50e120275afbc03ca0b80839dde3da8308    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Apr 2023 19:29:21 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 12 Apr 2023 19:29:21 +0200    

Click here for diff

This reverts commit e056c557aef4 and minor later fixes thereof.  
  
There's a few problems in this new feature -- most notably regarding  
pg_upgrade behavior, but others as well.  This new feature is not in any  
way critical on its own, so instead of scrambling to fix it we revert it  
and try again in early 17 with these issues in mind.  
  
Discussion: https://postgr.es/m/3801207.1681057430@sss.pgh.pa.us  

M doc/src/sgml/catalogs.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/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.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/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/commands/tablecmds.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/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

basebackup_to_shell: Check for a NULL return from OpenPipeStream.

commit   : 8e82db97b0a474008d8212a63f34e449a8c50bcd    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 12 Apr 2023 11:37:13 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 12 Apr 2023 11:37:13 -0400    

Click here for diff

Per complaint from Peter Eisentraut.  
  
Discussion: http://postgr.es/m/4f1707cc-2432-da35-64a2-5c2a8d92a388@enterprisedb.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c

Document BaseBackupSync and BaseBackupWrite wait events.

commit   : 4b1ad19a4e221897d01fbfe68b89412c8c5a9cbb    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 12 Apr 2023 11:18:40 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 12 Apr 2023 11:18:40 -0400    

Click here for diff

Commit 3500ccc39b0dadd1068a03938e4b8ff562587ccc should have done  
this, but I overlooked it.  
  
Per complaint from Thomas Munro.  
  
Discussion: http://postgr.es/m/CA+hUKGJixAHc860Ej9Qzd_z96Z6aoajAgJ18bYfV3Lfn6t9=+Q@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Fix parallel-safety marking when moving initplans to another node.

commit   : 88ceac5d77f4ffb31f1e2d3df23d37e569ad5ff4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Apr 2023 10:46:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 12 Apr 2023 10:46:30 -0400    

Click here for diff

Our policy since commit ab77a5a45 has been that a plan node having  
any initplans is automatically not parallel-safe.  (This could be  
relaxed, but not today.)  clean_up_removed_plan_level neglected  
this, and could attach initplans to a parallel-safe child plan  
node without clearing the plan's parallel-safe flag.  That could  
lead to "subplan was not initialized" errors at runtime, in case  
an initplan referenced another one and only the referencing one  
got transmitted to parallel workers.  
  
The fix in clean_up_removed_plan_level is trivial enough.  
materialize_finished_plan also moves initplans from one node  
to another, but it's okay because it already copies the source  
node's parallel_safe flag.  The other place that does this kind  
of thing is standard_planner's hack to inject a top-level Gather  
when debug_parallel_query is active.  But that's actually dead  
code given that we're correctly enforcing the "initplans aren't  
parallel safe" rule, so just replace it with an Assert that  
there are no initplans.  
  
Also improve some related comments.  
  
Normally we'd add a regression test case for this sort of bug.  
The mistake itself is already reached by existing tests, but there  
is accidentally no visible problem.  The only known test case that  
creates an actual failure seems too indirect and fragile to justify  
keeping it as a regression test (not least because it fails to fail  
in v11, though the bug is clearly present there too).  
  
Per report from Justin Pryzby.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/ZDVt6MaNWkRDO1LQ@telsasoft.com  

M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c

doc: Reword unexplained abbreviation

commit   : 91199dd281f11b8fdd214210cb608012a9aaef88    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 12 Apr 2023 16:16:12 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 12 Apr 2023 16:16:12 +0200    

Click here for diff

The previous wording used MVF to indicate the Most Common Values'  
Frequencies, but the abbreviation was never explained or defined.  
Reword to mcv_freqs to make the use clearer.  
  
Also add MCF and MCV as acronyms as they were using <acronym>  
markup but were missing from the acronyms page.  
  
Reported-by: Eric Mutta <eric.mutta@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/166112292492.654.5377188452604176150@wrigleys.postgresql.org  

M doc/src/sgml/acronyms.sgml
M doc/src/sgml/planstats.sgml

Fix incorrect format placeholders

commit   : 5f38a2034e4f18ad3a57421f070ae01c32137ef1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Apr 2023 10:05:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Apr 2023 10:05:50 +0200    

Click here for diff

M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/transam/xloginsert.c
M src/backend/utils/resowner/resowner.c

Update config.guess and config.sub

commit   : 906116ace1b8bc07161ee960015eb2b2d2a40118    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Apr 2023 09:16:19 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 12 Apr 2023 09:16:19 +0200    

Click here for diff

M config/config.guess
M config/config.sub

doc: Fix some typos and grammar

commit   : 644b848f50ef75430c0134654f86e8234691e390    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Apr 2023 13:03:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Apr 2023 13:03:09 +0900    

Click here for diff

This is a first batch of the fixes, for the most obvious fixes.  A  
little bit more is under discussion.  
  
Author: Thom Brown, Justin Pryzby  
Discussion: https://postgr.es/m/CAA-aLv7xCZ0nBJa-NWe0rxBB28TjFjS2JtjiZMoQ+0wsugG+hQ@mail.gmail.com  

M doc/src/sgml/archive-modules.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/indexam.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/createuser.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml

Fix detection of unseekable files for fseek() and ftello() with MSVC

commit   : a923e21631a29dc8b8781d7d02b5003d0df64ca3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Apr 2023 09:09:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 12 Apr 2023 09:09:38 +0900    

Click here for diff

Calling fseek() or ftello() on a handle to a non-seeking device such as  
a pipe or a communications device is not supported.  Unfortunately,  
MSVC's flavor of these routines, _fseeki64() and _ftelli64(), do not  
return an error when given a pipe as handle.  Some of the logic of  
pg_dump and restore relies on these routines to check if a handle is  
seekable, causing failures when passing the contents of pg_dump to  
pg_restore through a pipe, for example.  
  
This commit introduces wrappers for fseeko() and ftello() on MSVC so as  
any callers are able to properly detect the cases of non-seekable  
handles.  This relies mainly on GetFileType(), sharing a bit of code  
with the MSVC port for fstat().  The code in charge of getting a file  
type is refactored into a new file called win32common.c, shared by  
win32stat.c and the new win32fseek.c.  It includes the MSVC ports for  
fseeko() and ftello().  
  
Like 765f5df, this is backpatched down to 14, where the fstat()  
implementation for MSVC is able to understand about files larger than  
4GB in size.  Using a TAP test for that is proving to be tricky as  
IPC::Run handles the pipes by itself, still I have been able to check  
the fix manually.  
  
Reported-by: Daniel Watzinger  
Author: Juan José Santamaría Flecha, Michael Paquier  
Discussion: https://postgr.es/m/CAC+AXB26a4EmxM2suXxPpJaGrqAdxracd7hskLg-zxtPB50h7A@mail.gmail.com  
Backpatch-through: 14  

M configure
M configure.ac
M src/include/port/win32_port.h
M src/port/meson.build
A src/port/win32common.c
A src/port/win32fseek.c
M src/port/win32stat.c
M src/tools/msvc/Mkvcbuild.pm

Refine the guidelines for rmgrdesc authors.

commit   : c03c2eae0acbb82db8e626f71f367ef4b043d27d    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 15:26:24 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 15:26:24 -0700    

Click here for diff

Clarify the goals of the recently added guidelines for rmgrdesc authors:  
to avoid gratuitous inconsistencies across resource managers, and to  
make it reasonably easy to write a reusable custom parser.  
  
Beyond that, the guidelines leave rmgrdesc authors with a significant  
amount of leeway.  This even includes the leeway to invent custom  
conventions (in cases where it's warranted).  
  
Follow-up to commit 7d8219a4.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzkbYuvwYKm-Y-72QEh6SPMQcAo9uONv+mR3bMGcu9E_Cg@mail.gmail.com  

M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

Fix Heap rmgr's desc output for infobits arrays.

commit   : 96149a180d56162b0288e8c8ec5ee2c1f076e88b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 15:25:02 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 15:25:02 -0700    

Click here for diff

Make heap desc routines that output status bit as arrays of constants  
avoid outputting array literals that contain superfluous punctuation  
characters that complicate parsing the output.  Also make sure that no  
heap desc routine repeats the same key name (at the same nesting level),  
for the same reason.  Arguably, these were both oversights in commit  
7d8219a4.  
  
In passing, make the desc output code (which covers Heap's DELETE,  
UPDATE, HOT_UPDATE, LOCK, and LOCK_UPDATED record types) consistent in  
terms of the output order of each field.  This order also matches WAL  
record struct order.  Heap's DELETE desc output now shows the record's  
xmax field for the first time (just like UPDATE/HOT_UPDATE records).  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAH2-Wz=pNYtxiJ2Jx5Lj=fKo1OEZ4GE0p_kct+ugAUTqBwU46g@mail.gmail.com  

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

Fix xl_heap_lock WAL record field's data type.

commit   : e944063294fb9e85190f03948f5ce20331231e2f    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 14:07:54 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 11 Apr 2023 14:07:54 -0700    

Click here for diff

Make xl_heap_lock's infobits_set field of type uint8, not int8.  Using  
int8 isn't appropriate given that the field just holds status bits.  
This fixes an oversight in commit 0ac5ad5134.  
  
In passing rename the nearby TransactionId field to "xmax" to make  
things consistency with related records, such as xl_heap_lock_updated.  
  
Deliberately avoid a bump in XLOG_PAGE_MAGIC.  No backpatch, either.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WzkCd3kOS8b7Rfxw7Mh1_6jvX=Nzo-CWR1VBTiOtVZkWHA@mail.gmail.com  

M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/include/access/heapam_xlog.h

035_standby_logical_decoding: Add missing waits for replication

commit   : 57411c82ce8634888be807502ee6c50f219e0460    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 11 Apr 2023 11:17:36 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 11 Apr 2023 11:17:36 -0700    

Click here for diff

At least one slow buildfarm system (hoverfly) showed that the database  
creation was not replicated before we try to create logical replication slots  
on the standby, in that database.  
  
Reported-by: Noah Misch <noah@leadboat.com>  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/20230411053657.GA1177147@rfd.leadboat.com  

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

Document new pg_subscription columns.

commit   : bc25d6c54a000ab67c183cb88eb4f12b1220e6f9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 11 Apr 2023 11:00:36 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 11 Apr 2023 11:00:36 -0400    

Click here for diff

Commit 482675987bcdffb390ae735cfd5f34b485ae97c6 and commit  
c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6 forgot to take care  
of this.  
  
Noriyoshi Shinoda  
  
Discussion: http://postgr.es/m/DM4PR84MB17345D8760165F14A199B81CEE9A9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM  

M doc/src/sgml/catalogs.sgml

Fix uninitialized variable in transformTableLikeClause()

commit   : 4c8a1b4769372037b28516e5c9acb39bb82fa92d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 23:01:12 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 23:01:12 +1200    

Click here for diff

process_notnull_constraints should be set to false until we discover a NOT  
NULL column.  
  
Discovered while running Valgrind.  
  
Discussion: https://postgr.es/m/CAApHDvoMyiZVi1KW5WVdqMRzWsWkD3F7n6QD+BbAO6WTeAWsUQ@mail.gmail.com  

M src/backend/parser/parse_utilcmd.c

Improve ereports for VACUUM's BUFFER_USAGE_LIMIT option

commit   : 68a2a437f46716efd54d177edf9dbcc9916c903b    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 19:36:34 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 19:36:34 +1200    

Click here for diff

There's no need to check if opt->arg is NULL since defGetString() already  
does that and raises an ERROR if it is.  Let's just remove that check.  
  
Also, combine the two remaining ERRORs into a single check.  It seems  
better to give an indication about what sort of values we're looking for  
rather than just to state that the value given isn't valid.  Make  
BUFFER_USAGE_LIMIT uppercase in this ERROR message too.  It's already  
upper case in one other error message, so make that consistent.  
  
Reported-by: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20230411.102335.1643720544536884844.horikyota.ntt@gmail.com  

M src/backend/commands/vacuum.c
M src/test/regress/expected/vacuum.out

Doc: use "an SQL" consistently rather than "a SQL"

commit   : d866f0374ca688937b905fbebfcc2c5f8dc88b54    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 18:52:17 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 11 Apr 2023 18:52:17 +1200    

Click here for diff

Similarly to what was done in 04539e73f and 7bdd489d3, we standardized on  
SQL being pronounced "es-que-ell" rather than "sequel" in our  
documentation.  
  
This fixes the instances of "a SQL" that have crept in during the v16  
cycle.  
  
Discussion: https://postgr.es/m/CAApHDvpML27UqFXnrYO1MJddsKVMQoiZisPvsAGhKE_tsKXquw%40mail.gmail.com  

M doc/src/sgml/ecpg.sgml

Clarify nbtree posting list update desc issue.

commit   : 26e65ebdb295fc88988655dbbf30c9fd020e2e07    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 10 Apr 2023 17:55:23 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 10 Apr 2023 17:55:23 -0700    

Click here for diff

Per complaint from Melanie Plageman.  
  
Follow-up to commit 5d6728e5.  
  
Reported-By: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20230411002315.oyaicmcqrq2hb3ek@liskov  

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

Doc: add missed entries in BRIN extensibility tables.

commit   : 4380c2509d51febad34e1fac0cfaeb98aaa716c5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 15:49:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 15:49:48 -0400    

Click here for diff

The tables in "71.3. Extensibility" listing the support functions  
for bloom and minmax-multi opclasses should include the associated  
options function.  While this isn't quite as required as the rest,  
you need it for full functionality of the opclass.  
  
Back-patch to v14 where these functions were added.  

M doc/src/sgml/brin.sgml

Fix nbtree posting list update desc output.

commit   : 5d6728e588c37a4e458db9d55b308c8a3832a944    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 10 Apr 2023 11:15:41 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 10 Apr 2023 11:15:41 -0700    

Click here for diff

We cannot use the generic array_desc approach with per-tuple nbtree  
posting list update metadata because array_desc can only deal with fixed  
width elements (e.g., page offset numbers).  Using array_desc led to  
incorrect rmgr descriptions for updates from nbtree DELETE/VACUUM WAL  
records.  
  
To fix, add specialized code to describe the update metadata as array  
elements in desc output.  We now iterate over the update metadata using  
an approach that matches related REDO routines.  
  
Also stop showing the updates offset number array separately in nbtree  
DELETE/VACUUM desc output.  It's redundant information, since the same  
page offset numbers appear in the description of each individual update  
element.  Also make some small tweaks to the way that we format arrays  
in all desc routines (not just nbtree desc routines) to make arrays a  
little less verbose.  
  
Oversight in commit 1c453cfd, which enhanced the nbtree rmgr desc  
routines.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WzkbYuvwYKm-Y-72QEh6SPMQcAo9uONv+mR3bMGcu9E_Cg@mail.gmail.com  

M doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

Doc: adjust examples of EXTRACT() output to match current reality.

commit   : fbbd7edca867ea8f8bd7540492e527fdb16d954b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 13:09:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 13:09:18 -0400    

Click here for diff

EXTRACT(EPOCH), EXTRACT(SECOND), and some related cases print more  
trailing zeroes than they used to.  This behavior change happened  
with commit a2da77cdb (Change return type of EXTRACT to numeric),  
and it was intentional according to the commit log:  
  
    - Return values when extracting fields with possibly fractional  
      values, such as second and epoch, now have the full scale that the  
      value has internally (so, for example, '1.000000' instead of just  
      '1').  
  
It's been like that for two releases now, so while I suggested  
changing this back, it's probably better to adjust the documentation  
examples.  
  
Per bug #17866 from Евгений Жужнев.  Back-patch to v14 where the  
change came in.  
  
Discussion: https://postgr.es/m/17866-18eb70095b1594e2@postgresql.org  

M doc/src/sgml/func.sgml

Doc: avoid using pg_get_publication_tables() in an example.

commit   : 26f36fe844880ff68dc28493bba9aced5aad0034    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 12:22:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 10 Apr 2023 12:22:10 -0400    

Click here for diff

pg_get_publication_tables() is undocumented because it's only meant  
as infrastructure for the pg_publication_tables system view.  
That being the case, we should use the view not the bare function  
in this sample query.  
  
Shi Yu  
  
Discussion: https://postgr.es/m/OSZPR01MB63107E83D07FEDEEABD83A23FD949@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_subscription.sgml

Simplify version check for SKIP clause

commit   : 6ff2e8cdd410f70057cfa6259ad395c1119aeb32    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 8 Apr 2023 23:32:11 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 8 Apr 2023 23:32:11 +0200    

Click here for diff

Checking for the required versions of IO::Pty as well as IPC::Run  
can be achieved with a single eval call, and by using the VERSION  
function the comparison is guaranteed to follow the same rules as  
calling 'use' on the module with a version.  
  
Reported-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/6d880ea2-f8ca-f458-4dcd-a7a3e6d6cd7c@dunslane.net  

M src/test/authentication/t/001_password.pl

Use higher wal_level for 004_io_direct.pl.

commit   : 980e8879f54a7a00ca6a5bae2fe9486c87ef3e8e    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 9 Apr 2023 08:27:36 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 9 Apr 2023 08:27:36 +1200    

Click here for diff

The new direct I/O test deliberately uses a very small shared_buffers to  
force some disk transfers without making the data set large and slow,  
but ran into a problem with wal_level = minimal: log_newpage_range()  
pins many buffers, leading to a few intermittent "no unpinned buffers  
available" errors.  
  
We could presumably fix that by adjusting shared_buffers, but crake  
seems to be trying to tell us something interesting with these settings,  
so let's just avoid wal_level = minimal in this test for now.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20230408060408.n7xdwk3mxj5oykt6%40awork3.anarazel.de  

M src/test/modules/test_misc/t/004_io_direct.pl

Improve indentation of multiline initialization expressions.

commit   : 064750af4f4ebab9c0d47d502c7ff7e3c9533f9f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 8 Apr 2023 11:48:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 8 Apr 2023 11:48:36 -0400    

Click here for diff

If a variable has an initialization expression that wraps onto the  
next line(s), pg_bsd_indent will now indent the continuation lines  
one stop, instead of aligning them flush with the variable declaration.  
  
We've been holding off applying this until the last v16 CF finished,  
but now it's time.  
  
Thomas Munro and Tom Lane  
  
Discussion: https://postgr.es/m/20230120013137.7ky7nl4e4zjorrfa@awork3.anarazel.de  

M src/tools/pg_bsd_indent/args.c
M src/tools/pg_bsd_indent/io.c
M src/tools/pgindent/pgindent

Try to unbreak MSVC builds for pg_waldump

commit   : bbec50de16d2bf6e1a2878ff0f7e39dbd86ecff8    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Apr 2023 11:19:18 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Apr 2023 11:19:18 -0400    

Click here for diff

remedy an omission in commit 7d8219a444  

M src/tools/msvc/Mkvcbuild.pm

Suppress bogus printout during new 035_standby_logical_decoding.pl test.

commit   : 07690aab46ed5530643942726b27a503995dd835    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 8 Apr 2023 10:50:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 8 Apr 2023 10:50:46 -0400    

Click here for diff

Our convention for some time has been that successful tests shouldn't  
print anything on stderr.  A stray "diag" call violated that, and  
for that matter messed up the normal TAP progress display.  

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

Skip \password TAP test on old IPC::Run versions

commit   : 2e57ffe12f6b5c1498f29cb7c0d9e17c797d9da6    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 8 Apr 2023 15:51:45 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sat, 8 Apr 2023 15:51:45 +0200    

Click here for diff

IPC::Run versions prior to 0.98 cause the interactive session to time out,  
so SKIP the test in case these versions are detected (they are within the  
base requirement for our TAP tests in general).  Error reported by the BF  
and investigation by Tom Lane.  
  
Discussion: https://postgr.es/m/414A86BD-986B-48A7-A1E4-EEBCE5AF08CB@yesql.se  

M src/test/authentication/t/001_password.pl

Try to unbreak MSVC builds for fuzzystrmatch

commit   : 0e9b271890c09ecb60b08e45d377031b2385ebeb    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Apr 2023 08:26:19 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 8 Apr 2023 08:26:19 -0400    

Click here for diff

Commit a290378a37 neglrected to add a recipe for MSVC to build the  
daitch_motokoff.h file.  
  
Per buildfarm animal bowerbird.  

M src/tools/msvc/Solution.pm

Revert "Add support for Kerberos credential delegation"

commit   : 3d03b24c350ab060bb223623bdff38835bd7afd0    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Sat, 8 Apr 2023 07:21:35 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Sat, 8 Apr 2023 07:21:35 -0400    

Click here for diff

This reverts commit 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454.  
  
Per discussion and buildfarm, this depends on APIs that seem to not  
be available on at least one platform (NetBSD).  Should be certainly  
possible to rework to be optional on that platform if necessary but bit  
late for that at this point.  
  
Discussion: https://postgr.es/m/3286097.1680922218@sss.pgh.pa.us  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

Redesign interrupt/cancel API for regex engine.

commit   : db4f21e4a34b1d5a3f7123e28e77f575d1a971ea    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:57:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:57:46 +1200    

Click here for diff

Previously, a PostgreSQL-specific callback checked by the regex engine  
had a way to trigger a special error code REG_CANCEL if it detected that  
the next call to CHECK_FOR_INTERRUPTS() would certainly throw via  
ereport().  
  
A later proposed bugfix aims to move some complex logic out of signal  
handlers, so that it won't run until the next CHECK_FOR_INTERRUPTS(),  
which makes the above design impossible unless we split  
CHECK_FOR_INTERRUPTS() into two phases, one to run logic and another to  
ereport().  We may develop such a system in the future, but for the  
regex code it is no longer necessary.  
  
An earlier commit moved regex memory management over to our  
MemoryContext system.  Given that the purpose of the two-phase interrupt  
checking was to free memory before throwing, something we don't need to  
worry about anymore, it seems simpler to inject CHECK_FOR_INTERRUPTS()  
directly into cancelation points, and just let it throw.  
  
Since the plan is to keep PostgreSQL-specific concerns separate from the  
main regex engine code (with a view to bein able to stay in sync with  
other projects), do this with a new macro INTERRUPT(), customizable in  
regcustom.h and defaulting to nothing.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/regex/regc_locale.c
M src/backend/regex/regc_nfa.c
M src/backend/regex/regcomp.c
M src/backend/regex/rege_dfa.c
M src/backend/regex/regexec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/varlena.c
M src/include/regex/regcustom.h
M src/include/regex/regerrs.h
M src/include/regex/regex.h
M src/include/regex/regguts.h
M src/test/modules/test_regex/test_regex.c

Update contrib/trgm_regexp's memory management.

commit   : 6db75edb2ecbc9f6912f90b671b01ab4ac3a01b0    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:55:28 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:55:28 +1200    

Click here for diff

While no code change was necessary for this code to keep working, we  
don't need to use PG_TRY()/PG_FINALLY() with explicit clean-up while  
working with regexes anymore.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M contrib/pg_trgm/trgm_regexp.c

Update tsearch regex memory management.

commit   : 4f51429dd7f194e36af32b557ecdce555b5ab51b    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:54:45 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:54:45 +1200    

Click here for diff

Now that our regex engine uses palloc(), it's not necessary to set up a  
special memory context callback to free compiled regexes.  The regex has  
no resources other than the memory that is already going to be freed in  
bulk.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/tsearch/spell.c
M src/include/tsearch/dicts/spell.h

Use MemoryContext API for regex memory management.

commit   : bea3d7e3831fa6a1395eadbad7d97cebc7aa8aee    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:52:35 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 21:52:35 +1200    

Click here for diff

Previously, regex_t objects' memory was managed with malloc() and free()  
directly.  Switch to palloc()-based memory management instead.  
Advantages:  
  
 * memory used by cached regexes is now visible with MemoryContext  
   observability tools  
  
 * cleanup can be done automatically in certain failure modes  
   (something that later commits will take advantage of)  
  
 * cleanup can be done in bulk  
  
On the downside, there may be more fragmentation (wasted memory) due to  
per-regex MemoryContext objects.  This is a problem shared with other  
cached objects in PostgreSQL and can probably be improved with later  
tuning.  
  
Thanks to Noah Misch for suggesting this general approach, which  
unblocks later work on interrupts.  
  
Suggested-by: Noah Misch <noah@leadboat.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CA%2BhUKGK3PGKwcKqzoosamn36YW-fsuTdOPPF1i_rtEO%3DnEYKSg%40mail.gmail.com  

M src/backend/regex/regprefix.c
M src/backend/utils/adt/regexp.c
M src/include/regex/regcustom.h

TAP test for logical decoding on standby

commit   : fcd77d53217b4c4049d176072a1763d6e11ca478    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 02:24:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 02:24:50 -0700    

Click here for diff

Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Author: Amit Khandekar <amitdkhan.pg@gmail.com>  
Author: Craig Ringer <craig@2ndquadrant.com> (in an older version)  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  

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

Allow logical decoding on standbys

commit   : 0fdab27ad68a059a1663fa5ce48d76333f1bd74c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 02:20:01 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 02:20:01 -0700    

Click here for diff

Unsurprisingly, this requires wal_level = logical to be set on the primary and  
standby. The infrastructure added in 26669757b6a ensures that slots are  
invalidated if the primary's wal_level is lowered.  
  
Creating a slot on a standby waits for a xl_running_xact record to be  
processed. If the primary is idle (and thus not emitting xl_running_xact  
records), that can take a while.  To make that faster, this commit also  
introduces the pg_log_standby_snapshot() function. By executing it on the  
primary, completion of slot creation on the standby can be accelerated.  
  
Note that logical decoding on a standby does not itself enforce that required  
catalog rows are not removed. The user has to use physical replication slots +  
hot_standby_feedback or other measures to prevent that. If catalog rows  
required for a slot are removed, the slot is invalidated.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion, for the addition of the pg_log_standby_snapshot() function.  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de> (in an older version)  
Author: Amit Khandekar <amitdkhan.pg@gmail.com> (in an older version)  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: FabrÌzio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-By: Robert Haas <robertmhaas@gmail.com>  

M doc/src/sgml/func.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/catalog/system_functions.sql
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/include/access/xlog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat

For cascading replication, wake physical and logical walsenders separately

commit   : e101dfac3a53c20bfbf1ca85d30a368c2954facf    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 00:24:24 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 8 Apr 2023 00:24:24 -0700    

Click here for diff

Physical walsenders can't send data until it's been flushed; logical  
walsenders can't decode and send data until it's been applied. On the  
standby, the WAL is flushed first, which will only wake up physical  
walsenders; and then applied, which will only wake up logical  
walsenders.  
  
Previously, all walsenders were awakened when the WAL was flushed. That  
was fine for logical walsenders on the primary; but on the standby the  
flushed WAL would have been not applied yet, so logical walsenders were  
awakened too early.  
  
Per idea from Jeff Davis and Amit Kapila.  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-By: Jeff Davis <pgsql@j-davis.com>  
Reviewed-By: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Discussion: https://postgr.es/m/CAA4eK1+zO5LUeisabX10c81LU-fWMKO4M9Wyg1cdkbW7Hqh6vQ@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h

Handle logical slot conflicts on standby

commit   : 26669757b6a7665c1069e77e6472bd8550193ca6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 23:11:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 23:11:28 -0700    

Click here for diff

During WAL replay on the standby, when a conflict with a logical slot is  
identified, invalidate such slots. There are two sources of conflicts:  
1) Using the information added in 6af1793954e, logical slots are invalidated if  
   required rows are removed  
2) wal_level on the primary server is reduced to below logical  
  
Uses the infrastructure introduced in the prior commit. FIXME: add commit  
reference.  
  
Change InvalidatePossiblyObsoleteSlot() to use a recovery conflict to  
interrupt use of a slot, if called in the startup process. The new recovery  
conflict is added to pg_stat_database_conflicts, as confl_active_logicalslot.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion for the addition of the pg_stat_database_conflicts column.  
Bumps PGSTAT_FILE_FORMAT_ID for the same reason.  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: Amit Khandekar <amitdkhan.pg@gmail.com> (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/slot.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/storage/procsignal.h
M src/include/storage/standby.h
M src/test/regress/expected/rules.out

Support invalidating replication slots due to horizon and wal_level

commit   : be87200efd9308ccfe217ce8828f316e93e370da    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:40:27 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:40:27 -0700    

Click here for diff

Needed for logical decoding on a standby. Slots need to be invalidated because  
of the horizon if rows required for logical decoding are removed. If the  
primary's wal_level is lowered from 'logical', logical slots on the standby  
need to be invalidated.  
  
The new invalidation methods will be used in a subsequent commit.  
  
Logical slots that have been invalidated can be identified via the new  
pg_replication_slots.conflicting column.  
  
See 6af1793954e for an overall design of logical decoding on a standby.  
  
Bumps catversion for the addition of the new pg_replication_slots column.  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: Amit Khandekar <amitdkhan.pg@gmail.com> (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de  

M doc/src/sgml/system-views.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/regress/expected/rules.out

Fix underspecified sort order in inherit.sql

commit   : 2ed16aacf1af1e1a26bffb121a19d1ad5f5177f0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:25:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:25:46 -0700    

Click here for diff

Introduced in e056c557aef4.  
  
Per buildfarm member prion.  

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

Prevent use of invalidated logical slot in CreateDecodingContext()

commit   : 4397abd0a2af955326c0608d63f3716ce5901004    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:19:05 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 22:19:05 -0700    

Click here for diff

Previously we had checks for this in multiple places. Support for logical  
decoding on standbys will add other forms of invalidation, making it worth  
while to centralize the checks.  
  
This slightly changes the error message for both the walsender and SQL  
interface. Particularly the SQL interface error was inaccurate, as the "This  
slot has never previously reserved WAL" portion was unreachable.  
  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de  

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

Replace replication slot's invalidated_at LSN with an enum

commit   : 15f8203a5975d6b9b78e2c64e213ed964b50c044    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 21:47:25 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 21:47:25 -0700    

Click here for diff

This is mainly useful because the upcoming logical-decoding-on-standby feature  
adds further reasons for invalidating slots, and we don't want to end up with  
multiple invalidated_* fields, or check different attributes.  
  
Eventually we should consider not resetting restart_lsn when invalidating a  
slot due to max_slot_wal_keep_size. But that's a user visible change, so left  
for later.  
  
Increases SLOT_VERSION, due to the changed field (with a different alignment,  
no less).  
  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de  

M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h
M src/tools/pgindent/typedefs.list

Add io_direct setting (developer-only).

commit   : d4e71df6d757fd21c363164a3a4d3b5681462662    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 11:04:49 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 11:04:49 +1200    

Click here for diff

Provide a way to ask the kernel to use O_DIRECT (or local equivalent)  
where available for data and WAL files, to avoid or minimize kernel  
caching.  This hurts performance currently and is not intended for end  
users yet.  Later proposed work would introduce our own I/O clustering,  
read-ahead, etc to replace the facilities the kernel disables with this  
option.  
  
The only user-visible change, if the developer-only GUC is not used, is  
that this commit also removes the obscure logic that would activate  
O_DIRECT for the WAL when wal_sync_method=open_[data]sync and  
wal_level=minimal (which also requires max_wal_senders=0).  Those are  
non-default and unlikely settings, and this behavior wasn't (correctly)  
documented.  The same effect can be achieved with io_direct=wal.  
  
Author: Thomas Munro <thomas.munro@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKGK1X532hYqJ_MzFWt0n1zt8trz980D79WbjwnT-yYLZpg%40mail.gmail.com  

M doc/src/sgml/config.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/misc/guc_tables.c
M src/include/storage/fd.h
M src/include/storage/smgr.h
M src/include/utils/guc_hooks.h
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/004_io_direct.pl

Introduce PG_IO_ALIGN_SIZE and align all I/O buffers.

commit   : faeedbcefd40bfdf314e048c425b6d9208896d90    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 10:38:09 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 8 Apr 2023 10:38:09 +1200    

Click here for diff

In order to have the option to use O_DIRECT/FILE_FLAG_NO_BUFFERING in a  
later commit, we need the addresses of user space buffers to be well  
aligned.  The exact requirements vary by OS and file system (typically  
sectors and/or memory pages).  The address alignment size is set to  
4096, which is enough for currently known systems: it matches modern  
sectors and common memory page size.  There is no standard governing  
O_DIRECT's requirements so we might eventually have to reconsider this  
with more information from the field or future systems.  
  
Aligning I/O buffers on memory pages is also known to improve regular  
buffered I/O performance.  
  
Three classes of I/O buffers for regular data pages are adjusted:  
(1) Heap buffers are now allocated with the new palloc_aligned() or  
MemoryContextAllocAligned() functions introduced by commit 439f6175.  
(2) Stack buffers now use a new struct PGIOAlignedBlock to respect  
PG_IO_ALIGN_SIZE, if possible with this compiler.  (3) The buffer  
pool is also aligned in shared memory.  
  
WAL buffers were already aligned on XLOG_BLCKSZ.  It's possible for  
XLOG_BLCKSZ to be configured smaller than PG_IO_ALIGNED_SIZE and thus  
for O_DIRECT WAL writes to fail to be well aligned, but that's a  
pre-existing condition and will be addressed by a later commit.  
  
BufFiles are not yet addressed (there's no current plan to use O_DIRECT  
for those, but they could potentially get some incidental speedup even  
in plain buffered I/O operations through better alignment).  
  
If we can't align stack objects suitably using the compiler extensions  
we know about, we disable the use of O_DIRECT by setting PG_O_DIRECT to  
0.  This avoids the need to consider systems that have O_DIRECT but  
can't align stack objects the way we want; such systems could in theory  
be supported with more work but we don't currently know of any such  
machines, so it's easier to pretend there is no O_DIRECT support  
instead.  That's an existing and tested class of system.  
  
Add assertions that all buffers passed into smgrread(), smgrwrite() and  
smgrextend() are correctly aligned, unless PG_O_DIRECT is 0 (= stack  
alignment tricks may be unavailable) or the block size has been set too  
small to allow arrays of buffers to be all aligned.  
  
Author: Thomas Munro <thomas.munro@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/CA+hUKGK1X532hYqJ_MzFWt0n1zt8trz980D79WbjwnT-yYLZpg@mail.gmail.com  

M contrib/bloom/blinsert.c
M contrib/pg_prewarm/pg_prewarm.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hashpage.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/file/buffile.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/smgr/md.c
M src/backend/utils/sort/logtape.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_upgrade/file.c
M src/common/file_utils.c
M src/include/c.h
M src/include/pg_config_manual.h
M src/include/storage/fd.h
M src/tools/pgindent/typedefs.list

Doc: Fix the datatype of the newly added SUBSCRIPTION options.

commit   : d73c285af5c29a0b486643b77350bc23fbb6114c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Sat, 8 Apr 2023 09:42:50 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Sat, 8 Apr 2023 09:42:50 +0530    

Click here for diff

In docs, the datatype of "password_required" and "run_as_owner" was  
incorrectly specified as a string.  
  
Author: Amit Kapila  
Reviewed-by: Sawada Masahiko  
Discussion: https://postgr.es/m/CAHut+Pu=pnJf=SS1583pknSQ3CbOqLCkWcJCQYt6zxTagHEdmw@mail.gmail.com  

M doc/src/sgml/ref/create_subscription.sgml

Add missing .gitignore entry.

commit   : db6957bae8d7716785aa3748b25a9a4b7c3ff304    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 23:32:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 23:32:49 -0400    

Click here for diff

Seems an oversight in 7d8219a44.  Fix before somebody commits  
a generated file.  

M src/bin/pg_waldump/.gitignore

Remove useless dependencies in daitch_mokotoff_header.pl.

commit   : 2bfbad9c42207b4ba75cfce9901fa78f2c024b61    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 23:22:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 23:22:28 -0400    

Click here for diff

Actually, the correct fix for this is "we don't need this at all",  
because this program isn't dealing in any non-ASCII data.  The  
dependency on Data::Dumper seems to be a leftover too.  
  
Discussion: https://postgr.es/m/3287943.1680922997@sss.pgh.pa.us  

M contrib/fuzzystrmatch/daitch_mokotoff_header.pl

Add support for Kerberos credential delegation

commit   : 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Fri, 7 Apr 2023 21:58:04 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Fri, 7 Apr 2023 21:58:04 -0400    

Click here for diff

Support GSSAPI/Kerberos credentials being delegated to the server by a  
client.  With this, a user authenticating to PostgreSQL using Kerberos  
(GSSAPI) credentials can choose to delegate their credentials to the  
PostgreSQL server (which can choose to accept them, or not), allowing  
the server to then use those delegated credentials to connect to  
another service, such as with postgres_fdw or dblink or theoretically  
any other service which is able to be authenticated using Kerberos.  
  
Both postgres_fdw and dblink are changed to allow non-superuser  
password-less connections but only when GSSAPI credentials have been  
delegated to the server by the client and GSSAPI is used to  
authenticate to the remote system.  
  
Authors: Stephen Frost, Peifeng Qiu  
Reviewed-By: David Christensen  
Discussion: https://postgr.es/m/CO1PR05MB8023CC2CB575E0FAAD7DF4F8A8E29@CO1PR05MB8023.namprd05.prod.outlook.com  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/config.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M src/backend/catalog/system_views.sql
M src/backend/foreign/foreign.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/catalog/pg_proc.dat
M src/include/libpq/auth.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/libpq-be.h
M src/include/utils/backend_status.h
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/test/kerberos/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/regress/expected/rules.out

Pacify perlcritic.

commit   : edc627ae27632ae2be0e435aca02ed38005cb55f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 21:32:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 21:32:44 -0400    

Click here for diff

Discussion: https://postgr.es/m/3271512.1680916423@sss.pgh.pa.us  

M contrib/fuzzystrmatch/daitch_mokotoff_header.pl

Track IO times in pg_stat_io

commit   : ac8d53dae5ae2914aeb022dc514826f71c7206e6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 16:05:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 16:05:26 -0700    

Click here for diff

a9c70b46dbe and 8aaa04b32S added counting of IO operations to a new view,  
pg_stat_io. Now, add IO timing for reads, writes, extends, and fsyncs to  
pg_stat_io as well.  
  
This combines the tracking for pgBufferUsage with the tracking for pg_stat_io  
into a new function pgstat_count_io_op_time(). This should make it a bit  
easier to avoid the somewhat costly instr_time conversion done for  
pgBufferUsage.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/flat/CAAKRu_ay5iKmnbXZ3DsauViF3eMxu4m1oNnJXqV_HyqYeg55Ww%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/smgr/md.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Show more detail in nbtree rmgr descriptions.

commit   : 1c453cfd8976d9c6451ba45e27bf30375d574312    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 7 Apr 2023 16:46:23 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 7 Apr 2023 16:46:23 -0700    

Click here for diff

Show a detailed description of the page offset number arrays that appear  
in certain nbtree WAL records.  
  
Also brings nbtree desc routines in line with the guidelines established  
by recent commit 7d8219a4.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-By: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/flat/20230109215842.fktuhesvayno6o4g%40awork3.anarazel.de  

M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/include/access/rmgrdesc_utils.h

For Kerberos testing, disable DNS lookups

commit   : ce5e23408568452fd206b79ee411c6f34d80c46b    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Fri, 7 Apr 2023 19:36:46 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Fri, 7 Apr 2023 19:36:46 -0400    

Click here for diff

Similar to 8dff2f224, this disables DNS lookups by the Kerberos library  
to look up the KDC and the realm while the Kerberos tests are running.  
In some environments, these lookups can take a long time and end up  
timing out and causing tests to fail.  Further, since this isn't really  
our domain, we shouldn't be sending out these DNS requests during our  
tests.  

M src/test/kerberos/t/001_auth.pl

Show more detail in heapam rmgr descriptions.

commit   : 7d8219a444bd917d21234c97e2417a410f10ebd3    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 7 Apr 2023 16:08:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 7 Apr 2023 16:08:52 -0700    

Click here for diff

Add helper functions that output arrays in a standard format, and use  
the functions inside heapdesc routines.  This allows tools like  
pg_walinspect to show a detailed description of the page offset number  
arrays for records like PRUNE and VACUUM (unless there was an FPI).  
  
Also document the conventions that desc routines should follow.  Only  
the heapdesc routines follow the conventions for now, so they're just  
guidelines for the time being.  
  
Based on a suggestion from Andres Freund.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-By: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/flat/20230109215842.fktuhesvayno6o4g%40awork3.anarazel.de  

M doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/Makefile
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/meson.build
A src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/bin/pg_waldump/Makefile
A src/include/access/rmgrdesc_utils.h

Adjust contrib/sepgsql regression test expected outputs.

commit   : 76c111a7f16659f9018391f655764c8226461ca4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 18:17:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 18:17:22 -0400    

Click here for diff

Per buildfarm, the log output has changed as a consequence of  
commit e056c557a changing the catalog accesses performed in  
some commands.  
  
Discussion: https://postgr.es/m/20230407211950.aojbdirwdrxjeyzb@awork3.anarazel.de  

M contrib/sepgsql/expected/alter.out
M contrib/sepgsql/expected/ddl.out

Add support for Daitch-Mokotoff Soundex in contrib/fuzzystrmatch.

commit   : a290378a3752f787cdc2252889ba513f6fb393db    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 17:31:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 17:31:51 -0400    

Click here for diff

This modernized version of Soundex works significantly better than  
the original, particularly for non-English names.  
  
Dag Lem, reviewed by quite a few people along the way  
  
Discussion: https://postgr.es/m/yger1atbgfy.fsf@sid.nimrod.no  

M contrib/fuzzystrmatch/.gitignore
M contrib/fuzzystrmatch/Makefile
A contrib/fuzzystrmatch/daitch_mokotoff.c
A contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/fuzzystrmatch/expected/fuzzystrmatch.out
A contrib/fuzzystrmatch/expected/fuzzystrmatch_utf8.out
A contrib/fuzzystrmatch/expected/fuzzystrmatch_utf8_1.out
A contrib/fuzzystrmatch/fuzzystrmatch–1.1–1.2.sql
M contrib/fuzzystrmatch/fuzzystrmatch.control
M contrib/fuzzystrmatch/meson.build
M contrib/fuzzystrmatch/sql/fuzzystrmatch.sql
A contrib/fuzzystrmatch/sql/fuzzystrmatch_utf8.sql
M doc/src/sgml/fuzzystrmatch.sgml

Fix table name clash in recently introduced test

commit   : 728015a47016dcd734c516e43f326ae491b6a3d2    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 14:02:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 14:02:46 -0700    

Click here for diff

A few buildfarm animals recently started complaining about the "child"  
relation already existing. e056c557aef added a new child table to inherit.sql,  
but triggers.sql, running in the same parallel group, also uses a child table.  
  
Rename the new table to inh_child. It maybe worth renaming child, parent in  
other tests as well, but that's work for another day.  
  
Discussion: https://postgr.es/m/20230407204530.52q3v5cu5x6dj676@awork3.anarazel.de  

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

Improve IO accounting for temp relation writes

commit   : 704261ecc694db11d9b5feb4f05f57778214ba2f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 13:24:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 13:24:26 -0700    

Click here for diff

Both pgstat_database and pgBufferUsage count IO timing for reads of temporary  
relation blocks into local buffers. However, both failed to count write IO  
timing for flushes of dirty local buffers. Fix.  
  
Additionally, FlushRelationBuffers() seems to have omitted counting write  
IO (both count and timing) stats for both pgstat_database and  
pgBufferUsage. Fix.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20230321023451.7rzy4kjj2iktrg2r%40awork3.anarazel.de  

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

Test SCRAM iteration changes with psql \password

commit   : bf5a894c557179b85500a307104b36e846e24f48    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 22:14:23 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 22:14:23 +0200    

Click here for diff

A version of this test was included in the original patch for altering  
SCRAM iteration count, but was omitted due to how interactive psql TAP  
sessions worked before being refactored.  
  
Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt3d6@awork3.anarazel.de  
Discussion: https://postgr.es/m/F72E7BC7-189F-4B17-BF47-9735EB72C364@yesql.se  

M src/test/authentication/t/001_password.pl

Refactor background psql TAP functions

commit   : 664d757531e11ea5ef6971884ddb2a7af6fae69a    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 22:14:20 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 22:14:20 +0200    

Click here for diff

This breaks out the background and interactive psql functionality into a  
new class, PostgreSQL::Test::BackgroundPsql.  Sessions are still initiated  
via PostgreSQL::Test::Cluster, but once started they can be manipulated by  
the new helper functions which intend to make querying easier.  A sample  
session for a command which can be expected to finish at a later time can  
be seen below.  
  
  my $session = $node->background_psql('postgres');  
  $bsession->query_until(qr/start/, q(  
    \echo start  
	CREATE INDEX CONCURRENTLY idx ON t(a);  
  ));  
  $bsession->quit;  
  
Patch by Andres Freund with some additional hacking by me.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Discussion: https://postgr.es/m/20230130194350.zj5v467x4jgqt3d6@awork3.anarazel.de  

M contrib/amcheck/t/003_cic_2pc.pl
M src/bin/psql/t/010_tab_completion.pl
A src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/subscription/t/015_stream.pl

Fix underspecified sort order in test query

commit   : 32bc0d022dee250fac9fc787226abed96b8ff894    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Apr 2023 20:19:16 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Apr 2023 20:19:16 +0200    

Click here for diff

Fail in e056c557aef4.  

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

Add pg_buffercache_usage_counts() to contrib/pg_buffercache.

commit   : f3fa31327ecba75ee0e946abaa56dbf471ba704b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 14:25:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 14:25:45 -0400    

Click here for diff

It was pointed out that pg_buffercache_summary()'s report of  
the overall average usage count isn't that useful, and what  
would be more helpful in many cases is to report totals for  
each possible usage count.  Add a new function to do it like  
that.  Since pg_buffercache 1.4 is already new for v16,  
we don't need to create a new extension version; we'll just  
define this as part of 1.4.  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20230130233040.GA2800702@nathanxps13  

M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql
M doc/src/sgml/pgbuffercache.sgml

Catalog NOT NULL constraints

commit   : e056c557aef4006c3dfbf8a4b94b7ae88eb9fd67    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Apr 2023 19:20:53 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 7 Apr 2023 19:20:53 +0200    

Click here for diff

We now create pg_constaint rows for NOT NULL constraints with  
contype='n'.  
  
We propagate these constraints during operations such as adding  
inheritance relationships, creating and attaching partitions, creating  
tables LIKE other tables.  We mostly follow the well-known rules of  
conislocal and coninhcount that we have for CHECK constraints, with some  
adaptations; for example, as opposed to CHECK constraints, we don't  
match NOT NULL ones by name when descending a hierarchy to alter it;  
instead we match by column number.  This means we don't require the  
constraint names to be identical across a hierarchy.  
  
For now, we omit them from system catalogs.  Maybe this is worth  
reconsidering.  We don't support NOT VALID nor DEFERRABLE clauses  
either; these can be added as separate features later (this patch is  
already large and complicated enough.)  
  
This has been very long in the making.  The first patch was written by  
Bernd Helmle in 2010 to add a new pg_constraint.contype value ('n'),  
which I (Álvaro) then hijacked in 2011 and 2012, until that one was  
killed by the realization that we ought to use contype='c' instead:  
manufactured CHECK constraints.  However, later SQL standard  
development, as well as nonobvious emergent properties of that design  
(mostly, failure to distinguish them from "normal" CHECK constraints as  
well as the performance implication of having to test the CHECK  
expression) led us to reconsider this choice, so now the current  
implementation uses contype='n' again.  
  
In 2016 Vitaly Burovoy also worked on this feature[1] but found no  
consensus for his proposed approach, which was claimed to be closer to  
the letter of the standard, requiring additional pg_attribute columns to  
track the OID of the NOT NULL constraint for that column.  
[1] https://postgr.es/m/CAKOSWNkN6HSyatuys8xZxzRCR-KL1OkHS5-b9qd9bf1Rad3PLA@mail.gmail.com  
  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Author: Bernd Helmle <mailings@oopsware.de>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
  
Discussion: https://postgr.es/m/CACA0E642A0267EDA387AF2B%40%5B172.26.14.62%5D  
Discussion: https://postgr.es/m/AANLkTinLXMOEMz+0J29tf1POokKi4XDkWJ6-DDR9BKgU@mail.gmail.com  
Discussion: https://postgr.es/m/20110707213401.GA27098@alvh.no-ip.org  
Discussion: https://postgr.es/m/1343682669-sup-2532@alvh.no-ip.org  
Discussion: https://postgr.es/m/CAKOSWNkN6HSyatuys8xZxzRCR-KL1OkHS5-b9qd9bf1Rad3PLA@mail.gmail.com  
Discussion: https://postgr.es/m/20220817181249.q7qvj3okywctra3c@alvherre.pgsql  

M doc/src/sgml/catalogs.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/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.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/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/catalog/catversion.h
M src/include/catalog/heap.h
M src/include/catalog/pg_constraint.h
M src/include/commands/tablecmds.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/event_trigger.out
M src/test/regress/expected/foreign_data.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/indexing.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/replica_identity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/create_table.sql
M src/test/regress/sql/indexing.sql
M src/test/regress/sql/inherit.sql
M src/test/regress/sql/replica_identity.sql

Doc: improve descriptions of max_[pred_]locks_per_transaction GUCs.

commit   : ff245a37888ae28da4e6eeacac83f00aa0986340    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 13:29:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 13:29:29 -0400    

Click here for diff

The old wording described these as being multiplied by max_connections  
plus max_prepared_transactions, which hasn't been exactly right for  
some time thanks to the addition of various auxiliary processes.  
Moreover, exactness here is a bit pointless given that the lock tables  
can expand into the initially-unallocated "slop" space in shared  
memory.  Rather than trying to track exactly what the code is doing,  
let's just use the term "server processes".  
  
Likewise adjust these GUCs' description strings in guc_tables.c.  
  
Wang Wei, reviewed by Nathan Bossart and myself  
  
Discussion: https://postgr.es/m/OS3PR01MB6275BDD09C9B875C65FCC5AB9EA39@OS3PR01MB6275.jpnprd01.prod.outlook.com  

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

Add array_sample() and array_shuffle() functions.

commit   : 888f2ea0a81ff171087bdd1c5c1eeda3b78d73d4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 11:47:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 11:47:07 -0400    

Click here for diff

These are useful in Monte Carlo applications.  
  
Martin Kalcher, reviewed/adjusted by Daniel Gustafsson and myself  
  
Discussion: https://postgr.es/m/9d160a44-7675-51e8-60cf-6d64b76db831@aboutsource.net  

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

Fix locale-dependent test case.

commit   : cd82e5c79d145dddd7a30ed35e4d3b83945b56f3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 10:35:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 7 Apr 2023 10:35:11 -0400    

Click here for diff

psql parses the interval argument of \watch with locale-dependent  
strtod().  In commit 00beecfe8 I added a test case that exercises  
a fractional interval, but I hard-coded 0.01 which doesn't work  
in locales where the radix point isn't ".".  We don't want to  
change this longstanding parsing behavior, so fix the test case  
to generate a suitably locale-aware spelling.  
  
Report and patch by Alexander Korotkov.  
  
Discussion: https://postgr.es/m/CAPpHfdv+10Uk6FWjsh3+ju7kHYr76LaRXbYayXmrM7FBU-=Hgg@mail.gmail.com  

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

Fix copy-paste bug in 12f3867f553 triggering an assert after a write error

commit   : 21d7c05a5cf7637cbdf2739006936bb9d279d505    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 01:02:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 7 Apr 2023 01:02:46 -0700    

Click here for diff

The same condition accidentally was copied to both branches. Manual testing  
confirms that otherwise the error recovery path works fine.  
  
Found while reviewing the logical-decoding-on-standby patch.  

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

Add tab-completion for newly added SUBSCRIPTION options.

commit   : 96c498d2f8ce5f0082c64793f94e2d0cfa7d7605    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 7 Apr 2023 10:32:36 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 7 Apr 2023 10:32:36 +0530    

Click here for diff

Commits c3afe8cf5a and 482675987b added new subscription options  
"password_required" and "run_as_owner". This patch adds tab-completion  
for these newly added options.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+Pu=pnJf=SS1583pknSQ3CbOqLCkWcJCQYt6zxTagHEdmw@mail.gmail.com  

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

Add more protections in WAL record APIs against overflows

commit   : 8fcb32db98eda1ad2a0c0b40b1cbb5d9a7aa68f0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 7 Apr 2023 10:10:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 7 Apr 2023 10:10:17 +0900    

Click here for diff

This commit adds a limit to the size of an XLogRecord at 1020MB, based  
on a suggestion by Heikki Linnakangas.  This counts for the overhead  
needed by the XLogReader when allocating the memory it needs to read a  
record in DecodeXLogRecordRequiredSpace(), based on the record size.  An  
assertion based on that is added to detect that any additions in the  
XLogReader facilities would not cause any overflows.  If that's ever the  
case, the upper bound allowed would need to be adjusted.  
  
Before this, it was possible for an external module to create WAL  
records large enough to be assembled but not replayable, causing  
failures when replaying such WAL records on standbys.  One case  
mentioned where this is possible is the in-core function  
pg_logical_emit_message() (wrapper for LogLogicalMessage), that allows  
to emit WAL records with an arbitrary amount of data potentially higher  
than the replay limit of approximately 1GB (limit of a palloc, minus the  
overhead needed by a XLogReader).  
  
This commit is a follow-up of ffd1b6b that has added similar protections  
for the block-level data.  Here, the checks are extended to the whole  
record length, mainrdata_len being extended from uint32 to uint64 with  
the routines registering buffer and record data still limited to uint32  
to minimize the checks when assembling a record.  All the error messages  
related to overflow checks are improved to provide more context about  
the error happening.  
  
Author: Matthias van de Meent  
Reviewed-by: Andres Freund, Heikki Linnakangas, Michael Paquier  
Discussion: https://postgr.es/m/CAEze2WgGiw+LZt+vHf8tWqB_6VxeLsMeoAuod0N=ij1q17n5pw@mail.gmail.com  

M src/backend/access/transam/xloginsert.c
M src/include/access/xlogrecord.h

Use ExtendBufferedRelTo() in XLogReadBufferExtended()

commit   : 26158b852d3adf6936008ce09c9ff2b947c8df40    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 17:45:42 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 17:45:42 -0700    

Click here for diff

Instead of extending the relation block-by-block, use ExtendBufferedRelTo(),  
introduced in 31966b151e6. This is faster and simpler.  
  
This also somewhat reduces the danger that disconnected segments pose (which  
can be "discovered" once the previous segment reaches SEGSIZE), as  
ExtendBufferedRelTo() won't extend past the block it has been asked. However,  
the risk of the content of such a disconnected segment being invalid  
remains.  
  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  
Discussion: https://postgr.es/m/20230223010147.32oir7sb66slqnjk@awork3.anarazel.de  

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

Add --buffer-usage-limit option to vacuumdb

commit   : ae78cae3be627213528f2e08eb976d6906d754de    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 7 Apr 2023 12:47:10 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 7 Apr 2023 12:47:10 +1200    

Click here for diff

1cbbee033 added BUFFER_USAGE_LIMIT to the VACUUM and ANALYZE commands, so  
here we permit that option to be specified in vacuumdb.  
  
In passing, adjust the documents for vacuum_buffer_usage_limit and the  
BUFFER_USAGE_LIMIT VACUUM option to mention "kB" rather than "KB".  Do the  
same for the ERROR message in ExecVacuum() and  
check_vacuum_buffer_usage_limit().  Without that we might tell a user that  
the valid minimum value is 128 KB only to reject that because we accept  
only "kB" and not "KB".  
  
Also, add a small reminder comment in vacuum.h to try to trigger the  
memory of anyone adding new fields to VacuumParams that they might want to  
consider if vacuumdb needs to grow a new option too.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/ZAzTg3iEnubscvbf@telsasoft.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/vacuumdb.sgml
M src/backend/commands/vacuum.c
M src/bin/scripts/vacuumdb.c
M src/include/commands/vacuum.h
M src/test/regress/expected/vacuum.out

hio: Use ExtendBufferedRelBy() to extend tables more efficiently

commit   : 00d1e02be24987180115e371abaeb84738257ae2    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 16:35:21 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 16:35:21 -0700    

Click here for diff

While we already had some form of bulk extension for relations, it was fairly  
limited. It only amortized the cost of acquiring the extension lock, the  
relation itself was still extended one-by-one. Bulk extension was also solely  
triggered by contention, not by the amount of data inserted.  
  
To address this, use ExtendBufferedRelBy(), introduced in 31966b151e6, to  
extend the relation. We try to extend the relation by multiple blocks in two  
situations:  
  
1) The caller tells RelationGetBufferForTuple() that it will need multiple  
   pages. For now that's only used by heap_multi_insert(), see commit FIXME.  
  
2) If there is contention on the extension lock, use the number of waiters for  
   the lock as a multiplier for the number of blocks to extend by. This is  
   similar to what we already did. Previously we additionally multiplied the  
   numbers of waiters by 20, but with the new relation extension  
   infrastructure I could not see a benefit in doing so.  
  
Using the freespacemap to provide empty pages can cause significant  
contention, and adds measurable overhead, even if there is no contention. To  
reduce that, remember the blocks the relation was extended by in the  
BulkInsertState, in the extending backend. In case 1) from above, the blocks  
the extending backend needs are not entered into the FSM, as we know that we  
will need those blocks.  
  
One complication with using the FSM to record empty pages, is that we need to  
insert blocks into the FSM, when we already hold a buffer content lock. To  
avoid doing IO while holding a content lock, release the content lock before  
recording free space. Currently that opens a small window in which another  
backend could fill the block, if a concurrent VACUUM records the free  
space. If that happens, we retry, similar to the already existing case when  
otherBuffer is provided. In the future it might be worth closing the race by  
preventing VACUUM from recording the space in newly extended pages.  
  
This change provides very significant wins (3x at 16 clients, on my  
workstation) for concurrent COPY into a single relation. Even single threaded  
COPY is measurably faster, primarily due to not dirtying pages while  
extending, if supported by the operating system (see commit 4d330a61bb1). Even  
single-row INSERTs benefit, although to a much smaller degree, as the relation  
extension lock rarely is the primary bottleneck.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/include/access/hio.h

Add VACUUM/ANALYZE BUFFER_USAGE_LIMIT option

commit   : 1cbbee03385763b066ae3961fc61f2cd01a0d0d7    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 7 Apr 2023 11:40:31 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 7 Apr 2023 11:40:31 +1200    

Click here for diff

Add new options to the VACUUM and ANALYZE commands called  
BUFFER_USAGE_LIMIT to allow users more control over how large to make the  
buffer access strategy that is used to limit the usage of buffers in  
shared buffers.  Larger rings can allow VACUUM to run more quickly but  
have the drawback of VACUUM possibly evicting more buffers from shared  
buffers that might be useful for other queries running on the database.  
  
Here we also add a new GUC named vacuum_buffer_usage_limit which controls  
how large to make the access strategy when it's not specified in the  
VACUUM/ANALYZE command.  This defaults to 256KB, which is the same size as  
the access strategy was prior to this change.  This setting also  
controls how large to make the buffer access strategy for autovacuum.  
  
Per idea by Andres Freund.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Reviewed-by: Andres Freund  
Reviewed-by: Justin Pryzby  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/20230111182720.ejifsclfwymw2reb@awork3.anarazel.de  

M doc/src/sgml/config.sgml
M doc/src/sgml/ref/analyze.sgml
M doc/src/sgml/ref/vacuum.sgml
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/buffer/README
M src/backend/storage/buffer/freelist.c
M src/backend/utils/init/globals.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.c
M src/include/miscadmin.h
M src/include/storage/bufmgr.h
M src/include/utils/guc_hooks.h
M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql

heapam: Pass number of required pages to RelationGetBufferForTuple()

commit   : 5279e9db8e8da3c310c0068da2de98df5a714b2e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 14:18:24 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 14:18:24 -0700    

Click here for diff

A future commit will use this information to determine how aggressively to  
extend the relation by. In heap_multi_insert() we know accurately how many  
pages we need once we need to extend the relation, providing an accurate lower  
bound for how much to extend.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/hio.c
M src/include/access/hio.h

Refresh cost-based delay params more frequently in autovacuum

commit   : 7d71d3dd080b9b147402db3365fe498f74704231    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 01:00:21 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 01:00:21 +0200    

Click here for diff

Allow autovacuum to reload the config file more often so that cost-based  
delay parameters can take effect while VACUUMing a relation. Previously,  
autovacuum workers only reloaded the config file once per relation  
vacuumed, so config changes could not take effect until beginning to  
vacuum the next table.  
  
Now, check if a reload is pending roughly once per block, when checking  
if we need to delay.  
  
In order for autovacuum workers to safely update their own cost delay  
and cost limit parameters without impacting performance, we had to  
rethink when and how these values were accessed.  
  
Previously, an autovacuum worker's wi_cost_limit was set only at the  
beginning of vacuuming a table, after reloading the config file.  
Therefore, at the time that autovac_balance_cost() was called, workers  
vacuuming tables with no cost-related storage parameters could still  
have different values for their wi_cost_limit_base and wi_cost_delay.  
  
Now that the cost parameters can be updated while vacuuming a table,  
workers will (within some margin of error) have no reason to have  
different values for cost limit and cost delay (in the absence of  
cost-related storage parameters). This removes the rationale for keeping  
cost limit and cost delay in shared memory. Balancing the cost limit  
requires only the number of active autovacuum workers vacuuming a table  
with no cost-based storage parameters.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h

Separate vacuum cost variables from GUCs

commit   : a85c60a945acfcb1aaac0c521e5eb5a2477d9695    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 00:54:53 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 00:54:53 +0200    

Click here for diff

Vacuum code run both by autovacuum workers and a backend doing  
VACUUM/ANALYZE previously inspected VacuumCostLimit and VacuumCostDelay,  
which are the global variables backing the GUCs vacuum_cost_limit and  
vacuum_cost_delay.  
  
Autovacuum workers needed to override these variables with their  
own values, derived from autovacuum_vacuum_cost_limit and  
autovacuum_vacuum_cost_delay and worker cost limit balancing logic.  
This led to confusing code which, in some cases, both derived and  
set a new value of VacuumCostLimit from VacuumCostLimit.  
  
In preparation for refreshing these GUC values more often, introduce  
new, independent global variables and add a function to update them  
using the GUCs and existing logic.  
  
Per suggestion by Kyotaro Horiguchi  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h
M src/include/postmaster/autovacuum.h

Make vacuum failsafe_active globally visible

commit   : 71a825194fd3f8c084f63bd2b0a8d11d753d25d3    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 00:54:08 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 7 Apr 2023 00:54:08 +0200    

Click here for diff

While vacuuming a table in failsafe mode, VacuumCostActive should  
not be re-enabled.  This currently isn't a problem because vacuum  
cost parameters are only refreshed in between vacuuming tables and  
failsafe status is reset for every table.  
  
In preparation for allowing vacuum cost parameters to be updated  
more frequently, elevate LVRelState->failsafe_active to a global,  
VacuumFailsafeActive, which will be checked when determining whether  
or not to re-enable vacuum cost-related delays.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_ZngzqnEODc7LmS1NH04Kt6Y9huSjz5pp7%2BDXhrjDA0gw%40mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Stabilize just-added regression test cases.

commit   : 5499706bdf60235f787eae9d2b541444ef0b31b3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 18:13:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 18:13:49 -0400    

Click here for diff

The tests added by commits 029dea882 et al turn out to produce  
different output under -DRANDOMIZE_ALLOCATED_MEMORY.  This is  
not a bug exactly: that flag causes coerce_type() to invoke  
the input function twice when coercing an unknown-type literal  
to a specific type.  So you get tsqueryin's bleat about an empty  
tsquery twice.  Revise the test query to avoid that.  
  
Discussion: https://postgr.es/m/20230406213813.uep7plg6lvcywujo@awork3.anarazel.de  

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

psql: set SHELL_ERROR and SHELL_EXIT_CODE in more places.

commit   : 31ae2aa9d2c200a0d7d3283d749669a408ec7b65    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 17:33:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 17:33:38 -0400    

Click here for diff

Make the \g, \o, \w, and \copy commands set these variables  
when closing a pipe.  We missed doing this in commit b0d8f2d98,  
but it seems like a good idea.  
  
There are some remaining places in psql that intentionally don't  
update these variables after running a child program:  
	* pager invocations  
	* backtick evaluation within a prompt  
	* \e (edit query buffer)  
  
Corey Huinker and Tom Lane  
  
Discussion: https://postgr.es/m/CADkLM=eSKwRGF-rnRqhtBORRtL49QsjcVUCa-kLxKTqxypsakw@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/psqlscanslash.l

Fix ts_headline() edge cases for empty query and empty search text.

commit   : 029dea882a7aa34f46732473eed7c917505e6481    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 15:52:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 15:52:37 -0400    

Click here for diff

tsquery's GETQUERY() macro is only safe to apply to a tsquery  
that is known non-empty; otherwise it gives a pointer to garbage.  
Before commit 5a617d75d, ts_headline() avoided this pitfall, but  
only in a very indirect, nonobvious way.  (hlCover could not reach  
its TS_execute call, because if the query contains no lexemes  
then hlFirstIndex would surely return -1.)  After that commit,  
it fell into the trap, resulting in weird errors such as  
"unrecognized operator" and/or valgrind complaints.  In HEAD,  
fix this by not calling TS_execute_locations() at all for an  
empty query.  In the back branches, add a defensive check to  
hlCover() --- that's not fixing any live bug, but I judge the  
code a bit too fragile as-is.  
  
Also, both mark_hl_fragments() and mark_hl_words() were careless  
about the possibility of empty search text: in the cases where  
no match has been found, they'd end up telling mark_fragment() to  
mark from word indexes 0 to 0 inclusive, even when there is no  
word 0.  This is harmless since we over-allocated the prs->words  
array, but it does annoy valgrind.  Fix so that the end index is -1  
and thus mark_fragment() will do nothing in such cases.  
  
Bottom line is that this fixes a live bug in HEAD, but in the  
back branches it's only getting rid of a valgrind nitpick.  
Back-patch anyway.  
  
Per report from Alexander Lakhin.  
  
Discussion: https://postgr.es/m/c27f642d-020b-01ff-ae61-086af287c4fd@gmail.com  

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

hio: Don't pin the VM while holding buffer lock while extending

commit   : 18103b7c5f1aed4ca22f75229346eddb6e20d725    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 11:11:13 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 11:11:13 -0700    

Click here for diff

Starting with commit 7db0cd2145f, RelationGetBufferForTuple() did a  
visibilitymap_pin() while holding an exclusive buffer content lock on a newly  
extended page, when using COPY FREEZE. We elsewhere try hard to avoid to doing  
IO while holding a content lock. And until 14f98e0af99, that happened while  
holding the relation extension lock.  
  
Practically, this isn't a huge issue, because COPY FREEZE is restricted to  
relations created or truncated in the current session, so it's unlikely  
there's a lot of contention.  
  
We can't avoid doing IO while holding the content lock by pinning the VM  
earlier, because we don't know which page it will be on.  
  
While we could just ignore the issue in this case, a future commit will add  
bulk relation extension, which needs to enter pages into the FSM while also  
trying to hold onto a buffer lock.  
  
To address this issue, use visibilitymap_pin_ok() to see if the relevant  
buffer is already pinned. If not, release the buffer, pin the VM buffer, and  
acquire the lock again. This opens up a small window for other backends to  
insert data onto the page - as the page is not entered into the freespacemap,  
other backends won't see it normally, but a concurrent vacuum could enter the  
page, if it started just after the relation is extended. In case the page is  
used by another backend, retry. This is very similar to how locking  
"otherBuffer" is already dealt with.  
  
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Discussion: http://postgr.es/m/20230325025740.wzvchp2kromw4zqz@awork3.anarazel.de  

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

hio: Relax rules for calling GetVisibilityMapPins()

commit   : bba9003b627f4742212bd060ae65fe5c9c3592f3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 10:27:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 6 Apr 2023 10:27:30 -0700    

Click here for diff

GetVisibilityMapPins() insisted on the buffer1/buffer2 being in a specific  
order. This required checks at the callsite. As a subsequent patch will add  
another callsite, move related logic into GetVisibilityMapPins().  
  
Discussion: https://postgr.es/m/20230403190030.fk2frxv6faklrseb@awork3.anarazel.de  

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

psql: add an optional execution-count limit to \watch.

commit   : 00beecfe839c878abb366b68272426ed5296bc2b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 13:18:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 6 Apr 2023 13:18:14 -0400    

Click here for diff

\watch can now be told to stop after N executions of the query.  
  
With the idea that we might want to add more options to \watch  
in future, this patch generalizes the command's syntax to a list  
of name=value options, with the interval allowed to omit the name  
for backwards compatibility.  
  
Andrey Borodin, reviewed by Kyotaro Horiguchi, Nathan Bossart,  
Michael Paquier, Yugo Nagata, and myself  
  
Discussion: https://postgr.es/m/CAAhFRxiZ2-n_L1ErMm9AZjgmUK=qS6VHb+0SaMn8sqqbhF7How@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/t/001_basic.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Support long distance matching for zstd compression

commit   : 2820adf7755d2a377546d5b55f5b1a4a39889336    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 6 Apr 2023 17:18:38 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 6 Apr 2023 17:18:38 +0200    

Click here for diff

zstd compression supports a special mode for finding matched in distant  
past, which may result in better compression ratio, at the expense of  
using more memory (the window size is 128MB).  
  
To enable this optional mode, use the "long" keyword when specifying the  
compression method (--compress=zstd:long).  
  
Author: Justin Pryzby  
Reviewed-by: Tomas Vondra, Jacob Champion  
Discussion: https://postgr.es/m/20230224191840.GD1653@telsasoft.com  
Discussion: https://postgr.es/m/20220327205020.GM28503@telsasoft.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/backup/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/common/compression.c
M src/include/common/compression.h

postgres_fdw: Add support for parallel abort.

commit   : 983ec23007bd83a649af9bc823f13feb0da27e0e    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 6 Apr 2023 17:30:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 6 Apr 2023 17:30:00 +0900    

Click here for diff

postgres_fdw aborts remote (sub)transactions opened on remote server(s)  
in a local (sub)transaction one by one when the local (sub)transaction  
aborts.  This patch allows it to abort the remote (sub)transactions in  
parallel to improve performance.  This is enabled by the server option  
"parallel_abort".  The default is false.  
  
Etsuro Fujita, reviewed by David Zhang.  
  
Discussion: http://postgr.es/m/CAPmGK15FuPVGx3TGHKShsbPKKtF1y58-ZLcKoxfN-nqLj1dZ%3Dg%40mail.gmail.com  

M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/postgres-fdw.sgml

Move various prechecks from vacuum() into ExecVacuum()

commit   : b9b125b9c14381c4d04a446e335bb2da5f602596    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Apr 2023 15:44:52 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Apr 2023 15:44:52 +1200    

Click here for diff

vacuum() is used for both the VACUUM command and for autovacuum. There  
were many prechecks being done inside vacuum() that were just not relevant  
to autovacuum.  Let's move the bulk of these into ExecVacuum() so that  
they're only executed when running the VACUUM command.  This removes a  
small amount of overhead when autovacuum vacuums a table.  
  
While we are at it, allocate VACUUM's BufferAccessStrategy in ExecVacuum()  
and pass it into vacuum() instead of expecting vacuum() to make it if it's  
not already made by the calling function.  To make this work, we need to  
create the vacuum memory context slightly earlier, so we now need to pass  
that down to vacuum() so that it's available for use in other memory  
allocations.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/20230405211534.4skgskbilnxqrmxg@awork3.anarazel.de  

M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/commands/vacuum.h

Convert many uses of ReadBuffer[Extended](P_NEW) to ExtendBufferedRel()

commit   : acab1b0914e426d28789731f50f5964dd4d2f054    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 18:57:29 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 18:57:29 -0700    

Click here for diff

A few places are not converted. Some because they are tackled in later  
commits (e.g. hio.c, xlogutils.c), some because they are more  
complicated (e.g. brin_pageops.c).  Having a few users of ReadBuffer(P_NEW) is  
good anyway, to ensure the backward compat path stays working.  
  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M contrib/bloom/blutils.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistutil.c
M src/backend/access/hash/hashpage.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/commands/sequence.c

Use ExtendBufferedRelTo() in {vm,fsm}_extend()

commit   : fcdda1e4b50249c344e510ea93d4bd74d2743430    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 17:29:57 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 17:29:57 -0700    

Click here for diff

This uses ExtendBufferedRelTo(), introduced in 31966b151e6, to extend the  
visibilitymap and freespacemap to the size needed.  
  
It also happens to fix a warning introduced in 3d6a98457d8, reported by Tom  
Lane.  
  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  
Discussion: https://postgr.es/m/2194723.1680736788@sss.pgh.pa.us  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c

Always make a BufferAccessStrategy for ANALYZE

commit   : bccd6908ca82c6cba0c76b669bc81fc9f3fb60cd    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Apr 2023 12:37:03 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 6 Apr 2023 12:37:03 +1200    

Click here for diff

32fbe0239 changed things so we didn't bother allocating the  
BufferAccessStrategy during VACUUM (ONLY_DATABASE_STATS); and VACUUM  
(FULL), however, it forgot to consider that VACUUM (FULL, ANALYZE) is a  
possible combination.  That change would have resulted in such a command  
allowing ANALYZE to make full use of shared buffers, which wasn't  
intended, so fix that.  
  
Reported-by: Melanie Plageman  
Discussion: https://postgr.es/m/CAAKRu_bJRKe+v_=OqwC+5sA3j5qv8rqdAwy3+yHaO3wmtfrCRg@mail.gmail.com  

M src/backend/commands/vacuum.c

Fix row tracking in pg_stat_statements with extended query protocol

commit   : 1d477a907e63941b58508136f92ac0b5058b68ab    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 6 Apr 2023 09:29:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 6 Apr 2023 09:29:03 +0900    

Click here for diff

pg_stat_statements relies on EState->es_processed to count the number of  
rows processed by ExecutorRun().  This proves to be a problem under the  
extended query protocol when the result of a query is fetched through  
more than one call of ExecutorRun(), as es_processed is reset each time  
ExecutorRun() is called.  This causes pg_stat_statements to report the  
number of rows calculated in the last execute fetch, rather than the  
global sum of all the rows processed.  
  
As pquery.c tells, this is a problem when a portal does not use  
holdStore.  For example, DMLs with RETURNING would report a correct  
tuple count as these do one execution cycle when the query is first  
executed to fill in the portal's store with one ExecutorRun(), feeding  
on the portal's store for each follow-up execute fetch depending on the  
fetch size requested by the client.  
  
The fix proposed for this issue is simple with the addition of an extra  
counter in EState that's preserved across multiple ExecutorRun() calls,  
incremented with the value calculated in es_processed.  This approach is  
not back-patchable, unfortunately.  
  
Note that libpq does not currently give any way to control the fetch  
size when using the extended v3 protocol, meaning that in-core testing  
is not possible yet.  This issue can be easily verified with the JDBC  
driver, though, with *autocommit disabled*.  Hence, having in-core tests  
requires more features, left for future discussion:  
- At least two new libpq routines splitting PQsendQueryGuts(), one for  
the bind/describe and a second for a series of execute fetches with a  
custom fetch size, likely in a fashion similar to what JDBC does.  
- A psql meta-command for the execute phase.  This part is not strictly  
mandatory, still it could be handy.  
  
Reported-by: Andrew Dunstan (original discovery by Simon Siggs)  
Author: Sami Imseih  
Reviewed-by: Tom Lane, Michael Paquier  
Discussion: https://postgr.es/m/EBE6C507-9EB6-4142-9E4D-38B1673363A7@amazon.com  
Discussion: https://postgr.es/m/c90890e7-9c89-c34f-d3c5-d5c763a34bd8@dunslane.net  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/executor/execMain.c
M src/backend/executor/execUtils.c
M src/include/nodes/execnodes.h

bufmgr: Introduce infrastructure for faster relation extension

commit   : 31966b151e6ab7a6284deab6e8fe5faddaf2ae4c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 16:21:09 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 16:21:09 -0700    

Click here for diff

The primary bottlenecks for relation extension are:  
  
1) The extension lock is held while acquiring a victim buffer for the new  
   page. Acquiring a victim buffer can require writing out the old page  
   contents including possibly needing to flush WAL.  
  
2) When extending via ReadBuffer() et al, we write a zero page during the  
   extension, and then later write out the actual page contents. This can  
   nearly double the write rate.  
  
3) The existing bulk relation extension infrastructure in hio.c just amortized  
   the cost of acquiring the relation extension lock, but none of the other  
   costs.  
  
Unfortunately 1) cannot currently be addressed in a central manner as the  
callers to ReadBuffer() need to acquire the extension lock. To address that,  
this this commit moves the responsibility for acquiring the extension lock  
into bufmgr.c functions. That allows to acquire the relation extension lock  
for just the required time. This will also allow us to improve relation  
extension further, without changing callers.  
  
The reason we write all-zeroes pages during relation extension is that we hope  
to get ENOSPC errors earlier that way (largely works, except for CoW  
filesystems). It is easier to handle out-of-space errors gracefully if the  
page doesn't yet contain actual tuples. This commit addresses 2), by using the  
recently introduced smgrzeroextend(), which extends the relation, without  
dirtying the kernel page cache for all the extended pages.  
  
To address 3), this commit introduces a function to extend a relation by  
multiple blocks at a time.  
  
There are three new exposed functions: ExtendBufferedRel() for extending the  
relation by a single block, ExtendBufferedRelBy() to extend a relation by  
multiple blocks at once, and ExtendBufferedRelTo() for extending a relation up  
to a certain size.  
  
To avoid duplicating code between ReadBuffer(P_NEW) and the new functions,  
ReadBuffer(P_NEW) now implements relation extension with  
ExtendBufferedRel(), using a flag to tell ExtendBufferedRel() that the  
relation lock is already held.  
  
Note that this commit does not yet lead to a meaningful performance or  
scalability improvement - for that uses of ReadBuffer(P_NEW) will need to be  
converted to ExtendBuffered*(), which will be done in subsequent commits.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/probes.d
M src/include/pgstat.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list

Allow to use system CA pool for certificate verification

commit   : 8eda7314652703a2ae30d6c4a69c378f6813a7f2    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 5 Apr 2023 23:22:17 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 5 Apr 2023 23:22:17 +0200    

Click here for diff

This adds a new option to libpq's sslrootcert, "system", which will load  
the system trusted CA roots for certificate verification. This is a more  
convenient way to achieve this than pointing to the system CA roots  
manually since the location can differ by installation and be locally  
adjusted by env vars in OpenSSL.  
  
When sslrootcert is set to system, sslmode is forced to be verify-full  
as weaker modes aren't providing much security for public CAs.  
  
Changing the location of the system roots by setting environment vars is  
not supported by LibreSSL so the tests will use a heuristic to determine  
if the system being tested is LibreSSL or OpenSSL.  
  
The workaround in .cirrus.yml is required to handle a strange interaction  
between homebrew and the openssl@3 formula; hopefully this can be removed  
in the near future.  
  
The original patch was written by Thomas Habets, which was later revived  
by Jacob Champion.  
  
Author: Jacob Champion <jchampion@timescale.com>  
Author: Thomas Habets <thomas@habets.se>  
Reviewed-by: Jelte Fennema <postgres@jeltef.nl>  
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>  
Reviewed-by: Magnus Hagander <magnus@hagander.net>  
Discussion: https://www.postgresql.org/message-id/flat/CA%2BkHd%2BcJwCUxVb-Gj_0ptr3_KZPwi3%2B67vK6HnLFBK9MzuYrLA%40mail.gmail.com  

M .cirrus.yml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/t/001_uri.pl
A src/test/ssl/ssl/server-cn-only+server_ca.crt
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl

bufmgr: Support multiple in-progress IOs by using resowner

commit   : 12f3867f5534754c8bac5af35228d4079edc3a00    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 13:55:15 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 13:55:15 -0700    

Click here for diff

A future patch will add support for extending relations by multiple blocks at  
once. To be concurrency safe, the buffers for those blocks need to be marked  
as BM_IO_IN_PROGRESS. Until now we only had infrastructure for recovering from  
an IO error for a single buffer. This commit extends that infrastructure to  
multiple buffers by using the resource owner infrastructure.  
  
This commit increases the size of the ResourceOwnerData struct, which appears  
to have a just about measurable overhead in very extreme workloads. Medium  
term we are planning to substantially shrink the size of  
ResourceOwnerData. Short term the increase is small enough to not worry about  
it for now.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  
Discussion: https://postgr.es/m/20221029200025.w7bvlgvamjfo6z44@awork3.anarazel.de  

M src/backend/access/transam/xact.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/walwriter.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/resowner/resowner.c
M src/include/storage/bufmgr.h
M src/include/utils/resowner_private.h

Support "Right Anti Join" plan shapes.

commit   : 16dc2703c5413534d4989e08253e8f4fcb0e2aab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 16:59:00 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 16:59:00 -0400    

Click here for diff

Merge and hash joins can support antijoin with the non-nullable input  
on the right, using very simple combinations of their existing logic  
for right join and anti join.  This gives the planner more freedom  
about how to order the join.  It's particularly useful for hash join,  
since we may now have the option to hash the smaller table instead  
of the larger.  
  
Richard Guo, reviewed by Ronan Dunklau and myself  
  
Discussion: https://postgr.es/m/CAMbWs48xh9hMzXzSy3VaPzGAz+fkxXXTUbCLohX1_L8THFRm2Q@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMergejoin.c
M src/backend/optimizer/path/costsize.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/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/test/regress/expected/partition_join.out

bufmgr: Acquire and clean victim buffer separately

commit   : dad50f677c42de207168a3f08982ba23c9fc6720    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 13:47:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 13:47:46 -0700    

Click here for diff

Previously we held buffer locks for two buffer mapping partitions at the same  
time to change the identity of buffers.  Particularly for extending relations  
needing to hold the extension lock while acquiring a victim buffer is  
painful.But it also creates a bottleneck for workloads that just involve  
reads.  
  
Now we instead first acquire a victim buffer and write it out, if  
necessary. Then we remove that buffer from the old partition with just the old  
partition's partition lock held and insert it into the new partition with just  
that partition's lock held.  
  
By separating out the victim buffer acquisition, future commits will be able  
to change relation extensions to scale better.  
  
On my workstation, a micro-benchmark exercising buffered reads strenuously and  
under a lot of concurrency, sees a >2x improvement.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

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

Acquire locks on views in AcquirePlannerLocks, too.

commit   : 65eb2d00c6c1bab29db9fa6575185a40d823fe9d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 15:56:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 15:56:07 -0400    

Click here for diff

Commit 47bb9db75 taught AcquireExecutorLocks to re-acquire locks  
on views using data from their RTE_SUBQUERY replacements, but  
it now seems like we should make AcquirePlannerLocks do the same.  
In this way, if a view has been redefined, we will notice that  
a bit earlier while checking validity of a cached plan and thereby  
avoid some wasted work.  
  
Report and patch by Amit Langote.  
  
Discussion: https://postgr.es/m/CA+HiwqH0xZOQ+GQAdKeckY1R4NOeHdzhtfxkAMJLSchpapNk5w@mail.gmail.com  

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

pg_dump: Add support for zstd compression

commit   : 84adc8e20f54e93a003cd316fa1eb9b03e393288    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 5 Apr 2023 21:38:04 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 5 Apr 2023 21:38:04 +0200    

Click here for diff

Allow pg_dump to use the zstd compression, in addition to gzip/lz4. Bulk  
of the new compression method is implemented in compress_zstd.{c,h},  
covering the pg_dump compression APIs. The rest of the patch adds test  
and makes various places aware of the new compression method.  
  
The zstd library (which this patch relies on) supports multithreaded  
compression since version 1.5. We however disallow that feature for now,  
as it might interfere with parallel backups on platforms that rely on  
threads (e.g. Windows). This can be improved / relaxed in the future.  
  
This also fixes a minor issue in InitDiscoverCompressFileHandle(), which  
was not updated to check if the file already has the .lz4 extension.  
  
Adding zstd compression was originally proposed in 2020 (see the second  
thread), but then was reworked to use the new compression API introduced  
in e9960732a9. I've considered both threads when compiling the list of  
reviewers.  
  
Author: Justin Pryzby  
Reviewed-by: Tomas Vondra, Jacob Champion, Andreas Karlsson  
Discussion: https://postgr.es/m/20230224191840.GD1653@telsasoft.com  
Discussion: https://postgr.es/m/20201221194924.GI30237@telsasoft.com  

M doc/src/sgml/ref/pg_dump.sgml
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/compress_io.c
A src/bin/pg_dump/compress_zstd.c
A src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/tools/pginclude/cpluspluscheck
M src/tools/pgindent/typedefs.list

bufmgr: Add Pin/UnpinLocalBuffer()

commit   : 794f25944790ed0462cde3d6dc0f1ad02fcd6bba    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    

Click here for diff

So far these were open-coded in quite a few places, without a good reason.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

bufmgr: Add some more error checking [infrastructure] around pinning

commit   : 819b69a81d307e2ad8e9752cf062ebb57813960d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:42:17 -0700    

Click here for diff

This adds a few more assertions against a buffer being local in places we  
don't expect, and extracts the check for a buffer being pinned exactly once  
from LockBufferForCleanup() into its own function. Later commits will use this  
function.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: http://postgr.es/m/419312fd-9255-078c-c3e3-f0525f911d7f@iki.fi  

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

Add smgrzeroextend(), FileZero(), FileFallocate()

commit   : 4d330a61bb1969df31f2cebfe1ba9d1d004346d8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:06:39 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 10:06:39 -0700    

Click here for diff

smgrzeroextend() uses FileFallocate() to efficiently extend files by multiple  
blocks. When extending by a small number of blocks, use FileZero() instead, as  
using posix_fallocate() for small numbers of blocks is inefficient for some  
file systems / operating systems. FileZero() is also used as the fallback for  
FileFallocate() on platforms / filesystems that don't support fallocate.  
  
A big advantage of using posix_fallocate() is that it typically won't cause  
dirty buffers in the kernel pagecache. So far the most common pattern in our  
code is that we smgrextend() a page full of zeroes and put the corresponding  
page into shared buffers, from where we later write out the actual contents of  
the page. If the kernel, e.g. due to memory pressure or elapsed time, already  
wrote back the all-zeroes page, this can lead to doubling the amount of writes  
reaching storage.  
  
There are no users of smgrzeroextend() as of this commit. That will follow in  
future commits.  
  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: David Rowley <dgrowleyml@gmail.com>  
Reviewed-by: John Naylor <john.naylor@enterprisedb.com>  
Discussion: https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de  

M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/include/storage/fd.h
M src/include/storage/md.h
M src/include/storage/smgr.h

Fix another issue with ENABLE/DISABLE TRIGGER on partitioned tables.

commit   : 4766eef3174b0b1bd8d2428381a7a33813386a6a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 12:56:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 5 Apr 2023 12:56:29 -0400    

Click here for diff

In v13 and v14, the ENABLE/DISABLE TRIGGER USER variant malfunctioned  
on cloned triggers, failing to find the clones because it thought they  
were system triggers.  Other variants of ENABLE/DISABLE TRIGGER would  
improperly apply a superuserness check.  Fix by adjusting the is-it-  
a-system-trigger check to match reality in those branches.  (As far  
as I can find, this is the only place that got it wrong.)  
  
There's no such bug in v15/HEAD, because we revised the catalog  
representation of system triggers to be what this code was expecting.  
However, add the test case to these branches anyway, because this area  
is visibly pretty fragile.  Also remove an obsoleted comment.  
  
The recent v15/HEAD commit 6949b921d fixed a nearby bug.  I now see  
that my commit message for that was inaccurate: the behavior of  
recursing to clone triggers is older than v15, but it didn't apply  
to the case in v13/v14 because in those branches parent partitioned  
tables have no pg_trigger entries for foreign-key triggers.  But add  
the test case from that commit to v13/v14, just to show what is  
happening there.  
  
Per bug #17886 from DzmitryH.  
  
Discussion: https://postgr.es/m/17886-5406d5d828aa4aa3@postgresql.org  

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

Don't initialize page in {vm,fsm}_extend(), not needed

commit   : 3d6a98457d8e21d85bed86cfd3e1d1df1b260721    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 08:19:39 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 5 Apr 2023 08:19:39 -0700    

Click here for diff

The read path needs to be able to initialize pages anyway, as relation  
extensions are not durable. By avoiding initializing pages, we can, in a  
future patch, extend the relation by multiple blocks at once.  
  
Using smgrextend() for {vm,fsm}_extend() is not a good idea in general, as at  
least one page of the VM/FSM will be read immediately after, always causing a  
cache miss, requiring us to read content we just wrote.  
  
Discussion: https://postgr.es/m/20230301223515.pucbj7nb54n4i4nv@awork3.anarazel.de  

M src/backend/access/heap/visibilitymap.c
M src/backend/storage/freespace/freespace.c

Fix wrong word in comment.

commit   : 86a3fc7ec8a03bca7120894bababa7c734628b4c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 5 Apr 2023 09:50:08 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 5 Apr 2023 09:50:08 -0400    

Click here for diff

Reported by Peter Smith.  
  
Discussion: http://postgr.es/m/CAHut+Pt52ueOEAO-G5qeZiiPv1p9pBT_W5Vj3BTYfC8sD8LFxw@mail.gmail.com  

M src/backend/utils/init/usercontext.c

Update information_schema for SQL:2023

commit   : f275af8cb88e5a87b01467ad90704c945806d7dd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 09:47:07 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 09:47:07 +0200    

Click here for diff

This is mainly a light renumbering to match the sections in the  
standard.  
  
The comments for SQL_IMPLEMENTATION_INFO and SQL_SIZING are no longer  
applicable because the required information has been moved into part  
9.  

M src/backend/catalog/information_schema.sql

doc: Update error messages in RLS examples

commit   : 542b6347bf8876d89146097672c2c0128ad7c151    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 5 Apr 2023 14:16:19 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 5 Apr 2023 14:16:19 +0700    

Click here for diff

Since 8b9e9644d, the messages for failed permissions checks report  
"table" where appropriate, rather than "relation".  
  
Backpatch to all supported branches  

M doc/src/sgml/ddl.sgml

doc: Update SQL features/conformance information to SQL:2023

commit   : c9f57541d9705da44b9fbcb6e0c75dec3b41b57c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 08:55:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 08:55:44 +0200    

Click here for diff

Optional subfeatures have been changed to top-level features, so there  
is a bit of a churn in the list for that.  
  
Some existing functions have been added to the standard, so they are  
moved from the "other" to the "standard" lists in their sections.  
  
Discussion: https://www.postgresql.org/message-id/flat/63f285d9-4ec8-0c9e-4bf5-e76334ddc0af@enterprisedb.com  

M doc/src/sgml/datatype.sgml
M doc/src/sgml/features.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/information_schema.sql
M src/backend/catalog/sql_features.txt
M src/include/catalog/catversion.h

Fix function reference in comment

commit   : fb6fad6ef1bb94b5bfde01a83951ad7eda7764bc    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 5 Apr 2023 09:06:32 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 5 Apr 2023 09:06:32 +0200    

Click here for diff

Commit a61b1f748 renamed ExecCheckRTEPerms to ExecCheckPermissions  
as part of a larger body of work, but missed this comment.  Fix by  
updating the referenced function name to make the comment the same  
as other occurrences.  
  
Author: Koshi Shibagaki <shibagaki.koshi@fujitsu.com>  
Discussion: https://postgr.es/m/OS3PR01MB653359ACBE8DBBE29EE2BC71FA909@OS3PR01MB6533.jpnprd01.prod.outlook.com  

M contrib/postgres_fdw/postgres_fdw.c

doc: Update SQL keywords list to SQL:2023

commit   : 1993f3feb74f30e71c4139ace66ccc1e0225b4a8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 07:55:28 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 07:55:28 +0200    

Click here for diff

Per previous convention (see  
ace397e9d24eddc56e7dffa921f506117b602d78), drop SQL:2011 and only keep  
the latest two standards and SQL-92.  
  
Discussion: https://www.postgresql.org/message-id/flat/63f285d9-4ec8-0c9e-4bf5-e76334ddc0af@enterprisedb.com  

M doc/src/sgml/generate-keywords-table.pl
R088 doc/src/sgml/keywords/sql2011-02-nonreserved.txt doc/src/sgml/keywords/sql2023-02-nonreserved.txt
R086 doc/src/sgml/keywords/sql2011-02-reserved.txt doc/src/sgml/keywords/sql2023-02-reserved.txt
R100 doc/src/sgml/keywords/sql2011-09-nonreserved.txt doc/src/sgml/keywords/sql2023-09-nonreserved.txt
R100 doc/src/sgml/keywords/sql2011-09-reserved.txt doc/src/sgml/keywords/sql2023-09-reserved.txt
R086 doc/src/sgml/keywords/sql2011-14-nonreserved.txt doc/src/sgml/keywords/sql2023-14-nonreserved.txt
R100 doc/src/sgml/keywords/sql2011-14-reserved.txt doc/src/sgml/keywords/sql2023-14-reserved.txt

Fix minor signed/unsigned mixup

commit   : c209d317e9b818e25b30703c60113875acb73008    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 07:34:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 5 Apr 2023 07:34:52 +0200    

Click here for diff

The chunk header is unsigned, and the output format takes unsigned, so  
casting it to signed in between is incorrect.  

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

meson: docs: Allow configuring simple/website style

commit   : 9d2a464a04846961ffa6b5f2c25b68bc2bf0af67    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:31:27 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:31:27 -0700    

Click here for diff

The meson docs generation hardcoded using the website style so far. Make it  
configurable via a meson option.  
  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com  

M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
M meson_options.txt

docs: html: load stylesheet via custom.css.source

commit   : b8059bdf1ef8f7e215ec5010fcf6c3bd9c491eef    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:10:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:10:46 -0700    

Click here for diff

Until now the meson built docs did not have a working reference to the css  
stylesheet, it was copied in the make target. Instead of duplicating that for  
meson, use the docbook-xsl parameter custom.css.source to reference it. An  
additional benefit of that approach is that the stylesheet is now included in  
the single-file HTML documentation.  
  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com  

M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
M doc/src/sgml/stylesheet-html-common.xsl
M doc/src/sgml/stylesheet-html-nochunk.xsl
A doc/src/sgml/stylesheet.css.xml
M doc/src/sgml/stylesheet.xsl

docs: html: copy images to output as part of xslt build

commit   : 0012979d989fd1640ed17c32b303ebbd2294a3fc    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:05:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:05:52 -0700    

Click here for diff

Until now the meson built HTML docs had non-working references to images. They  
were copied in the make target. Instead of duplicating that for meson, copy  
them as part of the xslt stylesheet.  
  
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com  

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

meson: add docs, docs_pdf options

commit   : ef07d351a1860a6e93c89cc7af3ae13366942bf0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:29:39 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 21:29:39 -0700    

Click here for diff

Detect and report if the tools necessary to build documentation are available  
during configure. This is represented as two new options 'docs' and  
'docs_pdf', both defaulting to 'auto'.  
  
This should also fix a meson error about the installdocs target, when none of  
the doc tools are found.  
  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20230325201414.sh7c6xlut2fpunnv@awork3.anarazel.de  
Discussion: https://postgr.es/m/ZB8331v5IhUA/pNu@telsasoft.com  

M doc/src/sgml/installation.sgml
M doc/src/sgml/meson.build
M meson.build
M meson_options.txt

meson: docs: Preparatory cleanups

commit   : 0ba827ecfc677cb449b3a370cf6613b4a770c4f8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 20:50:43 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 20:50:43 -0700    

Click here for diff

These are just minor prerequisite changes for later commits. Kept separate for  
easier review.  
  
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com  
Discussion: https://postgr.es/m/20230329224132.fnymznyxmta5ugrs@awork3.anarazel.de  

M doc/src/sgml/meson.build

commit   : 8df0d3d5303fa62d169985b8e68dbd40316010f1    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 5 Apr 2023 09:20:14 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 5 Apr 2023 09:20:14 +0530    

Click here for diff

Author: Kuroda Hayato  
Discussion: https://postgr.es/m/TYCPR01MB587073D91E372B8EF719931EF5929@TYCPR01MB5870.jpnprd01.prod.outlook.com  

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

docs: Remove support for 'htmlhelp' format

commit   : d75c7fbaf94eab30c1f30db107237b64c3cf78e7    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 19:25:14 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 19:25:14 -0700    

Click here for diff

We had partial support for generating documentation suitable for .chm  
files. However, we only had wired up generating the input files using  
docbook-xsl, not generating an actual .chm file. Nor did we document how to do  
so.  Additionally, it was very slow to generate htmlhelp, as we never applied  
the docbook-xsl stylesheet performance improvements to htmlhelp.  
  
It doesn't look like there's any interest in the htmlhelp output, so remove  
it, instead of spending cycles to finish the support.  
  
Discussion: https://postgr.es/m/20230324165822.wcrj3akllbqquy7u@awork3.anarazel.de  

M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
D doc/src/sgml/stylesheet-hh.xsl

sequences: Lock buffer before initializing page

commit   : 3f695b31179b94a5eaa284ff588a983ff2dce932    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 16:38:06 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 4 Apr 2023 16:38:06 -0700    

Click here for diff

fill_seq_fork_with_data(), used to initialize a new sequence relation, only  
locked the buffer after calling PageInit(), even though PageInit() modifies  
page contents.  
  
This is unlikely to cause real-world issues, as the relation is exclusively  
locked at that point, and the buffer not yet marked dirty, so other processes  
should not access the buffer.  
  
This issue looks to have been present since the introduction of sequences in  
e8647c45d66a.  
  
Given the low risk, it does not seem worth backpatching the fix.  
  
Discussion: https://postgr.es/m/20230404185501.wdkmo3k7bedlx6qk@awork3.anarazel.de  

M src/backend/commands/sequence.c

doc: Add more details about pg_stat_get_xact_blocks_{fetched,hit}

commit   : e126d817c7af989c47366b0e344ee83d761f334a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 5 Apr 2023 07:59:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 5 Apr 2023 07:59:43 +0900    

Click here for diff

The explanation describing the dependency to system read() calls for  
these two functions has been removed in ddfc2d9.  And after more  
discussion about d69c404, we have concluded that adding more details  
makes them easier to understand.  
  
While on it, use the term "block read requests" (maybe found in cache)  
rather than "buffers fetched" and "buffer hits".  
  
Per discussion with Melanie Plageman, Kyotaro Horiguchi, Bertrand  
Drouvot and myself.  
  
Discussion: https://postgr.es/m/CAAKRu_ZmdiScT4q83OAbfmR5AH-L5zWya3SXjaxiJvhCob-e2A@mail.gmail.com  
Backpatch-through: 11  

M doc/src/sgml/monitoring.sgml

Fix MSVC warning introduced in ea1db8ae70.

commit   : 36320cbc164a8bc069f7a2d3990f47f5629f2020    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 4 Apr 2023 15:14:21 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 4 Apr 2023 15:14:21 -0700    

Click here for diff

Discussion: https://postgr.es/m/CA+hUKGJR1BhCORa5WdvwxztD3arhENcwaN1zEQ1Upg20BwjKWA@mail.gmail.com  
Reported-by: Thomas Munro  

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

Remove comment obsoleted by 11c2d6fd.

commit   : f303ec6210c4b858fd68531c92b8f0d490c91db5    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 5 Apr 2023 09:40:34 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 5 Apr 2023 09:40:34 +1200    

Click here for diff

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1604497.1680637072%40sss.pgh.pa.us  

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

Canonicalize ICU locale names to language tags.

commit   : ea1db8ae70e5f4ceaae34dc9c06a07d59aaa022e    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 4 Apr 2023 10:28:08 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 4 Apr 2023 10:28:08 -0700    

Click here for diff

Convert to BCP47 language tags before storing in the catalog, except  
during binary upgrade or when the locale comes from an existing  
collation or template database.  
  
The resulting language tags can vary slightly between ICU  
versions. For instance, "@colBackwards=yes" is converted to  
"und-u-kb-true" in older versions of ICU, and to the simpler (but  
equivalent) "und-u-kb" in newer versions.  
  
The process of canonicalizing to a language tag also understands more  
input locale string formats than ucol_open(). For instance,  
"fr_CA.UTF-8" is misinterpreted by ucol_open() and the region is  
ignored; effectively treating it the same as the locale "fr" and  
opening the wrong collator. Canonicalization properly interprets the  
language and region, resulting in the language tag "fr-CA", which can  
then be understood by ucol_open().  
  
This commit fixes a problem in prior versions due to ucol_open()  
misinterpreting locale strings as described above. For instance,  
creating an ICU collation with locale "fr_CA.UTF-8" would store that  
string directly in the catalog, which would later be passed to (and  
misinterpreted by) ucol_open(). After this commit, the locale string  
will be canonicalized to language tag "fr-CA" in the catalog, which  
will be properly understood by ucol_open(). Because this fix affects  
the resulting collator, we cannot change the locale string stored in  
the catalog for existing databases or collations; otherwise we'd risk  
corrupting indexes. Therefore, only canonicalize locales for  
newly-created (not upgraded) collations/databases. For similar  
reasons, do not backport.  
  
Discussion: https://postgr.es/m/8c7af6820aed94dc7bc259d2aa7f9663518e6137.camel@j-davis.com  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/charset.sgml
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

Add a way to get the current function's OID in pl/pgsql.

commit   : d3d53f955cf6ad755ba3682577e0f6fa10106438    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 4 Apr 2023 13:33:18 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 4 Apr 2023 13:33:18 -0400    

Click here for diff

Invent "GET DIAGNOSTICS oid_variable = PG_ROUTINE_OID".  
This is useful for avoiding the maintenance nuisances that come  
with embedding a function's name in its body, as one might do  
for logging purposes for example.  Typically users would cast the  
result to regproc or regprocedure to get something human-readable,  
but we won't pre-judge whether that's appropriate.  
  
Pavel Stehule, reviewed by Kirk Wolak and myself  
  
Discussion: https://postgr.es/m/CAFj8pRA4zMd5pY-B89Gm64bDLRt-L+akOd34aD1j4PEstHHSVQ@mail.gmail.com  

M doc/src/sgml/plpgsql.sgml
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Add a run_as_owner option to subscriptions.

commit   : 482675987bcdffb390ae735cfd5f34b485ae97c6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 4 Apr 2023 12:03:03 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 4 Apr 2023 12:03:03 -0400    

Click here for diff

This option is normally false, but can be set to true to obtain  
the legacy behavior where the subscription runs with the permissions  
of the subscription owner rather than the permissions of the  
table owner. The advantages of this mode are (1) it doesn't require  
that the subscription owner have permission to SET ROLE to each  
table owner and (2) since no role switching occurs, the  
SECURITY_RESTRICTED_OPERATION restrictions do not apply.  
  
On the downside, it allows any table owner to easily usurp  
the privileges of the subscription owner - basically, to take  
over their account. Because that's generally quite undesirable,  
we don't make this mode the default, but we do make it available,  
just in case the new behavior causes too many problems for someone.  
  
Discussion: http://postgr.es/m/CA+TgmoZ-WEeG6Z14AfH7KhmpX2eFh+tZ0z+vf0=eMDdbda269g@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/bin/psql/describe.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/subscription.out
A src/test/subscription/t/033_run_as_table_owner.pl

Perform logical replication actions as the table owner.

commit   : 1e10d49b65d6c26c61fee07999e4cd59eab2b765    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 4 Apr 2023 11:25:23 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 4 Apr 2023 11:25:23 -0400    

Click here for diff

Up until now, logical replication actions have been performed as the  
subscription owner, who will generally be a superuser.  Commit  
cec57b1a0fbcd3833086ba686897c5883e0a2afc documented hazards  
associated with that situation, namely, that any user who owns a  
table on the subscriber side could assume the privileges of the  
subscription owner by attaching a trigger, expression index, or  
some other kind of executable code to it. As a remedy, it suggested  
not creating configurations where users who are not fully trusted  
own tables on the subscriber.  
  
Although that will work, it basically precludes using logical  
replication in the way that people typically want to use it,  
namely, to replicate a database from one node to another  
without necessarily having any restrictions on which database  
users can own tables. So, instead, change logical replication to  
execute INSERT, UPDATE, DELETE, and TRUNCATE operations as the  
table owner when they are replicated.  
  
Since this involves switching the active user frequently within  
a session that is authenticated as the subscription user, also  
impose SECURITY_RESTRICTED_OPERATION restrictions on logical  
replication code. As an exception, if the table owner can SET  
ROLE to the subscription owner, these restrictions have no  
security value, so don't impose them in that case.  
  
Subscription owners are now required to have the ability to  
SET ROLE to every role that owns a table that the subscription  
is replicating. If they don't, replication will fail. Superusers,  
who normally own subscriptions, satisfy this property by default.  
Non-superusers users who own subscriptions will need to be  
granted the roles that own relevant tables.  
  
Patch by me, reviewed (but not necessarily in its entirety) by  
Jelte Fennema, Jeff Davis, and Noah Misch.  
  
Discussion: http://postgr.es/m/CA+TgmoaSCkg9ww9oppPqqs+9RVqCexYCE6Aq=UsYPfnOoDeFkw@mail.gmail.com  

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/tablecmds.c
M src/backend/replication/logical/worker.c
M src/backend/utils/init/Makefile
M src/backend/utils/init/meson.build
A src/backend/utils/init/usercontext.c
M src/include/commands/tablecmds.h
A src/include/utils/usercontext.h
M src/test/subscription/t/027_nosuperuser.pl

Add missing XML ID attributes

commit   : 3077324b03e81ab9894f1f510952273b78d98569    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Apr 2023 16:20:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 4 Apr 2023 16:20:34 +0200    

Click here for diff

Author: Brar Piening <brar@gmx.de>  
Discussion: https://www.postgresql.org/message-id/dc813a6f-60d9-991f-eecd-675a0921de11@gmx.de  

M doc/src/sgml/config.sgml
M doc/src/sgml/pgwalinspect.sgml

Code review for recent SQL/JSON commits

commit   : 71bfd1543f8b68e1013d3e8540b6b5aaf98e02e9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 4 Apr 2023 14:04:30 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 4 Apr 2023 14:04:30 +0200    

Click here for diff

- At the last minute and for no particularly good reason, I changed the  
  WITHOUT token to be marked especially for lookahead, from the one in  
  WITHOUT TIME to the one in WITHOUT UNIQUE.  Study of upcoming patches  
  (where a new WITHOUT ARRAY WRAPPER clause is added) showed me that the  
  former was better, so put it back the way the original patch had it.  
  
- update exprTypmod() for JsonConstructorExpr to return the typmod of  
  the RETURNING clause, as a comment there suggested.  Perhaps it's  
  possible for this to make a difference with datetime types, but I  
  didn't try to build a test case.  
  
- The nodeFuncs.c support code for new nodes was calling walker()  
  directly instead of the WALK() macro as introduced by commit 1c27d16e6e5c.  
  Modernize that.  Also add exprLocation() support for a couple of nodes  
  that missed it.  Lastly, reorder the code more sensibly.  
  
The WITHOUT_LA -> WITHOUT change means that stored rules containing  
either WITHOUT TIME ZONE or WITHOUT UNIQUE KEYS would change  
representation.  Therefore, bump catversion.  
  
Discussion: https://postgr.es/m/20230329181708.e64g2tpy7jyufqkr@alvherre.pgsql  

M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parser.c
M src/include/catalog/catversion.h
M src/interfaces/ecpg/preproc/parser.c

bufmgr: Remove buffer-write-dirty tracepoints

commit   : 8a2b1b147728b11f6df569081d121b9e3135109d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Apr 2023 18:02:41 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Apr 2023 18:02:41 -0700    

Click here for diff

The trace point was using the relfileno / fork / block for the to-be-read-in  
buffer. Some upcoming work would make that more expensive to provide. We still  
have buffer-flush-start/done, which can serve most tracing needs that  
buffer-write-dirty could serve.  
  
Discussion: https://postgr.es/m/f5164e7a-eef6-8972-75a3-8ac622ed0c6e@iki.fi  

M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/probes.d

Make SP-GiST redirect cleanup more aggressive.

commit   : 05a304a855104a8eb6394e044bfbc8e761a4d635    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:47:48 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:47:48 -0700    

Click here for diff

Commit 61b313e4 made VACUUM pass down a heaprel to index AM bulkdelete  
and vacuumcleanup routines.  Although this was primarily intended as  
preparation for logical decoding on standbys, it also made it easy to  
correct an old deficiency in how we determine how to cleanup SP-GiST  
redirect and placeholder tuples.  
  
Pass the heaprel to GlobalVisTestFor() during cleanup of redirect and  
placeholder tuples, rather than pessimistically passing NULL.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/02392033-f030-a3c8-c7d0-5c27eb529fec@gmail.com  

M src/backend/access/spgist/spgvacuum.c

Recycle deleted nbtree pages more aggressively.

commit   : e48c817395e1cdc85dbecc4ff3c18e34983ae3f2    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:31:43 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:31:43 -0700    

Click here for diff

Commit 61b313e4 made nbtree consistently pass down a heaprel to low  
level routines like _bt_getbuf().  Although this was primarily intended  
as preparation for logical decoding on standbys, it also made it easy to  
correct an old deficiency in how nbtree VACUUM determines whether or not  
it's now safe to recycle deleted pages.  
  
Pass the heaprel to GlobalVisTestFor() in nbtree routines that deal with  
recycle safety.  nbtree now makes less pessimistic assumptions about  
recycle safety within non-catalog relations.  This enhancement  
complements the recycling enhancement added by commit 9dd963ae25.  
  
nbtree remains just as pessimistic as ever when it comes to recycle  
safety within indexes on catalog relations.  There is no fundamental  
reason why we need to treat catalog relations differently, though.  The  
behavioral inconsistency is a consequence of the way that nbtree uses  
nextXID values to implement what Lanin and Shasha call "the drain  
technique".  Note in particular that it has nothing to do with whether  
or not index tuples might still be required for an older MVCC snapshot.  
  
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzkaiDxCje0yPuH=3Uh2p1V_2pFGY==xfbZoZu7Ax_NB8g@mail.gmail.com  

M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/include/access/nbtree.h

Move heaprel struct field next to index rel field.

commit   : a349b86603e11bad811bec111ec5330b9908e525    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:01:11 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 3 Apr 2023 11:01:11 -0700    

Click here for diff

Commit 61b313e4 added a heaprel struct member to IndexVacuumInfo, but  
placed it last.  Move the heaprel struct member next to the index struct  
member to improve the code's readability.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WznG=TV6S9d3VA=y0vBHbXwnLs9_LLdiML=aNJuHeriwxg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuumparallel.c
M src/include/access/genam.h

Fix possible logical replication crash.

commit   : e7e7da2f8d57bbe6c8fb463a9eec51486000ba2e    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 3 Apr 2023 13:11:00 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 3 Apr 2023 13:11:00 -0400    

Click here for diff

Commit c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6 added a new  
password_required option but forgot that you need database access  
to check whether an arbitrary role ID is a superuser.  
  
Report and patch by Hou Zhijie. I added a comment. Thanks to  
Alexander Lakhin for devising a way to reproduce the crash.  
  
Discussion: http://postgr.es/m/OS0PR01MB5716BFD7EC44284C89F40808948F9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

When using valgrind, log the current query after an error is detected.

commit   : a8a00124f1ddb9c8506ff75317f6dd64cc480e61    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Apr 2023 10:18:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Apr 2023 10:18:38 -0400    

Click here for diff

In USE_VALGRIND builds, add code to print the text of the current query  
to the valgrind log whenever the valgrind error count has increased  
during the query.  Valgrind will already have printed its report,  
if the error is distinct from ones already seen, so that this works  
out fairly well as a way of annotating the log.  
  
Onur Tirtir and Tom Lane  
  
Discussion: https://postgr.es/m/AM9PR83MB0498531E804DC8DF8CFF0E8FE9D09@AM9PR83MB0498.EURPRD83.prod.outlook.com  

M src/backend/tcop/postgres.c

Revert 764da7710b

commit   : b0b91ced167f02ced4adaf1b2ecdc6fa0f6eb6e9    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 3 Apr 2023 16:55:09 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 3 Apr 2023 16:55:09 +0300    

Click here for diff

Discussion: https://postgr.es/m/20230323003003.plgaxjqahjgkuxrk%40awork3.anarazel.de  

M src/backend/executor/nodeModifyTable.c

Revert 11470f544e

commit   : 2b65bf046d8a23be25502638da77a1592da2548d    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 3 Apr 2023 16:54:31 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Mon, 3 Apr 2023 16:54:31 +0300    

Click here for diff

Discussion: https://postgr.es/m/20230323003003.plgaxjqahjgkuxrk%40awork3.anarazel.de  

M src/backend/access/heap/heapam_handler.c
M src/backend/access/table/tableam.c
M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h
M src/include/executor/tuptable.h
M src/tools/pgindent/typedefs.list

Rename BufferAccessStrategyData.ring_size to nbuffers

commit   : 8d928e3a9fe7577e7abf2388b60cc67ed94f6d24    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 23:31:16 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 23:31:16 +1200    

Click here for diff

The new name better reflects what the field is - the size of the buffers[]  
array.  ring_size sounded more like it is in units of bytes.  
  
An upcoming commit allows a BufferAccessStrategy of custom sizes, so it  
seems relevant to improve this beforehand.  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_YefVbhg4rAxU2frYFdTap61UftH-kUNQZBvAs%2BYK81Zg%40mail.gmail.com  

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

Disable vacuum's use of a buffer access strategy during failsafe

commit   : 4830f102432518d06b50f61e0ab4c0c07082617b    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 23:05:58 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 23:05:58 +1200    

Click here for diff

Traditionally, vacuum always makes use of a buffer access strategy 32  
buffers in size.  This means that running vacuums tend not to cause too  
many shared buffers to become dirty, however, this can cause vacuums to  
run much more slowly than they otherwise could as WAL flushes will occur  
more frequently due to having to flush WAL out to the LSN of the dirty  
page before that page can be written to disk.  
  
When we are performing failsafe VACUUMs (as added in 1e55e7d17), we really  
want to make the vacuum work go as quickly as possible, so here we disable  
the buffer access strategy when entering failsafe mode while vacuuming a  
relation.  
  
Per idea and analyis from Andres Freund.  
  
In passing, also include some changes I had intended for 32fbe0239.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby, David Rowley  
Discussion: https://postgr.es/m/20230111182720.ejifsclfwymw2reb%40awork3.anarazel.de  

M doc/src/sgml/config.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c

Fix typo in CI README

commit   : 525fb0a171a60ddea94c1953e24abef1da358888    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 3 Apr 2023 10:50:17 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 3 Apr 2023 10:50:17 +0200    

Click here for diff

s/fron/from/  

M src/tools/ci/README

Only make buffer strategy for vacuum when it's likely needed

commit   : 32fbe0239b03d868744758d5809eaf74f19c924d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 19:19:45 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 19:19:45 +1200    

Click here for diff

VACUUM FULL and VACUUM ONLY_DATABASE_STATS will not use the vacuum  
strategy ring created in vacuum(), so don't waste effort making it in  
those cases.  
  
There are other conceivable cases where the buffer strategy also won't be  
used, but those are probably less common and not worth troubling over too  
much.  For example VACUUM (PROCESS_MAIN false, PROCESS_TOAST false).  
There are other cases too, but many of these are only discovered once  
inside vacuum_rel().  
  
Author: Melanie Plageman  
Reviewed-by: David Rowley  
Discussion: https://postgr.es/m/CAAKRu_ZLRuzkM3zKogiZAz2hUony37yLY4aaLb8fPf8fgqs5Og@mail.gmail.com  

M src/backend/commands/vacuum.c

pg_basebackup: Correct type of WalSegSz

commit   : 1980d3585e3c7fce74b811ca8d77733036cae76c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 3 Apr 2023 07:13:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 3 Apr 2023 07:13:52 +0200    

Click here for diff

The pg_basebackup code had WalSegSz as uint32, whereas the rest of the  
code has it as int.  This seems confusing, and using the extra range  
wouldn't actually work.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/flat/1bf15c7a-0acd-1864-081e-7a28814310fe%40enterprisedb.com  

M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h

Remove some global variables from vacuum.c

commit   : 3f476c953495e4d52a1ac776f976df16964ba592    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 15:07:25 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 3 Apr 2023 15:07:25 +1200    

Click here for diff

Using global variables because we don't want to pass these values around  
as parameters does not really seem like a great idea, so let's remove  
these two global variables and adjust a few functions to accept these  
values as parameters instead.  
  
This is part of a wider patch which intends to allow the size of the  
buffer access strategy that vacuum uses to be adjusted.  
  
Author: Melanie Plageman  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/CAAKRu_b1q_07uquUtAvLqTM%3DW9nzee7QbtzHwA4XdUo7KX_Cnw%40mail.gmail.com  

M src/backend/commands/vacuum.c

Doc: update pgindent/README.

commit   : 2e6ba13152624a837b67996eadfc58e75126071f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Apr 2023 20:01:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 2 Apr 2023 20:01:34 -0400    

Click here for diff

I missed updating this when we pulled pg_bsd_indent into the tree.  

M src/tools/pgindent/README

Add info in WAL records in preparation for logical slot conflict handling

commit   : 6af1793954e8c5e753af83c3edb37ed3267dd179    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 2 Apr 2023 12:32:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 2 Apr 2023 12:32:19 -0700    

Click here for diff

This commit only implements one prerequisite part for allowing logical  
decoding. The commit message contains an explanation of the overall design,  
which later commits will refer back to.  
  
Overall design:  
  
1. We want to enable logical decoding on standbys, but replay of WAL  
from the primary might remove data that is needed by logical decoding,  
causing error(s) on the standby. To prevent those errors, a new replication  
conflict scenario needs to be addressed (as much as hot standby does).  
  
2. Our chosen strategy for dealing with this type of replication slot  
is to invalidate logical slots for which needed data has been removed.  
  
3. To do this we need the latestRemovedXid for each change, just as we  
do for physical replication conflicts, but we also need to know  
whether any particular change was to data that logical replication  
might access. That way, during WAL replay, we know when there is a risk of  
conflict and, if so, if there is a conflict.  
  
4. We can't rely on the standby's relcache entries for this purpose in  
any way, because the startup process can't access catalog contents.  
  
5. Therefore every WAL record that potentially removes data from the  
index or heap must carry a flag indicating whether or not it is one  
that might be accessed during logical decoding.  
  
Why do we need this for logical decoding on standby?  
  
First, let's forget about logical decoding on standby and recall that  
on a primary database, any catalog rows that may be needed by a logical  
decoding replication slot are not removed.  
  
This is done thanks to the catalog_xmin associated with the logical  
replication slot.  
  
But, with logical decoding on standby, in the following cases:  
  
- hot_standby_feedback is off  
- hot_standby_feedback is on but there is no a physical slot between  
  the primary and the standby. Then, hot_standby_feedback will work,  
  but only while the connection is alive (for example a node restart  
  would break it)  
  
Then, the primary may delete system catalog rows that could be needed  
by the logical decoding on the standby (as it does not know about the  
catalog_xmin on the standby).  
  
So, it’s mandatory to identify those rows and invalidate the slots  
that may need them if any. Identifying those rows is the purpose of  
this commit.  
  
Implementation:  
  
When a WAL replay on standby indicates that a catalog table tuple is  
to be deleted by an xid that is greater than a logical slot's  
catalog_xmin, then that means the slot's catalog_xmin conflicts with  
the xid, and we need to handle the conflict. While subsequent commits  
will do the actual conflict handling, this commit adds a new field  
isCatalogRel in such WAL records (and a new bit set in the  
xl_heap_visible flags field), that is true for catalog tables, so as to  
arrange for conflict handling.  
  
The affected WAL records are the ones that already contain the  
snapshotConflictHorizon field, namely:  
  
- gistxlogDelete  
- gistxlogPageReuse  
- xl_hash_vacuum_one_page  
- xl_heap_prune  
- xl_heap_freeze_page  
- xl_heap_visible  
- xl_btree_reuse_page  
- xl_btree_delete  
- spgxlogVacuumRedirect  
  
Due to this new field being added, xl_hash_vacuum_one_page and  
gistxlogDelete do now contain the offsets to be deleted as a  
FLEXIBLE_ARRAY_MEMBER. This is needed to ensure correct alignment.  
It's not needed on the others struct where isCatalogRel has  
been added.  
  
This commit just introduces the WAL format changes mentioned above. Handling  
the actual conflicts will follow in future commits.  
  
Bumps XLOG_PAGE_MAGIC as the several WAL records are changed.  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Author: Andres Freund <andres@anarazel.de> (in an older version)  
Author: Amit Khandekar <amitdkhan.pg@gmail.com>  (in an older version)  
Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  

M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/spgist/spgvacuum.c
M src/include/access/gistxlog.h
M src/include/access/hash_xlog.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtxlog.h
M src/include/access/spgxlog.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xlog_internal.h
M src/include/utils/rel.h

Fix copy-pasto in contrib/auth_delay/meson.build variable name.

commit   : ab73291d263049f00a394b37940ed197616fc3f8    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 2 Apr 2023 09:31:10 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 2 Apr 2023 09:31:10 -0700    

Click here for diff

M contrib/auth_delay/meson.build

Use PG_TEST_TIMEOUT_DEFAULT in 019_replslot_limit.pl.

commit   : eaa1dd131ca0a4c8e221cd60cdfc69aa0f7efe42    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sun, 2 Apr 2023 09:31:09 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sun, 2 Apr 2023 09:31:09 -0700    

Click here for diff

Oversight in f2698ea02ca8a56f38935d2b300ac54936712558, which introduced  
the variable.  This lowers some 1000s timeouts to the configurable  
default of 180s, due to a lack of evidence for needing the longer  
timeout.  The alternative was 6*PG_TEST_TIMEOUT_DEFAULT, which we can  
adopt if the need arises.  Given the lack of observed trouble with these  
timeouts, no back-patch.  

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

Pass down table relation into more index relation functions

commit   : 61b313e47eb987682441c675724c22bf4363c9c4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 20:12:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 20:12:26 -0700    

Click here for diff

This is done in preparation for logical decoding on standby, which needs to  
include whether visibility affecting WAL records are about a (user) catalog  
table. Which is only known for the table, not the indexes.  
  
It's also nice to be able to pass the heap relation to GlobalVisTestFor() in  
vacuumRedirectAndPlaceholder().  
  
Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>  
Discussion: https://postgr.es/m/21b700c3-eecf-2e05-a699-f8c78dd31ec7@gmail.com  

M contrib/amcheck/verify_nbtree.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/catalog/index.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuumparallel.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/genam.h
M src/include/access/gist_private.h
M src/include/access/heapam_xlog.h
M src/include/access/nbtree.h
M src/include/utils/tuplesort.h

Assert only valid flag bits are passed to visibilitymap_set()

commit   : a88a18b1250b9e6b40536e4dec04d32d655b8140    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 17:55:33 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 17:55:33 -0700    

Click here for diff

If visibilitymap_set() is called with flags containing a higher bit than  
VISIBILITYMAP_ALL_FROZEN, the state of neighboring pages is affected. While  
there was an assertion that *some* valid bits were set, it did not check  
that *only* valid bits were. Change that.  
  
Discussion: https://postgr.es/m/20230331043300.gux3s5wzrapqi4oe@awork3.anarazel.de  

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

hio: Release extension lock before initializing page / pinning VM

commit   : 14f98e0af996beff561f66d7436c6da5d2de524d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 17:50:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Apr 2023 17:50:18 -0700    

Click here for diff

PageInit() while holding the extension lock is unnecessary after 0d1fe9f74e3  
started to use RBM_ZERO_AND_LOCK - nobody can look at the new page before we  
release the page lock. PageInit() zeroes the page, which isn't that cheap, so  
deferring it until after the extension lock is released seems like a good idea.  
  
Doing visibilitymap_pin() while holding the extension lock, introduced in  
7db0cd2145f2, looks like an accident. Due to the restrictions on  
HEAP_INSERT_FROZEN it's unlikely to be a performance issue, but it still seems  
better to move it out.  We also are doing the visibilitymap_pin() while  
holding the buffer lock, which will be fixed in a separate commit.  
  
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>  
Discussion: http://postgr.es/m/419312fd-9255-078c-c3e3-f0525f911d7f@iki.fi  

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

pg_dump: Use only LZ4 frame format for compression

commit   : 0070b66fef21e909adb283f7faa7b1978836ad75    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 1 Apr 2023 00:54:17 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Sat, 1 Apr 2023 00:54:17 +0200    

Click here for diff

After 0da243fed0 got committed, it was reported that in some cases the  
compression ratio is rather poor - particularly for custom format with  
narrow tables - due to writing the LZ4 header/footer for each row.  
  
This commit switches to LZ4F (LZ4 frame format), eliminating most of the  
overhead and greatly improving the compression ratio. This makes the  
compressed size about the same for plain and custom formats (just like  
for gzip, for example).  
  
LZ4F is now used by both compression APIs, which allowed refactoring and  
reusing more of the code. For consistency this also renames the LZ4File  
struct to LZ4State, and a number of functions are now prefixed with  
LZ4Stream_ (instead of LZ4File_).  
  
Patch by Georgios Kokolatos, based on report and initial patch by Justin  
Pryzby. Review and minor cleanups by me.  
  
Author: Georgios Kokolatos, Justin Pryzby  
Reported-by: Justin Pryzby  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/20230227044910.GO1653%40telsasoft.com  

M src/bin/pg_dump/compress_lz4.c

Doc: add Buffer Access Strategy to the glossary

commit   : c8f8d0eb1868cc88d481518d2b6aa0767116055c    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 1 Apr 2023 10:41:27 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 1 Apr 2023 10:41:27 +1300    

Click here for diff

It seems useful to add this to the glossary as there's discussion around  
adding an option to VACUUM to disable and adjust the size of the buffer  
access strategy that VACUUM uses.  
  
Author: Melanie Plageman  
Reviewed-by: Justin Pryzby, David Rowley  
Discussion: https://postgr.es/m/ZBYDTrD1kyGg%2BHkS%40telsasoft.com  

M doc/src/sgml/glossary.sgml

Add show_data option to pg_get_wal_block_info.

commit   : df4f3ab51730a4cdddfead0b264d394ee4925723    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 31 Mar 2023 14:02:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 31 Mar 2023 14:02:52 -0700    

Click here for diff

Allow users to opt out of returning FPI data and block data from  
pg_get_wal_block_info as an optimization.  Testing has shown that this  
can make function execution over twice as fast in some cases.  
  
When pg_get_wal_block_info is called with "show_data := false", it  
always returns NULL values for its block_data and block_fpi_data bytea  
output parameters.  Nothing else changes.  In particular, the function  
will still return the usual per-block summary of block data/FPI space  
overhead.  Use of "show_data := false" is therefore feasible with all  
queries that don't specifically require these raw binary strings.  
  
Follow-up to recent work in commit 122376f0.  There still hasn't been a  
stable release with the pg_get_wal_block_info function, so no bump in  
the pg_walinspect extension version.  
  
Per suggestion from Melanie Plageman.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAAKRu_bJvbcYBRj2cN6G2xV7B7-Ja+pjTO1nEnEhRR8OXYiABA@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-Wzm9shOkEDM10_+qOZkRSQhKVxwBFiehH6EHWQQRd_rDPw@mail.gmail.com  

M contrib/pg_walinspect/expected/oldextversions.out
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect–1.0–1.1.sql
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/pgwalinspect.sgml

SQL/JSON: support the IS JSON predicate

commit   : 6ee30209a6f161d0a267a33f090c70c579c87c00    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 22:34:04 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 22:34:04 +0200    

Click here for diff

This patch introduces the SQL standard IS JSON predicate. It operates  
on text and bytea values representing JSON, as well as on the json and  
jsonb types. Each test has IS and IS NOT variants and supports a WITH  
UNIQUE KEYS flag. The tests are:  
  
IS JSON [VALUE]  
IS JSON ARRAY  
IS JSON OBJECT  
IS JSON SCALAR  
  
These should be self-explanatory.  
  
The WITH UNIQUE KEYS flag makes these return false when duplicate keys  
exist in any object within the value, not necessarily directly contained  
in the outermost object.  
  
Author: Nikita Glukhov <n.gluhov@postgrespro.ru>  
Author: Teodor Sigaev <teodor@sigaev.ru>  
Author: Oleg Bartunov <obartunov@gmail.com>  
Author: Alexander Korotkov <aekorotkov@gmail.com>  
Author: Amit Langote <amitlangote09@gmail.com>  
Author: Andrew Dunstan <andrew@dunslane.net>  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com  
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  

M doc/src/sgml/func.sgml
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonfuncs.h
M src/interfaces/ecpg/test/expected/sql-sqljson.c
M src/interfaces/ecpg/test/expected/sql-sqljson.stderr
M src/interfaces/ecpg/test/expected/sql-sqljson.stdout
M src/interfaces/ecpg/test/sql/sqljson.pgc
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Further tweaking of width_bucket() edge cases.

commit   : a2a0c7c29e47f39da905577659e66b0086b769cc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 16:29:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 16:29:55 -0400    

Click here for diff

I realized that the third overflow case I posited in commit b0e9e4d76  
actually should be handled in a different way: rather than tolerating  
the idea that the quotient could round to 1, we should clamp so that  
the output cannot be more than "count" when we know that the operand is  
less than bound2.  That being the case, we don't need an overflow-aware  
increment in that code path, which leads me to revert the movement of  
the pg_add_s32_overflow() call.  (The diff in width_bucket_float8  
might be easier to read by comparing against b0e9e4d76^.)  
  
What's more, width_bucket_numeric also has this problem of the quotient  
potentially rounding to 1, so add a clamp there too.  
  
As before, I'm not quite convinced that a back-patch is warranted.  
  
Discussion: https://postgr.es/m/391415.1680268470@sss.pgh.pa.us  

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

Reject system columns as elements of foreign keys.

commit   : f0d65c0eaf05d6acd3ae05cde4a31465eb3992b2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 11:18:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 11:18:49 -0400    

Click here for diff

Up through v11 it was sensible to use the "oid" system column as  
a foreign key column, but since that was removed there's no visible  
usefulness in making any of the remaining system columns a foreign  
key.  Moreover, since the TupleTableSlot rewrites in v12, such cases  
actively fail because of implicit assumptions that only user columns  
appear in foreign keys.  The lack of complaints about that seems  
like good evidence that no one is trying to do it.  Hence, rather  
than trying to repair those assumptions (of which there are at least  
two, maybe more), let's just forbid the case up front.  
  
Per this patch, a system column in either the referenced or  
referencing side of a foreign key will draw this error; however,  
putting one in the referenced side would have failed later anyway,  
since we don't allow unique indexes to be made on system columns.  
  
Per bug #17877 from Alexander Lakhin.  Back-patch to v12; the  
case still appears to work in v11, so we shouldn't break it there.  
  
Discussion: https://postgr.es/m/17877-4bcc658e33df6de1@postgresql.org  

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

Ensure acquire_inherited_sample_rows sets its output parameters.

commit   : c2d7d679c1220af77023413b031902afe4d2fdd1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 10:08:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 31 Mar 2023 10:08:40 -0400    

Click here for diff

The totalrows/totaldeadrows outputs were left uninitialized in cases  
where we find no analyzable child tables of a partitioned table.  This  
could lead to setting the partitioned table's pg_class.reltuples value  
to garbage.  It's not clear that that would have any very bad effects  
in practice, but fix it anyway because it's making valgrind unhappy.  
  
Reported and diagnosed by Alexander Lakhin (bug #17880).  
  
Discussion: https://postgr.es/m/17880-9282037c923d856e@postgresql.org  

M src/backend/commands/analyze.c

pg_regress: Emit TAP compliant output

commit   : 558fff0adfa02b6db6b003c64cca75e55f5187e2    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 31 Mar 2023 13:00:02 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 31 Mar 2023 13:00:02 +0200    

Click here for diff

This converts pg_regress output format to emit TAP compliant output  
while keeping it as human readable as possible for use without TAP  
test harnesses. As verbose harness related information isn't really  
supported by TAP this also reduces the verbosity of pg_regress runs  
which makes scrolling through log output in buildfarm/CI runs a bit  
easier as well.  
  
As the meson TAP parser conumes whitespace, the leading indentation  
for differentiating parallel tests from sequential tests has been  
changed to a single character prefix.  
  
This patch has been around for an extended period of time, reviewers  
listed below may have been involved in reviewing a version quite  
different from the version in this commit.  The original idea for  
this patch was a hacking session with Jinbao Chen.  
  
TAP format testing is also enabled in meson as of this.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Nikolay Shaplov <dhyan@nataraj.su>  
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/BD4B107D-7E53-4794-ACBA-275BEB4327C9@yesql.se  
Discussion: https://postgr.es/m/20220221164736.rq3ornzjdkmwk2wo@alap3.anarazel.de  

M doc/src/sgml/regress.sgml
M meson.build
M src/Makefile.global.in
M src/test/regress/pg_regress.c

Move ExecEvalJsonConstructor new function to a more natural place

commit   : 9b058f6b0d9c3d1ccde4d51a72bf15ce731973a1    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 12:55:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 12:55:25 +0200    

Click here for diff

Commit 7081ac46ace8 put it at the end of the file, but that doesn't look  
very nice.  

M src/backend/executor/execExprInterp.c
M src/include/executor/execExpr.h

No need to add FORMAT to the keyword precedence list

commit   : 47a97098467fda56b497049430d0949f3a7dde01    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 11:14:43 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 31 Mar 2023 11:14:43 +0200    

Click here for diff

Commit 7081ac46ace8 put it there.  Remove it.  

M src/backend/parser/gram.y

Add XML ID attributes to create_publication.sgml.

commit   : ed94e8563e036f3b42519f1c3b5ae1361e2a59bf    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 31 Mar 2023 08:59:55 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 31 Mar 2023 08:59:55 +0530    

Click here for diff

This commit adds XML ID attributes to all varlistentries in  
create_publication.sgml. This allows us to include links to refer to  
publication options, making documents more readable.  
  
Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58668219FEA4EC231486A433F58E9@TYAPR01MB5866.jpnprd01.prod.outlook.com  

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

Bump PGSTAT_FILE_FORMAT_ID, omitted in 8aaa04b32d7

commit   : f95c1cd6b2fd7d70e219ea8c5fabf2c0a75d7705    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 19:44:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 19:44:40 -0700    

Click here for diff

I forgot to do so in the referenced commit. While the consequences of omitting  
the version change are likely to be harmless (besides discarding stats, as a  
PGSTAT_FILE_FORMAT_ID bump also does), it still seems worth doing.  

M src/include/pgstat.h

Track shared buffer hits in pg_stat_io

commit   : 8aaa04b32d790da595684de58ae4fc2db96becff    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 19:22:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 19:22:40 -0700    

Click here for diff

Among other things, this should make it easier to calculate a useful cache hit  
ratio by excluding buffer reads via buffer access strategies. As buffer access  
strategies reuse buffers (and thus evict the prior buffer contents), it is  
normal to see reads on repeated scans of the same data.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAAKRu_beMa9Hzih40%3DXPYqhDVz6tsgUGTrhZXRo%3Dunp%2Bszb%3DUA%40mail.gmail.com  

M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/storage/buf_internals.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix List memory issue in transformColumnDefinition

commit   : 6c3b697b19db6274da622cf0fe7a7ad32eeeced3    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 31 Mar 2023 12:13:05 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 31 Mar 2023 12:13:05 +1300    

Click here for diff

When calling generateSerialExtraStmts(), we would pass in the  
constraint->options.  In some cases, generateSerialExtraStmts() would  
modify the referenced List to remove elements from it, but doing so is  
invalid without assigning the list back to all variables that point to it.  
In the particular reported problem case, the List became empty, in which  
cases it became NIL, but the passed in constraint->options didn't get to  
find out about that and was left pointing to free'd memory.  
  
To fix this, just perform a list_copy() inside generateSerialExtraStmts().  
We could just do a list_copy() just before we perform the delete from the  
list, however, that seems less robust.  Let's make sure the generated  
CreateSeqStmt gets a completely different copy of the list to be safe.  
  
Bug: #17879  
Reported-by: Fei Changhong  
Diagnosed-by: Fei Changhong  
Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org  
Backpatch-through: 11, all supported versions  

M src/backend/parser/parse_utilcmd.c

Parallel Hash Full Join.

commit   : 11c2d6fdf5af1aacec9ca2005543f1b0fc4cc364    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 31 Mar 2023 11:01:51 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 31 Mar 2023 11:01:51 +1300    

Click here for diff

Full and right outer joins were not supported in the initial  
implementation of Parallel Hash Join because of deadlock hazards (see  
discussion).  Therefore FULL JOIN inhibited parallelism, as the other  
join strategies can't do that in parallel either.  
  
Add a new PHJ phase PHJ_BATCH_SCAN that scans for unmatched tuples on  
the inner side of one batch's hash table.  For now, sidestep the  
deadlock problem by terminating parallelism there.  The last process to  
arrive at that phase emits the unmatched tuples, while others detach and  
are free to go and work on other batches, if there are any, but  
otherwise they finish the join early.  
  
That unfairness is considered acceptable for now, because it's better  
than no parallelism at all.  The build and probe phases are run in  
parallel, and the new scan-for-unmatched phase, while serial, is usually  
applied to the smaller of the two relations and is either limited by  
some multiple of work_mem, or it's too big and is partitioned into  
batches and then the situation is improved by batch-level parallelism.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKG%2BA6ftXPz4oe92%2Bx8Er%2BxpGZqto70-Q_ERwRaSyA%3DafNg%40mail.gmail.com  

M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/optimizer/path/joinpath.c
M src/include/executor/hashjoin.h
M src/include/executor/nodeHash.h
M src/test/regress/expected/join_hash.out
M src/test/regress/sql/join_hash.sql

pg_stat_wal: Accumulate time as instr_time instead of microseconds

commit   : ca7b3c4c00042038ba9c282c4807e05c0a527e42    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 14:23:14 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 14:23:14 -0700    

Click here for diff

In instr_time.h it is stated that:  
  
* When summing multiple measurements, it's recommended to leave the  
* running sum in instr_time form (ie, use INSTR_TIME_ADD or  
* INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end.  
  
The reason for that is that converting to microseconds is not cheap, and can  
loose precision.  Therefore this commit changes 'PendingWalStats' to use  
'instr_time' instead of 'PgStat_Counter' while accumulating 'wal_write_time'  
and 'wal_sync_time'.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/1feedb83-7aa9-cb4b-5086-598349d3f555@gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/storage/file/buffile.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

Show record information in pg_get_wal_block_info.

commit   : 122376f028a0e31b91d6c6bad2a9a6e994708547    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 30 Mar 2023 12:26:12 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 30 Mar 2023 12:26:12 -0700    

Click here for diff

Expand the output parameters in pg_walinspect's pg_get_wal_block_info  
function to return additional information that was previously only  
available from pg_walinspect's pg_get_wal_records_info function.  Some  
of the details are attributed to individual block references, rather  
than aggregated into whole-record values, since the function returns one  
row per block reference per WAL record (unlike pg_get_wal_records_info,  
which always returns one row per WAL record).  
  
This structure is much easier to work with when writing queries that  
track how individual blocks changed over time, or when attributing costs  
to individual blocks (not WAL records) is useful.  
  
This is the second time that pg_get_wal_block_info has been enhanced in  
recent weeks.  Commit 9ecb134a expanded on the original version of the  
function added in commit c31cf1c0 (where it first appeared under the  
name pg_get_wal_fpi_info).  There still hasn't been a stable release  
since commit c31cf1c0, so no bump in the pg_walinspect extension  
version.  
  
Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Kyotaro HORIGUCHI <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/CALj2ACVRK5=Z+2ZVsjgTTSkfEnQzCuwny7iigpG7g1btk4Ws2A@mail.gmail.com  

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

Simplify transformJsonAggConstructor() API

commit   : 63cc20205c1a0022d808a783b3025029bb09101e    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 21:07:24 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 21:07:24 +0200    

Click here for diff

There's no need for callers to pass aggregate names so that the function  
can resolve them to OIDs, when callers can just pass aggregate OIDs  
directly to begin with.  

M src/backend/parser/parse_expr.c

Fix inconsistencies and style issues in new SQL/JSON code

commit   : 60966f56c3e4db9f9bdff485371ef3a50d53431f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 21:05:35 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 21:05:35 +0200    

Click here for diff

Reported by Alexander Lakhin.  
  
Discussion: https://postgr.es/m/60483139-5c34-851d-baee-6c0d014e1710@gmail.com  

M src/backend/executor/execExprInterp.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h

Fix setrefs.c code for adjusting partPruneInfos

commit   : 589bb816499e98b60aa5c406c409fb27b42b0e39    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 13:24:09 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 30 Mar 2023 13:24:09 +0200    

Click here for diff

We were transferring partPruneInfos from PlannerInfo into PlannerGlobal  
wrong, essentially relying on all of them being transferred, and  
adjusting their list indexes based on that.  But apparently it's  
possible that some of them are skipped, so that strategy leads to a  
corrupted execution tree.  Instead, adjust each Append/MergeAppend's  
partpruneinfo index as we copy from one list to the other, which seems  
safer anyway.  This requires adjusting the RT offset of the RTE  
referenced in each partPruneInfo ahead of actually adjusting the RTE  
itself, which seems a bit too ad-hoc.  
  
This problem was introduced by commit ec386948948c.  However, it may be  
that we no longer require the change introduced there, so perhaps we  
should revert both the present commit and that one.  
  
Problem noticed by sqlsmith.  
  
Author: Amit Langote <amitlangote09@gmail.com  
Discussion: https://postgr.es/m/CA+HiwqG6tbc2oadsbyyy24b2AL295XHQgyLRWghmA7u_SL1K8A@mail.gmail.com  

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

Fix format code in fd.c debugging infrastructure

commit   : f9054b7a7cd47b93d6a59f15994ce72c51fe1e04    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    

Click here for diff

These were not sufficiently adjusted in 2d4f1ba6cfc.  

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

bufmgr: Fix undefined behaviour with, unrealistically, large temp_buffers

commit   : 558cf803876874c55d637a1e87417fa1c670efe1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 30 Mar 2023 09:50:18 -0700    

Click here for diff

Quoting Melanie:  
> Since if buffer is INT_MAX, then the -(buffer + 1) version invokes  
> undefined behavior while the -buffer - 1 version doesn't.  
  
All other places were already using the correct version. I (Andres), copied  
the code into more places in a patch. Melanie caught it in review, but to  
prevent more people from copying the bad code, fix it. Even if it is a  
theoretical issue.  
  
We really ought to wrap these accesses in a helper function...  
  
As this is a theoretical issue, don't backpatch.  
  
Reported-by: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_aW2SX_LWtwHgfnqYpBrunMLfE9PD6-ioPpkh92XH0qpg@mail.gmail.com  

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

Clean up role created in new subscription test.

commit   : e9d202a1499d6a70e80d080fcdba07fe6707845d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Mar 2023 13:07:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Mar 2023 13:07:04 -0400    

Click here for diff

This oversight broke repeated runs of "make installcheck".  

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

Fix documentation build for c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6.

commit   : 9c487efe355692a4a219df1a1e5330ac02079bf8    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 30 Mar 2023 12:06:34 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 30 Mar 2023 12:06:34 -0400    

Click here for diff

This documentation hunk was intended to be part of that commit,  
but I goofed.  

M doc/src/sgml/ref/create_subscription.sgml

Add new predefined role pg_create_subscription.

commit   : c3afe8cf5a1e465bd71e48e4bc717f5bfdc7a7d6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 30 Mar 2023 11:37:19 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 30 Mar 2023 11:37:19 -0400    

Click here for diff

This role can be granted to non-superusers to allow them to issue  
CREATE SUBSCRIPTION. The non-superuser must additionally have CREATE  
permissions on the database in which the subscription is to be  
created.  
  
Most forms of ALTER SUBSCRIPTION, including ALTER SUBSCRIPTION .. SKIP,  
now require only that the role performing the operation own the  
subscription, or inherit the privileges of the owner. However, to  
use ALTER SUBSCRIPTION ... RENAME or ALTER SUBSCRIPTION ... OWNER TO,  
you also need CREATE permission on the database. This is similar to  
what we do for schemas. To change the owner of a schema, you must also  
have permission to SET ROLE to the new owner, similar to what we do  
for other object types.  
  
Non-superusers are required to specify a password for authentication  
and the remote side must use the password, similar to what is required  
for postgres_fdw and dblink.  A superuser who wants a non-superuser to  
own a subscription that does not rely on password authentication may  
set the new password_required=false property on that subscription. A  
non-superuser may not set password_required=false and may not modify a  
subscription that already has password_required=false.  
  
This new password_required subscription property works much like the  
eponymous postgres_fdw property.  In both cases, the actual semantics  
are that a password is not required if either (1) the property is set  
to false or (2) the relevant user is the superuser.  
  
Patch by me, reviewed by Andres Freund, Jeff Davis, Mark Dilger,  
and Stephen Frost (but some of those people did not fully endorse  
all of the decisions that the patch makes).  
  
Discussion: http://postgr.es/m/CA+TgmoaDH=0Xj7OBiQnsHTKcF2c4L+=gzPBUKSJLh8zed2_+Dg@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/drop_subscription.sgml
M doc/src/sgml/user-manag.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/alter.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_subscription.h
M src/include/replication/walreceiver.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/027_nosuperuser.pl

Avoid overflow in width_bucket_float8().

commit   : b0e9e4d76ca212d429d9cd615ae62ac73a9a89ba    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Mar 2023 11:27:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 30 Mar 2023 11:27:36 -0400    

Click here for diff

The original coding of this function paid little attention to the  
possibility of overflow.  There were actually three different hazards:  
  
1. The range from bound1 to bound2 could exceed DBL_MAX, which on  
IEEE-compliant machines produces +Infinity in the subtraction.  
At best we'd lose all precision in the result, and at worst  
produce NaN due to dividing Inf/Inf.  The range can't exceed  
twice DBL_MAX though, so we can fix this case by scaling all the  
inputs by 0.5.  
  
2. We computed count * (operand - bound1), which is also at risk of  
float overflow, before dividing.  Safer is to do the division first,  
producing a quotient that should be in [0,1), and even after allowing  
for roundoff error can't be outside [0,1]; then multiplying by count  
can't produce a result overflowing an int.  (width_bucket_numeric does  
the multiplication first on the grounds that that improves accuracy of  
its result, but I don't think that a similar argument can be made in  
float arithmetic.)  
  
3. If the division result does round to 1, and count is INT_MAX,  
the final addition of 1 would overflow an int.  We took care  
of that in the operand >= bound2 case but did not consider that  
it could be possible in the main path.  Fix that by moving the  
overflow-aware addition of 1 so it is done that way in all cases.  
  
The fix for point 2 creates a possibility that values very close to  
a bucket boundary will be rounded differently than they were before.  
I'm not troubled by that for HEAD, but it is an argument against  
putting this into the stable branches.  Given that the cases being  
fixed here are fairly extreme and unlikely to be hit in normal use,  
it seems best not to back-patch.  
  
Mats Kindahl and Tom Lane  
  
Discussion: https://postgr.es/m/17876-61f280d1601f978d@postgresql.org  

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

Fix pointer cast for seed calculation on 32-bit systems

commit   : 2fe7a6df94e69a20c57f71a0592133684cf612da    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Mar 2023 10:53:15 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 30 Mar 2023 10:53:15 +0200    

Click here for diff

The fallback seed for when pg_strong_random cannot generate a high  
quality seed mixes in the address of the conn object, but the cast  
failed to take the word size into consideration. Fix by casting to  
a uintptr_t instead. The seed calculation was added in 7f5b19817e.  
  
The code as it stood generated the following warning on mamba and  
lapwing in the buildfarm:  
  
fe-connect.c: In function 'libpq_prng_init':  
fe-connect.c:1048:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]  
1048 |  rseed = ((uint64) conn) ^  
     |           ^  
  
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>  
Discussion: https://postgr.es/m/TYAPR01MB58665250EDCD551CCA9AD117F58E9@TYAPR01MB5866.jpnprd01.prod.outlook.com  

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

Fix incorrect format placeholders

commit   : 261cf8962b8ce92ce62c47148bd72a2c2e3351b0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 30 Mar 2023 08:33:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 30 Mar 2023 08:33:43 +0200    

Click here for diff

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

Refactor pgoutput_change().

commit   : da324d6cd45bbbcc1682cc2fcbc4f575281916af    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 30 Mar 2023 11:10:38 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 30 Mar 2023 11:10:38 +0530    

Click here for diff

Instead of mostly-duplicate code for different operation  
(insert/update/delete) types, write a common code to compute old/new  
tuples, and check the row filter.  
  
Author: Hou Zhijie  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB5716194A47FFA8D91133687D94BF9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

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

Fix outdated comments regarding TupleTableSlots

commit   : 902ecd3bd4e733d273e69fd420df6fab4ffbe79b    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 30 Mar 2023 16:37:03 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 30 Mar 2023 16:37:03 +1300    

Click here for diff

The tts_flag is named TTS_FLAG_SHOULDFREE, so use that instead of  
TTS_SHOULDFREE, which is the name of the macro that checks for that flag.  
  
Additionally, 4da597edf got rid of the TupleTableSlot.tts_tuple field but  
forgot to update a comment which referenced that field.  Fix that.  
  
Reported-by: Zhen Mingyang <zhenmingyang@yeah.net>  
Reported-by: Richard Guo <guofenglinux@gmail.com>  
Discussion: https://postgr.es/m/1a96696c.9d3.187193989c3.Coremail.zhenmingyang@yeah.net  

M src/backend/executor/execTuples.c
M src/include/executor/tuptable.h

Support connection load balancing in libpq

commit   : 7f5b19817eaf38e70ad1153db4e644ee9456853e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 29 Mar 2023 21:53:38 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 29 Mar 2023 21:53:38 +0200    

Click here for diff

This adds support for load balancing connections with libpq using a  
connection parameter: load_balance_hosts=<string>. When setting the  
param to random, hosts and addresses will be connected to in random  
order. This then results in load balancing across these addresses and  
hosts when multiple clients or frequent connection setups are used.  
  
The randomization employed performs two levels of shuffling:  
  
  1. The given hosts are randomly shuffled, before resolving them  
     one-by-one.  
  2. Once a host its addresses get resolved, the returned addresses  
     are shuffled, before trying to connect to them one-by-one.  
  
Author: Jelte Fennema <postgres@jeltef.nl>  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Reviewed-by: Michael Banck <mbanck@gmx.net>  
Reviewed-by: Andrey Borodin <amborodin86@gmail.com>  
Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook.  

M .cirrus.yml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/regress.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/meson.build
A src/interfaces/libpq/t/003_load_balance_host_list.pl
A src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/pgindent/typedefs.list

Copy and store addrinfo in libpq-owned private memory

commit   : 44d85ba5a3361dea371d23bd91777ef4c0c4e506    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 29 Mar 2023 21:41:27 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 29 Mar 2023 21:41:27 +0200    

Click here for diff

This refactors libpq to copy addrinfos returned by getaddrinfo to  
memory owned by libpq such that future improvements can alter for  
example the order of entries.  
  
As a nice side effect of this refactor the mechanism for iteration  
over addresses in PQconnectPoll is now identical to its iteration  
over hosts.  
  
Author: Jelte Fennema <postgres@jeltef.nl>  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Reviewed-by: Michael Banck <mbanck@gmx.net>  
Reviewed-by: Andrey Borodin <amborodin86@gmail.com>  
Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook.com  

M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/tools/pgindent/typedefs.list

Fix dereference of dangling pointer in GiST index buffering build.

commit   : 8e5eef50c5b41fd39ad60365c9c1b46782f881ca    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 11:31:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 11:31:30 -0400    

Click here for diff

gistBuildCallback tried to fetch the size of an index tuple that  
might have already been freed by gistProcessEmptyingQueue.  
While this seems to usually be harmless in production builds,  
in principle it could result in a SIGSEGV, or more likely a bogus  
value for indtuplesSize leading to poor page-split decisions later  
in the build.  
  
The memory management here is confusing and could stand to be  
refactored, but for the moment it seems to be enough to fetch  
the tuple size sooner.  AFAICT the indtuples[Size] totals aren't  
used in between these places; even if they were, the updated  
values shouldn't be any worse to use.  So just move the  
incrementing of the totals up.  
  
It's not very clear why our valgrind-using buildfarm animals  
haven't noticed this problem, because the relevant code path  
does seem to be exercised according to the code coverage report.  
I think the reason that we didn't fix this bug after the first  
report is that I'd wanted to try to understand that better.  
However, now that it's been re-discovered let's just be pragmatic  
and fix it already.  
  
Original report by Alexander Lakhin (bug #16329),  
later rediscovered by Egor Chindyaskin (bug #17874).  
  
Patch by Alexander Lakhin (commentary by Pavel Borisov and me).  
Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/16329-7a6aa9b6fa1118a1@postgresql.org  
Discussion: https://postgr.es/m/17874-63ca6c7ce42d2103@postgresql.org  

M src/backend/access/gist/gistbuild.c

Add missing .gitignore entries.

commit   : 3aa961378b4e517908a4400cdc476ca299693de9    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 09:16:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 09:16:53 -0400    

Click here for diff

Oversight in commit 7081ac46ace8c459966174400b53418683c9fe5c.  

M src/interfaces/ecpg/test/sql/.gitignore

Remove empty function BufmgrCommit().

commit   : 58c9600a9f5818f63712ae4262143c42517dcba7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 09:13:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 29 Mar 2023 09:13:57 -0400    

Click here for diff

This function has been a no-op for over a decade.  Even if bufmgr  
regains a need to be called during commit, it seems unlikely that  
the most appropriate call points would be precisely here, so it's not  
doing us much good as a placeholder either.  Now, removing it probably  
doesn't save any noticeable number of cycles --- but the main call is  
inside the commit critical section, and the less work done there the  
better.  
  
Matthias van de Meent  
  
Discussion: https://postgr.es/m/CAEze2Wi1=tLKbxZnXzcD+8fYKyKqBtivVakLQC_mYBsP4Y8qVA@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h

SQL/JSON: add standard JSON constructor functions

commit   : 7081ac46ace8c459966174400b53418683c9fe5c    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 29 Mar 2023 12:11:36 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 29 Mar 2023 12:11:36 +0200    

Click here for diff

This commit introduces the SQL/JSON standard-conforming constructors for  
JSON types:  
  
JSON_ARRAY()  
JSON_ARRAYAGG()  
JSON_OBJECT()  
JSON_OBJECTAGG()  
  
Most of the functionality was already present in PostgreSQL-specific  
functions, but these include some new functionality such as the ability  
to skip or include NULL values, and to allow duplicate keys or throw  
error when they are found, as well as the standard specified syntax to  
specify output type and format.  
  
Author: Nikita Glukhov <n.gluhov@postgrespro.ru>  
Author: Teodor Sigaev <teodor@sigaev.ru>  
Author: Oleg Bartunov <obartunov@gmail.com>  
Author: Alexander Korotkov <aekorotkov@gmail.com>  
Author: Amit Langote <amitlangote09@gmail.com>  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/CAF4Au4w2x-5LTnN_bxky-mq4=WOqsGsxSpENCzHRAzSnEd8+WQ@mail.gmail.com  
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  
Discussion: https://postgr.es/m/20220616233130.rparivafipt6doj3@alap3.anarazel.de  
Discussion: https://postgr.es/m/abd9b83b-aa66-f230-3d6d-734817f0995d%40postgresql.org  

M doc/src/sgml/func.sgml
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/test/ecpg_schedule
A src/interfaces/ecpg/test/expected/sql-sqljson.c
A src/interfaces/ecpg/test/expected/sql-sqljson.stderr
A src/interfaces/ecpg/test/expected/sql-sqljson.stdout
M src/interfaces/ecpg/test/sql/Makefile
M src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/sql/sqljson.pgc
M src/test/regress/expected/json.out
M src/test/regress/expected/opr_sanity.out
A src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/opr_sanity.sql
A src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Fix some section numbers in information_schema.sql

commit   : 38b7437b9088b4859e4489a1a1a9ab7066f5b320    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 11:34:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 11:34:37 +0200    

Click here for diff

Some of the section numbers that appeared multiple times were not  
updated completely by previous changes d61d9aa750 and eb3a1376c9.  

M src/backend/catalog/information_schema.sql

meson: Change default buildtype to debugoptimized

commit   : 5aae36dc9c6842e4269b4a713f7ac6583bd8a318    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 09:24:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 09:24:37 +0200    

Click here for diff

This matches the Autoconf default (-O2 + debug) better.  The previous  
default setting "release" used -O3, which resulted in different  
compiler warnings.  At least for now, we want to avoid such  
divergence.  
  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBJD_Y-XcqwXSbWS24z%2B84FFX7ajhCan9ixc_m4bD63sA%40mail.gmail.com  

M doc/src/sgml/installation.sgml
M meson.build

Move definition of standard collations from initdb to pg_collation.dat

commit   : 563f21cda8fcb61a0b5f071affb79c86458e52f8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 09:45:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 09:45:21 +0200    

Click here for diff

The standard collations "ucs_basic" and "unicode" were defined in  
initdb, even though pg_collation.dat seems like the correct place for  
them.  It seems this was just forgotten during various reorganizations  
of initdb and pg_collation.dat/.h over time.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/08b58ecd-0d50-9395-ed51-dc8294e3fd2b%40enterprisedb.com  

M src/bin/initdb/initdb.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_collation.dat

Simplify useless 0L constants

commit   : 0d15afc875f44bcb0adc244c4d9034023f99b609    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 08:25:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 29 Mar 2023 08:25:12 +0200    

Click here for diff

In ancient times, these belonged to arguments or fields that were  
actually of type long, but now they are not anymore, so this "L"  
decoration is just confusing.  (Some other 0L and other "L" constants  
remain, where they are actually associated with a long type.)  

M src/backend/access/transam/xlogarchive.c
M src/backend/backup/backup_manifest.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/executor/nodeHashjoin.c
M src/backend/storage/file/buffile.c
M src/backend/tcop/pquery.c
M src/backend/utils/sort/tuplestore.c

Avoid syncing data twice for the 'publish_via_partition_root' option.

commit   : 062a8444242404242f7c2b814fed37b329639408    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 29 Mar 2023 10:46:58 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 29 Mar 2023 10:46:58 +0530    

Click here for diff

When there are multiple publications for a subscription and one of those  
publishes via the parent table by using publish_via_partition_root and the  
other one directly publishes the child table, we end up copying the same  
data twice during initial synchronization. The reason for this was that we  
get both the parent and child tables from the publisher and try to copy  
the data for both of them.  
  
This patch extends the function pg_get_publication_tables() to take a  
publication list as its input parameter. This allows us to exclude a  
partition table whose ancestor is published by the same publication list.  
  
This problem does exist in back-branches but we decide to fix it there in  
a separate commit if required. The fix for back-branches requires quite  
complicated changes to fetch the required table information from the  
publisher as we can't update the function pg_get_publication_tables() in  
back-branches. We are not sure whether we want to deviate and complicate  
the code in back-branches for this problem as there are no field reports  
yet.  
  
Author: Wang wei  
Reviewed-by: Peter Smith, Jacob Champion, Kuroda Hayato, Vignesh C, Osumi Takamichi, Amit Kapila  
Discussion: https://postgr.es/m/OS0PR01MB57167F45D481F78CDC5986F794B99@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/subscriptioncmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/rules.out
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl
M src/tools/pgindent/typedefs.list

Add XML ID attributes to create_subscription.sgml.

commit   : de5a47af2d8003dee123815bb7e58913be9a03f3    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 29 Mar 2023 09:58:14 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 29 Mar 2023 09:58:14 +0530    

Click here for diff

Commit ecb696527c added an XML ID attribute to one varlistentry in  
create_subscription.sgml. Following 78ee60ed84, this commit adds XML ID  
attributes to all varlistentries in create_subscription.sgml.  
Additionally, links are added to refer to the subscription options,  
enhancing the readability of documents.  
  
Author: Kuroda Hayato  
Reviewed-by: Peter Smith, Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58667AE04D291924671E2051F5879@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/pg_dump.sgml

pg_dump: Fix gzip compression of empty data

commit   : 00d9dcf5bebbb355152a60f0e2120cdf7f9e7ddd    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 29 Mar 2023 00:50:34 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Wed, 29 Mar 2023 00:50:34 +0200    

Click here for diff

The pg_dump Compressor API has three basic callbacks - Allocate, Write  
and End.  The gzip implementation (since e9960732a) wrongly assumed the  
Write function would always be called, and deferred the initialization  
of the internal compression system until the first such call.  But when  
there's no data to compress (e.g. for empty LO), this would result in  
not finalizing the compression state (because it was not actually  
initialized), producing invalid dump.  
  
Fixed by initializing the internal compression system in the Allocate  
call, whenever the caller provides the Write.  For decompression the  
state is not needed, so we leave the private_data member unpopulated.  
  
Introduces a pg_dump TAP test compressing an empty large object.  
  
This also rearranges the functions to their original order, to make  
diffs against older code simpler to understand.  Finally, replace an  
unreachable pg_fatal() with a simple assert check.  
  
Reported-by: Justin Pryzby  
Author: Justin Pryzby, Georgios Kokolatos  
Reviewed-by: Georgios Kokolatos, Tomas Vondra  
  
https://postgr.es/m/20230228235834.GC30529%40telsasoft.com  

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

Validate ICU locales.

commit   : 1671f990dd669c0b72e45c7bef0fd579a10676ed    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 28 Mar 2023 16:15:59 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 28 Mar 2023 16:15:59 -0700    

Click here for diff

For ICU collations, ensure that the locale's language exists in ICU,  
and that the locale can be opened.  
  
Basic validation helps avoid minor mistakes and misspellings, which  
often fall back to the root locale instead of the intended  
locale. It's even more important to avoid such mistakes in ICU  
versions 54 and earlier, where the same (misspelled) locale string  
could fall back to different locales depending on the environment.  
  
Discussion: https://postgr.es/m/11b1eeb7e7667fdd4178497aeb796c48d26e69b9.camel@j-davis.com  
Discussion: https://postgr.es/m/df2efad0cae7c65180df8e5ebb709e5eb4f2a82b.camel@j-davis.com  
Reviewed-by: Peter Eisentraut  

M doc/src/sgml/config.sgml
M src/backend/commands/collationcmds.c
M src/backend/commands/dbcommands.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/include/utils/pg_locale.h
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql

amcheck: In verify_heapam, allows tuples with xmin 0.

commit   : b7cea58822c67724effc711ae28e4077a01a7cd6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 28 Mar 2023 16:16:53 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 28 Mar 2023 16:16:53 -0400    

Click here for diff

Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case  
to be reported as corruption, but Peter Geoghegan pointed out that  
it can legitimately happen in the case of a speculative insertion  
that aborts, so we'd better not flag it as corruption after all.  
  
Back-patch to v14, like the commit that introduced the issue.  
  
Discussion: http://postgr.es/m/CAH2-WzmEabzcPTxSY-NXKH6Qt3FkAPYHGQSe2PtvGgj17ZQkCw@mail.gmail.com  

M contrib/amcheck/verify_heapam.c

Fix recent pg_walinspect fpi_length bug.

commit   : bade01cb4dd88f63bd9024cfdaec3d5001a805f3    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 28 Mar 2023 10:53:48 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 28 Mar 2023 10:53:48 -0700    

Click here for diff