PostgreSQL 15.0 (upcoming) commit log

doc: Properly punctuate "etc."

commit   : 648aa6734fefb2cc2c9bba7d6444890e727eaca1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 May 2022 09:27:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 19 May 2022 09:27:34 +0200    

Click here for diff

M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/extend.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/manage-ag.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/values.sgml
M doc/src/sgml/sources.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xml2.sgml

Fix incorrect comments for Memoize struct

commit   : c4a4e760f6b0e7933e7d3bff0b589af9da49f8e6    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 19 May 2022 17:14:23 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 19 May 2022 17:14:23 +1200    

Click here for diff

Reported-by: Peter Eisentraut  
Discussion: https://postgr.es/m/0635f5aa-4973-8dc2-4e4e-df9fd5778a65@enterprisedb.com  
Backpatch-through: 14, where Memoize was added  

M src/include/nodes/plannodes.h

Extend pg_publication_tables to display column list and row filter.

commit   : 0ff20288e1cb3282efb43401896a939916fceb4d    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 19 May 2022 08:20:55 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 19 May 2022 08:20:55 +0530    

Click here for diff

Commit 923def9a53 and 52e4f0cd47 allowed to specify column lists and row  
filters for publication tables. This commit extends the  
pg_publication_tables view and pg_get_publication_tables function to  
display that information.  
  
This information will be useful to users and we also need this for the  
later commit that prohibits combining multiple publications with different  
column lists for the same table.  
  
Author: Hou Zhijie  
Reviewed By: Amit Kapila, Alvaro Herrera, Shi Yu, Takamichi Osumi  
Discussion: https://postgr.es/m/202204251548.mudq7jbqnh7r@alvherre.pgsql  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/tablesync.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out

Update xml_1.out and xml_2.out

commit   : 62221ef187b0098c8f331f804b7c63859e5ee6ff    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 23:19:53 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 23:19:53 +0200    

Click here for diff

Commit 0fbf01120023 should have updated them but didn't.  

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

Fix EXPLAIN MERGE output when no tuples are processed

commit   : 12e423e21d8ef47d95a099c12f625f6d191eaf92    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 21:20:49 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 21:20:49 +0200    

Click here for diff

An 'else' clause was misplaced in commit 598ac10be1c2, making zero-rows  
output look a bit silly.  Add a test case for it.  
  
Pointed out by Tom Lane.  
  
Discussion: https://postgr.es/m/21030.1652893083@sss.pgh.pa.us  

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

Check column list length in XMLTABLE/JSON_TABLE alias

commit   : 0fbf0112002355efb2bb525ab88edf891dbfd033    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 20:28:31 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 20:28:31 +0200    

Click here for diff

We weren't checking the length of the column list in the alias clause of  
an XMLTABLE or JSON_TABLE function (a "tablefunc" RTE), and it was  
possible to make the server crash by passing an overly long one.  Fix it  
by throwing an error in that case, like the other places that deal with  
alias lists.  
  
In passing, modify the equivalent test used for join RTEs to look like  
the other ones, which was different for no apparent reason.  
  
This bug came in when XMLTABLE was born in version 10; backpatch to all  
stable versions.  
  
Reported-by: Wang Ke <krking@zju.edu.cn>  
Discussion: https://postgr.es/m/17480-1c9d73565bb28e90@postgresql.org  

M src/backend/parser/parse_clause.c
M src/backend/parser/parse_relation.c
M src/test/regress/expected/int2.out
M src/test/regress/expected/join.out
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xml.out
M src/test/regress/sql/int2.sql
M src/test/regress/sql/join.sql
M src/test/regress/sql/jsonb_sqljson.sql
M src/test/regress/sql/with.sql
M src/test/regress/sql/xml.sql

Make EXPLAIN MERGE output format more compact

commit   : 598ac10be1c20961baac44db773eb826f788fdfa    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 18:33:04 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 18 May 2022 18:33:04 +0200    

Click here for diff

We can use a single line to print all tuple counts that MERGE processed,  
for conciseness, and elide those that are zeroes.  Non-text formats  
report all numbers, as is typical.  
  
Per comment from Justin Pryzby <pryzby@telsasoft.com>  
  
Discussion: https://postgr.es/m/20220511163350.GL19626@telsasoft.com  

M src/backend/commands/explain.c
M src/test/regress/expected/merge.out

Fix markup in synopsis

commit   : 81e3c83d988daa8fd763ec5104d540713832dd1a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 May 2022 18:18:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 18 May 2022 18:18:22 +0200    

Click here for diff

There is no need for a <literal> inside a <synopsis>, since the latter  
is already all "literal" implicitly.  Also, create_help.pl misparses  
it.  So just remove it.  
  
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/20220517.174342.1884842412165214815.horikyota.ntt%40gmail.com  

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

pgbench: Restore compatibility of --partitions=0

commit   : 27f1366050c6cd8c1ea5f03b367a5a167ebf34b7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 May 2022 09:47:38 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 May 2022 09:47:38 +0900    

Click here for diff

A value of 0 is allowed for this option since its creation, that would  
map with the default of having no partitions for pgbench_accounts, but  
6f164e6 broke that by enforcing an error.  This commit restores the  
original behavior.  
  
Author: Amit Langote  
Discussion: https://postgr.es/m/CA+HiwqGAGobiiHR8nH382HJxqm1mzZs8=3oKPXnXivWoFSZmNA@mail.gmail.com  

M src/bin/pgbench/pgbench.c

Fix typo in walreceiver.c

commit   : bbf7c2d9e932db873469cd9cecf0e05e39c1962d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 May 2022 09:06:22 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 18 May 2022 09:06:22 +0900    

Click here for diff

s/primary_slotname/primary_slot_name/.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACX3=pHkCpoGG-z+O=7Gp5YZv70jmfTyGnNV7YF3SkK73g@mail.gmail.com  

M src/backend/replication/walreceiver.c

Stamp 15beta1.

commit   : 05a5a1775c89f6beb326725282e7eea1373cbec8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 May 2022 17:10:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 16 May 2022 17:10:42 -0400    

Click here for diff

M configure
M configure.ac

relnotes: improve updated UTF8 item wording

commit   : 4bfa420075b4e85012837b6b6d376edf8af5ede5    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 16 May 2022 10:18:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 16 May 2022 10:18:17 -0400    

Click here for diff

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

relnotes: improve UTF8 text item in relation to ASCII

commit   : 9499c0fcf488e2f8e0e3ae71b06003fe7735feb4    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Mon, 16 May 2022 10:09:36 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Mon, 16 May 2022 10:09:36 -0400    

Click here for diff

Reported-by: John Naylor  
  
Discussion: https://postgr.es/m/CAFBsxsE-US0sgVxVHjt99GCGky4TCD57gwMHWPF9XWo7R5rXPg@mail.gmail.com  

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

Translation updates

commit   : 6a8a7b1ccbc0e92ce2b301e9aad26a4caedfd9b5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 11:12:42 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 11:12:42 +0200    

Click here for diff

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

M src/backend/po/de.po
M src/backend/po/es.po
M src/backend/po/fr.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/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/ja.po
M src/bin/initdb/po/ru.po
M src/bin/initdb/po/sv.po
M src/bin/initdb/po/uk.po
M src/bin/initdb/po/zh_CN.po
M src/bin/pg_amcheck/nls.mk
M src/bin/pg_amcheck/po/de.po
M src/bin/pg_amcheck/po/el.po
M src/bin/pg_amcheck/po/es.po
M src/bin/pg_amcheck/po/fr.po
A src/bin/pg_amcheck/po/ja.po
A src/bin/pg_amcheck/po/ru.po
A src/bin/pg_amcheck/po/sv.po
A src/bin/pg_amcheck/po/uk.po
M src/bin/pg_amcheck/po/zh_CN.po
M src/bin/pg_archivecleanup/po/de.po
M src/bin/pg_archivecleanup/po/el.po
M src/bin/pg_archivecleanup/po/es.po
M src/bin/pg_archivecleanup/po/fr.po
M src/bin/pg_archivecleanup/po/ja.po
M src/bin/pg_archivecleanup/po/ru.po
M src/bin/pg_archivecleanup/po/sv.po
M src/bin/pg_archivecleanup/po/tr.po
M src/bin/pg_archivecleanup/po/uk.po
M src/bin/pg_archivecleanup/po/zh_CN.po
M src/bin/pg_basebackup/po/de.po
M src/bin/pg_basebackup/po/fr.po
M src/bin/pg_basebackup/po/ja.po
M src/bin/pg_basebackup/po/sv.po
M src/bin/pg_checksums/po/de.po
M src/bin/pg_checksums/po/fr.po
M src/bin/pg_checksums/po/ja.po
M src/bin/pg_checksums/po/sv.po
M src/bin/pg_config/po/el.po
M src/bin/pg_config/po/es.po
M src/bin/pg_config/po/fr.po
M src/bin/pg_config/po/ja.po
M src/bin/pg_config/po/ru.po
M src/bin/pg_config/po/sv.po
M src/bin/pg_config/po/tr.po
M src/bin/pg_config/po/uk.po
M src/bin/pg_config/po/zh_CN.po
M src/bin/pg_controldata/po/de.po
M src/bin/pg_controldata/po/el.po
M src/bin/pg_controldata/po/es.po
M src/bin/pg_controldata/po/fr.po
M src/bin/pg_controldata/po/ja.po
M src/bin/pg_controldata/po/ru.po
M src/bin/pg_controldata/po/sv.po
M src/bin/pg_controldata/po/uk.po
M src/bin/pg_controldata/po/zh_CN.po
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/ja.po
M src/bin/pg_ctl/po/ru.po
M src/bin/pg_ctl/po/sv.po
M src/bin/pg_ctl/po/uk.po
M src/bin/pg_ctl/po/zh_CN.po
M src/bin/pg_dump/po/cs.po
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/ja.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_dump/po/zh_CN.po
M src/bin/pg_resetwal/nls.mk
M src/bin/pg_resetwal/po/de.po
A src/bin/pg_resetwal/po/el.po
M src/bin/pg_resetwal/po/es.po
M src/bin/pg_resetwal/po/fr.po
M src/bin/pg_resetwal/po/ja.po
M src/bin/pg_resetwal/po/ru.po
M src/bin/pg_resetwal/po/sv.po
M src/bin/pg_resetwal/po/uk.po
M src/bin/pg_resetwal/po/zh_CN.po
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/po/de.po
A 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/ja.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_rewind/po/zh_CN.po
M src/bin/pg_test_fsync/po/de.po
M src/bin/pg_test_fsync/po/fr.po
M src/bin/pg_test_fsync/po/ja.po
M src/bin/pg_test_fsync/po/sv.po
M src/bin/pg_test_timing/po/el.po
M src/bin/pg_test_timing/po/fr.po
M src/bin/pg_test_timing/po/ja.po
M src/bin/pg_test_timing/po/ru.po
M src/bin/pg_test_timing/po/sv.po
M src/bin/pg_test_timing/po/uk.po
M src/bin/pg_test_timing/po/zh_CN.po
M src/bin/pg_upgrade/po/cs.po
M src/bin/pg_upgrade/po/de.po
M src/bin/pg_upgrade/po/es.po
M src/bin/pg_upgrade/po/fr.po
M src/bin/pg_upgrade/po/ja.po
M src/bin/pg_upgrade/po/ru.po
M src/bin/pg_upgrade/po/sv.po
M src/bin/pg_upgrade/po/uk.po
M src/bin/pg_upgrade/po/zh_CN.po
M src/bin/pg_verifybackup/po/de.po
M src/bin/pg_verifybackup/po/el.po
M src/bin/pg_verifybackup/po/es.po
M src/bin/pg_verifybackup/po/fr.po
M src/bin/pg_verifybackup/po/ja.po
M src/bin/pg_verifybackup/po/ru.po
M src/bin/pg_verifybackup/po/sv.po
M src/bin/pg_verifybackup/po/uk.po
M src/bin/pg_verifybackup/po/zh_CN.po
M src/bin/pg_waldump/po/de.po
M src/bin/pg_waldump/po/fr.po
M src/bin/pg_waldump/po/ja.po
M src/bin/pg_waldump/po/sv.po
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/ja.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/psql/po/zh_CN.po
M src/bin/scripts/nls.mk
M src/bin/scripts/po/cs.po
M src/bin/scripts/po/de.po
A src/bin/scripts/po/el.po
M src/bin/scripts/po/es.po
M src/bin/scripts/po/fr.po
M src/bin/scripts/po/ja.po
M src/bin/scripts/po/ru.po
M src/bin/scripts/po/sv.po
M src/bin/scripts/po/tr.po
M src/bin/scripts/po/uk.po
M src/bin/scripts/po/zh_CN.po
M src/interfaces/ecpg/ecpglib/nls.mk
A src/interfaces/ecpg/ecpglib/po/el.po
M src/interfaces/ecpg/ecpglib/po/es.po
M src/interfaces/ecpg/ecpglib/po/fr.po
M src/interfaces/ecpg/ecpglib/po/ja.po
M src/interfaces/ecpg/ecpglib/po/ru.po
M src/interfaces/ecpg/ecpglib/po/sv.po
M src/interfaces/ecpg/ecpglib/po/uk.po
M src/interfaces/ecpg/ecpglib/po/zh_CN.po
M src/interfaces/ecpg/preproc/nls.mk
M src/interfaces/ecpg/preproc/po/cs.po
M src/interfaces/ecpg/preproc/po/de.po
A src/interfaces/ecpg/preproc/po/el.po
M src/interfaces/ecpg/preproc/po/es.po
M src/interfaces/ecpg/preproc/po/fr.po
M src/interfaces/ecpg/preproc/po/ja.po
M src/interfaces/ecpg/preproc/po/ru.po
M src/interfaces/ecpg/preproc/po/sv.po
M src/interfaces/ecpg/preproc/po/tr.po
M src/interfaces/ecpg/preproc/po/uk.po
M src/interfaces/ecpg/preproc/po/zh_CN.po
M src/interfaces/libpq/po/de.po
M src/interfaces/libpq/po/el.po
M src/interfaces/libpq/po/es.po
M src/interfaces/libpq/po/fr.po
M src/interfaces/libpq/po/ja.po
M src/interfaces/libpq/po/ru.po
M src/interfaces/libpq/po/sv.po
M src/interfaces/libpq/po/uk.po
M src/interfaces/libpq/po/zh_CN.po
M src/pl/plperl/po/de.po
M src/pl/plperl/po/el.po
M src/pl/plperl/po/es.po
M src/pl/plperl/po/fr.po
M src/pl/plperl/po/ja.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/plperl/po/zh_CN.po
M src/pl/plpgsql/src/nls.mk
M src/pl/plpgsql/src/po/de.po
A src/pl/plpgsql/src/po/el.po
M src/pl/plpgsql/src/po/es.po
M src/pl/plpgsql/src/po/fr.po
M src/pl/plpgsql/src/po/ja.po
M src/pl/plpgsql/src/po/ru.po
M src/pl/plpgsql/src/po/sv.po
M src/pl/plpgsql/src/po/uk.po
M src/pl/plpgsql/src/po/zh_CN.po
M src/pl/plpython/po/el.po
M src/pl/plpython/po/es.po
M src/pl/plpython/po/fr.po
M src/pl/plpython/po/ja.po
M src/pl/plpython/po/ru.po
M src/pl/plpython/po/sv.po
M src/pl/plpython/po/uk.po
M src/pl/plpython/po/zh_CN.po
M src/pl/tcl/po/de.po
M src/pl/tcl/po/el.po
M src/pl/tcl/po/es.po
M src/pl/tcl/po/fr.po
M src/pl/tcl/po/ja.po
M src/pl/tcl/po/ru.po
M src/pl/tcl/po/sv.po
M src/pl/tcl/po/uk.po
M src/pl/tcl/po/zh_CN.po

pg_upgrade: Add missing gettext triggers

commit   : cd690e07fd47f245df02ab461754755956bf3e00    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 09:41:02 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 09:41:02 +0200    

Click here for diff

Forgot to add it in one place in the previous commit.  

M src/bin/pg_upgrade/nls.mk

pg_upgrade: Add missing gettext triggers

commit   : cd46d42a515918e88ae8ccb5990d59b3ad451455    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 08:55:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 16 May 2022 08:55:01 +0200    

Click here for diff

prep_status_progress() is new.  

M src/bin/pg_upgrade/nls.mk

Fix incorrect row estimates used for Memoize costing

commit   : 1e731ed12aac3f2ed99cf13244f5a1571a6eb6e6    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 16 May 2022 16:07:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 16 May 2022 16:07:56 +1200    

Click here for diff

In order to estimate the cache hit ratio of a Memoize node, one of the  
inputs we require is the estimated number of times the Memoize node will  
be rescanned.  The higher this number, the large the cache hit ratio is  
likely to become.  Unfortunately, the value being passed as the number of  
"calls" to the Memoize was incorrectly using the Nested Loop's  
outer_path->parent->rows instead of outer_path->rows.  This failed to  
account for the fact that the outer_path might be parameterized by some  
upper-level Nested Loop.  
  
This problem could lead to Memoize plans appearing more favorable than  
they might actually be.  It could also lead to extended executor startup  
times when work_mem values were large due to the planner setting overly  
large MemoizePath->est_entries resulting in the Memoize hash table being  
initially made much larger than might be required.  
  
Fix this simply by passing outer_path->rows rather than  
outer_path->parent->rows.  Also, adjust the expected regression test  
output for a plan change.  
  
Reported-by: Pavel Stehule  
Author: David Rowley  
Discussion: https://postgr.es/m/CAFj8pRAMp%3DQsMi6sPQJ4W3hczoFJRvyXHJV3AZAZaMyTVM312Q%40mail.gmail.com  
Backpatch-through: 14, where Memoize was introduced  

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

commit   : 5bcc4d09332844ae369bcf99f18ace1c982b7301    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 14 May 2022 09:57:03 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 14 May 2022 09:57:03 +0200    

Click here for diff

Reaction to a suggestion from jhebert@micron.com, though this doesn't  
directly address the complaint.  
  
Discussion: https://postgr.es/m/165117307860.683.10308862820133754390@wrigleys.postgresql.org  

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

commit   : dce7072e5106456a1f1f003c2fcc2d7901ab89d8    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 14 May 2022 09:03:16 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 14 May 2022 09:03:16 +0200    

Click here for diff

Suggested by David G. Johnston <david.g.johnston@gmail.com>  
  
Discussion: https://postgr.es/m/CAKFQuwYK4OqwoHscZi3yws-urv3NvVfoKHessyso5D=5qqChYQ@mail.gmail.com  

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

Fix slow animal timeouts in 032_relfilenode_reuse.pl.

commit   : 93759c665d482b5bf76ca22c9cac91e713e9386e    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 May 2022 11:58:10 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 14 May 2022 11:58:10 +1200    

Click here for diff

Per BF animal chipmunk:  CREATE DATABASE could apparently fail due to an  
AV process being in the template database and not quitting fast enough  
for the 5 second timeout in CountOtherDBBackends().  The test script had  
autovacuum_naptime=1s to encourage more activity and opening of fds, but  
that wasn't strictly necessary for this test.  Take it out.  
  
Per BF animal skink:  there was a 300s timeout for all tests in the  
script, but apparently that was not enough under valgrind.  Let's use  
the standard timeout $PostgreSQL::Test::Utils::timeout_default, but  
restart it for each query we run.  
  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/CA%2BhUKGKa8HNJaA24gqiiFoGy0ysndeVoJsHvX_q1-DVLFaGAmw%40mail.gmail.com  

M src/test/recovery/t/032_relfilenode_reuse.pl

Fix comment in pg_proc.c

commit   : fcab82a2d79b4533cfdc8e8d5e00dbdf6830d63a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 May 2022 08:27:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 14 May 2022 08:27:59 +0900    

Click here for diff

pgstat_create_function() creates stats for a function in a transactional  
fashion, so the stats would be dropped if transaction creating the  
function is aborted, not committed.  
  
Author: Amul Sul  
Discussion: https://postgr.es/m/CAAJ_b97x1T3xgAMWNj4w7kSgN0nTuG-vLrQJ4NB-dsNr0Kudxw@mail.gmail.com  

M src/backend/catalog/pg_proc.c

Clean up newlines following left parentheses

commit   : c4f113e8fef900e9e7e7c77a3a21db1535e5be72    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 13 May 2022 23:52:35 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 13 May 2022 23:52:35 +0200    

Click here for diff

Like commit c9d297751959.  

M src/backend/executor/nodeAgg.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/ipc/standby.c

relnotes: add null logical replication item

commit   : 3715850ecc524544546e696bb0a7bbc44095d12a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 13 May 2022 11:50:24 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 13 May 2022 11:50:24 -0400    

Click here for diff

Also move system view item to logical replication, mention "infinite  
_error_ loops".  
  
Reported-by: Euler Taveira, Takamichi Osumi, Amit Langote  
  
Discussion: https://postgr.es/m/21e8ef3b-6ffb-49d8-867f-4622a4dffcf3@www.fastmail.com  

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

Rename JsonIsPredicate.value_type, fix JSON backend/nodes/ infrastructure.

commit   : 3ab9a63cb638a1fd99475668e2da9c237495aeda    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 13 May 2022 11:40:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 13 May 2022 11:40:01 -0400    

Click here for diff

I started out with the intention to rename value_type to item_type to  
avoid a collision with a typedef name that appears on some platforms.  
  
Along the way, I noticed that the adjacent field "format" was not being  
correctly handled by the backend/nodes/ infrastructure functions:  
copyfuncs.c erroneously treated it as a scalar, while equalfuncs,  
outfuncs, and readfuncs omitted handling it at all.  This looks like  
it might be cosmetic at the moment because the field is always NULL  
after parse analysis; but that's likely a bug in itself, and the code's  
certainly not very future-proof.  Let's fix it while we can still do so  
without forcing an initdb on beta testers.  
  
Further study found a few other inconsistencies in the backend/nodes/  
infrastructure for the recently-added JSON node types, so fix those too.  
  
catversion bumped because of potential change in stored rules.  
  
Discussion: https://postgr.es/m/526703.1652385613@sss.pgh.pa.us  

M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/catversion.h
M src/include/nodes/makefuncs.h
M src/include/nodes/primnodes.h

Indent protocol.sgml

commit   : 2454cb07eed1ec7e68b9953b03d473d3c334ba05    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 May 2022 16:14:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 May 2022 16:14:16 +0200    

Click here for diff

protocol.sgml had some unusual indentation that kept getting added on  
to with new additions in that file.  This reindents it to be more in  
line with the style elsewhere.  
  
Discussion: https://www.postgresql.org/message-id/flat/15113594-649b-ce82-24c8-7522f1373da4%40enterprisedb.com  

M doc/src/sgml/protocol.sgml

Add a new shmem_request_hook hook.

commit   : 4f2400cb3f10aa79f99fba680c198237da28dd38    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 13 May 2022 09:31:06 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 13 May 2022 09:31:06 -0400    

Click here for diff

Currently, preloaded libraries are expected to request additional  
shared memory and LWLocks in _PG_init().  However, it is not unusal  
for such requests to depend on MaxBackends, which won't be  
initialized at that time.  Such requests could also depend on GUCs  
that other modules might change.  This introduces a new hook where  
modules can safely use MaxBackends and GUCs to request additional  
shared memory and LWLocks.  
  
Furthermore, this change restricts requests for shared memory and  
LWLocks to this hook.  Previously, libraries could make requests  
until the size of the main shared memory segment was calculated.  
Unlike before, we no longer silently ignore requests received at  
invalid times.  Instead, we FATAL if someone tries to request  
additional shared memory or LWLocks outside of the hook.  
  
Nathan Bossart and Julien Rouhaud  
  
Discussion: https://postgr.es/m/20220412210112.GA2065815%40nathanxps13  
Discussion: https://postgr.es/m/Yn2jE/lmDhKtkUdr@paquier.xyz  

M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h
M src/tools/pgindent/typedefs.list

Doc: Improve description of the "parallel_commit" option for postgres_fdw.

commit   : 8c8d307f82976122980bbccf940319d1b8a71403    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 13 May 2022 18:30:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 13 May 2022 18:30:00 +0900    

Click here for diff

It wasn't very clear that if this option was enabled, postgres_fdw would  
commit remote transactions in parallel at main-transaction end, and  
commit remote subtransactions in parallel at subtransaction end, due to  
the references to (sub)transaction and other too specific documentation.  
Clarify that.  Also reword to simplify.  
  
Follow-up for commit 04e706d42.  
  
Jonathan S. Katz, reviewed by Justin Pryzby, with some modifications by  
me.  
  
Discussion: https://postgr.es/m/1435bfd1-172b-de38-f590-4404a5a62eb0%40postgresql.org  

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

Indent C code in flex and bison files

commit   : 30ed71e423ee63b263730b86326da2a629a29f84    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 May 2022 07:17:29 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 13 May 2022 07:17:29 +0200    

Click here for diff

In the style of pgindent, done semi-manually.  
  
Discussion: https://www.postgresql.org/message-id/flat/7d062ecc-7444-23ec-a159-acd8adf9b586%40enterprisedb.com  

M contrib/cube/cubeparse.y
M contrib/seg/segparse.y
M src/backend/bootstrap/bootparse.y
M src/backend/parser/gram.y
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/guc-file.l
M src/bin/pgbench/exprparse.y
M src/interfaces/ecpg/preproc/pgc.l
M src/pl/plpgsql/src/pl_gram.y

Don't report stats in LogicalRepApplyLoop() when in xact.

commit   : 0cf16cb8ca4853b084c40eca310c4c9c3ebf7e2a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 18:49:33 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 18:49:33 -0700    

Click here for diff

pgstat_report_stat() is only supposed to be called outside of transactions. In  
5891c7a8ed8 I added a pgstat_report_stat() call into LogicalRepApplyLoop()'s  
timeout branch. While not commonly reached inside a transaction, it is  
reachable (e.g. due to network bottlenecks or the sender being stalled / slow  
for some reason).  
  
To fix, add a !IsTransactionState() check.  
  
No test added because there's no easy way to reproduce this case without  
patching the code.  
  
Reported-By: Erik Rijkers <er@xs4all.nl>  
Discussion: https://postgr.es/m/b3463b8c-2328-dcac-0136-af95715493c1@xs4all.nl  

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

Remove PGDLLIMPORT marker from __pg_log_level

commit   : 8d3341266508fc1aed1f1a6bdb4ed885821c81b0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 May 2022 09:39:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 13 May 2022 09:39:13 +0900    

Click here for diff

Per discussion with Tom Lane and Andres Freund.  I have misunderstood  
the intention behind the choice done in 9a374b7.  
  
Discussion: https://postgr.es/m/20220512153737.6kbbcf4qyvwgq4s2@alap3.anarazel.de  

M src/include/common/logging.h

Remove function declaration for function in pg_proc.

commit   : 07d683b54af854098cc559d4b8640905f9efa0ea    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:25:14 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:25:14 -0700    

Click here for diff

The declaration is automatically generated. Noticed when experimenting with  
adding PGDLLIMPORT markers for functions.  
  
Discussion: https://postgr.es/m/20220512164513.vaheofqp2q24l65r@alap3.anarazel.de  

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

Add missing binary_upgrade.h includes.

commit   : 0699b1ae2d8e7b8763a2019d9cd651ab55521779    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:20:36 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:20:36 -0700    

Click here for diff

A few places used binary_upgrade_* variables without including the header,  
which worked without warnings because the variables are defined in those  
places. However that can cause linker complaints with MSVC - except that we  
don't see them right now, due to the use of a symbol export file.  
  
Discussion: https://postgr.es/m/20220512164513.vaheofqp2q24l65r@alap3.anarazel.de  

M src/backend/catalog/heap.c
M src/backend/commands/tablespace.c

Add 'static' to file-local variables missing it.

commit   : 09cd33f47bb32f904c32b5aabe607a5125159cc4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:19:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:19:04 -0700    

Click here for diff

Noticed when comparing the set of exported symbols without / with  
-fvisibility=hidden after adding PGDLLIMPORT to intentionally exported  
symbols.  
  
Discussion: https://postgr.es/m/20220512164513.vaheofqp2q24l65r@alap3.anarazel.de  

M src/backend/access/common/reloptions.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/xact.c
M src/backend/catalog/storage.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/tcop/cmdtag.c

Add missing 'extern' to function prototypes.

commit   : 905c020bef99e16b37529203084cd93932e73805    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:17:14 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:17:14 -0700    

Click here for diff

Postgres style is to spell out extern. Noticed while scripting adding  
PGDLLIMPORT markers to functions.  
  
Discussion: https://postgr.es/m/20220512164513.vaheofqp2q24l65r@alap3.anarazel.de  

M src/include/access/rewriteheap.h
M src/include/port/win32_port.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/reorderbuffer.h
M src/include/replication/worker_internal.h
M src/include/storage/s_lock.h
M src/include/tsearch/dicts/regis.h
M src/include/utils/attoptcache.h
M src/include/utils/numeric.h
M src/include/utils/pgstat_internal.h
M src/include/utils/spccache.h

Do pre-release housekeeping on catalog data.

commit   : c2f436151edc818601c2499e400e1ad53d0da66f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:35:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:35:15 -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 6205  

M src/include/catalog/catversion.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h

Add 23e7b38bf to git-blame-ignore-revs.

commit   : 03501aceae5d27bf5a23942035299d52600e3279    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:22:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:22:20 -0400    

Click here for diff

M .git-blame-ignore-revs

Pre-beta mechanical code beautification.

commit   : 23e7b38bfe396f919fdb66057174d29e17086418    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:17:30 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 15:17:30 -0400    

Click here for diff

Run pgindent, pgperltidy, and reformat-dat-files.  
I manually fixed a couple of comments that pgindent uglified.  

M config/check_modules.pl
M contrib/amcheck/verify_heapam.c
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/btree_gist/btree_bool.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/openssl.c
M contrib/pgstattuple/pgstattuple.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/common/toast_internals.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/storage.c
M src/backend/commands/analyze.c
M src/backend/commands/collationcmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain.c
M src/backend/commands/extension.c
M src/backend/commands/matview.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/lib/dshash.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/value.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/regc_pg_locale.c
M src/backend/replication/backup_manifest.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_zstd.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/page/bufpage.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/util.c
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/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/pg_waldump.c
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/common.c
M src/bin/psql/describe.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/tab-complete.c
M src/bin/scripts/t/020_createdb.pl
M src/common/compression.c
M src/common/cryptohash_openssl.c
M src/common/exec.c
M src/include/access/amapi.h
M src/include/access/heapam.h
M src/include/access/rmgr.h
M src/include/access/xact.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/catalog/objectaccess.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/renumber_oids.pl
M src/include/commands/publicationcmds.h
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/fmgr.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/paths.h
M src/include/parser/analyze.h
M src/include/parser/parse_param.h
M src/include/port.h
M src/include/postmaster/pgarch.h
M src/include/replication/basebackup_target.h
M src/include/replication/decode.h
M src/include/replication/slot.h
M src/include/storage/latch.h
M src/include/tcop/tcopprot.h
M src/include/utils/formatting.h
M src/include/utils/jsonpath.h
M src/include/utils/rel.h
M src/include/utils/relmapper.h
M src/include/utils/selfuncs.h
M src/include/utils/sortsupport.h
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/t/002_api.pl
M src/test/icu/t/010_database.pl
M src/test/ldap/t/001_auth.pl
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/perl/PostgreSQL/Test/Cluster.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/006_logical_decoding.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/027_stream_regress.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/regress/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/007_ddl.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl
M src/tools/PerfectHash.pm
M src/tools/ci/windows_build_config.pl
M src/tools/mark_pgdllimport.pl
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/vcregress.pl
M src/tools/pgindent/typedefs.list

libpq: drop pending pipelined commands in pqDropConnection().

commit   : 93909599cdba64c8759d646983c0a4ef93de1e50    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 12:42:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 12:42:29 -0400    

Click here for diff

The original coding did this in pqDropServerData(), which seems  
fairly backwards.  Pending commands are more like already-queued  
output data, which is dropped in pqDropConnection().  Moving the  
operation means that we clear the command queue immediately upon  
detecting connection drop, which improves the sanity of subsequent  
behavior.  In particular this eliminates duplicated error message  
text as a consequence of code added in b15f25446, which supposed  
that a nonempty command queue must mean the prior operation is  
still active.  
  
There might be an argument for backpatching this to v14; but as with  
b15f25446, I'm unsure about interactions with 618c16707.  For now,  
given the lack of complaints about v14's behavior, leave it alone.  
  
Per report from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/de57761c-b99b-3435-b0a6-474c72b1149a@enterprisedb.com  

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

commit   : b5f44225b833a2fd07b4a7c77e33ae0c37e6a7d6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:10:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 12 May 2022 09:10:03 -0700    

Click here for diff

Discussion: https://postgr.es/m/20220506234924.6mxxotl3xl63db3l@alap3.anarazel.de  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M src/backend/replication/basebackup_copy.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_progress.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_throttle.c
M src/backend/replication/basebackup_zstd.c

Make pull_var_clause() handle GroupingFuncs exactly like Aggrefs.

commit   : 79b58c6f684315d39dfdbd721da7576d90bd9f99    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 11:31:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 12 May 2022 11:31:46 -0400    

Click here for diff

This follows in the footsteps of commit 2591ee8ec by removing one more  
ill-advised shortcut from planning of GroupingFuncs.  It's true that  
we don't intend to execute the argument expression(s) at runtime, but  
we still have to process any Vars appearing within them, or we risk  
failure at setrefs.c time (or more fundamentally, in EXPLAIN trying  
to print such an expression).  Vars in upper plan nodes have to have  
referents in the next plan level, whether we ever execute 'em or not.  
  
Per bug #17479 from Michael J. Sullivan.  Back-patch to all supported  
branches.  
  
Richard Guo  
  
Discussion: https://postgr.es/m/17479-6260deceaf0ad304@postgresql.org  

M src/backend/optimizer/util/var.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql

relnotes: adjust several logical replication items and FK text

commit   : 25285e5d4ee5b5655ddf93204180aedc873f19d6    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Thu, 12 May 2022 10:11:55 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Thu, 12 May 2022 10:11:55 -0400    

Click here for diff

Reported-by: Amit Langote, Amit Kapila, Takamichi Osumi  
  
Discussion: https://postgr.es/m/CAA4eK1KdAho_fNkYRe=o=XpxWs_TG4O0V8CJBAvTG8HamWt6OQ@mail.gmail.com  

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

postgres_fdw: Update comments in make_new_connection().

commit   : 4036bcbbb92839f20ed6d0db418996954dd66470    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 12 May 2022 17:30:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 12 May 2022 17:30:00 +0900    

Click here for diff

Expand the comment about the parallel_commit option to mention that the  
default is false.  
  
Also, since the comment about alteration of the keep_connections option,  
which was located above the expanded comment, holds true for the  
parallel_commit option, rewrite it to reflect this, and move it to after  
the expanded comment.  
  
Follow-up for commit 04e706d42.  
  
Discussion: https://postgr.es/m/CAPmGK16Kg2Bf90sqzcZ4YM5cN_G-4h7wFUS01qQpqNB%2B2BG5_w%40mail.gmail.com  

M contrib/postgres_fdw/connection.c

Add some missing PGDLLIMPORT markings

commit   : 5edeb574285ecbcc47f0b769a7e363404db0155b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 May 2022 15:08:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 12 May 2022 15:08:45 +0900    

Click here for diff

Three variables in pqsignal.h (UnBlockSig, BlockSig and StartupBlockSig)  
were not marked with PGDLLIMPORT, as they are declared in a way that  
prevents mark_pgdllimport.pl to detect them.  These variables are  
redefined in a style more consistent with the other headers, allowing  
the script to find and mark them.  
  
PGDLLIMPORT was missing for __pg_log_level in logging.h, so add it  
back.  The marking got accidentally removed in 9a374b77, just after its  
addition in 8ec5694.  
  
While on it, add a comment in mark_pgdllimport.pl explaining what are  
the arguments needed by the script (aka a list of header paths).  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20220506234924.6mxxotl3xl63db3l@alap3.anarazel.de  

M src/include/common/logging.h
M src/include/libpq/pqsignal.h
M src/tools/mark_pgdllimport.pl

relnotes: mention non-exclusive backup mode was deprecated

commit   : 6bfecf33f6ed558deee4f801e296b058261dbef3    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:46:36 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:46:36 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=j9VhsFXuN+xv5qzxQV7gj-6TKqqwVLSgz5zU7F8nHCYw@mail.gmail.com  

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

Use correct datum macros in more tuplesort specialization functions.

commit   : 7761b9faabae15217fe0e5bbb54230b425222f81    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 12 May 2022 09:18:21 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 12 May 2022 09:18:21 +0700    

Click here for diff

Also clarify that ApplySignedSortComparator() is not built on 32-bit machines.  
  
Folow-up to c90c16591  
  
Reviewed-by: David Rowley  
Discussion: https://www.postgresql.org/message-id/CAFBsxsFmt4_JUP8XgSJqwaAS9a9s8K8_PvMu%3Dj%3DDfwU%3D8QjNPw%40mail.gmail.com  

M src/include/utils/sortsupport.h

relnotes: add author to in-memory sorts item

commit   : d70b95a7178af84212487438b5509871090f5b05    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:19:12 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:19:12 -0400    

Click here for diff

Reported-by: Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGKha50-H2ye-9x3PJWU5wBq_MPc2rmVKM1xJ0tL+ntROw@mail.gmail.com  

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

relnotes: update for non-exclusive backup mode removal

commit   : da82c62469865e11c29881b42e955482194ca781    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:01:46 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 22:01:46 -0400    

Click here for diff

Reported-by: Ian Lawrence Barwick  
  
Discussion: https://postgr.es/m/CAB8KJ=jmLBMAmxjcew12-yntb7m3FH-8A2+Qb7+RybZp1w9GOg@mail.gmail.com  

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

relnote: improve sorting entries

commit   : 922d1a27e9bd3415522a5ec5578c7c1324b16b93    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 20:55:01 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 20:55:01 -0400    

Click here for diff

Reported-by: David Rowley  
  
Discussion: https://postgr.es/m/CAApHDvrToHFvL-W03vSi6T50uScyhrdUGzTtcuLAjdjtRF8FLA@mail.gmail.com  

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

Remove non-functional code for unloading loadable modules.

commit   : ab02d702ef08343fba30d90fdf7df5950063e8c9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 11 May 2022 15:27:33 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 11 May 2022 15:27:33 -0400    

Click here for diff

The code for unloading a library has been commented-out for over 12  
years, ever since commit 602a9ef5a7c60151e10293ae3c4bb3fbb0132d03, and we're  
no closer to supporting it now than we were back then.  
  
Nathan Bossart, reviewed by Michael Paquier and by me.  
  
Discussion: http://postgr.es/m/Ynsc9bRL1caUSBSE@paquier.xyz  

M contrib/auto_explain/auto_explain.c
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/pgarch.c
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/include/fmgr.h
M src/pl/plpgsql/src/plpgsql.h
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c

relnotes: adjustments from Álvaro Herrera

commit   : 78ccd6cca48dab098fcce62528c2b471f7a0010a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 11:28:29 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 11:28:29 -0400    

Click here for diff

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

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

relnotes: update foreign key partition and add sort items

commit   : 279d957efebb4fe0636981cf0354b310fd2a109b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 10:45:17 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 11 May 2022 10:45:17 -0400    

Click here for diff

Reported-by: David Rowley, Amit Langote  
  
Discussion: https://postgr.es/m/CA+HiwqFcEdbNinfK94aTgBJKmtkYGdtkPnjt3b0fVzKi+WZ+KA@mail.gmail.com  

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

Fix typos and grammar in code and test comments

commit   : 45edde037efc6ec76714e0be7309b348fe34351e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 15:38:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 15:38:55 +0900    

Click here for diff

This fixes the grammar of some comments in a couple of tests (SQL and  
TAP), and in some C files.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220511020334.GH19626@telsasoft.com  

M contrib/citext/expected/citext.out
M contrib/citext/expected/citext_1.out
M contrib/citext/sql/citext.sql
M src/backend/executor/execGrouping.c
M src/backend/parser/parse_expr.c
M src/backend/replication/basebackup_target.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

Add logging for excessive ProcSignalBarrier waits.

commit   : 0d3431497dbe91ba1e428ace4e9537c109eaff07    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 11 May 2022 18:03:03 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Wed, 11 May 2022 18:03:03 +1200    

Click here for diff

To enable diagnosis of systems that are not processing ProcSignalBarrier  
requests promptly, add a LOG message every 5 seconds if we seem to be  
wedged.  Although you could already see this state as a wait event in  
pg_stat_activity, the log message also shows the PID of the process that  
is preventing progress.  
  
Also add DEBUG1 logging around the whole wait loop.  
  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/CA%2BTgmoYJ03r5359gQutRGP9BtigYCg3_UskcmnVjBf-QO3-0pQ%40mail.gmail.com  

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

Fix the logical replication timeout during large transactions.

commit   : f95d53eded55ecbf037f6416ced6af29a2c3caca    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 11 May 2022 11:11:44 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 11 May 2022 11:11:44 +0530    

Click here for diff

The problem is that we don't send keep-alive messages for a long time  
while processing large transactions during logical replication where we  
don't send any data of such transactions. This can happen when the table  
modified in the transaction is not published or because all the changes  
got filtered. We do try to send the keep_alive if necessary at the end of  
the transaction (via WalSndWriteData()) but by that time the  
subscriber-side can timeout and exit.  
  
To fix this we try to send the keepalive message if required after  
processing certain threshold of changes.  
  
Reported-by: Fabrice Chapuis  
Author: Wang wei and Amit Kapila  
Reviewed By: Masahiko Sawada, Euler Taveira, Hou Zhijie, Hayato Kuroda  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAA5-nLARN7-3SLU_QUxfy510pmrYK6JJb=bk3hcgemAM_pAv+w@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/include/replication/logical.h

Silence extra logging when using "postgres -C" on runtime-computed GUCs

commit   : 8bbf8461a3a2a38ce5f2952a025385b6938a61f7    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 14:21:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 14:21:06 +0900    

Click here for diff

Presently, the server may emit a variety of log messages when inspecting  
a runtime-computed GUC, mostly in the shape of one LOG message with the  
default configuration, related to the startup sequence launched as such  
GUCs require a load of the control file and of external shared  
libraries.  
  
For example, the server will always emit a "database system is shut  
down" LOG (unless the user has set log_min_messages higher than LOG),  
which is an annoying behavior as "postgres -C" is expected to only emit  
in its output the parameter value we are looking for.  The parameter  
value is sent to stdout, while the logs are sent to stderr so we could  
recommend to use a redirection, but there was not much love for this  
workaround either.  
  
To avoid such extra log messages, per discussion, this change sets  
log_min_messages to FATAL internally when -C is used on a  
runtime-computed GUC (even if set to PANIC in postgresql.conf).  At  
FATAL, the user will still receive messages explaining why a GUC value  
cannot be inspected, and will know if the command is attempted on a  
server already running, something not supported yet for a  
runtime-computed GUC.  
  
Reported-by: Magnus Hagander, Bruce Momjian  
Author: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/Yni6ZHkGotUU+RSf@paquier.xyz  

M doc/src/sgml/runtime.sgml
M src/backend/postmaster/postmaster.c

Add missing source files to nls.mk

commit   : 3aa7a3d2a3d1177d32680b94541dc2db7f3d7b0b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 May 2022 06:16:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 11 May 2022 06:16:21 +0200    

Click here for diff

M src/bin/psql/nls.mk
M src/interfaces/libpq/nls.mk

relnotes: more adjustments

commit   : 38fbbb5bb293c4cceebb130b42357a2d6ee8d294    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 23:41:26 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 23:41:26 -0400    

Click here for diff

Reported-by: Justin Pryzby  
  
Discussion: https://postgr.es/m/20220511013117.GG19626@telsasoft.com  

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

relnotes: logical replication permissions checked by subscrib.

commit   : 581c4e5b31853045473949822bcd0c90daf850fb    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 22:10:45 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 22:10:45 -0400    

Click here for diff

Reported-by: Mark Dilger  
  
Discussion: https://postgr.es/m/F3D44160-F41A-4F2E-AED5-5C15B6903AC4@enterprisedb.com  

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

relnotes: adjustments

commit   : a3c5f56c213e5799f7f5eb08890f6ddebacbb83c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 21:57:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 21:57:11 -0400    

Click here for diff

Remove SSL item backpatched (Jonathan S. Katz), adjust logical  
replication item (Mark Dilger), adjust --compress wording (Justin  
Pryzby).  
  
Discussion: https://postgr.es/m/20220511012854.GF19626@telsasoft.com  

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

Improve setup of environment values for commands in MSVC's vcregress.pl

commit   : 0826ac89ac18ab05b9991cfbba72351a502ef12c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 10:21:52 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 11 May 2022 10:21:52 +0900    

Click here for diff

The current setup assumes that commands for lz4, zstd and gzip always  
exist by default if not enforced by a user's environment.  However,  
vcpkg, as one example, installs libraries but no binaries, so this  
default setup to assume that a command should always be present would  
cause failures.  This commit improves the detection of such external  
commands as follows:  
* If a ENV value is available, trust the environment/user and use it.  
* If a ENV value is not available, check its execution by looking in the  
current PATH, by launching a simple "$command --version" (that should be  
portable enough).  
** On execution failure, ignore ENV{command}.  
** On execution success, set ENV{command} = "$command".  
  
Note that this new rule applies to gzip, lz4 and zstd but not tar that  
we assume will always exist.  Those commands are set up in the  
environment only when using bincheck and taptest.  The CI includes all  
those commands and I have checked that their setup is correct there.  I  
have also tested this change in a MSVC environment where we have none of  
those commands.  
  
While on it, remove the references to lz4 from the documentation and  
vcregress.pl in ~v13.  --with-lz4 has been added in v14~ so there is no  
point to have this information in these older branches.  
  
Reported-by: Andrew Dunstan  
Reviewed-by: Andrew Dunstan  
Discussion: https://postgr.es/m/14402151-376b-a57a-6d0c-10ad12608e12@dunslane.net  
Backpatch-through: 10  

M src/tools/msvc/vcregress.pl

Fix some incorrect preprocessor tests in tuplesort specializations

commit   : c90c16591c438e4146b1d4b9e4539f80b58845ba    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 11 May 2022 11:38:13 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 11 May 2022 11:38:13 +1200    

Click here for diff

697492434 added 3 new quicksort specialization functions for common  
datatypes.  
  
That commit was not very consistent in how it would determine if we're  
compiling for 32-bit or 64-bit machines.  It would sometimes use  
USE_FLOAT8_BYVAL and at other times check if SIZEOF_DATUM == 8.  This  
could cause theoretical problems due to the way USE_FLOAT8_BYVAL is now  
defined based on SIZEOF_VOID_P >= 8.  If pointers for some reason were  
ever larger than 8-bytes then we'd end up doing 32-bit comparisons  
mistakenly.  Let's just always check SIZEOF_DATUM >= 8.  
  
It also seems that ssup_datum_signed_cmp is just never used on 32-bit  
builds, so let's just ifdef that out to make sure we never accidentally  
use that comparison function on such machines.  This also allows us to  
ifdef out 1 of the 3 new specialization quicksort functions in 32-bit  
builds which seems to shrink down the binary by over 4KB on my machine.  
  
In passing, also add the missing DatumGetInt32() / DatumGetInt64() macros  
in the comparison functions.  
  
Discussion: https://postgr.es/m/CAApHDvqcQExRhtRa9hJrJB_5egs3SUfOcutP3m+3HO8A+fZTPA@mail.gmail.com  
Reviewed-by: John Naylor  

M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

configure: don't probe for libldap_r if libldap is 2.5 or newer.

commit   : aff45c879e018d18951a9bc4cd8e2a395ee52c43    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 May 2022 18:42:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 10 May 2022 18:42:02 -0400    

Click here for diff

In OpenLDAP 2.5 and later, libldap itself is always thread-safe and  
there's never a libldap_r.  Our existing coding dealt with that  
by assuming it wouldn't find libldap_r if libldap is thread-safe.  
But that rule fails to cope if there are multiple OpenLDAP versions  
visible, as is likely to be the case on macOS in particular.  We'd  
end up using shiny new libldap in the backend and a hoary libldap_r  
in libpq.  
  
Instead, once we've found libldap, check if it's >= 2.5 (by  
probing for a function introduced then) and don't bother looking  
for libldap_r if so.  While one can imagine library setups that  
this'd still give the wrong answer for, they seem unlikely to  
occur in practice.  
  
Per report from Peter Eisentraut.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/fedacd7c-2a38-25c9-e7ff-dea549d0e979@enterprisedb.com  

M configure
M configure.ac

relnotes: adjust sections for various items

commit   : b0d4b3c386f5372474575a4eeba2450951d9b44a    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 17:49:51 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 17:49:51 -0400    

Click here for diff

Also improve postgres_fdw.application_name  
  
Reported-by: Justin Pryzby, Tatsuo Ishii  
  
Diagnosed-by: 20220510210235.GD19626@telsasoft.com  

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

relnote: add ARM64 spinlock item

commit   : 40131af573514d9915798f5fa6399ddc3d214937    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:47:48 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:47:48 -0400    

Click here for diff

Reported-by: Jonathan Katz  
  
Discussion: per private email  

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

relnotes: remove sequence replication and update 'postgres -C'

commit   : 653443ed83f03820d29604b65dca6a56f3f8ab06    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:34:11 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:34:11 -0400    

Click here for diff

Reported-by: Nathan Bossart, Jonathan Katz  
  
Discussion: https://postgr.es/m/20220510194456.GA3716556@nathanxps13  

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

relnote: extensive updates

commit   : 9d89bb8a025d0374f7705cea9fead4eae9ae80ed    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:05:12 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 16:05:12 -0400    

Click here for diff

Reported-by: Erik Rijkers, Justin Pryzby  
  
Discussion: https://postgr.es/m/20220510180935.GB19626@telsasoft.com  

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

Formatting and punctuation improvements in sample configuration files

commit   : 9700b250c5b84a083261add9f6e3507c9c72e076    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 21:15:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 21:15:56 +0200    

Click here for diff

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

Remove some tabs in SQL code in C string literals

commit   : 93e6892f6717d5777c9decef301728e8bb3f011b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 20:57:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 20:57:37 +0200    

Click here for diff

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

M src/bin/psql/describe.c

doc: Update SQL keywords for SQL:2016 technical corrigenda

commit   : a9c018565eb306b5a884c31ca6e26efed4dfc774    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 20:31:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 10 May 2022 20:31:13 +0200    

Click here for diff

Several keywords were missing or misclassified in the original  
SQL:2016 standard.  This has been corrected in later technical  
corrigenda.  This change updates the PostgreSQL documentation  
accordingly.  
  
This also fixes a mistake in 606948b058d: The keywords JSON_SCALAR and  
JSON_SERIALIZE added there are not from SQL:2016 but from future  
SQL:202x, so they don't belong in that list yet.  
  
(606948b058d also added JSON to the reserved list, which is what the  
corrigendum also does, but failed to remove it from the nonreserved  
list.)  

M doc/src/sgml/keywords/sql2016-02-nonreserved.txt
M doc/src/sgml/keywords/sql2016-02-reserved.txt

relnotes: "training" -> "trailing"

commit   : 3c534949bbb0c7f312175879d1bf7de4f336c6e1    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 12:51:25 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 12:51:25 -0400    

Click here for diff

Reported-by: Geoff Winkless  
  
Discussion: https://postgr.es/m/CAEzk6fdF_J4jqicLz=FZ6R1u2EjpEtmzD55tFjVbxw-O-kR1=w@mail.gmail.com  

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

doc: first draft of PG 15 release notes

commit   : 9499606db00290562096d74f62cf47f953795b58    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 11:35:28 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Tue, 10 May 2022 11:35:28 -0400    

Click here for diff

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

Fix several issues with the TAP tests of pg_upgrade

commit   : 7dd3ee508432730d15c5d3032f37362f6b6e4dd8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 May 2022 11:31:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 10 May 2022 11:31:31 +0900    

Click here for diff

This commit addresses the following issues in the TAP tests of  
pg_upgrade, introduced in 322becb:  
- Remove --port and --host for commands that already rely on a node's  
environment PGHOST and PGPORT.  
- Switch from run_log() to command_ok(), as all the commands executed in  
the tests should succeed.  
- Change EXTRA_REGRESS_OPTS to make it count as a shell fragment (fixing  
s/OPT/OPTS on a way), to be compatible with the various Makefiles using  
it as well as 027_stream_regress.pl in the recovery tests.  The command  
built for the execution the pg_regress command is reformatted, while on  
it, to map with the recovery test doing the same thing (we should  
refactor and consolidate that in the future, perhaps).  
- Re-add the test for database names stressing the behavior of  
backslashes with double quotes, mostly here for Windows.  
  
Tests doable with the upgrade across different major versions still work  
the same way.  
  
Reported-by: Noah Misch  
Discussion: https://postgr.es/m/20220502042718.GB1565149@rfd.leadboat.com  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Fix core dump in transformValuesClause when there are no columns.

commit   : fe20afaee8aac7838ed6e4a76baa83e547629582    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 May 2022 14:15:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 May 2022 14:15:37 -0400    

Click here for diff

The parser code that transformed VALUES from row-oriented to  
column-oriented lists failed if there were zero columns.  
You can't write that straightforwardly (though probably you  
should be able to), but the case can be reached by expanding  
a "tab.*" reference to a zero-column table.  
  
Per bug #17477 from Wang Ke.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/17477-0af3c6ac6b0a6ae0@postgresql.org  

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

Revert "Disallow infinite endpoints in generate_series() for timestamps."

commit   : 29904f5f2fdafbbb96ef3685fd361053b061aeb1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 May 2022 11:02:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 9 May 2022 11:02:36 -0400    

Click here for diff

This reverts commit eafdf9de06e9b60168f5e47cedcfceecdc6d4b5f  
and its back-branch counterparts.  Corey Huinker pointed out that  
we'd discussed this exact change back in 2016 and rejected it,  
on the grounds that there's at least one usage pattern with LIMIT  
where an infinite endpoint can usefully be used.  Perhaps that  
argument needs to be re-litigated, but there's no time left before  
our back-branch releases.  To keep our options open, restore the  
status quo ante; if we do end up deciding to change things, waiting  
one more quarter won't hurt anything.  
  
Rather than just doing a straight revert, I added a new test case  
demonstrating the usage with LIMIT.  That'll at least remind us of  
the issue if we forget again.  
  
Discussion: https://postgr.es/m/3603504.1652068977@sss.pgh.pa.us  
Discussion: https://postgr.es/m/CADkLM=dzw0Pvdqp5yWKxMd+VmNkAMhG=4ku7GnCZxebWnzmz3Q@mail.gmail.com  

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

In REFRESH MATERIALIZED VIEW, set user ID before running user code.

commit   : 0abc1a059e27c5a71a1a186c97d9c0af407469cc    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 9 May 2022 08:35:08 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 9 May 2022 08:35:08 -0700    

Click here for diff

It intended to, but did not, achieve this.  Adopt the new standard of  
setting user ID just after locking the relation.  Back-patch to v10 (all  
supported versions).  
  
Reviewed by Simon Riggs.  Reported by Alvaro Herrera.  
  
Security: CVE-2022-1552  

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

Make relation-enumerating operations be security-restricted operations.

commit   : a117cebd638dd02e5c2e791c25e43745f233111b    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 9 May 2022 08:35:08 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 9 May 2022 08:35:08 -0700    

Click here for diff

When a feature enumerates relations and runs functions associated with  
all found relations, the feature's user shall not need to trust every  
user having permission to create objects.  BRIN-specific functionality  
in autovacuum neglected to account for this, as did pg_amcheck and  
CLUSTER.  An attacker having permission to create non-temp objects in at  
least one schema could execute arbitrary SQL functions under the  
identity of the bootstrap superuser.  CREATE INDEX (not a  
relation-enumerating operation) and REINDEX protected themselves too  
late.  This change extends to the non-enumerating amcheck interface.  
Back-patch to v10 (all supported versions).  
  
Sergey Shinderuk, reviewed (in earlier versions) by Alexander Lakhin.  
Reported by Alexander Lakhin.  
  
Security: CVE-2022-1552  

M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_nbtree.c
M src/backend/access/brin/brin.c
M src/backend/catalog/index.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/utils/init/miscinit.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Add missing source files to nls.mk

commit   : f45f8b7ff3fe6c8b8139e177bb3fec7629ef9f05    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 9 May 2022 07:17:08 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 9 May 2022 07:17:08 +0200    

Click here for diff

M src/bin/pg_amcheck/nls.mk
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_checksums/nls.mk
M src/bin/pg_dump/nls.mk
M src/bin/pg_test_fsync/nls.mk
M src/bin/scripts/nls.mk

Fix control file update done in restartpoints still running after promotion

commit   : 7863ee4def653f2c2193cb0b0cf4a8f0f3ca6c56    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 May 2022 08:39:59 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 9 May 2022 08:39:59 +0900    

Click here for diff

If a cluster is promoted (aka the control file shows a state different  
than DB_IN_ARCHIVE_RECOVERY) while CreateRestartPoint() is still  
processing, this function could miss an update of the control file for  
"checkPoint" and "checkPointCopy" but still do the recycling and/or  
removal of the past WAL segments, assuming that the to-be-updated LSN  
values should be used as reference points for the cleanup.  This causes  
a follow-up restart attempting crash recovery to fail with a PANIC on a  
missing checkpoint record if the end-of-recovery checkpoint triggered by  
the promotion did not complete while the cluster abruptly stopped or  
crashed before the completion of this checkpoint.  The PANIC would be  
caused by the redo LSN referred in the control file as located in a  
segment already gone, recycled by the previous restartpoint with  
"checkPoint" out-of-sync in the control file.  
  
This commit fixes the update of the control file during restartpoints so  
as "checkPoint" and "checkPointCopy" are updated even if the cluster has  
been promoted while a restartpoint is running, to be on par with the set  
of WAL segments actually recycled in the end of CreateRestartPoint().  
  
This problem exists in all the stable branches.  However, commit  
7ff23c6, by removing the last call of CreateCheckPoint() from the  
startup process, has made this bug much easier to reason about as  
concurrent checkpoints are not possible anymore.  No backpatch is done  
yet, mostly out of caution from me as a point release is close by, but  
we need to think harder about the case of concurrent checkpoints at  
promotion if the bgwriter is not considered as running by the startup  
process in ~v14, so this change is done only on HEAD for the moment.  
  
Reported-by: Fujii Masao, Rui Zhao  
Author: Kyotaro Horiguchi  
Reviewed-by: Nathan Bossart, Michael Paquier  
Discussion: https://postgr.es/m/20220316.102444.2193181487576617583.horikyota.ntt@gmail.com  

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

Fix race in 032_relfilenode_reuse.pl.

commit   : a22652ebbcb33a6a271cc69841ad61d971d7db30    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 8 May 2022 16:54:09 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 8 May 2022 16:54:09 +1200    

Click here for diff

Add wait_for_catchup() call to the test added by commit e2f65f42.  Per  
slow build farm animal grison.  
  
Also fix a comment.  
  
Discussion: https://postgr.es/m/CA%2BhUKGLJ2Vy8hVQmnYotmTaEKZK0%3D-GcXgNAgcHzArZvtS4L_g%40mail.gmail.com  

M src/test/recovery/t/032_relfilenode_reuse.pl

Under has_wal_read_bug, skip contrib/bloom/t/001_wal.pl.

commit   : ad76c9708bd1a333c28e7be2178e34b745fb23d1    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 7 May 2022 00:33:15 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 7 May 2022 00:33:15 -0700    

Click here for diff

Per buildfarm members snapper and kittiwake.  Back-patch to v10 (all  
supported versions).  
  
Discussion: https://postgr.es/m/20220116210241.GC756210@rfd.leadboat.com  

M contrib/bloom/t/001_wal.pl

Fix old-fd issues using global barriers everywhere.

commit   : e2f65f42555ff531c6d7c8f151526b4ef7c016f8    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 7 May 2022 15:19:52 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 7 May 2022 15:19:52 +1200    

Click here for diff

Commits 4eb21763 and b74e94dc introduced a way to force every backend to  
close all relation files, to fix an ancient Windows-only bug.  
  
This commit extends that behavior to all operating systems and adds  
a couple of extra barrier points, to fix a totally different class of  
bug: the reuse of relfilenodes in scenarios that have no other kind of  
cache invalidation to prevent file descriptor mix-ups.  
  
In all releases, data corruption could occur when you moved a database  
to another tablespace and then back again.  Despite that, no back-patch  
for now as the infrastructure required is too new and invasive.  In  
master only, since commit aa010514, it could also happen when using  
CREATE DATABASE with a user-supplied OID or via pg_upgrade.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de  

M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/include/pg_config_manual.h
M src/test/recovery/Makefile
A src/test/recovery/t/032_relfilenode_reuse.pl

Rethink PROCSIGNAL_BARRIER_SMGRRELEASE.

commit   : b74e94dc27fdbb13954f230b1d1298430afa6c0c    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 7 May 2022 16:19:42 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 7 May 2022 16:19:42 +1200    

Click here for diff

With sufficiently bad luck, it was possible for IssuePendingWritebacks()  
to reopen a file after we'd processed PROCSIGNAL_BARRIER_SMGRRELEASE and  
before the file was unlinked by some other backend.  That left a small  
hole in commit 4eb21763's plan to fix all spurious errors from DROP  
TABLESPACE and similar on Windows.  
  
Fix by closing md.c's segments, instead of just closing fd.c's  
descriptors, and then teaching smgrwriteback() not to open files that  
aren't already open.  
  
Reported-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/20220209220004.kb3dgtn2x2k2gtdm%40alap3.anarazel.de  

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

Fix misleading comments about background worker registration.

commit   : 701d918a426b394620ce4d046533f77262c70829    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 6 May 2022 09:24:06 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 6 May 2022 09:24:06 -0400    

Click here for diff

Since 6bc8ef0b7f1f1df3998745a66e1790e27424aa0c, the maximum number  
of backends can't change as background workers are registered, but  
these comments still reflect the way things worked prior to that.  
  
Also, per recent discussion, some modules call SetConfigOption()  
from _PG_init(). It's not entirely clear to me whether we want to  
regard that as a fully supported operation, but since we know it's  
a thing that happens, it at least deserves a mention in the comments,  
so add that.  
  
Nathan Bossart, reviewed by Anton A. Melnikov  
  
Discussion: http://postgr.es/m/20220419154658.GA2487941@nathanxps13  

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

pgcrypto: remove questionmark from error message

commit   : ee97d46cdb7e23f8ee98fe22648a1c3c75a80261    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:36 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:36 +0200    

Click here for diff

The PXE_CIPHER_INIT error is used to report initialization errors, so  
appending a questionmark to the error isn't entirely accurate (using a  
space before the questionmark doubly so).  
  
Discussion: https://postgr.es/m/C89D932C-501E-4473-9750-638CFCD9095E@yesql.se  

M contrib/pgcrypto/expected/blowfish_1.out
M contrib/pgcrypto/expected/cast5_1.out
M contrib/pgcrypto/expected/des_1.out
M contrib/pgcrypto/px.c

pgcrypto: report init errors as PXE_CIPHER_INIT

commit   : 0250a167a07d4d2cff932e467d84306cbd3704fe    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:33 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:33 +0200    

Click here for diff

Report OpenSSL errors during initialization as PXE_CIPHER_INIT since  
that's just what they were, and not generic unknown errors. This also  
removes the last users of the generic error, and thus it can be removed.  
  
Discussion: http://postgr.es/m/C89D932C-501E-4473-9750-638CFCD9095E@yesql.se  

M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h

Clear the OpenSSL error queue before cryptohash operations

commit   : 17ec5fa502d299b1919b1afacda839fb7d8206ad    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:31 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 6 May 2022 14:41:31 +0200    

Click here for diff

Setting up an EVP context for ciphers banned under FIPS generate  
two OpenSSL errors in the queue, and as we only consume one from  
the queue the other is at the head for the next invocation:  
  
  postgres=# select md5('foo');  
  ERROR:  could not compute MD5 hash: unsupported  
  postgres=# select md5('foo');  
  ERROR:  could not compute MD5 hash: initialization error  
  
Clearing the error queue when creating the context ensures that  
we don't pull in an error from an earlier operation.  
  
Discussion: https://postgr.es/m/C89D932C-501E-4473-9750-638CFCD9095E@yesql.se  

M src/common/cryptohash_openssl.c
M src/common/hmac_openssl.c

Fix typo in origin.c

commit   : 59a32f00937c85fe944cf1fac3e8b98d091e2bc6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 May 2022 20:01:15 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 6 May 2022 20:01:15 +0900    

Click here for diff

Introduced in 5aa2350.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PsuWz6_7aCmivNU5FahgQxDUTQtc3+__XnWkBzQcfn43w@mail.gmail.com  

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

Update SQL features

commit   : 7e367924e33e47e0b0b135b0649c406a589bd496    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:17:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:17:38 +0200    

Click here for diff

Update a few items that have become supported or mostly supported but  
weren't updated at the time.  

M src/backend/catalog/sql_features.txt

Fix some whitespace in documentation markup

commit   : 7d6a4fdf3243a7a18e2cfc6cf03bce01cc6ce651    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:14:15 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:14:15 +0200    

Click here for diff

M doc/src/sgml/func.sgml

doc: Fix typos

commit   : a6f12520bed073d1d548a691e85d7f5371cc4ed4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:07:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 6 May 2022 09:07:14 +0200    

Click here for diff

introduced by 222b697ec077047024a96392a2f5cb9b1803ccf7  

M doc/src/sgml/func.sgml

Update time zone data files to tzdata release 2022a.

commit   : ab3479bf55066f3dc827796f5bf1e957ffc97d2d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 May 2022 14:54:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 5 May 2022 14:54:53 -0400    

Click here for diff

DST law changes in Palestine.  Historical corrections for  
Chile and Ukraine.  

M src/timezone/data/tzdata.zi

Fix timing issue in deadlock recovery conflict test.

commit   : 9e6b7b45ca92cccd6b870fa4e0a98059a86ce79d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 4 May 2022 12:50:38 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 4 May 2022 12:50:38 -0700    

Click here for diff

Per buildfarm members longfin and skink.  
  
Discussion: https://postgr.es/m/20220413002626.udl7lll7f3o7nre7@alap3.anarazel.de  
Backpatch: 10-  

M src/test/recovery/t/031_recovery_conflict.pl

Fix rowcount estimate for SubqueryScan that's under a Gather.

commit   : c40ba5f318f96a6a5a29729b987ead11c5dc65c1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 May 2022 14:44:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 4 May 2022 14:44:40 -0400    

Click here for diff

SubqueryScan was always getting labeled with a rowcount estimate  
appropriate for non-parallel cases.  However, nodes that are  
underneath a Gather should be treated as processing only one  
worker's share of the rows, whether the particular node is explicitly  
parallel-aware or not.  Most non-scan-level node types get this  
right automatically because they base their rowcount estimate on  
that of their input sub-Path(s).  But SubqueryScan didn't do that,  
instead using the whole-relation rowcount estimate as if it were  
a non-parallel-aware scan node.  If there is a parallel-aware node  
below the SubqueryScan, this is wrong, and it results in inflating  
the cost estimates for nodes above the SubqueryScan, which can cause  
us to not choose a parallel plan, or choose a silly one --- as indeed  
is visible in the one regression test whose results change with this  
patch.  (Although that plan tree appears to contain no SubqueryScans,  
there were some in it before setrefs.c deleted them.)  
  
To fix, use path->subpath->rows not baserel->tuples as the number  
of input tuples we'll process.  This requires estimating the quals'  
selectivity afresh, which is slightly annoying; but it shouldn't  
really add much cost thanks to the caching done in RestrictInfo.  
  
This is pretty clearly a bug fix, but I'll refrain from back-patching  
as people might not appreciate plan choices changing in stable branches.  
The fact that it took us this long to identify the bug suggests that  
it's not a major problem.  
  
Per report from bucoo, though this is not his proposed patch.  
  
Discussion: https://postgr.es/m/202204121457159307248@sohu.com  

M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/incremental_sort.out

Remove JsonPathSpec typedef

commit   : dc2be6ed47e54004666a78e1592896c08f2be80e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 17:36:31 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 17:36:31 +0200    

Click here for diff

It doesn't seem very useful, and it's a bit in the way of the planned  
node support automation.  
  
Discussion: https://www.postgresql.org/message-id/202204191140.3wsbevfhqmu3@alvherre.pgsql  

M src/backend/parser/parse_jsontable.c
M src/include/nodes/parsenodes.h

Add missing enum tag in enum used in nodes

commit   : d47a11da9e5c5bad3eb0f353ab7b883d3f0eb48a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 17:34:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 17:34:22 +0200    

Click here for diff

Similar to 983bdc4fac492a99bb8ab5a471ca7437139e5cf6.  
  
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>  
Discussion: https://www.postgresql.org/message-id/202204191140.3wsbevfhqmu3@alvherre.pgsql  

M src/include/nodes/parsenodes.h

Simplify configure test

commit   : cfb63b994e91af8315f5262b3dc630c565f2420a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 13:33:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 13:33:59 +0200    

Click here for diff

The test for lz4.h used AC_CHECK_HEADERS, but nothing was using the  
resulting symbol HAVE_LZ4_H.  Change this to use AC_CHECK_HEADER  
instead.  This was probably an oversight, seeing that the nearby  
similar tests do this correctly.  

M configure
M configure.ac
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Rename libpq test programs with libpq_ prefix

commit   : 0432490d290f679cad773ce4735e8769e2c4db75    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 4 May 2022 14:15:25 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 4 May 2022 14:15:25 +0200    

Click here for diff

The testclient and uri-regress programs in the libpq test suite had  
quite generic names which didn't convey much meaning. Since they are  
installed as part of the MSVC test runs, ensure that their purpose  
is a little bit clearer by renaming with a libpq_ prefix. While at  
it rename uri-regress to uri_regress to avoid mixing dash and under-  
score in the same filename.  
  
Reported-by: Noah Misch <noah@leadboat.com>  
Discussion: https://postgr.es/m/20220501080706.GA1542365@rfd.leadboat.com  

M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile
R088 src/interfaces/libpq/test/testclient.c src/interfaces/libpq/test/libpq_testclient.c
R090 src/interfaces/libpq/test/uri-regress.c src/interfaces/libpq/test/libpq_uri_regress.c
M src/tools/msvc/Mkvcbuild.pm

Fix incorrect format placeholders

commit   : 2e77180d4572ddb892f9c2e253ee95dc0fa26b5f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 07:57:39 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 4 May 2022 07:57:39 +0200    

Click here for diff

M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/xactdesc.c

Fix possibility of self-deadlock in ResolveRecoveryConflictWithBufferPin().

commit   : 8f1537d10e83ad9c23ed2772cc28f74582b237ea    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 2 May 2022 18:25:00 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 2 May 2022 18:25:00 -0700    

Click here for diff

The tests added in 9f8a050f68d failed nearly reliably on FreeBSD in CI, and  
occasionally on the buildfarm. That turns out to be caused not by a bug in the  
test, but by a longstanding bug in recovery conflict handling.  
  
The standby timeout handler, used by ResolveRecoveryConflictWithBufferPin(),  
executed SendRecoveryConflictWithBufferPin() inside a signal handler. A bad  
idea, because the deadlock timeout handler (or a spurious latch set) could  
have interrupted ProcWaitForSignal(). If unlucky that could cause a  
self-deadlock on ProcArrayLock, if the deadlock check is in  
SendRecoveryConflictWithBufferPin()->CancelDBBackends().  
  
To fix, set a flag in StandbyTimeoutHandler(), and check the flag in  
ResolveRecoveryConflictWithBufferPin().  
  
Subsequently the recovery conflict tests will be backpatched.  
  
Discussion: https://postgr.es/m/20220413002626.udl7lll7f3o7nre7@alap3.anarazel.de  
Backpatch: 10-  

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

Add tests for recovery deadlock conflicts.

commit   : 21e184403bf92c52191d1f03dd6566a3d54dc907    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 2 May 2022 17:19:11 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 2 May 2022 17:19:11 -0700    

Click here for diff

The recovery conflict tests added in 9f8a050f68d surfaced a bug in the  
interaction between buffer pin and deadlock recovery conflicts. To make sure  
that the bugfix won't break deadlock conflict detection, add a test for that  
scenario.  
  
031_recovery_conflict.pl will later be backpatched, with this included.  
  
Discussion: https://postgr.es/m/20220413002626.udl7lll7f3o7nre7@alap3.anarazel.de  

M src/test/recovery/t/031_recovery_conflict.pl

basebackup_to_shell: Add missing MarkGUCPrefixReserved()

commit   : 7307988abdff6c948d87e6d9dc9aaaa1f4c5283f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 May 2022 20:16:19 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 2 May 2022 20:16:19 +0900    

Click here for diff

Oversight in c6306db24, as per a requirement from 88103567.  All the  
other modules in the tree, be they in contrib/ or src/test/modules/,  
already do that.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACUy7q_KwSMda+2SHPSWep32tNUM8cXGRS3=-Vfodo9OUg@mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c

Fix typo in comment.

commit   : d89f97e83efed4b2ac0a1803a1b6813c8277de73    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 2 May 2022 16:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Mon, 2 May 2022 16:45:00 +0900    

Click here for diff

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

pg_walinspect: fix case where flush LSN is in the middle of a record.

commit   : ed57cac84d1c5642737dab1e4c4b8cb4f0c4305f    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Sat, 30 Apr 2022 08:28:33 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Sat, 30 Apr 2022 08:28:33 -0700    

Click here for diff

Instability in the test for pg_walinspect revealed that  
pg_get_wal_records_info_till_end_of_wal(x) would try to decode all the  
records with a start LSN earlier than the flush LSN, even though that  
might include a partial record at the end of the range. In that case,  
read_local_xlog_page_no_wait() would return NULL when it tried to read  
past the flush LSN, which would be interpreted as an error by the  
caller. That caused a test failure only on a BF animal that had been  
restarted recently, but could be expected to happen in the wild quite  
easily depending on the alignment of various parameters.  
  
Fix by using private data in read_local_xlog_page_no_wait() to signal  
end-of-wal to the caller, so that it can be properly distinguished  
from a real error.  
  
Discussion: https://postgr.es/m/Ymd/e5eeZMNAkrXo%40paquier.xyz  
Discussion: https://postgr.es/m/111657.1650910309@sss.pgh.pa.us  
  
Authors: Thomas Munro, Bharath Rupireddy.  

M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/transam/xlogutils.c
M src/include/access/xlogutils.h

Tighten enforcement of variable CONSTANT markings in plpgsql.

commit   : ccd10a9bfa54c1aad3561232bf24222f1b455e1c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 30 Apr 2022 11:54:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 30 Apr 2022 11:54:28 -0400    

Click here for diff

I noticed that plpgsql would allow assignment of a new value to a  
variable even when that variable is marked CONSTANT, if the variable  
is used as an output parameter in CALL or is a refcursor variable  
that OPEN assigns a new value to.  Fix these oversights.  
  
In the CALL case, the check has to be done at runtime because we  
cannot know at parse time which parameters are OUT parameters.  
For OPEN, it seems best to likewise enforce at runtime because  
then we needn't throw error if the variable has a nonnull value  
(since OPEN will only try to overwrite a null value).  
  
Although this is surely a bug fix, no back-patch: it seems unlikely  
that anyone would thank us for breaking formerly-working code in  
minor releases.  
  
Discussion: https://postgr.es/m/214453.1651182729@sss.pgh.pa.us  

M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_call.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/sql/plpgsql.sql

Claim SQL standard compliance for SQL/JSON features

commit   : a79153b7a28579bda02e0d72464383dca4929e62    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 29 Apr 2022 09:01:05 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 29 Apr 2022 09:01:05 -0400    

Click here for diff

Discussion: https://postgr.es/m/d03d809c-d0fb-fd6a-1476-d6dc18ec940e@dunslane.net  

M src/backend/catalog/sql_features.txt

Fix JSON_OBJECTAGG uniquefying bug

commit   : 9c3d25e17894f35045a2d57dfb834e25c9dc4c21    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 28 Apr 2022 15:28:20 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 28 Apr 2022 15:28:20 -0400    

Click here for diff

Commit f4fb45d15c contained a bug in removing items with null values when  
unique keys are required, where the leading items that are sorted  
contained such values. Fix that and add a test for it.  
  
Discussion: https://postgr.es/m/CAJA4AWQ_XbSmsNbW226UqNyRLJ+wb=iQkQMj77cQyoNkqtf=2Q@mail.gmail.com  

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

Disable asynchronous execution if using gating Result nodes.

commit   : 5c854e7a2c8a6cd26040e0f9949e7a4a007f6366    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 28 Apr 2022 15:15:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 28 Apr 2022 15:15:00 +0900    

Click here for diff

mark_async_capable_plan(), which is called from create_append_plan() to  
determine whether subplans are async-capable, failed to take into  
account that the given subplan created from a given subpath might  
include a gating Result node if the subpath is a SubqueryScanPath or  
ForeignPath, causing a segmentation fault there when the subplan created  
from a SubqueryScanPath includes the Result node, or causing  
ExecAsyncRequest() to throw an error about an unrecognized node type  
when the subplan created from a ForeignPath includes the Result node,  
because in the latter case the Result node was unintentionally  
considered as async-capable, but we don't currently support executing  
Result nodes asynchronously.  Fix by modifying mark_async_capable_plan()  
to disable asynchronous execution in such cases.  Also, adjust code in  
the ProjectionPath case in mark_async_capable_plan(), for consistency  
with other cases, and adjust/improve comments there.  
  
is_async_capable_path() added in commit 27e1f1456, which was rewritten  
to mark_async_capable_plan() in a later commit, has the same issue,  
causing the error at execution mentioned above, so back-patch to v14  
where the aforesaid commit went in.  
  
Per report from Justin Pryzby.  
  
Etsuro Fujita, reviewed by Zhihong Yu and Justin Pryzby.  
  
Discussion: https://postgr.es/m/20220408124338.GK24419%40telsasoft.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/createplan.c

Revert recent changes with durable_rename_excl()

commit   : 55b56865115eccd6449e79d6f06fe49d6ba3b792    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 13:08:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 13:08:16 +0900    

Click here for diff

This reverts commits 2c902bb and ccfbd92.  Per buildfarm members  
kestrel, rorqual and calliphoridae, the assertions checking that a TLI  
history file should not exist when created by a WAL receiver have been  
failing, and switching to durable_rename() over durable_rename_excl()  
would cause the newest TLI history file to overwrite the existing one.  
We need to think harder about such cases, so revert the new logic for  
now.  
  
Note that all the failures have been reported in the test  
025_stuck_on_old_timeline.  
  
Discussion: https://postgr.es/m/511362.1651116498@sss.pgh.pa.us  

M contrib/basic_archive/basic_archive.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c
M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Fix SQL syntax in comment in logical/worker.c

commit   : e84f82ab5cff2811745ae8e2ac163a4b8b733394    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 28 Apr 2022 09:27:32 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 28 Apr 2022 09:27:32 +0700    

Click here for diff

Euler Taveira  
  
Disussion: https://www.postgresql.org/message-id/25f95189-eef8-43c4-9d7b-419b651963c8%40www.fastmail.com  

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

Remove durable_rename_excl()

commit   : 2c902bbf1911a3c3dd68b817209eca9be81e381c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 11:10:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 11:10:40 +0900    

Click here for diff

ccfbd92 has replaced all existing in-core callers of this function in  
favor of durable_rename().  durable_rename_excl() is by nature unsafe on  
crashes happening at the wrong time, so just remove it.  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  

M src/backend/storage/file/fd.c
M src/include/pg_config_manual.h
M src/include/storage/fd.h

Replace existing durable_rename_excl() calls with durable_rename()

commit   : ccfbd9287d70038518bdd3e85d7f5fd3dd1bb880    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 10:11:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 28 Apr 2022 10:11:45 +0900    

Click here for diff

durable_rename_excl() attempts to avoid overwriting any existing files  
by using link() and unlink(), falling back to rename() on some platforms  
(e.g., Windows where link() followed by unlink() is not concurrent-safe,  
see 909b449).  Most callers of durable_rename_excl() use it just in case  
there is an existing file, but it happens that for all of them we never  
expect a target file to exist (WAL segment recycling, creation of  
timeline history file and basic_archive).  
  
basic_archive used durable_rename_excl() to avoid overwriting an archive  
concurrently created by another server.  Now, there is a stat() call to  
avoid overwriting an existing archive a couple of lines above, so note  
that this change opens a small TOCTOU window in this module between the  
stat() call and durable_rename().  
  
Furthermore, as mentioned in the top comment of durable_rename_excl(),  
this routine can result in multiple hard links to the same file and data  
corruption, with two or more links to the same file in pg_wal/ if a  
crash happens before the unlink() call during WAL recycling.  
Specifically, this would produce links to the same file for the current  
WAL file and the next one because the half-recycled WAL file was  
re-recycled during crash recovery of a follow-up cluster restart.  
  
This change replaces all calls to durable_rename_excl() with  
durable_rename().  This removes the protection against accidentally  
overwriting an existing file, but some platforms are already living  
without it, and all those code paths never expect an existing file (a  
couple of assertions are added to check after that, in case).  
  
This is a bug fix, but knowing the unlikeliness of the problem involving  
one of more crashes at an exceptionally bad moment, no backpatch is  
done.  This could be revisited in the future.  
  
Author: Nathan Bossart  
Reviewed-by: Robert Haas, Kyotaro Horiguchi, Michael Paquier  
Discussion: https://postgr.es/m/20220407182954.GA1231544@nathanxps13  

M contrib/basic_archive/basic_archive.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/xlog.c

Fix incorrect format placeholders

commit   : 755df30e48b0a9ff8428f4c1ccb468dac29fc320    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Apr 2022 09:49:10 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Apr 2022 09:49:10 +0200    

Click here for diff

M src/backend/executor/execExprInterp.c
M src/backend/utils/activity/pgstat_xact.c

Handle NULL fields in WRITE_INDEX_ARRAY

commit   : 9ddf251f94090cebf1bd8fc18396cb8a4b580d04    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Apr 2022 09:15:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 27 Apr 2022 09:15:09 +0200    

Click here for diff

Unlike existing WRITE_*_ARRAY macros, WRITE_INDEX_ARRAY needs to  
handle the case that the field is NULL.  We already have the  
convention to print NULL fields as "<>", so we do that here as well.  
There is currently no corresponding read function for this, so reading  
this back in is not implemented, but it could be if needed.  
  
Reported-by: Richard Guo <guofenglinux@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/CAMbWs4-LN%3DbF8f9eU2R94dJtF54DfDvBq%2BovqHnOQqbinYDrUw%40mail.gmail.com  

M src/backend/nodes/outfuncs.c

Fix typo in pg_walinspect.c

commit   : 06cafd6f577ba251ac10d4f009fc3be424705a37    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Apr 2022 14:24:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Apr 2022 14:24:13 +0900    

Click here for diff

Spotted while looking at the surroundings, introduced by 2258e76.  

M contrib/pg_walinspect/pg_walinspect.c

Add some isolation tests for CLUSTER

commit   : 21a10368eb3fce73f146d7e48b4d81496f60d965    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Apr 2022 13:41:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 26 Apr 2022 13:41:17 +0900    

Click here for diff

This commit adds two isolation tests for CLUSTER, using:  
- A normal table, making sure that CLUSTER blocks and completes if the  
table is locked by a concurrent session.  
- A partitioned table with a partition owned by a different user.  If  
the partitioned table is locked by a concurrent session, CLUSTER on the  
partitioned table should block.  If the partition owned by a different  
user is locked, CLUSTER on its partitioned table should complete and  
skip the partition.  3f19e17 has added an early check to ignore such a  
partition with a SQL regression test, but this was not checking that  
CLUSTER should not block.  
  
Discussion: https://postgr.es/m/YlqveniXn9AI6RFZ@paquier.xyz  

A src/test/isolation/expected/cluster-conflict-partition.out
A src/test/isolation/expected/cluster-conflict.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/cluster-conflict-partition.spec
A src/test/isolation/specs/cluster-conflict.spec

Inhibit mingw CRT's auto-globbing of command line arguments

commit   : b787c554c264cbed4de4eff2bb170a5224f0cfa5    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 25 Apr 2022 15:02:13 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 25 Apr 2022 15:02:13 -0400    

Click here for diff

For some reason by default the mingw C Runtime takes it upon itself to  
expand program arguments that look like shell globbing characters. That  
has caused much scratching of heads and mis-attribution of the causes of  
some TAP test failures, so stop doing that.  
  
This removes an inconsistency with Windows binaries built with MSVC,  
which have no such behaviour.  
  
Per suggestion from Noah Misch.  
  
Backpatch to all live branches.  
  
Discussion: https://postgr.es/m/20220423025927.GA1274057@rfd.leadboat.com  

M src/common/exec.c

Drop unlogged table after test is done

commit   : dec8ad367e46180f826d5b6dc820fbecba1b71d2    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 15:48:13 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 15:48:13 +0200    

Click here for diff

Another test is constructed on top of regression tests, which does not  
work correctly with unlogged tables.  For now, cope with that by making  
sure no unlogged table is left behind.  
  
Per buildfarm pink after 4fb5c794e586.  

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

Cover brin/gin/gist/spgist ambuildempty routines in regression tests

commit   : 4fb5c794e58613561f94ad5ea1197729be7791dc    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 15:00:49 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 15:00:49 +0200    

Click here for diff

Changing some TEMP or permanent tables to UNLOGGED is sufficient to  
invoke these ambuildempty routines, which were all not uncovered by any  
tests.  These changes do not otherwise affect the test suite.  
  
Author: Amul Sul <sulamul@gmail.com>  
Discussion: https://postgr.es/m/CAAJ_b95nneRCLM-=qELEdgCYSk6W_++-C+Q_t+wH3SW-hF50iw@mail.gmail.com  

M src/test/regress/expected/brin.out
M src/test/regress/expected/gin.out
M src/test/regress/expected/gist.out
M src/test/regress/expected/spgist.out
M src/test/regress/sql/brin.sql
M src/test/regress/sql/gin.sql
M src/test/regress/sql/gist.sql
M src/test/regress/sql/spgist.sql

Always pfree strings returned by GetDatabasePath

commit   : 0bd56172b2871e94c0d7115ffbf430308317ac49    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 10:32:13 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 25 Apr 2022 10:32:13 +0200    

Click here for diff

Several places didn't do it, and in many cases it didn't matter because  
it would be a small allocation in a short-lived context; but other  
places may accumulate a few (for example, in CreateDatabaseUsingFileCopy,  
one per tablespace).  In most databases this is highly unlikely to be  
very serious either, but it seems better to make the code consistent in  
case there's future copy-and-paste.  
  
The only case of actual concern seems to be the aforementioned routine,  
which is new with commit 9c08aea6a309, so there's no need to backpatch.  
  
As pointed out by Coverity.  

M src/backend/commands/dbcommands.c
M src/backend/utils/init/postinit.c

Fix incautious CTE matching in rewriteSearchAndCycle().

commit   : f819020d400f1dbd96ee1a9fd44a1f6f44932b4d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 23 Apr 2022 12:16:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 23 Apr 2022 12:16:12 -0400    

Click here for diff

This function looks for a reference to the recursive WITH CTE,  
but it checked only the CTE name not ctelevelsup, so that it could  
seize on a lower CTE that happened to have the same name.  This  
would result in planner failures later, either weird errors such as  
"could not find attribute 2 in subquery targetlist", or crashes  
or assertion failures.  The code also merely Assert'ed that it found  
a matching entry, which is not guaranteed at all by the parser.  
  
Per bugs #17320 and #17318 from Zhiyong Wu.  
Thanks to Kyotaro Horiguchi for investigation.  
  
Discussion: https://postgr.es/m/17320-70e37868182512ab@postgresql.org  
Discussion: https://postgr.es/m/17318-2eb65a3a611d2368@postgresql.org  

M src/backend/rewrite/rewriteSearchCycle.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Test ALIGNOF_DOUBLE==4 compatibility under ALIGNOF_DOUBLE==8.

commit   : c1da0acbb06e9175044b436d14c51cef03339109    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 22 Apr 2022 20:20:11 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 22 Apr 2022 20:20:11 -0700    

Click here for diff

Today's test case detected alignment problems only when executing on  
AIX.  This change lets popular platforms detect the same problems.  
  
Reviewed by Masahiko Sawada.  
  
Discussion: https://postgr.es/m/20220415072601.GG862547@rfd.leadboat.com  

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

Remove some recently-added pg_dump test cases.

commit   : a66e722cc1180cd7a2046fb552195a7d7703a592    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 22 Apr 2022 16:16:52 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 22 Apr 2022 16:16:52 -0400    

Click here for diff

Commit d2d35479796c3510e249d6fc72adbd5df918efbf included a pretty  
extensive set of test cases, and some of them don't work on all  
of our Windows machines. This happens because IPC::Run expands  
its arguments as shell globs on a few machines, but doesn't on most  
of the buildfarm. It might be good to fix that problem systematically  
somehow, but in the meantime, there are enough test cases for this  
commit that it seems OK to just remove the ones that are failing.  
  
Discussion: http://postgr.es/m/3a190754-b2b0-d02b-dcfd-4ec1610ffbcb@dunslane.net  
Discussion: http://postgr.es/m/CA+TgmoYRGUcFBy6VgN0+Pn4f6Wv=2H0HZLuPHqSy6VC8Ba7vdg@mail.gmail.com  

M src/bin/pg_dump/t/002_pg_dump.pl

commit   : 826be1ffb28dde083552150243dbbdcac55ab28e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 22 Apr 2022 11:19:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 22 Apr 2022 11:19:17 +0200    

Click here for diff

Formal tables should generally have an xref in the text that points to  
them.  Add them here.  

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

Fix performance regression in tuplesort specializations

commit   : 99c754129d787ea4ce3b34b9f4c5f5e74c45ab6a    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 22 Apr 2022 16:02:15 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 22 Apr 2022 16:02:15 +1200    

Click here for diff

697492434 added 3 new qsort specialization functions aimed to improve the  
performance of sorting many of the common pass-by-value data types when  
they're the leading or only sort key.  
  
Unfortunately, that has caused a performance regression when sorting  
datasets where many of the values being compared were equal.  What was  
happening here was that we were falling back to the standard sort  
comparison function to handle tiebreaks.  When the two given Datums  
compared equally we would incur both the overhead of an indirect function  
call to the standard comparer to perform the tiebreak and also the  
standard comparer function would go and compare the leading key needlessly  
all over again.  
  
Here improve the situation in the 3 new comparison functions.  We now  
return 0 directly when the two Datums compare equally and we're performing  
a 1-key sort.  
  
Here we don't do anything to help the multi-key sort case where the  
leading key uses one of the sort specializations functions.  On testing  
this case, even when the leading key's values are all equal, there  
appeared to be no performance regression.  Let's leave it up to future  
work to optimize that case so that the tiebreak function no longer  
re-compares the leading key over again.  
  
Another possible fix for this would have been to add 3 additional sort  
specialization functions to handle single-key sorts for these  
pass-by-value types.  The reason we didn't do that here is that we may  
deem some other sort specialization to be more useful than single-key  
sorts.  It may be impractical to have sort specialization functions for  
every single combination of what may be useful and it was already decided  
that further analysis into which ones are the most useful would be delayed  
until the v16 cycle.  Let's not let this regression force our hand into  
trying to make that decision for v15.  
  
Author: David Rowley  
Reviewed-by: John Naylor  
Discussion: https://postgr.es/m/CA+hUKGJRbzaAOUtBUcjF5hLtaSHnJUqXmtiaLEoi53zeWSizeA@mail.gmail.com  

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

Remove inadequate assertion check in CTE inlining.

commit   : 92e7a537520927107742af654619e55f34072942    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 17:58:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 17:58:52 -0400    

Click here for diff

inline_cte() expected to find exactly as many references to the  
target CTE as its cterefcount indicates.  While that should be  
accurate for the tree as emitted by the parser, there are some  
optimizations that occur upstream of here that could falsify it,  
notably removal of unused subquery output expressions.  
  
Trying to make the accounting 100% accurate seems expensive and  
doomed to future breakage.  It's not really worth it, because  
all this code is protecting is downstream assumptions that every  
referenced CTE has a plan.  Let's convert those assertions to  
regular test-and-elog just in case there's some actual problem,  
and then drop the failing assertion.  
  
Per report from Tomas Vondra (thanks also to Richard Guo for  
analysis).  Back-patch to v12 where the faulty code came in.  
  
Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com  

M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/subselect.c
M src/include/nodes/pathnodes.h
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Fix missed cases in libpq's error handling.

commit   : 914611ea738a3601717990faff0f5d71a0f14a3d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 17:12:49 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 17:12:49 -0400    

Click here for diff

Commit 618c16707 invented an "error_result" flag in PGconn, which  
intends to represent the state that we have an error condition and  
need to build a PGRES_FATAL_ERROR PGresult from the message text in  
conn->errorMessage, but have not yet done so.  (Postponing construction  
of the error object simplifies dealing with out-of-memory conditions  
and with concatenation of messages for multiple errors.)  For nearly all  
purposes, this "virtual" PGresult object should act the same as if it  
were already materialized.  But a couple of places in fe-protocol3.c  
didn't get that memo, and were only testing conn->result as they used  
to, without also checking conn->error_result.  
  
In hopes of reducing the probability of similar mistakes in future,  
I invented a pgHavePendingResult() macro that includes both tests.  
  
Per report from Peter Eisentraut.  
  
Discussion: https://postgr.es/m/b52277b9-fa66-b027-4a37-fb8989c73ff8@enterprisedb.com  

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

Rethink method for assigning OIDs to the template0 and postgres DBs.

commit   : 2cb1272445d2a6616991fc6ede274d9f1f62ff73    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 16:23:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 16:23:12 -0400    

Click here for diff

Commit aa0105141 assigned fixed OIDs to template0 and postgres  
in a very ad-hoc way.  Notably, instead of teaching Catalog.pm  
about these OIDs, the unused_oids script was just hacked to  
not show them as unused.  That's problematic since, for example,  
duplicate_oids wouldn't report any future conflict.  Hence,  
invent a macro DECLARE_OID_DEFINING_MACRO() that can be used to  
define an OID that is known to Catalog.pm and will participate  
in duplicate-detection as well as renumbering by renumber_oids.pl.  
(We don't anticipate renumbering these particular OIDs, but we  
might as well build out all the Catalog.pm infrastructure while  
we're here.)  
  
Another issue is that aa0105141 neglected to touch IsPinnedObject,  
with the result that it now claimed template0 and postgres are  
pinned.  The right thing to do there seems to be to teach it that  
no database is pinned, since in fact DROP DATABASE doesn't check  
for pinned-ness (and at least for these cases, that is an  
intentional choice).  It's not clear whether this wrong answer  
had any visible effect, but perhaps it could have resulted in  
erroneous management of dependency entries.  
  
In passing, rename the TemplateDbOid macro to Template1DbOid  
to reduce confusion (likely we should have done that way back  
when we invented template0, but we didn't), and rename the  
OID macros for template0 and postgres to have a similar style.  
  
There are no changes to postgres.bki here, so no need for a  
catversion bump.  
  
Discussion: https://postgr.es/m/2935358.1650479692@sss.pgh.pa.us  

M doc/src/sgml/bki.sgml
M src/backend/access/transam/xlog.c
M src/backend/catalog/Catalog.pm
M src/backend/catalog/catalog.c
M src/backend/catalog/genbki.pl
M src/backend/utils/init/postinit.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dump.c
M src/include/access/transam.h
M src/include/catalog/genbki.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/renumber_oids.pl
M src/include/catalog/unused_oids

Standardize references to Zstandard as <productname>

commit   : 586955dddecc95e0003262a3954ae83b68ce0372    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 21 Apr 2022 19:12:21 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 21 Apr 2022 19:12:21 +0200    

Click here for diff

Some places used ZSTD, which isn't widely used anywhere.  Use ZSTD only  
to refer to the environment variable; use zstd (all lowercase) to refer  
to the utility.  
  
Per complaint from Justin Pryzby.  
  
Discussion: https://postgr.es/m/20220414003301.GT26620@telsasoft.com  

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

CREATE PUBLICATION ref: Minor tweaks to row filters

commit   : bb85eec6fe9178aa849b43414f2db440bb5edfbd    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 21 Apr 2022 18:57:40 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 21 Apr 2022 18:57:40 +0200    

Click here for diff

Prompted by a complaint from Justin Pryzby.  
  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/20220414003301.GT26620@telsasoft.com  

M doc/src/sgml/ref/create_publication.sgml

Use DECLARE_TOAST_WITH_MACRO() to simplify toast-table declarations.

commit   : 40eba064b24d98e343b45ccef6907fe8c9784dc1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 12:02:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 21 Apr 2022 12:02:23 -0400    

Click here for diff

This is needed so that renumber_oids.pl can handle renumbering  
shared catalog declarations, which need to provide C macros for  
the OIDs of the shared toast table and index.  The previous  
method of writing a C macro separately was error-prone anyway.  
  
Also teach renumber_oids.pl about DECLARE_UNIQUE_INDEX_PKEY,  
as we missed doing when inventing that macro.  
  
There are no changes to postgres.bki here, so no need for a  
catversion bump.  
  
Discussion: https://postgr.es/m/2995325.1650487527@sss.pgh.pa.us  

M src/backend/catalog/Catalog.pm
M src/backend/catalog/genbki.pl
M src/include/catalog/genbki.h
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_tablespace.h
M src/include/catalog/renumber_oids.pl

postgres_fdw: Disable batch insert when BEFORE ROW INSERT triggers exist.

commit   : 4eea2202beadbba67638bb129149abe5650aaaf6    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 21 Apr 2022 15:30:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 21 Apr 2022 15:30:00 +0900    

Click here for diff

Previously, we allowed this, but such triggers might query the table to  
insert into and act differently if the tuples that have already been  
processed and prepared for insertion are not there, so disable it in  
such cases.  
  
Back-patch to v14 where batch insert was added.  
  
Discussion: https://postgr.es/m/CAPmGK16_uPqsmgK0-LpLSUk54_BoK13bPrhxhfjSoSTVz414hA%40mail.gmail.com  

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

vacuumlazy.c: MultiXactIds are MXIDs, not XMIDs.

commit   : ba6af6aa0b764d76cfca79d9dfbddc7134a16bfc    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Apr 2022 18:29:02 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Apr 2022 18:29:02 -0700    

Click here for diff

Oversights in commits 0b018fab and f3c15cbe.  

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

Fix CLUSTER tuplesorts on abbreviated expressions.

commit   : 8ab0ebb9a842dc6063d1374a38b47a3b7ee64afe    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Apr 2022 17:17:43 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 20 Apr 2022 17:17:43 -0700    

Click here for diff

CLUSTER sort won't use the datum1 SortTuple field when clustering  
against an index whose leading key is an expression.  This makes it  
unsafe to use the abbreviated keys optimization, which was missed by the  
logic that sets up SortSupport state.  Affected tuplesorts output tuples  
in a completely bogus order as a result (the wrong SortSupport based  
comparator was used for the leading attribute).  
  
This issue is similar to the bug fixed on the master branch by recent  
commit cc58eecc5d.  But it's a far older issue, that dates back to the  
introduction of the abbreviated keys optimization by commit 4ea51cdfe8.  
  
Backpatch to all supported versions.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Author: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CA+hUKG+bA+bmwD36_oDxAoLrCwZjVtST2fqe=b4=qZcmU7u89A@mail.gmail.com  
Backpatch: 10-  

M src/backend/utils/sort/tuplesort.c
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Disallow infinite endpoints in generate_series() for timestamps.

commit   : eafdf9de06e9b60168f5e47cedcfceecdc6d4b5f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Apr 2022 18:08:15 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Apr 2022 18:08:15 -0400    

Click here for diff

Such cases will lead to infinite loops, so they're of no practical  
value.  The numeric variant of generate_series() already threw error  
for this, so borrow its message wording.  
  
Per report from Richard Wesley.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/91B44E7B-68D5-448F-95C8-B4B3B0F5DEAF@duckdblabs.com  

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

Allow db.schema.table patterns, but complain about random garbage.

commit   : d2d35479796c3510e249d6fc72adbd5df918efbf    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 20 Apr 2022 11:02:35 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 20 Apr 2022 11:02:35 -0400    

Click here for diff

psql, pg_dump, and pg_amcheck share code to process object name  
patterns like 'foo*.bar*' to match all tables with names starting in  
'bar' that are in schemas starting with 'foo'. Before v14, any number  
of extra name parts were silently ignored, so a command line '\d  
foo.bar.baz.bletch.quux' was interpreted as '\d bletch.quux'.  In v14,  
as a result of commit 2c8726c4b0a496608919d1f78a5abc8c9b6e0868, we  
instead treated this as a request for table quux in a schema named  
'foo.bar.baz.bletch'. That caused problems for people like Justin  
Pryzby who were accustomed to copying strings of the form  
db.schema.table from messages generated by PostgreSQL itself and using  
them as arguments to \d.  
  
Accordingly, revise things so that if an object name pattern contains  
more parts than we're expecting, we throw an error, unless there's  
exactly one extra part and it matches the current database name.  
That way, thisdb.myschema.mytable is accepted as meaning just  
myschema.mytable, but otherdb.myschema.mytable is an error, and so  
is some.random.garbage.myschema.mytable.  
  
Mark Dilger, per report from Justin Pryzby and discussion among  
various people.  
  
Discussion: https://www.postgresql.org/message-id/20211013165426.GD27491%40telsasoft.com  

M doc/src/sgml/ref/psql-ref.sgml
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/t/002_nonesuch.pl
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/psql/describe.c
M src/fe_utils/string_utils.c
M src/include/fe_utils/string_utils.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

Remove trailing whitespace from *.sgml files.

commit   : 836af9756b742f5a8ae77b4bef9d27311772a13c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Apr 2022 11:04:28 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 20 Apr 2022 11:04:28 -0400    

Click here for diff

Historically we've been lax about this, but seeing that we're not  
lax in C files, there doesn't seem to be a good reason to be so  
in the documentation.  Remove the existing occurrences (mostly  
though not entirely in copied-n-pasted psql output), and modify  
.gitattributes so that "git diff --check" will warn about future  
cases.  
  
While at it, add *.pm to the set of extensions .gitattributes  
knows about, and remove some obsolete entries for files that  
we don't have in the tree anymore.  
  
Per followup discussion of commit 5a892c9b1.  
  
Discussion: https://postgr.es/m/E1nfcV1-000kOR-E5@gemulon.postgresql.org  

M .gitattributes
M doc/src/sgml/advanced.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/json.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/parallel.sgml
M doc/src/sgml/perform.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgsurgery.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/explain.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M doc/src/sgml/ref/pgtestfsync.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/rollback_to.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/ref/set_session_auth.sgml
M doc/src/sgml/ref/show.sgml
M doc/src/sgml/release-15.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/test-decoding.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/xaggr.sgml
M doc/src/sgml/xfunc.sgml

Fix incorrect format placeholders

commit   : 6c0f9f60f1c24aead1bfdd0ed294ac5b6f1d1ac1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 20 Apr 2022 16:11:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 20 Apr 2022 16:11:14 +0200    

Click here for diff

M src/bin/pgbench/pgbench.c

set_deparse_plan: Reuse variable to appease Coverity

commit   : e70813fbc4aaca35ec012d5a426706bd54e4acab    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 11:44:08 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 11:44:08 +0200    

Click here for diff

Coverity complains that dpns->outer_plan is deferenced (to obtain  
->targetlist) when possibly NULL.  We can avoid this by using  
dpns->outer_tlist instead, which was already obtained a few lines up.  
  
The fact that we end up with  
  dpns->inner_tlist = dpns->outer_tlist  
is a bit suspicious-looking and maybe worthy of more investigation, but  
I'll leave that for another day.  
  
Reviewed-by: Michaël Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql  

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

Move ModifyTableContext->lockmode to UpdateContext

commit   : a87e75956926f966d90bdd1a6bd495cf59cdc3ad    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 11:18:04 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 11:18:04 +0200    

Click here for diff

Should have been done this way to start with, but I failed to notice  
This way we avoid some pointless initialization, and better contains the  
variable to exist in the scope where it is really used.  
  
Reviewed-by: Michaël Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql  

M src/backend/executor/nodeModifyTable.c

ExecModifyTable: use context.planSlot instead of planSlot

commit   : 3dcc6bf4068a29be2bebee80bb919f8057af0fd9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 10:34:58 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 20 Apr 2022 10:34:58 +0200    

Click here for diff

There's no reason to keep a separate local variable when we have a place  
for it elsewhere.  This allows to simplify some code.  
  
Reviewed-by: Michaël Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/202204191345.qerjy3kxi3eb@alvherre.pgsql  

M src/backend/executor/nodeModifyTable.c

Stabilize streaming tests in test_decoding.

commit   : 74547b9c23f9f7ecfc6511e055982b8d5f51ae88    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 20 Apr 2022 08:59:55 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 20 Apr 2022 08:59:55 +0530    

Click here for diff

We have some streaming tests that rely on the size of changes which can  
fail if there are additional changes like invalidation messages by  
background activity like auto analyze. Avoid such failures by increasing  
autovacuum_naptime to a reasonably high value (1d).  
  
Author: Dilip Kumar  
Backpatch-through: 14  
Discussion: https://postgr.es/m/1958043.1650129119@sss.pgh.pa.us  

M contrib/test_decoding/logical.conf

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

commit   : 7bdd489d3d32d6ab5af1d2b22eaf8cc7dc148027    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 20 Apr 2022 15:17:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 20 Apr 2022 15:17:56 +1200    

Click here for diff

Similarly to what was done in 04539e73f, we standardized on SQL being  
pronounced "es-que-ell" rather than "sequel" in our documentation.  
  
Two inconsistencies have crept in during the v15 cycle.  The others  
existed before but were missed in 04539e73f due to none of the searches  
accounting for "SQL" being wrapped in tags.  
  
As with 04539e73f, we don't touch code comments here in order to not  
create unnecessary back-patching pain.  
  
Discussion: https://postgr.es/m/CAApHDvpML27UqFXnrYO1MJddsKVMQoiZisPvsAGhKE_tsKXquw%40mail.gmail.com  

M doc/src/sgml/func.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/xfunc.sgml

Fix breakage in AlterFunction().

commit   : 344a225cb9d42f20df063e4d0e0d4559c5de7910    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Apr 2022 23:03:59 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 19 Apr 2022 23:03:59 -0400    

Click here for diff

An ALTER FUNCTION command that tried to update both the function's  
proparallel property and its proconfig list failed to do the former,  
because it stored the new proparallel value into a tuple that was  
no longer the interesting one.  Carelessness in 7aea8e4f2.  
  
(I did not bother with a regression test, because the only likely  
future breakage would be for someone to ignore the comment I added  
and add some other field update after the heap_modify_tuple step.  
A test using existing function properties could not catch that.)  
  
Per report from Bryn Llewellyn.  Back-patch to all supported branches.  
  
Discussion: https://postgr.es/m/8AC9A37F-99BD-446F-A2F7-B89AD0022774@yugabyte.com  

M src/backend/commands/functioncmds.c

Remove duplicated word in comment of basebackup.c

commit   : 83cca409edf276cfbd2ff691ceea1b10027c5205    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 20 Apr 2022 11:05:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 20 Apr 2022 11:05:34 +0900    

Click here for diff

Oversight in 39969e2.  
  
Author: Martín Marqués  
Discussion: https://postgr.es/m/CABeG9LviA01oHC5h=ksLUuhMyXxmZR_tftRq6q3341CMT=j=4g@mail.gmail.com  

M src/backend/replication/basebackup.c

Fix extract epoch from interval calculation

commit   : f2a2bf66c87e14f07aefe23cbbe2f2d9edcd9734    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 19 Apr 2022 20:38:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 19 Apr 2022 20:38:53 +0200    

Click here for diff

The new numeric code for extract epoch from interval accidentally  
truncated the DAYS_PER_YEAR value to an integer, leading to results  
that mismatched the floating-point interval_part calculations.  
  
The commit a2da77cdb4661826482ebf2ddba1f953bc74afe4 that introduced  
this actually contains the regression test change that this reverts.  
I suppose this was missed at the time.  
  
Reported-by: Joseph Koshakow <koshy44@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/CAAvxfHd5n%3D13NYA2q_tUq%3D3%3DSuWU-CufmTf-Ozj%3DfrEgt7pXwQ%40mail.gmail.com  

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

Fix aggregate logging of pgbench.

commit   : a62bff74b135b191de0417d1cc8ec52f144c8fe7    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Tue, 19 Apr 2022 17:04:27 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Tue, 19 Apr 2022 17:04:27 +0900    

Click here for diff

Remove meaningless "failures" column from the aggregate logging. It  
was just a sum of "serialization failures" and "deadlock failures".  
Pointed out by Tom Lane. Patch reviewed by Fabien COELHO.  
  
Discussion: https://postgr.es/m/4183048.1649536705%40sss.pgh.pa.us  

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

Fix the check to limit sync workers.

commit   : dd4ab6fd6528e160571986fa8817cee9f2645aa8    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 19 Apr 2022 08:49:49 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 19 Apr 2022 08:49:49 +0530    

Click here for diff

We don't allow to invoke more sync workers once we have reached the sync  
worker limit per subscription. But the check to enforce this also doesn't  
allow to launch an apply worker if it gets restarted.  
  
This code was introduced by commit de43897122 but we caught the problem  
only with the test added by recent commit c91f71b9dc which started failing  
occasionally in the buildfarm.  
  
As per buildfarm.  
Diagnosed-by: Amit Kapila, Masahiko Sawada, Tomas Vondra  
Author: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com  
	    https://postgr.es/m/f90d2b03-4462-ce95-a524-d91464e797c8@enterprisedb.com  

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

Add missing error handling in pg_md5_hash().

commit   : 587de223f03e6086d511dab16b17406eb21277ce    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 18 Apr 2022 20:04:55 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 18 Apr 2022 20:04:55 -0400    

Click here for diff

It failed to provide an error string as expected for the  
admittedly-unlikely case of OOM in pg_cryptohash_create().  
Also, make it initialize *errstr to NULL for success,  
as pg_md5_binary() does.  
  
Also add missing comments.  Readers should not have to  
reverse-engineer the API spec for a publicly visible routine.  

M src/common/md5_common.c

Avoid invalid array reference in transformAlterTableStmt().

commit   : 36d4efe779bfc7190ea1c1cf8deb0d945b726663    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 18 Apr 2022 12:16:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 18 Apr 2022 12:16:45 -0400    

Click here for diff

Don't try to look at the attidentity field of system attributes,  
because they're not there in the TupleDescAttr array.  Sometimes  
this is harmless because we accidentally pick up a zero, but  
otherwise we'll report "no owned sequence found" from an attempt  
to alter a system attribute.  (It seems possible that a SIGSEGV  
could occur, too, though I've not seen it in testing.)  
  
It's not in this function's charter to complain that you can't  
alter a system column, so instead just hard-wire an assumption  
that system attributes aren't identities.  I didn't bother with  
a regression test because the appearance of the bug is very  
erratic.  
  
Per bug #17465 from Roman Zharkov.  Back-patch to all supported  
branches.  (There's not actually a live bug before v12, because  
before that get_attidentity() did the right thing anyway.  
But for consistency I changed the test in the older branches too.)  
  
Discussion: https://postgr.es/m/17465-f2a554a6cb5740d3@postgresql.org  

M src/backend/parser/parse_utilcmd.c

Fix second race condition in 002_archiving.pl with archive_cleanup_command

commit   : 1a8b110539efe18803c1fa8aa452a2178dbad9a9    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 13:41:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 13:41:40 +0900    

Click here for diff

Checking the execution of archive_cleanup_command on a standby requires  
a valid checkpoint coming from its primary, but the logic did not check  
that the standby replayed up to the point of the checkpoint, causing the  
test checking for the execution of archive_cleanup_command to fail.  
This race was more visible in slow environments.  
  
Issue introduced in 46dea24, so no backpatch is needed.  
  
Author: Tom Lane  
Discussion: https://postgr.es/m/4015413.1649454951@sss.pgh.pa.us  

M src/test/recovery/t/002_archiving.pl

Add additional documentation for row filters.

commit   : 676eeb6dd1655f7a3ee783b7ca0d645580630acc    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Apr 2022 08:42:37 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 18 Apr 2022 08:42:37 +0530    

Click here for diff

Commit 52e4f0cd47 added a feature to allow specifying row filters for  
logical replication of tables. This patch adds detailed documentation on  
that feature including examples to make it easier for users to understand.  
  
Author: Peter Smith, Euler Taveira  
Reviewed By: Greg Nancarrow, Aleksander Alekseev, Amit Kapila, Ajin Cherian, Alvaro Herrera  
Discussion: https://postgr.es/m/CAHut+PtnsBr59=_NvxXp_=S-em0WxyuDOQmSTuHGb4sVhkHffg@mail.gmail.com  

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

Fix race in TAP test 002_archiving.pl when restoring history file

commit   : e61efafcb82c605dcc78f668685223e20d2f7ad8    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 11:39:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 11:39:50 +0900    

Click here for diff

This test, introduced in df86e52, uses a second standby to check that  
it is able to remove correctly RECOVERYHISTORY and RECOVERYXLOG at the  
end of recovery.  This standby uses the archives of the primary to  
restore its contents, with some of the archive's contents coming from  
the first standby previously promoted.  In slow environments, it was  
possible that the test did not check what it should, as the history file  
generated by the promotion of the first standby may not be stored yet on  
the archives the second standby feeds on.  So, it could be possible that  
the second standby selects an incorrect timeline, without restoring a  
history file at all.  
  
This commits adds a wait phase to make sure that the history file  
required by the second standby is archived before this cluster is  
created.  This relies on poll_query_until() with pg_stat_file() and an  
absolute path, something not supported in REL_10_STABLE.  
  
While on it, this adds a new test to check that the history file has  
been restored by looking at the logs of the second standby.  This  
ensures that a RECOVERYHISTORY, whose removal needs to be checked,  
is created in the first place.  This should make the test more robust.  
  
This test has been introduced by df86e52, but it came in light as an  
effect of the bug fixed by acf1dd42, where the extra restore_command  
calls made the test much slower.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/YlT23IvsXkGuLzFi@paquier.xyz  
Backpatch-through: 11  

M src/test/recovery/t/002_archiving.pl

Handle compression level in pg_receivewal for LZ4

commit   : 42e44f3b3830cbc051a5d83956546e2ef553b047    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 10:18:34 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 18 Apr 2022 10:18:34 +0900    

Click here for diff

The new option set of pg_receivewal introduced in 042a923 to control the  
compression method makes it now easy to pass down various options,  
including the compression level.  The change to be able to do is simple,  
and requires one LZ4F_preferences_t fed to LZ4F_compressBegin().  
  
Note that LZ4F_INIT_PREFERENCES could be used to initialize the contents  
of LZ4F_preferences_t as required by LZ4, but this is only available  
since v1.8.3.  memset()'ing its structure to 0 is enough.  
  
Discussion: https://postgr.es/m/YlPQGNAAa04raObK@paquier.xyz  

M src/bin/pg_basebackup/walmethods.c

Add a temp-install prerequisite to src/interfaces/ecpg "checktcp".

commit   : 42dbbca58e8e87e461bb0a4fe48a450e90e1e932    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Sat, 16 Apr 2022 17:43:54 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Sat, 16 Apr 2022 17:43:54 -0700    

Click here for diff

The target failed, tested $PATH binaries, or tested a stale temporary  
installation.  Commit c66b438db62748000700c9b90b585e756dd54141 missed  
this.  Back-patch to v10 (all supported versions).  

M src/interfaces/ecpg/Makefile

Don't retry restore_command while reading ahead.

commit   : acf1dd42342d6d84ca8e7a1998335e2e8809759e    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 17 Apr 2022 10:22:03 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sun, 17 Apr 2022 10:22:03 +1200    

Click here for diff

Suppress further attempts to read ahead in the WAL if we run out of  
data, until the records already decoded have been replayed.  This  
restores the traditional behavior for continuous archive recovery, which  
is to retry the failing restore_command only every 5 seconds.  With the  
coding in 5dc0418f, we would start retrying every time through the  
recovery loop when our WAL decoding window hit the end of the current  
segment and we tried to look ahead into a not-yet-available next file.  
That was very slow.  
  
Also change the no_readahead_until mechanism to use <= rather than <,  
which seems more useful.  Otherwise we'd either get one extra unwanted  
retry of restore_command, or we'd need to add 1 to an LSN.  
  
No change in behavior for regular streaming.  That was already limited  
by the flushedUpto variable, which won't be updated until we replay what  
we have already.  
  
Reported by Andres Freund while analyzing the failure of a TAP test on  
build farm animal skink (investigation ongoing but probably due to  
otherwise unrelated timing bugs triggered by this slowness magnified by  
valgrind).  
  
Discussion: https://postgr.es/m/20220409005910.alw46xqmmgny2sgr%40alap3.anarazel.de  

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

pgstat: Use correct lock level in pgstat_drop_all_entries().

commit   : 4a736a161c306fcfed970e6b649f2f03f465ac24    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 16 Apr 2022 12:13:31 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 16 Apr 2022 12:13:31 -0700    

Click here for diff

Previously we didn't, which lead to an assertion failure when resetting  
partially loaded statistics. This was encountered on the buildfarm, for  
as-of-yet unknown reasons.  
  
Ttighten up a validity check when reading the stats file, verifying 'E'  
signals the end of the file (rather than just stopping reading). That's then  
used in a test appending to the stats file that crashed before the fix in  
pgstat_drop_all_entries().  
  
Reported by buildfarm animals mylodon and kestrel, via Tom Lane.  
  
Discussion: https://postgr.es/m/1656446.1650043715@sss.pgh.pa.us  

M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/test/recovery/t/029_stats_restart.pl

Fix incorrect logic in HaveRegisteredOrActiveSnapshot().

commit   : 9f4f0a0dad4c7422a97d94e4051c08ec6d181dd6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 16 Apr 2022 16:04:50 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 16 Apr 2022 16:04:50 -0400    

Click here for diff

This function gave the wrong answer when there's more than one  
RegisteredSnapshots entry, whether or not any of them is the  
CatalogSnapshot.  This leads to assertion failure in some scenarios  
involving fetching toasted data using a cursor.  (As per discussion,  
I'm dubious that this is the right contract to be enforcing at all;  
but it surely doesn't help to be enforcing it incorrectly.)  
  
Fetching toasted data using a cursor is evidently under-tested,  
so add a test case too.  
  
Per report from Erik Rijkers.  This is new code, so no need for  
back-patch.  
  
Discussion: https://postgr.es/m/dc9dd229-ed30-6c62-4c41-d733ffff776b@xs4all.nl  

M src/backend/utils/time/snapmgr.c
M src/test/regress/expected/portals.out
M src/test/regress/sql/portals.sql

Build libpq test programs under MSVC

commit   : a17fd67d2f2861ae0ce00d1aeefdf2facc47cd5e    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 16 Apr 2022 09:35:15 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 16 Apr 2022 09:35:15 -0400    

Click here for diff

This allows the newly added TAP tests to run.  

M src/tools/msvc/Mkvcbuild.pm

Fix some trailing whitespace in documentation files

commit   : 5a892c9b154f513a42c4a42cdfdae524ce33c86a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 16 Apr 2022 09:05:07 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 16 Apr 2022 09:05:07 +0200    

Click here for diff

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/runtime.sgml

Use standard timeout, in 010_pg_basebackup.pl.

commit   : 5fbb2d8f105efee1d059a7edb86f45e38616d329    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Fri, 15 Apr 2022 23:15:38 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Fri, 15 Apr 2022 23:15:38 -0700    

Click here for diff

Per buildfarm member mandrill.  The test is new in v15, so no back-patch.  

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

Fix multi-table VACUUM VERBOSE accounting.

commit   : d3609dd2547b3ed807bc3b6dd27a008d65e86668    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 15:48:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 15:48:39 -0700    

Click here for diff

Per-backend global variables like VacuumPageHit are initialized once per  
VACUUM command.  This was missed by commit 49c9d9fc, which unified  
VACUUM VERBOSE and autovacuum logging.  As a result of that oversight,  
incorrect values were shown when multiple relations were processed by a  
single VACUUM VERBOSE command.  
  
Relations that happened to be processed later on would show "buffer  
usage:" values that incorrectly included buffer accesses made while  
processing earlier unrelated relations.  The same accesses were counted  
multiple times.  
  
To fix, take initial values for the tracker variables at the start of  
heap_vacuum_rel(), and report delta values later on.  

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

psql: fix \l display for pre-v15 databases.

commit   : 7129a9791eafdd825eae0187b7dd7b99ed48fdc7    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 18:31:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 18:31:01 -0400    

Click here for diff

With a pre-v15 server, show NULL for the "ICU Locale" column,  
matching what you see in v15 when the database locale isn't ICU.  
The previous coding incorrectly repeated datcollate here.  
  
(There's an unfinished discussion about whether to consolidate  
these columns in \l output, but in any case we'd want this fix  
for \l+ output.)  
  
Euler Taveira, per report from Christoph Berg  
  
Discussion: https://postgr.es/m/YlmIFCqu+TZSW4rB@msg.df7cb.de  

M src/bin/psql/describe.c

Tighten ComputeXidHorizons' handling of walsenders.

commit   : 6fea65508a1aa6a1caa5f3e7b4d27bcccb0740d8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 17:50:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 17:50:01 -0400    

Click here for diff

ComputeXidHorizons (nee GetOldestXmin) thought that it could identify  
walsenders by checking for proc->databaseId == 0.  Perhaps that was  
safe when the code was written, but it's been wrong at least since  
autovacuum was invented.  Background processes that aren't connected  
to any particular database, such as the autovacuum launcher and  
logical replication launcher, look like that too.  
  
This imprecision is harmful because when such a process advertises an  
xmin, the result is to hold back dead-tuple cleanup in all databases,  
though it'd be sufficient to hold it back in shared catalogs (which  
are the only relations such a process can access).  Aside from being  
generally inefficient, this has recently been seen to cause regression  
test failures in the buildfarm, as a consequence of the logical  
replication launcher's startup transaction preventing VACUUM from  
marking pages of a user table as all-visible.  
  
We only want that global hold-back effect for the case where a  
walsender is advertising a hot standby feedback xmin.  Therefore,  
invent a new PGPROC flag that says that a process' xmin should be  
considered globally, and check that instead of using the incorrect  
databaseId == 0 test.  Currently only a walsender sets that flag,  
and only if it is not connected to any particular database.  (This is  
for bug-compatibility with the undocumented behavior of the existing  
code, namely that feedback sent by a client who has connected to a  
particular database would not be applied globally.  I'm not sure this  
is a great definition; however, such a client is capable of issuing  
plain SQL commands, and I don't think we want xmins advertised for  
such commands to be applied globally.  Perhaps this could do with  
refinement later.)  
  
While at it, I rewrote the comment in ComputeXidHorizons, and  
re-ordered the commented-upon if-tests, to make them match up  
for intelligibility's sake.  
  
This is arguably a back-patchable bug fix, but given the lack of  
complaints I think it prudent to let it age awhile in HEAD first.  
  
Discussion: https://postgr.es/m/1346227.1649887693@sss.pgh.pa.us  

M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/include/storage/proc.h

VACUUM VERBOSE: Show dead items for an empty table.

commit   : bdb71dbe80d0560f84255e05b73f449e11007325    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 14:20:56 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 14:20:56 -0700    

Click here for diff

Be consistent about the lines that VACUUM VERBOSE outputs by including  
an "index scan not needed: " line for completely empty tables. This  
makes the output more readable, especially with multiple distinct VACUUM  
operations processed by the same VACUUM command.  It's also more  
consistent; even empty tables can use the failsafe, which wasn't  
reported in the standard way until now.  
  
Follow-up to commit 6e20f460, which taught VACUUM VERBOSE to be more  
consistent about reporting on scanned pages with empty tables.  

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

Adjust VACUUM's removable cutoff log message.

commit   : 357c8455e64915f2d8f50ca5853eb91b74470d96    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 13:21:43 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 15 Apr 2022 13:21:43 -0700    

Click here for diff

The age of OldestXmin (a.k.a. "removable cutoff") when VACUUM ends often  
indicates the approximate number of XIDs consumed while VACUUM ran.  
However, there is at least one important exception: the cutoff could be  
held back by a snapshot that was acquired before our VACUUM even began.  
Successive VACUUM operations may even use exactly the same old cutoff in  
extreme cases involving long held snapshots.  
  
The log messages that described how removable cutoff aged (which were  
added by commit 872770fd) created the impression that we were reporting  
on how VACUUM's usable cutoff advanced while VACUUM ran, which was  
misleading in these extreme cases.  Fix by using a more general wording.  
  
Per gripe from Tom Lane.  
  
In passing, relocate related instrumentation code for clarity.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/1643035.1650035653@sss.pgh.pa.us  

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

Revert "Temporarily add some probes of tenk1's relallvisible in create_index.sql."

commit   : 91998539b227dfc6dd091714da7d106f2c95a321    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 13:29:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 15 Apr 2022 13:29:39 -0400    

Click here for diff

This reverts commit 5bb2b6abc8d6cf120a814317816e4384bcbb9c1e.  
Not needed anymore.  

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

Small cleanups in SQL/JSON code

commit   : f7a605f636d62935b80f9905575d40bc4eeca5ae    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 15 Apr 2022 07:47:12 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Fri, 15 Apr 2022 07:47:12 -0400    

Click here for diff

These are to keep Coverity happy. In one case remove a redundant NULL  
check, and in another explicitly ignore a function result that is already  
known.  

M src/backend/parser/parse_expr.c
M src/backend/utils/adt/jsonb.c

pgstat: set timestamps of fixed-numbered stats after a crash.

commit   : 5cd1c40b3ce9600f129fd1fea9850e1affaf31d5    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 14 Apr 2022 17:40:25 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 14 Apr 2022 17:40:25 -0700    

Click here for diff

When not loading stats at startup (i.e. pgstat_discard_stats() getting  
called), reset timestamps of fixed numbered stats would be left at  
0. Oversight in 5891c7a8ed8.  
  
Instead use pgstat_reset_after_failure() and add tests verifying that  
fixed-numbered reset timestamps are set appropriately.  
  
Reported-By: "David G. Johnston" <david.g.johnston@gmail.com>  
Discussion: https://postgr.es/m/CAKFQuwamFuaQHKdhcMt4Gbw5+Hca2UE741B8gOOXoA=TtAd2Yw@mail.gmail.com  

M src/backend/utils/activity/pgstat.c
M src/test/recovery/t/029_stats_restart.pl

Have CLUSTER ignore partitions not owned by caller

commit   : 3f19e176ae0f55a653d62e1504dbe5ad8c1006a0    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Apr 2022 22:11:06 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Apr 2022 22:11:06 +0200    

Click here for diff

If a partitioned table has partitions owned by roles other than the  
owner of the partitioned table, don't include them in the to-be-  
clustered list.  This is similar to what VACUUM FULL does (except we do  
it sooner, because there is no reason to postpone it).  Add a simple  
test to verify that only owned partitions are clustered.  
  
While at it, change memory context switch-and-back to occur once per  
partition instead of outside of the loop.  
  
Author: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/20220411140609.GF26620@telsasoft.com  

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

Reword text on ROW SHARE lock as acquired by SELECT FOR <lock>

commit   : 275e719d910459db747346a51d56185e2440763b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Apr 2022 21:52:20 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 14 Apr 2022 21:52:20 +0200    

Click here for diff

It was missing lock levels FOR KEY SHARE and FOR NO KEY EXCLUSIVE; but  
also SELECT FOR UPDATE is not a command separate from SELECT, as the  
original text implied.  It is clearer to state that FOR <lock strength>  
is an option of regular SELECT.  
  
Per suggestion from Joey Bodoia <jbodoia21@cmc.edu>  
  
Reviewed-by: Joey Bodoia <jbodoia21@cmc.edu> (offlist)  
Reviewed-by: Erikjan Rijkers <er@xs4all.nl>  
Discussion: https://postgr.es/m/164908765512.682.17348032020747341013@wrigleys.postgresql.org  

M doc/src/sgml/mvcc.sgml

Temporarily add some probes of tenk1's relallvisible in create_index.sql.

commit   : 5bb2b6abc8d6cf120a814317816e4384bcbb9c1e    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 14 Apr 2022 12:14:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 14 Apr 2022 12:14:01 -0400    

Click here for diff

This is to gather some more evidence about why buildfarm member wrasse  
is failing.  We should revert it (or at least scale it way back) once  
that's resolved.  
  
Discussion: https://postgr.es/m/1346227.1649887693@sss.pgh.pa.us  

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

Improve a couple of sql/json error messages

commit   : 4cd8717af3f0345c758d46fea06fb390b4d593f2    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 14 Apr 2022 10:26:29 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 14 Apr 2022 10:26:29 -0400    

Click here for diff

Fix the grammar in two, and add a hint to one.  

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

Fix transformJsonBehavior

commit   : fcdb35c32ac70a113c134a66daf9ba28523ff32b    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 14 Apr 2022 08:57:09 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 14 Apr 2022 08:57:09 -0400    

Click here for diff

Commit 1a36bc9dba8 conained some logic that was a little opaque and  
could have involved a NULL dereference, as complained about by Coverity.  
Make the logic more transparent and in doing so avoid the NULL  
dereference.  

M src/backend/parser/parse_expr.c

pageinspect: Fix handling of all-zero pages

commit   : cd4868a5700fadf5a840d44686658517433b338c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Apr 2022 15:08:03 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 14 Apr 2022 15:08:03 +0900    

Click here for diff

Getting from get_raw_page() an all-zero page is considered as a valid  
case by the buffer manager and it can happen for example when finding a  
corrupted page with zero_damaged_pages enabled (using zero_damaged_pages  
to look at corrupted pages happens), or after a crash when a relation  
file is extended before any WAL for its new data is generated (before a  
vacuum or autovacuum job comes in to do some cleanup).  
  
However, all the functions of pageinspect, as of the index AMs (except  
hash that has its own idea of new pages), heap, the FSM or the page  
header have never worked with all-zero pages, causing various crashes  
when going through the page internals.  
  
This commit changes all the pageinspect functions to be compliant with  
all-zero pages, where the choice is made to return NULL or no rows for  
SRFs when finding a new page.  get_raw_page() still works the same way,  
returning a batch of zeros in the bytea of the page retrieved.  A hard  
error could be used but NULL, while more invasive, is useful when  
scanning relation files in full to get a batch of results for a single  
relation in one query.  Tests are added for all the code paths  
impacted.  
  
Reported-by: Daria Lepikhova  
Author: Michael Paquier  
Discussion: https://postgr.es/m/561e187b-3549-c8d5-03f5-525c14e65bd0@postgrespro.ru  
Backpatch-through: 10  

M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/expected/brin.out
M contrib/pageinspect/expected/btree.out
M contrib/pageinspect/expected/gin.out
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/expected/hash.out
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/rawpage.c
M contrib/pageinspect/sql/brin.sql
M contrib/pageinspect/sql/btree.sql
M contrib/pageinspect/sql/gin.sql
M contrib/pageinspect/sql/gist.sql
M contrib/pageinspect/sql/hash.sql
M contrib/pageinspect/sql/page.sql

Add missing spaces after single-line comments

commit   : a00fd066b1b632e675bae74841a87de1ffc1cd33    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 14 Apr 2022 09:28:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 14 Apr 2022 09:28:56 +1200    

Click here for diff

Only 1 of 3 of these changes appear to be handled by pgindent. That change  
is new to v15.  The remaining two appear to be left alone by pgindent. The  
exact reason for that is not 100% clear to me.  It seems related to the  
fact that it's a line that contains *only* a single line comment and no  
actual code.  It does not seem worth investigating this in too much  
detail.  In any case, these do not conform to our usual practices, so fix  
them.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M src/backend/storage/file/fd.c
M src/include/replication/message.h
M src/include/tsearch/ts_type.h

Docs: fix some spelling mistakes and also do some wordsmithing

commit   : ac8be0cb957811d04d7564f4d710ceb3e5f2fb9f    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 14 Apr 2022 09:16:05 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 14 Apr 2022 09:16:05 +1200    

Click here for diff

All except one of these are new to v15.  Only one of the wordsmithing  
changes appears in older versions. The wordsmithing improvement does not  
seem significant enough to warrant backpatching.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/initdb.sgml

Fix case sensitivity in psql's tab completion for GUC names.

commit   : b5607b0746f40b3f5b38004c64ccc9697ee1e222    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 16:26:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 16:26:34 -0400    

Click here for diff

Input for these should be case-insensitive, but was not completely  
so.  Comparing to the similar queries for timezone names, I realized  
that we'd missed forcing the comparison pattern to lower-case.  
With that, it behaves as I expect.  
  
While here, flatten the sub-selects in these queries; I don't  
find that those add any readability.  
  
Discussion: https://postgr.es/m/3369130.1649348542@sss.pgh.pa.us  

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

Further tweak the default behavior of psql's \dconfig.

commit   : 139d46ee26a2c7813d02739d35fa305890643ac1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 15:03:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 15:03:58 -0400    

Click here for diff

Define "parameters with non-default settings" as being those that  
not only have pg_settings.source different from 'default', but  
also have a current value different from the hard-wired boot_val.  
Adding the latter restriction removes a number of not-very-interesting  
cases where the active setting is chosen by initdb but in practice  
tends to be the same all the time.  
  
Per discussion with Jonathan Katz.  
  
Discussion: https://postgr.es/m/YlFQLzlPi4QD0wSi@msg.df7cb.de  

M src/bin/psql/describe.c

Prevent access to no-longer-pinned buffer in heapam_tuple_lock().

commit   : 7b7ed046cb2ad9f6efac90380757d5977f0f563f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 13:35:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 13 Apr 2022 13:35:02 -0400    

Click here for diff

heap_fetch() used to have a "keep_buf" parameter that told it to return  
ownership of the buffer pin to the caller after finding that the  
requested tuple TID exists but is invisible to the specified snapshot.  
This was thoughtlessly removed in commit 5db6df0c0, which broke  
heapam_tuple_lock() (formerly EvalPlanQualFetch) because that function  
needs to do more accesses to the tuple even if it's invisible.  The net  
effect is that we would continue to touch the page for a microsecond or  
two after releasing pin on the buffer.  Usually no harm would result;  
but if a different session decided to defragment the page concurrently,  
we could see garbage data and mistakenly conclude that there's no newer  
tuple version to chain up to.  (It's hard to say whether this has  
happened in the field.  The bug was actually found thanks to a later  
change that allowed valgrind to detect accesses to non-pinned buffers.)  
  
The most reasonable way to fix this is to reintroduce keep_buf,  
although I made it behave slightly differently: buffer ownership  
is passed back only if there is a valid tuple at the requested TID.  
In HEAD, we can just add the parameter back to heap_fetch().  
To avoid an API break in the back branches, introduce an additional  
function heap_fetch_extended() in those branches.  
  
In HEAD there is an additional, less obvious API change: tuple->t_data  
will be set to NULL in all cases where buffer ownership is not returned,  
in particular when the tuple exists but fails the time qual (and  
!keep_buf).  This is to defend against any other callers attempting to  
access non-pinned buffers.  We concluded that making that change in back  
branches would be more likely to introduce problems than cure any.  
  
In passing, remove a comment about heap_fetch that was obsoleted by  
9a8ee1dc6.  
  
Per bug #17462 from Daniil Anisimov.  Back-patch to v12 where the bug  
was introduced.  
  
Discussion: https://postgr.es/m/17462-9c98a0f00df9bd36@postgresql.org  

M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/include/access/heapam.h

Remove extraneous blank lines before block-closing braces

commit   : 24d2b2680a8d0e01b30ce8a41c4eb3b47aca5031    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 13 Apr 2022 19:14:20 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 13 Apr 2022 19:14:20 +0200    

Click here for diff

These are useless and distracting.  We wouldn't have written the code  
with them to begin with, so there's no reason to keep them.  
  
Author: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  
Discussion: https://postgr.es/m/attachment/133167/0016-Extraneous-blank-lines.patch  

M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_ts.c
M contrib/dblink/dblink.c
M contrib/intarray/_int_bool.c
M contrib/ltree/ltxtquery_io.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/postgres_fdw/connection.c
M contrib/spi/refint.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_attrdef.c
M src/backend/commands/copyto.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execParallel.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeMergejoin.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/libpq/hba.c
M src/backend/optimizer/geqo/geqo_cx.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_ox1.c
M src/backend/optimizer/geqo/geqo_ox2.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_px.c
M src/backend/optimizer/plan/planner.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/backend/statistics/dependencies.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/page/bufpage.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/tuplesort.c
M src/bin/initdb/initdb.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/psql/describe.c
M src/bin/psql/prompt.c
M src/common/jsonapi.c
M src/fe_utils/print.c
M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/data.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/misc.c
M src/interfaces/ecpg/pgtypeslib/dt_common.c
M src/interfaces/ecpg/pgtypeslib/interval.c
M src/interfaces/ecpg/pgtypeslib/numeric.c
M src/interfaces/ecpg/pgtypeslib/timestamp.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/pl/tcl/pltcl.c
M src/port/chklocale.c
M src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c

Release cache tuple when no longer needed

commit   : ed0fbc8e5ac995eada933250c1d5535336442b97    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 13 Apr 2022 18:19:38 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 13 Apr 2022 18:19:38 +0200    

Click here for diff

There was a small buglet in commit 52e4f0cd472d whereby a tuple acquired  
from cache was not released, giving rise to WARNING messages; fix that.  
  
While at it, restructure the code a bit on stylistic grounds.  
  
Author: Hou zj <houzj.fnst@fujitsu.com>  
Reported-by: Peter Smith <smithpb2250@gmail.com>  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://postgr.es/m/CAHut+PvKTyhTBtYCQsP6Ph7=o-oWRSX+v+PXXLXp81-o2bazig@mail.gmail.com  

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

Fix finalization for json_objectagg and friends

commit   : 112fdb3528465cc14a2f1dff3dc27f100326d885    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 13 Apr 2022 10:26:38 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 13 Apr 2022 10:26:38 -0400    

Click here for diff

Commit f4fb45d15c misguidedly tried to free some state during aggregate  
finalization for json_objectagg. This resulted in attempts to access  
freed memory, especially when the function is used as a window function.  
Commit 4eb9798879 attempted to ameliorate that, but in fact it should  
just be ripped out, which is done here. Also add some regression tests  
for json_objectagg in various flavors as a window function.  
  
Original report from Jaime Casanova, diagnosis by Andres Freund.  
  
Discussion: https://postgr.es/m/YkfeMNYRCGhySKyg@ahch-to  

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

Fix incorrect format placeholders

commit   : a038679cd876f63e17a08f64fafad27cd5bc23fe    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 13 Apr 2022 14:04:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 13 Apr 2022 14:04:51 +0200    

Click here for diff

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

Docs: wording improvement for compute_query_id = regress

commit   : a59746d311264305bbe68aaf48d5b20e8fd56920    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 21:28:25 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 21:28:25 +1200    

Click here for diff

It's more accurate to say that the query identifier is not shown when  
compute_query_id = regress rather than to say it is hidden.  
  
This change (ebf6c5249) appeared in v14, so it makes sense to backpatch  
this small adjustment to keep the documents consistent between v14 and  
master.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  
Backpatch-through: 14, where compute_query_id = regress was added  

M doc/src/sgml/config.sgml

Remove "recheck" argument from check_index_is_clusterable()

commit   : b940918dc888b9b797f29d965f8beafe0a4271b5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Apr 2022 15:32:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Apr 2022 15:32:35 +0900    

Click here for diff

The last usage of this argument in this routine can be tracked down to  
7e2f9062, aka 11 years ago.  Getting rid of this argument can also be an  
advantage for extensions calling check_index_is_clusterable(), as it  
removes any need to worry about the meaning of what a recheck would be  
at this level.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411140609.GF26620@telsasoft.com  

M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/include/commands/cluster.h

Docs: tidy up various usages of the productname tag

commit   : fdc18ea23b393d4a34c78b94ad3fcaf547e74959    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 17:42:13 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 17:42:13 +1200    

Click here for diff

This tries to bring a bit more consistency to the use of the <productname>  
tag in the documents.  This fixes a couple of mistakes with our own  
product.  We definitely should be consistently calling that PostgreSQL  
when we're referring to the modern-day version of the software.  
  
This also tidies up a couple of inconsistencies with the case of other  
product names, namely Emacs and Python.  We also get rid of some incorrect  
usages of <productname> and replace them with <literal>.  
  
Many of these mistakes exist in the back branches, but they don't quite  
seem critical enough to warrant fixing them in prior versions at this  
stage.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/sources.sgml

Rework compression options of pg_receivewal

commit   : 042a923ad53dfbe39a9d5012d6c3cf3c9c338884    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Apr 2022 11:09:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 13 Apr 2022 11:09:51 +0900    

Click here for diff

Since babbbb5 and the introduction of LZ4 in pg_receivewal, the  
compression of the WAL archived is controlled by two options:  
- --compression-method with "gzip", "none" or "lz4" as possible value.  
- --compress=N to specify a compression level.  This includes a  
backward-incompatible change where a value of 0 leads to a failure  
instead of no compression enforced.  
  
This commit takes advantage of a4b5754 and 3603f7c to rework the  
compression options of pg_receivewal, as of:  
- The removal of --compression-method.  
- The extenction of --compress to use the same grammar as pg_basebackup,  
with a METHOD:DETAIL format, where a METHOD is "gzip", "none" or "lz4"  
and a DETAIL is a comma-separated list of options, the only keyword  
supported is now "level" to control the compression level.  If only an  
integer is specified as value of this option, "none" is implied on 0  
and "gzip" is implied otherwise.  This brings back --compress to be  
backward-compatible with ~14, while still supporting LZ4.  
  
This has also the advantage of centralizing the set of checks used by  
pg_receivewal to validate its compression options.  
  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/YlPQGNAAa04raObK@paquier.xyz  

M doc/src/sgml/ref/pg_receivewal.sgml
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/020_pg_receivewal.pl

Docs: adjust wording about basebackup_to_shell's required_role GUC

commit   : d27323db7c451462387cd284275e1e79c59f7bac    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 12:01:23 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 12:01:23 +1200    

Click here for diff

Author: Justin Pryzby  
Reviewed-by: Robert Haas  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M doc/src/sgml/basebackup-to-shell.sgml

Docs: adjust pg_upgrade syntax to mark -B as optional

commit   : 0f0b76b67a064083c77a25a307592c55ab5f2930    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 11:18:54 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 11:18:54 +1200    

Click here for diff

This was made optional in 959f6d6a1.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  
Backpatch-through: 13, where -B was made optional  

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

Doc: tweak textsearch.sgml for SEO purposes.

commit   : aa36e7dd38d35b81d978ab94cd7a6fd3dc2d23c5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 18:21:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 18:21:04 -0400    

Click here for diff

Google seems to like to return textsearch.html for queries about  
GIN and GiST indexes, even though it's not a primary reference  
for either.  It seems likely that that's because those keywords  
appear in the page title.  Since "GIN and GiST Index Types" is  
not a very apposite title for this material anyway, rename the  
section in hopes of stopping that.  
  
Also provide explicit links to the GIN and GiST chapters, to help  
anyone who finds their way to this page regardless.  
  
Per gripe from Jan Piotrowski.  Back-patch to supported branches.  
(Unfortunately Google is likely to continue returning the 9.1  
version of this page, but improving that situation is a matter  
for the www team.)  
  
Discussion: https://postgr.es/m/164978902252.1276550.9330175733459697101@wrigleys.postgresql.org  

M doc/src/sgml/textsearch.sgml

Docs: avoid confusing use of the word "synchronized"

commit   : 55ff3563d8fac659147a87ea93ec1464c601107d    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 09:15:02 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 13 Apr 2022 09:15:02 +1200    

Click here for diff

It's misleading to call the data directory the "synchronized data  
directory" when discussing a crash scenario when using pg_rewind's  
--no-sync option.  Here we just remove the word "synchronized" to avoid  
any possible confusion.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  
Backpatch-through: 12, where --no-sync was added  

M doc/src/sgml/ref/pg_rewind.sgml

commit   : 7fc0e7de9fb8306e84d1c15211aba4308f694455    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 12 Apr 2022 14:45:23 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 12 Apr 2022 14:45:23 -0400    

Click here for diff

This reverts commits 0147fc7, 4567596, aa64f23, and 5ecd018.  
There is no longer agreement that introducing this function  
was the right way to address the problem. The consensus now  
seems to favor trying to make a correct value for MaxBackends  
available to mdules executing their _PG_init() functions.  
  
Nathan Bossart  
  
Discussion: http://postgr.es/m/20220323045229.i23skfscdbvrsuxa@jrouhaud  

M src/backend/access/nbtree/nbtutils.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/commands/async.c
M src/backend/libpq/pqcomm.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/init/postinit.c
M src/include/miscadmin.h

Remove not-very-useful early checks of __pg_log_level in logging.h.

commit   : 2c9381840fe2d6d1c3179350493fe5fd3dcf90b5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 13:25:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 13:25:29 -0400    

Click here for diff

Enforce __pg_log_level message filtering centrally in logging.c,  
instead of relying on the calling macros to do it.  This is more  
reliable (e.g. it works correctly for direct calls to pg_log_generic)  
and it saves a percent or so of total code size because we get rid of  
so many duplicate checks of __pg_log_level.  
  
This does mean that argument expressions in a logging macro will be  
evaluated even if we end up not printing anything.  That seems of  
little concern for INFO and higher levels as those messages are printed  
by default, and most of our frontend programs don't even offer a way to  
turn them off.  I left the unlikely() checks in place for DEBUG  
messages, though.  
  
Discussion: https://postgr.es/m/3993549.1649449609@sss.pgh.pa.us  

M src/bin/pg_dump/pg_backup_utils.h
M src/common/logging.c
M src/include/common/logging.h

Doc: update description of random() function.

commit   : d4f109e4a2c028bcd889cc44d84b10fff7d9186b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 11:36:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 12 Apr 2022 11:36:45 -0400    

Click here for diff

Commit 3804539e4 neglected to update the documentation's claim that  
random() uses a "linear congruential algorithm".  In hopes of avoiding  
the same mistake if someone replaces our PRNG again, just say it's a  
deterministic pseudo-random number generator and leave it at that.  
Anybody who really wants to know can look in the source code.  
  
COMPATIBILITY NOTE FOR RELEASE NOTES: 3804539e4's commit message  
really should have mentioned that the random() sequence after  
setseed(), while still repeatable, will differ from what you got  
in pre-v15 releases.  
  
Noted by Dagfinn Ilmari Mannsåker; wording suggestion by Dean Rasheed.  
  
Discussion: https://postgr.es/m/875ynfpiru.fsf@wibble.ilmari.org  

M doc/src/sgml/func.sgml

Use WRITE_ENUM_FIELD for enum field

commit   : e7cc4a6e3dcc39f3643f998aa5da6a6f27f28db5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Apr 2022 16:19:00 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Apr 2022 16:19:00 +0200    

Click here for diff

M src/backend/nodes/outfuncs.c

Make node output prefix match node structure name

commit   : 51e81794058e78a151368d0b652f3c92602568c0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Apr 2022 16:18:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 12 Apr 2022 16:18:01 +0200    

Click here for diff

as done in e58136069687b9cf29c27281e227ac397d72141d  

M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c

adjust_partition_colnos mustn't be called if not needed

commit   : 183c869e1cbf69e7f5408ccb2121d37deec9956e    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Apr 2022 15:19:57 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Apr 2022 15:19:57 +0200    

Click here for diff

Add an assert to make this very explicit, as well as a code comment.  
The former should silence Coverity complaining about this.  
  
Introduced by 7103ebb7aae8.  
  
Reported-by: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqTTAOzXiYybab+1DQOb3ZUuK99=p_KD+yrRFhcDbd0jg@mail.gmail.com  

M src/backend/executor/execPartition.c

Fix documentation for pg_stat_recovery_prefetch.

commit   : 4533de358dd5f2a8930e3a73bcb49103b37357be    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 12 Apr 2022 21:19:47 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 12 Apr 2022 21:19:47 +1200    

Click here for diff

The table was in the wrong section and using an older type of link, as  
reported by Sirisha, and also using an older table layout, as I noticed  
while trying to figure out how and when it might have got out of sync.  
  
Defect in commit 5dc0418f.  
  
Author: sirisha chamarthi <sirichamarthi22@gmail.com>  
Author: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CAKrAKeVk-LRHMdyT6x_p33eF6dCorM2jed5h_eHdRdv0reSYTA@mail.gmail.com  

M doc/src/sgml/monitoring.sgml

Fix grammatical errors and typos in logical replication docs.

commit   : aeebb8bf233e7f48a7a6eb6857e7b7c61ef0ef4c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Apr 2022 14:14:32 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 12 Apr 2022 14:14:32 +0530    

Click here for diff

Author: Justin Pryzby  
Reviewed By: Masahiko Sawada  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

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

Remove WalCompressionMethod in favor of pg_compress_algorithm

commit   : 3603f7c6e66afda7c7bf4acdefd4e5b04c5478b3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 Apr 2022 17:28:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 Apr 2022 17:28:17 +0900    

Click here for diff

The same structure, with the same set of elements (for none, lz4, gzip  
and zstd), exists in compression.h, so let's make use of the centralized  
version instead of duplicating things.  Some of the variables used  
previously for WalCompressionMethod are renamed to stick better with the  
new structure and routine names.  
  
WalCompressionMethod was leading to some confusion in walmethods.c, as  
it was sometimes used to refer to some data unrelated to WAL.  
  
Reported-by: Robert Haas  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/YlPQGNAAa04raObK@paquier.xyz  

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h

Change mechanism to set up source targetlist in MERGE

commit   : ce4f46fdc814eb1b704d81640f6d8f03625d0f53    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Apr 2022 09:29:39 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 12 Apr 2022 09:29:39 +0200    

Click here for diff

We were setting MERGE source subplan's targetlist by expanding the  
individual attributes of the source relation completely, early in the  
parse analysis phase.  This failed to work when the condition of an  
action included a whole-row reference, causing setrefs.c to error out  
with  
  ERROR:  variable not found in subplan target lists  
because at that point there is nothing to resolve the whole-row  
reference with.  We can fix this by having preprocess_targetlist expand  
the source targetlist for Vars required from the source rel by all  
actions.  Moreover, by using this expansion mechanism we can do away  
with the targetlist expansion in transformMergeStmt, which is good  
because then we no longer pull in columns that aren't needed for  
anything.  
  
Add a test case for the problem.  
  
While at it, remove some redundant code in preprocess_targetlist():  
MERGE was doing separately what is already being done for UPDATE/DELETE,  
so we can just rely on the latter and remove the former.  (The handling  
of inherited rels was different for MERGE, but that was a no-longer-  
necessary hack.)  
  
Fix outdated, related comments for fix_join_expr also.  
  
Author: Richard Guo <guofenglinux@gmail.com>  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Reported-by: Joe Wildish <joe@lateraljoin.com>  
Discussion: https://postgr.es/m/fab3b90a-914d-46a9-beb0-df011ee39ee5@www.fastmail.com  

M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/parser/parse_merge.c
M src/test/regress/expected/merge.out
M src/test/regress/expected/with.out
M src/test/regress/sql/merge.sql

Rename backup_compression.{c,h} to compression.{c,h}

commit   : a4b57543acfb52cc7c7e031501002563f536b929    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 Apr 2022 13:38:54 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 12 Apr 2022 13:38:54 +0900    

Click here for diff

Compression option handling (level, algorithm or even workers) can be  
used across several parts of the system and not only base backups.  
Structures, objects and routines are renamed in consequence, to remove  
the concept of base backups from this part of the code making this  
change straight-forward.  
  
pg_receivewal, that has gained support for LZ4 since babbbb5, will make  
use of this infrastructure for its set of compression options, bringing  
more consistency with pg_basebackup.  This cleanup needs to be done  
before releasing a beta of 15.  pg_dump is a potential future target, as  
well, and adding more compression options to it may happen in 16~.  
  
Author: Michael Paquier  
Reviewed-by: Robert Haas, Georgios Kokolatos  
Discussion: https://postgr.es/m/YlPQGNAAa04raObK@paquier.xyz  

M src/backend/replication/basebackup.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer.h
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/nls.mk
M src/bin/pg_basebackup/pg_basebackup.c
M src/common/Makefile
R080 src/common/backup_compression.c src/common/compression.c
D src/include/common/backup_compression.h
A src/include/common/compression.h
M src/include/replication/basebackup_sink.h
M src/tools/msvc/Mkvcbuild.pm
M src/tools/pgindent/typedefs.list

Make XLogRecGetBlockTag() throw error if there's no such block.

commit   : bd037dc928dd126e5623117b2fe7633ec3fa7c40    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 17:43:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 17:43:46 -0400    

Click here for diff

All but a few existing callers assume without checking that this  
function succeeds.  While it probably will, that's a poor excuse for  
not checking.  Let's make it return void and instead throw an error  
if it doesn't find the block reference.  Callers that actually need  
to handle the no-such-block case must now use the underlying function  
XLogRecGetBlockTagExtended.  
  
In addition to being a bit less error-prone, this should also serve  
to suppress some Coverity complaints about XLogRecGetBlockRefInfo.  
  
While at it, clean up some inconsistency about use of the  
XLogRecHasBlockRef macro: make XLogRecGetBlockTagExtended use  
that instead of open-coding the same condition, and avoid calling  
XLogRecHasBlockRef twice in relevant code paths.  (That is,  
calling XLogRecHasBlockRef followed by XLogRecGetBlockTag is now  
deprecated: use XLogRecGetBlockTagExtended instead.)  
  
Patch HEAD only; this doesn't seem to have enough value to consider  
a back-branch API break.  
  
Discussion: https://postgr.es/m/425039.1649701221@sss.pgh.pa.us  

M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlogreader.h

Remove comment about historic heap vacuuming issue.

commit   : 9debd123483b970a53ba0e3de51c6234f3044df0    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 11 Apr 2022 14:20:46 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 11 Apr 2022 14:20:46 -0700    

Click here for diff

Remove comment block about how heap page vacuuming used to set tuples  
with storage to LP_UNUSED in a rare edge case that can no longer happen  
following commit 8523492d4e.  The comments seem unnecessary now, since  
it's now generally clear that heap vacuuming only applies to LP_DEAD  
items from VACUUM's first heap pass following more recent work from  
commits 12b5ade902 and 4f8d9d1217.  

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

Remove dead code in do_pg_backup_start().

commit   : 9de692c10176e2af00dc915b122e07bd6903185c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 15:56:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 15:56:01 -0400    

Click here for diff

As of commit 39969e2a1, no caller of do_pg_backup_start() passes NULL  
for labelfile or tblspcmapfile, nor is it plausible that any would  
do so in the future.  Remove the code that coped with that case,  
as (a) it's dead and (b) it causes Coverity to bleat about possibly  
leaked storage.  
  
While here, do some janitorial work on the function's header comment.  

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

Tweak the default behavior of psql's \dconfig.

commit   : 5e70d8b5d18b0a71528dc6f11ade31a9d10e00cb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 15:11:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 15:11:46 -0400    

Click here for diff

\dconfig without an argument originally printed all parameters,  
but it seems more useful to print only those parameters with  
non-default settings.  You can easily get the show-everything  
behavior with "\dconfig *", but that output is unwieldy and  
seems unlikely to be wanted very often.  
  
Per suggestion from Christoph Berg.  
  
Discussion: https://postgr.es/m/YlFQLzlPi4QD0wSi@msg.df7cb.de  

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

Explicitly ignore guaranteed-true result from pgstat_lock_entry().

commit   : 3c702b3ed1519624d50e7a42283b8d481a579f77    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 13:22:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 13:22:37 -0400    

Click here for diff

With nowait passed as false, pgstat_lock_entry() must return true  
so there's no need to check its result.  Coverity seems unconvinced  
of this, so whack it upside the head with a (void) cast.  

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

fgetc() returns int, not char.

commit   : 93fcf2d2095674834e1ddbc6803ec043e3216afa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 13:15:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 13:15:46 -0400    

Click here for diff

This has no practical effect, since this code doesn't actually need to  
distinguish EOF (-1) from \0377; but it silences a Coverity complaint.  

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

Doc build fix: remove tab from filelist.sgml.

commit   : 8638c76cc9f47b86bd6500559fbf023a8886d9d6    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 11 Apr 2022 08:41:28 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Mon, 11 Apr 2022 08:41:28 -0700    

Click here for diff

Author: Amit Kapila  
Discussion: https://postgr.es/m/CAA4eK1K6z=gu-jppU1dtsyr2BC-pzrq3TYe=RfY+w386dfdiFA@mail.gmail.com  

M doc/src/sgml/filelist.sgml

Improve readability of SQL/JSON documentation.

commit   : b46bcf7a4b6f161eae1cee3ed9b6c4a28d04f4d0    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 11 Apr 2022 11:48:40 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 11 Apr 2022 11:48:40 -0400    

Click here for diff

Per review from Justin Pryzby.  
  
Discussion: https://postgr.es/m/f50aca87-6b35-a1b0-2286-f815a589dd83@dunslane.net  

M doc/src/sgml/func.sgml

Add color support for new frontend detail/hint messages

commit   : c215cc7b61cbe06425c8ea3ac9d49581e6b5c6cd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Apr 2022 17:36:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Apr 2022 17:36:44 +0200    

Click here for diff

As before, the defaults are similar to gcc's default appearance.  

M doc/src/sgml/color.sgml
M src/common/logging.c

Avoid re-writing files unnecessarily in src/tools/copyright.pl.

commit   : dfd0f2bbc5776f261ef4c8ab128469ef9091dcfe    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 11:20:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 11 Apr 2022 11:20:13 -0400    

Click here for diff

The existing coding resulted in touching every copyright-containing  
file in the tree, even if it was already up to date.  That doesn't  
matter much for the annual run, but it's an annoyance if you try  
to use the script for mop-up at the close of a devel cycle, as  
I just did.  
  
Discussion: https://postgr.es/m/266030.1649685473@sss.pgh.pa.us  

M src/tools/copyright.pl

docs: Note the recovery_min_apply_delay bloats pg_wal.

commit   : ad385a494f6ad863b38aa7c708f23aaf223438a7    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 11:02:59 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 11:02:59 -0400    

Click here for diff

Those WAL files that we're waiting to apply have to be stored  
somewhere.  
  
Thom Brown  
  
Discussion: http://postgr.es/m/CAA-aLv4SkJRK6GGcd0Axt8kt6_eWMEbtG7f8NJpFh+rNshtdNA@mail.gmail.com  

M doc/src/sgml/config.sgml

Docs: Mention that relpersistence is for sequences now too

commit   : e0064f0ff6dfada2695330c6bc1945fa7ae813be    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:50:20 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:50:20 +1200    

Click here for diff

Per 344d62fb9.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M doc/src/sgml/catalogs.sgml

Fix various typos and spelling mistakes in code comments

commit   : b0e5f02ddc836499bdcf093df52e4c342dda5891    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:49:41 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:49:41 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M contrib/ltree/ltree.h
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/heap/heapam.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/dbcommands.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/parser/parse_expr.c
M src/backend/replication/basebackup_server.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/slot.c
M src/backend/storage/ipc/procarray.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/mmgr/generation.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/copy.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/utils/sortsupport.h
M src/tools/mark_pgdllimport.pl

Docs: Fix various mistakes and typos

commit   : bba3c35b29d07a27bbf5dd0d7d5e7c7592e02f81    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:48:48 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 11 Apr 2022 20:48:48 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220411020336.GB26620@telsasoft.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/pgbench.sgml

commit   : 7597cc3083f8b3607123f71bc6432afc5a655d6e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 Apr 2022 16:36:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 Apr 2022 16:36:25 +0900    

Click here for diff

0ad8032 and 4e34747 are at the origin of that.  Julien has found the one  
in parse_jsontable.c, while I have spotted the rest.  
  
Author: Julien Rouhaud, Michael Paquier  
Discussion: https://postgr.es/m/20220411060838.ftnzyvflpwu6f74w@jrouhaud  

M src/backend/parser/parse_jsontable.c
M src/backend/replication/basebackup_gzip.c
M src/backend/replication/basebackup_lz4.c
M src/backend/replication/basebackup_target.c
M src/backend/replication/basebackup_zstd.c

Put new command-line options into alphabetical order in help output

commit   : 0c65177a21a9e23490bee0e50ba61eeb287f7183    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Apr 2022 07:39:25 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 11 Apr 2022 07:39:25 +0200    

Click here for diff

M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pgbench/pgbench.c

doc: Clarify behavior of query planner locking with REINDEX

commit   : 8ac700acffc7b17d88414be47b8dff44fb1ea681    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 Apr 2022 09:49:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 11 Apr 2022 09:49:13 +0900    

Click here for diff

The documentation of REINDEX has never mentioned that the query planner  
may take an ACCESS SHARE lock on the indexes depending on the query  
used.  This adds also a note about prepared queries not impacted when  
they do not use the index(es) rebuilt.  
  
Author: Frédéric Yhuel  
Reviewed-by: Guillaume Lelarge, Justin Pryzby  
Discussion: https://postgr.es/m/65d08718-6f11-978a-4b5a-72b807d4c663@dalibo.com  

M doc/src/sgml/ref/reindex.sgml

Doc: fix typos in documentation

commit   : cd959b1b0662c9d57540b31961680c38037ffcd6    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sun, 10 Apr 2022 21:42:43 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Sun, 10 Apr 2022 21:42:43 +0200    

Click here for diff

Commits 39969e2a1e4 and 5c279a6d350 accidentally included a typo each  
in the user facing documentation.  

M doc/src/sgml/backup.sgml
M doc/src/sgml/custom-rmgr.sgml

Doc: reformat descriptions of pgbench output formats.

commit   : b6b8824ee771eecb84830903fad50a7f6853639d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 10 Apr 2022 15:31:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 10 Apr 2022 15:31:42 -0400    

Click here for diff

This is mostly driven by trying to get rid of line-too-wide  
warnings in PDF output; but I think converting to a <variablelist>  
makes it more readable anyway.  
  
Discussion: https://postgr.es/m/4183048.1649536705@sss.pgh.pa.us  

M doc/src/sgml/ref/pgbench.sgml

Fix pgperlsyncheck following SSL TAP test refactoring

commit   : c835dcdab622813bb1ccd130458065089f2ccacd    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 10 Apr 2022 09:04:24 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 10 Apr 2022 09:04:24 -0400    

Click here for diff

Commit 4a7e964fc6 made pgperlsyncheck fail, but apparently nobody  
noticed, although the buildfarm module that does more or less the same  
thing was modified. So fix the in-core test. I will look at unifying the  
two sets of tests so we avoid a future mismatch.  

M src/tools/perlcheck/pgperlsyncheck

Add timestamp and elapsed time decorations to TAP test logs

commit   : 3b0a42e74edfc57c3cef1f3b1a583d4fe5cca846    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 10 Apr 2022 08:46:12 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sun, 10 Apr 2022 08:46:12 -0400    

Click here for diff

These apply to traces from Test::More functions such as ok(), is(),  
diag() and note(). Output from other sources (e.g. external programs  
such a initdb) is not affected. The elapsed time is the time since the  
last such trace (or the beginning of the test in the first case). Times  
and timestamps are at millisecond precision.  
  
Discussion: https://postgr.es/m/20220401172150.rsycz4lrn7ewruil@alap3.anarazel.de  

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

Doc: shorten JSON_SERIALIZE example to avoid a PDF build warning.

commit   : 7b735f8b52ad4ccf742c29dc41e3d049bdffe2fa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 9 Apr 2022 15:09:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 9 Apr 2022 15:09:38 -0400    

Click here for diff

There's no particular reason why this example has to use a  
3-element array rather than 2-element.  Shortening it makes  
the result bytea narrow enough to not cause a margin overrun  
in A4 format.  

M doc/src/sgml/func.sgml

Fix whitespace

commit   : 80c877271a61bd11d6a2ff9a37f1f414a1b082ab    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 16:17:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 16:17:41 +0200    

Click here for diff

M src/test/regress/expected/rules.out
M src/test/regress/sql/rules.sql
M src/tools/mark_pgdllimport.pl

Add missing serial commas

commit   : 38abc39c81f9d51cff0b4dccebd5bf73327f19e1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 16:15:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 16:15:01 +0200    

Click here for diff

M src/backend/commands/publicationcmds.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/misc/guc.c
M src/test/regress/expected/publication.out

Add missing source files to nls.mk

commit   : fc5b83bb60a862a4a27372b255405df598455ff1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 15:46:37 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 9 Apr 2022 15:46:37 +0200    

Click here for diff

M src/bin/pg_basebackup/nls.mk

Silence compiler warnings for unsupported compression methods.

commit   : c0d1c641cbe433d1b6304bc1e3a2d8cd38b9a8e5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 18:14:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 18:14:24 -0400    

Click here for diff

wrasse, at least, moans about the lack of any "return" statement  
in these functions.  You'd think pretty much everything would  
know that exit(1) doesn't return, but evidently not.  

M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c

Improve frontend error logging style.

commit   : 9a374b77fb53e4cfbca121e4fa278a7d71bde7c4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 14:55:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 14:55:14 -0400    

Click here for diff

Get rid of the separate "FATAL" log level, as it was applied  
so inconsistently as to be meaningless.  This mostly involves  
s/pg_log_fatal/pg_log_error/g.  
  
Create a macro pg_fatal() to handle the common use-case of  
pg_log_error() immediately followed by exit(1).  Various  
modules had already invented either this or equivalent macros;  
standardize on pg_fatal() and apply it where possible.  
  
Invent the ability to add "detail" and "hint" messages to a  
frontend message, much as we have long had in the backend.  
  
Except where rewording was needed to convert existing coding  
to detail/hint style, I have (mostly) resisted the temptation  
to change existing message wording.  
  
Patch by me.  Design and patch reviewed at various stages by  
Robert Haas, Kyotaro Horiguchi, Peter Eisentraut and  
Daniel Gustafsson.  
  
Discussion: https://postgr.es/m/1363732.1636496441@sss.pgh.pa.us  

M contrib/oid2name/oid2name.c
M contrib/vacuumlo/vacuumlo.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/bbstreamer_file.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_inject.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_tar.c
M src/bin/pg_basebackup/bbstreamer_zstd.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/nls.mk
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_db.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_null.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/nls.mk
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_waldump/nls.mk
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/mainloop.c
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl
M src/bin/scripts/clusterdb.c
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/pg_isready.c
M src/bin/scripts/reindexdb.c
M src/bin/scripts/vacuumdb.c
M src/common/controldata_utils.c
M src/common/file_utils.c
M src/common/logging.c
M src/common/restricted_token.c
M src/fe_utils/archive.c
M src/fe_utils/connect_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/include/common/logging.h
M src/include/lib/simplehash.h
M src/nls-global.mk

Fix busted .gitignore entry.

commit   : 5c431c7fb327e1abc70b7a197650f8d45fd5bede    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 14:22:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 8 Apr 2022 14:22:47 -0400    

Click here for diff

Typo in commit 2258e76f9.  

M src/bin/pg_waldump/.gitignore

Rename delayChkpt to delayChkptFlags.

commit   : f37015a1617d4e6b4b50a1c789b382d9a654fcd9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 11:44:17 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 11:44:17 -0400    

Click here for diff

Before commit 412ad7a55639516f284cd0ef9757d6ae5c7abd43, delayChkpt  
was a Boolean. Now it's an integer. Extensions using it need to be  
appropriately updated, so let's rename the field to make sure that  
a hard compilation failure occurs.  
  
Replacing delayChkpt with delayChkptFlags made a few comments extend  
past 80 characters, so I reflowed them and changed some wording very  
slightly.  
  
The back-branches will need a different change to restore compatibility  
with existing minor releases; this is just for master.  
  
Per suggestion from Tom Lane.  
  
Discussion: http://postgr.es/m/a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com  

M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/catalog/storage.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h

psql: Fix translation marking

commit   : 891624f0ec3b3d353269b0bfc7bc545333d6b4d5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Apr 2022 15:07:35 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Apr 2022 15:07:35 +0200    

Click here for diff

Commit 5a2832465fd8984d089e8c44c094e6900d987fcd added  
addFooterToPublicationDesc() as a wrapper around  
printTableAddFooter().  The translation marker _() was moved to the  
body of addFooterToPublicationDesc(), but addFooterToPublicationDesc()  
was not added to GETTEXT_TRIGGERS, so those strings were lost for  
translation.  To fix, add the translation markers to the call sites of  
addFooterToPublicationDesc() and remove the translation marker from  
the body of the function.  This seems easiest since there were only  
two callers and it keeps the API consistent with  
printTableAddFooter().  While we're here, add some const decorations  
to the prototype of addFooterToPublicationDesc() for consistency with  
printTableAddFooter().  

M src/bin/psql/describe.c

Apply PGDLLIMPORT markings broadly.

commit   : 8ec569479fc28ddd634a13dc100b36352ec3a3c2    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 08:16:38 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 08:16:38 -0400    

Click here for diff

Up until now, we've had a policy of only marking certain variables  
in the PostgreSQL header files with PGDLLIMPORT, but now we've  
decided to mark them all. This means that extensions running on  
Windows should no longer operate at a disadvantage as compared to  
extensions running on Linux: if the variable is present in a header  
file, it should be accessible.  
  
Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com  

M src/include/access/gin.h
M src/include/access/parallel.h
M src/include/access/session.h
M src/include/access/tableam.h
M src/include/access/toast_compression.h
M src/include/access/twophase_rmgr.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogutils.h
M src/include/bootstrap/bootstrap.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaddress.h
M src/include/catalog/storage.h
M src/include/commands/async.h
M src/include/commands/tablespace.h
M src/include/commands/user.h
M src/include/commands/vacuum.h
M src/include/common/file_perm.h
M src/include/common/jsonapi.h
M src/include/common/logging.h
M src/include/common/pg_lzcompress.h
M src/include/common/relpath.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/print.h
M src/include/fe_utils/string_utils.h
M src/include/fmgr.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/libpq/auth.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq.h
M src/include/libpq/pqcomm.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/nodes/readfuncs.h
M src/include/optimizer/geqo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/planmain.h
M src/include/parser/parse_expr.h
M src/include/parser/parser.h
M src/include/pg_getopt.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walwriter.h
M src/include/replication/logicallauncher.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/dsm_impl.h
M src/include/storage/fd.h
M src/include/storage/large_object.h
M src/include/storage/lock.h
M src/include/storage/lwlock.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/proc.h
M src/include/storage/s_lock.h
M src/include/storage/sinval.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/tcop/tcopprot.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_type.h
M src/include/utils/array.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/datetime.h
M src/include/utils/elog.h
M src/include/utils/fmgrtab.h
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/include/utils/jsonpath.h
M src/include/utils/pg_locale.h
M src/include/utils/pgstat_internal.h
M src/include/utils/plancache.h
M src/include/utils/ps_status.h
M src/include/utils/queryjumble.h
M src/include/utils/relcache.h
M src/include/utils/rls.h
M src/include/utils/snapmgr.h
M src/include/utils/timestamp.h
M src/include/utils/xml.h

Helper script to apply PGDLLIMPORT markings.

commit   : 80900d4690916a30f278d877eb5a7a42b14c3f0a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 08:06:10 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 8 Apr 2022 08:06:10 -0400    

Click here for diff

This script isn't terribly smart and won't necessarily catch every  
case, but it catches many of them and is better than a totally  
manual approach.  
  
Patch by me, reviewed by Andrew Dunstan.  
  
Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com  

A src/tools/mark_pgdllimport.pl

Add JIT counters to pg_stat_statements

commit   : 57d6aea00fcefec3825a5948ce05cf2b4941097b    
  
author   : Magnus Hagander <magnus@hagander.net>    
date     : Fri, 8 Apr 2022 13:51:01 +0200    
  
committer: Magnus Hagander <magnus@hagander.net>    
date     : Fri, 8 Apr 2022 13:51:01 +0200    

Click here for diff

This adds cumulative counters for jit operations to pg_stat_statements,  
making it easier to diagnose how JIT is used in an installation.  
  
These changes merge into the 1.10 changes applied in 76cbf7edb6 without  
creating a new version.  
  
Reviewed-By: Julien Rouhaud  
Discussion: https://www.postgresql.org/message-id/flat/CABUevEySt4NTYqvWzwyAW_0-jG1bjN-y+tykapAnA0FALOs+Lw@mail.gmail.com  

M contrib/pg_stat_statements/expected/oldextversions.out
M contrib/pg_stat_statements/pg_stat_statements–1.9–1.10.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M doc/src/sgml/pgstatstatements.sgml

Fix buildfarm failures in pg_walinspect tests.

commit   : dad9ba1c82fd985aa6fb8035ebca1e79c138dde2    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 03:21:12 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 03:21:12 -0700    

Click here for diff

M contrib/pg_walinspect/Makefile
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
A contrib/pg_walinspect/walinspect.conf

Check XLogRecHasBlockRef() before XLogRecHasBlockImage().

commit   : 12aaae5131af343b7cd2fdef05dee82c25d8aaf8    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 02:30:57 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 02:30:57 -0700    

Click here for diff

Trial fix of buildfarm failures on kestrel and tamandua.  

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

Fix buildfarm failure from commit 2258e76f90.

commit   : 1562e92c62a3f3a4e5d87895523ff74174029654    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 01:33:58 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 01:33:58 -0700    

Click here for diff

M src/include/access/xlogstats.h

Add contrib/pg_walinspect.

commit   : 2258e76f90bf0254504644df0515cddc0c0a87f9    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 00:02:10 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Fri, 8 Apr 2022 00:02:10 -0700    

Click here for diff

Provides similar functionality to pg_waldump, but from a SQL interface  
rather than a separate utility.  
  
Author: Bharath Rupireddy  
Reviewed-by: Greg Stark, Kyotaro Horiguchi, Andres Freund, Ashutosh Sharma, Nitin Jadhav, RKN Sai Krishna  
Discussion: https://postgr.es/m/CALj2ACUGUYXsEQdKhEdsBzhGEyF3xggvLdD8C0VT72TNEfOiog%40mail.gmail.com  

M contrib/Makefile
A contrib/pg_walinspect/.gitignore
A contrib/pg_walinspect/Makefile
A contrib/pg_walinspect/expected/pg_walinspect.out
A contrib/pg_walinspect/pg_walinspect–1.0.sql
A contrib/pg_walinspect/pg_walinspect.c
A contrib/pg_walinspect/pg_walinspect.control
A contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/contrib.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
A doc/src/sgml/pgwalinspect.sgml
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/Makefile
M src/backend/access/transam/xlogreader.c
A src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/bin/pg_waldump/.gitignore
M src/bin/pg_waldump/Makefile
M src/bin/pg_waldump/pg_waldump.c
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogreader.h
A src/include/access/xlogstats.h
M src/include/access/xlogutils.h

Remove error message hints mentioning configure options

commit   : 708007dced2b05ed9b4f1963e91b2eb67413bd19    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Apr 2022 07:41:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 8 Apr 2022 07:41:09 +0200    

Click here for diff

These are usually not useful since users will use packaged  
distributions and won't be interested in rebuilding their installation  
from source.  Also, we have only used these kinds of hints for some  
features and in some places, not consistently throughout.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/2552aed7-d0e9-280a-54aa-2dc7073f371d%40enterprisedb.com  

M src/backend/access/common/toast_compression.c
M src/backend/libpq/hba.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/xml.c
M src/bin/initdb/initdb.c
M src/test/regress/expected/compression_1.out
M src/test/regress/expected/xml_1.out
M src/test/regress/expected/xmlmap_1.out

pgstat: Update docs to match the shared memory stats reality.

commit   : b3abca68106d518ce5d3c0d9a1e0ec02a647ceda    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 21:35:35 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 21:35:35 -0700    

Click here for diff

This includes removing documentation for stats_temp_directory, adding  
documentation for stats_fetch_consistency, rephrasing references to the stats  
collector and documenting that starting a cleanly shut down standby will not  
remove stats anymore. The latter point might require further wordsmithing, it  
wasn't easy to adjust some of the existing content.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-By: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-By: "David G. Johnston" <david.g.johnston@gmail.com>  
Reviewed-By: Lukas Fittl <lukas@fittl.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M doc/src/sgml/backup.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_dump.sgml

pg_stat_statements: Track I/O timing for temporary file blocks

commit   : 76cbf7edb6385c682facda095050858cac2efae0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 8 Apr 2022 13:12:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 8 Apr 2022 13:12:07 +0900    

Click here for diff

This commit adds two new columns to pg_stat_statements, called  
temp_blk_read_time and temp_blk_write_time.  Those columns respectively  
show the time spent to read and write temporary file blocks on disk,  
whose tracking has been added in efb0ef9.  This information is  
available when track_io_timing is enabled, like blk_read_time and  
blk_write_time.  
  
pg_stat_statements is updated to version to 1.10 as an effect of the  
newly-added columns.  Tests for the upgrade path 1.9->1.10 are added.  
  
PGSS_FILE_HEADER is bumped for the new stats file format.  
  
Author: Masahiko Sawada  
Reviewed-by: Georgios Kokolatos, Melanie Plageman, Julien Rouhaud,  
Ranier Vilela  
Discussion: https://postgr.es/m/CAD21AoAJgotTeP83p6HiAGDhs_9Fw9pZ2J=_tYTsiO5Ob-V5GQ@mail.gmail.com  

M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/oldextversions.out
A contrib/pg_stat_statements/pg_stat_statements–1.9–1.10.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M contrib/pg_stat_statements/sql/oldextversions.sql
M doc/src/sgml/pgstatstatements.sgml

Documentation for SQL/JSON features

commit   : a6baa4baddd5f111bc59d8f5ed5cadbb2d91e98d    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 7 Apr 2022 23:36:50 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 7 Apr 2022 23:36:50 -0400    

Click here for diff

This documents the features added in commits f79b803dcc, f4fb45d15c,  
33a377608f, 1a36bc9dba, 606948b058, 49082c2cc3, 4e34747c88, and  
fadb48b00e.  
  
I have cleaned up the aggregate section of the submitted docs, but there  
is still a deal of copy editing required. However, I thought it best to  
have some documentation sooner rather than later so testers can have a  
better idea what they are playing with.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  
Discussion: https://postgr.es/m/7e2cb85d-24cf-4abb-30a5-1a33715959bd@postgrespro.ru  

M doc/src/sgml/func.sgml

Track I/O timing for temporary file blocks in EXPLAIN (BUFFERS)

commit   : efb0ef909f605817da6b77c1f3fef0a24457ec16    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 8 Apr 2022 11:27:21 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 8 Apr 2022 11:27:21 +0900    

Click here for diff

Previously, the output of EXPLAIN (BUFFERS) option showed only the I/O  
timing spent reading and writing shared and local buffers.  This commit  
adds on top of that the I/O timing for temporary buffers in the output  
of EXPLAIN (for spilled external sorts, hashes, materialization. etc).  
This can be helpful for users in cases where the I/O related to  
temporary buffers is the bottleneck.  
  
Like its cousin, this information is available only when track_io_timing  
is enabled.  Playing the patch, this is showing an extra overhead of up  
to 1% even when using gettimeofday() as implementation for interval  
timings, which is slightly within the usual range noise still that's  
measurable.  
  
Author: Masahiko Sawada  
Reviewed-by: Georgios Kokolatos, Melanie Plageman, Julien Rouhaud,  
Ranier Vilela  
Discussion: https://postgr.es/m/CAD21AoAJgotTeP83p6HiAGDhs_9Fw9pZ2J=_tYTsiO5Ob-V5GQ@mail.gmail.com  

M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/backend/storage/file/buffile.c
M src/include/executor/instrument.h
M src/test/regress/expected/explain.out
M src/test/regress/sql/explain.sql

Fix recovery_prefetch docs.

commit   : dafae9707ab7e7079ce1ba22cebda4557d0cbaf3    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 8 Apr 2022 13:28:04 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 8 Apr 2022 13:28:04 +1200    

Click here for diff

Correct a typo and a couple of sentences that weren't updated to reflect  
recent changes to the code.  
  
Reported-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20220407125555.GC24419%40telsasoft.com  

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

pgstat: Hide instability in stats.spec with -DCATCACHE_FORCE_RELEASE.

commit   : d6c0db14836cd843d589372d909c73aab68c7a24    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 18:20:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 18:20:50 -0700    

Click here for diff

With -DCATCACHE_FORCE_RELEASE a few tests failed. Those were trying to test  
behavior in the absence of invalidation processing and  
-DCATCACHE_FORCE_RELEASE obviously adds a lot of invalidation processing. The  
test already tried to handle debug_discard_caches > 0, by disabling it for  
individual tests.  
  
Instead hide potentially problematic function calls in a wrapper function that  
catches the does-not-exist error. The error isn't the actually interesting  
bit, it's whether the stats entry still exist afterwards.  
  
I confirmed that the tests still catches leaked function stats if I nuke the  
protections against that in pgstat_function.c.  
  
Per buildfarm animal prion.  
  
Discussion: https://postgr.es/m/20220407165709.jgdkrzqlkcwue6ko@alap3.anarazel.de  

M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec

pgstat: add/extend tests for resetting various kinds of stats.

commit   : 5264add7847871d61d36a5770dac2139d6a7bc80    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 15:17:07 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 15:17:07 -0700    

Click here for diff

- subscriber stats reset path was untested  
- slot stat sreset path for all slots was untested  
- pg_stat_database.sessions etc was untested  
- pg_stat_reset_shared() was untested, for any kind of shared stats  
- pg_stat_reset() was untested  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M contrib/test_decoding/expected/stats.out
M contrib/test_decoding/sql/stats.sql
M src/test/recovery/t/006_logical_decoding.pl
M src/test/regress/expected/stats.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/stats.sql
M src/test/subscription/t/026_stats.pl

Truncate line pointer array during heap pruning.

commit   : 10a8d138235b3b8cfbce8a0145526d9b9a80cc96    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 7 Apr 2022 15:42:12 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 7 Apr 2022 15:42:12 -0700    

Click here for diff

Reclaim space from the line pointer array when heap pruning leaves  
behind a contiguous group of LP_UNUSED items at the end of the array.  
This happens during subsequent page defragmentation.  Certain kinds of  
heap line pointer bloat are ameliorated by this new optimization.  
  
Follow-up work to commit 3c3b8a4b26, which taught VACUUM to truncate the  
line pointer array in about the same way during VACUUM's second pass  
over the heap.  We now apply line pointer array truncation during both  
the first and the second pass over the heap made by VACUUM.  We can also  
perform line pointer array truncation during opportunistic pruning.  
  
Matthias van de Meent, with small tweaks by me.  
  
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/CAEze2WjgaQc55Y5f5CQd3L=eS5CZcff2Obxp=O6pto8-f0hC4w@mail.gmail.com  
Discussion: https://postgr.es/m/CAEze2Wg36%2B4at2eWJNcYNiW2FJmht34x3YeX54ctUSs7kKoNcA%40mail.gmail.com  

M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/storage/page/bufpage.c

Teach planner and executor about monotonic window funcs

commit   : 9d9c02ccd1aea8e9131d8f4edb21bf1687e40782    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 8 Apr 2022 10:34:36 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 8 Apr 2022 10:34:36 +1200    

Click here for diff

Window functions such as row_number() always return a value higher than  
the previously returned value for tuples in any given window partition.  
  
Traditionally queries such as;  
  
SELECT * FROM (  
   SELECT *, row_number() over (order by c) rn  
   FROM t  
) t WHERE rn <= 10;  
  
were executed fairly inefficiently.  Neither the query planner nor the  
executor knew that once rn made it to 11 that nothing further would match  
the outer query's WHERE clause.  It would blindly continue until all  
tuples were exhausted from the subquery.  
  
Here we implement means to make the above execute more efficiently.  
  
This is done by way of adding a pg_proc.prosupport function to various of  
the built-in window functions and adding supporting code to allow the  
support function to inform the planner if the window function is  
monotonically increasing, monotonically decreasing, both or neither.  The  
planner is then able to make use of that information and possibly allow  
the executor to short-circuit execution by way of adding a "run condition"  
to the WindowAgg to allow it to determine if some of its execution work  
can be skipped.  
  
This "run condition" is not like a normal filter.  These run conditions  
are only built using quals comparing values to monotonic window functions.  
For monotonic increasing functions, quals making use of the btree  
operators for <, <= and = can be used (assuming the window function column  
is on the left). You can see here that once such a condition becomes false  
that a monotonic increasing function could never make it subsequently true  
again.  For monotonically decreasing functions the >, >= and = btree  
operators for the given type can be used for run conditions.  
  
The best-case situation for this is when there is a single WindowAgg node  
without a PARTITION BY clause.  Here when the run condition becomes false  
the WindowAgg node can simply return NULL.  No more tuples will ever match  
the run condition.  It's a little more complex when there is a PARTITION  
BY clause.  In this case, we cannot return NULL as we must still process  
other partitions.  To speed this case up we pull tuples from the outer  
plan to check if they're from the same partition and simply discard them  
if they are.  When we find a tuple belonging to another partition we start  
processing as normal again until the run condition becomes false or we run  
out of tuples to process.  
  
When there are multiple WindowAgg nodes to evaluate then this complicates  
the situation.  For intermediate WindowAggs we must ensure we always  
return all tuples to the calling node.  Any filtering done could lead to  
incorrect results in WindowAgg nodes above.  For all intermediate nodes,  
we can still save some work when the run condition becomes false.  We've  
no need to evaluate the WindowFuncs anymore.  Other WindowAgg nodes cannot  
reference the value of these and these tuples will not appear in the final  
result anyway.  The savings here are small in comparison to what can be  
saved in the top-level WingowAgg, but still worthwhile.  
  
Intermediate WindowAgg nodes never filter out tuples, but here we change  
WindowAgg so that the top-level WindowAgg filters out tuples that don't  
match the intermediate WindowAgg node's run condition.  Such filters  
appear in the "Filter" clause in EXPLAIN for the top-level WindowAgg node.  
  
Here we add prosupport functions to allow the above to work for;  
row_number(), rank(), dense_rank(), count(*) and count(expr).  It appears  
technically possible to do the same for min() and max(), however, it seems  
unlikely to be useful enough, so that's not done here.  
  
Bump catversion  
  
Author: David Rowley  
Reviewed-by: Andy Fan, Zhihong Yu  
Discussion: https://postgr.es/m/CAApHDvqvp3At8++yF8ij06sdcoo1S_b2YoaT9D4Nf+MObzsrLQ@mail.gmail.com  

M src/backend/commands/explain.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/allpaths.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/optimizer/util/pathnode.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/windowfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/supportnodes.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql

Extend plsample example to include a trigger handler.

commit   : 2f4d0d67994b32320487784afab7ab997d331bb5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Apr 2022 18:26:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Apr 2022 18:26:13 -0400    

Click here for diff

Mark Wong and Konstantina Skovola, reviewed by Chapman Flack  
  
Discussion: https://postgr.es/m/Yd8Cz22eHi80XS30@workstation-mark-wong  

M src/test/modules/plsample/expected/plsample.out
M src/test/modules/plsample/plsample.c
M src/test/modules/plsample/sql/plsample.sql

Add minimal tests for recovery conflict handling.

commit   : 9f8a050f68dcb38fb0a1ea87e0e5d04df32b56f4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 12:46:51 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 12:46:51 -0700    

Click here for diff

Previously none of our tests triggered recovery conflicts. The test is  
primarily motivated by needing tests for recovery conflict stats for shared  
memory based pgstats. But it's also a decent start for recovery conflict  
handling in general.  
  
The only type of recovery conflict not tested yet are rcovery deadlock  
conflicts.  
  
By configuring log_recovery_conflict_waits the test adds some very minimal  
testing for that path as well.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

A src/test/recovery/t/031_recovery_conflict.pl

pgstat: test stats interactions with physical replication.

commit   : 53b9cd20d4144f5d65c107babe23916aad6c2ef8    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 21 Mar 2022 12:58:51 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 21 Mar 2022 12:58:51 -0700    

Click here for diff

Tests that standbys:  
- drop stats for objects when the those records are replayed  
- persist stats across graceful restarts  
- discard stats after immediate / crash restarts  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

A src/test/recovery/t/030_stats_cleanup_replica.pl

Revert "Rewrite some RI code to avoid using SPI"

commit   : a90641eac24dfc8889122d88eb7f482cd3db8b39    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 23:42:13 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 23:42:13 +0200    

Click here for diff

This reverts commit 99392cdd78b788295e52b9f4942fa11992fd5ba9.  
We'd rather rewrite ri_triggers.c as a whole rather than piecemeal.  
  
Discussion: https://postgr.es/m/E1ncXX2-000mFt-Pe@gemulon.postgresql.org  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeLockRows.c
M src/backend/utils/adt/ri_triggers.c
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/specs/fk-snapshot.spec

psql: add \dconfig command to show server's configuration parameters.

commit   : 3e707fbb4009e9ac1d0e8b78b7af9f3f03f4cf1a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Apr 2022 17:09:44 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 7 Apr 2022 17:09:44 -0400    

Click here for diff

Plain \dconfig is basically equivalent to SHOW except that you can  
give it a pattern with wildcards, either to match multiple GUCs or  
because you don't exactly remember the name you want.  
  
\dconfig+ adds type, context, and access-privilege information,  
mainly because every other kind of object privilege has a psql command  
to show it, so GUC privileges should too.  (A form of this command was  
in some versions of the patch series leading up to commit a0ffa885e.  
We pulled it out then because of doubts that the design and code were  
up to snuff, but I think subsequent work has resolved that.)  
  
In passing, fix incorrect completion of GUC names in GRANT/REVOKE  
ON PARAMETER: a0ffa885e neglected to use the VERBATIM form of  
COMPLETE_WITH_QUERY, so it misbehaved for custom (qualified) GUC  
names.  
  
Mark Dilger and Tom Lane  
  
Discussion: https://postgr.es/m/3118455.1649267333@sss.pgh.pa.us  

M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/help.c
M src/bin/psql/tab-complete.c
M src/fe_utils/string_utils.c
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql

pgstat: add tests for handling of restarts, including crashes.

commit   : 16acf7f1aaea6c5efc0fa49182c16cd6bfd9f3d3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 12:07:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 12:07:50 -0700    

Click here for diff

Test that stats are restored during normal restarts, discarded after a crash /  
immediate restart, and that a corrupted stats file leads to stats being reset.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

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

Rewrite some RI code to avoid using SPI

commit   : 99392cdd78b788295e52b9f4942fa11992fd5ba9    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 21:04:36 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 21:04:36 +0200    

Click here for diff

Modify the subroutines called by RI trigger functions that want to check  
if a given referenced value exists in the referenced relation to simply  
scan the foreign key constraint's unique index, instead of using SPI to  
execute  
  SELECT 1 FROM referenced_relation WHERE ref_key = $1  
This saves a lot of work, especially when inserting into or updating a  
referencing relation.  
  
This rewrite allows to fix a PK row visibility bug caused by a partition  
descriptor hack which requires ActiveSnapshot to be set to come up with  
the correct set of partitions for the RI query running under REPEATABLE  
READ isolation.  We now set that snapshot indepedently of the snapshot  
to be used by the PK index scan, so the two no longer interfere.  The  
buggy output in src/test/isolation/expected/fk-snapshot.out of the  
relevant test case added by commit 00cb86e75d6d has been corrected.  
(The bug still exists in branch 14, however, but this fix is too  
invasive to backpatch.)  
  
Author: Amit Langote <amitlangote09@gmail.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>  
Reviewed-by: Li Japin <japinli@hotmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>  
Discussion: https://postgr.es/m/CA+HiwqGkfJfYdeq5vHPh6eqPKjSbfpDDY+j-kXYFePQedtSLeg@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeLockRows.c
M src/backend/utils/adt/ri_triggers.c
M src/include/executor/execPartition.h
M src/include/executor/executor.h
M src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/specs/fk-snapshot.spec

Fix test instability introduced in e349c95d3e9 due to async deduplication.

commit   : dbe29b0d2c96f34b3f3222c6fc1710fcff065f18    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 11:54:51 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 11:54:51 -0700    

Click here for diff

The statement emitting notifies tried to make sure page boundaries were  
crossed, but failed to do so reliably due to deduplication.  
  
Reported-By: chap@anastigmatix.net  
Discussion: https://postgr.es/m/20220407185408.n7dvsgqsb3q6uze7@alap3.anarazel.de  

M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec

Add isolation tests for snapshot behavior in ri_triggers.c

commit   : 00cb86e75d6dd13a8bc07f79c2cdbe20d96c2d92    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 19:57:29 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 7 Apr 2022 19:57:29 +0200    

Click here for diff

They are to check the behavior of RI_FKey_check() and  
ri_Check_Pk_Match().  A test case whereby RI_FKey_check() queries a  
partitioned PK table under REPEATABLE READ isolation produces wrong  
output due to a bug of the partition-descriptor logic and that is noted  
as such in the comment in the test.  A subsequent commit will fix the  
bug and replace the buggy output by the correct one.  
  
Author: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/1627848.1636676261@sss.pgh.pa.us  

A src/test/isolation/expected/fk-snapshot.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-snapshot.spec

Revert "Logical decoding of sequences"

commit   : 2c7ea57e56ca5f668c32d4266e0a3e45b455bef5    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 7 Apr 2022 18:13:13 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 7 Apr 2022 18:13:13 +0200    

Click here for diff

This reverts a sequence of commits, implementing features related to  
logical decoding and replication of sequences:  
  
 - 0da92dc530c9251735fc70b20cd004d9630a1266  
 - 80901b32913ffa59bf157a4d88284b2b3a7511d9  
 - b779d7d8fdae088d70da5ed9fcd8205035676df3  
 - d5ed9da41d96988d905b49bebb273a9b2d6e2915  
 - a180c2b34de0989269fdb819bff241a249bf5380  
 - 75b1521dae1ff1fde17fda2e30e591f2e5d64b6a  
 - 2d2232933b02d9396113662e44dca5f120d6830e  
 - 002c9dd97a0c874fd1693a570383e2dd38cd40d5  
 - 05843b1aa49df2ecc9b97c693b755bd1b6f856a9  
  
The implementation has issues, mostly due to combining transactional and  
non-transactional behavior of sequences. It's not clear how this could  
be fixed, but it'll require reworking significant part of the patch.  
  
Discussion: https://postgr.es/m/95345a19-d508-63d1-860a-f5c2f41e8d40@enterprisedb.com  

M contrib/test_decoding/Makefile
M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/expected/decoding_in_xact.out
M contrib/test_decoding/expected/decoding_into_rel.out
M contrib/test_decoding/expected/mxact.out
M contrib/test_decoding/expected/ondisk_startup.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/expected/rewrite.out
D contrib/test_decoding/expected/sequence.out
M contrib/test_decoding/expected/slot.out
M contrib/test_decoding/expected/toast.out
M contrib/test_decoding/expected/truncate.out
M contrib/test_decoding/specs/mxact.spec
M contrib/test_decoding/specs/ondisk_startup.spec
M contrib/test_decoding/sql/ddl.sql
M contrib/test_decoding/sql/decoding_in_xact.sql
M contrib/test_decoding/sql/decoding_into_rel.sql
M contrib/test_decoding/sql/replorigin.sql
M contrib/test_decoding/sql/rewrite.sql
D contrib/test_decoding/sql/sequence.sql
M contrib/test_decoding/sql/slot.sql
M contrib/test_decoding/sql/toast.sql
M contrib/test_decoding/sql/truncate.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/commands/publicationcmds.c
M src/backend/commands/sequence.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execReplication.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/parser/gram.y
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/access/rmgrlist.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/commands/sequence.h
M src/include/nodes/parsenodes.h
M src/include/replication/decode.h
M src/include/replication/logicalproto.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
D src/test/subscription/t/030_sequences.pl

doc: Fix man page whitespace issues

commit   : d7ab2a9a3c0a2800ab36bb48d1cc97370067777e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 18:23:28 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 18:23:28 +0200    

Click here for diff

Whitespace between tags is significant, and in some cases it creates  
extra vertical space in man pages.  The fix is to remove some newlines  
in the markup.  

M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/drop_procedure.sgml
M doc/src/sgml/ref/merge.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pgbench.sgml

Fix off-by-one error in pg_waldump, introduced in 5c279a6d350.

commit   : dad97e0502b4a5fc125c83e9092d9673f0e91805    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 09:14:49 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 09:14:49 -0700    

Click here for diff

Per report by Bharath Rupireddy.  
  
Discussion: https://postgr.es/m/CALj2ACX+PWDK2MYjdu8CB1ot7OUSo6kd5-fkkEgduEsTSZjAEw@mail.gmail.com  

M src/bin/pg_waldump/pg_waldump.c

Fix another buildfarm issue from commit 5c279a6d350.

commit   : 957aa4d87a419d18710283cf4f53ba7d3ead6bbe    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 08:40:16 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 08:40:16 -0700    

Click here for diff

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

M src/include/access/xlog_internal.h

Unlogged sequences

commit   : 344d62fb9a978a72cf8347f0369b9ee643fd0b31    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 16:13:23 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 16:13:23 +0200    

Click here for diff

Add support for unlogged sequences.  Unlike for unlogged tables, this  
is not a performance feature.  It allows sequences associated with  
unlogged tables to be excluded from replication.  
  
A new subcommand ALTER SEQUENCE ... SET LOGGED/UNLOGGED is added.  
  
An identity/serial sequence now automatically gets and follows the  
persistence level (logged/unlogged) of its owning table.  (The  
sequences owned by temporary tables were already temporary through the  
separate mechanism in RangeVarAdjustRelationPersistence().)  But you  
can still change the persistence of an owned sequence separately.  
Also, pg_dump and pg_upgrade preserve the persistence of existing  
sequences.  
  
Discussion: https://www.postgresql.org/message-id/flat/04e12818-2f98-257c-b926-2845d74ed04f%402ndquadrant.com  

M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_sequence.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_dump.sgml
M src/backend/commands/sequence.c
M src/backend/commands/tablecmds.c
M src/backend/parser/parse_utilcmd.c
M src/bin/pg_dump/pg_dump.c
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.c
M src/include/commands/sequence.h
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/sequence.out
M src/test/regress/sql/sequence.sql

Fix typo in xlogrecovery.c code comment

commit   : bab588cd5cbbeb43cda6e20c967b43000ea2aa80    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 7 Apr 2022 14:01:28 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 7 Apr 2022 14:01:28 +0200    

Click here for diff

Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/CALj2ACUoPtnReT=yAQMcWLtcCpk7p83xjeA8tiRX8Q0_sjh8kw@mail.gmail.com  

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

Avoid <substeps> element in man pages

commit   : d772b18d44c209ec4a48ba6e1d86c13445318b81    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 13:45:25 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 13:45:25 +0200    

Click here for diff

The upstream DocBook manpages stylesheet apparently does not handle  
the <substeps> element at all, and so the content comes out  
unformatted, which is not useful.  
  
As a workaround, replace <substeps> with a nested <procedure>, which  
ends up effectively the same in output.  

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

Include some missing headers.

commit   : 5b186308fbc41d0713fa91426d57a2afe37dd969    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Apr 2022 20:55:16 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Apr 2022 20:55:16 +1200    

Click here for diff

Per headerscheck on BF animal crake, and Andres.  
  
Discussion: https://postgr.es/m/20220407083630.n62vgwqfy2v6wsrd%40alap3.anarazel.de  

M src/include/access/xlogprefetcher.h

pgstat: add alternate output for stats.spec, for the 2PC disabled case.

commit   : a2f433fa491f709767dbf916203f1c53f39707fe    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:57:13 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:57:13 -0700    

Click here for diff

It might be worth instead splitting the test up to produce a smaller  
alternative output file. But that's not trivial either, due to the number of  
steps defined. And more than I want to do tonight.  
  
Per buildfarm.  

A src/test/isolation/expected/stats_1.out

Try to silence "-Wmissing-braces" complaints in rmgrdesc.c.

commit   : 6392f2a0968c20ecde4d27b6652703ad931fce92    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:49:32 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:49:32 -0700    

Click here for diff

Per buildfarm member lapwing.  
  
https://postgr.es/m/20220407065640.xljttqcs46k4lyvr@alap3.anarazel.de  

M src/bin/pg_waldump/rmgrdesc.c

Prefetch data referenced by the WAL, take II.

commit   : 5dc0418fab281d017a61a5756240467af982bdfd    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Apr 2022 19:28:40 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 7 Apr 2022 19:28:40 +1200    

Click here for diff

Introduce a new GUC recovery_prefetch.  When enabled, look ahead in the  
WAL and try to initiate asynchronous reading of referenced data blocks  
that are not yet cached in our buffer pool.  For now, this is done with  
posix_fadvise(), which has several caveats.  Since not all OSes have  
that system call, "try" is provided so that it can be enabled where  
available.  Better mechanisms for asynchronous I/O are possible in later  
work.  
  
Set to "try" for now for test coverage.  Default setting to be finalized  
before release.  
  
The GUC wal_decode_buffer_size limits the distance we can look ahead in  
bytes of decoded data.  
  
The existing GUC maintenance_io_concurrency is used to limit the number  
of concurrent I/Os allowed, based on pessimistic heuristics used to  
infer that I/Os have begun and completed.  We'll also not look more than  
maintenance_io_concurrency * 4 block references ahead.  
  
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>  
Reviewed-by: Tomas Vondra <tomas.vondra@2ndquadrant.com>  
Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> (earlier version)  
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier version)  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> (earlier version)  
Tested-by: Tomas Vondra <tomas.vondra@2ndquadrant.com> (earlier version)  
Tested-by: Jakub Wartak <Jakub.Wartak@tomtom.com> (earlier version)  
Tested-by: Dmitry Dolgov <9erthalion6@gmail.com> (earlier version)  
Tested-by: Sait Talha Nisanci <Sait.Nisanci@microsoft.com> (earlier version)  
Discussion: https://postgr.es/m/CA%2BhUKGJ4VJN8ttxScUFM8dOKX0BrBiboo5uz1cq%3DAovOddfHpA%40mail.gmail.com  

M doc/src/sgml/config.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/Makefile
M src/backend/access/transam/xlog.c
A src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/system_views.sql
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/smgr/md.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/access/xlog.h
A src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogutils.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/guc.h
M src/include/utils/guc_tables.h
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list

Fix warning introduced in 5c279a6d350.

commit   : 9553b4115f1879f66935f42fff0b798ef91866d0    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 00:27:07 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 7 Apr 2022 00:27:07 -0700    

Click here for diff

Change two macros to be static inline functions instead to keep the  
data type consistent. This avoids a "comparison is always true"  
warning that was occurring with -Wtype-limits. In the process, change  
the names to look less like macros.  
  
Discussion: https://postgr.es/m/20220407063505.njnnrmbn4sxqfsts@alap3.anarazel.de  

M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlogreader.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/rmgrdesc.c
M src/include/access/rmgr.h

pgstat: add tests for transaction behaviour, 2PC, function stats.

commit   : e349c95d3e91754c8c3afc0587d52d44a479c8d2    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    

Click here for diff

Author: Andres Freund <andres@anarazel.de>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

A src/test/isolation/expected/stats.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/stats.spec
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

pgstat: add pg_stat_have_stats() test helper.

commit   : ad401664b8012cafb64e8fce33fe40356c5bc686    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 7 Apr 2022 00:03:58 -0700    

Click here for diff

Will be used by tests committed subsequently.  
  
Bumps catversion (this time for real, the one in 0f96965c658 got lost when  
rebasing over 5c279a6d350).  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Discussion: https://postgr.es/m/CAAKRu_aNxL1WegCa45r=VAViCLnpOU7uNC7bTtGw+=QAPyYivw@mail.gmail.com  

M src/backend/catalog/system_functions.sql
M src/backend/utils/activity/pgstat.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

pgstat: add pg_stat_force_next_flush(), use it to simplify tests.

commit   : 0f96965c658147d6d6bad096d2d4a2c9c665f4a9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

In the stats collector days it was hard to write tests for the stats system,  
because fundamentally delivery of stats messages over UDP was not  
synchronous (nor guaranteed). Now we easily can force pending stats updates to  
be flushed synchronously.  
  
This moves stats.sql into a parallel group, there isn't a reason for it to run  
in isolation anymore. And it may shake out some bugs.  
  
Bumps catversion.  
  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M contrib/test_decoding/expected/stats.out
M contrib/test_decoding/sql/stats.sql
M src/backend/utils/activity/pgstat.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/brin.out
M src/test/regress/expected/stats.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/brin.sql
M src/test/regress/sql/stats.sql

pgstat: fix small bug in pgstat_drop_relation().

commit   : 5e07d3d6bdbff998eb68c131ecd10c448b026e47    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

Just after committing 5891c7a8ed8, a test running with debug_discard_caches=1  
failed locally...  
  
pgstat_drop_relation() neither checked pgstat_should_count_relation() nor  
called pgstat_prep_relation_pending(). With debug_discard_caches=1  
rel->pgstat_info wasn't set up, leading pg_stat_get_xact_tuples_inserted()  
spuriously still returning > 0 while in the transaction dropping the table.  

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

pgstat: prevent fix pgstat_reinit_entry() from zeroing out lwlock.

commit   : 81ae9e65887476b4c55aaad276a8010a459a41ce    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:35:56 -0700    

Click here for diff

Zeroing out an lwlock in a normal build turns out to not trigger any alarms,  
if nobody can use the lwlock at that moment (as the case here). But with  
--disable-spinlocks --disable-atomics, the sema field needs to be initialized.  
  
We probably should make sure that this fails on more common configurations as  
well...  
  
Per buildfarm animal rorqual  

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

Fix compilation with WAL_DEBUG.

commit   : 3536b851adb275e2f49a80030111e84abc0736ba    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:24:00 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 23:24:00 -0700    

Click here for diff

Broke with 5c279a6d350. But looks like it had been half-broken since  
70e81861fad, because 'rmid' didn't refer to the current record's rmid anymore,  
but to rmid from "Initialize resource managers" - a constant.  

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

Custom WAL Resource Managers.

commit   : 5c279a6d350205cc98f91fb8e1d3e4442a6b25d1    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 6 Apr 2022 22:26:43 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Wed, 6 Apr 2022 22:26:43 -0700    

Click here for diff

Allow extensions to specify a new custom resource manager (rmgr),  
which allows specialized WAL. This is meant to be used by a Table  
Access Method or Index Access Method.  
  
Prior to this commit, only Generic WAL was available, which offers  
support for recovery and physical replication but not logical  
replication.  
  
Reviewed-by: Julien Rouhaud, Bharath Rupireddy, Andres Freund  
Discussion: https://postgr.es/m/ed1fb2e22d15d3563ae0eb610f7b61bb15999c0a.camel%40j-davis.com  

M doc/src/sgml/config.sgml
A doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/filelist.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/generic-wal.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M src/backend/access/transam/rmgr.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/decode.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/rmgrdesc.c
M src/bin/pg_waldump/rmgrdesc.h
M src/include/access/rmgr.h
M src/include/access/xlog_internal.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/miscadmin.h
M src/include/utils/guc.h

Update config.guess and config.sub

commit   : a8cfb0c1a964ebbe830c5138d389b0d2627ec298    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 07:32:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 7 Apr 2022 07:32:43 +0200    

Click here for diff

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

Add single-item cache when looking at topmost XID of a subtrans XID

commit   : 06f5295af673df795e8e70e28c43d61c2817b6df    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Apr 2022 14:34:37 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Apr 2022 14:34:37 +0900    

Click here for diff

This change affects SubTransGetTopmostTransaction(), used to find the  
topmost transaction ID of a given transaction ID.  The cache is able to  
store one value, so as we can save the backend from unnecessary lookups  
at pg_subtrans/ on repetitive calls of this routine.  There is a similar  
practice in transam.c, for example.  
  
Author: Simon Riggs  
Reviewed-by: Andrey Borodin, Julien Rouhaud  
Discussion: https://postgr.es/m/CANbhV-G8Co=yq4v4BkW7MJDqVt68K_8A48nAZ_+8UQS7LrwLEQ@mail.gmail.com  

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

pgstat: move pgstat.c to utils/activity.

commit   : fbfe6910eca0d6a61cbcdd27cdd5a8d9de6477fa    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Now that pgstat is not related to postmaster anymore, src/backend/postmaster  
is not a well fitting directory.  
  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M src/backend/postmaster/Makefile
M src/backend/utils/activity/Makefile
R099 src/backend/postmaster/pgstat.c src/backend/utils/activity/pgstat.c

pgstat: rename STATS_COLLECTOR GUC group to STATS_CUMULATIVE.

commit   : 1db4e5a4eeec0c5e240628923daf0e0a666f8c04    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc_tables.h

pgstat: remove stats_temp_directory.

commit   : 6f0cf87872ab2fd4a81249ca9d6299b9b1a52277    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

With stats now being stored in shared memory, the GUC isn't needed  
anymore. However, the pg_stat_tmp directory and PG_STAT_TMP_DIR define are  
kept, as pg_stat_statements (and some out-of-core extensions) store data in  
it.  
  
Docs will be updated in a subsequent commit, together with the other pending  
docs updates due to shared memory stats.  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220330233550.eiwsbearu6xhuqwe@alap3.anarazel.de  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/postmaster/pgstat.c
M src/backend/replication/basebackup.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_rewind/filemap.c
M src/include/pgstat.h
M src/test/perl/PostgreSQL/Test/Cluster.pm

pgstat: store statistics in shared memory.

commit   : 5891c7a8ed8f2d3d577e7eea34dacff12d7b6bbd    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Previously the statistics collector received statistics updates via UDP and  
shared statistics data by writing them out to temporary files regularly. These  
files can reach tens of megabytes and are written out up to twice a  
second. This has repeatedly prevented us from adding additional useful  
statistics.  
  
Now statistics are stored in shared memory. Statistics for variable-numbered  
objects are stored in a dshash hashtable (backed by dynamic shared  
memory). Fixed-numbered stats are stored in plain shared memory.  
  
The header for pgstat.c contains an overview of the architecture.  
  
The stats collector is not needed anymore, remove it.  
  
By utilizing the transactional statistics drop infrastructure introduced in a  
prior commit statistics entries cannot "leak" anymore. Previously leaked  
statistics were dropped by pgstat_vacuum_stat(), called from [auto-]vacuum. On  
systems with many small relations pgstat_vacuum_stat() could be quite  
expensive.  
  
Now that replicas drop statistics entries for dropped objects, it is not  
necessary anymore to reset stats when starting from a cleanly shut down  
replica.  
  
Subsequent commits will perform some further code cleanup, adapt docs and add  
tests.  
  
Bumps PGSTAT_FILE_FORMAT_ID.  
  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-By: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-By: "David G. Johnston" <david.g.johnston@gmail.com>  
Reviewed-By: Tomas Vondra <tomas.vondra@2ndquadrant.com> (in a much earlier version)  
Reviewed-By: Arthur Zakirov <a.zakirov@postgrespro.ru> (in a much earlier version)  
Reviewed-By: Antonin Houska <ah@cybertec.at> (in a much earlier version)  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  
Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de  
Discussion: https://postgr.es/m/20210319235115.y3wz7hpnnrshdyv6@alap3.anarazel.de  

M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
A src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/miscadmin.h
M src/include/pgstat.h
M src/include/storage/lwlock.h
M src/include/utils/pgstat_internal.h
M src/include/utils/rel.h
M src/include/utils/timeout.h
M src/include/utils/wait_event.h
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
M src/tools/pgindent/typedefs.list
M src/tools/valgrind.supp

pgstat: normalize function naming.

commit   : be902e26510788c70a874ea54bad753b723d018f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 21:29:46 -0700    

Click here for diff

Most of pgstat uses pgstat_<verb>_<subject>() or just <verb>_<subject>(). But  
not all (some introduced fairly recently by me). Rename ones that aren't  
intentionally following a different scheme (e.g. AtEOXact_*).  

M src/backend/access/common/relation.c
M src/backend/access/transam/slru.c
M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h

Reorder subskiplsn in pg_subscription to avoid alignment issues.

commit   : 79b716cfb7a1be2a61ebb4418099db1258f35e30    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 7 Apr 2022 09:39:25 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 7 Apr 2022 09:39:25 +0530    

Click here for diff

The column 'subskiplsn' uses TYPALIGN_DOUBLE (which has 4 bytes alignment  
on AIX) for storage. But the C Struct (Form_pg_subscription) has 8-byte  
alignment for this field, so retrieving it from storage causes an  
unaligned read.  
  
To fix this, we rearranged the 'subskiplsn' column in the catalog so that  
it naturally comes at an 8-byte boundary.  
  
We have fixed a similar problem in commit f3b421da5f. This patch adds a  
test to avoid a similar mistake in the future.  
  
Reported-by: Noah Misch  
Diagnosed-by: Noah Misch, Masahiko Sawada, Amit Kapila  
Author: Masahiko Sawada  
Reviewed-by: Noah Misch, Amit Kapila  
Discussion: https://postgr.es/m/20220401074423.GC3682158@rfd.leadboat.com  
	    https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/test/regress/expected/sanity_check.out
M src/test/regress/expected/test_setup.out
M src/test/regress/regress.c
M src/test/regress/sql/sanity_check.sql
M src/test/regress/sql/test_setup.sql

pgstat: revise replication slot API in preparation for shared memory stats.

commit   : e41aed674f35c63380175bb0e2dfa8dccfb2204d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 18:26:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 18:26:17 -0700    

Click here for diff

Previously the pgstat <-> replication slots API was done with on the basis of  
names. However, the upcoming move to storing stats in shared memory makes it  
more convenient to use a integer as key.  
  
Change the replication slot functions to take the slot rather than the slot  
name, and expose ReplicationSlotIndex() to compute the index of an replication  
slot. Special handling will be required for restarts, as the index is not  
stable across restarts. For now pgstat internally still uses names.  
  
Rename pgstat_report_replslot_{create,drop}() to  
pgstat_{create,drop}_replslot() to match the functions for other kinds of  
stats.  
  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de  

M src/backend/postmaster/pgstat.c
M src/backend/replication/logical/logical.c
M src/backend/replication/slot.c
M src/backend/utils/activity/pgstat_replslot.c
M src/include/pgstat.h
M src/include/replication/slot.h

pgstat: scaffolding for transactional stats creation / drop.

commit   : 8b1dccd37c71ed2ff016294d8f9053a32b02b19e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 18:22:22 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 18:22:22 -0700    

Click here for diff

One problematic part of the current statistics collector design is that there  
is no reliable way of getting rid of statistics entries. Because of that  
pgstat_vacuum_stat() (called by [auto-]vacuum) matches all stats for the  
current database with the catalog contents and tries to drop now-superfluous  
entries. That's quite expensive. What's worse, it doesn't work on physical  
replicas, despite physical replicas collection statistics entries.  
  
This commit introduces infrastructure to create / drop statistics entries  
transactionally, together with the underlying catalog objects (functions,  
relations, subscriptions). pgstat_xact.c maintains a list of stats entries  
created / dropped transactionally in the current transaction. To ensure the  
removal of statistics entries is durable dropped statistics entries are  
included in commit / abort (and prepare) records, which also ensures that  
stats entries are dropped on standbys.  
  
Statistics entries created separately from creating the underlying catalog  
object (e.g. when stats were previously lost due to an immediate restart)  
are *not* WAL logged. However that can only happen outside of the transaction  
creating the catalog object, so it does not lead to "leaked" statistics  
entries.  
  
For this to work, functions creating / dropping functions / relations /  
subscriptions need to call into pgstat. For subscriptions this was already  
done when dropping subscriptions, via pgstat_report_subscription_drop() (now  
renamed to pgstat_drop_subscription()).  
  
This commit does not actually drop stats yet, it just provides the  
infrastructure. It is however a largely independent piece of infrastructure,  
so committing it separately makes sense.  
  
Bumps XLOG_PAGE_MAGIC.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/catalog/heap.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/pgstat.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_xact.c
M src/include/access/xact.h
M src/include/access/xlog_internal.h
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list

pgstat: prepare APIs used by pgstatfuncs for shared memory stats.

commit   : 8fb580a35ce358063dfdd10991d017498283c767    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    

Click here for diff

With the introduction of PgStat_Kind PgStat_Single_Reset_Type,  
PgStat_Shared_Reset_Target don't make sense anymore. Replace them with  
PgStat_Kind.  
  
Instead of having dedicated reset functions for different kinds of stats, use  
two generic helper routines (one to reset all stats of a kind, one to reset  
one stats entry).  
  
A number of reset functions were named pgstat_reset_*_counter(), despite  
affecting multiple counters. The generic helper routines get rid of  
pgstat_reset_single_counter(), pgstat_reset_subscription_counter().  
  
Rename pgstat_reset_slru_counter(), pgstat_reset_replslot_counter() to  
pgstat_reset_slru(), pgstat_reset_replslot() respectively, and have them only  
deal with a single SLRU/slot. Resetting all SLRUs/slots goes through the  
generic pgstat_reset_of_kind().  
  
Previously pg_stat_reset_replication_slot() used SearchNamedReplicationSlot()  
to check if a slot exists. API wise it seems better to move that to  
pgstat_replslot.c.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/pgstat.h
M src/tools/pgindent/typedefs.list

pgstat: introduce PgStat_Kind enum.

commit   : 997afad89d12f314555600feee8189d753e105d1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 17:56:19 -0700    

Click here for diff

Will be used by following commits to generalize stats infrastructure. Kept  
separate to allow commits stand reasonably on their own.  
  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de  

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

Add option --config-file to pg_rewind

commit   : 0d5c387573be5c40bf18b7b8983f406637dff42f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Apr 2022 08:51:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 7 Apr 2022 08:51:49 +0900    

Click here for diff

This option is useful to do a rewind with the server configuration file  
(aka postgresql.conf) located outside the data directory, which is  
something that some Linux distributions and some HA tools like to rely  
on.  As a result, this can simplify the logic around a rewind by  
avoiding the copy of such files before running pg_rewind.  
  
This option affects pg_rewind when it internally starts the target  
cluster with some "postgres" commands, adding -c config_file=FILE to the  
command strings generated, when:  
- retrieving a restore_command using a "postgres -C" command for  
-c/--restore-target-wal.  
- forcing crash recovery once to get the cluster into a clean shutdown  
state.  
  
Author: Gunnar "Nick" Bluth  
Reviewed-by: Michael Banck, Alexander Kukushkin, Michael Paquier,  
Alexander Alekseev  
Discussion: https://postgr.es/m/7c59265d-ac50-b0aa-ca1e-65e8bd27642a@pro-open.de  

M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/t/RewindTest.pm

Use ISB as a spin-delay instruction on ARM64.

commit   : a82a5eee314df52f3183cedc0ecbcac7369243b1    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 18:57:57 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 18:57:57 -0400    

Click here for diff

This seems beneficial on high-core-count machines, and not harmful  
on lesser hardware.  However, older ARM32 gear doesn't have this  
instruction, so restrict the patch to ARM64.  
  
Geoffrey Blake  
  
Discussion: https://postgr.es/m/78338F29-9D7F-4DC8-BD71-E9674CE71425@amazon.com  

M src/include/storage/s_lock.h

pgstat: add pgstat_copy_relation_stats().

commit   : 8ea7963fc741b6f403a544d56ad0ecf78e5237b1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 14:09:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 14:09:18 -0700    

Click here for diff

Until now index_concurrently_swap() directly modified pgstat internal  
datastructures. That will break with the introduction of shared memory  
statistics and seems off architecturally.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M src/backend/catalog/index.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/pgstat.h

pgstat: rename some pgstat_send_* functions to pgstat_report_*.

commit   : cc96373cf39bbfb386a40a47b7f0ea8f051f1838    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 14:08:57 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 14:08:57 -0700    

Click here for diff

Only the pgstat_send_* functions that are called from outside pgstat*.c are  
renamed (the rest will go away). This is done separately from the - quite  
large - shared memory statistics patch to make review easier.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de  

M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/pgstat.h

Suppress "variable 'pagesaving' set but not used" warning.

commit   : dbafe127bb215f512164669b49f99fcb7ed9d266    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 17:03:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 17:03:35 -0400    

Click here for diff

With asserts disabled, late-model clang notices that this variable  
is incremented but never otherwise read.  
  
Discussion: https://postgr.es/m/3171401.1649275153@sss.pgh.pa.us  

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

pgstat: stats collector references in comments.

commit   : bdbd3d9064f9dbd064253e05f156ec77d4a90d05    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 13:56:06 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 13:56:06 -0700    

Click here for diff

Soon the stats collector will be no more, with statistics instead getting  
stored in shared memory. There are a lot of references to the stats collector  
in comments. This commit replaces most of these references with "cumulative  
statistics system", with the remaining ones getting replaced as part of  
subsequent commits.  
  
This is done separately from the - quite large - shared memory statistics  
patch to make review easier.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  
Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de  

M contrib/test_decoding/t/001_repl_stats.pl
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/dbcommands.c
M src/backend/commands/matview.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pgstat.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/basebackup.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/error/elog.c
M src/include/pgstat.h
M src/include/utils/backend_status.h
M src/include/utils/pgstat_internal.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

pgstat: move transactional code into pgstat_xact.c.

commit   : ab62a642d52c95c0c62e927ba1bf3cfa279b744b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 13:23:47 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 13:23:47 -0700    

Click here for diff

The transactional integration code is largely independent from the rest of  
pgstat.c. Subsequent commits will add more related code.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20220404041516.cctrvpadhuriawlq@alap3.anarazel.de  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/Makefile
A src/backend/utils/activity/pgstat_xact.c
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h

pgstat: move pgstat_report_autovac() to pgstat_database.c.

commit   : c3e9b07936f70388c6f5341b68d6a04d40e07b86    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 12:41:29 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 12:41:29 -0700    

Click here for diff

I got the location wrong in 13619598f10. The name did make it sound like it  
belonged in pgstat_relation.c...  

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

dsm: allow use in single user mode.

commit   : 46a2d2499a647174585fcfe871ddd2d32244a128    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 12:40:04 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 6 Apr 2022 12:40:04 -0700    

Click here for diff

It might seem pointless to allow use of dsm in single user mode, but otherwise  
subsystems might need dedicated single user mode code paths.  
  
Besides changing the assert, all that's needed is to make some windows code  
assuming the presence of postmaster conditional.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com  

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

Forgotten catversion bump for 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a

commit   : e99546f56670491370d7dc63b0693c3aadaa3112    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Wed, 6 Apr 2022 15:00:07 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Wed, 6 Apr 2022 15:00:07 -0400    

Click here for diff

M src/include/catalog/catversion.h

Remove exclusive backup mode

commit   : 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Wed, 6 Apr 2022 14:41:03 -0400    
  
committer: Stephen Frost <sfrost@snowman.net>    
date     : Wed, 6 Apr 2022 14:41:03 -0400    

Click here for diff

Exclusive-mode backups have been deprecated since 9.6 (when  
non-exclusive backups were introduced) due to the issues  
they can cause should the system crash while one is running and  
generally because non-exclusive provides a much better interface.  
Further, exclusive backup mode wasn't really being tested (nor was most  
of the related code- like being able to log in just to stop an exclusive  
backup and the bits of the state machine related to that) and having to  
possibly deal with an exclusive backup and the backup_label file  
existing during pg_basebackup, pg_rewind, etc, added other complexities  
that we are better off without.  
  
This patch removes the exclusive backup mode, the various special cases  
for dealing with it, and greatly simplifies the online backup code and  
documentation.  
  
Authors: David Steele, Nathan Bossart  
Reviewed-by: Chapman Flack  
Discussion: https://postgr.es/m/ac7339ca-3718-3c93-929f-99e725d1172c@pgmasters.net  
https://postgr.es/m/CAHg+QDfiM+WU61tF6=nPZocMZvHDzCK47Kneyb0ZRULYzV5sKQ@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/pg_ctl-ref.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/runtime.sgml
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/system_functions.sql
M src/backend/postmaster/postmaster.c
M src/backend/replication/basebackup.c
M src/backend/utils/init/postinit.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_rewind/filemap.c
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/recovery/t/010_logical_decoding_timelines.pl

Further improve jsonb_sqljson parallel test

commit   : 14d3f24fa8a21f8a7e66f1fc60253a1e11410bf3    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 6 Apr 2022 13:48:26 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 6 Apr 2022 13:48:26 -0400    

Click here for diff

Instead of using a very large table, use some settings to encourage use  
of parallelism. Also, drop the table so it doesn't upset the recovery  
test.  
  
per suggestion from Andres Freund  
  
Discussion: https://postgr.es/m/20220406022118.3ocqvhxr6kciw5am@alap3.anarazel.de  

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

Allow granting SET and ALTER SYSTEM privileges on GUC parameters.

commit   : a0ffa885e478f5eeacc4e250e35ce25a4740c487    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 13:24:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 6 Apr 2022 13:24:33 -0400    

Click here for diff

This patch allows "PGC_SUSET" parameters to be set by non-superusers  
if they have been explicitly granted the privilege to do so.  
The privilege to perform ALTER SYSTEM SET/RESET on a specific parameter  
can also be granted.  
Such privileges are cluster-wide, not per database.  They are tracked  
in a new shared catalog, pg_parameter_acl.  
  
Granting and revoking these new privileges works as one would expect.  
One caveat is that PGC_USERSET GUCs are unaffected by the SET privilege  
--- one could wish that those were handled by a revocable grant to  
PUBLIC, but they are not, because we couldn't make it robust enough  
for GUCs defined by extensions.  
  
Mark Dilger, reviewed at various times by Andrew Dunstan, Robert Haas,  
Joshua Brindle, and myself  
  
Discussion: https://postgr.es/m/3D691E20-C1D5-4B80-8BA5-6BEB63AF3029@enterprisedb.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/drop_owned.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/revoke.sgml
M doc/src/sgml/ref/set.sgml
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
A src/backend/catalog/pg_parameter_acl.c
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/seclabel.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/utils/adt/acl.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/misc/guc.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/psql/tab-complete.c
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/objectaccess.h
A src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_proc.dat
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/utils/acl.h
M src/include/utils/guc.h
M src/include/utils/syscache.h
M src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
M src/test/modules/test_oat_hooks/sql/test_oat_hooks.sql
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/unsafe_tests/Makefile
A src/test/modules/unsafe_tests/expected/guc_privs.out
A src/test/modules/unsafe_tests/sql/guc_privs.sql

Reduce running time of jsonb_sqljson test

commit   : 2ef6f11b0c77ec323c688ddfd98ffabddb72c11d    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 6 Apr 2022 10:25:45 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 6 Apr 2022 10:25:45 -0400    

Click here for diff

The test created a 1m row table in order to test parallel operation of  
JSON_VALUE. However, this was more than were needed for the test, so  
save time by halving it, and also by making the table unlogged.  
Experimentation shows that this size is only a little above the number  
required to generate the expected output.  
  
Per gripe from Andres Freund  
  
Discussion: https://postgr.es/m/20220406022118.3ocqvhxr6kciw5am@alap3.anarazel.de  

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

Fix unsigned output format in SLRU error reporting

commit   : 01effb130420ba06b3fb441274415bd07c8a87b0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 09:15:05 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 09:15:05 +0200    

Click here for diff

Avoid printing signed values as unsigned.  (No impact in practice  
expected.)  
  
Author: Pavel Borisov <pashkin.elfe@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/CALT9ZEHN7hWJo6MgJKqoDMGj%3DGOzQU50wTvOYZXDj7x%3DsUK-kw%40mail.gmail.com  

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

Change one AssertMacro to Assert

commit   : b604a1c204fce2600730cb60aa78e04e949fa588    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 09:09:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 09:09:14 +0200    

Click here for diff

What surrounds it is no longer a macro (e27f4ee0a701).  

M src/include/access/htup_details.h

Allow asynchronous execution in more cases.

commit   : c2bb02bc2e858ba345b8b33f1f3a54628f719d93    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 6 Apr 2022 15:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 6 Apr 2022 15:45:00 +0900    

Click here for diff

In commit 27e1f1456, create_append_plan() only allowed the subplan  
created from a given subpath to be executed asynchronously when it was  
an async-capable ForeignPath.  To extend coverage, this patch handles  
cases when the given subpath includes some other Path types as well that  
can be omitted in the plan processing, such as a ProjectionPath directly  
atop an async-capable ForeignPath, allowing asynchronous execution in  
partitioned-scan/partitioned-join queries with non-Var tlist expressions  
and more UNION queries.  
  
Andrey Lepikhov and Etsuro Fujita, reviewed by Alexander Pyhalov and  
Zhihong Yu.  
  
Discussion: https://postgr.es/m/659c37a8-3e71-0ff2-394c-f04428c76f08%40postgrespro.ru  

M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/plannodes.h
M src/include/optimizer/planmain.h

Update Unicode data to CLDR 41

commit   : 376dc437de40bd17e99a37f72f88627a16d7f200    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 08:17:33 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 6 Apr 2022 08:17:33 +0200    

Click here for diff

No actual changes result.  

M src/Makefile.global.in

Improve comments for row filtering and toast interaction in logical replication.

commit   : 2d09e44d309f64d3571f90f7620c9d924aecd010    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 6 Apr 2022 08:20:40 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 6 Apr 2022 08:20:40 +0530    

Click here for diff

Reported-by: Antonin Houska  
Author: Amit Kapila  
Reviewed-by: Antonin Houska, Ajin Cherian  
Discussion: https://postgr.es/m/84638.1649152255@antos  

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

Change aggregated log format of pgbench.

commit   : 17a856d08bedeaec77be3f15572e01f553e9613f    
  
author   : Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 6 Apr 2022 09:55:58 +0900    
  
committer: Tatsuo Ishii <ishii@postgresql.org>    
date     : Wed, 6 Apr 2022 09:55:58 +0900    

Click here for diff

Commit 4a39f87acd changed the aggregated log format. Problem is, now  
the explanatory paragraph for the log line in the document is too  
long. Also the log format included more optional columns, and it's  
harder to parse the log lines.  This commit tries to solve the  
problems.  
  
- There's no optional log columns anymore. If a column is not  
  meaningful with provided pgbench option, it will be presented as 0.  
  
- Reorder the log columns so that it's easier to parse them.  
  
- Adjust explanatory paragraph for the log line in the doc.  
  
Discussion: https://postgr.es/m/flat/202203280757.3tu4ovs3petm%40alvherre.pgsql  

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

Remove race condition in 022_crash_temp_files.pl test.

commit   : e37ad5fa4df2319e26a7e779607130feae1a5029    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Apr 2022 20:44:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 5 Apr 2022 20:44:01 -0400    

Click here for diff

It's possible for the query that "waits for restart" to complete a  
successful iteration before the postmaster has noticed its SIGKILL'd  
child and begun the restart cycle.  (This is a bit hard to believe  
perhaps, but it's been seen at least twice in the buildfarm, mainly  
on ancient platforms that likely have quirky schedulers.)  
  
To provide a more secure interlock, wait for the other session  
we're using to report that it's been forcibly shut down.  
  
Patch by me, based on a suggestion from Andres Freund.  
Back-patch to v14 where this test case came in.  
  
Discussion: https://postgr.es/m/1801850.1649047827@sss.pgh.pa.us  

M src/test/recovery/t/022_crash_temp_files.pl

Fix compilerwarning in logging size_t

commit   : 75edb919613ee835e7680e40137e494c7856bcf9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 5 Apr 2022 22:16:45 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 5 Apr 2022 22:16:45 +0200    

Click here for diff

The pg_fatal log which included filesizes were using UINT64_FORMAT for  
the size_t variables, which failed on 32 bit buildfarm animals. Change  
to using plain int instead, which is in line with how digestControlFile  
is doing it already.  
  
Per buildfarm animals florican and lapwing.  
  
Discussion: https://postgr.es/m/13C2BF64-4A6D-47E4-9181-3A658F00C9B7@yesql.se  

M src/bin/pg_rewind/local_source.c

PLAN clauses for JSON_TABLE

commit   : fadb48b00e02ccfd152baa80942de30205ab3c4f    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 5 Apr 2022 14:09:04 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Tue, 5 Apr 2022 14:09:04 -0400    

Click here for diff

These clauses allow the user to specify how data from nested paths are  
joined, allowing considerable freedom in shaping the tabular output of  
JSON_TABLE.  
  
PLAN DEFAULT allows the user to specify the global strategies when  
dealing with sibling or child nested paths. The is often sufficient to  
achieve the necessary goal, and is considerably simpler than the full  
PLAN clause, which allows the user to specify the strategy to be used  
for each named nested path.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu,  
Himanshu Upadhyaya, Daniel Gustafsson, Justin Pryzby.  
  
Discussion: https://postgr.es/m/7e2cb85d-24cf-4abb-30a5-1a33715959bd@postgrespro.ru  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_jsontable.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/jsonb_sqljson.sql
M src/tools/pgindent/typedefs.list

Have VACUUM warn on relfrozenxid "in the future".

commit   : e83ebfe6d767dafcefe00bc5f11392a3d6976c1b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 5 Apr 2022 09:44:52 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 5 Apr 2022 09:44:52 -0700    

Click here for diff

Commits 74cf7d46 and a61daa14 fixed pg_upgrade bugs involving oversights  
in how relfrozenxid or relminmxid are carried forward or initialized.  
Corruption caused by bugs of this nature was ameliorated by commit  
78db307bb2, which taught VACUUM to always overwrite existing invalid  
relfrozenxid or relminmxid values that are apparently "in the future".  
  
Extend that work now by showing a warning in the event of overwriting  
either relfrozenxid or relminmxid due to an existing value that is "in  
the future".  There is probably a decent chance that the sanity checks  
added by commit 699bf7d05c will raise an error before VACUUM reaches  
this point, but we shouldn't rely on that.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAH2-WzmRZEzeGvLv8yDW0AbFmSvJjTziORqjVUrf74mL4GL0Ww@mail.gmail.com  

M src/backend/commands/vacuum.c

pg_rewind: Fetch small files according to new size.

commit   : 16915126746e2d8597a92197a346fea0756f8e3e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 5 Apr 2022 14:45:31 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 5 Apr 2022 14:45:31 +0200    

Click here for diff

There's a race condition if a file changes in the source system  
after we have collected the file list. If the file becomes larger,  
we only fetched up to its original size. That can easily result in  
a truncated file.  That's not a problem for relation files, files  
in pg_xact, etc. because any actions on them will be replayed from  
the WAL.  However, configuration files are affected.  
  
This commit mitigates the race condition by fetching small files in  
whole, even if they have grown.  A test is added in which an extra  
file copied is concurrently grown with the output of pg_rewind thus  
guaranteeing it to have changed in size during the operation.  This  
is not a full fix: we still believe the original file size for files  
larger than 1 MB.  That should be enough for configuration files,  
and doing more than that would require big changes to the chunking  
logic in libpq_source.c.  
  
This mitigates the race condition if the file is modified between  
the original scan of files and copying the file, but there's still  
a race condition if a file is changed while it's being copied.  
That's a much smaller window, though, and pg_basebackup has the  
same issue.  
  
This race can be seen with pg_auto_failover, which frequently uses  
ALTER SYSTEM, which updates postgresql.auto.conf.  Often, pg_rewind  
will fail, because the postgresql.auto.conf file changed concurrently  
and a partial version of it was copied to the target.  The partial  
file would fail to parse, preventing the server from starting up.  
  
Author: Heikki Linnakangas  
Reviewed-by: Cary Huang  
Discussion: https://postgr.es/m/f67feb24-5833-88cb-1020-19a4a2b83ac7%40iki.fi  

M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/rewind_source.h
A src/bin/pg_rewind/t/009_growing_files.pl

Extend TAP tests of pg_dump to test for compression with gzip

commit   : 98fe74218d97becb2a53581304c96091409fd929    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Apr 2022 19:10:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 5 Apr 2022 19:10:10 +0900    

Click here for diff

The test logic is extended with two new concepts:  
- Addition of a compression command called compress_cmd, executed  
between restore_cmd and dump_cmd to control the contents of the dumps.  
In the case of this commit, this is used to compress or decompress  
elements of a dump to test new code paths.  
- Addition of a new flag called compile_option, to check if a set of  
tests can be executed depending on the ./configure options used in a  
given build.  
  
The tests introduced here are for gzip, but they are designed so as they  
can easily be extended for new compression methods.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

M src/bin/pg_dump/Makefile
M src/bin/pg_dump/t/002_pg_dump.pl

Refactor and cleanup runtime partition prune code a little

commit   : 297daa9d43539fbf5fbb3c3a2cca190d0e3da471    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 5 Apr 2022 11:46:48 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 5 Apr 2022 11:46:48 +0200    

Click here for diff

* Move the execution pruning initialization steps that are common  
between both ExecInitAppend() and ExecInitMergeAppend() into a new  
function ExecInitPartitionPruning() defined in execPartition.c.  
Those steps include creation of a PartitionPruneState to be used for  
all instances of pruning and determining the minimal set of child  
subplans that need to be initialized by performing initial pruning if  
needed, and finally adjusting the subplan_map arrays in the  
PartitionPruneState to reflect the new set of subplans remaining  
after initial pruning if it was indeed performed.  
ExecCreatePartitionPruneState() is no longer exported out of  
execPartition.c and has been renamed to CreatePartitionPruneState()  
as a local sub-routine of ExecInitPartitionPruning().  
  
* Likewise, ExecFindInitialMatchingSubPlans() that was in charge of  
performing initial pruning no longer needs to be exported.  In fact,  
since it would now have the same body as the more generally named  
ExecFindMatchingSubPlans(), except differing in the value of  
initial_prune passed to the common subroutine  
find_matching_subplans_recurse(), it seems better to remove it and add  
an initial_prune argument to ExecFindMatchingSubPlans().  
  
* Add an ExprContext field to PartitionPruneContext to remove the  
implicit assumption in the runtime pruning code that the ExprContext to  
use to compute pruning expressions that need one can always rely on the  
PlanState providing it.  A future patch will allow runtime pruning (at  
least the initial pruning steps) to be performed without the  
corresponding PlanState yet having been created, so this will help.  
  
Author: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/CA+HiwqEYCpEqh2LMDOp9mT+4-QoVe8HgFMKBjntEMCTZLpcCCA@mail.gmail.com  

M src/backend/executor/execPartition.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/partitioning/partprune.c
M src/include/executor/execPartition.h
M src/include/partitioning/partprune.h

Update some tests in 013_crash_restart.pl.

commit   : 7a43a1fc52d0fefdcb008f2fc460ab46f242da69    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Apr 2022 22:10:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Apr 2022 22:10:06 -0400    

Click here for diff

The expected backend message after SIGQUIT changed in commit  
7e784d1dc, but we missed updating this test case.  Also, experience  
shows that we might sometimes get "could not send data to server"  
instead of either of the libpq messages the test is looking for.  
  
Per report from Mark Dilger.  Back-patch to v14 where the  
backend message changed.  
  
Discussion: https://postgr.es/m/17BD82D7-49AC-40C9-8204-E7ADD30321A0@enterprisedb.com  

M src/test/recovery/t/013_crash_restart.pl

dshash: revise sequential scan support.

commit   : 909eebf27b9e6aaa78fb3338f7d8fbc7fa174247    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 14:32:52 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 14:32:52 -0700    

Click here for diff

The previous coding of dshash_seq_next(), on the first call, accessed  
status->hash_table->size_log2 without holding a partition lock and without  
guaranteeing that ensure_valid_bucket_pointers() had ever been called.  
  
That oversight turns out to not have immediately visible effects, because  
bucket 0 is always in partition 0, and ensure_valid_bucket_pointers() was  
called after acquiring the partition lock.  However,  
PARTITION_FOR_BUCKET_INDEX() with a size_log2 of 0 ends up triggering formally  
undefined behaviour.  
  
Simplify by accessing partition 0, without using PARTITION_FOR_BUCKET_INDEX().  
  
While at it, remove dshash_get_current(), there is no convincing use  
case. Also polish a few comments.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com  

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

pgstat: remove some superflous comments from pgstat.h.

commit   : 55e566fc4bc866d73541a3b28be5454bf8d666b0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 14:23:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 14:23:02 -0700    

Click here for diff

These would all need to be rephrased when moving to shared memory stats, but  
since they don't provide actual information right now, remove them instead.  
  
The comments for PgStat_Msg* are left in, because they will all be removed as  
part of the shared memory stats patch.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de  

M src/include/pgstat.h

pgstat: consistent function comment formatting.

commit   : edadf8098f4b2ca50bcc449f8857d0cc960b3c90    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 12:14:34 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 4 Apr 2022 12:14:34 -0700    

Click here for diff

There was a wild mishmash of function comment formatting in pgstat, making it  
hard to know what to use for any new function and hard to extend existing  
comments (particularly due to randomly different forms of indentation).  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20220329191727.mzzwbl7udhpq7pmf@alap3.anarazel.de  
Discussion: https://postgr.es/m/20220308205351.2xcn6k4x5yivcxyd@alap3.anarazel.de  

M src/backend/postmaster/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c

JSON_TABLE

commit   : 4e34747c88a03ede6e9d731727815e37273d4bc9    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 4 Apr 2022 15:36:03 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 4 Apr 2022 15:36:03 -0400    

Click here for diff

This feature allows jsonb data to be treated as a table and thus used in  
a FROM clause like other tabular data. Data can be selected from the  
jsonb using jsonpath expressions, and hoisted out of nested structures  
in the jsonb to form multiple rows, more or less like an outer join.  
  
Nikita Glukhov  
  
Reviewers have included (in no particular order) Andres Freund, Alexander  
Korotkov, Pavel Stehule, Andrew Alsup, Erik Rijkers, Zhihong Yu (whose  
name I previously misspelled), Himanshu Upadhyaya, Daniel Gustafsson,  
Justin Pryzby.  
  
Discussion: https://postgr.es/m/7e2cb85d-24cf-4abb-30a5-1a33715959bd@postgrespro.ru  

M src/backend/commands/explain.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
A src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/utils/jsonpath.h
M src/test/regress/expected/json_sqljson.out
M src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/sql/json_sqljson.sql
M src/test/regress/sql/jsonb_sqljson.sql
M src/tools/pgindent/typedefs.list

vacuumlazy.c: Further consolidate resource allocation.

commit   : c42a6fc41dc22b42e5417224440c02893996afb4    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 4 Apr 2022 11:53:33 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 4 Apr 2022 11:53:33 -0700    

Click here for diff

Move remaining VACUUM resource allocation and deallocation code from  
lazy_scan_heap() to its caller, heap_vacuum_rel().  This finishes off  
work started by commit 73f6ec3d.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-Wzk3fNBa_S3Ngi+16GQiyJ=AmUu3oUY99syMDTMRxitfyQ@mail.gmail.com  

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

psql: Show all query results by default

commit   : 7844c9918a43b494adde3575891d217a37062378    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Apr 2022 14:57:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 4 Apr 2022 14:57:17 +0200    

Click here for diff

Previously, psql printed only the last result if a command string  
returned multiple result sets.  Now it prints all of them.  The  
previous behavior can be obtained by setting the psql variable  
SHOW_ALL_RESULTS to off.  
  
This is a significantly enhanced version of  
3a5130672296ed4e682403a77a9a3ad3d21cef75 (that was later reverted).  
There is also much more test coverage for various psql features now.  
  
Author: Fabien COELHO <coelho@cri.ensmp.fr>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Reviewed-by: "Iwata, Aya" <iwata.aya@jp.fujitsu.com> (earlier version)  
Reviewed-by: Daniel Verite <daniel@manitou-mail.org> (earlier version)  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> (earlier version)  
Reviewed-by: vignesh C <vignesh21@gmail.com> (earlier version)  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/common.c
M src/bin/psql/help.c
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/tab-complete.c
M src/test/regress/expected/copyselect.out
M src/test/regress/expected/psql.out
M src/test/regress/expected/transactions.out
M src/test/regress/sql/copyselect.sql
M src/test/regress/sql/psql.sql
M src/test/regress/sql/transactions.sql

Disable synchronize_seqscans in 027_stream_regress.pl.

commit   : cbf4177f2ca0b9bbfdb78a6ab51e3876e9ff6eac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Apr 2022 12:38:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 4 Apr 2022 12:38:51 -0400    

Click here for diff

This script runs the core regression tests with quite a small value of  
shared_buffers, making it prone to breakage due to synchronize_seqscans  
kicking in where the tests don't expect that.  Disable that feature to  
stabilize the tests.  
  
Discussion: https://postgr.es/m/1258185.1648876239@sss.pgh.pa.us  

M src/test/recovery/t/027_stream_regress.pl

Avoid freeing objects during json aggregate finalization

commit   : 4eb9798879680dcc0e3ebb301cf6f925dfa69422    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 4 Apr 2022 10:12:30 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Mon, 4 Apr 2022 10:12:30 -0400    

Click here for diff

Commit f4fb45d15c tried to free memory during aggregate finalization.  
This cause issues, particularly when used as a window function, so stop  
doing that.  
  
Per complaint by Jaime Casanova and diagnosis by Andres Freund  
  
Discussion: https://postgr.es/m/YkfeMNYRCGhySKyg@ahch-to  

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

pg_basebackup: Fix code that thinks about LZ4 buffer size.

commit   : afb529e6772b4e2b065644a2204697eeaf6c9a96    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 4 Apr 2022 10:36:23 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 4 Apr 2022 10:36:23 -0400    

Click here for diff

Before this patch, there was some code that tried to make sure that the  
buffer was always big enough at the start, and then asserted that it  
didn't need to be enlarged later. However, the code to make sure it was  
big enough at the start doesn't actually work, and therefore it was  
possible to fail an assertion and crash later.  
  
Remove the code that tries to make sure the buffer is always big enough  
at the start in favor of enlarging the buffer as we go along whenever  
that is necessary.  
  
The mistake probably happened because, on the server side, we do  
actually need to guarantee that the buffer is big enough at the start  
to avoid subsequent resizings. However, in that case, the calling  
code makes promises about how much data it will provide at once, but  
here, that's not the case.  
  
Report by Justin Pryzby. Analysis by me. Patch by Dipesh Pandit.  
  
Discussion: http://postgr.es/m/20220330143536.GG28503@telsasoft.com  

M src/bin/pg_basebackup/bbstreamer_lz4.c

Use Generation memory contexts to store tuples in sorts

commit   : 40af10b571bdabbab06839d090083c9f9c2091d2    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 22:52:35 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 22:52:35 +1200    

Click here for diff

The general usage pattern when we store tuples in tuplesort.c is that  
we store a series of tuples one by one then either perform a sort or spill  
them to disk.  In the common case, there is no pfreeing of already stored  
tuples.  For the common case since we do not individually pfree tuples, we  
have very little need for aset.c memory allocation behavior which  
maintains freelists and always rounds allocation sizes up to the next  
power of 2 size.  
  
Here we conditionally use generation.c contexts for storing tuples in  
tuplesort.c when the sort will never be bounded.  Unfortunately, the  
memory context to store tuples is already created by the time any calls  
would be made to tuplesort_set_bound(), so here we add a new sort option  
that allows callers to specify if they're going to need a bounded sort or  
not.  We'll use a standard aset.c allocator when this sort option is not  
set.  
  
Extension authors must ensure that the TUPLESORT_ALLOWBOUNDED flag is  
used when calling tuplesort_begin_* for any sorts that make a call to  
tuplesort_set_bound().  
  
Author: David Rowley  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf++8JJ0paw+03dk+W25tQEcNQ@mail.gmail.com  

M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeSort.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Adjust tuplesort API to have bitwise option flags

commit   : 77bae396df3f6f883f58f1877b7c08eb3ebb6b63    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 22:24:59 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 22:24:59 +1200    

Click here for diff

This replaces the bool flag for randomAccess.  An upcoming patch requires  
adding another option, so instead of breaking the API for that, then  
breaking it again one day if we add more options, let's just break it  
once.  Any boolean options we add in the future will just make use of an  
unused bit in the flags.  
  
Any extensions making use of tuplesorts will need to update their code  
to pass TUPLESORT_RANDOMACCESS instead of true for randomAccess.  
TUPLESORT_NONE can be used for a set of empty options.  
  
Author: David Rowley  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvoH4ASzsAOyHcxkuY01Qf%2B%2B8JJ0paw%2B03dk%2BW25tQEcNQ%40mail.gmail.com  

M src/backend/access/gist/gistbuild.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/catalog/index.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeSort.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/tuplesort.h

Improve the generation memory allocator

commit   : 1b0d9aa4f728edfdff64c3a13fc52bb95f7fb860    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 20:53:13 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 4 Apr 2022 20:53:13 +1200    

Click here for diff

Here we make a series of improvements to the generation memory  
allocator, namely:  
  
1. Allow generation contexts to have a minimum, initial and maximum block  
sizes. The standard allocator allows this already but when the generation  
context was added, it only allowed fixed-sized blocks.  The problem with  
fixed-sized blocks is that it's difficult to choose how large to make the  
blocks.  If the chosen size is too small then we'd end up with a large  
number of blocks and a large number of malloc calls. If the block size is  
made too large, then memory is wasted.  
  
2. Add support for "keeper" blocks.  This is a special block that is  
allocated along with the context itself but is never freed.  Instead,  
when the last chunk in the keeper block is freed, we simply mark the block  
as empty to allow new allocations to make use of it.  
  
3. Add facility to "recycle" newly empty blocks instead of freeing them  
and having to later malloc an entire new block again.  We do this by  
recording a single GenerationBlock which has become empty of any chunks.  
When we run out of space in the current block, we check to see if there is  
a "freeblock" and use that if it contains enough space for the allocation.  
  
Author: David Rowley, Tomas Vondra  
Reviewed-by: Andy Fan  
Discussion: https://postgr.es/m/d987fd54-01f8-0f73-af6c-519f799a0ab8@enterprisedb.com  

M src/backend/access/gist/gistvacuum.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/mmgr/generation.c
M src/include/utils/memutils.h

Fix tuplesort optimization for CLUSTER-on-expression.

commit   : cc58eecc5d75a9329a6d49a25a6499aea7ee6fd6    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 4 Apr 2022 10:52:02 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 4 Apr 2022 10:52:02 +1200    

Click here for diff

When dispatching sort operations to specialized variants, commit  
69749243 failed to handle the case where CLUSTER-sort decides not to  
initialize datum1 and isnull1.  Fix by hoisting that decision up a level  
and advertising whether datum1 can be relied on, in the Tuplesortstate  
object.  
  
Per reports from UBsan and Valgrind build farm animals, while running  
the cluster.sql test.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CAFBsxsF1TeK5Fic0M%2BTSJXzbKsY6aBqJGNj6ptURuB09ZF6k_w%40mail.gmail.com  

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

Fix portability issues in datetime parsing.

commit   : 591e088dd5b357796e136c13dfcdb1f06fd7a3c2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Apr 2022 17:04:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 3 Apr 2022 17:04:21 -0400    

Click here for diff

datetime.c's parsing logic has assumed that strtod() will accept  
a string that looks like ".", which it does in glibc, but not on  
some less-common platforms such as AIX.  The result of this was  
that datetime fields like "123." would be accepted on some platforms  
but not others; which is a sufficiently odd case that it's not that  
surprising we've heard no field complaints.  But commit e39f99046  
extended that assumption to new places, and happened to add a test  
case that exposed the platform dependency.  Remove this dependency  
by special-casing situations without any digits after the decimal  
point.  
  
(Again, this is in part a pre-existing bug but I don't feel a  
compulsion to back-patch.)  
  
Also, rearrange e39f99046's changes in formatting.c to avoid a  
Coverity complaint that we were copying an uninitialized field.  
  
Discussion: https://postgr.es/m/1592893.1648969747@sss.pgh.pa.us  

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

Generalize how VACUUM skips all-frozen pages.

commit   : f3c15cbe5065f8c4fb902af8f810a8061a802417    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 3 Apr 2022 13:35:43 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 3 Apr 2022 13:35:43 -0700    

Click here for diff

Non-aggressive VACUUMs were at a gratuitous disadvantage (relative to  
aggressive VACUUMs) around advancing relfrozenxid and relminmxid before  
now.  The issue only came up when concurrent activity unset some heap  
page's visibility map bit right as VACUUM was considering if the page  
should get counted in frozenskipped_pages.  The non-aggressive case  
would recheck the all-frozen bit at this point.  The aggressive case  
reasoned that the page (a skippable page) must have at least been  
all-frozen in the recent past, so skipping it won't make relfrozenxid  
advancement unsafe (which is never okay for aggressive VACUUMs).  
  
The recheck created a window for some other backend to confuse matters  
for VACUUM.  If the page's VM bit turned out to be unset, VACUUM would  
conclude that the page was _never_ all-frozen.  frozenskipped_pages was  
not incremented, and yet VACUUM couldn't back out of skipping at this  
late stage (it couldn't choose to scan the page instead).  This made it  
unsafe to advance relfrozenxid later on.  
  
Consistently avoid the issue by generalizing how we skip frozen pages  
during aggressive VACUUMs: take the same approach when skipping any  
skippable page range during aggressive and non-aggressive VACUUMs alike.  
The new approach makes ranges (not individual pages) the fundamental  
unit of skipping using the visibility map.  frozenskipped_pages is  
replaced with a boolean flag that represents whether some skippable  
range with one or more all-visible pages was actually skipped.  
  
It is safe for VACUUM to treat a page as all-frozen provided it at least  
had its all-frozen bit set after the OldestXmin cutoff was established.  
VACUUM is only required to scan pages that might have XIDs < OldestXmin  
(unfrozen XIDs) to be able to safely advance relfrozenxid.  Tuples  
concurrently inserted on "skipped" pages can be thought of as equivalent  
to tuples concurrently inserted on a block >= rel_pages.  
  
It's possible that the issue this commit fixes hardly ever came up in  
practice.  But we only had to be unlucky once to lose out on advancing  
relfrozenxid -- a single affected heap page was enough to throw VACUUM  
off.  That seems like something to avoid on general principle.  This is  
similar to an issue fixed by commit 44fa8488, which taught vacuumlazy.c  
to not give up on non-aggressive relfrozenxid advancement just because a  
cleanup lock wasn't immediately available on some heap page.  
  
Skipping an all-visible range is now explicitly structured as a choice  
made by non-aggressive VACUUMs, by weighing known costs (scanning extra  
skippable pages to freeze their tuples early) against known benefits  
(advancing relfrozenxid early).  This works in essentially the same way  
as it always has (don't skip ranges < SKIP_PAGES_THRESHOLD).  We could  
do much better here in the future by considering other relevant factors.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/CAH2-Wzn6bGJGfOy3zSTJicKLw99PHJeSOQBOViKjSCinaxUKDQ@mail.gmail.com  
Discussion: https://postgr.es/m/CA%2BTgmoZiSOY6H7aadw5ZZGm7zYmfDzL6nwmL5V7GL4HgJgLF_w%40mail.gmail.com  

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

Set relfrozenxid to oldest extant XID seen by VACUUM.

commit   : 0b018fabaaba77e39539ce7eb71e34a90ceb0825    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 3 Apr 2022 09:57:21 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 3 Apr 2022 09:57:21 -0700    

Click here for diff

When VACUUM set relfrozenxid before now, it set it to whatever value was  
used to determine which tuples to freeze -- the FreezeLimit cutoff.  
This approach was very naive.  The relfrozenxid invariant only requires  
that new relfrozenxid values be <= the oldest extant XID remaining in  
the table (at the point that the VACUUM operation ends), which in  
general might be much more recent than FreezeLimit.  
  
VACUUM now carefully tracks the oldest remaining XID/MultiXactId as it  
goes (the oldest remaining values _after_ lazy_scan_prune processing).  
The final values are set as the table's new relfrozenxid and new  
relminmxid in pg_class at the end of each VACUUM.  The oldest XID might  
come from a tuple's xmin, xmax, or xvac fields.  It might even come from  
one of the table's remaining MultiXacts.  
  
Final relfrozenxid values must still be >= FreezeLimit in an aggressive  
VACUUM (FreezeLimit still acts as a lower bound on the final value that  
aggressive VACUUM can set relfrozenxid to).  Since standard VACUUMs  
still make no guarantees about advancing relfrozenxid, they might as  
well set relfrozenxid to a value from well before FreezeLimit when the  
opportunity presents itself.  In general standard VACUUMs may now set  
relfrozenxid to any value > the original relfrozenxid and <= OldestXmin.  
  
Credit for the general idea of using the oldest extant XID to set  
pg_class.relfrozenxid at the end of VACUUM goes to Andres Freund.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Andres Freund <andres@anarazel.de>  
Reviewed-By: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzkymFbz6D_vL+jmqSn_5q1wsFvFrE+37yLgL_Rkfd6Gzg@mail.gmail.com  

M doc/src/sgml/maintenance.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/commands/vacuum.h
A src/test/isolation/expected/vacuum-no-cleanup-lock.out
D src/test/isolation/expected/vacuum-reltuples.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/vacuum-no-cleanup-lock.spec
D src/test/isolation/specs/vacuum-reltuples.spec

Doc: Add relfrozenxid Tip to XID wraparound section.

commit   : 05023a237c059c840380817abf079a9282a227b7    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 13:34:57 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 13:34:57 -0700    

Click here for diff

VACUUM VERBOSE and autovacuum log reports were taught to report the  
details of how VACUUM advanced relfrozenxid (and relminmxid) by commit  
872770fd.  Highlight this by adding a "Tip" to the documentation, next  
to related discussion of age(relfrozenxid) monitoring.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-Wzk0C1O-MKkOrj4YAfsGRru2=cA2VQpqM-9R1HNuG3nFaQ@mail.gmail.com  

M doc/src/sgml/maintenance.sgml

Fix overflow hazards in interval input and output conversions.

commit   : e39f9904671082c5ad3a2c5acbdbd028fa93bf35    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Apr 2022 16:12:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Apr 2022 16:12:26 -0400    

Click here for diff

DecodeInterval (interval input) was careless about integer-overflow  
hazards, allowing bogus results to be obtained for sufficiently  
large input values.  Also, since it initially converted the input  
to a "struct tm", it was impossible to produce the full range of  
representable interval values.  
  
Meanwhile, EncodeInterval (interval output) and a few other  
functions could suffer failures if asked to process sufficiently  
large interval values, because they also relied on being able to  
represent an interval in "struct tm" which is not designed to  
handle that.  
  
Fix all this stuff by introducing new struct types that are more  
fit for purpose.  
  
While this is clearly a bug fix, it's also an API break for any  
code that's calling these functions directly.  So back-patching  
doesn't seem wise, especially in view of the lack of field  
complaints.  
  
Joe Koshakow, editorialized a bit by me  
  
Discussion: https://postgr.es/m/CAAvxfHff0JLYHwyBrtMx_=6wr=k2Xp+D+-X3vEhHjJYMj+mQcg@mail.gmail.com  

M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/timestamp.c
M src/include/datatype/timestamp.h
M src/include/pgtime.h
M src/include/utils/datetime.h
M src/include/utils/timestamp.h
M src/test/regress/expected/interval.out
M src/test/regress/sql/interval.sql

Doc: Clarify the role of aggressive VACUUMs.

commit   : f7e4d5c64fb3977e3a773e7213472be1b59dab2f    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 12:29:35 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 12:29:35 -0700    

Click here for diff

Adjust the documentation's coverage of aggressive VACUUMs to make it  
clearer that aggressive vacuuming isn't always strictly necessary.  It's  
possible for non-aggressive VACUUMs to advance relfrozenxid/relminmxid  
without fail, given the right workload conditions.  
  
While this has always been true, it matters more with recent and pending  
improvements to VACUUM.  These improvements make non-aggressive  
vacuuming more likely to advance relfrozenxid/relminmxid in practice.  
While this is an unrelated improvement to the docs, formally speaking,  
it still doesn't seem worth backpatching.  So don't backpatch.  

M doc/src/sgml/maintenance.sgml

Add a couple more tests for interval input decoding.

commit   : 1b208ebaf14e668a24c78ee42cf805431cd0f591    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Apr 2022 13:49:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 2 Apr 2022 13:49:39 -0400    

Click here for diff

Cover some cases that would have been broken by a proposed patch,  
but we failed to notice for lack of test coverage.  I'm pushing  
this separately mainly to memorialize that it *is* our historical  
behavior.  
  
Discussion: https://postgr.es/m/1344498.1648920056@sss.pgh.pa.us  

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

vacuumlazy.c: Clean up variable declarations.

commit   : 14bf1e831356770cc61a5f43b9b816f0c0583f2b    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 10:33:21 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 10:33:21 -0700    

Click here for diff

Move some of the heap_vacuum_rel() instrumentation related variables to  
the scope where they're actually needed.  Also reorder some of the  
variable declarations at the start of heap_vacuum_rel() so that related  
variables appear together.  

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

Use has_privs_for_roles for predefined role checks: round 2

commit   : 9752436f049430428464e22dcf837e9c6fa4e513    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Sat, 2 Apr 2022 13:24:38 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Sat, 2 Apr 2022 13:24:38 -0400    

Click here for diff

Similar to commit 6198420ad, replace is_member_of_role with  
has_privs_for_role for predefined role access checks in recently  
committed basebackup code. In passing fix a double-word error  
in a nearby comment.  
  
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com  

M contrib/basebackup_to_shell/basebackup_to_shell.c
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/basebackup_server.c

Allow CLUSTER on partitioned tables

commit   : cfdd03f45e6afc632fbe70519250ec19167d6765    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 2 Apr 2022 19:08:34 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 2 Apr 2022 19:08:34 +0200    

Click here for diff

This is essentially the same as applying VACUUM FULL to a partitioned  
table, which has been supported since commit 3c3bb99330aa (March 2017).  
While there's no great use case in applying CLUSTER to partitioned  
tables, we don't have any strong reason not to allow it either.  
  
For now, partitioned indexes cannot be marked clustered, so an index  
must always be specified.  
  
While at it, rename some variables that were RangeVars during the  
development that led to 8bc717cb8878 but never made it that way to the  
source tree; there's no need to perpetuate names that have always been  
more confusing than helpful.  
  
Author: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/20201028003312.GU9241@telsasoft.com  
Discussion: https://postgr.es/m/20200611153502.GT14879@telsasoft.com  

M doc/src/sgml/ref/cluster.sgml
M src/backend/commands/cluster.c
M src/backend/commands/tablecmds.c
M src/bin/psql/tab-complete.c
M src/include/commands/cluster.h
M src/test/regress/expected/cluster.out
M src/test/regress/sql/cluster.sql

Doc: Remove MultiXact wraparound section link.

commit   : b7c485fb93726cb04b858442d73043b56e603711    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 09:49:08 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 2 Apr 2022 09:49:08 -0700    

Click here for diff

Remove circular "25.1.5.1. Multixacts And Wraparound" link that  
references the section that the link itself appears in.  An explanation  
of MultiXactId age appears only a few sentences before the link, so  
there's no question that the link is superfluous at best.  
  
Oversight in commit d5409295.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Backpatch: 14-  

M doc/src/sgml/maintenance.sgml

Remove excess semicolon in MERGE docs

commit   : 0af504733c6e9198067705822e7527dc4e60b4f6    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 2 Apr 2022 17:16:32 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sat, 2 Apr 2022 17:16:32 +0200    

Click here for diff

Author: Euler Taveira <euler@eulerto.com>  
Discussion: https://postgr.es/m/01dea9ef-85ad-4e09-a783-a1eadeae7bbe@www.fastmail.com  

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

Use ORDER BY in catalog results in SQL/JSON tests

commit   : c6dc6a0124fa130e1c083a870156c32ab4cf0ae2    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 2 Apr 2022 10:00:10 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 2 Apr 2022 10:00:10 -0400    

Click here for diff

The buildfarm has revealed some instability in results from catalog  
queries in tests from commit 1a36bc9dba8. Cure this by adding ORDER BY  
to such queries.  

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

Specialize tuplesort routines for different kinds of abbreviated keys

commit   : 6974924347c908335607a4a2f252213d58e21b7c    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 2 Apr 2022 15:22:25 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 2 Apr 2022 15:22:25 +0700    

Click here for diff

Previously, the specialized tuplesort routine inlined handling for  
reverse-sort and NULLs-ordering but called the datum comparator via a  
pointer in the SortSupport struct parameter. Testing has showed that we  
can get a useful performance gain by specializing datum comparison for  
the different representations of abbreviated keys -- signed and unsigned  
64-bit integers and signed 32-bit integers. Almost all abbreviatable data  
types will benefit -- the only exception for now is numeric, since the  
datum comparison is more complex. The performance gain depends on data  
type and input distribution, but often falls in the range of 10-20% faster.  
  
Thomas Munro  
  
Reviewed by Peter Geoghegan, review and performance testing by me  
  
Discussion:  
https://www.postgresql.org/message-id/CA%2BhUKGKKYttZZk-JMRQSVak%3DCXSJ5fiwtirFf%3Dn%3DPAbumvn1Ww%40mail.gmail.com  

M src/backend/access/gist/gistproc.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h

Remove obsolete comment

commit   : db086de5abe5d87b07cddd030092b1f81f99c5ea    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 2 Apr 2022 07:27:26 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 2 Apr 2022 07:27:26 +0200    

Click here for diff

accidentally left behind by 4cb658af70027c3544fb843d77b2e84028762747  

M src/include/utils/rel.h

Make upgradecheck a no-op in MSVC's vcregress.pl

commit   : d2a2ce4184b0038adb1d6d292f12685056e2ab7a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Apr 2022 12:06:11 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Apr 2022 12:06:11 +0900    

Click here for diff

322becb has changed upgradecheck to use the TAP tests, discarding  
pg_upgrade's tests in bincheck.  However, this is proving to be a bad  
idea for the Windows buildfarm clients that use MSVC when TAP tests are  
disabled as this causes a hard failure at the pg_upgrade step.  
  
This commit disables upgradecheck, moving the execution of the tests of  
pg_upgrade to bincheck, as per an initial suggestion from Andres  
Freund, so as the buildfarm is able to live happily with those changes.  
  
While on it, remove the routine that was used by upgradecheck to  
create databases whose names are generated with a range of ASCII  
characters as it is not used since 322becb.  upgradecheck is removed  
from the CI script for Windows, as bincheck takes care of that now.  
  
Per report from buildfarm member hamerkop (MSVC 2017 without a TAP  
setup).  
  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/YkbnpriYEAagZ2wH@paquier.xyz  

M .cirrus.yml
M doc/src/sgml/install-windows.sgml
M src/tools/msvc/vcregress.pl

pageinspect: Use better macros to get special page area for GIN and GiST

commit   : d43085d12e825ede628bafee1e5e6e0e3a3d5e67    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Apr 2022 11:27:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 2 Apr 2022 11:27:20 +0900    

Click here for diff

These five code paths are the last ones that made use of  
PageGetSpecialPointer() to get the special area of such pages, while  
those index AMs have already macros to do this job.  
  
Noticed while reviewing the use PageGetSpecialPointer() in the whole  
tree, in relation to the recent commit d16773c.  

M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c

libpq: Fix pkg-config without OpenSSL

commit   : 465ab24296c27502c81c8c197725cba728b9b057    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 17:12:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 17:12:56 +0200    

Click here for diff

Do not add OpenSSL dependencies to libpq pkg-config file if OpenSSL is  
not enabled.  Oversight in beff361bc1edc24ee5f8b2073a1e5e4c92ea66eb.  
  
Author: Fabrice Fontaine <fontaine.fabrice@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/20220331163759.32665-1-fontaine.fabrice%40gmail.com  

M src/interfaces/libpq/Makefile

Set minimum required version of zstd as 1.4.0.

commit   : 479b69a4a551465614042bba00694001273d702f    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 1 Apr 2022 11:05:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 1 Apr 2022 11:05:52 -0400    

Click here for diff

It emerges that our new zstd code depends on features that were not  
present (or at least not enabled by default) in zstd before 1.4.0.  
That's already four years old, so there's little reason to try to  
make our code work with something older.  Instead make configure  
check that zstd is at least 1.4.0, and document this requirement.  
  
Justin Pryzby (doc changes by me)  
  
Discussion: https://postgr.es/m/efbd94cd1102f99fd1300e44905ee4a994ee2ef6.camel@gunduz.org  

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

libpq: Allow IP address SANs in server certificates

commit   : c1932e542863f0f646f005b3492452acc57c7e66    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 15:41:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 15:41:44 +0200    

Click here for diff

The current implementation supports exactly one IP address in a server  
certificate's Common Name, which is brittle (the strings must match  
exactly).  This patch adds support for IPv4 and IPv6 addresses in a  
server's Subject Alternative Names.  
  
Per discussion on-list:  
  
- If the client's expected host is an IP address, we allow fallback to  
  the Subject Common Name if an iPAddress SAN is not present, even if  
  a dNSName is present.  This matches the behavior of NSS, in  
  violation of the relevant RFCs.  
  
- We also, counter-intuitively, match IP addresses embedded in dNSName  
  SANs.  From inspection this appears to have been the behavior since  
  the SAN matching feature was introduced in acd08d76.  
  
- Unlike NSS, we don't map IPv4 to IPv6 addresses, or vice-versa.  
  
Author: Jacob Champion <pchampion@vmware.com>  
Co-authored-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/flat/9f5f20974cd3a4091a788cf7f00ab663d5fcdffe.camel@vmware.com  

M configure
M configure.ac
M doc/src/sgml/libpq.sgml
M src/include/pg_config.h.in
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
A src/test/ssl/conf/server-cn-and-ip-alt-names.config
A src/test/ssl/conf/server-ip-alt-names.config
A src/test/ssl/conf/server-ip-cn-and-alt-names.config
A src/test/ssl/conf/server-ip-cn-and-dns-alt-names.config
A src/test/ssl/ssl/server-cn-and-ip-alt-names.crt
A src/test/ssl/ssl/server-cn-and-ip-alt-names.key
A src/test/ssl/ssl/server-ip-alt-names.crt
A src/test/ssl/ssl/server-ip-alt-names.key
A src/test/ssl/ssl/server-ip-cn-and-alt-names.crt
A src/test/ssl/ssl/server-ip-cn-and-alt-names.key
A src/test/ssl/ssl/server-ip-cn-and-dns-alt-names.crt
A src/test/ssl/ssl/server-ip-cn-and-dns-alt-names.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/tools/msvc/Solution.pm

docs: Changing column type doesn't always require an index rebuild.

commit   : fa25bebb827a8cc4d62f15d564b0093f40b9d44d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Fri, 1 Apr 2022 08:48:44 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Fri, 1 Apr 2022 08:48:44 -0400    

Click here for diff

James Coleman and Robert Haas, reviewed by Matthias van de Meent.  
  
Discussion: https://postgr.es/m/CAAaqYe90Ea3RG=A7H-ONvTcx549-oQhp07BrHErwM=AyH2ximg@mail.gmail.com  

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

Add SSL tests for IP addresses in certificates

commit   : af9e180495507a2b01f1bc31b7ea5125b8385903    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 14:06:23 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 14:06:23 +0200    

Click here for diff

This tests some scenarios that already work.  A subsequent patch will  
introduce more functionality.  
  
Author: Jacob Champion <pchampion@vmware.com>  
Co-authored-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/flat/9f5f20974cd3a4091a788cf7f00ab663d5fcdffe.camel@vmware.com  

A src/test/ssl/conf/server-ip-cn-only.config
A src/test/ssl/conf/server-ip-in-dnsname.config
A src/test/ssl/ssl/server-ip-cn-only.crt
A src/test/ssl/ssl/server-ip-cn-only.key
A src/test/ssl/ssl/server-ip-in-dnsname.crt
A src/test/ssl/ssl/server-ip-in-dnsname.key
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl

psql: Refactor ProcessResult()

commit   : 5519d5affdfae4f5ea4b5faca65348cc14c5d279    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 13:00:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 1 Apr 2022 13:00:43 +0200    

Click here for diff

Separate HandleCopyResult() from ProcessResult() in preparation for a  
subsequent patch.  
  
Author: Fabien COELHO <coelho@cri.ensmp.fr>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M src/bin/psql/common.c

Add macros in hash and btree AMs to get the special area of their pages

commit   : d16773cdc86210493a2874cb0cf93f3883fcda73    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 13:24:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 13:24:50 +0900    

Click here for diff

This makes the code more consistent with SpGiST, GiST and GIN, that  
already use this style, and the idea is to make easier the introduction  
of more sanity checks for each of these AM-specific macros.  BRIN uses a  
different set of macros to get a page's type and flags, so it has no  
need for something similar.  
  
Author: Matthias van de Meent  
Discussion: https://postgr.es/m/CAEze2WjE3+tGO9Fs9+iZMU+z6mMZKo54W1Zt98WKqbEUHbHOBg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashutil.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtxlog.c
M src/include/access/hash.h
M src/include/access/nbtree.h

Improve handling and logging of TAP tests for pg_upgrade

commit   : 73db8f4d17ed4efb7709f1cafd5b1dd0285b0842    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 12:45:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 12:45:40 +0900    

Click here for diff

This commit includes a set of improvements to help with the debugging of  
failures in these new TAP tests:  
- Instead of a plain diff command to compare the dumps generated, use  
File::Compare::compare for the same effect.  diff is still used to  
provide more context in the event of an error.  
- Log the contents of regression.diffs if the pg_regress command fails.  
- Unify the format of the logs generated, getting inspiration from the  
style used in 027_stream_regress.pl.  
  
wrasse is the only buildfarm member that has reported a failure until  
now after the introduction of 322becb, complaining that the dumps  
generated do not match, and I am lacking information to understand what  
is going in this environment.  

M src/bin/pg_upgrade/t/002_pg_upgrade.pl

Switch the regression tests of pg_upgrade to use TAP tests

commit   : 322becb6085cb92d3708635eea61b45776bf27b6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 10:13:50 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 1 Apr 2022 10:13:50 +0900    

Click here for diff

This simplifies a lot of code in the tests of pg_upgrade without  
sacrificing its coverage:  
- Removal of test.sh used for builds with make, that has accumulated  
over the years tweaks for problems that are solved in a duplicated way  
by the centralized TAP framework (initialization of the various  
environment variables PG*, port selection).  
- Removal of the code in MSVC to test pg_upgrade.  This was roughly a  
duplicate of test.sh adapted for Windows, with an extra footprint of  
a pg_regress command and all the assumptions behind it.  
  
Support for upgrades with older versions is changed, not removed.  
test.sh was able to set up the regression database on the old instance  
by launching itself the pg_regress command and a dependency to the  
source tree of thd old cluster, with tweaks on the command arguments to  
adapt across the versions used.  This created a backward-compatibility  
dependency with older pg_regress commands, and recent changes like  
d1029bb have made that much more complicated.  
  
Instead, this commit allows tests with older major versions by  
specifying a path to a SQL dump (taken with pg_dumpall from the old  
cluster's installation) that will be loaded into the old instance to  
upgrade instead of running pg_regress, through an optional environment  
variable called $olddump.  This requires a second variable called  
$oldinstall to point to the base path of the installation of the old  
cluster.  This method is more in line with the buildfarm client that  
uses a set of static dumps to set up an old instance, so hopefully we  
will be able to reuse what is introduced in this commit there.  The last  
step of the tests that checks for differences between the two dumps  
taken still needs to be improved as it can fail, requiring a manual  
lookup at the dumps.  This is not different from the old way of testing  
where things could fail at the last step.  
  
Support for EXTRA_REGRESS_OPTS is kept.  vcregress.pl in the MSVC  
scripts still handles the test of pg_upgrade with its upgradecheck, and  
bincheck is changed to skip pg_upgrade.  
  
Author: Michael Paquier  
Reviewed-by: Andrew Dunstan, Andres Freund, Rachel Heaton, Tom Lane,  
Discussion: https://postgr.es/m/YJ8xTmLQkotVLpN5@paquier.xyz  

M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/TESTING
A src/bin/pg_upgrade/t/001_basic.pl
A src/bin/pg_upgrade/t/002_pg_upgrade.pl
D src/bin/pg_upgrade/test.sh
M src/tools/msvc/vcregress.pl

Keep plpgsql.h C++-clean.

commit   : fb691bbb4c8d729e6701f708edbb003b73efb16b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 18:29:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 18:29:10 -0400    

Click here for diff

I forgot that "typeid" is a C++ keyword.  Per buildfarm.  

M src/pl/plpgsql/src/plpgsql.h

Expose a few more PL/pgSQL functions to debugger plugins.

commit   : 53ef6c40f1e7ff6c9ad9a221cd9999dd147ec3a2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 17:05:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 17:05:47 -0400    

Click here for diff

Add exec_assign_value, exec_eval_datum, and exec_cast_value  
to the set of functions a PL/pgSQL debugger plugin can  
conveniently call.  This allows more convenient manipulation  
of the values of PL/pgSQL function variables.  
  
Pavel Stehule, reviewed by Aleksander Alekseev and myself  
  
Discussion: https://postgr.es/m/CAFj8pRD+dBPU0T-KrkP7ef6QNPDEsjYCejEsBe07NDq8TybOkA@mail.gmail.com  

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

Fix comments with "a expression"

commit   : 9f91344223aad903ff70301f40183691a89f6cd4    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 15:27:09 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 15:27:09 -0400    

Click here for diff

M src/backend/optimizer/path/equivclass.c
M src/backend/parser/parse_expr.c

RETURNING clause for JSON() and JSON_SCALAR()

commit   : 49082c2cc3d8167cca70cfe697afb064710828ca    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 5 Mar 2022 08:07:15 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Sat, 5 Mar 2022 08:07:15 -0500    

Click here for diff

This patch is extracted from a larger patch that allowed setting the  
default returned value from these functions to json or jsonb. That had  
problems, but this piece of it is fine. For these functions only json or  
jsonb can be specified in the RETURNING clause.  
  
Extracted from an original patch from Nikita Glukhov  
  
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/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  

M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.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/ruleutils.c
M src/include/nodes/parsenodes.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

initdb: When running CREATE DATABASE, use STRATEGY = WAL_COPY.

commit   : ad43a413c4f7f5d024a5b2f51e00d280a22f1874    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 31 Mar 2022 15:15:11 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 31 Mar 2022 15:15:11 -0400    

Click here for diff

Dilip Kumar, reviewed by Andres Freund and by me.  
  
Discussion: http://postgr.es/m/20220330011757.wr544o5y5my7ssoa@alap3.anarazel.de  

M src/bin/initdb/initdb.c

Fix postgres_fdw to check shippability of sort clauses properly.

commit   : f3dd9fe1dd9254680591aa8d9891b90b8d735b2a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 14:29:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 14:29:24 -0400    

Click here for diff

postgres_fdw would push ORDER BY clauses to the remote side without  
verifying that the sort operator is safe to ship.  Moreover, it failed  
to print a suitable USING clause if the sort operator isn't default  
for the sort expression's type.  The net result of this is that the  
remote sort might not have anywhere near the semantics we expect,  
which'd be disastrous for locally-performed merge joins in particular.  
  
We addressed similar issues in the context of ORDER BY within an  
aggregate function call in commit 7012b132d, but failed to notice  
that query-level ORDER BY was broken.  Thus, much of the necessary  
logic already existed, but it requires refactoring to be usable  
in both cases.  
  
Back-patch to all supported branches.  In HEAD only, remove the  
core code's copy of find_em_expr_for_rel, which is no longer used  
and really should never have been pushed into equivclass.c in the  
first place.  
  
Ronan Dunklau, per report from David Rowley;  
reviews by David Rowley, Ranier Vilela, and myself  
  
Discussion: https://postgr.es/m/CAApHDvr4OeC2DBVY--zVP83-K=bYrTD7F8SZDhN4g+pj2f2S-A@mail.gmail.com  

M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/path/equivclass.c
M src/include/optimizer/paths.h

Print information about type of test and subdirectory before running tests.

commit   : 28bdfa2adfc6afe4121614b500bfcb27b7c6b94c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 31 Mar 2022 11:18:25 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 31 Mar 2022 11:18:25 -0700    

Click here for diff

When testing check-world it's hard to know what the test the test failure  
output belongs to. The tap test output is especially problematic, partially  
due to our practice of reusing test names like 001_basic.pl.  
  
This isn't a real issue on the buildfarm, which invokes tests separately, but  
locally and for CI it's quite annoying.  
  
To fix, the test target provisos in Makefile.global.in now output  
  echo "+++ (regress|isolation|tap) [install-]check in $(subdir) +++"  
before running the tests.  
  
Discussion: https://postgr.es/m/20220330165039.3zseuiraxfjkksf5@alap3.anarazel.de  

M src/Makefile.global.in

Remove use of perl parent module in Cluster.pm

commit   : d5f43a1a10f688e2437ffb7d454d0a2d57308bff    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 14:10:47 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 14:10:47 -0400    

Click here for diff

Commit fb16d2c658 used the old but not quite old enough parent module,  
which dates to perl version 5.10.1 as a core module. We still have a  
dinosaur or two running older versions of perl, so rather than require  
an upgrade in those we simply do in place what parent.pm's import()  
would have done for us.  
  
Reviewed by Tom Lane  
  
Discussion: https://postgr.es/m/474104.1648685981@sss.pgh.pa.us  

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

In basebackup_to_shell tests, properly set up pg_hba.conf.

commit   : fea1cc49e4abca7eeb9bb9dd02d7d78abbd8d045    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 31 Mar 2022 14:06:17 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 31 Mar 2022 14:06:17 -0400    

Click here for diff

Discussion: http://postgr.es/m/485495.1648692468@sss.pgh.pa.us  

M contrib/basebackup_to_shell/t/001_basic.pl

psql: Refactor SendQuery()

commit   : 8910a25fef3dc4aa7e10cfcebdc784650a4d256b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Mar 2022 19:57:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Mar 2022 19:57:21 +0200    

Click here for diff

This breaks out the fetch-it-all-and-print case in SendQuery() into a  
separate function.  This makes the code more similar to the other  
cases \gdesc and run query with FETCH_COUNT, and makes SendQuery()  
itself a bit smaller.  
  
Extracted from a larger patch with more changes in this area to  
follow.  
  
Author: Fabien COELHO <coelho@cri.ensmp.fr>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

M src/bin/psql/common.c

Add missing newline in one libpq error message.

commit   : 878e64d0f8f6865943046ce88e597a5657e304c2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 11:24:26 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 31 Mar 2022 11:24:26 -0400    

Click here for diff

Oversight in commit a59c79564.  Back-patch, as that was.  
Noted by Peter Eisentraut.  
  
Discussion: https://postgr.es/m/7f85ef6d-250b-f5ec-9867-89f0b16d019f@enterprisedb.com  

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

psql: Add tests for \errverbose

commit   : d3ab618290543017402b3bec9d36dde881becb18    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Mar 2022 16:09:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 31 Mar 2022 16:09:44 +0200    

Click here for diff

This is another piece of functionality that happens while a user query  
is being sent and which did not have any test coverage.  

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

Fix comment typo in PotsgreSQL::Test::Cluster module

commit   : ddee016b342cddcfb97325afac0a65c502932e5f    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 08:34:39 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 31 Mar 2022 08:34:39 -0400    

Click here for diff

Per Dagfinn Ilmari Mannsåker  

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

doc: Fix typo in ANALYZE documentation

commit   : 4e31c46e1e7b7d3a34909ec872c4446711e86e7d    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 31 Mar 2022 12:03:33 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 31 Mar 2022 12:03:33 +0200    

Click here for diff

Commit 61fa6ca79b3 accidentally wrote constrast instead of contrast.  
  
Backpatch-through: 10  
Discussion: https://postgr.es/m/88903179-5ce2-3d4d-af43-7830372bdcb6@enterprisedb.com  

M doc/src/sgml/ref/analyze.sgml

Add diagnostic output on error in pump_until

commit   : 2beb4acff1e83fef6766a5a7d5bbd952444a0b36    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 31 Mar 2022 11:16:16 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 31 Mar 2022 11:16:16 +0200    

Click here for diff

When pump_until was moved to Utils.pm in commit 6da65a3f9 the diag  
calls were removed, this puts them back.  
  
Per request from Andres Freund.  
  
Discussion: https://postgr.es/m/20220329225819.ahk5u2tax3ez6d2t@alap3.anarazel.de  

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

Raise a WARNING for missing publications.

commit   : 8f2e2bbf145384784bad07a96d461c6bbd91f597    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 31 Mar 2022 08:24:19 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 31 Mar 2022 08:24:19 +0530    

Click here for diff

When we create or alter a subscription to add publications raise a warning  
for non-existent publications. We don't want to give an error here because  
it is possible that users can later create the missing publications.  
  
Author: Vignesh C  
Reviewed-by: Bharath Rupireddy, Japin Li, Dilip Kumar, Euler Taveira, Ashutosh Sharma, Amit Kapila  
Discussion: https://postgr.es/m/CALDaNm0f4YujGW+q-Di0CbZpnQKFFrXntikaQQKuEmGG0=Zw=Q@mail.gmail.com  

M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/007_ddl.pl

Clean up some dead code in pg_dump with tar format and gzip compression

commit   : 8ac4c25a05d1e491a51d5390aaae405600e8e466    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 31 Mar 2022 10:34:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 31 Mar 2022 10:34:10 +0900    

Click here for diff

Compression with gzip has never been supported in the tar format of  
pg_dump since this code has been introduced in c3e18804, as the use of  
buffered I/O in gzdopen() changes the file positioning that tar  
requires.  The original idea behind the use of compression with the tar  
mode is to be able to include compressed data files (named %u.dat.gz)  
and blob files (blob_%u.dat.gz) in the tarball generated by the dump,  
with toc.dat, that tracks down if compression is used in the dump,  
always uncompressed.  
  
Note that this commit removes the dump part of the code as well as the  
restore part, removing any dependency to zlib in pg_backup_tar.c.  There  
could be an argument behind keeping around the restore part, but this  
would require one to change the internals of a tarball previously dumped  
so as data and blob files are compressed with toc.dat itself changed to  
track down if compression is enabled.  However, the argument about  
gzdopen() still holds in the read case with pg_restore.  
  
Removing this code simplifies future additions related to compression in  
pg_dump.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

M src/bin/pg_dump/pg_backup_tar.c

Add .gitignore for basebackup_to_shell.

commit   : f8e0d900afed933d8f5d3f189fdb141924a8e518    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 30 Mar 2022 19:59:33 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 30 Mar 2022 19:59:33 -0400    

Click here for diff

Nathan Bossart  
  
Discussion: https://postgr.es/m/20220330223531.GA134543@nathanxps13  

A contrib/basebackup_to_shell/.gitignore

Optimize order of GROUP BY keys

commit   : db0d67db2401eb6238ccc04c6407a4fd4f985832    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 31 Mar 2022 00:09:11 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Thu, 31 Mar 2022 00:09:11 +0200    

Click here for diff

When evaluating a query with a multi-column GROUP BY clause using sort,  
the cost may be heavily dependent on the order in which the keys are  
compared when building the groups. Grouping does not imply any ordering,  
so we're allowed to compare the keys in arbitrary order, and a Hash Agg  
leverages this. But for Group Agg, we simply compared keys in the order  
as specified in the query. This commit explores alternative ordering of  
the keys, trying to find a cheaper one.  
  
In principle, we might generate grouping paths for all permutations of  
the keys, and leave the rest to the optimizer. But that might get very  
expensive, so we try to pick only a couple interesting orderings based  
on both local and global information.  
  
When planning the grouping path, we explore statistics (number of  
distinct values, cost of the comparison function) for the keys and  
reorder them to minimize comparison costs. Intuitively, it may be better  
to perform more expensive comparisons (for complex data types etc.)  
last, because maybe the cheaper comparisons will be enough. Similarly,  
the higher the cardinality of a key, the lower the probability we’ll  
need to compare more keys. The patch generates and costs various  
orderings, picking the cheapest ones.  
  
The ordering of group keys may interact with other parts of the query,  
some of which may not be known while planning the grouping. E.g. there  
may be an explicit ORDER BY clause, or some other ordering-dependent  
operation, higher up in the query, and using the same ordering may allow  
using either incremental sort or even eliminate the sort entirely.  
  
The patch generates orderings and picks those minimizing the comparison  
cost (for various pathkeys), and then adds orderings that might be  
useful for operations higher up in the plan (ORDER BY, etc.). Finally,  
it always keeps the ordering specified in the query, on the assumption  
the user might have additional insights.  
  
This introduces a new GUC enable_group_by_reordering, so that the  
optimization may be disabled if needed.  
  
The original patch was proposed by Teodor Sigaev, and later improved and  
reworked by Dmitry Dolgov. Reviews by a number of people, including me,  
Andrey Lepikhov, Claudio Freire, Ibrar Ahmed and Zhihong Yu.  
  
Author: Dmitry Dolgov, Teodor Sigaev, Tomas Vondra  
Reviewed-by: Tomas Vondra, Andrey Lepikhov, Claudio Freire, Ibrar Ahmed, Zhihong Yu  
Discussion: https://postgr.es/m/7c79e6a5-8597-74e8-0671-1c39d124c9d6%40sigaev.ru  
Discussion: https://postgr.es/m/CA%2Bq6zcW_4o2NC0zutLkOJPsFt80megSpX_dVRo6GK9PC-Jx_Ag%40mail.gmail.com  

M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/config.sgml
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/sysviews.out
M src/test/regress/expected/union.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/incremental_sort.sql

SQL JSON functions

commit   : 606948b058dc16bce494270eea577011a602810e    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:15:13 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:15:13 -0500    

Click here for diff

This Patch introduces three SQL standard JSON functions:  
  
JSON() (incorrectly mentioned in my commit message for f4fb45d15c)  
JSON_SCALAR()  
JSON_SERIALIZE()  
  
JSON() produces json values from text, bytea, json or jsonb values, and  
has facilitites for handling duplicate keys.  
JSON_SCALAR() produces a json value from any scalar sql value, including  
json and jsonb.  
JSON_SERIALIZE() produces text or bytea from input which containis or  
represents json or jsonb;  
  
For the most part these functions don't add any significant new  
capabilities, but they will be of use to users wanting standard  
compliant JSON handling.  
  
Nikita Glukhov  
  
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/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  

M doc/src/sgml/keywords/sql2016-02-reserved.txt
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.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/format_type.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/ruleutils.c
M src/include/executor/execExpr.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Fix possible NULL-pointer-deference in backup_compression.c.

commit   : 8e053dc6dfbee4ae412e98ad73cfd4662d7453ac    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 15:53:08 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 15:53:08 -0400    

Click here for diff

Per Coverity and Tom Lane. Reviewed by Tom Lane and Justin Pryzby.  
  
Discussion: http://postgr.es/m/384291.1648403267@sss.pgh.pa.us  

M src/common/backup_compression.c

basebackup_to_shell: Add TAP test.

commit   : 027fa0fd72619a56d9d8877eedcb514331b63fa4    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 15:47:02 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 15:47:02 -0400    

Click here for diff

Per gripe from Andres Freund. Thanks to Andres Freund, Thomas  
Munro, and Andrew Dunstan for advice on how to make this test  
work even on Windows.  
  
Discussion: https://postgr.es/m/CA+Tgmoat+zbzzZQJ7poXyUwiqxQxTaUid=auB4FejZ15VvDh4Q@mail.gmail.com  

M contrib/basebackup_to_shell/Makefile
A contrib/basebackup_to_shell/t/001_basic.pl

Document basebackup_to_shell.required_role.

commit   : 26a0c025e233c3d4333f071bde4ac970ba1ec643    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 10:06:07 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 10:06:07 -0400    

Click here for diff

Omission noted by Joe Conway.  
  
Discussion: https://postgr.es/m/CA+Tgmoat+zbzzZQJ7poXyUwiqxQxTaUid=auB4FejZ15VvDh4Q@mail.gmail.com  
Discussion: https://postgr.es/m/744cf762-47d3-050f-5fa1-d4f9e8dbae2e@joeconway.com  

M doc/src/sgml/basebackup-to-shell.sgml

Add range_agg with multirange inputs

commit   : 7ae1619bc5b1794938c7387a766b8cae34e38d8a    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 20:12:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 20:12:53 +0200    

Click here for diff

range_agg for normal ranges already existed.  A lot of code can be  
shared.  
  
Author: Paul Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Chapman Flack <chap@anastigmatix.net>  
Discussion: https://www.postgresql.org/message-id/flat/007ef255-35ef-fd26-679c-f97e7a7f30c2@illuminatedcomputing.com  

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

ci: enable zstd where available.

commit   : ff50baec65bba1a839322ba8bcb3efcd08f40621    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 30 Mar 2022 09:33:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 30 Mar 2022 09:33:28 -0700    

Click here for diff

Since zstd is now used in a bunch of places, enable it in CI. The windows  
image unfortunately doesn't yet contain zstd, so it's not enabled there.  
  
Discussion: https://postgr.es/m/20220330155017.lfnlzt3m42nk7kff@alap3.anarazel.de  

M .cirrus.yml

Change some internal error messages to elogs

commit   : f453d684ecf9f6cd872d4bb43fe385c2c56126bd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:48:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:48:56 +0200    

Click here for diff

Author: Paul Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Chapman Flack <chap@anastigmatix.net>  
Discussion: https://www.postgresql.org/message-id/flat/007ef255-35ef-fd26-679c-f97e7a7f30c2@illuminatedcomputing.com  

M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c

Make PostgreSQL::Test::Cluster compatible with all live branches

commit   : fb16d2c6588446b00534d90958e6dc312ae52a2f    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 30 Mar 2022 11:07:05 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Wed, 30 Mar 2022 11:07:05 -0400    

Click here for diff

We do this via a subclass for any branch older than the minimum known  
to be compatible with the main package (currently release 12).  
  
This should be useful for constructing cross-version tests.  
  
In theory this could be extended back any number of versions, with  
varying degrees of compatibility.  
  
Reviewed by Michael Paquier and Dagfinn Ilmari Mannsåker  
  
Discussion: https://postgr.es/m/a3efd19a-d5c9-fdf2-6094-4cde056a2708@dunslane.net  

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

Additional tests for range_intersect_agg(anymultirange)

commit   : cd7ea75e4b1b0c44476bef4f00075b9a4b07733e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:23:13 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:23:13 +0200    

Click here for diff

Author: Paul Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Chapman Flack <chap@anastigmatix.net>  
Discussion: https://www.postgresql.org/message-id/flat/007ef255-35ef-fd26-679c-f97e7a7f30c2@illuminatedcomputing.com  

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

doc: Document range_intersect_agg(anymultirange)

commit   : b21c4cf95103fae63aeb534f8ee37fbf90a1f907    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:08:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 17:08:24 +0200    

Click here for diff

It already existed but was not mentioned in the documentation.  (Only  
the anyrange variant was listed.)  
  
Author: Paul Jungwirth <pj@illuminatedcomputing.com>  
Reviewed-by: Chapman Flack <chap@anastigmatix.net>  
Discussion: https://www.postgresql.org/message-id/flat/007ef255-35ef-fd26-679c-f97e7a7f30c2@illuminatedcomputing.com  

M doc/src/sgml/func.sgml

Allow parallel zstd compression when taking a base backup.

commit   : 51c0d186d99a18e6aae53003f5138f20991e15a6    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 09:35:14 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 09:35:14 -0400    

Click here for diff

libzstd allows transparent parallel compression just by setting  
an option when creating the compression context, so permit that  
for both client and server-side backup compression. To use this,  
use something like pg_basebackup --compress WHERE-zstd:workers=N  
where WHERE is "client" or "server" and N is an integer.  
  
When compression is performed on the server side, this will spawn  
threads inside the PostgreSQL backend. While there is almost no  
PostgreSQL server code which is thread-safe, the threads here are used  
internally by libzstd and touch only data structures controlled by  
libzstd.  
  
Patch by me, based in part on earlier work by Dipesh Pandit  
and Jeevan Ladhe. Reviewed by Justin Pryzby.  
  
Discussion: http://postgr.es/m/CA+Tgmobj6u-nWF-j=FemygUhobhryLxf9h-wJN7W-2rSsseHNA@mail.gmail.com  

M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/replication/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_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/common/backup_compression.c
M src/include/common/backup_compression.h

Simplify a needlessly-complicated regular expression.

commit   : c6863b85829149e2241faafa161b6c5af1f06cb9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 09:02:44 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 30 Mar 2022 09:02:44 -0400    

Click here for diff

Dilip Kumar  
  
Discussion: https://postgr.es/m/CAFiTN-uV_u1LgBN_CAiGyfgPXp+bfBUVqG5mZ24Nqc8e_Yb0HQ@mail.gmail.com  

M src/bin/scripts/t/020_createdb.pl

doc: Clarify when SSL actually means TLS

commit   : 860ea46ba7be69c46c37a96983e1ddca9d630c2e    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 30 Mar 2022 13:07:30 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 30 Mar 2022 13:07:30 +0200    

Click here for diff

SSL has become the de facto term to mean an end-to-end encrypted channel  
regardless of protocol used, even though the SSL protocol is deprecated.  
Clarify what we mean with SSL in our documentation, especially for new  
users who might be looking for TLS.  
  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/D4ABB281-6CFD-46C6-A4E0-8EC23A2977BC@yesql.se  

M doc/src/sgml/config.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/runtime.sgml

Fix typo in comment.

commit   : f505bec711f602c6bd08a88e8ad894b611e7e8a1    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 30 Mar 2022 19:00:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 30 Mar 2022 19:00:00 +0900    

Click here for diff

M src/backend/commands/copyfrom.c

Add header matching mode to COPY FROM

commit   : 072132f04e55c1c3b0f1a582318da78de7334379    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 08:56:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 30 Mar 2022 08:56:58 +0200    

Click here for diff

COPY FROM supports the HEADER option to silently discard the header  
line from a CSV or text file.  It is possible to load by mistake a  
file that matches the expected format, for example, if two text  
columns have been swapped, resulting in garbage in the database.  
  
This adds a new option value HEADER MATCH that checks the column names  
in the header line against the actual column names and errors out if  
they do not match.  
  
Author: Rémi Lapeyre <remi.lapeyre@lenstra.fr>  
Reviewed-by: Daniel Verite <daniel@manitou-mail.org>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://www.postgresql.org/message-id/flat/CAF1-J-0PtCWMeLtswwGV2M70U26n4g33gpe1rcKQqe6wVQDrFA@mail.gmail.com  

M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/include/commands/copy.h
M src/test/regress/expected/copy.out
M src/test/regress/sql/copy.sql

Add TAP test in pg_dump with --format=tar and --compress

commit   : edcedcc2c7bb8390858bbccda9637318598f2473    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Mar 2022 13:34:01 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 30 Mar 2022 13:34:01 +0900    

Click here for diff

This combination of options has never been supported, and it has never  
been checked in the regression tests.  When building the code without  
zlib support, pg_dump is allowed to run and it generates a warning to  
inform that any contents are dumped as uncompressed.  The tests added by  
this commit check both behaviors.  
  
Author: Georgios Kokolatos, Rachel Heaton  
Discussion: https://postgr.es/m/faUNEOpts9vunEaLnmxmG-DldLSg_ql137OC3JYDmgrOMHm1RvvWY2IdBkv_CRxm5spCCb_OmKNk2T03TMm0fBEWveFF9wA1WizPuAgB7Ss=@protonmail.com  

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

Skip empty transactions for logical replication.

commit   : d5a9d86d8ffcadc52ff3729cd00fbd83bc38643c    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 30 Mar 2022 07:41:05 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 30 Mar 2022 07:41:05 +0530    

Click here for diff

The current logical replication behavior is to send every transaction to  
subscriber even if the transaction is empty. This can happen because  
transaction doesn't contain changes from the selected publications or all  
the changes got filtered. It is a waste of CPU cycles and network  
bandwidth to build/transmit these empty transactions.  
  
This patch addresses the above problem by postponing the BEGIN message  
until the first change is sent. While processing a COMMIT message, if  
there was no other change for that transaction, do not send the COMMIT  
message. This allows us to skip sending BEGIN/COMMIT messages for empty  
transactions.  
  
When skipping empty transactions in synchronous replication mode, we send  
a keepalive message to avoid delaying such transactions.  
  
Author: Ajin Cherian, Hou Zhijie, Euler Taveira  
Reviewed-by: Peter Smith, Takamichi Osumi, Shi Yu, Masahiko Sawada, Greg Nancarrow, Vignesh C, Amit Kapila  
Discussion: https://postgr.es/m/CAMkU=1yohp9-dv48FLoSPrMqYEyyS5ZWkaZGD41RJr10xiNo_Q@mail.gmail.com  

M src/backend/replication/logical/logical.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/walsender.c
M src/include/replication/logical.h
M src/include/replication/output_plugin.h
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/020_messages.pl
M src/tools/pgindent/typedefs.list

Make PostgreSQL::Test::Cluster::run_log() return a useful value.

commit   : ad4f2c47de440cdd5d58cf9ffea09afa0da04d6c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 16:29:49 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 16:29:49 -0400    

Click here for diff

Curently, some TAP test that directly call the underlying function  
PostgreSQL::Test::Utils::run_log() care about the return value, but  
none of those that call it via PostgreSQL::Test::Cluster::run_log() care.  
However, I'd like to add a test that will care, so adjust this function  
to return whatever it gets back from the underlying function, just as  
we do for a number of other functions in this module.  
  
Discussion: http://postgr.es/m/CA+Tgmobj6u-nWF-j=FemygUhobhryLxf9h-wJN7W-2rSsseHNA@mail.gmail.com  

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

SQL/JSON query functions

commit   : 1a36bc9dba8eae90963a586d37b6457b32b2fed4    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:11:14 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:11:14 -0500    

Click here for diff

This introduces the SQL/JSON functions for querying JSON data using  
jsonpath expressions. The functions are:  
  
JSON_EXISTS()  
JSON_QUERY()  
JSON_VALUE()  
  
All of these functions only operate on jsonb. The workaround for now is  
to cast the argument to jsonb.  
  
JSON_EXISTS() tests if the jsonpath expression applied to the jsonb  
value yields any values. JSON_VALUE() must return a single value, and an  
error occurs if it tries to return multiple values. JSON_QUERY() must  
return a json object or array, and there are various WRAPPER options for  
handling scalar or multi-value results. Both these functions have  
options for handling EMPTY and ERROR conditions.  
  
Nikita Glukhov  
  
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/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  

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/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/utils/formatting.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
A src/test/regress/expected/json_sqljson.out
A src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/json_sqljson.sql
A src/test/regress/sql/jsonb_sqljson.sql

In 020_createdb.pl, change order of command-line arguments.

commit   : 3d067c53b26dfeb95da0d75a65614b4d7b45c317    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 13:48:39 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 13:48:39 -0400    

Click here for diff

Linux thinks that something like "createdb foo -S bar" is perfectly  
fine, but Windows wants the options to precede any bare arguments, so  
we must write "createdb -S bar foo" for portability.  
  
Per reports from CI, the buildfarm, and Andres.  
  
Discussion: http://postgr.es/m/20220329173536.7d2ywdatsprxl4x6@alap3.anarazel.de  

M src/bin/scripts/t/020_createdb.pl

Add new block-by-block strategy for CREATE DATABASE.

commit   : 9c08aea6a3090a396be334cc58c511edab05776a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 11:31:43 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 11:31:43 -0400    

Click here for diff

Because this strategy logs changes on a block-by-block basis, it  
avoids the need to checkpoint before and after the operation.  
However, because it logs each changed block individually, it might  
generate a lot of extra write-ahead logging if the template database  
is large. Therefore, the older strategy remains available via a new  
STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy  
option to createdb.  
  
Somewhat controversially, this patch assembles the list of relations  
to be copied to the new database by reading the pg_class relation of  
the template database. Cross-database access like this isn't normally  
possible, but it can be made to work here because there can't be any  
connections to the database being copied, nor can it contain any  
in-doubt transactions. Even so, we have to use lower-level interfaces  
than normal, since the table scan and relcache interfaces will not  
work for a database to which we're not connected. The advantage of  
this approach is that we do not need to rely on the filesystem to  
determine what ought to be copied, but instead on PostgreSQL's own  
knowledge of the database structure. This avoids, for example,  
copying stray files that happen to be located in the source database  
directory.  
  
Dilip Kumar, with a fairly large number of cosmetic changes by me.  
Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor,  
Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian,  
Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro  
Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.  
  
Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com  

M contrib/bloom/blinsert.c
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M src/backend/access/heap/heapam_handler.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/transam/xlogutils.c
M src/backend/catalog/heap.c
M src/backend/catalog/storage.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablecmds.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relmapper.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/psql/tab-complete.c
M src/bin/scripts/createdb.c
M src/bin/scripts/t/020_createdb.pl
M src/include/catalog/storage.h
M src/include/commands/dbcommands_xlog.h
M src/include/storage/bufmgr.h
M src/include/storage/lmgr.h
M src/include/utils/relmapper.h
M src/include/utils/wait_event.h
M src/tools/pgindent/typedefs.list

Revert "Fix replay of create database records on standby"

commit   : bf902c13930c268388644100663f2998868b6e85    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 29 Mar 2022 15:36:21 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 29 Mar 2022 15:36:21 +0200    

Click here for diff

This reverts commit 49d9cfc68bf4.  The approach taken by this patch has  
problems, so we'll come up with a radically different fix.  
  
Discussion: https://postgr.es/m/CA+TgmoYcUPL+WOJL2ZzhH=zmrhj0iOQ=iCFM0SuYqBbqZEamEg@mail.gmail.com  

M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/include/access/xlogutils.h
D src/test/recovery/t/029_replay_tsp_drops.pl
M src/tools/pgindent/typedefs.list

Explain why the startup process can't cause a shortage of sinval slots.

commit   : edea649afbcedd431802a5255cd153538e43ee1d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 09:24:24 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 29 Mar 2022 09:24:24 -0400    

Click here for diff

Bharath Rupireddy, reviewed by Fujii Masao and Yura Sokolov.  
Lightly edited by me.  
  
Discussion: http://postgr.es/m/CALj2ACU=3_frMkDp9UUeuZoAMjaK1y0Z_q5RFNbGvwi8NM==AA@mail.gmail.com  

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

doc: Make UPDATE FROM examples consistent

commit   : 3785d8e98b741749d09f1cfe119ec04961ed07b2    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Mar 2022 14:53:20 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Mar 2022 14:53:20 +0200    

Click here for diff

The original first half of the example used an employees table and an  
accounts.sales_person foreign key column, while the second half (added  
in commit 8f889b1083f) used a salesmen table and accounts.sales_id  
for the foreign key.  This makes everything use the original names.  
  
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>  
Discussion: https://postgr.es/m/87o81vqjw0.fsf@wibble.ilmari.org  

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

Enable SSL library detection via PQsslAttribute()

commit   : ebc8b7d4416d8e0dfb7c05132ef6182fd3daf885    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Mar 2022 14:02:45 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Tue, 29 Mar 2022 14:02:45 +0200    

Click here for diff

Currently, libpq client code must have a connection handle  
before it can query the "library" SSL attribute.  This poses  
problems if the client needs to know what SSL library is in  
use before constructing a connection string.  
  
Allow PQsslAttribute(NULL, "library") to return the library  
in use -- currently, just "OpenSSL" or NULL. The new behavior  
is announced with the LIBPQ_HAS_SSL_LIBRARY_DETECTION feature  
macro, allowing clients to differentiate between a libpq that  
was compiled without SSL support and a libpq that's just too  
old to tell.  
  
Author: Jacob Champion <pchampion@vmware.com>  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://postgr.es/m/4c8b76ef434a96627170a31c3acd33cbfd6e41f1.camel@vmware.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
A src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/test/.gitignore
M src/interfaces/libpq/test/Makefile
A src/interfaces/libpq/test/testclient.c

psql: Add test for psql behavior on server crash

commit   : 8cd7627c7b19c5a1bb235e7ad91b53856b101e65    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Mar 2022 08:58:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 29 Mar 2022 08:58:54 +0200    

Click here for diff

Author: Fabien COELHO <coelho@cri.ensmp.fr>  
Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1904132231510.8961@lancre  

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

Avoid instabilities with the regression tests of pg_freespacemap

commit   : c14a9eeec4797358922f8696d76716501b86c57d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 13:52:49 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 13:52:49 +0900    

Click here for diff

It was possible to run those tests with installcheck, but they are  
actually unstable as concurrent autovacuum jobs could prevent the  
truncation of the filespace map to happen (aka the scan of pg_database  
when building the list of relations to clean), an assumption we rely on  
when checking that the FSM of the relation gets truncated during a  
manual vacuum after deleting all the relation's data.  
  
This commit adds a NO_INSTALLCHECK to disallow installcheck, and  
introduces the use of a custom configuration file with autovacuum  
disabled.  
  
It happens that we already do that in the recovery test  
008_fsm_truncation, for example.  
  
Reported-by: Tom Lane, via buildfarm member skink  
Discussion: https://postgr.es/m/381910.1648401526@sss.pgh.pa.us  

M contrib/pg_freespacemap/Makefile
A contrib/pg_freespacemap/pg_freespacemap.conf

Add system view pg_ident_file_mappings

commit   : a2c84990bea7beadb599d02328190e2a763dcb86    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 10:15:48 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 10:15:48 +0900    

Click here for diff

This view is similar to pg_hba_file_rules view, except that it is  
associated with the parsing of pg_ident.conf.  Similarly to its cousin,  
this view is useful to check via SQL if changes planned in pg_ident.conf  
would work upon reload or restart, or to diagnose a previous failure.  
  
Bumps catalog version.  
  
Author: Julien Rouhaud  
Reviewed-by: Aleksander Alekseev, Michael Paquier  
Discussion: https://postgr.es/m/20220223045959.35ipdsvbxcstrhya@jrouhaud  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/client-auth.sgml
M doc/src/sgml/func.sgml
M src/backend/catalog/system_views.sql
M src/backend/libpq/hba.c
M src/backend/utils/adt/hbafuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/libpq/hba.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql

Modify query on pg_hba_file_rules to check for errors in regression tests

commit   : 091a971bb59ca9751f32a4aa5aee969c5a915754    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 09:06:51 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 29 Mar 2022 09:06:51 +0900    

Click here for diff

The regression tests include a query to check the execution path of  
pg_hba_file_rules, but it has never checked that a given cluster has  
correct contents in pg_hba.conf.  This commit extends the query of  
pg_hba_file_rules to report any errors if anything bad is found.  For  
EXEC_BACKEND builds, any connection attempt would fail when loading  
pg_hba.conf if any incorrect content is found when parsed, so a failure  
would be detected before even running this query.  However, this can  
become handy for clusters where pg_hba.conf can be reloaded, where new  
connection attempts are not subject to a fresh loading of pg_hba.conf.  
  
Author: Julien Rouhaud, based on an idea from me  
Discussion: https://postgr.es/m/YkFhpydhyeNNo3Xl@paquier.xyz  

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

IS JSON predicate

commit   : 33a377608fc29cdd1f6b63be561eab0aee5c81f0    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:02:53 -0500    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 3 Mar 2022 13:02:53 -0500    

Click here for diff

This patch intrdocuces 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 an IS and IS NOT variant. The tests are:  
  
IS JSON [VALUE]  
IS JSON ARRAY  
IS JSON OBJECT  
IS JSON SCALAR  
IS JSON  WITH | WITHOUT UNIQUE KEYS  
  
These are mostly self-explanatory, but note that IS JSON WITHOUT UNIQUE  
KEYS is true whenever IS JSON is true, and IS JSON WITH UNIQUE KEYS is  
true whenever IS JSON is true except it IS JSON OBJECT is true and there  
are duplicate keys (which is never the case when applied to jsonb values).  
  
Nikita Glukhov  
  
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/cd0bb935-0158-78a7-08b5-904886deac4b@postgrespro.ru  

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/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.c
M src/backend/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/backend/utils/misc/queryjumble.c
M src/include/executor/execExpr.h
M src/include/nodes/makefuncs.h
M src/include/nodes/nodes.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/test/regress/expected/sqljson.out
M src/test/regress/sql/sqljson.sql

Use has_privs_for_roles for predefined role checks

commit   : 6198420ad8a72e37f4fe4964616b17e0fd33b808    
  
author   : Joe Conway <mail@joeconway.com>    
date     : Mon, 28 Mar 2022 15:10:04 -0400    
  
committer: Joe Conway <mail@joeconway.com>    
date     : Mon, 28 Mar 2022 15:10:04 -0400    

Click here for diff

Generally if a role is granted membership to another role with NOINHERIT  
they must use SET ROLE to access the privileges of that role, however  
with predefined roles the membership and privilege is conflated. Fix that  
by replacing is_member_of_role with has_privs_for_role for predefined  
roles. Patch does not remove is_member_of_role from acl.h, but it does  
add a warning not to use that function for privilege checking. Not  
backpatched based on hackers list discussion.  
  
Author: Joshua Brindle  
Reviewed-by: Stephen Frost, Nathan Bossart, Joe Conway  
Discussion: https://postgr.es/m/flat/CAGB+Vh4Zv_TvKt2tv3QNS6tUM_F_9icmuj0zjywwcgVi4PAhFA@mail.gmail.com  

M contrib/adminpack/adminpack.c
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pgrowlocks/pgrowlocks.c
M doc/src/sgml/adminpack.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/pgfreespacemap.sgml
M doc/src/sgml/pgrowlocks.sgml
M doc/src/sgml/pgstatstatements.sgml
M doc/src/sgml/pgvisibility.sgml
M src/backend/commands/copy.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/misc/guc.c
M src/test/modules/unsafe_tests/expected/rolenames.out

Remove the ability of a role to administer itself.

commit   : 79de9842ab03259325ee4055fb0a7ebd2e4372ff    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 28 Mar 2022 13:38:13 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 28 Mar 2022 13:38:13 -0400    

Click here for diff

Commit f9fd1764615ed5d85fab703b0ffb0c323fe7dfd5 effectively gave  
every role ADMIN OPTION on itself. However, this appears to be  
something that happened accidentally as a result of refactoring  
work rather than an intentional decision. Almost a decade later,  
it was discovered that this was a security vulnerability. As a  
result, commit fea164a72a7bfd50d77ba5fb418d357f8f2bb7d0 restricted  
this implicit ADMIN OPTION privilege to be exercisable only when  
the role being administered is the same as the session user and  
when no security-restricted operation is in progress. That  
commit also documented the existence of this implicit privilege  
for what seems to be the first time.  
  
The effect of the privilege is to allow a login role to grant  
the privileges of that role, and optionally ADMIN OPTION on it,  
to some other role. That's an unusual thing to do, because generally  
membership is granted in roles used as groups, rather than roles  
used as users. Therefore, it does not seem likely that removing  
the privilege will break things for many PostgreSQL users.  
  
However, it will make it easier to reason about the permissions  
system. This is the only case where a user who has not been given any  
special permission (superuser, or ADMIN OPTION on some role) can  
modify role membership, so removing it makes things more consistent.  
For example, if a superuser sets up role A and B and grants A to B  
but no other privileges to anyone, she can now be sure that no one  
else will be able to revoke that grant. Without this change, that  
would have been true only if A was a non-login role.  
  
Patch by me. Reviewed by Tom Lane and Stephen Frost.  
  
Discussion: http://postgr.es/m/CA+Tgmoawdt03kbA+dNyBcNWJpRxu0f4X=69Y3+DkXXZqmwMDLg@mail.gmail.com  

M doc/src/sgml/ref/grant.sgml
M src/backend/commands/user.c
M src/backend/utils/adt/acl.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Fix a few goofs in new backup compression code.

commit   : 61762426e6edbe87100dd5a4f107e8c06a11ec02    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 28 Mar 2022 12:19:05 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 28 Mar 2022 12:19:05 -0400    

Click here for diff

When we try to set the zstd compression level either on the client  
or on the server, check for errors.  
  
For any algorithm, on the client side, don't try to set the compression  
level unless the user specified one. This was visibly broken for  
zstd, which managed to set -1 rather than 0 in this case, but tidy  
up the code for the other methods, too.  
  
On the client side, if we fail to create a ZSTD_CCtx, exit after  
reporting the error. Otherwise we'll dereference a null pointer.  
  
Patch by me, reviewed by Dipesh Pandit.  
  
Discussion: http://postgr.es/m/CA+TgmoZK3zLQUCGi1h4XZw4jHiAWtcACc+GsdJR1_Mc19jUjXA@mail.gmail.com  

M src/backend/replication/basebackup_zstd.c
M src/bin/pg_basebackup/bbstreamer_gzip.c
M src/bin/pg_basebackup/bbstreamer_lz4.c
M src/bin/pg_basebackup/bbstreamer_zstd.c

Add public ruleutils.c entry point to deparse a Query.

commit   : d22646922d66012705e0e2948cfb5b4a07092a29    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Mar 2022 11:19:29 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 28 Mar 2022 11:19:29 -0400    

Click here for diff

This has no in-core callers but will be wanted by extensions.  
It's just a thin wrapper around get_query_def, so it adds little code.  
  
Also, fix get_from_clause_item() to force insertion of an alias  
for a SUBQUERY RTE item.  This is irrelevant to existing uses because  
RTE_SUBQUERY items made by the parser always have aliases already.  
However, if one tried to use pg_get_querydef() to inspect a post-rewrite  
Query, it could be an issue.  In any case, get_from_clause_item already  
contained logic to force alias insertion for VALUES items, so the lack  
of the same for SUBQUERY is a pretty clear oversight.  
  
In passing, replace duplicated code for selection of pretty-print  
options with a common macro.  
  
Julien Rouhaud, reviewed by Pavel Stehule, Gilles Darold, and myself  
  
Discussion: https://postgr.es/m/20210627041138.zklczwmu3ms4ufnk@nol  

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

Fix role names in merge.sql regress file

commit   : 386ca0abf4107721a363f1c152cd026041b609ea    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 28 Mar 2022 17:10:36 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 28 Mar 2022 17:10:36 +0200    

Click here for diff

These names need to be prefixed with "regress_".  Per buildfarm.  

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

Add support for MERGE SQL command

commit   : 7103ebb7aae8ab8076b7e85f335ceb8fe799097c    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 28 Mar 2022 16:45:58 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Mon, 28 Mar 2022 16:45:58 +0200    

Click here for diff

MERGE performs actions that modify rows in the target table using a  
source table or query. MERGE provides a single SQL statement that can  
conditionally INSERT/UPDATE/DELETE rows -- a task that would otherwise  
require multiple PL statements.  For example,  
  
MERGE INTO target AS t  
USING source AS s  
ON t.tid = s.sid  
WHEN MATCHED AND t.balance > s.delta THEN  
  UPDATE SET balance = t.balance - s.delta  
WHEN MATCHED THEN  
  DELETE  
WHEN NOT MATCHED AND s.delta > 0 THEN  
  INSERT VALUES (s.sid, s.delta)  
WHEN NOT MATCHED THEN  
  DO NOTHING;  
  
MERGE works with regular tables, partitioned tables and inheritance  
hierarchies, including column and row security enforcement, as well as  
support for row and statement triggers and transition tables therein.  
  
MERGE is optimized for OLTP and is parameterizable, though also useful  
for large scale ETL/ELT. MERGE is not intended to be used in preference  
to existing single SQL commands for INSERT, UPDATE or DELETE since there  
is some overhead.  MERGE can be used from PL/pgSQL.  
  
MERGE does not support targetting updatable views or foreign tables, and  
RETURNING clauses are not allowed either.  These limitations are likely  
fixable with sufficient effort.  Rewrite rules are also not supported,  
but it's not clear that we'd want to support them.  
  
Author: Pavan Deolasee <pavan.deolasee@gmail.com>  
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>  
Author: Amit Langote <amitlangote09@gmail.com>  
Author: Simon Riggs <simon.riggs@enterprisedb.com>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Reviewed-by: Andres Freund <andres@anarazel.de> (earlier versions)  
Reviewed-by: Peter Geoghegan <pg@bowt.ie> (earlier versions)  
Reviewed-by: Robert Haas <robertmhaas@gmail.com> (earlier versions)  
Reviewed-by: Japin Li <japinli@hotmail.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>  
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>  
Discussion: https://postgr.es/m/CANP8+jKitBSrB7oTgT9CY2i1ObfOt36z0XMraQc+Xrz8QB0nXA@mail.gmail.com  
Discussion: https://postgr.es/m/CAH2-WzkJdBuxj9PO=2QaO9-3h3xGbQPZ34kJH=HukRekwM-GZg@mail.gmail.com  
Discussion: https://postgr.es/m/20201231134736.GA25392@alvherre.pgsql  

M contrib/test_decoding/expected/ddl.out
M contrib/test_decoding/sql/ddl.sql
M doc/src/sgml/libpq.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/ref/allfiles.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/insert.sgml
A doc/src/sgml/ref/merge.sgml
M doc/src/sgml/reference.sgml
M doc/src/sgml/trigger.sgml
M src/backend/catalog/sql_features.txt
M src/backend/commands/explain.c
M src/backend/commands/trigger.c
M src/backend/executor/README
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/spi.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/readfuncs.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/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/Makefile
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
A src/backend/parser/parse_merge.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/utils/adt/ruleutils.c
M src/bin/psql/tab-complete.c
M src/include/commands/trigger.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/spi.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/prep.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
A src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_relation.h
M src/include/tcop/cmdtaglist.h
M src/interfaces/libpq/fe-exec.c
M src/pl/plpgsql/src/pl_exec.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
A src/test/isolation/expected/merge-delete.out
A src/test/isolation/expected/merge-insert-update.out
A src/test/isolation/expected/merge-match-recheck.out
A src/test/isolation/expected/merge-update.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/merge-delete.spec
A src/test/isolation/specs/merge-insert-update.spec
A src/test/isolation/specs/merge-match-recheck.spec
A src/test/isolation/specs/merge-update.spec
M src/test/regress/expected/identity.out
A src/test/regress/expected/merge.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/with.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/identity.sql
A src/test/regress/sql/merge.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/with.sql
M src/tools/pgindent/typedefs.list

Preparatory test cleanup

commit   : ae63017bdb316b16a9f201b10f1221598111d6c5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Mar 2022 15:22:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Mar 2022 15:22:34 +0200    

Click here for diff

Add a little bit of explanation, clarity, and space.  Extraced from a  
larger patch so that the changes from that patch would be easier to  
identify.  
  
Discussion: https://www.postgresql.org/message-id/flat/04e12818-2f98-257c-b926-2845d74ed04f%402ndquadrant.com  

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

Document autoanalyze limitations for partitioned tables

commit   : 61fa6ca79b3c566f44831a33bb226f7358ed4511    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 28 Mar 2022 14:27:36 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 28 Mar 2022 14:27:36 +0200    

Click here for diff

When dealing with partitioned tables, counters for partitioned tables  
are not updated when modifying child tables. This means autoanalyze may  
not update optimizer statistics for the parent relations, which can  
result in poor plans for some queries.  
  
It's worth documenting this limitation, so that people are aware of it  
and can take steps to mitigate it (e.g. by setting up a script executing  
ANALYZE regularly).  
  
Backpatch to v10. Older branches are affected too, of couse, but we no  
longer maintain those.  
  
Author: Justin Pryzby  
Reviewed-by: Zhihong Yu, Tomas Vondra  
Backpatch-through: 10  
Discussion: https://postgr.es/m/20210913035409.GA10647%40telsasoft.com  

M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/analyze.sgml

Make JSON path numeric literals more correct

commit   : e26114c817b610424010cfbe91a743f591246ff1    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Mar 2022 10:41:43 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 28 Mar 2022 10:41:43 +0200    

Click here for diff

Per ECMAScript standard (ECMA-262, referenced by SQL standard), the  
syntax forms  
  
.1  
1.  
  
should be allowed for decimal numeric literals, but the existing  
implementation rejected them.  
  
Also, by the same standard, reject trailing junk after numeric  
literals.  
  
Note that the ECMAScript standard for numeric literals is in respects  
like these slightly different from the JSON standard, which might be  
the original cause for this discrepancy.  
  
A change is that this kind of syntax is now rejected:  
  
    1.type()  
  
This needs to be written as  
  
    (1).type()  
  
This is correct; normal JavaScript also does not accept this syntax.  
  
We also need to fix up the jsonpath output function for this case.  We  
put parentheses around numeric items if they are followed by another  
path item.  
  
Reviewed-by: Nikita Glukhov <n.gluhov@postgrespro.ru>  
Discussion: https://www.postgresql.org/message-id/flat/50a828cc-0a00-7791-7883-2ed06dfb2dbb@enterprisedb.com  

M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_scan.l
M src/test/regress/expected/jsonpath.out
M src/test/regress/sql/jsonpath.sql

Don't fail for > 1 walsenders in 019_replslot_limit, add debug messages.

commit   : 91c0570a791180aa3ff01d70eb16ed6c0d8283a3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 22:29:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 22:29:19 -0700    

Click here for diff

So far the first of the retries introduced in f28bf667f60 resolves the  
issue. But I (Andres) am still suspicious that the start of the failures might  
indicate a problem.  
  
To reduce noise, stop reporting a failure if a retry resolves the problem. To  
allow figuring out what causes the slow slot drop, add a few more debug  
messages to ReplicationSlotDropPtr.  
  
See also commit afdeff10526, fe0972ee5e6 and f28bf667f60.  
  
Discussion: https://postgr.es/m/20220327213219.smdvfkq2fl74flow@alap3.anarazel.de  

M src/backend/replication/slot.c
M src/test/recovery/t/019_replslot_limit.pl

Mark pg_stat_get_subscription_stats() strict.

commit   : da4b56662f2cda3ef97847307aaec8e8f66ffb15    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 21:47:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 21:47:26 -0700    

Click here for diff

It accidentally was marked as non-strict. As it was introduced only in HEAD,  
we can just fix the catalog.  
  
Bumps catversion.  
  
Discussion: https://postgr.es/m/20220326212432.s5n2maw6kugnpyxw@alap3.anarazel.de  

M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Fix NULL input behaviour of pg_stat_get_replication_slot().

commit   : 43a7dc96eb363f87286494223861301361ce766c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 21:39:43 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sun, 27 Mar 2022 21:39:43 -0700    

Click here for diff

pg_stat_get_replication_slot() accidentally was marked as non-strict, crashing  
when called with NULL input. As it's already released, introduce an explicit  
NULL check in 14, fix the catalog in HEAD.  
  
Bumps catversion in HEAD.