PostgreSQL 15.0 (upcoming) commit log

Fix comment in guc_tables.c

commit   : bdf9b60085bca2dbb0af920d50f1a0917dda0cbb    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 15:39:41 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 15:39:41 +0900    

Click here for diff

s/ERROR_HANDLING/ERROR_HANDLING_OPTIONS/.  
  
Author: Peter Smith  
Discussion: https://postgr.es/m/CAHut+PtDj3CV+f0pVisc0XYMi2LHGBpQxQWtF0FjiSVN_nV17Q@mail.gmail.com  

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

Cleanup useless assignments and checks

commit   : c42cd05c586235fa9e84fb4a3682286cf551df0e    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 13:16:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 13:16:23 +0900    

Click here for diff

This cleans up a couple of areas:  
- Remove XLogSegNo calculation for the last WAL segment in backup in  
xlog.c (7d70809 has moved this logic entirely to xlogbackup.c when  
building the contents of the backup history file).  
- Remove check on log_min_duration in analyze.c, as it is already true  
where this code path is reached.  
- Simplify call to find_option() in guc.c.  
  
Author: Ranier Vilela  
Reviewed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAEudQArCDQQiPiFR16=yu9k5s2tp4tgEe1U1ZbkW4ofx81AWWQ@mail.gmail.com  

M src/backend/access/transam/xlog.c
M src/backend/commands/analyze.c
M src/backend/utils/misc/guc.c

Add filtering capability for cross-version pg_upgrade tests

commit   : 62be9e4cdc1d59dd6c9c268c7419d7d4f1016124    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 10:11:08 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 4 Oct 2022 10:11:08 +0900    

Click here for diff

This commit expands the TAP tests of pg_upgrade when running these with  
different major versions for the "old" cluster (to-be-upgraded) and the  
"new" cluster (upgraded-to), by backporting some of the buildfarm  
facilities directory into the script:  
- Remove comments from the dump files, avoiding version-dependent  
information.  
- Remove empty lines from the dump files.  
- Use --extra-float-digits=0 in the pg_dump command, when using an "old"  
cluster with version equal to or lower than v11.  
- Use --wal-segsize and --allow-group-access in initdb only when the  
"old" cluster is equal to or higher than v11.  
  
This allows the tests to pass down to v14 with the main regression test  
suite, while v9.5~13 still generate some diffs, but these are minimal  
compared to what happened before this commit.  Much more could be done,  
especially around dump differences with function and procedures (these  
can also be avoided with direct manipulation of the dumps loaded, for  
example, in a way similar to the buildfarm), but at least the basics are  
in place now.  
  
Reviewed-by: Justin Pryzby, Anton A. Melnikov  
Discussion: https://postgr.es/m/Yox1ME99GhAemMq1@paquier.xyz  

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

meson: llvm: Use llvm-config's --cxxflags when building llvmjit

commit   : 908e17151b4834bd4bbfb703e206b68f5db341f9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Oct 2022 14:52:51 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Oct 2022 14:52:51 -0700    

Click here for diff

Otherwise we don't use LLVM's flags when building llvmjit_wrap.cpp and  
llvmjit_inline.cpp. That can cause compile time failures if the C++ compiler  
doesn't default to a new enough C++ standards version and link time failures  
due to ABI influencing flags like -fno-rtti.  

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

Fix psql's behavior with \g for a multiple-command string.

commit   : 4a79fd1a754edcc85f9b94f17a2fb4576becf0a3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Oct 2022 15:07:10 -0400    

Click here for diff

The pre-v15 behavior was to discard all but the last result,  
but with the new behavior of printing all results by default,  
we will send each such result to the \g file.  However,  
we're still opening and closing the \g file for each result,  
so you lose all but the last result anyway.  Move the output-file  
state up to ExecQueryAndProcessResults so that we open/close the  
\g file only once per command string.  
  
To support this without changing other behavior, we must  
adjust PrintQueryResult to have separate FILE * arguments  
for query and status output (since status output has never  
gone to the \g file).  That in turn makes it a good idea  
to push the responsibility for fflush'ing output down to  
PrintQueryTuples and PrintQueryStatus.  
  
Also fix an infinite loop if COPY IN/OUT is attempted in \watch.  
We used to reject that, but that error exit path got broken  
somewhere along the line in v15.  There seems no real reason  
to reject it anyway as the code now stands, so just remove  
the error exit and make sure that COPY OUT data goes to the  
right place.  
  
Also remove PrintQueryResult's unused is_watch parameter,  
and make some other cosmetic cleanups (adjust obsolete  
comments, break some overly-long lines).  
  
Daniel Vérité and Tom Lane  
  
Discussion: https://postgr.es/m/4333844c-2244-4d6e-a49a-1d483fbe304f@manitou-mail.org  

M src/bin/psql/common.c

meson: respect -Dldap=disabled

commit   : 0ae5db28d06939d1a2ac52813629be0dfc77010e    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Oct 2022 10:13:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 3 Oct 2022 10:13:12 -0700    

Click here for diff

I noticed during some manual testing that -Dldap=disabled (or  
--auto-features=disabled) doesn't disable ldap if available - that's obviously  
wrong.  

M meson.build

Revert "Optimize order of GROUP BY keys".

commit   : f4c7c410ee4a7baa06f51ebb8d5333c169691dd3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 3 Oct 2022 10:56:16 -0400    

Click here for diff

This reverts commit db0d67db2401eb6238ccc04c6407a4fd4f985832 and  
several follow-on fixes.  The idea of making a cost-based choice  
of the order of the sorting columns is not fundamentally unsound,  
but it requires cost information and data statistics that we don't  
really have.  For example, relying on procost to distinguish the  
relative costs of different sort comparators is pretty pointless  
so long as most such comparator functions are labeled with cost 1.0.  
Moreover, estimating the number of comparisons done by Quicksort  
requires more than just an estimate of the number of distinct values  
in the input: you also need some idea of the sizes of the larger  
groups, if you want an estimate that's good to better than a factor of  
three or so.  That's data that's often unknown or not very reliable.  
Worse, to arrive at estimates of the number of calls made to the  
lower-order-column comparison functions, the code needs to make  
estimates of the numbers of distinct values of multiple columns,  
which are necessarily even less trustworthy than per-column stats.  
Even if all the inputs are perfectly reliable, the cost algorithm  
as-implemented cannot offer useful information about how to order  
sorting columns beyond the point at which the average group size  
is estimated to drop to 1.  
  
Close inspection of the code added by db0d67db2 shows that there  
are also multiple small bugs.  These could have been fixed, but  
there's not much point if we don't trust the estimates to be  
accurate in-principle.  
  
Finally, the changes in cost_sort's behavior made for very large  
changes (often a factor of 2 or so) in the cost estimates for all  
sorting operations, not only those for multi-column GROUP BY.  
That naturally changes plan choices in many situations, and there's  
precious little evidence to show that the changes are for the better.  
Given the above doubts about whether the new estimates are really  
trustworthy, it's hard to summon much confidence that these changes  
are better on the average.  
  
Since we're hard up against the release deadline for v15, let's  
revert these changes for now.  We can always try again later.  
  
Note: in v15, I left T_PathKeyInfo in place in nodes.h even though  
it's unreferenced.  Removing it would be an ABI break, and it seems  
a bit late in the release cycle for that.  
  
Discussion: https://postgr.es/m/TYAPR01MB586665EB5FB2C3807E893941F5579@TYAPR01MB5866.jpnprd01.prod.outlook.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_tables.c
M src/backend/utils/misc/postgresql.conf.sample
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/merge.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

Add authentication TAP test for peer authentication

commit   : f60eb3f2827db292edf71bb7296fbdf5958ace3d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Oct 2022 16:42:25 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 3 Oct 2022 16:42:25 +0900    

Click here for diff

This commit introduces an authentication test for the peer method, as of  
a set of scenarios with and without a user name map.  The script is  
automatically skipped if peer is not supported in the environment where  
this test is run, checking this behavior by attempting a connection  
first on a cluster up and running.  
  
Author: Bertrand Drouvot  
Discussion: https://postgr.es/m/aa60994b-1c66-ca7a-dab9-9a200dbac3d2@amazon.com  

M src/test/authentication/meson.build
A src/test/authentication/t/003_peer.pl

ci: enable various runtime checks on FreeBSD and macOS

commit   : 89d16b63527d078ae611b0af1241258ffa1f460b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 17:04:13 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 17:04:13 -0700    

Click here for diff

Increase likelihood of discovering problems during CI rather the buildfarm by  
defining -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES  
-DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST on FreeBSD, and  
-DRANDOMIZE_ALLOCATED_MEMORY on macOS.  
  
FreeBSD and macoS are currently not CI bottlenecks, so we can afford to  
increase their test times a bit.  
  
Author: Justin Pryzby <pryzbyj@telsasoft.com>  
Discussion: https://postgr.es/m/20220910200542.GX31833@telsasoft.com  

M .cirrus.yml

ci: macos: Reduce test concurrency

commit   : 2d2f08310490d63c4cc097243ba63a1601316c17    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 16:55:16 -0700    

Click here for diff

Test performance regresses noticably when using all cores. This is more  
pronounced with meson than with autoconf, presumably because meson will  
schedule the "full number" of tests more consistently.  8 seems to work  
OK.  
  
Discussion: https://postgr.es/m/20220927040208.l3shfcidovpzqxfh@awork3.anarazel.de  
Backpatch: 15-, where CI was introduced  

M .cirrus.yml

meson: Add prefix=/usr/local/pgsql to default_options

commit   : 1360943d1ac03240fc719a459aed4ad4f9f9b5d4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    

Click here for diff

autoconf set PREFIX to /usr/local/pgsql, so using the same default for meson  
makes sense. The effect on windows is that installation defaults to installing  
to C:/usr/local/pgsql rather than meson's default of C:/, which doesn't seem  
perfect, but OK enough.  
  
Signed-off-by: Junwang Zhao <zhjwpku@gmail.com>  
Author: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/CAEG8a3LGWE-gG6vuddmH91RORhi8gWs0mMB-hcTmP3_NVgM7dg@mail.gmail.com  

M meson.build

meson: windows: Determine path to tmp_install + prefix using meson

commit   : d0366bfb3b211b26a997a4220757392a0c153d8d    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 1 Oct 2022 12:39:12 -0700    

Click here for diff

Previously some paths (like c:\ or d:/) worked, but plenty others (like  
/path/to or //computer/share/path) didn't. As we'd like to change the default  
prefix to /usr/local/pgsql, that's a problem.  
  
Instead of trying to do this in meson.build, call out to the implementation  
meson install uses. This isn't pretty, but it's more reliable than what we had  
before.  
  
Discussion: https://postgr.es/CAEG8a3LGWE-gG6vuddmH91RORhi8gWs0mMB-hcTmP3_NVgM7dg@mail.gmail.com  

M meson.build

Fix tiny memory leaks

commit   : a9d58bfe8a3ae2254e1553ab76974feeaafa0133    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 1 Oct 2022 12:48:24 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 1 Oct 2022 12:48:24 +0200    

Click here for diff

Both check_application_name() and check_cluster_name() use  
pg_clean_ascii() but didn't release the memory.  Depending on when the  
GUC is set, this might be cleaned up at some later time or it would  
leak postmaster memory once.  In any case, it seems better not to have  
to rely on such analysis and make the code locally robust.  Also, this  
makes Valgrind happier.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reviewed-by: Jacob Champion <jchampion@timescale.com>  
Discussion: https://www.postgresql.org/message-id/CAD21AoBmFNy9MPfA0UUbMubQqH3AaK5U3mrv6pSeWrwCk3LJ8g@mail.gmail.com  

M src/backend/commands/variable.c

doc: Fix some grammar and typos

commit   : 83e42a0035718914efad2fe04080fd6c579e9ef2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 1 Oct 2022 15:28:02 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 1 Oct 2022 15:28:02 +0900    

Click here for diff

This fixes some areas related to logical replication and custom RMGRs.  
  
Author: Ekaterina Kiryanova  
Discussion: https://postgr.es/m/fa4773f1-1396-384a-bcd7-85b5e013f399@postgrespro.ru  
Backpatch-through: 15  

M doc/src/sgml/custom-rmgr.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logical-replication.sgml
M src/backend/access/transam/rmgr.c

meson: mingw: Add -Wl,--disable-auto-import, enable when linking with readline

commit   : 24ef127b6d1f268ca09f4c501b4655e914329c5a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 10:19:00 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 10:19:00 -0700    

Click here for diff

I hadn't ported -Wl,--disable-auto-import over from the win32 template as I  
had focused on msvc for windows. The flag is desirable as it makes it easier  
to find problems one would have with msvc, particularly useful during cross  
compilation.  
  
This turned out to be a somewhat happy accident, as it allowed me to realize  
that readline actually works on windows these days, as long as auto imports to  
enable. Therefore enable auto-import again as part of linking to readline.  
  
We perhaps can come up with a better solution for the readline issue, but this  
seems good enough for now.  
  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  

M meson.build

Avoid improbable PANIC during heap_update, redux.

commit   : 2dc2e4e31adb71502074c8c2bf9e0766347aa6e5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Sep 2022 19:36:46 -0400    

Click here for diff

Commit 34f581c39 intended to ensure that RelationGetBufferForTuple  
would acquire a visibility-map page pin in case the otherBuffer's  
all-visible bit had become set since we last had lock on that page.  
But I missed a case: when we're extending the relation, VM concerns  
were dealt with only in the relatively-less-likely case that we  
fail to conditionally lock the otherBuffer.  I think I'd believed  
that we couldn't need to worry about it if the conditional lock  
succeeds, which is true for the target buffer; but the otherBuffer  
was unlocked for awhile so its bit might be set anyway.  So we need  
to do the GetVisibilityMapPins dance, and then also recheck the  
page's free space, in both cases.  
  
Per report from Jaime Casanova.  Back-patch to v12 as the previous  
patch was (although there's still no evidence that the bug is  
reachable pre-v14).  
  
Discussion: https://postgr.es/m/E1lWLjP-00006Y-Ml@gemulon.postgresql.org  

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

mingw: Define PGDLLEXPORT as __declspec (dllexport) as done for msvc

commit   : 0e497eadb1f4028b147b5c58dc08cea7e73675e1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 10:16:49 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 10:16:49 -0700    

Click here for diff

While mingw would otherwise fall back to  
__attribute__((visibility("default"))), that appears to only work as long as  
no symbols are declared with __declspec(dllexport). But we can end up with  
some, e.g. plpython's Py_Init.  
  
It's quite possible we should do the same for cygwin, but I don't have a test  
environment for that...  
  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  
Discussion: http://postgr.es/m/20220928025242.ugf7t5ugxxgmkraa@awork3.anarazel.de  

M src/include/port/win32.h

Adjust PQsslAttributeNames() to match PQsslAttribute().

commit   : 4e4f7b9fcc9ad0b023b6e698e978882d022b94c4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Sep 2022 10:26:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 30 Sep 2022 10:26:47 -0400    

Click here for diff

Currently, PQsslAttributeNames() returns the same list of attribute  
names regardless of its conn parameter.  This patch changes it to  
have behavior parallel to what 80a05679d installed for PQsslAttribute:  
you get OpenSSL's attributes if conn is NULL or is an SSL-encrypted  
connection, or an empty list if conn is a non-encrypted connection.  
The point of this is to have sensible connection-dependent behavior  
in case we ever support multiple SSL libraries.  The behavior for  
NULL can be defined as "the attributes for the default SSL library",  
parallel to what PQsslAttribute(NULL, "library") does.  
  
Since this is mostly just future-proofing, no back-patch.  
  
Discussion: https://postgr.es/m/17625-fc47c78b7d71b534@postgresql.org  

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

Fix tab-completion after commit 790bf615ddba

commit   : 69298db8e1a5a7afcfeea32daf71e713a109ef93    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 30 Sep 2022 12:53:31 +0200    

Click here for diff

I (Álvaro) broke tab-completion for GRANT .. ALL TABLES IN SCHEMA while  
removing ALL from the publication syntax for schemas in the  
aforementioned commit.  I also missed to update a bunch of  
tab-completion rules for ALTER/CREATE PUBLICATION that match each  
individual piece of ALL TABLES IN SCHEMA.  Repair those bugs.  
  
While fixing up that commit, update a couple of outdated comments  
related to the same change.  
  
Backpatch to 15.  
  
Author: Shi yu <shiy.fnst@fujitsu.com>  
Reviewed-by: Peter Smith <smithpb2250@gmail.com>  
Discussion: https://postgr.es/m/OSZPR01MB6310FCE8609185A56344EED2FD559@OSZPR01MB6310.jpnprd01.prod.outlook.com  

M src/backend/replication/logical/tablesync.c
M src/bin/psql/tab-complete.c
M src/test/subscription/t/031_column_list.pl

doc: Fix PQsslAttribute docs for compression

commit   : 51fd7cdfd07d49223c82f8bbdf37866c81c62908    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 30 Sep 2022 12:03:48 +0200    

Click here for diff

The compression parameter to PQsslAttribute has never returned the  
compression method used, it has always returned "on" or "off since  
it was added in commit 91fa7b4719ac. Backpatch through v10.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/B9EC60EC-F665-47E8-A221-398C76E382C9@yesql.se  
Backpatch-through: v10  

M doc/src/sgml/libpq.sgml

Remove useless argument from UnpinBuffer()

commit   : 65b158ae4e892c2da7a5e31e2d2645e5e79a0bfd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Sep 2022 15:57:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 30 Sep 2022 15:57:47 +0900    

Click here for diff

The last caller of UnpinBuffer() that did not want to adjust  
CurrentResourceOwner was removed in 2d115e4, and nothing has been  
introduced in bufmgr.c to do the same thing since.  This simplifies 10  
code paths.  
  
Author: Aleksander Alekseev  
Reviewed-by: Nathan Bossart, Zhang Mingli, Bharath Rupireddy  
Discussion: https://postgr.es/m/CAJ7c6TOmmFpb6ohurLhTC7hKNJWGzdwf8s4EAtAZxD48g-e6Jw@mail.gmail.com  

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

ci: Add 32bit build and test

commit   : ccf36ea2580f66abbc37f27d8c296861ffaad9bf    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Sep 2022 16:09:09 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 29 Sep 2022 16:09:09 -0700    

Click here for diff

It's easy enough to make changes that break on 32bit platforms and few people  
test that locally. Add a test for that to CI. LLVM is disabled on 32bit  
because installing it would bloat the image size further.  
  
The debian w/ meson task is fast enough that we can afford to test both.  
  
Use the occasion of a separate run of the tests to run them under LANG=C,  
we've recently discovered there's not a lot of testing in the buildfarm for  
the case.  
  
Discussion: https://postgr.es/m/4033181.1664395633@sss.pgh.pa.us  

M .cirrus.yml

Fix bogus behavior of PQsslAttribute(conn, "library").

commit   : 80a05679d5a400b8f995740c175f8bdb060bb05c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 17:28:09 -0400    

Click here for diff

Commit ebc8b7d44 intended to change the behavior of  
PQsslAttribute(NULL, "library"), but accidentally also changed  
what happens with a non-NULL conn pointer.  Undo that so that  
only the intended behavior change happens.  Clarify some  
associated documentation.  
  
Per bug #17625 from Heath Lord.  Back-patch to v15.  
  
Discussion: https://postgr.es/m/17625-fc47c78b7d71b534@postgresql.org  

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

Improve wording of log messages triggered by max_slot_wal_keep_size.

commit   : 551aa6b7b9f3b78e7b6cbab1fea70947fa7f4966    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 13:27:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 13:27:48 -0400    

Click here for diff

The one about "terminating process to release replication slot" told  
you nothing about why that was happening.  The one about "invalidating  
slot because its restart_lsn exceeds max_slot_wal_keep_size" told you  
what was happening, but violated our message style guideline about  
keeping the primary message short.  Add DETAIL/HINT lines to carry  
the appropriate detail and make the two cases more uniform.  
  
While here, fix bogus test logic in 019_replslot_limit.pl: if it timed  
out without seeing the expected log message, no test failure would be  
reported.  This is flat broken since commit 549ec201d removed the test  
counts; even before that it was horribly bad style, since you'd only  
get told that not all tests had been run.  
  
Kyotaro Horiguchi, reviewed by Bertrand Drouvot; test fixes by me  
  
Discussion: https://postgr.es/m/20211214.130456.2233153190058148084.horikyota.ntt@gmail.com  

M src/backend/replication/slot.c
M src/test/recovery/t/019_replslot_limit.pl

Use actual backend IDs in pg_stat_get_backend_idset() and friends.

commit   : d7e39d72ca1c6f188b400d7d58813ff5b5b79064    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 12:14:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 29 Sep 2022 12:14:39 -0400    

Click here for diff

Up to now, the ID values returned by pg_stat_get_backend_idset() and  
used by pg_stat_get_backend_activity() and allied functions were just  
indexes into a local array of sessions seen by the last stats refresh.  
This is problematic for a few reasons.  The "ID" of a session can vary  
over its existence, which is surprising.  Also, while these numbers  
often match the "backend ID" used for purposes like temp schema  
assignment, that isn't reliably true.  We can fairly cheaply switch  
things around to make these numbers actually be the sessions' backend  
IDs.  The added test case illustrates that with this definition, the  
temp schema used by a given session can be obtained given its PID.  
  
While here, delete some dead code that guarded against getting  
a NULL return from pgstat_fetch_stat_local_beentry().  That can't  
happen as long as the caller is careful to pass an in-range array  
index, as all the callers are.  (This code may not have been dead  
when written, but it surely is now.)  
  
Nathan Bossart  
  
Discussion: https://postgr.es/m/20220815205811.GA250990@nathanxps13  

M doc/src/sgml/monitoring.sgml
M src/backend/utils/activity/backend_status.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/utils/backend_status.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Update comment in ExecInsert() regarding batch insertion.

commit   : d5e3fe682ac327ae2c0682a931f95e946ae13487    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 29 Sep 2022 16:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 29 Sep 2022 16:55:00 +0900    

Click here for diff

Remove the stale text that is a leftover from an earlier version of the  
patch to add support for batch insertion, and adjust the wording in the  
remaining text.  
  
Back-patch to v14 where batch insertion came in.  
  
Review and wording adjustment by Tom Lane.  
  
Discussion: https://postgr.es/m/CAPmGK14goatHPHQv2Aeu_UTKqZ%2BBO%2BP%2Bzd3HKv5D%2BdyyfWKDSw%40mail.gmail.com  

M src/backend/executor/nodeModifyTable.c

Introduce SYSTEM_USER

commit   : 0823d061b0b7f1e20fbfd48bef3c2e093493dbd4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 15:05:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 15:05:40 +0900    

Click here for diff

SYSTEM_USER is a reserved keyword of the SQL specification that,  
roughly described, is aimed at reporting some information about the  
system user who has connected to the database server.  It may include  
implementation-specific information about the means by the user  
connected, like an authentication method.  
  
This commit implements SYSTEM_USER as of auth_method:identity, where  
"auth_method" is a keyword about the authentication method used to log  
into the server (like peer, md5, scram-sha-256, gss, etc.) and  
"identity" is the authentication identity as introduced by 9afffcb (peer  
sets authn to the OS user name, gss to the user principal, etc.).  This  
format has been suggested by Tom Lane.  
  
Note that thanks to d951052, SYSTEM_USER is available to parallel  
workers.  
  
Bump catalog version.  
  
Author: Bertrand Drouvot  
Reviewed-by: Jacob Champion, Joe Conway, Álvaro Herrera, Michael Paquier  
Discussion: https://postgr.es/m/7e692b8c-0b11-45db-1cad-3afc5b57409f@amazon.com  

M doc/src/sgml/func.sgml
M src/backend/access/transam/parallel.c
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/miscadmin.h
M src/include/parser/kwlist.h
M src/test/authentication/t/001_password.pl
M src/test/kerberos/t/001_auth.pl
M src/test/regress/expected/create_view.out
M src/test/regress/sql/create_view.sql

Mark sigint_interrupt_enabled as sig_atomic_t

commit   : 5ac9e869191148741539e626b84ba7e77dc71670    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 14:28:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 14:28:13 +0900    

Click here for diff

This is a continuation of 78fdb1e, where this flag is set in the psql  
callback handler used for SIGINT.  This was previously a boolean but the  
C standard recommends the use of sig_atomic_t.  Note that this  
influences PromptInterruptContext in string.h, where the same flag is  
tracked.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58669A9EC96AA3078C2CD938F5549@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/bin/psql/common.c
M src/bin/psql/common.h
M src/include/common/string.h

windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h

commit   : b8d8a4593a3a2daa5e16e4a3634d9284fe14667f    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 21:59:15 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 21:59:15 -0700    

Click here for diff

We'd like to use precompiled headers on windows to reduce compile times. Right  
now we rely on defining UMDF_USING_NTSTATUS before including postgres.h in a few  
select places - which doesn't work with precompiled headers.  Instead define  
it globally.  
  
When UMDF_USING_NTSTATUS is defined we need to explicitly include ntstatus.h,  
winternl.h to get a comparable set of symbols. Right now these includes would  
be required in a number of non-platform-specific .c files - to avoid that,  
include them in win32_port.h. Based on my measurements that doesn't increase  
compile times measurably.  
  
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>  
Discussion: https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de  

M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/port/open.c
M src/port/win32fdatasync.c
M src/port/win32ntdll.c
M src/port/win32stat.c

meson: Implement getopt logic from autoconf

commit   : a1b3bca1c8e32c31ba1a8d1125b2eb97f750a7f0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 14:21:43 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 14:21:43 -0700    

Click here for diff

Not replacing getopt/getopt_long definitely causes issues on mingw. It's not  
as clear whether the solaris & openbsd aspect is still needed, but if not, we  
should remove it from both autoconf and meson.  
  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  

M meson.build

meson: mingw: Allow multiple definitions

commit   : caeeabd11066a360c8a9986581da320dd5aa09b9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 09:48:09 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 28 Sep 2022 09:48:09 -0700    

Click here for diff

I didn't carry this forward from the win32 template. It's not needed anymore  
for the reason stated therein, but it turns out to be required to  
e.g. override getopt. Possibly a better solution exists, but that's for later.  
  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  

M meson.build

meson: pg_regress: Define a HOST_TUPLE sufficient to make resultmap work

commit   : dfefa0e46433a2c798281826f8501895f3fa2a71    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 27 Sep 2022 12:01:35 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 27 Sep 2022 12:01:35 -0700    

Click here for diff

This doesn't end up with a triple that's exactly the same as config.guess -  
it'd be hard to achieve that and it doesn't seem required. We can't rely on  
config.guess as we don't necessarily have a /bin/sh on windows, e.g., when  
building on windows with msvc.  
  
This isn't perfect, e.g., clang works on windows as well.  But I suspect we'd  
need a bunch of other changes to make clang on windows work, and we haven't  
supported it historically.  
  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  

M src/test/regress/meson.build

meson: windows: Normalize slashes in prefix

commit   : e3a892539b2baabc1963c31605728bbbc8f8b89a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 27 Sep 2022 11:55:00 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 27 Sep 2022 11:55:00 -0700    

Click here for diff

This fixes a build issue on windows, when the prefix is set to a path with  
forward slashes. Windows python defaults to a path with a backslash, but mingw  
ucrt python defaults to a forward slash. This in turn lead to a wrong PATH set  
during tests, causing tests to fail.  
  
Reported-by: Melih Mutlu <m.melihmutlu@gmail.com>  
Discussion: http://postgr.es/m/20220928022724.erzuk5v4ai4b53do@awork3.anarazel.de  

M meson.build

Map ERROR_INVALID_NAME to ENOENT in mapping table of win32error.c

commit   : 2beae72746e6b762cb335ec4fff87e5407b3096c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 10:14:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 29 Sep 2022 10:14:47 +0900    

Click here for diff

This error can be reached when sending an incorrect file name to open()  
on Windows, resulting in a confusing errno reported.  This has been seen  
in the development of a different patch by the same author.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACWet-b8Juba0DiXwfGCyyOcohzwksahE5ebB9rcbLZKCQ@mail.gmail.com  

M src/port/win32error.c

Restore pg_pread and friends.

commit   : b6d8a60aba322678585ebe11dab072a37ac32905    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 29 Sep 2022 13:12:11 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 29 Sep 2022 13:12:11 +1300    

Click here for diff

Commits cf112c12 and a0dc8271 were a little too hasty in getting rid of  
the pg_ prefixes where we use pread(), pwrite() and vectored variants.  
  
We dropped support for ancient Unixes where we needed to use lseek() to  
implement replacements for those, but it turns out that Windows also  
changes the current position even when you pass in an offset to  
ReadFile() and WriteFile() if the file handle is synchronous, despite  
its documentation saying otherwise.  
  
Switching to asynchronous file handles would fix that, but have other  
complications.  For now let's just put back the pg_ prefix and add some  
comments to highlight the non-standard side-effect, which we can now  
describe as Windows-only.  
  
Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Discussion: https://postgr.es/m/20220923202439.GA1156054%40nathanxps13  

M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/replication/walreceiver.c
M src/backend/storage/file/fd.c
M src/backend/utils/init/miscinit.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/include/access/xlogreader.h
M src/include/port.h
M src/include/port/pg_iovec.h
M src/include/port/win32_port.h
M src/port/preadv.c
M src/port/pwritev.c
M src/port/win32pread.c
M src/port/win32pwrite.c

Restrict Datum sort optimization to byval types only

commit   : 3a5817695a8360011864c1834f8a90ffdfc7f840    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 29 Sep 2022 11:43:00 +1300    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 29 Sep 2022 11:43:00 +1300    

Click here for diff

91e9e89dc modified nodeSort.c so that it used datum sorts when the  
targetlist of the outer node contained only a single column.  That commit  
failed to recognise that the Datum returned by tuplesort_getdatum() must  
be pfree'd when the type is a byref type.  Ronan Dunklau did originally  
propose the patch with that restriction, but that, probably through my own  
fault, got lost during further development work.  
  
Due to the timing of this report (PG15 RC1 is almost out the door), let's  
just restrict the datum sort optimization to apply for byval types only.  
We might want to look harder into making this work for byref types in  
PG16.  
  
Reported-by: Önder Kalacı  
Diagnosis-by: Tom Lane  
Discussion: https://postgr.es/m/CACawEhVxe0ufR26UcqtU7GYGRuubq3p6ZWPGXL4cxy_uexpAAQ@mail.gmail.com  
Backpatch-through: 15, where 91e9e89dc was introduced.  

M src/backend/executor/nodeSort.c

doc: clarify internal behavior of RECURSIVE CTE queries

commit   : 2a66b9bfb74e522d64c066dabe4fddde0fe7425c    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 28 Sep 2022 13:14:38 -0400    

Click here for diff

Reported-by: Tom Lane  
  
Discussion: https://postgr.es/m/3976627.1662651004@sss.pgh.pa.us  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

revert "warn of SECURITY DEFINER schemas for non-sql_body funcs"

commit   : f77becbe5a99c9853b1ae7f22aa15babd01368b7    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 28 Sep 2022 13:05:21 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 28 Sep 2022 13:05:21 -0400    

Click here for diff

doc revert of commit 1703726488.  Change was applied to irrelevant  
branches, and was not detailed enough to be helpful in relevant  
branches.  
  
Reported-by: Peter Eisentraut, Noah Misch  
  
Discussion: https://postgr.es/m/a2dc9de4-24fc-3222-87d3-0def8057d7d8@enterprisedb.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

Doc: document bpchar, clarify relationship of text and varchar.

commit   : 0937f6d172921202e1b432e206e4c30775d564d8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Sep 2022 12:31:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Sep 2022 12:31:36 -0400    

Click here for diff

For some reason the "bpchar" type name was defined nowhere in  
our SGML docs, although several places refer to it in passing.  
Give it a proper mention under Character Types.  
  
While here, also provide an explanation of how the text and varchar  
types relate.  The previous wording seemed to be doing its best  
to sweep text under the rug, which doesn't seem very appropriate  
given its prominence in other parts of the docs.  
  
Minor rearrangements and word-smithing for clarity, too.  
  
Laurenz Albe and Tom Lane, per gripe from Yanliang Lei  
  
Discussion: https://postgr.es/m/120b3084.56b6.1833b5ffe4b.Coremail.msdnchina@163.com  

M doc/src/sgml/datatype.sgml

Allow callback functions to deregister themselves during a call.

commit   : 4d2a844242dcfb34e05dd0d880b1a283a514b16b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Sep 2022 11:23:14 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 28 Sep 2022 11:23:14 -0400    

Click here for diff

Fetch the next-item pointer before the call not after, so that  
we aren't dereferencing a dangling pointer if the callback  
deregistered itself during the call.  The risky coding pattern  
appears in CallXactCallbacks, CallSubXactCallbacks, and  
ResourceOwnerReleaseInternal.  (There are some other places that  
might be at hazard if they offered deregistration functionality,  
but they don't.)  
  
I (tgl) considered back-patching this, but desisted because it  
wouldn't be very safe for extensions to rely on this working in  
pre-v16 branches.  
  
Hao Wu  
  
Discussion: https://postgr.es/m/CAH+9SWXTiERkmhRke+QCcc+jRH8d5fFHTxh8ZK0-Yn4BSpyaAg@mail.gmail.com  

M src/backend/access/transam/xact.c
M src/backend/utils/resowner/resowner.c

Change some errdetail() to errdetail_internal()

commit   : d84a7b290f866b3f16cbefb0fca31b69ebace98a    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 28 Sep 2022 17:14:53 +0200    

Click here for diff

This prevents marking the argument string for translation for gettext,  
and it also prevents the given string (which is already translated) from  
being translated at runtime.  
  
Also, mark the strings used as arguments to check_rolespec_name for  
translation.  
  
Backpatch all the way back as appropriate.  None of this is caught by  
any tests (necessarily so), so I verified it manually.  

M src/backend/catalog/dependency.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/user.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/jsonfuncs.c
M src/common/jsonapi.c

Fix bug in DROP OWNED BY.

commit   : 7188b9b0fdbb4dd99915626f171d820a56b98514    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 10:42:07 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 10:42:07 -0400    

Click here for diff

Commit 6566133c5f52771198aca07ed18f84519fac1be7 broke the case where  
the role passed to DROP OWNED BY owns a database.  
  
Report by Rushabh Lathia, who also provided a patch, but this patch  
takes a slightly different approach to fixing the problem.  
  
Discussion: http://postgr.es/m/CAGPqQf2vO+nbo=3yAdZ8v26Rbug7bY4YjPaPLZx=L1NZ9-CC3w@mail.gmail.com  

M src/backend/catalog/pg_shdepend.c
M src/bin/scripts/t/020_createdb.pl

Revert 56-bit relfilenode change and follow-up commits.

commit   : a448e49bcbe40fb72e1ed85af910dd216d45bad8    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 09:45:27 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 09:45:27 -0400    

Click here for diff

There are still some alignment-related failures in the buildfarm,  
which might or might not be able to be fixed quickly, but I've also  
just realized that it increased the size of many WAL records by 4 bytes  
because a block reference contains a RelFileLocator. The effect of that  
hasn't been studied or discussed, so revert for now.  

M contrib/pg_buffercache/Makefile
M contrib/pg_buffercache/meson.build
D contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/gen_node_support.pl
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/scripts/t/090_reindexdb.pl
M src/common/relpath.c
M src/fe_utils/option_utils.c
M src/include/access/transam.h
M src/include/access/xlog.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/common/relpath.h
M src/include/fe_utils/option_utils.h
M src/include/storage/buf_internals.h
M src/include/storage/relfilelocator.h
M src/include/storage/sinval.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/fast_default.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/fast_default.sql

Fix InitializeRelfilenumberMap for 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c

commit   : 6af082723277eeca74f2da65e7759666bf7c7f9c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 08:02:30 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 08:02:30 -0400    

Click here for diff

Since relfilenodes are now 56-bits, we use bigint as the SQL type  
to represent them, which means F_INT8EQ must be used here rather  
than F_OIDEQ. On 64-bit machines this doesn't matter, but 32-bit  
machines are unhappy.  
  
Dilip Kumar  
  
Discussion: http://postgr.es/m/CAFiTN-t71ciSckMzixAhrF9py7oRO6xszKi4mTRwjuucXr5tpw@mail.gmail.com  

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

Fix alignment problems with SharedInvalSmgrMsg.

commit   : 0222be137188ac3912d244d832a328be0944f3e9    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 07:51:48 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 28 Sep 2022 07:51:48 -0400    

Click here for diff

SharedInvalSmgrMsg can't require 8-byte alignment, because then  
SharedInvalidationMessage will require 8-byte alignment, which will  
then cause ParseCommitRecord to fail on machines that are picky  
about alignment, because it assumes that everything that gets  
packed into a commit record requires only 4-byte alignment.  
  
Another problem with 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.  
  
Discussion: http://postgr.es/m/3825454.1664310917@sss.pgh.pa.us  

M src/backend/utils/cache/inval.c
M src/include/storage/sinval.h

Remove publicationcmds.c's expr_allowed_in_node as a function

commit   : d0b1dbcb98454a353919d789c71c6d9a89e961eb    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 28 Sep 2022 13:47:25 +0200    

Click here for diff

Its API is quite strange, and since there's only one caller, there's no  
reason for it to be a separate function in the first place.  Inline it  
instead.  
  
Discussion: https://postgr.es/m/20220927124249.4zdzzlz6had7k3x2@alvherre.pgsql  

M src/backend/commands/publicationcmds.c

Fix some comments of do_pg_backup_start() and do_pg_backup_stop()

commit   : 2e560b974ec7f7e8fe47e765e7c276422015ff3b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Sep 2022 09:58:44 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 28 Sep 2022 09:58:44 +0900    

Click here for diff

Both functions referred to an incorrect variable name, so make the whole  
more consistent.  
  
Oversight in 7d70809.  
  
Author: Kyotaro Horiguchi, Bharath Rupireddy  
Discussion: https://postgr.es/m/20220927.172427.467118514018439476.horikyota.ntt@gmail.com  

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

In BufTagGetForkNum, cast to the correct type.

commit   : 0aaa7cf6989ef6709f2bade96c4c43c7195afe17    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 16:12:43 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 16:12:43 -0400    

Click here for diff

Another defect in 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.  
  
Per CI, via Justin Pryzby.  
  
Discussion: http://postgr.es/m/20220927200712.GH6256@telsasoft.com  

M src/include/storage/buf_internals.h

Update pg_buffercache's meson.build.

commit   : 99164b7ea6bb396f4df569eb7c07664b74b66f19    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 15:31:36 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 15:31:36 -0400    

Click here for diff

Commit 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c needed to do this,  
but didn't.  
  
Per Justin Pryzby.  
  
Discussion: 20220927191710.GG6256@telsasoft.com  

M contrib/pg_buffercache/meson.build

Fix typos in commit 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c.

commit   : 4667d97ca624b257f690e8d369b242b380f53a09    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 15:13:34 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 15:13:34 -0400    

Click here for diff

Reported by Justin Pryzby.  
  
Discussion: http://postgr.es/m/20220927185121.GE6256@telsasoft.com  

M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/storage.c
M src/fe_utils/option_utils.c

Convert *GetDatum() and DatumGet*() macros to inline functions

commit   : c8b2ef05f481ef06326d7b9f3eb14b303f215c7e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 27 Sep 2022 20:47:07 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 27 Sep 2022 20:47:07 +0200    

Click here for diff

The previous macro implementations just cast the argument to a target  
type but did not check whether the input type was appropriate.  The  
function implementation can do better type checking of the input type.  
  
For the *GetDatumFast() macros, converting to an inline function  
doesn't work in the !USE_FLOAT8_BYVAL case, but we can use  
AssertVariableIsOfTypeMacro() to get a similar level of type checking.  
  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Include common/relpath.h in utils/relfilenumbermap.h

commit   : 8caf96de0b7b4ad5beb02b36a158196520c035a7    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 13:34:23 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 13:34:23 -0400    

Click here for diff

Buildfarm member crake ran headerscheck, which complained about  
a missing include here.  
  
Defect introduced by commit 2f47715cc8649f854b1df28dfc338af9801db217.  

M src/include/utils/relfilenumbermap.h

Increase width of RelFileNumbers from 32 bits to 56 bits.

commit   : 05d4cbf9b6ba708858984b01ca0fc56d59d4ec7c    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 13:25:21 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 13:25:21 -0400    

Click here for diff

RelFileNumbers are now assigned using a separate counter, instead of  
being assigned from the OID counter. This counter never wraps around:  
if all 2^56 possible RelFileNumbers are used, an internal error  
occurs. As the cluster is limited to 2^64 total bytes of WAL, this  
limitation should not cause a problem in practice.  
  
If the counter were 64 bits wide rather than 56 bits wide, we would  
need to increase the width of the BufferTag, which might adversely  
impact buffer lookup performance. Also, this lets us use bigint for  
pg_class.relfilenode and other places where these values are exposed  
at the SQL level without worrying about overflow.  
  
This should remove the need to keep "tombstone" files around until  
the next checkpoint when relations are removed. We do that to keep  
RelFileNumbers from being recycled, but now that won't happen  
anyway. However, this patch doesn't actually change anything in  
this area; it just makes it possible for a future patch to do so.  
  
Dilip Kumar, based on an idea from Andres Freund, who also reviewed  
some earlier versions of the patch. Further review and some  
wordsmithing by me. Also reviewed at various points by Ashutosh  
Sharma, Vignesh C, Amul Sul, Álvaro Herrera, and Tom Lane.  
  
Discussion: http://postgr.es/m/CA+Tgmobp7+7kmi4gkq7Y+4AM9fTvL+O1oQ4-5gFTT+6Ng-dQ=g@mail.gmail.com  

M contrib/pg_buffercache/Makefile
A contrib/pg_buffercache/pg_buffercache–1.3–1.4.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/sql/pg_walinspect.sql
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pgbuffercache.sgml
M doc/src/sgml/storage.sgml
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/README
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/catalog/catalog.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/storage.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/nodes/gen_node_support.pl
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/file/reinit.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/lmgr/lwlocknames.txt
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/misc/pg_controldata.c
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/scripts/t/090_reindexdb.pl
M src/common/relpath.c
M src/fe_utils/option_utils.c
M src/include/access/transam.h
M src/include/access/xlog.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_class.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_proc.dat
M src/include/common/relpath.h
M src/include/fe_utils/option_utils.h
M src/include/storage/buf_internals.h
M src/include/storage/relfilelocator.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/fast_default.out
M src/test/regress/expected/oidjoins.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/fast_default.sql

Move RelFileNumber declarations to common/relpath.h.

commit   : 2f47715cc8649f854b1df28dfc338af9801db217    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 12:01:57 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 27 Sep 2022 12:01:57 -0400    

Click here for diff

Previously, these were declared in postgres_ext.h, but they are not  
needed nearly so widely as the OID declarations, so that doesn't  
necessarily make sense. Also, because postgres_ext.h is included  
before most of c.h has been processed, the previous location creates  
some problems for a pending patch.  
  
Patch by me, reviewed by Dilip Kumar.  
  
Discussion: http://postgr.es/m/CA+TgmoYc8oevMqRokZQ4y_6aRn-7XQny1JBr5DyWR_jiFtONHw@mail.gmail.com  

M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/include/catalog/binary_upgrade.h
M src/include/common/relpath.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/postgres_ext.h
M src/include/utils/relcache.h

Renumber GUC flags for a bit more sanity.

commit   : 7ac918ada0037fc1101456271b3e7d0982d6a375    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 27 Sep 2022 11:51:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 27 Sep 2022 11:51:06 -0400    

Click here for diff

Push the units fields over to the left so that all the single-bit  
flags can be together.  I considered rearranging the single-bit  
flags to try to group flags with similar purposes, but eventually  
decided that that involved too many judgment calls.  
  
Discussion: https://postgr.es/m/17385-9ee529fb091f0ce5@postgresql.org  

M src/include/utils/guc.h

Introduce GUC_NO_RESET flag.

commit   : 385366426511399a91da327c0f04765bbcfd5322    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 27 Sep 2022 11:47:12 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 27 Sep 2022 11:47:12 -0400    

Click here for diff

Previously, the transaction-property GUCs such as transaction_isolation  
could be reset after starting a transaction, because we marked them  
as GUC_NO_RESET_ALL but still allowed a targeted RESET.  That leads to  
assertion failures or worse, because those properties aren't supposed  
to change after we've acquired a transaction snapshot.  
  
There are some NO_RESET_ALL variables for which RESET is okay, so  
we can't just redefine the semantics of that flag.  Instead introduce  
a separate GUC_NO_RESET flag.  Mark "seed", as well as the transaction  
property GUCs, as GUC_NO_RESET.  
  
We have to disallow GUC_ACTION_SAVE as well as straight RESET, because  
otherwise a function having a "SET transaction_isolation" clause can  
still break things: the end-of-function restore action is equivalent  
to a RESET.  
  
No back-patch, as it's conceivable that someone is doing something  
this patch will forbid (like resetting one of these GUCs at transaction  
start, or "CREATE FUNCTION ... SET transaction_read_only = 1") and not  
running into problems with it today.  Given how long we've had this  
issue and not noticed, the side effects in non-assert builds can't be  
too serious.  
  
Per bug #17385 from Andrew Bille.  
  
Masahiko Sawada  
  
Discussion: https://postgr.es/m/17385-9ee529fb091f0ce5@postgresql.org  

M doc/src/sgml/func.sgml
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_tables.c
M src/include/utils/guc.h
M src/pl/plpgsql/src/expected/plpgsql_transaction.out
M src/pl/plpgsql/src/sql/plpgsql_transaction.sql
M src/test/regress/expected/guc.out
M src/test/regress/expected/transactions.out
M src/test/regress/sql/guc.sql
M src/test/regress/sql/transactions.sql

commit   : 4148c8b3daf95ca308f055e103f6ee82e25b8f99    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 27 Sep 2022 14:11:31 +0200    

Click here for diff

While at it, remove an unused queryString parameter from  
CheckPubRelationColumnList() and make other minor stylistic changes.  
  
Backpatch to 15.  
  
Reported by Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Co-authored-by: Hou zj <houzj.fnst@fujitsu.com>  
Discussion: https://postgr.es/m/20220926.160426.454497059203258582.horikyota.ntt@gmail.com  

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

Fix pg_stat_statements for MERGE

commit   : 249b0409b181311bb1c375311e43eb767b5c3bdd    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 27 Sep 2022 10:44:42 +0200    

Click here for diff

We weren't jumbling the merge action list, so wildly different commands  
would be considered to use the same query ID.  Add that, mention it in  
the docs, and some test lines.  
  
Backpatch to 15.  
  
Author: Tatsu <bt22nakamorit@oss.nttdata.com>  
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>  
Discussion: https://postgr.es/m/d87e391694db75a038abc3b2597828e8@oss.nttdata.com  

M contrib/pg_stat_statements/expected/pg_stat_statements.out
M contrib/pg_stat_statements/sql/pg_stat_statements.sql
M doc/src/sgml/pgstatstatements.sgml
M src/backend/nodes/nodeFuncs.c
M src/backend/utils/misc/queryjumble.c

ci: Add hint about downloadable logs to README

commit   : bed0927aeb0c61bd8649b56e5b84a6d551d5f416    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 20:02:26 -0700    

Click here for diff

I (Andres) chose to backpatch this to 15, as it seems better to keep the  
README the same.  
  
Author: James Coleman <jtc331@gmail.com>  
Discussion: https://postgr.es/m/CAAaqYe_7BXDjpk0Ks_eqf1r6LZpC_rfB7kjhb_T3+eC4t6yiGQ@mail.gmail.com  
Backpatch: 15-, where CI came in  

M src/tools/ci/README

meson: Set up absolute rpaths to libdir

commit   : a1860071b3fc6b9475a09f0c306e432249bb8314    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 19:44:05 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 19:44:05 -0700    

Click here for diff

While I (Andres) had planned to use relative rpaths, it looks like agreeing on  
the precise path might take a bit. So set up absolute rpaths for now.  
  
I'm pushing this fairly quickly after posting the patch as several hackers  
fought with this issue.  
  
Discussion: https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de  

M meson.build

meson: Include CFLAGS/c_args in summary and pg_config output

commit   : 1330dcdec0f22fb2b7a621f9a0e6e729e21d50a4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 19:36:24 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 19:36:24 -0700    

Click here for diff

Previously arguments passed in via CFLAGS/-Dc_args were neither displayed in  
meson's summary, nor in pg_config's output.  
  
Reported-by: "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>  
Discussion: https://postgr.es/m/OS3PR01MB62751847BC9CD2DB7B29AC129E529@OS3PR01MB6275.jpnprd01.prod.outlook.com  

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

Mark ParallelMessagePending as sig_atomic_t

commit   : 78fdb1e50f7fd394505a400b507f70ecffa6d7bf    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Sep 2022 09:29:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Sep 2022 09:29:56 +0900    

Click here for diff

ParallelMessagePending was previously marked as a boolean which should  
be fine on modern platforms, but the C standard recommends the use of  
sig_atomic_t for variables manipulated in signal handlers.  
  
Author: Hayato Kuroda  
Discussion: https://postgr.es/m/TYAPR01MB58667C15A95A234720F4F876F5529@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/backend/access/transam/parallel.c
M src/include/access/parallel.h

Remove dependency to StringInfo in xlogbackup.{c.h}

commit   : e1e6f8f3dfe141839220875270a81ad3a719e0b6    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Sep 2022 09:15:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 27 Sep 2022 09:15:07 +0900    

Click here for diff

This was used as the returned result type of the generated contents for  
the backup_label and backup history files.  This is replaced by a simple  
string, reducing the cleanup burden of all the callers of  
build_backup_content().  
  
Reviewed-by: Bharath Rupireddy  
Discussion: https://postgr.es/m/YzERvNPaZivHEKZJ@paquier.xyz  

M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/backup/basebackup.c
M src/include/access/xlogbackup.h

windows: remove date from version number in win32ver.rc

commit   : 31d2c4716e6b429353bb81cebaa0f2b1267823d6    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 11:38:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 26 Sep 2022 11:38:02 -0700    

Click here for diff

This may have served a purpose at some point, but these days it just  
contributes to a non-reproducible build.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/c5736f70-bb6d-8d25-e35c-e3d886e4e905@enterprisedb.com  
Discussion: https://postgr.es/m/1cef5b48-32bd-5cbf-fb62-fb648860f5ef@enterprisedb.com  

M src/makefiles/Makefile.win32
M src/tools/msvc/Project.pm

Doc: further adjust notes about pg_upgrade_output.d.

commit   : fbd2bd15b0114bb900aa6986add2b359fec1b740    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Sep 2022 14:19:21 -0400    

Click here for diff

I'd misunderstood how it worked in 5f1048881.  
  
Discussion: https://postgr.es/m/20220925215009.GC21938@telsasoft.com  

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

Enable WRITE_READ_PARSE_PLAN_TREES of rewritten utility statements

commit   : 787102b5637389b10c220b08992a6a064ac319c6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    

Click here for diff

This was previously disabled because we lacked outfuncs/readfuncs  
support for most utility statement types.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

M src/backend/tcop/postgres.c

Implement WRITE_READ_PARSE_PLAN_TREES for raw parse trees

commit   : 40ad8f9deed21f02b23eb034bfca87f7acc7562b    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 16:32:16 +0200    

Click here for diff

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

M src/backend/tcop/postgres.c

Don't lose precision for float fields of Nodes.

commit   : acd624644bc4f957824abcd00f6af27861b03a29    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 16:02:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 16:02:09 +0200    

Click here for diff

Historically we've been more worried about making the output of  
float fields look pretty than whether they'd be read back exactly.  
That won't work if we're to compare the read-back nodes for  
equality, so switch to using the Ryu code for float output.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/outfuncs.c

catversion bump

commit   : c07785d458c1ca69ad7cd3ebb8f4a1d953c3779b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 15:56:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 15:56:47 +0200    

Click here for diff

for 8999f5ed3cd7d26be1121d912086d04d134d398b  

M src/include/catalog/catversion.h

Fix write/read of empty string fields in Nodes.

commit   : 8999f5ed3cd7d26be1121d912086d04d134d398b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 15:25:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 26 Sep 2022 15:25:59 +0200    

Click here for diff

Historically, outToken has represented both NULL and empty-string  
strings as "<>", which readfuncs.c then read as NULL, thus failing  
to preserve empty-string fields accurately.  Remarkably, this has  
not caused any serious problems yet, but let's fix it.  
  
We'll keep the "<>" notation for NULL, and use """" for empty string,  
because that matches other notational choices already in use.  
An actual input string of """" is converted to "\""" (this was true  
already, apparently as a hangover from an ancient time when string  
quoting was handled directly by pg_strtok).  
  
CHAR fields also use "<>", but for '\0'.  
  
Author: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

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

Remove unused xid parameter.

commit   : af51b2f042a0808943125b82c0d6e785259069f2    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 26 Sep 2022 08:47:00 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 26 Sep 2022 08:47:00 +0530    

Click here for diff

Commit 6c2003f8a1 removes the use of transaction id's for exporting  
snapshots. This commit removes one unused xid parameter left behind in  
SnapBuildGetOrBuildSnapshot.  
  
Author: Melih Mutlu  
Reviewed-By: Zhang Mingli  
Discussion: https://postgr.es/m/CAGPVpCTqZRoDKgCycw+eYi+Gq41rN9pU-gntgTd7wfsNDpPL3Q@mail.gmail.com  

M src/backend/replication/logical/decode.c
M src/backend/replication/logical/snapbuild.c
M src/include/replication/snapbuild.h

Refactor creation of backup_label and backup history files

commit   : 7d708093b7400327658a30d1aa1d5e284d37622c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Sep 2022 11:15:47 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 26 Sep 2022 11:15:47 +0900    

Click here for diff

This change simplifies some of the logic related to the generation and  
creation of the backup_label and backup history files, which has become  
unnecessarily complicated since the removal of the exclusive backup mode  
in commit 39969e2.  The code was previously generating the contents of  
these files as a string (start phase for the backup_label and stop phase  
for the backup history file), one problem being that the contents of the  
backup_label string were scanned to grab some of its internal contents  
at the stop phase.  
  
This commit changes the logic so as we store the data required to build  
these files in an intermediate structure named BackupState.  The  
backup_label file and backup history file strings are generated when  
they are ready to be sent back to the client.  Both files are now  
generated with the same code path.  While on it, this commit renames  
some variables for clarity.  
  
Two new files named xlogbackup.{c,h} are introduced in this commit, to  
remove from xlog.c some of the logic around base backups.  Note that  
more could be moved to this new set of files.  
  
Author: Bharath Rupireddy, Michael Paquier  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/CALj2ACXWwTDgJqCjdaPyfR7djwm6SrybGcrZyrvojzcsmt4FFw@mail.gmail.com  

M src/backend/access/transam/Makefile
M src/backend/access/transam/meson.build
M src/backend/access/transam/xlog.c
A src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/backup/basebackup.c
M src/include/access/xlog.h
A src/include/access/xlogbackup.h
M src/tools/pgindent/typedefs.list

Fix tupdesc lifespan bug with AfterTriggersTableData.storeslot.

commit   : 216f9c1ab3a4f333632ce576e1dc1e3643427eb8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 25 Sep 2022 17:10:58 -0400    

Click here for diff

Commit 25936fd46 adjusted things so that the "storeslot" we use  
for remapping trigger tuples would have adequate lifespan, but it  
neglected to consider the lifespan of the tuple descriptor that  
the slot depends on.  It turns out that in at least some cases, the  
tupdesc we are passing is a refcounted tupdesc, and the refcount for  
the slot's reference can get assigned to a resource owner having  
different lifespan than the slot does.  That leads to an error like  
"tupdesc reference 0x7fdef236a1b8 is not owned by resource owner  
SubTransaction".  Worse, because of a second oversight in the same  
commit, we'd try to free the same tupdesc refcount again while  
cleaning up after that error, leading to recursive errors and an  
"ERRORDATA_STACK_SIZE exceeded" PANIC.  
  
To fix the initial problem, let's just make a non-refcounted copy  
of the tupdesc we're supposed to use.  That seems likely to guard  
against additional problems, since there's no strong reason for  
this code to assume that what it's given is a refcounted tupdesc;  
in which case there's an independent hazard of the tupdesc having  
shorter lifespan than the slot does.  (I didn't bother trying to  
free said copy, since it should go away anyway when the (sub)  
transaction context is cleaned up.)  
  
The other issue can be fixed by making the code added to  
AfterTriggerFreeQuery work like the rest of that function, ie be  
sure that it doesn't try to free the same slot twice in the event  
of recursive error cleanup.  
  
While here, also clean up minor stylistic issues in the test case  
added by 25936fd46: don't use "create or replace function", as any  
name collision within the tests is likely to have ill effects  
that that won't mask; and don't use function names as generic as  
trigger_function1, especially if you're not going to drop them  
at the end of the test stanza.  
  
Per bug #17607 from Thomas Mc Kay.  Back-patch to v12, as the  
previous fix was.  
  
Discussion: https://postgr.es/m/17607-bd8ccc81226f7f80@postgresql.org  

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

Avoid loss of code coverage with unlogged-index test cases.

commit   : 1d2fec990c4dd6da8ffe5ca6b3c2aed2553197fb    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 25 Sep 2022 13:10:10 -0400    

Click here for diff

Commit 4fb5c794e intended to add coverage of some ambuildempty  
methods that were not getting reached, without removing any  
test coverage.  However, by changing a temp table to unlogged  
it managed to negate the intent of 4c51a2d1e, which means that  
we didn't have reliable test coverage of ginvacuum.c anymore.  
As things stand, much of that file might or might not get reached  
depending on timing, which seems pretty undesirable.  
  
Although this is only clearly broken for the GIN test, it seems  
best to revert 4fb5c794e altogether and instead add bespoke test  
cases covering unlogged indexes for these four AMs.  We don't  
need to do very much with them, so the extra tests are cheap.  
(Note that btree, hash, and bloom already have similar test cases,  
so they need no additional work.)  
  
We can also undo dec8ad367.  Since the testing deficiency that that  
hacked around was later fixed by 2f2e24d90, let's intentionally leave  
an unlogged table behind to improve test coverage in the modules that  
use the regression database for other test purposes.  (The case I used  
also leaves an unlogged sequence behind.)  
  
Per report from Alex Kozhemyakin.  Back-patch to v15 where the  
faulty test came in.  
  
Discussion: https://postgr.es/m/b00c8ee096ee46cd25c183125562a1a7@postgrespro.ru  

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

Add missing source files to pg_waldump/nls.mk

commit   : dda101315ad93e9b39c48eeb53b131d171d1fd0b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Sun, 25 Sep 2022 17:48:03 +0200    

Click here for diff

M src/bin/pg_waldump/nls.mk

Message style improvements

commit   : 26f7802beb2a4aafa0903f5bedeb7f1fa6f4f358    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:38:35 -0400    

Click here for diff

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_server.c
M src/backend/catalog/pg_publication.c
M src/backend/commands/dbcommands.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeModifyTable.c
M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walsender.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_xact.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.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/scripts/t/020_createdb.pl
M src/common/compression.c
M src/test/recovery/t/006_logical_decoding.pl
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/triggers.out
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/029_on_error.pl

Add read support for some missing raw parse nodes

commit   : a6bc3301925e1a8ad1f58da629b9dd55bc4b8d9c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:18:33 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:18:33 -0400    

Click here for diff

The node types A_Const, Constraint, and A_Expr had custom output  
functions, but no read functions were implemented so far.  
  
The A_Expr output format had to be tweaked a bit to make it easier to  
parse.  
  
Be a bit more cautious about applying strncmp to unterminated strings.  
  
Also error out if an unrecognized enum value is found in each case,  
instead of just printing a placeholder value.  That was maybe ok for  
debugging but won't work if we want to have robust round-tripping.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

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

Fix reading of BitString nodes

commit   : 2cb1a5a8d4aeb63da2d6a2d22169f05c60bb5828    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:10:52 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:10:52 -0400    

Click here for diff

The node tokenizer went out of its way to store BitString node values  
without the leading 'b'.  But everything else in the system stores the  
leading 'b'.  This would break if a BitString node is  
read-printed-read.  
  
Also, the node tokenizer didn't know that BitString node tokens could  
also start with 'x'.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

M src/backend/nodes/read.c

Fix reading of most-negative integer value nodes

commit   : 43f4b349152d972c711592b8e8a4645aea9625f4    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:10:11 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 24 Sep 2022 18:10:11 -0400    

Click here for diff

The main parser checks whether a literal fits into an int when  
deciding whether it should be put into an Integer or Float node.  The  
parser processes integer literals without signs.  So a most-negative  
integer literal will not fit into Integer and will end up as a Float  
node.  
  
The node tokenizer did this differently.  It included the sign when  
checking whether the literal fit into int.  So a most-negative integer  
would indeed fit that way and end up as an Integer node.  
  
In order to preserve the node structure correctly, we need the node  
tokenizer to also analyze integer literals without sign.  
  
There are a number of test cases in the regression tests that have a  
most-negative integer argument of some utility statement, so this  
issue is easily reproduced under WRITE_READ_PARSE_PLAN_TREES.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us  

M src/backend/nodes/read.c

Remove uses of register due to incompatibility with C++17 and up

commit   : 03bf971d2dc701d473705fd00891028d140dd5ae    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 12:01:06 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 12:01:06 -0700    

Click here for diff

The use in regexec.c could remain, since we only try to keep headers C++  
clean. But there really doesn't seem to be a good reason to use register in  
that spot.  
  
Discussion: https://postgr.es/m/20220308185902.ibdqmasoaunzjrfc@alap3.anarazel.de  

M .cirrus.yml
M src/backend/regex/regexec.c
M src/include/port/atomics/arch-x86.h
M src/include/storage/s_lock.h

De-special-case pgevent's rc file handling

commit   : eef63941c127bcfbc278445b85cf3d9dd9e323b0    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 12:04:56 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 12:04:56 -0700    

Click here for diff

There's really no need to build win32ver.rc as part of building  
pgmsgevent.rc. This will make it sligthly easier to add rc file generation to  
the meson build.  

M src/bin/pgevent/Makefile
M src/bin/pgevent/pgmsgevent.rc
M src/tools/msvc/Mkvcbuild.pm

meson: Remove non-binary targets accidentally added to bin_targets

commit   : a075c616d22921fd90eafa852f140df9cd832209    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 11:29:29 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 24 Sep 2022 11:29:29 -0700    

Click here for diff

M src/bin/psql/meson.build

Improve terminology

commit   : 6d6e1368722c664eef547d59ab23a29e555778c8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 23 Sep 2022 21:16:08 -0400    

Click here for diff

Use "prepared transaction" instead of "two-phrase transaction".  This  
is in line with 0e60a50e0bf158bead247731e00cee95bcf64daf.  

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

Doc: minor cleanups.

commit   : 5f1048881d5f16475b76e168bfe962682c741fb5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 23 Sep 2022 18:20:11 -0400    

Click here for diff

Improve a couple of things I noticed while working on v15  
release notes.  

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

pgstat: Fix transactional stats dropping for indexes

commit   : d811ce6ea343fa8a0b6b9cd7e9cddcbdaa27962b    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 23 Sep 2022 13:00:55 -0700    

Click here for diff

Because index creation does not go through heap_create_with_catalog() we  
didn't call pgstat_create_relation(), leading to index stats of a newly  
created realtion not getting dropped during rollback. To fix, move the  
pgstat_create_relation() to heap_create(), which indexes do use.  
  
Similarly, because dropping an index does not go through  
heap_drop_with_catalog(), we didn't drop index stats when the transaction  
dropping an index committed. Here there's no convenient common path for  
indexes and relations, so index_drop() now calls pgstat_drop_relation().  
  
Add tests for transactional index stats handling.  
  
Author: "Drouvot, Bertrand" <bdrouvot@amazon.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/51bbf286-2b4a-8998-bd12-eaae4b765d99@amazon.com  
Backpatch: 15-, like 8b1dccd37c71, which introduced the bug  

M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql

Remove PQsendQuery support in pipeline mode

commit   : 0032a5456708811ca95bd80a538f4fb72ad0dd20    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 23 Sep 2022 18:21:22 +0200    

Click here for diff

The extended query protocol implementation I added in commit  
acb7e4eb6b1c has bugs when used in pipeline mode.  Rather than spend  
more time trying to fix it, remove that code and make the function rely  
on simple query protocol only, meaning it can no longer be used in  
pipeline mode.  
  
Users can easily change their applications to use PQsendQueryParams  
instead.  We leave PQsendQuery in place for Postgres 14, just in case  
somebody is using it and has not hit the mentioned bugs; but we should  
recommend that it not be used.  
  
Backpatch to 15.  
  
Per bug report from Gabriele Varrazzo.  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c

Stop using PQsendQuery in libpq_pipeline

commit   : d11a41a4ce79660d1a1c5f81b051061717099a9f    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 23 Sep 2022 18:11:48 +0200    

Click here for diff

The "emulation" I wrote for PQsendQuery in pipeline mode to use extended  
query protocol, in commit acb7e4eb6b1c, is problematic.  Due to numerous  
bugs we'll soon remove it.  As a first step and for all branches back to  
14, stop using PQsendQuery in libpq_pipeline.  Also remove a few test  
lines that will no longer be relevant.  
  
Backpatch to 14.  
  
Discussion: https://postgr.es/m/CA+mi_8ZGSQNmW6-mk_iSR4JZB_LJ4ww3suOF+1vGNs3MrLsv4g@mail.gmail.com  

M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/traces/pipeline_abort.trace
M src/test/modules/libpq_pipeline/traces/pipeline_idle.trace

ci: freebsd: Set extra_{lib,include}_dirs to /usr/local/...

commit   : e3e6ee69641b8ea1e24f05ee64393a52e495bf86    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 22 Sep 2022 20:36:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 22 Sep 2022 20:36:28 -0700    

Click here for diff

Ommitted in e6b6ea025cc, but necessary for libintl to be found. All other  
dependencies can be found via pkg-config (which searches in /usr/local/...)  
and thus worked even without adding the directories.  

M .cirrus.yml

Allow publications with schema and table of the same schema.

commit   : 13a185f54ba594a5fb42bac3e1ecbdfd62b9041f    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 23 Sep 2022 08:21:26 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 23 Sep 2022 08:21:26 +0530    

Click here for diff

We previously thought that allowing such cases can confuse users when they  
specify DROP TABLES IN SCHEMA but that doesn't seem to be the case based  
on discussion. This helps to uplift the restriction during  
ALTER TABLE ... SET SCHEMA which used to ensure that we couldn't end up  
with a publication having both a schema and the same schema's table.  
  
To allow this, we need to forbid having any schema on a publication if  
column lists on a table are specified (and vice versa). This is because  
otherwise we still need a restriction during ALTER TABLE ... SET SCHEMA to  
forbid cases where it could lead to a publication having both a schema and  
the same schema's table with column list.  
  
Based on suggestions by Peter Eisentraut.  
  
Author: Hou Zhijie and Vignesh C  
Reviewed-By: Peter Smith, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e@enterprisedb.com  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/028_row_filter.pl

Doc: adjust misleading phrasing of a few cross-references.

commit   : d89755dac6153518a601ca0fa9e489f2bc209fdc    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 22 Sep 2022 22:05:09 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 22 Sep 2022 22:05:09 -0400    

Click here for diff

The pg_dump and pg_dumpall man pages referred to app-psql-patterns  
as appearing "below", which I suspect was copied-and-pasted from  
equivalent text in psql-ref.sgml rather than being actually thought  
through.  At least to me, that phrasing means "later in this same  
web page/section", which this link target is not.  Drop the  
misleading and unnecessary-in-any-case adjective.  

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

Harmonize parameter names in pg_dump/pg_dumpall.

commit   : 20e69daa1348f6899fffe3c260bf44293551ee87    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 16:41:23 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 16:41:23 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in pg_dump/pg_dumpall  
related code.  
  
Affected code happens to be inconsistent in how it applies conventions  
around how Archive and Archive Handle variables are named.  Significant  
code churn is required to fully fix those inconsistencies, so take the  
least invasive approach possible: treat function definition names as  
authoritative, and mechanically adjust corresponding names from function  
definitions to match.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAH2-Wzmma+vzcO6gr5NYDZ+sx0G14aU-UrzFutT2FoRaisVCUQ@mail.gmail.com  

M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dumpall.c

Harmonize parameter names in contrib code.

commit   : 0faf7d933f625eb1668dcaa518b472f722b53a55    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 13:59:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 13:59:20 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in contrib code.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M contrib/amcheck/verify_nbtree.c
M contrib/cube/cube.c
M contrib/dblink/dblink.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/intarray/_int.h
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/_int_tool.c
M contrib/ltree/ltree.h
M contrib/oid2name/oid2name.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgcrypto.c
M contrib/pgcrypto/pgp.h
M contrib/pgcrypto/px-crypt.h
M contrib/pgcrypto/px.h
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/seg/seg.c
M contrib/seg/segdata.h
M contrib/tablefunc/tablefunc.c
M contrib/test_decoding/test_decoding.c

Harmonize more lexer function parameter names.

commit   : 8fb4e001e9c185250a95b2b13880a2a04d626b75    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 13:27:16 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 13:27:16 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions for several "lexer  
adjacent" backend functions.  These were missed by commit aab06442.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/utils/adt/jsonpath_scan.l
M src/bin/pgbench/pgbench.h
M src/include/bootstrap/bootstrap.h
M src/include/parser/scanner.h
M src/include/replication/walsender_private.h
M src/test/isolation/isolationtester.h

Harmonize parameter names in ecpg code.

commit   : 3535ebce5dc542b90f14d6e81cce80fe7226bda5    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 12:53:20 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 22 Sep 2022 12:53:20 -0700    

Click here for diff

Make ecpg function declarations consistently use named parameters.  Also  
make sure that the declarations use names that match corresponding names  
from function definitions.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/include/ecpg_informix.h
M src/interfaces/ecpg/include/ecpglib.h
M src/interfaces/ecpg/include/pgtypes_date.h
M src/interfaces/ecpg/include/pgtypes_interval.h
M src/interfaces/ecpg/include/pgtypes_numeric.h
M src/interfaces/ecpg/include/pgtypes_timestamp.h
M src/interfaces/ecpg/pgtypeslib/dt.h
M src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h
M src/interfaces/ecpg/preproc/c_keywords.c
M src/interfaces/ecpg/preproc/ecpg.header
M src/interfaces/ecpg/preproc/output.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/preproc_extern.h
M src/interfaces/ecpg/preproc/type.c
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/preproc-outofscope.c
M src/interfaces/ecpg/test/expected/sql-sqlda.c

Fix race condition where heap_delete() fails to pin VM page.

commit   : 163b0993a162ebae00fe5de8f593a5da28821a1b    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 22 Sep 2022 10:58:49 -0700    

Click here for diff

Similar to 5f12bc94dc, the code must re-check PageIsAllVisible() after  
buffer lock is re-acquired. Backpatching to the same version, 12.  
  
Discussion: https://postgr.es/m/CAEP4nAw9jYQDKd_5Y+-s2E4YiUJq1vqiikFjYGpLShtp-K3gag@mail.gmail.com  
Reported-by: Robins Tharakan  
Reviewed-by: Robins Tharakan  
Backpatch-through: 12  

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

Remove ALL keyword from TABLES IN SCHEMA for publication

commit   : 790bf615ddba8a0ba3b870915d03438ce9cb7860    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 22 Sep 2022 19:02:25 +0200    

Click here for diff

This may be a bit too subtle, but removing that word from there makes  
this clause no longer a perfect parallel of the GRANT variant "ALL  
TABLES IN SCHEMA": indeed, for publications what we record is the schema  
itself, not the tables therein, which means that any tables added to the  
schema in the future are also published.  This is completely different  
to what GRANT does, which is affect only the tables that exist when the  
command is executed.  
  
There isn't resounding support for this change, but there are a few  
positive votes and no opposition.  Because the time to 15 RC1 is very  
short, let's get this out now.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e  

M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/ref/create_subscription.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/pg_publication.c
M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/tab-complete.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/object_address.out
M src/test/regress/expected/publication.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/object_address.sql
M src/test/regress/sql/publication.sql
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/031_column_list.pl

Restore archive_command documentation

commit   : ba50834551f936719450a287c0d7f1d0d769e9c9    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 17 Sep 2022 11:34:20 +0200    

Click here for diff

Commit 5ef1eefd76f404ddc59b885d50340e602b70f05f, which added  
archive_library, purged most mentions of archive_command from the  
documentation.  This is inappropriate, since archive_command is still  
a feature in use and users will want to see information about it.  
  
This restores all the removed mentions and rephrases things so that  
archive_command and archive_library are presented as alternatives of  
each other.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/9366d634-a917-85a9-4991-b2a4859edaf9@enterprisedb.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pg_receivewal.sgml
M doc/src/sgml/wal.sgml

Use min/max bounds defined by Zstd for compression level

commit   : 18ac08f0b42de3cf35f07199c9f482746c8b12c0    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 20:02:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 20:02:40 +0900    

Click here for diff

The bounds hardcoded in compression.c since ffd5365 (minimum at 1 and  
maximum at 22) do not match the reality of what zstd is able to  
handle, these values being available via ZSTD_maxCLevel() and  
ZSTD_minCLevel() at run-time.  The maximum of 22 is actually correct  
in recent versions, but the minimum was not as the library can go down  
to -131720 by design.  This commit changes the code to use the run-time  
values in the code instead of some hardcoded ones.  
  
Zstd seems to assume that these bounds could change in the future, and  
Postgres will be able to adapt automatically to such changes thanks to  
what's being done in this commit.  
  
Reported-by: Justin Prysby  
Discussion: https://postgr.es/m/20220922033716.GL31833@telsasoft.com  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/common/compression.c

Fix thinko in comment.

commit   : cbe6dd17ac453fece214b2a430b354d4f7d5a15d    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 22 Sep 2022 15:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Thu, 22 Sep 2022 15:55:00 +0900    

Click here for diff

This comment has been wrong since its introduction in commit 0d5f05cde;  
backpatch to v12 where that came in.  
  
Discussion: https://postgr.es/m/CAPmGK14VGf-xQjGQN4o1QyAbXAaxugU5%3DqfcmTDh1iufUDnV_w%40mail.gmail.com  

M src/backend/commands/copyfrom.c

meson: ci: Convert some tasks to use meson

commit   : e6b6ea025cc0b6e5cdb7a3bf6d9275afdd861e51    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 21:53:18 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 21:53:18 -0700    

Click here for diff

The Windows task is changed to use meson as there currently is no way to run  
all tests in the old MSVC build system (only ninja is covered for now, we  
don't have enough CI resources to test msbuild as well).  
  
To maintain autoconf coverage, the Linux task is duplicated to test both meson  
and autoconf builds (linux is currently the fastest task). FreeBSD and macOS  
are also converted to meson, as it seems more important to have coverage for  
meson than autoconf.  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Author: Justin Pryzby <pryzby@telsasoft.com>  

M .cirrus.yml

meson: Add initial version of meson based build system

commit   : e6927270cd18d535b77cbe79c55c6584351524be    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 21:53:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 21:53:12 -0700    

Click here for diff

Autoconf is showing its age, fewer and fewer contributors know how to wrangle  
it. Recursive make has a lot of hard to resolve dependency issues and slow  
incremental rebuilds. Our home-grown MSVC build system is hard to maintain for  
developers not using Windows and runs tests serially. While these and other  
issues could individually be addressed with incremental improvements, together  
they seem best addressed by moving to a more modern build system.  
  
After evaluating different build system choices, we chose to use meson, to a  
good degree based on the adoption by other open source projects.  
  
We decided that it's more realistic to commit a relatively early version of  
the new build system and mature it in tree.  
  
This commit adds an initial version of a meson based build system. It supports  
building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD,  
Solaris and Windows (however only gcc is supported on aix, solaris). For  
Windows/MSVC postgres can now be built with ninja (faster, particularly for  
incremental builds) and msbuild (supporting the visual studio GUI, but  
building slower).  
  
Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM  
bitcode generation, documentation adjustments) are done in subsequent commits  
requiring further review. Other aspects (e.g. not installing test-only  
extensions) are not yet addressed.  
  
When building on Windows with msbuild, builds are slower when using a visual  
studio version older than 2019, because those versions do not support  
MultiToolTask, required by meson for intra-target parallelism.  
  
The plan is to remove the MSVC specific build system in src/tools/msvc soon  
after reaching feature parity. However, we're not planning to remove the  
autoconf/make build system in the near future. Likely we're going to keep at  
least the parts required for PGXS to keep working around until all supported  
versions build with meson.  
  
Some initial help for postgres developers is at  
https://wiki.postgresql.org/wiki/Meson  
  
With contributions from Thomas Munro, John Naylor, Stone Tickle and others.  
  
Author: Andres Freund <andres@anarazel.de>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Author: Peter Eisentraut <peter@eisentraut.org>  
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de  

A config/meson.build
M configure
M configure.ac
A contrib/adminpack/meson.build
A contrib/amcheck/meson.build
A contrib/auth_delay/meson.build
A contrib/auto_explain/meson.build
A contrib/basebackup_to_shell/meson.build
A contrib/basic_archive/meson.build
A contrib/bloom/meson.build
A contrib/bool_plperl/meson.build
A contrib/btree_gin/meson.build
A contrib/btree_gist/meson.build
A contrib/citext/meson.build
A contrib/cube/meson.build
A contrib/dblink/meson.build
A contrib/dict_int/meson.build
A contrib/dict_xsyn/meson.build
A contrib/earthdistance/meson.build
A contrib/file_fdw/meson.build
A contrib/fuzzystrmatch/meson.build
A contrib/hstore/meson.build
A contrib/hstore_plperl/meson.build
A contrib/hstore_plpython/meson.build
A contrib/intagg/meson.build
A contrib/intarray/meson.build
A contrib/isn/meson.build
A contrib/jsonb_plperl/meson.build
A contrib/jsonb_plpython/meson.build
A contrib/lo/meson.build
A contrib/ltree/meson.build
A contrib/ltree_plpython/meson.build
A contrib/meson.build
A contrib/oid2name/meson.build
A contrib/old_snapshot/meson.build
A contrib/pageinspect/meson.build
A contrib/passwordcheck/meson.build
A contrib/pg_buffercache/meson.build
A contrib/pg_freespacemap/meson.build
A contrib/pg_prewarm/meson.build
A contrib/pg_stat_statements/meson.build
A contrib/pg_surgery/meson.build
A contrib/pg_trgm/meson.build
A contrib/pg_visibility/meson.build
A contrib/pg_walinspect/meson.build
A contrib/pgcrypto/meson.build
A contrib/pgrowlocks/meson.build
A contrib/pgstattuple/meson.build
A contrib/postgres_fdw/meson.build
A contrib/seg/meson.build
A contrib/sepgsql/meson.build
A contrib/spi/meson.build
A contrib/sslinfo/meson.build
A contrib/tablefunc/meson.build
A contrib/tcn/meson.build
A contrib/test_decoding/meson.build
A contrib/tsm_system_rows/meson.build
A contrib/tsm_system_time/meson.build
A contrib/unaccent/meson.build
A contrib/uuid-ossp/meson.build
A contrib/vacuumlo/meson.build
A contrib/xml2/meson.build
A doc/src/sgml/meson.build
A doc/src/sgml/version.sgml.in
A meson.build
A meson_options.txt
A src/backend/access/brin/meson.build
A src/backend/access/common/meson.build
A src/backend/access/gin/meson.build
A src/backend/access/gist/meson.build
A src/backend/access/hash/meson.build
A src/backend/access/heap/meson.build
A src/backend/access/index/meson.build
A src/backend/access/meson.build
A src/backend/access/nbtree/meson.build
A src/backend/access/rmgrdesc/meson.build
A src/backend/access/spgist/meson.build
A src/backend/access/table/meson.build
A src/backend/access/tablesample/meson.build
A src/backend/access/transam/meson.build
A src/backend/backup/meson.build
A src/backend/bootstrap/meson.build
A src/backend/catalog/meson.build
A src/backend/commands/meson.build
A src/backend/executor/meson.build
A src/backend/foreign/meson.build
A src/backend/jit/llvm/meson.build
A src/backend/jit/meson.build
A src/backend/lib/meson.build
A src/backend/libpq/meson.build
A src/backend/main/meson.build
A src/backend/meson.build
A src/backend/nodes/meson.build
A src/backend/optimizer/geqo/meson.build
A src/backend/optimizer/meson.build
A src/backend/optimizer/path/meson.build
A src/backend/optimizer/plan/meson.build
A src/backend/optimizer/prep/meson.build
A src/backend/optimizer/util/meson.build
A src/backend/parser/meson.build
A src/backend/partitioning/meson.build
A src/backend/po/meson.build
A src/backend/port/meson.build
A src/backend/port/win32/meson.build
A src/backend/postmaster/meson.build
A src/backend/regex/meson.build
A src/backend/replication/libpqwalreceiver/meson.build
A src/backend/replication/logical/meson.build
A src/backend/replication/meson.build
A src/backend/replication/pgoutput/meson.build
A src/backend/rewrite/meson.build
A src/backend/snowball/meson.build
A src/backend/statistics/meson.build
A src/backend/storage/buffer/meson.build
A src/backend/storage/file/meson.build
A src/backend/storage/freespace/meson.build
A src/backend/storage/ipc/meson.build
A src/backend/storage/large_object/meson.build
A src/backend/storage/lmgr/meson.build
A src/backend/storage/meson.build
A src/backend/storage/page/meson.build
A src/backend/storage/smgr/meson.build
A src/backend/storage/sync/meson.build
A src/backend/tcop/meson.build
A src/backend/tsearch/meson.build
A src/backend/utils/activity/meson.build
A src/backend/utils/adt/meson.build
A src/backend/utils/cache/meson.build
A src/backend/utils/error/meson.build
A src/backend/utils/fmgr/meson.build
A src/backend/utils/hash/meson.build
A src/backend/utils/init/meson.build
A src/backend/utils/mb/conversion_procs/meson.build
A src/backend/utils/mb/meson.build
A src/backend/utils/meson.build
A src/backend/utils/misc/meson.build
A src/backend/utils/mmgr/meson.build
A src/backend/utils/resowner/meson.build
A src/backend/utils/sort/meson.build
A src/backend/utils/time/meson.build
A src/bin/initdb/meson.build
A src/bin/initdb/po/meson.build
A src/bin/meson.build
A src/bin/pg_amcheck/meson.build
A src/bin/pg_amcheck/po/meson.build
A src/bin/pg_archivecleanup/meson.build
A src/bin/pg_archivecleanup/po/meson.build
A src/bin/pg_basebackup/meson.build
A src/bin/pg_basebackup/po/meson.build
A src/bin/pg_checksums/meson.build
A src/bin/pg_checksums/po/meson.build
A src/bin/pg_config/meson.build
A src/bin/pg_config/po/meson.build
A src/bin/pg_controldata/meson.build
A src/bin/pg_controldata/po/meson.build
A src/bin/pg_ctl/meson.build
A src/bin/pg_ctl/po/meson.build
A src/bin/pg_dump/meson.build
A src/bin/pg_dump/po/meson.build
A src/bin/pg_resetwal/meson.build
A src/bin/pg_resetwal/po/meson.build
A src/bin/pg_rewind/meson.build
A src/bin/pg_rewind/po/meson.build
A src/bin/pg_test_fsync/meson.build
A src/bin/pg_test_fsync/po/meson.build
A src/bin/pg_test_timing/meson.build
A src/bin/pg_test_timing/po/meson.build
A src/bin/pg_upgrade/meson.build
A src/bin/pg_upgrade/po/meson.build
A src/bin/pg_verifybackup/meson.build
A src/bin/pg_verifybackup/po/meson.build
A src/bin/pg_waldump/meson.build
A src/bin/pg_waldump/po/meson.build
A src/bin/pgbench/meson.build
A src/bin/pgevent/meson.build
A src/bin/psql/meson.build
A src/bin/psql/po/meson.build
A src/bin/scripts/meson.build
A src/bin/scripts/po/meson.build
A src/common/meson.build
A src/common/unicode/meson.build
A src/fe_utils/meson.build
A src/include/catalog/meson.build
A src/include/meson.build
A src/include/nodes/meson.build
A src/include/pg_config_ext.h.meson
A src/include/storage/meson.build
A src/include/utils/meson.build
A src/interfaces/ecpg/compatlib/meson.build
A src/interfaces/ecpg/ecpglib/meson.build
A src/interfaces/ecpg/ecpglib/po/meson.build
A src/interfaces/ecpg/include/meson.build
A src/interfaces/ecpg/meson.build
A src/interfaces/ecpg/pgtypeslib/meson.build
A src/interfaces/ecpg/preproc/meson.build
A src/interfaces/ecpg/preproc/po/meson.build
A src/interfaces/ecpg/test/compat_informix/meson.build
A src/interfaces/ecpg/test/compat_oracle/meson.build
A src/interfaces/ecpg/test/connect/meson.build
A src/interfaces/ecpg/test/meson.build
A src/interfaces/ecpg/test/pgtypeslib/meson.build
A src/interfaces/ecpg/test/preproc/meson.build
A src/interfaces/ecpg/test/sql/meson.build
A src/interfaces/ecpg/test/thread/meson.build
A src/interfaces/libpq/meson.build
A src/interfaces/libpq/po/meson.build
A src/interfaces/libpq/test/meson.build
A src/interfaces/meson.build
A src/meson.build
A src/pl/meson.build
A src/pl/plperl/meson.build
A src/pl/plperl/po/meson.build
A src/pl/plpgsql/meson.build
A src/pl/plpgsql/src/meson.build
A src/pl/plpgsql/src/po/meson.build
A src/pl/plpython/meson.build
A src/pl/plpython/po/meson.build
A src/pl/tcl/meson.build
A src/pl/tcl/po/meson.build
A src/port/meson.build
A src/test/authentication/meson.build
A src/test/icu/meson.build
A src/test/isolation/meson.build
A src/test/kerberos/meson.build
A src/test/ldap/meson.build
A src/test/meson.build
A src/test/modules/brin/meson.build
A src/test/modules/commit_ts/meson.build
A src/test/modules/delay_execution/meson.build
A src/test/modules/dummy_index_am/meson.build
A src/test/modules/dummy_seclabel/meson.build
A src/test/modules/libpq_pipeline/meson.build
A src/test/modules/meson.build
A src/test/modules/plsample/meson.build
A src/test/modules/snapshot_too_old/meson.build
A src/test/modules/spgist_name_ops/meson.build
A src/test/modules/ssl_passphrase_callback/meson.build
A src/test/modules/test_bloomfilter/meson.build
A src/test/modules/test_ddl_deparse/meson.build
A src/test/modules/test_extensions/meson.build
A src/test/modules/test_ginpostinglist/meson.build
A src/test/modules/test_integerset/meson.build
A src/test/modules/test_lfind/meson.build
A src/test/modules/test_misc/meson.build
A src/test/modules/test_oat_hooks/meson.build
A src/test/modules/test_parser/meson.build
A src/test/modules/test_pg_dump/meson.build
A src/test/modules/test_predtest/meson.build
A src/test/modules/test_rbtree/meson.build
A src/test/modules/test_regex/meson.build
A src/test/modules/test_rls_hooks/meson.build
A src/test/modules/test_shm_mq/meson.build
A src/test/modules/unsafe_tests/meson.build
A src/test/modules/worker_spi/meson.build
A src/test/perl/meson.build
A src/test/recovery/meson.build
A src/test/regress/meson.build
A src/test/ssl/meson.build
A src/test/subscription/meson.build
A src/timezone/meson.build
A src/timezone/tznames/meson.build
A src/tools/find_meson
A src/tools/gen_export.pl
A src/tools/pgflex
A src/tools/testwrap

Clear ps display of startup process at the end of recovery

commit   : fbb5f54b67c2f35c885d07daa26bce7e2eb6b0be    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 14:25:09 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 14:25:09 +0900    

Click here for diff

If the ps display is not cleared at this point, the process could  
continue displaying "recovering NNN" even if handling end-of-recovery  
steps.  df9274a has tackled that by providing some information with the  
end-of-recovery checkpoint but 7ff23c6 has nullified the effect of the  
first commit.  
  
Per a suggestion from Justin, just clear the ps display when we are done  
with recovery, so as no incorrect information is displayed.  This may  
get extended in the future, but for now restore the pre-7ff23c6  
behavior.  
  
Author: Justin Prysby  
Discussion: https://postgr.es/m/20220913223954.GU31833@telsasoft.com  
Backpatch-through: 15  

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

docs: Fix snapshot name in SET TRANSACTION docs.

commit   : 2f636daac85b7bad608b24b475feceb7e3076ec6    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Sep 2022 12:54:26 +0900    

Click here for diff

Commit 6c2003f8a1 changed the snapshot names mentioned in  
SET TRANSACTION docs, however, there was one place that  
the commit missed updating the name.  
  
Back-patch to all supported versions.  
  
Author: Japin Li  
Reviewed-by: Fujii Masao  
Discussion: https://postgr.es/m/MEYP282MB1669BD4280044501165F8B07B64F9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M doc/src/sgml/ref/set_transaction.sgml

Used optimized linear search in more code paths

commit   : 14ff44f80c09718d43d853363941457f5468cc03    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 09:47:28 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Thu, 22 Sep 2022 09:47:28 +0900    

Click here for diff

This commit updates two code paths to use pg_lfind32() introduced by  
b6ef167 with TransactionId arrays:  
- At the end of TransactionIdIsInProgress(), when checking for the case  
of still running but overflowed subxids.  
- XidIsConcurrent(), when checking for a serializable conflict.  
  
These cases are less impactful than 37a6e5d, but a bit of  
micro-benchmarking of this API shows that linear search speeds up by  
~20% depending on the number of items involved (x86_64 and amd64 looked  
at here).  
  
Author: Nathan Bossart  
Reviewed-by: Richard Guo, Michael Paquier  
Discussion: https://postgr.es/m/20220901185153.GA783106@nathanxps13  

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

psql: Improve tab-completion for MERGE.

commit   : 9a6915257d1d804ddba05331030b74d7426a4005    
  
author   : Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    
  
committer: Fujii Masao <fujii@postgresql.org>    
date     : Thu, 22 Sep 2022 09:25:29 +0900    

Click here for diff

Commit 7103ebb7aa added the tab-completion for MERGE accidentally  
in the middle of that for LOCK TABLE. This commit fixes this issue.  
  
This also adds some tab-completion for MERGE.  
  
Back-patch to v15 where MERGE was introduced.  
  
Author: Kotaro Kawamoto, Fujii Masao  
Reviewed-by: Shinya Kato, Álvaro Herrera  
Discussion: https://postgr.es/m/9f1ad2a87a58cd5e7d64f3993130958d@oss.nttdata.com  

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

ci: windows: set error mode to not include SEM_NOGPFAULTERRORBOX

commit   : 661ee7bfc661a4ba52ed57cff46e414b2add75b1    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 21 Sep 2022 17:15:54 -0700    

Click here for diff

Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That prevents  
crash reporting from working unless binaries do SetErrorMode()  
themselves. Furthermore, it appears that either python or, more likely, the C  
runtime has a bug where SEM_NOGPFAULTERRORBOX can very occasionally *trigger*  
a crash on process exit - which is hard to debug, given that it explicitly  
prevents crash dumps from working...  
  
Discussion: https://postgr.es/m/20220909235836.lz3igxtkcjb5w7zb%40awork3.anarazel.de  
Backpatch: 15-, where CI was added  

M .cirrus.yml

ci: Increase requested memory size.

commit   : a3a3c1ea87804c9efddf53fc2e7793993630a034    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 22 Sep 2022 11:35:46 +1200    

Click here for diff

CI builds recently started failing with:  
  
"Memory size for 4.0 vCPU instance should be between 3840MiB and  
26624MiB, while 2048MiB is requested."  
  
Ok then, let's ask for 4G instead of 2G.  
  
This may be due to a change in the type of instance used to work around  
an outage, per:  
  
https://twitter.com/cirrus_labs/status/1572657320093712384  

M .cirrus.yml

Harmonize lexer adjacent function parameter names.

commit   : aab06442d488364f8861219cb8864a16b6d0d4e4    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 21 Sep 2022 13:21:36 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 21 Sep 2022 13:21:36 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions for several "lexer  
adjacent" backend functions.  
  
These functions were missed by recent commits because they were obscured  
by clang-tidy warnings about functions whose signature is directly under  
the control of the lexer (flex seems to always generate function  
declarations with unnamed parameters).  We probably can't fix most of  
the warnings it generates for translation units that get built from .l  
and .y files, but we can at least do this much.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/bin/pgbench/exprparse.y
M src/include/replication/syncrep.h
M src/include/replication/walsender_private.h

Improve ICU option handling in CREATE DATABASE

commit   : e59a67fb8fe1ac1408dc1858038f525a860d772b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Sep 2022 10:28:40 -0400    

Click here for diff

We check that the ICU locale is only specified if the ICU locale  
provider is selected.  But we did that too early.  We need to wait  
until we load the settings of the template database, since that could  
also set what the locale provider is.  
  
Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru>  
Discussion: https://www.postgresql.org/message-id/9ba4cd1ea6ed6b7b15c0ff15e6f540cd@postgrespro.ru  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

Tighten pg_get_object_address argument checking

commit   : 2da8c4cff39328897aa716a0ba57bdada5aeaf6e    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 21 Sep 2022 09:34:22 -0400    

Click here for diff

For publication schemas (OBJECT_PUBLICATION_NAMESPACE) and user  
mappings (OBJECT_USER_MAPPING), pg_get_object_address() checked the  
array length of the second argument, but not of the first argument.  
If the first argument was too long, it would just silently ignore  
everything but the first argument.  Fix that by checking the length of  
the first argument as well.  
  
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/caaef70b-a874-1088-92ef-5ac38269c33b%40enterprisedb.com  

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

Improve some GUC description strings

commit   : 3d4e841a076379663ae714d1d1c7eee11c638063    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 21 Sep 2022 12:29:38 +0200    

Click here for diff

It is not our usual style to use "we" in messages.  Also, remove some  
noise words.  Backpatch to 15.  
  
Noted by Kyotaro Horiguchi.  
  
Discussion: https://postgr.es/m/20220914.111507.13049297635620898.horikyota.ntt@gmail.com  

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

Pass Size as a 2nd argument for snprintf() in tablesync.c.

commit   : a932824dfe068f563e9abb9264f6e071f23e67ae    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Sep 2022 10:20:37 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Sep 2022 10:20:37 +0530    

Click here for diff

Previously the following snprintf() wrappers:  
  
* ReplicationSlotNameForTablesync()  
* ReplicationOriginNameForTablesync()  
  
... used int as a second argument of snprintf() while the actual type of it  
is size_t. Although it doesn't fail at present better replace it with Size  
for consistency with the rest of the system.  
  
Author: Aleksander Alekseev  
Reviewed-By: Peter Smith  
Discussion: https://postgr.es/m/CAHut%2BPsa8hhfSE6ozUK-ih7GkQziAVAf4f3bqiXEj2nQiu-43g%40mail.gmail.com  

M src/backend/replication/logical/tablesync.c
M src/include/replication/slot.h
M src/include/replication/worker_internal.h

Improve some error messages.

commit   : 6971a839ccdf1131ddf1fa2fa405cba43cd68608    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Sep 2022 09:43:59 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 21 Sep 2022 09:43:59 +0530    

Click here for diff

It is not our usual style to use "we" in the error messages.  
  
Author: Kyotaro Horiguchi  
Reviewed-By: Amit Kapila  
Discussion: https://postgr.es/m/20220914.111507.13049297635620898.horikyota.ntt@gmail.com  

M src/backend/replication/pgoutput/pgoutput.c
M src/backend/storage/file/fd.c

Use \b in one more PG_TEST_EXTRA check, oversight in c3382a3c3cc

commit   : 3f0c901e744c87f6e00744e63afe0242d5fe45e9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 20 Sep 2022 18:11:10 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 20 Sep 2022 18:11:10 -0700    

Click here for diff

Per off-list report from Thomas Munro.  

M src/test/ssl/t/001_ssltests.pl

Add definition pg_attribute_aligned() for MSVC

commit   : ec3c9cc202fb2749fce82483e6dc247cfe286cab    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Sep 2022 10:11:23 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 21 Sep 2022 10:11:23 +0900    

Click here for diff

Visual Studio 2015+ has support for a macro to control the alignement of  
structures as of __declspec(align(#)), and this commit adds a definition  
of pg_attribute_aligned() based on that.  It happens that this was  
already used in the implementation of atomics for MSVC.  Note that there  
is still no definition fo pg_attribute_packed(), so this does not impact  
itemptr.h.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe-HbtZvR3msoMtk+hYW2S0e0OapzMW8icSMYTMA+mN8Aw@mail.gmail.com  

M config/c-compiler.m4
M configure
M src/include/c.h
M src/include/port/atomics/generic-msvc.h

Revise tree-walk APIs to improve spec compliance & silence warnings.

commit   : 1c27d16e6e5c1f463bbe1e9ece88dda811235165    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Sep 2022 18:03:22 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Sep 2022 18:03:22 -0400    

Click here for diff

expression_tree_walker and allied functions have traditionally  
declared their callback functions as, say, "bool (*walker) ()"  
to allow for variation in the declared types of the callback  
functions' context argument.  This is apparently going to be  
forbidden by the next version of the C standard, and the latest  
version of clang warns about that.  In any case it's always  
been pretty poor for error-detection purposes, so fixing it is  
a good thing to do.  
  
What we want to do is change the callback argument declarations to  
be like "bool (*walker) (Node *node, void *context)", which is  
correct so far as expression_tree_walker and friends are concerned,  
but not change the actual callback functions.  Strict compliance with  
the C standard would require changing them to declare their arguments  
as "void *context" and then cast to the appropriate context struct  
type internally.  That'd be very invasive and it would also introduce  
a bunch of opportunities for future bugs, since we'd no longer have  
any check that the correct sort of context object is passed by outside  
callers or internal recursion cases.  Therefore, we're just going  
to ignore the standard's position that "void *" isn't necessarily  
compatible with struct pointers.  No machine built in the last forty  
or so years actually behaves that way, so it's not worth introducing  
bug hazards for compatibility with long-dead hardware.  
  
Therefore, to silence these compiler warnings, introduce a layer of  
macro wrappers that cast the supplied function name to the official  
argument type.  Thanks to our use of -Wcast-function-type, this will  
still produce a warning if the supplied function is seriously  
incompatible with the required signature, without going as far as  
the official spec restriction does.  
  
This method fixes the problem without any need for source code changes  
outside nodeFuncs.h/.c.  However, it is an ABI break because the  
physically called functions now have names ending in "_impl".  Hence  
we can only fix it this way in HEAD.  In the back branches, we'll have  
to settle for disabling -Wdeprecated-non-prototype.  
  
Discussion: https://postgr.es/m/CA+hUKGKpHPDTv67Y+s6yiC8KH5OXeDg6a-twWo_xznKTcG0kSA@mail.gmail.com  

M src/backend/nodes/nodeFuncs.c
M src/include/nodes/nodeFuncs.h

Fix recent cpluspluscheck issue in selfuncs.h.

commit   : eccb607e19993483e25966abae895277599f77a2    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 20 Sep 2022 14:08:57 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 20 Sep 2022 14:08:57 -0700    

Click here for diff

Fix selfuncs.h cpluspluscheck complaint, without reintroducing a  
parameter name inconsistency (restore the original declaration names,  
and then make corresponding function definitions consistent with that).  
  
Oversight in commit a601366a.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reported-By: Andres Freund <andres@anarazel.de>  

M src/backend/utils/adt/selfuncs.c
M src/include/utils/selfuncs.h

Harmonize more parameter names in bulk.

commit   : a601366a460f68472bf70c4d94c57baa0a3ed1b2    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 20 Sep 2022 13:09:30 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Tue, 20 Sep 2022 13:09:30 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in optimizer, parser,  
utility, libpq, and "commands" code, as well as in remaining library  
code.  Do the same for all code related to frontend programs (with the  
exception of pg_dump/pg_dumpall related code).  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will handle  
ecpg and pg_dump/pg_dumpall.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/backup/basebackup.c
M src/backend/bootstrap/bootstrap.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/backend/postmaster/postmaster.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/queryjumble.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/time/snapmgr.c
M src/bin/initdb/initdb.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_waldump/compat.c
M src/bin/pgbench/pgbench.h
M src/bin/psql/describe.h
M src/bin/scripts/common.h
M src/fe_utils/cancel.c
M src/include/bootstrap/bootstrap.h
M src/include/commands/alter.h
M src/include/commands/conversioncmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/common/fe_memutils.h
M src/include/common/kwlookup.h
M src/include/common/scram-common.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/libpq/pqmq.h
M src/include/nodes/extensible.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/pg_list.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/include/optimizer/prep.h
M src/include/parser/analyze.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_relation.h
M src/include/partitioning/partbounds.h
M src/include/pgstat.h
M src/include/pgtime.h
M src/include/port.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/syslogger.h
M src/include/rewrite/rewriteManip.h
M src/include/snowball/libstemmer/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/statistics.h
M src/include/tcop/cmdtag.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/attoptcache.h
M src/include/utils/builtins.h
M src/include/utils/datetime.h
M src/include/utils/jsonb.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pgstat_internal.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/relcache.h
M src/include/utils/relmapper.h
M src/include/utils/selfuncs.h
M src/include/utils/snapmgr.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/xml.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/libpq-fe.h
M src/pl/plpgsql/src/pl_exec.c

Refactor PG_TEST_EXTRA logic in autoconf build

commit   : c3382a3c3ccda6df126c95bf37dcc762480c5202    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 20 Sep 2022 11:09:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 20 Sep 2022 11:09:30 -0700    

Click here for diff

To avoid duplicating the PG_TEST_EXTRA logic in Makefiles into the upcoming  
meson based build definition, move the checks into the the tests  
themselves. That also has the advantage of making skipped tests visible.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com  

M src/test/Makefile
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/t/001_auth.pl
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl

Improve comment for OAT_POST_CREATE.

commit   : bb44a6ba48edfe1ac8bca87b1f2cfdcd9f86c930    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 20 Sep 2022 10:41:34 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Tue, 20 Sep 2022 10:41:34 -0700    

Click here for diff

Clarify that the command counter may or may not have been incremented.  
  
We may want to change the behavior to be more consistent, but until  
that time, at least improve the comment.  
  
Discussion: https://postgr.es/m/CAHoZxqvN2eoic_CvjsAvpryyLyA2xG8JmsyMtKFFJz_1oFhfOg%40mail.gmail.com  
Reported-by: Mary Xu  

M src/include/catalog/objectaccess.h

Fix `trap` in a few shell scripts

commit   : 3d53b9ef1a4cda7b6303a0496f8531eceeef0e77    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 20 Sep 2022 18:50:16 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 20 Sep 2022 18:50:16 +0200    

Click here for diff

The original `trap` lines in these scripts are incomplete: in case of  
any signal, they delete the working directory but let the script run to  
completion, which is useless because it will only proceed to complain  
about the working directory being removed.  Add `exit` there, with the  
original exit value (not rm's).  
  
Since this is mostly just cosmetic, no backpatch.  
  
Discussion: https://postgr.es/m/20220913181002.hzsosy7qkemb7ky7@alvherre.pgsql  

M src/tools/find_static
M src/tools/make_ctags
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck
M src/tools/pgtest

Suppress variable-set-but-not-used warnings from clang 15.

commit   : 152c9f7b8f01437780d9f87bfe945bba47efdd0a    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 20 Sep 2022 12:04:37 -0400    

Click here for diff

clang 15+ will issue a set-but-not-used warning when the only  
use of a variable is in autoincrements (e.g., "foo++;").  
That's perfectly sensible, but it detects a few more cases that  
we'd not noticed before.  Silence the warnings with our usual  
methods, such as PG_USED_FOR_ASSERTS_ONLY, or in one case by  
actually removing a useless variable.  
  
One thing that we can't nicely get rid of is that with %pure-parser,  
Bison emits "yynerrs" as a local variable that falls foul of this  
warning.  To silence those, I inserted "(void) yynerrs;" in the  
top-level productions of affected grammars.  
  
Per recently-established project policy, this is a candidate  
for back-patching into out-of-support branches: it suppresses  
annoying compiler warnings but changes no behavior.  Hence,  
back-patch to 9.5, which is as far as these patches go without  
issues.  (A preliminary check shows that the prior branches  
need some other set-but-not-used cleanups too, so I'll leave  
them for another day.)  
  
Discussion: https://postgr.es/m/514615.1663615243@sss.pgh.pa.us  

M src/backend/access/gist/gistxlog.c
M src/backend/access/transam/xlog.c
M src/backend/parser/gram.y
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/jsonpath_gram.y
M src/bin/pgbench/exprparse.y

Disable autovacuum in MERGE test script

commit   : c9a21fea44ca5722dbfcced0dfdc84db063aff71    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 20 Sep 2022 12:38:48 +0200    

Click here for diff

Otherwise, it can fail given sufficient bad luck.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/537759.1663625579@sss.pgh.pa.us  

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

doc: Fix parameter name for pg_create_logical_replication_slot()

commit   : 6f0dad88b2eff56e1ddada983f27427250b8a3c3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Sep 2022 19:28:37 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Sep 2022 19:28:37 +0900    

Click here for diff

The parameter controlling if two-phase transactions can be decoded was  
named "two_phase" in the documentation while its procedure defines  
"twophase".  
  
Author: Florin Irion  
Discussion: https://postgr.es/m/5eeabd10-1aff-ea61-f92d-9fa0d9a7e207@gmail.com  
Backpatch-through: 14  

M doc/src/sgml/func.sgml

Fix incorrect variable types for origin IDs in decode.c

commit   : e9123197c844a3a7fe20d723477fcdbef5b89f93    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Sep 2022 18:13:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 20 Sep 2022 18:13:00 +0900    

Click here for diff

These variables used XLogRecPtr instead of RepOriginId.  
  
Author: Masahiko Sawada  
Discussion: https://postgr.es/m/CAD21AoBm-vNyBSXGp4bmJGvhr=S-EGc5q1dtV70cFTcJvLhC=Q@mail.gmail.com  
Backpatch-through: 14  

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

Harmonize parameter names in storage and AM code.

commit   : bfcf1b34805f70df48eedeec237230d0cc1154a6    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 19:18:36 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 19:18:36 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions in storage, catalog,  
access method, executor, and logical replication code, as well as in  
miscellaneous utility/library code.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will do the  
same for other parts of the codebase.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/reloptions.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/commands/dbcommands.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeMemoize.c
M src/backend/lib/bloomfilter.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/buffile.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/md.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin_private.h
M src/include/access/gist_private.h
M src/include/access/reloptions.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/twophase.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xloginsert.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogutils.h
M src/include/catalog/dependency.h
M src/include/catalog/index.h
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_publication.h
M src/include/commands/copy.h
M src/include/commands/dbcommands_xlog.h
M src/include/executor/execParallel.h
M src/include/executor/executor.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/spi.h
M src/include/mb/pg_wchar.h
M src/include/miscadmin.h
M src/include/replication/logical.h
M src/include/replication/logicalproto.h
M src/include/replication/origin.h
M src/include/replication/slot.h
M src/include/replication/walsender.h
M src/include/storage/barrier.h
M src/include/storage/bufpage.h
M src/include/storage/dsm.h
M src/include/storage/fd.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/lwlock.h
M src/include/storage/predicate.h
M src/include/storage/procarray.h
M src/include/storage/standby.h

Split TESTDIR into TESTLOGDIR and TESTDATADIR

commit   : c47885bd8b6997ccb0cc1997f61f6f98a79ce32a    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 18:03:17 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 18:03:17 -0700    

Click here for diff

The motivation for this is twofold. For one the meson patchset would like to  
have more control over the logfiles. For another, the log file location for  
tap tests (tmp_check/log) is not symmetric to the log location for  
pg_regress/isolation tests (log/).  
  
This commit does not change the default location for log files for tap tests,  
as that'd break the buildfarm log collection, it just provides the  
infrastructure for doing so.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/1131990.1660661896@sss.pgh.pa.us  
Discussion: https://postgr.es/m/20220828170806.GN2342@telsasoft.com  

M src/Makefile.global.in
M src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/tools/msvc/vcregress.pl

Don't hardcode tmp_check/ as test directory for tap tests

commit   : bb54bf22900f76dab6899594d47f55d62e912143    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 18:00:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 18:00:50 -0700    

Click here for diff

This is motivated by the meson patchset, which wants to put the log / data for  
tests in a different place than the autoconf build. Right now log files for  
tap tests have to be inside $TESTDIR/tmp_check, whereas log files for  
pg_regress/isolationtester are outside of tmp_check. This change doesn't fix  
the latter, but is a prerequisite.  
  
The only test that needs adjustment is 010_tab_completion.pl, as it hardcoded  
the tmp_check/ directory. Instead create a dedicated directory for the test  
files.  It's also a bit cleaner independently, because it doesn't intermingle  
the test files with more important things like the log/ directory.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/1131990.1660661896@sss.pgh.pa.us  
Discussion: https://postgr.es/m/d861493c-ed20-c251-7a89-7924f5197341@enterprisedb.com  

M src/Makefile.global.in
M src/bin/psql/t/010_tab_completion.pl
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/tools/msvc/vcregress.pl

Harmonize heapam and tableam parameter names.

commit   : 4bac9600f09a9b9ba7daa3ba69495a877f51e6c3    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 16:46:23 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 16:46:23 -0700    

Click here for diff

Make sure that function declarations use names that exactly match the  
corresponding names from function definitions.  Having parameter names  
that are reliably consistent in this way will make it easier to reason  
about groups of related C functions from the same translation unit as a  
module.  It will also make certain refactoring tasks easier.  
  
Like other recent commits that cleaned up function parameter names, this  
commit was written with help from clang-tidy.  Later commits will do the  
same for other parts of the codebase.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/access/common/heaptuple.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/multixact.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/htup_details.h
M src/include/access/multixact.h
M src/include/access/rewriteheap.h
M src/include/access/tableam.h
M src/include/commands/cluster.h
M src/include/replication/snapbuild.h

Consistently use named parameters in regex code consistently.

commit   : cb8ff7ed5ac907a4a574413f3e46a3522d7b164c    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:47:04 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:47:04 -0700    

Click here for diff

Adjust a handful of remaining function prototypes that were overlooked  
by recent commit bc2187ed.  This oversight wasn't caught by clang-tidy  
because the functions in question are only built in custom REG_DEBUG  
builds.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reported-By: Tom Lane <tgl@sss.pgh.pa.us>  

M src/backend/regex/regcomp.c

Extend gendef.pl in preparation for meson

commit   : 70df2df1cc89e69e31b31b6aa0d65fd72935af38    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 15:34:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 19 Sep 2022 15:34:50 -0700    

Click here for diff

The main issue with using gendef.pl as-is for meson is that with meson the  
filenames are a bit longer, exceeding the max commandline length when calling  
dumpbin with all objects. As it's easier to pass in a library anyway, do so.  
  
The .def file location, input and temporary file location need to be tunable  
as well.  
  
This also fixes a bug in gendef.pl: The logic when to regenerate was broken  
and never avoid regenerating.  
  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/20220809071055.rgikv3qn74ypnnbb@awork3.anarazel.de  
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com  

M src/tools/msvc/MSBuildProject.pm
M src/tools/msvc/gendef.pl

Update Unicode data to Unicode 15.0.0

commit   : 1091b48cd761abc7f697fa9c4e018c46763b46fb    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 18:30:05 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 18:30:05 -0400    

Click here for diff

M src/Makefile.global.in
M src/include/common/unicode_east_asian_fw_table.h
M src/include/common/unicode_nonspacing_table.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_normprops_table.h

Consistently use named parameters in timezone code.

commit   : c4f8e89fef3d4cd8b0791637667fd984d6f38fb2    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:13:42 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:13:42 -0700    

Click here for diff

Make our copy of the IANA timezone library use named parameters in  
function declarations.  Also make sure that parameter names from each  
function's declaration match corresponding definition parameter names.  
  
This makes the timezone code follow Postgres coding standards.  The  
value of having a consistent standard everywhere seems to outweigh the  
cost of keeping the function declarations in sync with future IANA  
releases.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/timezone/localtime.c
M src/timezone/pgtz.c
M src/timezone/strftime.c
M src/timezone/zic.c

Consistently use named parameters in regex code.

commit   : bc2187ed63c56bb9cd99f6613f3e2ba56afb22fe    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:10:24 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 19 Sep 2022 15:10:24 -0700    

Click here for diff

Make regex code consistently use named parameters in function  
declarations.  Also make sure that parameter names from each function's  
declaration match corresponding definition parameter names.  
  
This makes Henry Spencer's regex code follow Postgres coding standards.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: David Rowley <dgrowleyml@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  

M src/backend/regex/regcomp.c
M src/backend/regex/regexec.c
M src/backend/utils/adt/regexp.c
M src/include/regex/regex.h
M src/test/modules/test_regex/test_regex.c

Fix misleading comment for get_cheapest_group_keys_order

commit   : 55b4966365fa76bda275c409f3aefad43243f12c    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 10:03:26 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 10:03:26 +1200    

Click here for diff

The header comment for get_cheapest_group_keys_order() claimed that the  
output arguments were set to a newly allocated list which may be freed by  
the calling function, however, this was not always true as the function  
would simply leave these arguments untouched in some cases.  
  
This tripped me up when working on 1349d2790 as I mistakenly assumed I  
could perform a list_concat with the output parameters.  That turned out  
bad due to list_concat modifying the original input lists.  
  
In passing, make it more clear that the number of distinct values is  
important to reduce tiebreaks during sorts.  Also, explain what the  
n_preordered parameter means.  
  
Backpatch-through: 15, where get_cheapest_group_keys_order was introduced.  

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

Fix out-dated comment in preprocess_groupclause()

commit   : 78a9af1a27641ad983354bbaaaa4b7c00ea390f6    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 09:13:49 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 09:13:49 +1200    

Click here for diff

The comment claimed we don't consider other orders of the GROUP BY clause,  
but this is no longer true as of db0d67db2.  
  
Discussion: https://postgr.es/m/CAApHDvq65=9Ro+hLX1i9ugWEiNDvHrBibAO7ARcTnf38_JE+UQ@mail.gmail.com  
Backpatch-through: 15, where db0d67db2 was introduced.  

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

Remove various duplicated words

commit   : 66fa8ff637982b51257d80626dd00dccf3ad9fa6    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 08:37:02 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 20 Sep 2022 08:37:02 +1200    

Click here for diff

Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220919111000.GW31833@telsasoft.com  

M src/backend/executor/execPartition.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_replslot.c
M src/test/ssl/t/SSL/Server.pm

Fix icu tests with C locale

commit   : cab3ce7a065b8ec04303d680a64bd9aa9bdd29db    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 15:22:43 -0400    

Click here for diff

Similar to 1e08576691bf1a25c0e28745e5e800c44f2a1c76, but for the icu  
test suite.  
  
Reported-by: Christoph Berg <myon@debian.org>  
Discussion: https://www.postgresql.org/message-id/YyWeU61YMFwjVdxE@msg.df7cb.de  

M src/test/icu/t/010_database.pl

Make ALTER DEFAULT PRIVILEGES require privileges, not membership.

commit   : 48a257d444a787941ba3da24d65e6cbe31461d0a    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 14:21:59 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 14:21:59 -0400    

Click here for diff

If role A is a direct or indirect member of role B but does not inherit  
B's privileges (because at least one relevant grant was created WITH  
INHERIT FALSE) then A should not be permitted to bypass privilege  
checks that require the privileges of B. For example, A can't change  
the privileges of objects owned by B, nor can A drop those objects.  
  
However, up until now, it's been possible for A to change default  
privileges for role B. That doesn't seem to be correct, because a  
non-inherited role grant is only supposed to permit you to assume  
the identity of the granted role via SET ROLE, and should not  
otherwise permit you to exercise the privileges of that role. Most  
places followed that rule, but this case was an exception.  
  
This could be construed as a security vulnerability, but it does not  
seem entirely clear cut, since older branches were fuzzy about the  
distinction between is_member_of_role() and has_privs_of_role() in  
a number of other ways as well. Because of this, and because  
user-visible behavior changes in minor releases are to be avoided  
whenever possible, no back-patch.  
  
Discussion: http://postgr.es/m/CA+TgmobG_YUP06R_PM_2Z7wR0qv_52gQPHD8CYXbJva0cf0E+A@mail.gmail.com  

M src/backend/catalog/aclchk.c

walmethods.c/h: Make WalWriteMethod more object-oriented.

commit   : ebfb814f7ce0d5ab6f47f0b86db51a1b8f3342f4    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 12:53:46 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 12:53:46 -0400    

Click here for diff

Normally when we use object-oriented programming techniques, we  
provide a pointer to an object and then some way of looking up the  
associated table of callbacks, but walmethods.c/h took the alternative  
approach of providing only a pointer to the table of callbacks and  
thus imposed the artificial restriction that there could only ever be  
one object of each type, so that the callbacks could find it via a  
global variable. That doesn't seem like the right idea, so revise the  
approach.  
  
Each callback which does not already have an argument of type  
Walfile * now takes a pointer to the relevant WalWriteMethod *  
so that these callbacks need not rely on there being only one  
object of each type.  
  
Freeing a WalWriteMethod is now performed via a callback provided  
for that purpose rather than requiring the caller to know which  
WAL method they want to free.  
  
Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com  

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

Future-proof the recursion inside ExecShutdownNode().

commit   : c35ba141de1fa04373671ba24c73eb0fe4862415    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 19 Sep 2022 12:16:02 -0400    

Click here for diff

The API contract for planstate_tree_walker() callbacks is that they  
take a PlanState pointer and a context pointer.  Somebody figured  
they could save a couple lines of code by ignoring that, and passing  
ExecShutdownNode itself as the walker even though it has but one  
argument.  Somewhat remarkably, we've gotten away with that so far.  
However, it seems clear that the upcoming C2x standard means to  
forbid such cases, and compilers that actively break such code  
likely won't be far behind.  So spend the extra few lines of code  
to do it honestly with a separate walker function.  
  
In HEAD, we might as well go further and remove ExecShutdownNode's  
useless return value.  I left that as-is in back branches though,  
to forestall complaints about ABI breakage.  
  
Back-patch, with the thought that this might become of practical  
importance before our stable branches are all out of service.  
It doesn't seem to be fixing any live bug on any currently known  
platform, however.  
  
Discussion: https://postgr.es/m/208054.1663534665@sss.pgh.pa.us  

M src/backend/executor/execMain.c
M src/backend/executor/execProcnode.c
M src/include/executor/executor.h

walmethods.c/h: Make Walfile a struct, rather than a void *

commit   : 4fd14794945e60c4aedad84b06ff1e2a7a6236f0    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 11:20:18 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 19 Sep 2022 11:20:18 -0400    

Click here for diff

This makes the curent file position and pathname visible in a generic  
way, so we no longer need current_walfile_name global variable or the  
get_current_pos() method. Since that purported to be able to fail but  
never actually did, this also lets us get rid of some unnecessary  
error-handling code.  
  
One risk of this change is that the get_current_pos() method  
previously cleared the error indicator, and that will no longer happen  
with the new approach. I looked for a way that this could cause problems  
and did not find one.  
  
The previous code was confused about whether "Walfile" was the  
implementation-dependent structure representing a WAL file or  
whether it was a pointer to that stucture. Some of the code used it  
one way, and some in the other. The compiler tolerated that because  
void * is interchangeable with void **, but now that Walfile is a  
struct, it's necessary to be consistent. Hence, some references to  
"Walfile" have been converted to "Walfile *".  
  
Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com  

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

Add missing serial commas

commit   : 1fe1d09652d796392785922bef54e0ffda6e1f05    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 19 Sep 2022 06:35:01 -0400    

Click here for diff

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

Fix typos.

commit   : a23417790631e50f54bdcf5e40bf84e2dbd1c34b    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 19 Sep 2022 14:21:39 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 19 Sep 2022 14:21:39 +0530    

Click here for diff

Author: Hou Zhijie and Zhang Mingli  
Discussion: https://postgr.es/m/OS0PR01MB57162559C01FE2848C12E8F7944D9@OS0PR01MB5716.jpnprd01.prod.outlook.com  

M doc/src/sgml/runtime.sgml
M src/backend/catalog/pg_attrdef.c
M src/backend/replication/logical/decode.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql

Fix typos referring to PGPROC

commit   : 08f8af983a8bd8ef78e48bab624071998a26cbb7    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 19 Sep 2022 11:36:51 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 19 Sep 2022 11:36:51 +0700    

Click here for diff

Japin Li  
  
Reviewed by Kyotaro Horiguchi  
Discussion: https://www.postgresql.org/message-id/MEYP282MB1669459813B36FB5EAA38434B6499@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  

M src/backend/access/transam/README
M src/backend/access/transam/xact.c

Harmonize missed reorderbuffer parameter names.

commit   : f66d997fd024223a78ebf64bf42f98f639b0b942    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 18 Sep 2022 12:05:07 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sun, 18 Sep 2022 12:05:07 -0700    

Click here for diff

The function ReorderBufferCommitChild() was overlooked by initial work  
from commit 035ce1fe.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-WzkhzFESnRo+VaGqyEZuzc33Dw09BdZBVmW896Sa22ci_A@mail.gmail.com  

M src/include/replication/reorderbuffer.h

Remove unused argument "isSlice" from transformAssignmentSubscripts()

commit   : 9f65aaa408f60081a057f559b717100b55511698    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Sep 2022 15:33:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 18 Sep 2022 15:33:16 +0900    

Click here for diff

Since c7aba7c, the transform method used during parse analysis of a  
subcripting construct has moved from transformAssignmentSubscripts() to  
the per-type transform method (arrays or arbitrary types) the step that  
checks for slicing support, but transformAssignmentSubscripts() has kept  
traces of it.  Removing it simplifies the code, so let's clean up all  
that.  
  
Author: Zhang Mingli  
Reviewed-by: Richard Guo  
Discussion: https://postgr.es/m/0d7041ac-c704-48ad-86fd-e05feddf08ed@Spark  

M src/backend/parser/parse_target.c

Harmonize reorderbuffer parameter names.

commit   : 035ce1feb2ed27680558ebc5cd1455041c8ec3cf    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 17 Sep 2022 17:20:17 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 17 Sep 2022 17:20:17 -0700    

Click here for diff

Make reorderbuffer.h function declarations consistently use named  
parameters.  Also make sure that the declarations use names that match  
corresponding names from function definitions in reorderbuffer.c.  This  
makes the definitions easier to follow, especially in the case of  
functions that happen to have adjoining arguments of the same type.  
  
This patch was written with help from clang-tidy.  Specifically, its  
"readability-inconsistent-declaration-parameter-name" check and its  
"readability-named-parameter" check were used.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/3955318.1663377656@sss.pgh.pa.us  

M src/backend/replication/logical/reorderbuffer.c
M src/include/replication/reorderbuffer.h

Make check_usermap() parameter names consistent.

commit   : 4274dc223ce75b2adf7b7cde5e00df7bbdd2a061    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 17 Sep 2022 16:54:17 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Sat, 17 Sep 2022 16:54:17 -0700    

Click here for diff

The function has a bool argument named "case_insensitive", but that was  
spelled "case_sensitive" in the declaration.  Make them consistent now  
to avoid confusion in the future.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Michael Paquiër <michael@paquier.xyz>  
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com  
Backpatch: 10-  

M src/include/libpq/hba.h

Include c.h instead of postgres.h in src/port/*p{read,write}*.c

commit   : 43fcaa345d5af45101c5d96dd164f1ebed686b2c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 17 Sep 2022 09:21:59 -0700    

Click here for diff

Frontend code shouldn't include postgres.h. Some files in src/port/ need to  
include postgres.h/postgres_fe.h, but these files don't.  
  
Discussion: https://postgr.es/m/20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de  
Backpatch: 12-, where 3fd2a7932ef introduced (some) of these files  

M src/port/preadv.c
M src/port/pwritev.c
M src/port/win32pread.c
M src/port/win32pwrite.c

Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in

commit   : 8d513a6b71b7ad94331a485adaf00adce8ee74ec    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 17 Sep 2022 09:15:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 17 Sep 2022 09:15:12 -0700    

Click here for diff

We got rid of the need for them in 4f5f485d10c and 846e91e0223.  
  
Discussion: https://postgr.es/m/20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de  

M configure
M configure.ac
M src/Makefile.global.in

pgstat: Create memory contexts below TopMemoryContext

commit   : 9d3ebba729ebaf5882a92f0f5f662a3312037605    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Sep 2022 14:08:40 -0700    

Click here for diff

So far they were created below CacheMemoryContext. However, that's not  
guaranteed to exist in all situations, leading to memory contexts created as  
top-level contexts. There isn't actually a good reason anymore to create them  
below CacheMemoryContext, so just creating them below TopMemoryContext seems  
the best approach.  
  
Reported-by: Reid Thompson <reid.thompson@crunchydata.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Author: "Drouvot, Bertrand" <bdrouvot@amazon.com>  
Discussion: https://postgr.es/m/b948b729-42fe-f88c-2f4a-0e65d84c049b@amazon.com  
Backpatch: 15-  

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

Fix huge_pages on Windows

commit   : fdd8937c071e85e2b7606939fb28284f008e15d1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 17 Sep 2022 15:39:55 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 17 Sep 2022 15:39:55 +0900    

Click here for diff

Since Windows 10 1703, it is additionally necessary to pass a flag  
called FILE_MAP_LARGE_PAGES to MapViewOfFile() to enable large pages at  
map time.  This flag is ignored on older versions of Windows, where  
large pages should still be able to work properly without setting it.  
Note that the flag would be set only for binaries that knew about it at  
compile-time, which should be more or less all the Windows environments  
these days.  
  
Since 495ed0e, Windows 10 is the minimum version of Windows supported by  
Postgres, making this change easy to reason about on HEAD.  Per  
discussion, no backpatch is done for the moment.  
  
Reported-by: Okano Naoki  
Author: Thomas Munro  
Reviewed-by: Tom Lane, Michael Paquier, Julien Rouhaud  
Discussion: https://postgr.es/m/17448-0a96583a67edb1f7@postgresql.org  

M src/backend/port/win32_shmem.c

Message style improvements

commit   : a0b65155d04e3d78e1ee92d5e3c6c340c7c6b286    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 17 Sep 2022 08:10:59 +0200    

Click here for diff

M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_target.c

Fix race condition in stats.sql added in 5264add7847

commit   : 32914d900f90f7f5238a3856e67f6bc5bf05e1d9    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 16 Sep 2022 10:07:12 -0700    

Click here for diff

Very occasionally the stats test failed due to the number of sessions not  
being updated yet. Likely this requires that there is contention on the  
database's stats entry. Solve this by forcing pending stats to be flushed  
before fetching the stats.  
  
I verified that there are no other test failures after making  
pgstat_report_stat() only flush stats when force = true.  
  
Per message from Tom Lane and buildfarm member crake.  
  
Discussion: https://postgr.es/m/3428246.1663271992@sss.pgh.pa.us  
Backpatch: 15-, where 5264add7847 added the test  

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

Improve plpgsql's ability to handle arguments declared as RECORD.

commit   : bfd6b3bc4e19db19289ae92a17799edae2cdd5f3    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 16 Sep 2022 13:23:01 -0400    

Click here for diff

Treat arguments declared as RECORD as if that were a polymorphic type  
(which it is, sort of), in that we substitute the actual argument type  
while forming the function cache lookup key.  This allows the specific  
composite type to be known in some cases where it was not before,  
at the cost of making a separate function cache entry for each named  
composite type that's passed to the function during a session.  The  
particular symptom discussed in bug #17610 could be solved in other  
more-efficient ways, but only at the cost of considerable development  
work, and there are other cases where we'd still fail without this.  
  
Per bug #17610 from Martin Jurča.  Back-patch to v11 where we first  
allowed plpgsql functions to be declared as taking type RECORD.  
  
Discussion: https://postgr.es/m/17610-fb1eef75bf6c2364@postgresql.org  

M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_record.sql

aix: xlc: Use -Wl,-b,expfull for old compiler versions

commit   : d08a049db9b47c32f3e7b6985a3105cae0da3681    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Sep 2022 10:55:03 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Tue, 13 Sep 2022 10:55:03 -0700    

Click here for diff

Unfortunately xlc 12.1 and earlier don't support -qvisibility. Therefore  
be7c15b194a doesn't suffice to make extension libraries work without the  
explicit mkldexport step removed in fe6a64a58ab. While 12.1 is EOL, there is  
some desire to leave buildfarm animals using it run a bit longer. But instead  
of adding back the complicated mkldexport step, we can use -Wl,-b,expfull to  
force all symbols to be exported.  
  
Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/2490844.1663123546@sss.pgh.pa.us  

M configure
M configure.ac

Clean up minor inconsistencies in pg_attribute_printf() usage.

commit   : eacbe94ab1f46d94a8532f9b9ac83ccd98cc1287    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 16 Sep 2022 11:10:48 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 16 Sep 2022 11:10:48 -0400    

Click here for diff

For some reason we'd never decorated pg_v*printf() with  
pg_attribute_printf() annotations.  There is a convention for  
how to label va_list-using printf functions (write zero for the  
second argument), and we use that liberally elsewhere in the  
code, but these core functions lacked it.  It's not clear how  
much useful checking the compiler can do for calls of these,  
but we might as well add the annotations.  
  
Also, sync win32security.c's log_error() with our normal convention  
that pg_attribute_printf must be attached to a function's declaration  
not definition.  Apparently this file is only compiled with compilers  
that aren't picky about that, but still it'd be better to be  
consistent.  
  
No back-patch since there's little reason to think we would catch  
anything.  
  
Discussion: https://postgr.es/m/3492412.1663283395@sss.pgh.pa.us  

M src/include/port.h
M src/port/win32security.c

Message wording improvements

commit   : b2451385cbb40f930838f6cd86c244912590a7d2    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 16:37:53 +0200    

Click here for diff

M doc/src/sgml/logical-replication.sgml
M src/backend/commands/subscriptioncmds.c
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/030_origin.pl

postgres_fdw: Remove useless DO block in test

commit   : 32b507378fac179717f093c78a0e70371fbdf514    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 15:57:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 15:57:34 +0200    

Click here for diff

Discussion: https://www.postgresql.org/message-id/flat/b1f9f399-3a1a-b554-283f-4ae7f34608e2@enterprisedb.com  

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

Adjust assorted hint messages that list all valid options.

commit   : 5ac51c8c9e4434140f4ba45b7bdb38896b48cc64    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 14:51:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 14:51:47 +0200    

Click here for diff

Instead of listing all valid options, we now try to provide one  
that looks similar.  Since this may be useful elsewhere, this  
change introduces a new set of functions that can be reused for  
similar purposes.  
  
Author: Nathan Bossart <nathandbossart@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/b1f9f399-3a1a-b554-283f-4ae7f34608e2@enterprisedb.com  

M contrib/dblink/dblink.c
M contrib/dblink/expected/dblink.out
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/option.c
M src/backend/foreign/foreign.c
M src/backend/utils/adt/varlena.c
M src/include/utils/varlena.h
M src/test/regress/expected/foreign_data.out

Fix createdb tests for C locale

commit   : 1e08576691bf1a25c0e28745e5e800c44f2a1c76    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 11:10:41 +0200    

Click here for diff

If the createdb tests run under the C locale, the database cluster  
will be initialized with encoding SQL_ASCII.  With the checks added in  
c7db01e325a530ec38ec7ba57cd3ed32e123e33c, this will cause several  
ICU-related tests to fail because SQL_ASCII is not supported by ICU.  
To work around that, use initdb option -E UTF8 for those tests to get  
past that check.  

M src/bin/scripts/t/020_createdb.pl

Don't allow creation of database with ICU locale with unsupported encoding

commit   : c7db01e325a530ec38ec7ba57cd3ed32e123e33c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 16 Sep 2022 09:37:54 +0200    

Click here for diff

Check in CREATE DATABASE and initdb that the selected encoding is  
supported by ICU.  Before, they would pass but users would later get  
an error from the server when they tried to use the database.  
  
Also document that initdb sets the encoding to UTF8 by default if the  
ICU locale provider is chosen.  
  
Author: Marina Polyakova <m.polyakova@postgrespro.ru>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://www.postgresql.org/message-id/6dd6db0984d86a51b7255ba79f111971@postgrespro.ru  

M doc/src/sgml/ref/initdb.sgml
M src/backend/commands/dbcommands.c
M src/bin/initdb/initdb.c
M src/bin/initdb/t/001_initdb.pl
M src/bin/scripts/t/020_createdb.pl

Detect format-string mistakes in the libpq_pipeline test module.

commit   : cf2c7a736e4939ff0d6cf2acd29b17eea3bca7c2    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Sep 2022 17:17:53 -0400    

Click here for diff

I happened to notice that libpq_pipeline's private implementation  
of pg_fatal lacked any pg_attribute_printf decoration.  Indeed,  
adding that turned up a mistake!  We'd likely never have noticed  
because the error exits in this code are unlikely to get hit,  
but still, it's a bug.  
  
We're so used to having the compiler check this stuff for us that  
a printf-like function without pg_attribute_printf is a land mine.  
I wonder if there is a way to detect such omissions.  
  
Back-patch to v14 where this code came in.  

M src/test/modules/libpq_pipeline/libpq_pipeline.c

Copy-edit docs for logical replication column lists

commit   : 3a06a79cd137d294bc82d931769d778c8c9aec91    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 15 Sep 2022 18:04:00 +0200    

Click here for diff

There was a excessive structure, leading to somewhat disorganized  
presentation of the information. Remove a few tags and reorder  
paragraphs to make the text flow more easily.  Also, reword some of it  
to be more concise.  
  
The bit about column list combination is not modified, other than to  
remove an uninteresting (and IMO confusing and wrong) paragraph; I  
intend to deal with it differently afterwards.  
  
Backpatch to 15.  
  
Discussion: https://postgr.es/m/20220913121138.yn7ekkfysxzhkm2u@alvherre.pgsql  

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

Revert ill-considered change in pg_resetwal output.

commit   : 918de37652138da7f7e54c79351178367d60f501    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Sep 2022 10:58:03 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 15 Sep 2022 10:58:03 -0400    

Click here for diff

Commit 31dcfae83 changed one pg_resetwal output string, and a  
corresponding test in pg_upgrade, without sufficient thought for  
the consequences.  We can't change that output without creating  
hazards for cross-version upgrades, since pg_upgrade needs to be able  
to read the output of several different versions of pg_resetwal.  
There may well be external tools with the same requirement.  
  
For the moment, just revert those two changes.  What we really  
ought to do here is have a separate, stable, easily machine-readable  
output format for pg_resetwal and pg_controldata, as proposed  
years ago by Alvaro.  Once that's in place and tools no longer  
need to depend on the exact spelling of the human-readable output,  
we can put back this change.  
  
Discussion: https://postgr.es/m/fbea8c6f-415a-bad9-c3de-969c40d08a84@dunslane.net  

M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c

Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.

commit   : b4f584f9d2a1b50d1f5ce88408a54bb11f1c8353    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Thu, 15 Sep 2022 06:45:23 -0700    

Click here for diff

After commit cc2c7d65fc27e877c9f407587b0b92d46cd6dd16 added this flag,  
failure to reset it caused assertion failures.  In non-assert builds, it  
made the system fail to achieve the objectives listed in that commit;  
chiefly, we might emit a spurious log message.  Back-patch to v15, where  
that commit first appeared.  
  
Bharath Rupireddy and Kyotaro Horiguchi.  Reviewed by Dilip Kumar,  
Nathan Bossart and Michael Paquier.  Reported by Dilip Kumar.  
  
Discussion: https://postgr.es/m/CAFiTN-sE3ry=ycMPVtC+Djw4Fd7gbUGVv_qqw6qfzp=JLvqT3g@mail.gmail.com  

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

Fix grammar in error message

commit   : 7beda87b6a4e5eae66f06df313581f7f53cab813    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 15 Sep 2022 11:40:17 +0700    

Click here for diff

While at it, make ellipses formatting consistent when describing SQL statements.  
  
Ekaterina Kiryanova and Alexander Lakhin  
  
Reviewed by myself and Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/eed5cec0-a542-53da-6a5e-7789c6ed9817%40postgrespro.ru  
Backpatch only the grammar fix to v15  

M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/bgworker.c
M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql

Blind attempt to fix LLVM dependency in the backend

commit   : 16492df70bb25bc99ca3c340a75ba84ca64171b8    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 15 Sep 2022 10:24:55 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 15 Sep 2022 10:24:55 +0700    

Click here for diff

Commit ecaf7c5df5 removed gram.h from the backend's generated-headers  
target. In LLVM builds, this leads to loss of dependency information  
when generating .bc files. To fix, add a rule that mirrors ad-hoc .o  
dependencies for .bc files as well.  
  
Per cfbot (no buildfarm failures reported)  
Analysis by Tom Lane and Andres Freund  
Proposed fix by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220914210427.y26tkagmxo5wwbvp%40awork3.anarazel.de  

M src/backend/common.mk

Use the terminology "WAL file" not "log file" more consistently.

commit   : 31dcfae83c001c6cdfd1e67c11adb9149f564da0    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 18:40:58 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 18:40:58 -0400    

Click here for diff

Referring to the WAL as just "log" invites confusion with the  
postmaster log, so avoid doing that in docs and error messages.  
Also shorten "WAL segment file" to just "WAL file" in various  
places.  
  
Bharath Rupireddy, reviewed by Nathan Bossart and Kyotaro Horiguchi  
  
Discussion: https://postgr.es/m/CALj2ACUeXa8tDPaiTLexBDMZ7hgvaN+RTb957-cn5qwv9zf-MQ@mail.gmail.com  

M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/pg_waldump.sgml
M doc/src/sgml/wal.sgml
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/replication/walreceiver.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_waldump/pg_waldump.c

Fix outdated convert_saop_to_hashed_saop comment

commit   : 63840526b05c5c12c92cb16be8748e4d20e6eab6    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 15 Sep 2022 09:40:34 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 15 Sep 2022 09:40:34 +1200    

Click here for diff

In 29f45e299, we added support for optimizing the execution of NOT  
IN(values) by using a hash table instead of a linear search over the  
array.  That commit neglected to update the header comment for  
convert_saop_to_hashed_saop() to mention this fact.  Here we fix that.  
  
Author: James Coleman  
Discussion: https://postgr.es/m/CAAaqYe99NUpAPcxgchGstgM23fmiGjqQPot8627YgkBgNt=BfA@mail.gmail.com  
Backpatch-through: 15, where 29f45e299 was added.  

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

Small wording improvements

commit   : 111d954024c8f4e6d8d273d8e7c1d64d14435bf5    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 22:30:51 +0200    

Click here for diff

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

Doc: add some doco about using the libpq_pipeline test module.

commit   : f40346ff0bae6ac9d00f3ae80d3a214e64662a2d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 16:43:19 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 16:43:19 -0400    

Click here for diff

The README file here was barely a stub.  Try to make it useful.  
  
Jelte Fennema, with some further work by me  
  
Discussion: https://postgr.es/m/AM5PR83MB0178D3B31CA1B6EC4A8ECC42F7529@AM5PR83MB0178.EURPRD83.prod.outlook.com  

M src/test/modules/libpq_pipeline/README

pgcrypto: Remove unused code

commit   : 1d3566f1b2a8cf518ec26322023d243b288a90aa    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 14 Sep 2022 21:58:30 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 14 Sep 2022 21:58:30 +0200    

Click here for diff

The mbuf_tell, mbuf_rewind and pgp_get_cipher_name functions were  
introduced in commit e94dd6ab91, but were never used, so remove.  
  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Discussion: https://postgr.es/m/FCF3F14E-17D5-41F2-AC58-0A97B341193A@yesql.se  

M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/mbuf.h
M contrib/pgcrypto/pgp.c
M contrib/pgcrypto/pgp.h

Update .gitignore

commit   : 5f84647ee1b25532cf5ea06801a4f36706a0cb96    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 21:55:28 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 21:55:28 +0200    

Click here for diff

Add entry for ab393528fa4b2486237ee7aa51fac67f82fee824.  Remove one  
obsolete entry.  

M doc/src/sgml/.gitignore

Use SIGNAL_ARGS consistently to declare signal handlers.

commit   : b66fbd8afe6eb80e3e48495e002fda9aa92df583    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 14:44:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 14 Sep 2022 14:44:45 -0400    

Click here for diff

Various bits of code were declaring signal handlers manually,  
using "int signum" or variants of that.  We evidently have no  
platforms where that's actually wrong, but let's use our  
SIGNAL_ARGS macro everywhere anyway.  If nothing else, it's  
good for finding signal handlers easily.  
  
No need for back-patch, since this is just cosmetic AFAICS.  
  
Discussion: https://postgr.es/m/2684964.1663167995@sss.pgh.pa.us  

M src/backend/storage/ipc/pmsignal.c
M src/bin/initdb/initdb.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_waldump/pg_waldump.c
M src/include/port.h
M src/test/regress/pg_regress.c

Run xmllint validation only once

commit   : ab393528fa4b2486237ee7aa51fac67f82fee824    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 17:55:22 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 14 Sep 2022 17:55:22 +0200    

Click here for diff

Before, each documentation target that built something from  
postgres.sgml ran xmllint first to validate the input.  Here, we  
change it so that the validation only runs once and produces an output  
file, and all the other targets build from that output file.  This  
avoids redundant work when building multiple documentation targets  
(such as html and man).  
  
Also, when we run xmllint, we can resolve entities (included files).  
This helps with tools that don't support vpath builds, such as  
dbtoepub.  
  
All this also organizes the make targets a bit better for implementing  
equivalent steps in meson.  
  
Discussion: https://www.postgresql.org/message-id/e3ae16de-c9f9-f559-2d11-70b1342ae3d1@enterprisedb.com  

M doc/src/sgml/Makefile
M doc/src/sgml/standalone-install.xml

Handle SIGTERM in pg_receivewal and pg_recvlogical

commit   : 8b60db774356117fab2eb53fb37160fa3e173cdb    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 14 Sep 2022 16:32:24 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 14 Sep 2022 16:32:24 +0200    

Click here for diff

In pg_receivewal, compressed output is only flushed on clean exits.  The  
reason to support SIGTERM as well as SIGINT (which is currently handled)  
is that pg_receivewal might well be running as a daemon, and systemd's  
default KillSignal is SIGTERM.  
  
Since pg_recvlogical is also supposed to run as a daemon, teach it about  
SIGTERM as well and update the documentation to match.  While in there,  
change pg_receivewal's time_to_stop to be sig_atomic_t like it is in  
pg_recvlogical.  
  
Author: Christoph Berg <myon@debian.org>  
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>  
Reviewed-by: Michael Paquier <michael@paquier.xyz>  
Discussion: https://postgr.es/m/Yvo/5No5S0c4EFMj@msg.df7cb.de  

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

Add subxid-overflow "isolation" test

commit   : 0e733278e346f19df93843bce9a81c8183df6e1d    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 14 Sep 2022 15:17:23 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 14 Sep 2022 15:17:23 +0200    

Click here for diff

This test covers a few lines of subxid-overflow-handling code in various  
part of the backend, which are otherwise uncovered.  
  
Author: Simon Riggs <simon.riggs@enterprisedb.com>  
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>  
Discussion: https://postgr.es/m/CANbhV-H8ov5+nCMBYQFKhO+UZJjrFgY_ORiMWr3RhS4+x44PzA@mail.gmail.com  

M src/include/storage/proc.h
A src/test/isolation/expected/subxid-overflow.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/subxid-overflow.spec

Remove duplicate initialization

commit   : 3fd1f4b9cd1e374e76e23dd37dfd6ab03b6ef935    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 14 Sep 2022 15:36:21 +0200    

Click here for diff

This appears to be a merge mistake in 96ef3237bf74.  We could put it  
back the way it was before JSON_TABLE and it'd be two lines shorter, but  
it's likely that JSON_TABLE will be back and will prefer things this  
way.  It makes no other difference in practice.  
  
Backpatch to 15.  
  
Reported by Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAr4nOcNQskC4oBEZN4S+4heJ=1ch_ZKOxU+_Ef-FQSf-g@mail.gmail.com  

M src/backend/parser/parse_relation.c

postgres_fdw: Avoid 'variable not found in subplan target list' error.

commit   : 9320cfdd06e5975b7bf60ab4c3d03195bf3fb5ff    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 14 Sep 2022 18:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Wed, 14 Sep 2022 18:45:00 +0900    

Click here for diff

The tlist of the EvalPlanQual outer plan for a ForeignScan node is  
adjusted to produce a tuple whose descriptor matches the scan tuple slot  
for the ForeignScan node.  But in the case where the outer plan contains  
an extra Sort node, if the new tlist contained columns required only for  
evaluating PlaceHolderVars or columns required only for evaluating local  
conditions, this would cause setrefs.c to fail with the error.  
  
The cause of this is that when creating the outer plan by injecting the  
Sort node into an alternative local join plan that could emit such extra  
columns as well, we fail to arrange for the outer plan to propagate them  
up through the Sort node, causing setrefs.c to fail to match up them in  
the new tlist to what is available from the outer plan.  Repair.  
  
Per report from Alexander Pyhalov.  
  
Richard Guo and Etsuro Fujita, reviewed by Alexander Pyhalov and Tom Lane.  
Backpatch to all supported versions.  
  
Discussion: http://postgr.es/m/cfb17bf6dfdf876467bd5ef533852d18%40postgrespro.ru  

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

Fix failure to build gramparse.h standalone in vpath builds

commit   : b0526d271d16d54064666d30bbfa53d4f335c66d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 14:33:35 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 14:33:35 +0700    

Click here for diff

Add include directory in a similar fashion as 829906fb6c.  
  
Per buildfarm animal crake  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Fix incorrect value for "strategy" with deflateParams() in walmethods.c

commit   : b447d6075db8041b870ac526525f6873df222db4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Sep 2022 14:52:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Sep 2022 14:52:20 +0900    

Click here for diff

The zlib documentation mentions the values supported for the compression  
strategy, but this code has been using a hardcoded value of 0 rather  
than Z_DEFAULT_STRATEGY.  This commit adjusts the code to use  
Z_DEFAULT_STRATEGY.  
  
Backpatch down to where this code has been added to ease the backport of  
any future patch touching this area.  
  
Reported-by: Tom Lane  
Discussion: https://postgr.es/m/1400032.1662217889@sss.pgh.pa.us  
Backpatch-through: 10  

M src/bin/pg_basebackup/walmethods.c

Fix typo in pgbench.c.

commit   : d583036d68d6fe2fa7facd63eb6548583094fa96    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 14 Sep 2022 11:09:48 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 14 Sep 2022 11:09:48 +0530    

Click here for diff

Author: Kyotaro Horiguchi  
Discussion: https://postgr.es/m/20220914.114608.1462991533784489178.horikyota.ntt@gmail.com  

M src/bin/pgbench/pgbench.c

Bump minimum Perl version to 5.14

commit   : 4c1532763a00c21cbb737bc3855e9a31374b119d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 09:58:13 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 09:58:13 +0700    

Click here for diff

The oldest vendor-shipped Perl in the buildfarm is 5.14.2, which is  
the last version that Debian Wheezy shipped. That OS is EOL, but we  
keep it running because there is no other convenient way to test certain  
non-mainstream 32-bit platforms. There is no bugfix in the 5.14.2 release  
that is required, and yet it's also not the latest minor release --  
that would be 5.14.4. To clarify the situation, we have thus arranged the  
buildfarm to test 5.14.0. That allows configure scripts and documentation  
to state 5.14 without fine print.  
  
The MSVC build didn't check the version, since our previous minimum 5.8.3  
was considered too old to check for on Windows. We will need a check for  
Windows sometime during the v16 cycle, but that could be rendered moot  
by the impending Meson conversion, so it seems safe to just document  
the requirement for now.  
  
Reviewed by Tom Lane  
Discussion: https://www.postgresql.org/message-id/20220902181553.ev4pgzhubhdkguuv@awork3.anarazel.de  

M config/perl.m4
M configure
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/pl/plperl/plc_perlboot.pl
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/README
M src/tools/msvc/gendef.pl
M src/tools/pgindent/pgindent

Move gramparse.h to src/backend/parser

commit   : ecaf7c5df54f7fa9df2fdc7225d2bb4e283f0081    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 10:41:44 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 14 Sep 2022 10:41:44 +0700    

Click here for diff

This header is semi-private, being used only in files related to  
raw parsing, so move to the backend directory where those files  
live. This allows removal of Makefile rules that symlink gram.h to  
src/include/parser, since gramparse.h can now include gram.h from  
within the same directory. This has the side-effect of no longer  
installing gram.h and gramparse.h, but there doesn't seem to be a  
good reason to continue doing so.  
  
Per suggestion from Andres Freund and Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/20220904181759.px6uosll6zbxcum5%40awork3.anarazel.de  

M src/backend/Makefile
M src/backend/parser/gram.y
R097 src/include/parser/gramparse.h src/backend/parser/gramparse.h
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/include/Makefile
D src/include/parser/.gitignore
M src/tools/msvc/Install.pm
M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Simplify handling of compression level with compression specifications

commit   : f352e2d08ac048d7407dd6098fc6b344ff85c2dd    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Sep 2022 12:16:57 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 14 Sep 2022 12:16:57 +0900    

Click here for diff

PG_COMPRESSION_OPTION_LEVEL is removed from the compression  
specification logic, and instead the compression level is always  
assigned with each library's default if nothing is directly given.  This  
centralizes the checks on the compression methods supported by a given  
build, and always assigns a default compression level when parsing a  
compression specification.  This results in complaining at an earlier  
stage than previously if a build supports a compression method or not,  
aka when parsing a specification in the backend or the frontend, and not  
when processing it.  zstd, lz4 and zlib are able to handle in their  
respective routines setting up the compression level the case of a  
default value, hence the backend or frontend code (pg_receivewal or  
pg_basebackup) has now no need to know what the default compression  
level should be if nothing is specified: the logic is now done so as the  
specification parsing assigns it.  It can also be enforced by passing  
down a "level" set to the default value, that the backend will accept  
(the replication protocol is for example able to handle a command like  
BASE_BACKUP (COMPRESSION_DETAIL 'gzip:level=-1')).  
  
This code simplification fixes an issue with pg_basebackup --gzip  
introduced by ffd5365, where the tarball of the streamed WAL segments  
would be created as of pg_wal.tar.gz with uncompressed contents, while  
the intention is to compress the segments with gzip at a default level.  
The origin of the confusion comes from the handling of the default  
compression level of gzip (-1 or Z_DEFAULT_COMPRESSION) and the value of  
0 was getting assigned, which is what walmethods.c would consider  
as equivalent to no compression when streaming WAL segments with its tar  
methods.  Assigning always the compression level removes the confusion  
of some code paths considering a value of 0 set in a specification as  
either no compression or a default compression level.  
  
Note that 010_pg_basebackup.pl has to be adjusted to skip a few tests  
where the shape of the compression detail string for client and  
server-side compression was checked using gzip.  This is a result of the  
code simplification, as gzip specifications cannot be used if a build  
does not support it.  
  
Reported-by: Tom Lane  
Reviewed-by: Tom Lane  
Discussion: https://postgr.es/m/1400032.1662217889@sss.pgh.pa.us  
Backpatch-through: 15  

M doc/src/sgml/protocol.sgml
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/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
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/common/compression.c
M src/include/common/compression.h

Split up guc.c for better build speed and ease of maintenance.

commit   : 0a20ff54f5e66158930d5328f89f087d4e9ab400    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Sep 2022 11:05:07 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 13 Sep 2022 11:05:07 -0400    

Click here for diff

guc.c has grown to be one of our largest .c files, making it  
a bottleneck for compilation.  It's also acquired a bunch of  
knowledge that'd be better kept elsewhere, because of our not  
very good habit of putting variable-specific check hooks here.  
Hence, split it up along these lines:  
  
* guc.c itself retains just the core GUC housekeeping mechanisms.  
* New file guc_funcs.c contains the SET/SHOW interfaces and some  
  SQL-accessible functions for GUC manipulation.  
* New file guc_tables.c contains the data arrays that define the  
  built-in GUC variables, along with some already-exported constant  
  tables.  
* GUC check/assign/show hook functions are moved to the variable's  
  home module, whenever that's clearly identifiable.  A few hard-  
  to-classify hooks ended up in commands/variable.c, which was  
  already a home for miscellaneous GUC hook functions.  
  
To avoid cluttering a lot more header files with #include "guc.h",  
I also invented a new header file utils/guc_hooks.h and put all  
the GUC hook functions' declarations there, regardless of their  
originating module.  That allowed removal of #include "guc.h"  
from some existing headers.  The fallout from that (hopefully  
all caught here) demonstrates clearly why such inclusions are  
best minimized: there are a lot of files that, for example,  
were getting array.h at two or more levels of remove, despite  
not having any connection at all to GUCs in themselves.  
  
There is some very minor code beautification here, such as  
renaming a couple of inconsistently-named hook functions  
and improving some comments.  But mostly this just moves  
code from point A to point B and deals with the ensuing  
needs for #include adjustments and exporting a few functions  
that previously weren't exported.  
  
Patch by me, per a suggestion from Andres Freund; thanks also  
to Michael Paquier for the idea to invent guc_funcs.c.  
  
Discussion: https://postgr.es/m/587607.1662836699@sss.pgh.pa.us  

M contrib/amcheck/verify_nbtree.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree_gist.c
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_trgm/trgm_op.c
M src/backend/access/brin/brin.c
M src/backend/access/table/tableamapi.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/backup/basebackup.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/commands/cluster.c
M src/backend/commands/indexcmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/variable.c
M src/backend/libpq/pqcomm.c
M src/backend/partitioning/partbounds.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/lmgr/predicate.c
M src/backend/tcop/postgres.c
M src/backend/tsearch/dict.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc.c
A src/backend/utils/misc/guc_funcs.c
A src/backend/utils/misc/guc_tables.c
M src/include/access/tableam.h
M src/include/access/xlog.h
D src/include/commands/variable.h
M src/include/replication/syncrep.h
M src/include/tcop/tcopprot.h
M src/include/tsearch/ts_cache.h
M src/include/utils/elog.h
M src/include/utils/guc.h
A src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/pg_locale.h
M src/test/regress/regress.c

Don't reflect unescaped cert data to the logs

commit   : 257eb57b50f7c65467bfc2f4d579622fa13f3370    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 16:10:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 16:10:50 +0200    

Click here for diff

Commit 3a0e385048 introduced a new path for unauthenticated bytes from  
the client certificate to be printed unescaped to the logs. There are a  
handful of these already, but it doesn't make sense to keep making the  
problem worse. \x-escape any unprintable bytes.  
  
The test case introduces a revoked UTF-8 certificate. This requires the  
addition of the `-utf8` flag to `openssl req`. Since the existing  
certificates all use an ASCII subset, this won't modify the existing  
certificates' subjects if/when they get regenerated; this was verified  
experimentally with  
  
    $ make sslfiles-clean  
    $ make sslfiles  
  
Unfortunately the test can't be run in the CI yet due to a test timing  
issue; see 55828a6b60.  
  
Author: Jacob Champion <jchampion@timescale.com>  
Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com  

M src/backend/libpq/be-secure-openssl.c
A src/test/ssl/conf/client-revoked-utf8.config
M src/test/ssl/ssl/client-crldir/9bb9e3c3.r0
A src/test/ssl/ssl/client-revoked-utf8.crt
A src/test/ssl/ssl/client-revoked-utf8.key
M src/test/ssl/ssl/client.crl
M src/test/ssl/ssl/root+client-crldir/9bb9e3c3.r0
M src/test/ssl/ssl/root+client.crl
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm

pg_clean_ascii(): escape bytes rather than lose them

commit   : 45b1a67a0fcb3f1588df596431871de4c93cb76f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 16:10:44 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 16:10:44 +0200    

Click here for diff

Rather than replace each unprintable byte with a '?' character, replace  
it with a hex escape instead. The API now allocates a copy rather than  
modifying the input in place.  
  
Author: Jacob Champion <jchampion@timescale.com>  
Discussion: https://www.postgresql.org/message-id/CAAWbhmgsvHrH9wLU2kYc3pOi1KSenHSLAHBbCVmmddW6-mc_=w@mail.gmail.com  

M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/guc.c
M src/common/string.c
M src/include/common/string.h

Make locale option behavior more consistent

commit   : da5d4ea5aaac4fc02f2e2aec272efe438dd4e171    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 13 Sep 2022 14:18:45 +0200    

Click here for diff

Locale options can be specified for initdb, createdb, and CREATE  
DATABASE.  In initdb, it has always been possible to specify --locale  
and then some --lc-* option to override a category.  CREATE DATABASE  
and createdb didn't allow that, requiring either the all-categories  
option or only per-category options.  In  
f2553d43060edb210b36c63187d52a632448e1d2, this was changed in CREATE  
DATABASE (perhaps by accident?) to be more like the initdb behavior,  
but createdb still had the old behavior.  
  
Now we change createdb to match the behavior of CREATE DATABASE and  
initdb, and also update the documentation of CREATE DATABASE to match  
the new behavior, which was not done in the above commit.  
  
Author: Marina Polyakova <m.polyakova@postgrespro.ru>  
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://www.postgresql.org/message-id/7c99c132dc9c0ac630e0127f032ac480@postgrespro.ru  

M doc/src/sgml/ref/create_database.sgml
M src/bin/scripts/createdb.c

Improve wal_decode_buffer_size description some more

commit   : 8e7a0b4a36741934d1350de5646efd2f3a10951e    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 13 Sep 2022 12:02:56 +0200    

Click here for diff

Per Thomas Munro  
  
Discussion: https://postgr.es/m/CA+hUKGJ9wP9kpvgoxHvqA=4g1d9-y_w3LhhdhFVU=mFiqjwHww@mail.gmail.com  

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

Remove useless pstrdups in untransformRelOptions

commit   : 6710e83a675eda798544fea4cdcb89eef7f39403    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 13 Sep 2022 11:59:31 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Tue, 13 Sep 2022 11:59:31 +0200    

Click here for diff

The two strings are already a single palloc'd chunk, not freed; there's  
no reason to allocate separate copies that have the same lifetime.  
  
This code is only called in short-lived memory contexts (except in some  
cases in TopTransactionContext, which is still short-lived enough not to  
really matter), and typically only for short arrays, so the memory or  
computation saved is likely negligible.  However, let's fix it to avoid  
leaving a bad example of code to copy.  This is the only place I could  
find where we're doing this with makeDefElem().  
  
Reported-by: Junwang Zhao <zhjwpku@gmail.com>  
Discussion: https://postgr.es/m/20220909142050.3vv2hjekppk265dd@alvherre.pgsql  

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

Adjust header exceptions for 0bd9c6297

commit   : fcf7b3a9d42c3cf778dab0fc644f11f12684d184    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Sep 2022 16:57:15 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Sep 2022 16:57:15 +0700    

Click here for diff

Per buildfarm animal crake  

M src/tools/pginclude/cpluspluscheck
M src/tools/pginclude/headerscheck

Treat Unicode codepoints of category "Format" as non-spacing

commit   : 0bd9c629732375e21d3ca6fba16c4a6a2808411a    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Sep 2022 16:13:33 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 13 Sep 2022 16:13:33 +0700    

Click here for diff

Commit d8594d123 updated the list of non-spacing codepoints used  
for calculating display width, but in doing so inadvertently removed  
some, since the script used for that commit only considered combining  
characters.  
  
For complete coverage for zero-width characters, include codepoints in  
the category Cf (Format). To reflect the wider purpose, also rename files  
and update comments that referred specifically to combining characters.  
  
Some of these ranges have been missing since v12, but due to lack of  
field complaints it was determined not important enough to justify adding  
special-case logic the backbranches.  
  
Kyotaro Horiguchi  
  
Report by Pavel Stehule  
Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRBE8yvpQ0FSkPCoe0Ny1jAAsAQ6j3qMgVwWvkqAoaaNmQ%40mail.gmail.com  

M src/common/unicode/Makefile
R064 src/common/unicode/generate-unicode_combining_table.pl src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/wchar.c
R091 src/include/common/unicode_combining_table.h src/include/common/unicode_nonspacing_table.h

commit   : bb629c294bea533884a379eee5f8ed6307c17bf2    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 13 Sep 2022 10:45:43 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 13 Sep 2022 10:45:43 +0900    

Click here for diff

This should have been part of 39969e2 that has renamed pg_stop_backup()  
to pg_backup_stop(), and this one is the last reference to  
pg_stop/start_backup() I could find in the tree.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACXjvC28ppeDTCrfaSyHga0ggP5nRLJbsjx=7N-74UT4QA@mail.gmail.com  

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

Move any remaining files generated by pg_upgrade into an internal subdir

commit   : ee5353abb6124de5ffd24ef1cedbc2a7196d4fd5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 13 Sep 2022 10:38:56 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 13 Sep 2022 10:38:56 +0900    

Click here for diff

This change concerns a couple of .txt files (for internal state checks)  
that were still written in the path where the binary is executed, and  
not in the subdirectory located in the target cluster.  Like the other  
.txt files doing already so (like loadable_libraries.txt), these are  
saved in the base output directory.  Note that on failure, the logs  
report the full path to the .txt file generated, so these are easy to  
find.  
  
Oversight in 38bfae3.  
  
Author: Daniel Gustafsson  
Reviewed-by: Michael Paquier, Justin Prysby  
Discussion: https://postgr.es/m/181A6DA8-3B7F-4B71-82D5-363FF0146820@yesql.se  
Backpatch-through: 15  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/version.c

Don't reference out-of-bounds array elements in brin_minmax_multi.c

commit   : 6b89ce1a21f909f616db165dcc6d8d2918fbc185    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 13 Sep 2022 11:02:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 13 Sep 2022 11:02:56 +1200    

Click here for diff

The primary fix here is to fix has_matching_range() so it does not  
reference ranges->values[-1] when nranges == 0.  Similar problems existed  
in AssertCheckRanges() too.  It does not look like any of these problems  
could lead to a crash as the array in question is at the end of the Ranges  
struct, and values[-1] is memory that belongs to other fields in the  
struct.  However, let's get rid of these rather unsafe coding practices.  
  
In passing, I (David) adjusted some comments to try to make it more clear  
what some of the fields are for in the Ranges struct.  I had to study the  
code to find out what nsorted was for as I couldn't tell from the  
comments.  
  
Author: Ranier Vilela  
Discussion: https://postgr.es/m/CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com  
Backpatch-through: 14, where multi-range brin was added.  

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

commit   : 346990ae2e9f50030831a27aba78653fbde8c7ca    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 12 Sep 2022 22:17:17 +0200    

Click here for diff

The FreeBSD site was changed with a redirect, which in turn seems to  
lead to a 404. Replace with the working link.  
  
Author: James Coleman <jtc331@gmail.com>  
Discussion: https://postgr.es/m/CAAaqYe_JZRj+KPn=hACtwsg1iLRYs=jYvxG1NW4AnDeUL1GD-Q@mail.gmail.com  

M doc/src/sgml/docguide.sgml

Use normal install program to install server headers.

commit   : c0a1d7621b0a6086630919d91dc031eea72ab0b6    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 12 Sep 2022 22:33:59 +0300    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 12 Sep 2022 22:33:59 +0300    

Click here for diff

Commit a7032690f9 replaced $(INSTALL) with plain "cp" for installing the  
server header files. It sped up "make install" significantly, because  
the old logic called $(INSTALL) separately for every header file,  
whereas plain "cp" could copy all the files in one command. However, we  
have long since made it a requirement that $(INSTALL) can also install  
multiple files in one command, see commit f1c5247563. Switch back to  
$(INSTALL).  
  
Discussion: https://www.postgresql.org/message-id/200503252305.j2PN52m23610%40candle.pha.pa.us  
Discussion: https://www.postgresql.org/message-id/2415283.1641852217%40sss.pgh.pa.us  

M src/include/Makefile

Revert "Convert *GetDatum() and DatumGet*() macros to inline functions"

commit   : e8d78581bb864369035c736a82ecfb57482a1a09    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 19:57:07 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 19:57:07 +0200    

Click here for diff

This reverts commit 595836e99bf1ee6d43405b885fb69bb8c6d3ee23.  
  
It has problems when USE_FLOAT8_BYVAL is off.  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Convert *GetDatum() and DatumGet*() macros to inline functions

commit   : 595836e99bf1ee6d43405b885fb69bb8c6d3ee23    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 17:35:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 17:35:55 +0200    

Click here for diff

The previous macro implementations just cast the argument to a target  
type but did not check whether the input type was appropriate.  The  
function implementation can do better type checking of the input type.  
  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/intarray/_int_gist.c
M doc/src/sgml/xfunc.sgml
M src/backend/access/gist/gistutil.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/mb/mbutils.c
M src/include/access/gin.h
M src/include/funcapi.h
M src/include/postgres.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/cash.h
M src/include/utils/date.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/geo_decls.h
M src/include/utils/inet.h
M src/include/utils/jsonb.h
M src/include/utils/jsonpath.h
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/pg_lsn.h
M src/include/utils/rangetypes.h
M src/include/utils/timestamp.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/xid8.h
M src/include/utils/xml.h

Fix NaN comparison in circle_same test

commit   : 8cb2a22bbb2cf4212482ac15021ceaa2e9c52209    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 12 Sep 2022 12:59:06 +0200    

Click here for diff

Commit c4c340088 changed geometric operators to use float4 and float8  
functions, and handle NaN's in a better way. The circle sameness test  
had a typo in the code which resulted in all comparisons with the left  
circle having a NaN radius considered same.  
  
  postgres=# select '<(0,0),NaN>'::circle ~= '<(0,0),1>'::circle;  
  ?column?  
  ----------  
  t  
  (1 row)  
  
This fixes the sameness test to consider the radius of both the left  
and right circle.  
  
Backpatch to v12 where this was introduced.  
  
Author: Ranier Vilela <ranier.vf@gmail.com>  
Discussion: https://postgr.es/m/CAEudQAo8dK=yctg2ZzjJuzV4zgOPBxRU5+Kb+yatFiddtQk6Rw@mail.gmail.com  
Backpatch-through: v12  

M src/backend/utils/adt/geo_ops.c
M src/test/regress/expected/geometry.out

pgstattuple: Use double consistently for percentages

commit   : 07d8af5e5e0cf5d5187353809920f344a5d20684    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 10:19:17 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 10:19:17 +0200    

Click here for diff

pgstattuple uses data type double for other percentage calculations  
and exposes those values to the users via the float8 data type.  
However, scanned_percent in struct output_type is of type uint64, even  
though it is later returned via Float8GetDatum().  Change it to use  
double to be inline with other percentages.  
  
Author: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com  

M contrib/pgstattuple/pgstatapprox.c

Use float8 datatype for percentiles in pg_walinspect stat functions

commit   : 57796a0f15f8fd3c908aa885a7ebb8ae47ce9880    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 09:38:07 +0200    

Click here for diff

pg_walinspect uses datatype double (double precision floating point  
number) for WAL stats percentile calculations and expose them via  
float4 (single precision floating point number), which an unnecessary  
loss of precision and confusing. Even though, it's harmless that way,  
let's use float8 (double precision floating-point number) to be in  
sync with what pg_walinspect does internally and what it exposes to  
the users. This seems to be the pattern used elsewhere in the code.  
  
Reported-by: Peter Eisentraut  
Author: Bharath Rupireddy  
Reviewed-by: Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/36ee692b-232f-0484-ce94-dc39d82021ad%40enterprisedb.com  

M contrib/pg_walinspect/pg_walinspect–1.0.sql
M contrib/pg_walinspect/pg_walinspect.c
M doc/src/sgml/pgwalinspect.sgml

Make the tablesync worker's replication origin drop logic robust.

commit   : 88f488319bac051b874bcec87941217e25e0e126    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 12 Sep 2022 12:40:57 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 12 Sep 2022 12:40:57 +0530    

Click here for diff

In commit f6c5edb8ab, we started to drop the replication origin slots  
before tablesync worker exits to avoid consuming more slots than required.  
We were dropping the replication origin in the same transaction where we  
were marking the tablesync state as SYNCDONE. Now, if there is any error  
after we have dropped the origin but before we commit the containing  
transaction, the in-memory state of replication progress won't be rolled  
back. Due to this, after the restart, tablesync worker can start streaming  
from the wrong location and can apply the already processed transaction.  
  
To fix this, we need to opportunistically drop the origin after marking  
the tablesync state as SYNCDONE. Even, if the tablesync worker fails to  
remove the replication origin before exit, the apply worker ensures to  
clean it up afterward.  
  
Reported by Tom Lane as per buildfarm.  
Diagnosed-by: Masahiko Sawada  
Author: Hou Zhijie  
Reviewed-By: Masahiko Sawada, Amit Kapila  
Discussion: https://postgr.es/m/20220714115155.GA5439@depesz.com  
Discussion: https://postgr.es/m/CAD21AoAw0Oofi4kiDpJBOwpYyBBBkJj=sLUOn4Gd2GjUAKG-fw@mail.gmail.com  

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

Assorted examples of expanded type-safer palloc/pg_malloc API

commit   : 5015e1e1b58f81a036e4ad16291ef4b3bb7a596c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    

Click here for diff

This adds some uses of the new palloc/pg_malloc variants here and  
there as a demonstration and test.  This is kept separate from the  
actual API patch, since the latter might be backpatched at some point.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/bb755632-2a43-d523-36f8-a1e7a389a907@enterprisedb.com  

M contrib/dblink/dblink.c
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginfast.c
M src/backend/commands/indexcmds.c
M src/backend/commands/prepare.c
M src/backend/executor/nodeHash.c
M src/backend/tcop/postgres.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/psql/startup.c
M src/common/config_info.c
M src/common/controldata_utils.c

Expand palloc/pg_malloc API for more type safety

commit   : 2016055a92f26d648aba9f66d26cc0bcd1619eff    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 12 Sep 2022 08:31:56 +0200    

Click here for diff

This adds additional variants of palloc, pg_malloc, etc. that  
encapsulate common usage patterns and provide more type safety.  
  
Specifically, this adds palloc_object(), palloc_array(), and  
repalloc_array(), which take the type name of the object to be  
allocated as its first argument and cast the return as a pointer to  
that type.  There are also palloc0_object() and palloc0_array()  
variants for initializing with zero, and pg_malloc_*() variants of all  
of the above.  
  
Inspired by the talloc library.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/bb755632-2a43-d523-36f8-a1e7a389a907@enterprisedb.com  

M src/include/common/fe_memutils.h
M src/include/utils/palloc.h

Make eval statement naturally proof against perltidy

commit   : b060f57791cfd84ec7c7eb84eb1d1d38b39aa0a5    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 12 Sep 2022 11:59:43 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 12 Sep 2022 11:59:43 +0700    

Click here for diff

This is a bit less verbose than adding an exception. Rewrite  
the other eval statement in Catalog.pm as well, just for  
the sake of consistency.  
  
Idea from Andrew Dunstan  
Discussion: https://www.postgresql.org/message-id/CAD5tBc%2BzRhuWn_S4ayH2sWKe60FQu1guTTokDFS3YMOeSrsozA%40mail.gmail.com  

M src/backend/catalog/Catalog.pm

Replace loading of ldap_start_tls_sA() by direct function call

commit   : c3fb5809eae3bb6f448ebc562462b39d6b1f6f22    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Sep 2022 09:07:10 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 12 Sep 2022 09:07:10 +0900    

Click here for diff

This change impacts the backend-side code in charge of starting a LDAP  
TLS session.  It is a bit sad that it is not possible to unify the WIN32  
and non-WIN32 code paths, but the different number of arguments for both  
discard this possibility.  
  
This is similar to 47bd0b3, where this replaces the last function  
loading that seems worth it, any others being either environment or  
version-dependent.  
  
Reported-by: Thomas Munro  
Reviewed-by: Thomas Munro  
Discussion: https://postgr.es/m/Yx0rxpNgDh8tN4XA@paquier.xyz  

M src/backend/libpq/auth.c

Doc: improve explanation of when custom GUCs appear in pg_settings.

commit   : 857808a4116b231822746d6e70ded27bff0ec612    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 10 Sep 2022 16:42:24 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 10 Sep 2022 16:42:24 -0400    

Click here for diff

Be more clear about when and how an extension-defined GUC comes to be  
visible in pg_settings.  (Move the para to the bottom of the page, too;  
whoever thought this point was more important than the para about the  
view being updatable had odd priorities IMNSHO.)  
  
Back-patch to v15 where archive modules were added, since that seems  
to have made this more of a sore spot than it was before.  
  
Benoit Lobréau, Nathan Bossart  
  
Discussion: https://postgr.es/m/CAPE8EZ7KHaXMHKwT=HOim23tDVKYA1PruRuTfeYdCrYWwPGhag@mail.gmail.com  

M doc/src/sgml/system-views.sgml

Add psql tab compression for ALTER TABLE .. { OF | NOT OF }

commit   : 6afcab6ac1e03975dc59d62c3ccaf98ed2831669    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 10 Sep 2022 17:22:29 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 10 Sep 2022 17:22:29 +0900    

Click here for diff

ALTER TABLE .. OF is now able to complete with the list of available  
composite types that can be used with the query.  
  
Author: Aleksander Alekseev  
Reviewed-by: Shinya Kato  
Discussion: https://postgr.es/m/47b71e0c523b30357208e79786161281@oss.nttdata.com  

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

Free correctly LDAPMessage returned by ldap_search_s() in auth.c

commit   : 799437e0bd3259c90d26e195894b6e22eb0b325c    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 10 Sep 2022 16:56:07 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 10 Sep 2022 16:56:07 +0900    

Click here for diff

The LDAP wiki states that the search message should be freed regardless  
of the return value of ldap_search_s(), but we failed to do so in one  
backend code path when searching LDAP with a filter.  This is not  
critical in an authentication code path failing in the backend as this  
causes such the process to exit promptly, but let's be clean and free  
the search message appropriately, as documented by upstream.  
  
All the other code paths failing a LDAP operation do that already, and  
somebody looking at this code in the future may miss what LDAP expects  
with the search message.  
  
Author: Zhihong Yu  
Discussion: https://postgr.es/m/CALNJ-vTf5Y+8RtzZ4GjOGE9qWVHZ8awfhnFYc_qGm8fMLUNRAg@mail.gmail.com  

M src/backend/libpq/auth.c

configure: Expand -fvisibility checks to more compilers, test for -qvisibility

commit   : be7c15b194ab91d28904a0e656f3f6600883ab68    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Sep 2022 22:53:02 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Sep 2022 22:53:02 -0700    

Click here for diff

It looks like icc and sunpro both support -fvisibility=hidden and xlc supports  
-qvisibility=hidden. I tested this on AIX and solaris with their proprietary  
compilers as well as gcc, and with gcc or clang on freebsd, linux, macos,  
netbsd and openbsd.  
  
Apparently my prior commit fe6a64a58ab only works in combination with this  
patch. While I tried to test them separately, an unknown caching issue  
prevented me from noticing the problem.  
  
Per discussion with Tom Lane and buildfarm member hoverfly.  
  
Discussion: https://postgr.es/m/20220910052741.t7w7csyrggwus2ze%40awork3.anarazel.de  
Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M configure
M configure.ac

aix: No need to use mkldexport when we want to export all symbols

commit   : fe6a64a58ab3e5bda3aceee2f1ee3e8efdb03865    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Sep 2022 19:11:49 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Fri, 9 Sep 2022 19:11:49 -0700    

Click here for diff

When building a shared library with exports.txt there's no need to build an  
intermediary static library, we can just pass -Wl,-bE:... when generating the  
.so.  
  
When building a shared library without exports.txt, there's no need to call  
mkldexport.sh to export all symbols, because all symbols are exported anyway,  
and we don't need the export file on the import side (like we do for  
postgres.imp).  
  
This makes building .so's on aix a lot more similar to building on other  
platforms. In particular, we don't create and remove a .a of the same name but  
different contents anymore.  
  
Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M src/Makefile.shlib
M src/makefiles/Makefile.aix

Fix possible omission of variable storage markers in ECPG.

commit   : b7050e2584803a6abe71fb0b94a63b63e59cff9c    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 15:34:04 -0400    

Click here for diff

The ECPG preprocessor converted code such as  
  
static varchar str1[10], str2[20], str3[30];  
  
into  
  
static  struct varchar_1  { int len; char arr[ 10 ]; }  str1 ;  
        struct varchar_2  { int len; char arr[ 20 ]; }  str2 ;  
        struct varchar_3  { int len; char arr[ 30 ]; }  str3 ;  
  
thus losing the storage attribute for the later variables.  
Repeat the declaration for each such variable.  
  
(Note that this occurred only for variables declared "varchar"  
or "bytea", which may help explain how it escaped detection  
for so long.)  
  
Andrey Sokolov  
  
Discussion: https://postgr.es/m/942241662288242@mail.yandex.ru  

M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/type.h
M src/interfaces/ecpg/test/expected/preproc-variable.c
M src/interfaces/ecpg/test/expected/preproc-variable.stderr
M src/interfaces/ecpg/test/expected/preproc-variable.stdout
M src/interfaces/ecpg/test/preproc/variable.pgc

Doc: improve documentation about where the psqlrc files are.

commit   : f734857a9211afcd4fc068dfa322642b6be99b87    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 13:50:42 -0400    

Click here for diff

Remove no-longer-accurate claim that Windows lacks home directories.  
Clarify the text by more clearly distinguishing which statements  
reflect hard-wired choices versus which ones reflect overridable  
defaults.  Update the examples of version-specific file names,  
and make them track future version changes by using "&majorversion;"  
and "&version;".  (BTW, in devel and beta releases this method  
correctly says that you can use strings like "16devel" and "15beta4"  
as minor version identifiers.)  
  
Back-patch to v15, but not further, with the thought that in older  
releases the examples with three-part version numbers still had  
some historical relevance.  v15 will be the first major release after  
the last 9.x branch went out of support.  
  
Robert Treat and Tom Lane, reviewed by Julien Rouhaud  
  
Discussion: https://postgr.es/m/CAJSLCQ07F-WCYYYOY8+dWhHcVeJ1Pb01cWc-c0Hu=M3EjKT2Eg@mail.gmail.com  

M doc/src/sgml/ref/psql-ref.sgml

Reject bogus output from uuid_create(3).

commit   : c4b6d218e369b69c20ca40d4ccefc02350f38c24    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 9 Sep 2022 12:41:36 -0400    

Click here for diff

When using the BSD UUID functions, contrib/uuid-ossp expects  
uuid_create() to produce a version-1 UUID.  FreeBSD still does so,  
but in recent NetBSD releases that function produces a version-4  
(random) UUID instead.  That's not acceptable for our purposes:  
if the user wanted v4 she would have asked for v4, not v1.  
Hence, check the version digit and complain if it's not '1'.  
  
Also drop the documentation's claim that the NetBSD implementation  
is usable.  It might be, depending on which OS version you're using,  
but we're not going to get into that kind of detail.  
  
(Maybe someday we should ditch all these external libraries  
and just write our own UUID code, but today is not that day.)  
  
Nazir Bilal Yavuz, with cosmetic adjustments and docs by me.  
Backpatch to all supported versions.  
  
Discussion: https://postgr.es/m/3848059.1661038772@sss.pgh.pa.us  
Discussion: https://postgr.es/m/17358-89806e7420797025@postgresql.org  

M contrib/uuid-ossp/uuid-ossp.c
M doc/src/sgml/installation.sgml
M doc/src/sgml/uuid-ossp.sgml

Doc fixes for MERGE statement

commit   : 5dcebd10baa8ec14a97029ca0bacaf2a9a0f8652    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 9 Sep 2022 13:51:45 +0200    

Click here for diff

In commit 3d895bc846f2 I introduced a bogus semicolon mid-statement by  
careless cut-n-paste; move it.  This had already been reported by Justin  
Pryzby.  
  
Also, change the styling a bit by avoiding names in CamelCase.  This is  
more consistent with the style we use elsewhere.  
  
Backpatch to 15.  
  
Author: Vitaly Burovoy <vitaly.burovoy@gmail.com>  
Reviewed-by: Vik Fearing <vik@postgresfriends.org>  
Discussion: https://postgr.es/m/9afe5766-5a61-7860-598c-136867fad065@gmail.com  
Discussion: https://postgr.es/m/20220819133016.GV26426@telsasoft.com  

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

Fix GetForeignKey*Triggers for self-referential FKs

commit   : 8c848cd4b8e9e0fee33eaad33cb44376b9e5b480    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Fri, 9 Sep 2022 12:22:20 +0200    

Click here for diff

Because of inadequate filtering, the check triggers were confusing the  
search for action triggers in GetForeignKeyActionTriggers and vice-versa  
in GetForeignKeyCheckTriggers; this confusion results in seemingly  
random assertion failures, and can have real impact in non-asserting  
builds depending on catalog order.  Change these functions so that they  
correctly ignore triggers that are not relevant to each side.  
  
To reduce the odds of further problems, do not break out of the  
searching loop in assertion builds.  This break is likely to hide bugs;  
without it, we would have detected this bug immediately.  
  
This problem was introduced by f4566345cf40, so backpatch to 15 where  
that commit first appeared.  
  
Author: Amit Langote <amitlangote09@gmail.com>  
Discussion: https://postgr.es/m/20220908172029.sejft2ppckbo6oh5@awork3.anarazel.de  
Discussion: https://postgr.es/m/4104619.1662663056@sss.pgh.pa.us  

M src/backend/commands/tablecmds.c

Bump minimum version of Flex to 2.5.35

commit   : 8b878bffa8d8ac7e13508025c3ca5e6101e3a5e8    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    

Click here for diff

Since the retirement of some older buildfarm members, the oldest Flex  
that gets regular testing is 2.5.35.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/1097762.1662145681@sss.pgh.pa.us  

M config/programs.m4
M configure
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/utils/misc/guc-file.l
M src/tools/msvc/pgflex.pl

Bump minimum version of Bison to 2.3

commit   : b086a47a270fba133969e78f1fb9e264725d97ae    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 11:41:58 +0700    

Click here for diff

Since the retirement of some older buildfarm members, the oldest Bison  
that gets regular testing is 2.3. MacOS ships that version, and will  
continue doing so for the forseeable future because of Apple's policy  
regarding GPLv3. While Mac users could use a package manager to install  
a newer version, there is no compelling reason to force them do so at  
this time.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/1097762.1662145681@sss.pgh.pa.us  

M config/programs.m4
M configure
M contrib/cube/cubeparse.y
M contrib/seg/segparse.y
M doc/src/sgml/install-windows.sgml
M doc/src/sgml/installation.sgml
M src/backend/bootstrap/bootparse.y
M src/backend/parser/gram.y
M src/backend/replication/repl_gram.y
M src/backend/replication/syncrep_gram.y
M src/backend/utils/adt/jsonpath_gram.y
M src/pl/plpgsql/src/pl_gram.y
M src/tools/msvc/pgbison.pl

Add jsonpath_gram.h to list of distprep targets

commit   : 96683db880cab7791006fcc13416d67f6230a2f7    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Fri, 9 Sep 2022 11:34:09 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Fri, 9 Sep 2022 11:34:09 +0700    

Click here for diff

Oversight in dac048f71e  

M src/backend/Makefile

Replace load of functions by direct calls for some WIN32

commit   : 47bd0b3fa601642b6cfbe79ad956d4a9fc835ba1    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Sep 2022 10:52:17 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Sep 2022 10:52:17 +0900    

Click here for diff

This commit changes the following code paths to do direct system calls  
to some WIN32 functions rather than loading them from an external  
library, shaving some code in the process:  
- Creation of restricted tokens in pg_ctl.c, introduced by a25cd81.  
- QuerySecurityContextToken() in auth.c for SSPI authentication in the  
backend, introduced in d602592.  
- CreateRestrictedToken() in src/common/.  This change is similar to the  
case of pg_ctl.c.  
  
Most of these functions were loaded rather than directly called because,  
as mentioned in the code comments, MinGW headers were not declaring  
them.  I have double-checked the recent MinGW code, and all the  
functions changed here are declared in its headers, so this change  
should be safe.  Note that I do not have a MinGW environment at hand so  
I have not tested it directly, but that MSVC was fine with the change.  
The buildfarm will tell soon enough if this change is appropriate or not  
for a much broader set of environments.  
  
A few code paths still use GetProcAddress() to load some functions:  
- LDAP authentication for ldap_start_tls_sA(), where I am not confident  
that this change would work.  
- win32env.c and win32ntdll.c where we have a per-MSVC version  
dependency for the name of the library loaded.  
- crashdump.c for MiniDumpWriteDump() and EnumDirTree(), where direct  
calls were not able to work after testing.  
  
Reported-by: Thomas Munro  
Reviewed-by: Justin Prysby  
Discussion: https://postgr.es/m/CA+hUKG+BMdcaCe=P-EjMoLTCr3zrrzqbcVE=8h5LyNsSVHKXZA@mail.gmail.com  

M src/backend/libpq/auth.c
M src/bin/pg_ctl/pg_ctl.c
M src/common/restricted_token.c

Add more error context to RestoreBlockImage() and consume it

commit   : df4a056619a7e9868ec43a15e2088ff8ccf94471    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Sep 2022 10:00:40 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 9 Sep 2022 10:00:40 +0900    

Click here for diff

On failure in restoring a block image, no details were provided, while  
it is possible to see failure with an inconsistent record state, a  
failure in processing decompression or a failure in decompression  
because a build does not support this option.  
  
RestoreBlockImage() is used in two code paths in the backend code,  
during recovery and when checking a page consistency after applying  
masking, and both places are changed to consume the error message  
produced by the internal routine when it returns a false status.  All  
the error messages are reported under ERRCODE_INTERNAL_ERROR, that gets  
used also when attempting to access a page compressed by a method  
not supported by the build attempting the decompression.  This is  
something that can happen in core when doing physical replication with  
primary and standby using inconsistent build options, for example.  
  
This routine is available since 2c03216d and it has never provided any  
context about the error happening when it failed.  This change is  
justified even more after 57aa5b2, that introduced compression of FPWs  
in WAL.  
  
Reported-by: Justin Prysby  
Author: Michael Paquier  
Discussion: https://postgr.es/m/20220905002320.GD31833@telsasoft.com  
Backpatch-through: 15  

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

Instrument freezing in autovacuum log reports.

commit   : d977ffd923d207164eef78ed107d5293aee6c660    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 8 Sep 2022 10:29:39 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 8 Sep 2022 10:29:39 -0700    

Click here for diff

Add a new line to log reports from autovacuum (as well as VACUUM VERBOSE  
output) that shows information about freezing.  Emphasis is placed on  
the total number of heap pages that had one or more tuples frozen by  
VACUUM.  The total number of tuples frozen is also shown.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Jeff Janes <jeff.janes@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WznTY6D0zyE8VLrC6Gd4kh_HGAXxnTPtcOQOOsxzLx9zog@mail.gmail.com  

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

Temporarily make MemoryContextContains return false

commit   : b76fb6c2a99eb7d49f96e56599fef1ffc1c134c9    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 9 Sep 2022 00:28:38 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 9 Sep 2022 00:28:38 +1200    

Click here for diff

5265e91fd changed MemoryContextContains to update it so that it works  
correctly with the new MemoryChunk code added in c6e0fe1f2.  However,  
5265e91fd was done with the assumption that MemoryContextContains would  
only ever be given pointers to memory that had been returned by one of our  
MemoryContext allocators.  It seems that's not true and many of our 32-bit  
buildfarm animals are clearly showing that.  
  
There are some code paths that call MemoryContextContains with a pointer  
pointing part way into an allocated chunk.  The example of this found by  
the 32-bit buildfarm animals is the int2int4_sum() function.  This  
function returns transdata->sum, which is not a pointer to memory that was  
allocated directly.  This return value is then subsequently passed to  
MemoryContextContains which causes it to crash due to it thinking the  
memory directly prior to that pointer is a MemoryChunk.  What's actually  
in that memory is the field in the struct that comes prior to the "sum"  
field.  This problem didn't occur in 64-bit world because BIGINT is a  
byval type and the code which was calling MemoryContextContains with the  
bad pointer only does so with non-byval types.  
  
Here, instead of reverting 5265e91fd and making MemoryContextContains  
completely broken again, let's just make it always return false for now.  
Effectively prior to 5265e91fd it was doing that anyway, this at least  
makes that more explicit.  The only repercussions of this with the current  
MemoryContextContains calls are that we perform a datumCopy() when we  
might not need to.  This should make the 32-bit buildfarm animals happy  
again and give us more time to consider a long-term fix.  
  
Discussion: https://postgr.es/m/20220907130552.sfjri7jublfxyyi4%40jrouhaud  

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

Choose FK name correctly during partition attachment

commit   : e7936f8b3e57046c0e178ccefa04ac7e6fbae79c    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 8 Sep 2022 13:17:02 +0200    

Click here for diff

During ALTER TABLE ATTACH PARTITION, if the name of a parent's foreign  
key constraint is already used on the partition, the code tries to  
choose another one before the FK attributes list has been populated,  
so the resulting constraint name was "<relname>__fkey" instead of  
"<relname>_<attrs>_fkey".  Repair, and add a test case.  
  
Backpatch to 12.  In 11, the code to attach a partition was not smart  
enough to cope with conflicting constraint names, so the problem doesn't  
exist there.  
  
Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>  
Discussion: https://postgr.es/m/20220901184156.738ebee5@karst  

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

Fix recovery_prefetch with low maintenance_io_concurrency.

commit   : adb466150b44d1eaf43a2d22f58ff4c545a0ed3f    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 8 Sep 2022 20:25:20 +1200    

Click here for diff

We should process completed IOs *before* trying to start more, so that  
it is always possible to decode one more record when the decoded record  
queue is empty, even if maintenance_io_concurrency is set so low that a  
single earlier WAL record might have saturated the IO queue.  
  
That bug was hidden because the effect of maintenance_io_concurrency was  
arbitrarily clamped to be at least 2.  Fix the ordering, and also remove  
that clamp.  We need a special case for 0, which is now treated the same  
as recovery_prefetch=off, but otherwise the number is used directly.  
This allows for testing with 1, which would have made the problem  
obvious in simple test scenarios.  
  
Also add an explicit error message for missing contrecords.  It was a  
bit strange that we didn't report an error already, and became a latent  
bug with prefetching, since the internal state that tracks aborted  
contrecords would not survive retrying, as revealed by  
026_overwrite_contrecord.pl with this adjustment.  Reporting an error  
prevents that.  
  
Back-patch to 15.  
  
Reported-by: Justin Pryzby <pryzby@telsasoft.com>  
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/20220831140128.GS31833%40telsasoft.com  

M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/include/access/xlogreader.h

Fix perltidy breaking perlcritic

commit   : 12d40d4a8d0495cf2c7b564daa8aaa7f107a6c56    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 8 Sep 2022 11:16:09 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Thu, 8 Sep 2022 11:16:09 +0200    

Click here for diff

perltidying a "##no critic" line moves the marker to where it becomes  
useless.  Put the line back to how it was, and protect it from further  
malfeasance.  
  
Per buildfarm member crake.  

M src/backend/catalog/Catalog.pm

doc: Fix PL/pgSQL casing to be consistent

commit   : cb62d0b3c372350b997733f41283cc35a6814024    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 8 Sep 2022 09:56:50 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 8 Sep 2022 09:56:50 +0200    

Click here for diff

Ensure that all mentions of PL/pgSQL is cased equally, a few instances  
of PL/PgSQL had snuck in.  
  
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>  
Discussion: https://postgr.es/m/DDCF61C3-9E25-48A8-97BE-6113A93D54A5@yesql.se  

M doc/src/sgml/plpgsql.sgml

Add b2e6e7682 to .git-blame-ignore-revs

commit   : b289b86231ad10fb317231ff85596d6272203916    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 14:05:40 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 14:05:40 +0700    

Click here for diff

M .git-blame-ignore-revs

Run perltidy over Catalog.pm

commit   : b2e6e768230be334b12dae536ba4c147fba4e9c9    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 13:54:14 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 13:54:14 +0700    

Click here for diff

Commit 69eb643b2 deliberately left indentation unchanged to make the changes  
more legible. Rather than waiting until next year's perltidy run, do it now  
to avoid confusion  
  
Per suggestion from Álvaro Herrera  
Discussion: https://www.postgresql.org/message-id/20220907083558.vfvb5hcauaictgum%40alvherre.pgsql  

M src/backend/catalog/Catalog.pm

Parse catalog .dat files as a whole when compiling the backend

commit   : 69eb643b2582f180c91b2d14c896402e54040231    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 13:23:13 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 8 Sep 2022 13:23:13 +0700    

Click here for diff

Previously Catalog.pm eval'd each individual hash reference  
so that comments and whitespace can be preserved when running  
reformat-dat-files. This is unnecessary when building, and we can save  
~15% off the run time of genbki.pl by simply slurping and eval'-ing  
the whole file at once. This saves a bit of time, especially in highly  
parallel builds, since most build targets depend on this script's outputs.  
  
Report and review by Andres Freund  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGW%3DWRbnxXrc8UqqR479XuxtukSFWV-hnmtgsbuNAUO6w%40mail.gmail.com  

M src/backend/catalog/Catalog.pm

Fix the test case introduced by commit 8756930190.

commit   : 0324651573479f4e782f76c0d06f2ebd02e6160a    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Sep 2022 09:47:43 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Sep 2022 09:47:43 +0530    

Click here for diff

Before dropping a relation, ensure that it has reached a 'ready' state  
after initial synchronization.  
  
Author: Vignesh C  
Reviewed-By: Amit Kapila  
Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com  

M src/test/subscription/t/030_origin.pl

Raise a warning if there is a possibility of data from multiple origins.

commit   : 875693019053b8897ec3983e292acbb439b088c3    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Sep 2022 06:54:13 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Thu, 8 Sep 2022 06:54:13 +0530    

Click here for diff

This commit raises a warning message for a combination of options  
('copy_data = true' and 'origin = none') during CREATE/ALTER subscription  
operations if the publication tables were also replicated from other  
publishers.  
  
During replication, we can skip the data from other origins as we have that  
information in WAL but that is not possible during initial sync so we raise  
a warning if there is such a possibility.  
  
Author: Vignesh C  
Reviewed-By: Peter Smith, Amit Kapila, Jonathan Katz, Shi yu, Wang wei  
Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@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/030_origin.pl

Message style fixes

commit   : 4b4663fb4a704b7a145ed6ec018b1f0c116eeb6b    
  
author   : Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    
  
committer: Alvaro Herrera <alvherre@alvh.no-ip.org>    
date     : Wed, 7 Sep 2022 17:33:49 +0200    

Click here for diff

M src/backend/replication/logical/worker.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc.c
M src/test/subscription/t/029_on_error.pl

Make MemoryContextContains work correctly again

commit   : 5265e91fd10ddbc47921126571ed64914fd3cb72    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 8 Sep 2022 00:20:20 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 8 Sep 2022 00:20:20 +1200    

Click here for diff

c6e0fe1f2 recently changed the way we store headers for allocated chunks  
of memory.  Prior to that commit, we stored a pointer to the owning  
MemoryContext directly prior to the pointer to the allocated memory.  
That's no longer true and c6e0fe1f2 neglected to update  
MemoryContextContains() so that it correctly obtains the owning context  
with the new method.  
  
A side effect of this change and c6e0fe1f2, in general, is that it's even  
less safe than it was previously to pass MemoryContextContains() an  
arbitrary pointer which was not allocated by one of our MemoryContexts.  
Previously some comments in MemoryContextContains() seemed to indicate  
that the worst that could happen by passing an arbitrary pointer would be  
a false positive return value.  It seems to me that this was a rather  
wishful outlook as we subsequently proceeded to subtract sizeof(void *)  
from the given pointer and then dereferenced that memory.  So it seems  
quite likely that we could have segfaulted instead of returning a false  
positive.  However, it's not impossible that the memory sizeof(void *)  
bytes before the pointer could have been owned by the process, but it's  
far less likely to work now as obtaining a pointer to the owning  
MemoryContext is less direct than before c6e0fe1f2 and will access memory  
that's possibly much further away to obtain the owning MemoryContext.  
Because of this, I took the liberty of updating the comment to warn  
against any future usages of the function and checked the existing core  
usages to ensure that we only ever pass in a pointer to memory allocated  
by a MemoryContext.  
  
Extension authors updating their code for PG16 who are using  
MemoryContextContains should check to ensure that only NULL pointers and  
pointers to chunks allocated with a MemoryContext will ever be passed to  
MemoryContextContains.  
  
Reported-by: Andres Freund  
Discussion: https://postgr.es/m/20220905230949.kb3x2fkpfwtngz43@awork3.anarazel.de  

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

Renumber confusing value for GUC_UNIT_BYTE

commit   : 3fe76ab9722c2891855dd2b34261f7c23a2e5b2b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Sep 2022 11:03:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 7 Sep 2022 11:03:53 +0200    

Click here for diff

It had a power-of-two value, which looks right, and causes the other  
values which aren't powers-of-two to look wrong.  But this is tested  
for equality and not a bitwise test.  
  
See also:  
6e7baa322773ff8c79d4d8883c99fdeff5bfa679  
https://www.postgresql.org/message-id/CAOG9ApEu8bXVwBxkOO9J7ZpM76TASK_vFMEEiCEjwhMmSLiaqQ%40mail.gmail.com  
  
Author: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://www.postgresql.org/message-id/flat/20220720145220.GJ12702@telsasoft.com  

M src/include/utils/guc.h

Make more effort to put a sentinel at the end of allocated memory

commit   : 0e480385ec59aa7f769366eb24462acc2b7a40d7    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 7 Sep 2022 15:46:57 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 7 Sep 2022 15:46:57 +1200    

Click here for diff

Traditionally, in MEMORY_CONTEXT_CHECKING builds, we only ever marked a  
sentinel byte just beyond the requested size if there happened to be  
enough space on the chunk to do so.  For Slab and Generation context  
types, we only rounded the size of the chunk up to the next maxalign  
boundary, so it was often not that likely that those would ever have space  
for the sentinel given that the majority of allocation requests are going  
to be for sizes which are maxaligned.  For AllocSet, it was a little  
different as smaller allocations are rounded up to the next power-of-2  
value rather than the next maxalign boundary, so we're a bit more likely  
to have space for the sentinel byte, especially when we get away from tiny  
sized allocations such as 8 or 16 bytes.  
  
Here we make more of an effort to allow space so that there is enough room  
for the sentinel byte in more cases.  This makes it more likely that we'll  
detect when buggy code accidentally writes beyond the end of any of its  
memory allocations.  
  
Each of the 3 MemoryContext types has been changed as follows:  
  
The Slab allocator will now always set a sentinel byte.  Both the current  
usages of this MemoryContext type happen to use chunk sizes which were on  
the maxalign boundary, so these never used sentinel bytes previously.  
  
For the Generation allocator, we now always ensure there's enough space in  
the allocation for a sentinel byte.  
  
For AllocSet, this commit makes an adjustment for allocation sizes which  
are greater than allocChunkLimit.  We now ensure there is always space for  
a sentinel byte.  We don't alter the sentinel behavior for request sizes  
<= allocChunkLimit.  Making way for the sentinel byte for power-of-2  
request sizes would require doubling up to the next power of 2.  Some  
analysis done on the request sizes made during installcheck shows that a  
fairly large portion of allocation requests are for power-of-2 sizes.  The  
amount of additional memory for the sentinel there seems prohibitive, so  
we do nothing for those here.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/3478405.1661824539@sss.pgh.pa.us  

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

Doc: Explain about Column List feature.

commit   : f98d07424523ab5fefa6c6483dbf60d0d2fe1df3    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Wed, 7 Sep 2022 08:58:31 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Wed, 7 Sep 2022 08:58:31 +0530    

Click here for diff

Add a new logical replication section for "Column Lists" (analogous to the  
Row Filters page). This explains how the feature can be used and the  
caveats in it.  
  
Author: Peter Smith  
Reviewed-by: Shi yu, Vignesh C, Erik Rijkers, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

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

Fix new pg_publication_tables query.

commit   : 20b6847176976da9cae6103475b967e6c2971898    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 6 Sep 2022 18:00:32 -0400    

Click here for diff

The addition of published column names forgot to filter on attisdropped,  
leading to cases where you could see "........pg.dropped.1........"  
or the like as a reportedly-published column.  
  
While we're here, rewrite the new subquery to get a more efficient plan  
for it.  
  
Hou Zhijie, per report from Jaime Casanova.  Back-patch to v15 where  
the bug was introduced.  (Sadly, this means we need a post-beta4  
catversion bump before beta4 has even hit the streets.  I see no  
good alternative though.)  
  
Discussion: https://postgr.es/m/Yxa1SU4nH2HfN3/i@ahch-to  

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

Fix cplusplusscheck in vpath builds

commit   : cec2754fbebee0a40aaf905947deb823cca4fe39    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    

Click here for diff

Same solution as 829906fb6.  

M src/tools/pginclude/cpluspluscheck

Add psql tab compression for SET COMPRESSION with ALTER TABLE

commit   : 4cbe579746ea05898f2b0c7ba88e4015b781ff71    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Sep 2022 15:36:42 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 6 Sep 2022 15:36:42 +0900    

Click here for diff

Author: Aleksander Alekseev  
Reviewed-by: Shinya Kato  
Discussion: https://postgr.es/m/CAJ7c6TMuT+=P7uDepjVpdqSEp2xOmXET3Y2K-xWAO=sCz-28gg@mail.gmail.com  

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

Fix headerscheck in vpath builds

commit   : 829906fb6c21e39e732f340600f461f3d8db24c2    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:46:41 +0700    

Click here for diff

Oversight in dac048f71e per buildfarm animal crake.  
Fix per suggestion from Andrew Dunstan.  
  
Discussion: https://www.postgresql.org/message-id/e3f4a3d0-dfcc-41cc-1ed2-acc15700ddef%40dunslane.net  

M src/tools/pginclude/headerscheck

Fix failure to maintainer-clean jsonpath_gram.h

commit   : eac76cc012aa4888e882287baae791429396b403    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:30:56 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 12:30:56 +0700    

Click here for diff

Oversight in dac048f71e  

M src/backend/Makefile

Fix typo in 16d69ec29

commit   : c89b44a68d918e24335f2d132684c53dd16d0d2b    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 15:59:15 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 15:59:15 +1200    

Click here for diff

As noted by Justin Pryzby, just I forgot to commit locally before creating  
a patch file.  
  
Discussion: https://postgr.es/m/20220901053146.GI31833@telsasoft.com  

M src/backend/commands/trigger.c

Remove buggy and dead code from CreateTriggerFiringOn

commit   : 16d69ec29b1199831c74504845f5d6117dbfc738    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 15:51:44 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 15:51:44 +1200    

Click here for diff

Here we remove some dead code from CreateTriggerFiringOn() which was  
attempting to find the relevant child partition index corresponding to the  
given indexOid.  As it turned out, thanks to -Wshadow=compatible-local,  
this code was buggy as the code which was finding the child indexes  
assigned those to a shadowed variable that directly went out of scope.  
The code which thought it was looking at the List of child indexes was  
always referencing an empty List.  
  
On further investigation, this code is dead.  We never call  
CreateTriggerFiringOn() passing a valid indexOid in a way that the  
function would actually ever execute the code in question.  So, for lack  
of a way to test if a fix actually works, let's just remove the dead code  
instead.  
  
As a reminder, if there is ever a need to resurrect this code, an Assert()  
has been added to remind future feature developers that they might need to  
write some code to find the corresponding child index.  
  
Reported-by: Justin Pryzby  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/20220819211824.GX26426@telsasoft.com  

M src/backend/commands/trigger.c

Add missing exceptions to cpluspluscheck

commit   : 8c06a282fe35a02338116a7ad4df9ea309b3deb4    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 10:27:05 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 6 Sep 2022 10:27:05 +0700    

Click here for diff

dac048f71 added exceptions to headerscheck but failed to do the  
same for cpluspluscheck  
  
Per report from Andres Freund regarding CI  
Discussion:https://www.postgresql.org/message-id/20220904205743.y3ntq6ij3aibmxvy%40awork3.anarazel.de  

M src/tools/pginclude/cpluspluscheck

Fix an assortment of improper usages of string functions

commit   : 8b26769bc441fffa8aad31dddc484c2f4043d2c9    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 13:19:44 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 6 Sep 2022 13:19:44 +1200    

Click here for diff

In a similar effort to f736e188c and 110d81728, fixup various usages of  
string functions where a more appropriate function is available and more  
fit for purpose.  
  
These changes include:  
  
1. Use cstring_to_text_with_len() instead of cstring_to_text() when  
   working with a StringInfoData and the length can easily be obtained.  
2. Use appendStringInfoString() instead of appendStringInfo() when no  
   formatting is required.  
3. Use pstrdup(...) instead of psprintf("%s", ...)  
4. Use pstrdup(...) instead of psprintf(...) (with no formatting)  
5. Use appendPQExpBufferChar() instead of appendPQExpBufferStr() when the  
   length of the string being appended is 1.  
6. appendStringInfoChar() instead of appendStringInfo() when no formatting  
   is required and string is 1 char long.  
7. Use appendPQExpBufferStr(b, .) instead of appendPQExpBuffer(b, "%s", .)  
8. Don't use pstrdup when it's fine to just point to the string constant.  
  
I (David) did find other cases of #8 but opted to use #4 instead as I  
wasn't certain enough that applying #8 was ok (e.g in hba.c)  
  
Author: Ranier Vilela, David Rowley  
Discussion: https://postgr.es/m/CAApHDvo2j2+RJBGhNtUz6BxabWWh2Jx16wMUMWKUjv70Ver1vg@mail.gmail.com  

M contrib/hstore/hstore_io.c
M contrib/sepgsql/schema.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/libpq/hba.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/timestamp.c
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/describe.c

Fix incorrect uses of Datum conversion macros

commit   : 6bcda4a72123c3aa29fa3f03d952095675ad4468    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Aug 2022 10:47:10 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Aug 2022 10:47:10 +0200    

Click here for diff

Since these macros just cast whatever you give them to the designated  
output type, and many normal uses also cast the output type further, a  
number of incorrect uses go undiscovered.  The fixes in this patch  
have been discovered by changing these macros to inline functions,  
which is the subject of a future patch.  
  
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>  
Discussion: https://www.postgresql.org/message-id/flat/8528fb7e-0aa2-6b54-85fb-0c0886dbd6ed%40enterprisedb.com  

M contrib/btree_gist/btree_utils_num.c
M contrib/dblink/dblink.c
M contrib/hstore/hstore_op.c
M contrib/pageinspect/heapfuncs.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/toast_compression.c
M src/backend/access/table/toast_helper.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/resowner/resowner.c
M src/pl/plperl/plperl.c

Update out of date comments in pg_trgm

commit   : 6dc0738812c3fdbd733d917267a0543ab5fdf997    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 5 Sep 2022 11:11:18 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 5 Sep 2022 11:11:18 +0200    

Click here for diff

Commit be8a7a68662 changed the check_only parameter to a flag array  
but missed updating all comments. Update, and fix a related typo.  
  
Discussion: https://postgr.es/m/9732D8A2-EABD-4F5B-8BA0-A97DA4AB51A7@yesql.se  

M contrib/pg_trgm/trgm_op.c

Check for interrupts in pg_trgm word similarity

commit   : ae4fc52ae24785f51e3dc5a4c7e5b4d206356bdc    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 5 Sep 2022 11:10:57 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 5 Sep 2022 11:10:57 +0200    

Click here for diff

Calculating similarity between large strings can be timesconsuming  
and overrun configured statement timeouts. Check for interrupts in  
the main loop to ensure query cancellation can be performed.  
  
Author: Robins Tharakan <tharakan@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/CAEP4nAxvmfc_XWTz73bqXRhgjONi=1HaX4_NhsopA3L6UvnN1g@mail.gmail.com  

M contrib/pg_trgm/trgm_op.c

Doc: clarify partitioned table limitations

commit   : 519be095f2bf7150fe7a36c4f5cd0c1825126427    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Sep 2022 18:43:03 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 5 Sep 2022 18:43:03 +1200    

Click here for diff

Improve documentation regarding the limitations of unique and primary key  
constraints on partitioned tables.  The existing documentation didn't make  
it clear that the constraint columns had to be present in the partition  
key as bare columns.  The reader could be led to believe that it was ok to  
include the constraint columns as part of a function call's parameters or  
as part of an expression.  Additionally, the documentation didn't mention  
anything about the fact that we disallow unique and primary key  
constraints if the partition keys contain *any* function calls or  
expressions, regardless of if the constraint columns appear as columns  
elsewhere in the partition key.  
  
The confusion here was highlighted by a report on the general mailing list  
by James Vanns.  
  
Discussion: https://postgr.es/m/CAH7vdhNF0EdYZz3GLpgE3RSJLwWLhEk7A_fiKS9dPBT3Dz_3eA@mail.gmail.com  
Discussion: https://postgr.es/m/CAApHDvoU-u9iTqKjteYRFfi+UNEk7dbSAcyxEQD==vZt9B1KnA@mail.gmail.com  
Reviewed-by: Erik Rijkers  
Backpatch-through: 11  

M doc/src/sgml/ddl.sgml

Force parallelism in partition_aggregate

commit   : 2fe6b2a806f20f2dbf02c6e79783dbc2777a1840    
  
author   : Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 5 Sep 2022 00:09:17 +0200    
  
committer: Tomas Vondra <tomas.vondra@postgresql.org>    
date     : Mon, 5 Sep 2022 00:09:17 +0200    

Click here for diff

Commit db0d67db2 tweaked sort costing, which however resulted in a  
couple plan changes in our regression tests. Most of the new plans were  
fine, but partition_aggregate were meant to test parallel plans and the  
new plans were serial.  
  
Fix that by lowering parallel_setup_cost to 0, which is enough to switch  
to the parallel plan again.  
  
Commit 1349d2790 already made the plans parallel again, but do this  
anyway to keep the tests in sync with 15, to make backpatching simpler.  
  
Report and patch by David Rowley.  
  
Author: David Rowley  
Reviewed-by: Tomas Vondra  
Discussion: https://postgr.es/m/CAApHDvpVFgWzXdtUQkjyOPhNrNvumRi_=ftgS79KeAZ92tnHKQ@mail.gmail.com  

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

Fix MSVC linker error for specparse.obj

commit   : 92e7b7722da98eb4d54df7d4f850eee6a5fe9eef    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 16:49:00 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 16:49:00 +0700    

Click here for diff

Per buildfarm animals drongo  

M src/tools/msvc/Mkvcbuild.pm

Build all Flex files standalone

commit   : dac048f71ebbcf2f980d280711f8ff8001331c5d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 11:33:31 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 11:33:31 +0700    

Click here for diff

The proposed Meson build system will need a way to ignore certain  
generated files in order to coexist with the autoconf build system,  
and C files generated by Flex which are #include'd into .y files make  
this more difficult. In similar vein to 72b1e3a21, arrange for all Flex  
C files to compile to their own .o targets.  
  
Reviewed by Andres Freund  
  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M contrib/cube/.gitignore
M contrib/cube/Makefile
M contrib/cube/cube.c
M contrib/cube/cubedata.h
M contrib/cube/cubeparse.y
M contrib/cube/cubescan.l
M contrib/seg/.gitignore
M contrib/seg/Makefile
M contrib/seg/segparse.y
M contrib/seg/segscan.l
M src/backend/Makefile
M src/backend/bootstrap/.gitignore
M src/backend/bootstrap/Makefile
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/replication/.gitignore
M src/backend/replication/Makefile
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/utils/adt/.gitignore
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/jsonpath_gram.y
A src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/misc/Makefile
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/bin/pgbench/.gitignore
M src/bin/pgbench/Makefile
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/test/isolation/.gitignore
M src/test/isolation/Makefile
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/tools/pginclude/headerscheck

Move private declarations shared between guc.c and guc-file.l to new header

commit   : 80e8450a744b1f6fa75663f37f1db3388995dc67    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Aug 2022 12:01:41 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Aug 2022 12:01:41 +0700    

Click here for diff

Further preparatory refactoring for compiling guc-file.c standalone.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
A src/backend/utils/misc/guc_internal.h
M src/include/utils/guc.h

Preparatory refactoring for compiling guc-file.c standalone

commit   : 1b188ea7921a7d4f6cc569541e32c980d2221f9d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Aug 2022 10:42:19 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 16 Aug 2022 10:42:19 +0700    

Click here for diff

Mostly this involves moving ProcessConfigFileInternal() to guc.c  
and fixing the shared API to match.  
  
Reviewed by Andres Freund  
Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de  
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com  

M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/include/utils/guc.h

Fix sign-compare warnings arising from port/simd.h

commit   : 73b9d051c6076cf1cf1b90af505c8b379147c8b1    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 09:23:57 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sun, 4 Sep 2022 09:23:57 +0700    

Click here for diff

Noted while building an extension using -Wsign-compare.  
  
Per gripe from Pavel Stehule  
Discussion: https://www.postgresql.org/message-id/CAFj8pRAagKQHfw71aQbL8PbL0S_360M61V0_vPqJXbpUFvqnRA%40mail.gmail.com  

M src/include/port/simd.h

commit   : e062328ff11502b279186a286222f59fb9b4d15f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 3 Sep 2022 20:57:16 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 3 Sep 2022 20:57:16 +0900    

Click here for diff

These have been updated by the revert done in 2f2b18b, but the  
pre-revert state was correct.  Note that the result was incorrectly  
formatted in the first case.  
  
Author: Erik Rijkers  
Discussion: https://postgr.es/m/13777e96-24b6-396b-cb16-8ad01b6ac130@xs4all.nl  
Backpatch-through: 13  

M doc/src/sgml/func.sgml

doc: simplify docs about analyze and inheritance/partitions

commit   : 75d5712452ee887e938535001f9efef337c644d9    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 2 Sep 2022 23:32:19 -0400    

Click here for diff

Discussion: https://postgr.es/m/YxAqYijOsLzgLQgy@momjian.us  
  
Backpatch-through: 10  

M doc/src/sgml/ref/analyze.sgml

doc: clarify recursion internal behavior

commit   : 8ec6a4ef3c3a6aa08f2cc235fab8c691a8b2f341    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Fri, 2 Sep 2022 21:57:41 -0400    

Click here for diff

Reported-by: Drew DeVault  
  
Discussion: https://postgr.es/m/20211018091720.31299-1-sir@cmpwn.com  
  
Backpatch-through: 10  

M doc/src/sgml/queries.sgml

Fix cache invalidation bug in recovery_prefetch.

commit   : 932b01630095a08797e05ba1dae279731b862c95    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Sat, 3 Sep 2022 12:58:16 +1200    

Click here for diff

XLogPageRead() can retry internally after a pread() system call has  
succeeded, in the case of short reads, and page validation failures  
while in standby mode (see commit 0668719801).  Due to an oversight in  
commit 3f1ce973, these cases could leave stale data in the internal  
cache of xlogreader.c without marking it invalid.  The main defense  
against stale cached data on failure to read a page was in the error  
handling path of the calling function ReadPageInternal(), but that  
wasn't quite enough for errors handled internally by XLogPageRead()'s  
retry loop if we then exited with XLREAD_WOULDBLOCK.  
  
1.  ReadPageInternal() now marks the cache invalid before calling the  
    page_read callback, by setting state->readLen to 0.  It'll be set to  
    a non-zero value only after a successful read.  It'll stay valid as  
    long as the caller requests data in the cached range.  
  
2.  XLogPageRead() no long performs internal retries while reading  
    ahead.  While such retries should work, the general philosophy is  
    that we should give up prefetching if anything unusual happens so we  
    can handle it when recovery catches up, to reduce the complexity of  
    the system.  Let's do that here too.  
  
3.  While here, a new function XLogReaderResetError() improves the  
    separation between xlogrecovery.c and xlogreader.c, where the former  
    previously clobbered the latter's internal error buffer directly.  
    The new function makes this more explicit, and also clears a related  
    flag, without which a standby would needlessly retry in the outer  
    function.  
  
Thanks to Noah Misch for tracking down the conditions required for a  
rare build farm failure in src/bin/pg_ctl/t/003_promote.pl, and  
providing a reproducer.  
  
Back-patch to 15.  
  
Reported-by: Noah Misch <noah@leadboat.com>  
Discussion: https://postgr.es/m/20220807003627.GA4168930%40rfd.leadboat.com  

M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/include/access/xlogreader.h

Fix planner to consider matches to boolean columns in extension indexes.

commit   : ff720a597c0a53a8fcdf2cf4e45248dc5c37f9ab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 2 Sep 2022 17:01:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Fri, 2 Sep 2022 17:01:51 -0400    

Click here for diff

The planner has to special-case indexes on boolean columns, because  
what we need for an indexscan on such a column is a qual of the shape  
of "boolvar = pseudoconstant".  For plain bool constants, previous  
simplification will have reduced this to "boolvar" or "NOT boolvar",  
and we have to reverse that if we want to make an indexqual.  There is  
existing code to do so, but it only fires when the index's opfamily  
is BOOL_BTREE_FAM_OID or BOOL_HASH_FAM_OID.  Thus extension AMs, or  
extension opclasses such as contrib/btree_gin, are out in the cold.  
  
The reason for hard-wiring the set of relevant opfamilies was mostly  
to avoid a catalog lookup in a hot code path.  We can improve matters  
while not taking much of a performance hit by relying on the  
hard-wired set when the opfamily OID is visibly built-in, and only  
checking the catalogs when dealing with an extension opfamily.  
  
While here, rename IsBooleanOpfamily to IsBuiltinBooleanOpfamily  
to remind future users of that macro of its limitations.  At some  
point we might want to make indxpath.c's improved version of the  
test globally accessible, but it's not presently needed elsewhere.  
  
Zongliang Quan and Tom Lane  
  
Discussion: https://postgr.es/m/f293b91d-1d46-d386-b6bb-4b06ff5c667b@yeah.net  

M contrib/btree_gin/expected/bool.out
M contrib/btree_gist/expected/bool.out
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/pathkeys.c
M src/backend/partitioning/partprune.c
M src/include/catalog/pg_opfamily.h

Remove unused code from sepgsql

commit   : d885a6b612cf10a3013ba206a2607c88ccea42bc    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 2 Sep 2022 20:38:34 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Fri, 2 Sep 2022 20:38:34 +0200    

Click here for diff

Commit 4232c4b40 removed all callers of sepgsql_check_perms but left  
the function in place. This removes the function as well.  
  
Reviewed-by: Robert Haas <robertmhaas@gmail.com>  
Discussion: https://postgr.es/m/3BD5C3BF-FECA-4496-AE53-5E447997AA0B@yesql.se  

M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h

Fix PL/Perl build on Cygwin

commit   : 1c3aa54502dd7d2ced0c4e51de40aa4d61bfc04c    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 2 Sep 2022 17:56:14 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 2 Sep 2022 17:56:14 +0200    

Click here for diff

This was broken by b4e936859dc441102eb0b6fb7a104f3948c90490.  The  
reason why this fixes it are not entirely clear, but it seemed the  
best way to get it working again.  
  
Discussion: https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com  

M src/pl/plperl/GNUmakefile

Doc: fix column list vs. replica identity rules.

commit   : 376af686111e57929c626254eb403c0e810d8e22    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Fri, 2 Sep 2022 16:44:52 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Fri, 2 Sep 2022 16:44:52 +0530    

Click here for diff

It was not strictly correct to say that a column list must always include  
replica identity columns because that is true for only updates and  
deletes.  
  
Author: Peter Smith  
Reviwed-by: Vignesh C, Amit Kapila  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com  

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

Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat()

commit   : bfb9dfd93720098cf8f3e7d802df9b02ebe3dc20    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 2 Sep 2022 16:58:06 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 2 Sep 2022 16:58:06 +0900    

Click here for diff

Several backend-side loops scanning one or more directories with  
ReadDir() (WAL segment recycle/removal in xlog.c, backend-side directory  
copy, temporary file removal, configuration file parsing, some logical  
decoding logic and some pgtz stuff) already know the type of the entry  
being scanned thanks to the dirent structure associated to the entry, on  
platforms where we know about DT_REG, DT_DIR and DT_LNK to make the  
difference between a regular file, a directory and a symbolic link.  
  
Relying on the direct structure of an entry saves a few system calls to  
stat() and lstat() in the loops updated here, shaving some code while on  
it.  The logic of the code remains the same, calling stat() or lstat()  
depending on if it is necessary to look through symlinks.  
  
Authors: Nathan Bossart, Bharath Rupireddy  
Reviewed-by: Andres Freund, Thomas Munro, Michael Paquier  
Discussion: https://postgr.es/m/CALj2ACV8n-J-f=yiLUOx2=HrQGPSOZM3nWzyQQvLPcccPXxEdg@mail.gmail.com  

M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/xlog.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/slot.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/utils/misc/guc-file.l
M src/timezone/pgtz.c

Doc: Update struct Trigger definition.

commit   : 11e5f99d39ef58ce34c41f4163c1a3df2c639069    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 2 Sep 2022 16:45:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 2 Sep 2022 16:45:00 +0900    

Click here for diff

Commit 487e9861d added a new field to struct Trigger, but failed to  
update the documentation to match; backpatch to v13 where that came in.  
  
Reviewed by Richard Guo.  
  
Discussion: https://postgr.es/m/CAPmGK17NY92CyxJ%2BBG7A3JZurmng4jfRfzPiBTtNupGMF0xW1g%40mail.gmail.com  

M doc/src/sgml/trigger.sgml

Speed up lexing of long JSON strings

commit   : 0a8de93a48ce1e7479fb75fe10a8859559ec0c09    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Wed, 31 Aug 2022 10:39:17 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Wed, 31 Aug 2022 10:39:17 +0700    

Click here for diff

Use optimized linear search when looking ahead for end quotes,  
backslashes, and non-printable characters. This results in nearly 40%  
faster JSON parsing on x86-64 when most values are long strings, and  
all platforms should see some improvement.  
  
Reviewed by Andres Freund and Nathan Bossart  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGhaR2KQ5eisaK%3D6Vm60t%3DaxhD8Ckj1qFoCH1pktZi%2B2w%40mail.gmail.com  
Discussion: https://www.postgresql.org/message-id/CAFBsxsESLUyJ5spfOSyPrOvKUEYYNqsBosue9SV1j8ecgNXSKA%40mail.gmail.com  

M src/common/jsonapi.c
M src/test/regress/expected/json.out
M src/test/regress/sql/json.sql

Move darwin sysroot determination into separate file

commit   : 05519126a02ee39bf0957d3d85a1da5bd7e1c09c    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 1 Sep 2022 16:54:19 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 1 Sep 2022 16:54:19 -0700    

Click here for diff

The sysroot determination is fairly complex and will soon also be needed when  
building with meson. Instead of duplicating the logic, move it to a dedicated  
shell script invoked both by configure and meson.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/2180a97c-c026-1b6c-cec8-d6e499f97017@enterprisedb.com  

M src/template/darwin
A src/tools/darwin_sysroot

Revert SQL/JSON features

commit   : 2f2b18bd3f554e96a8cc885b177211be12288e4a    
  
author   : Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 1 Sep 2022 17:07:14 -0400    
  
committer: Andrew Dunstan <andrew@dunslane.net>    
date     : Thu, 1 Sep 2022 17:07:14 -0400    

Click here for diff

The reverts the following and makes some associated cleanups:  
  
    commit f79b803dc: Common SQL/JSON clauses  
    commit f4fb45d15: SQL/JSON constructors  
    commit 5f0adec25: Make STRING an unreserved_keyword.  
    commit 33a377608: IS JSON predicate  
    commit 1a36bc9db: SQL/JSON query functions  
    commit 606948b05: SQL JSON functions  
    commit 49082c2cc: RETURNING clause for JSON() and JSON_SCALAR()  
    commit 4e34747c8: JSON_TABLE  
    commit fadb48b00: PLAN clauses for JSON_TABLE  
    commit 2ef6f11b0: Reduce running time of jsonb_sqljson test  
    commit 14d3f24fa: Further improve jsonb_sqljson parallel test  
    commit a6baa4bad: Documentation for SQL/JSON features  
    commit b46bcf7a4: Improve readability of SQL/JSON documentation.  
    commit 112fdb352: Fix finalization for json_objectagg and friends  
    commit fcdb35c32: Fix transformJsonBehavior  
    commit 4cd8717af: Improve a couple of sql/json error messages  
    commit f7a605f63: Small cleanups in SQL/JSON code  
    commit 9c3d25e17: Fix JSON_OBJECTAGG uniquefying bug  
    commit a79153b7a: Claim SQL standard compliance for SQL/JSON features  
    commit a1e7616d6: Rework SQL/JSON documentation  
    commit 8d9f9634e: Fix errors in copyfuncs/equalfuncs support for JSON node types.  
    commit 3c633f32b: Only allow returning string types or bytea from json_serialize  
    commit 67b26703b: expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.  
  
The release notes are also adjusted.  
  
Backpatch to release 15.  
  
Discussion: https://postgr.es/m/40d2c882-bcac-19a9-754d-4299e1d87ac7@postgresql.org  

M doc/src/sgml/func.sgml
M doc/src/sgml/keywords/sql2016-02-reserved.txt
M src/backend/catalog/sql_features.txt
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/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/nodeFuncs.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/Makefile
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_expr.c
D src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parser.c
M src/backend/utils/adt/format_type.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/ruleutils.c
M src/backend/utils/misc/queryjumble.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_proc.dat
M src/include/executor/execExpr.h
M src/include/executor/executor.h
M src/include/nodes/makefuncs.h
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/parser/parse_clause.h
M src/include/utils/formatting.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
D src/test/regress/expected/json_sqljson.out
D src/test/regress/expected/jsonb_sqljson.out
M src/test/regress/expected/opr_sanity.out
D src/test/regress/expected/sqljson.out
M src/test/regress/parallel_schedule
D src/test/regress/sql/json_sqljson.sql
D src/test/regress/sql/jsonb_sqljson.sql
M src/test/regress/sql/opr_sanity.sql
D src/test/regress/sql/sqljson.sql
M src/tools/pgindent/typedefs.list

Add a regression test for contrib/pgrowlocks.

commit   : 90247e742f849794d061a0444071647728054b45    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 1 Sep 2022 15:02:34 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 1 Sep 2022 15:02:34 -0400    

Click here for diff

Dong Wook Lee, revised a bit by me  
  
Discussion: https://postgr.es/m/20220629055326.tdswmcjcr5jzbrsk@home-desktop  

A contrib/pgrowlocks/.gitignore
M contrib/pgrowlocks/Makefile
A contrib/pgrowlocks/expected/pgrowlocks.out
A contrib/pgrowlocks/specs/pgrowlocks.spec

aix: when building with gcc, tell gcc we're building a shared library

commit   : e5484554ba90536aaff42db588a6397633713c43    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 1 Sep 2022 11:49:36 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 1 Sep 2022 11:49:36 -0700    

Click here for diff

Not passing -shared to gcc when building a shared library triggers linking to  
the wrong libgcc (libgcc.a instead of libgcc_s.a) and prevents emitting  
correct unwind information. It's somewhat surprising that this hasn't caused  
known problems so far.  
  
Doing so requires adding path to libgcc to libpath, or linking statically to  
libgcc - as the latter increases .so size substantially (for not entirely  
obvious reasons), shared linking seems preferrable.  It likely is worth  
building executables with -shared-libgcc too, but I've not done that here.  
  
Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M src/makefiles/Makefile.aix

Use --load-extension to set up for contrib/tcn's isolation tests.

commit   : a1b9b14cc80327854ff667973096a230434a2386    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 1 Sep 2022 14:30:41 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 1 Sep 2022 14:30:41 -0400    

Click here for diff

Oversight in commit 418ec3207: it's better to do it like this,  
else you have to drop and recreate the extension for each  
permutation.  tcn.spec only has one permutation at present,  
so this doesn't speed it up any, but it's still a bad example.  

M contrib/tcn/Makefile
M contrib/tcn/specs/tcn.spec

doc: in create statistics docs, mention analyze for parent info

commit   : 97fe6d2210d4c6a0be3ff16abc9432b2c0a867b8    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 23:11:46 -0400    

Click here for diff

Discussion: https://postgr.es/m/Yv1Bw8J+1pYfHiRl@momjian.us  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_statistics.sgml

doc: mention "bloom" as a possible index access method

commit   : dd03dfeb3bc952818a34aaee30c31d491190aa21    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:35:09 -0400    

Click here for diff

Also remove USING erroneously added recently.  
  
Reported-by: Jeff Janes  
  
Discussion: https://postgr.es/m/CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com  
  
Backpatch-through: 10  

M doc/src/sgml/indices.sgml
M doc/src/sgml/ref/create_index.sgml

Adjust XML test case to avoid unstable behavior.

commit   : 4ea07e7cf3c6b5ff7a7059c223fa54241533b0a5    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 22:21:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 22:21:32 -0400    

Click here for diff

Buildfarm member bowerbird is (inconsistently) showing different  
results for this test case since we enabled ASLR for MSVC builds.  
It's not very clear whether that's a bug in its version of libxml2  
or the test case is relying on nominally-undefined behavior, ie the  
ordering of results from XPath's node().  It seems quite unlikely  
that it's *our* bug though, and what's more, using node() adds  
nothing to the test coverage so far as our code is concerned.  
So, tweak the test to not use node().  
  
For the moment, only change HEAD because we've only seen the  
problem there.  Perhaps a case will emerge for back-patching.  
  
Discussion: https://postgr.es/m/2655387.1661695793@sss.pgh.pa.us  

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

doc: use FILTER in aggregate example

commit   : fede15417225c08479fc6cd10812a25826c65f86    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:19:06 -0400    

Click here for diff

Reported-by: michal.palenik@freemap.sk  
  
Discussion: https://postgr.es/m/163499710897.684.7420075366995883688@wrigleys.postgresql.org  
  
Backpatch-through: 10  

M doc/src/sgml/query.sgml

doc: clarify that pgcrypto's gen_random_uuid calls core func.

commit   : fbd597e0b80d5590594be187a7c51e29ac7c5ca2    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 22:04:36 -0400    

Click here for diff

Previously it was just marked as a duplicate of the core function.  
  
Reported-by: Andreas Dijkman  
  
Discussion: https://postgr.es/m/17349-24d61e214429e8c1@postgresql.org  
  
Backpatch-through: 13  

M doc/src/sgml/pgcrypto.sgml

doc: split out the NATURAL/CROSS JOIN in SELECT syntax

commit   : 3e337b585a13e61929c184730c0ad6ac97c05a38    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 21:46:14 -0400    

Click here for diff

This allows the syntax to be more accurate about what clauses are  
supported.  Also switch an example query to use the ANSI join syntax.  
  
Reported-by: Joel Jacobson  
  
Discussion: https://postgr.es/m/67b71d3e-0c22-44df-a223-351f14418319@www.fastmail.com  
  
Backpatch-through: 11  

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

doc: warn of SECURITY DEFINER schemas for non-sql_body functions

commit   : 1703726488064901e05aeb24b463e1dc3d07bde9    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 21:10:37 -0400    

Click here for diff

Non-sql_body functions are evaluated at runtime.  
  
Reported-by: Erki Eessaar  
  
Discussion: https://postgr.es/m/AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com  
  
Backpatch-through: 10  

M doc/src/sgml/ref/create_function.sgml

doc: mention that SET TIME ZONE often needs to be quoted

commit   : a009cb3141e35f07791510c13992b087dc835467    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 20:27:27 -0400    

Click here for diff

Also mention that time zone abbreviations are not supported.  
  
Reported-by: philippe.godfrin@nov.com  
  
Discussion: https://postgr.es/m/163888728952.1269.5167822676466793158@wrigleys.postgresql.org  
  
Backpatch-through: 10  

M doc/src/sgml/ref/set.sgml

doc: document the maximum char/varchar length value

commit   : 62c49fca1330954a678d1d74e2a7883eb950fcff    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 19:43:06 -0400    

Click here for diff

Reported-by: Japin Li  
  
Discussion: https://postgr.es/m/MEYP282MB1669B13E98AE531617CB1386B6979@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM  
  
Backpatch-through: 10  

M doc/src/sgml/datatype.sgml

doc: show direction is optional in FETCH/MOVE's FROM/IN syntax

commit   : 9bdad1b5153e5d6b77a8f9c6e32286d6bafcd76d    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 19:28:42 -0400    

Click here for diff

It used to show direction was required for FROM/IN.  
  
Reported-by: Rob <rirans@comcast.net>  
  
Discussion: https://postgr.es/m/20211015165248.isqjceyilelhnu3k@localhost  
  
Author: Rob <rirans@comcast.net>  
  
Backpatch-through: 10  

M doc/src/sgml/ref/fetch.sgml
M doc/src/sgml/ref/move.sgml

Be smarter about freeing tuples during tuplesorts

commit   : 1083f94dacde5f5b383ca8e18a85babb5cb5e77f    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 1 Sep 2022 11:08:10 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 1 Sep 2022 11:08:10 +1200    

Click here for diff

During dumptuples() the call to writetuple() would pfree any non-null  
tuple.  This was quite wasteful as this happens just before we perform a  
reset of the context which stores all of those tuples.  
  
It seems to make sense to do a bit of a code refactor to make this work,  
so here we just get rid of the writetuple function and adjust the WRITETUP  
macro to call the state's writetup function.  The WRITETUP usage in  
mergeonerun() always has state->slabAllocatorUsed == true, so writetuple()  
would never free the tuple or do any memory accounting.  The only call  
path that needs memory accounting done is in dumptuples(), so let's just  
do it manually there.  
  
In passing, let's get rid of the state->memtupcount-- code that counts the  
memtupcount down to 0 one tuple at a time inside the loop.  That seems to  
be a rather inefficient way to set memtupcount to 0, so let's just zero it  
after the loop instead.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvqZXoDCyrfCzZJR0-xH+7_q+GgitcQiYXUjRani7h4j8Q@mail.gmail.com  

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

doc: simplify WITH clause syntax in CREATE DATABASE

commit   : 349baa87ae4bf1c65c3ed34073837a71a725b30b    
  
author   : Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    
  
committer: Bruce Momjian <bruce@momjian.us>    
date     : Wed, 31 Aug 2022 17:08:44 -0400    

Click here for diff

Reported-by: Rob <rirans@comcast.net>  
  
Discussion: https://postgr.es/m/20211016171149.yaouvlw5kvux6dvk@localhost  
  
Author: Rob <rirans@comcast.net>  
  
Backpatch-through: 10  

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

Prevent long-term memory leakage in autovacuum launcher.

commit   : 1c1294be716d96e804aadafc249fcbfa8367621d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 16:23:20 -0400    

Click here for diff

get_database_list() failed to restore the caller's memory context,  
instead leaving current context set to TopMemoryContext which is  
how CommitTransactionCommand() leaves it.  The callers both think  
they are using short-lived contexts, for the express purpose of  
not having to worry about cleaning up individual allocations.  
The net effect therefore is that supposedly short-lived allocations  
could accumulate indefinitely in the launcher's TopMemoryContext.  
  
Although this has been broken for a long time, it seems we didn't  
have any obvious memory leak here until v15's rearrangement of the  
stats logic.  I (tgl) am not entirely convinced that there's no  
other leak at all, though, and we're surely at risk of adding one  
in future back-patched fixes.  So back-patch to all supported  
branches, even though this may be only a latent bug in pre-v15.  
  
Reid Thompson  
  
Discussion: https://postgr.es/m/972a4e12b68b0f96db514777a150ceef7dcd2e0f.camel@crunchydata.com  

M src/backend/postmaster/autovacuum.c

Derive freeze cutoff from nextXID, not OldestXmin.

commit   : c3ffa731a5f99c4361203015ce2219d209fea94c    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 31 Aug 2022 11:37:35 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Wed, 31 Aug 2022 11:37:35 -0700    

Click here for diff

Before now, the cutoffs that VACUUM used to determine which XIDs/MXIDs  
to freeze were determined at the start of each VACUUM by taking related  
cutoffs that represent which XIDs/MXIDs VACUUM should treat as still  
running, and subtracting an XID/MXID age based value controlled by GUCs  
like vacuum_freeze_min_age.  The FreezeLimit cutoff (XID freeze cutoff)  
was derived by subtracting an XID age value from OldestXmin, while the  
MultiXactCutoff cutoff (MXID freeze cutoff) was derived by subtracting  
an MXID age value from OldestMxact.  This approach didn't match the  
approach used nearby to determine whether this VACUUM operation should  
be an aggressive VACUUM or not.  
  
VACUUM now uses the standard approach instead: it subtracts the same  
age-based values from next XID/next MXID (rather than subtracting from  
OldestXmin/OldestMxact).  This approach is simpler and more uniform.  
Most of the time it will have only a negligible impact on how and when  
VACUUM freezes.  It will occasionally make VACUUM more robust in the  
event of problems caused by long running transaction.  These are cases  
where OldestXmin and OldestMxact are held back by so much that they  
attain an age that is a significant fraction of the value of age-based  
settings like vacuum_freeze_min_age.  
  
There is no principled reason why freezing should be affected in any way  
by the presence of a long-running transaction -- at least not before the  
point that the OldestXmin and OldestMxact limits used by each VACUUM  
operation attain an age that makes it unsafe to freeze some of the  
XIDs/MXIDs whose age exceeds the value of the relevant age-based  
settings.  The new approach should at least make freezing degrade more  
gracefully than before, even in the most extreme cases.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Reviewed-By: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-By: Matthias van de Meent <boekewurm+postgres@gmail.com>  
Discussion: https://postgr.es/m/CAH2-WzkOv5CEeyOO=c91XnT5WBR_0gii0Wn5UbZhJ=4TTykDYg@mail.gmail.com  

M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/vacuum.c
M src/include/commands/vacuum.h

Fix MSVC warning in compat_informix/rnull.pgc

commit   : 483ac6476198c66696b725d49aa42290a9a94a95    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 31 Aug 2022 09:31:22 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 31 Aug 2022 09:31:22 -0700    

Click here for diff

Building the ecpg tests with MSVC, with warnings enabled, results in the  
following warning:  
src/interfaces/ecpg/test/compat_informix/rnull.pgc(19,1): warning C4305: 'initializing': truncation from 'double' to 'float'  
  
The more obvious fix would be an 'f' suffix, but ecpg can't parse that.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/2180a97c-c026-1b6c-cec8-d6e499f97017@enterprisedb.com  

M src/interfaces/ecpg/test/compat_informix/rnull.pgc
M src/interfaces/ecpg/test/expected/compat_informix-rnull.c

In the Snowball dictionary, don't try to stem excessively-long words.

commit   : 1058555a5eccffd17c47edf3e15dd7e26934b492    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 31 Aug 2022 10:42:05 -0400    

Click here for diff

If the input word exceeds 1000 bytes, don't pass it to the stemmer;  
just return it as-is after case folding.  Such an input is surely  
not a word in any human language, so whatever the stemmer might  
do to it would be pretty dubious in the first place.  Adding this  
restriction protects us against a known recursion-to-stack-overflow  
problem in the Turkish stemmer, and it seems like good insurance  
against any other safety or performance issues that may exist in  
the Snowball stemmers.  (I note, for example, that they contain no  
CHECK_FOR_INTERRUPTS calls, so we really don't want them running  
for a long time.)  The threshold of 1000 bytes is arbitrary.  
  
An alternative definition could have been to treat such words as  
stopwords, but that seems like a bigger break from the old behavior.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  
Thanks to Olly Betts for the recommendation to fix it this way.  
  
Discussion: https://postgr.es/m/1661334672.728714027@f473.i.mail.ru  

M src/backend/snowball/dict_snowball.c

Fix a bug in roles_is_member_of.

commit   : 0101f770a05b07dd7a8e05b6f8f95d4e22f4e846    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Tue, 30 Aug 2022 08:32:35 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Tue, 30 Aug 2022 08:32:35 -0400    

Click here for diff

Commit e3ce2de09d814f8770b2e3b3c152b7671bcdb83f rearranged this  
function to be able to identify which inherited role had admin option  
on the target role, but it got the order of operations wrong, causing  
the function to return wrong answers in the presence of non-inherited  
grants.  
  
Fix that, and add a test case that verifies the correct behavior.  
  
Patch by me, reviewed by Nathan Bossart  
  
Discussion: http://postgr.es/m/CA+TgmoYamnu-xt-u7CqjYWnRiJ6BQaSpYOHXP=r4QGTfd1N_EA@mail.gmail.com  

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

doc: Fix typo in user inheritance documentation

commit   : c7892c253fdc7bcb99a61e820798588ee4c071b9    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 31 Aug 2022 13:32:52 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 31 Aug 2022 13:32:52 +0200    

Click here for diff

Commit 620ac285483 accidentally introduced a typo in the privilege  
inheritance documentation  

M doc/src/sgml/user-manag.sgml

Refactor check_ functions to use filehandle for status

commit   : cad4323cd345ec91fbe8d118436d3d50fa53c300    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 31 Aug 2022 13:06:50 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 31 Aug 2022 13:06:50 +0200    

Click here for diff

When reporting failure in check_ functions there is (typically) a text-  
file mentioned in the error report which contains further details. Some  
check_ functions kept a separate flag variable to indicate failure, and  
some just checked the state of the filehandle as it's guaranteed to be  
open when the check failed. This refactors the functions to consistently  
do the same check on error reporting. As the error report contains the  
filepath, it makes more sense to check the filehandle state and skip the  
flag variable.  
  
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>  
Reviewed-by: Bruce Momjian <bruce@momjian.us>  
Discussion: https://postgr.es/m/595759F6-625B-4ED7-8125-91AF00437F83@yesql.se  

M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/version.c

plpython: Don't create pgxsdir subdirectory in installdir target

commit   : 7d5852ca83f4103d806ee7501f70b9354345f65d    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 31 Aug 2022 07:42:01 +0200    

Click here for diff

As of db23464715f4792298c639153dda7bfd9ad9d602, we don't install  
anything there anymore from plpython, so we don't need to create the  
installation directory anymore.  

M src/pl/plpython/Makefile

On NetBSD, force dynamic symbol resolution at postmaster start.

commit   : 8acd8f8690ed10f421a54e9b3fb6d49f2ce226f8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 30 Aug 2022 17:28:32 -0400    

Click here for diff

The default of lazy symbol resolution means that when the postmaster  
first reaches the select() call in ServerLoop, it'll need to resolve  
the link to that libc entry point.  NetBSD's dynamic loader takes  
an internal lock while doing that, and if a signal interrupts the  
operation then there is a risk of self-deadlock should the signal  
handler do anything that requires that lock, as several of the  
postmaster signal handlers do.  The window for this is pretty narrow,  
and timing considerations make it unlikely that a signal would arrive  
right then anyway.  But it's semi-repeatable on slow single-CPU  
machines, and in principle the race could happen with any hardware.  
  
The least messy solution to this is to force binding of dynamic  
symbols at postmaster start, using the "-z now" linker option.  
While we're at it, also use "-z relro" so as to provide a small  
security gain.  
  
It's not entirely clear whether any other platforms share this  
issue, but for now we'll assume it's NetBSD-specific.  (We might  
later try to use "-z now" on more platforms for performance  
reasons, but that would not likely be something to back-patch.)  
  
Report and patch by me; the idea to fix it this way is from  
Andres Freund.  
  
Discussion: https://postgr.es/m/3384826.1661802235@sss.pgh.pa.us  

M src/template/netbsd

Various cleanups of the new memory context header code

commit   : 05f90842369538cf94bbd09970a008b9357f4101    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 31 Aug 2022 07:33:54 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 31 Aug 2022 07:33:54 +1200    

Click here for diff

Robert Haas reported that his older clang compiler didn't like the two  
Asserts which were verifying that the given MemoryContextMethodID was <=  
MEMORY_CONTEXT_METHODID_MASK when building with  
-Wtautological-constant-out-of-range-compare.  In my (David's) opinion,  
the compiler is wrong to warn about that.  Newer versions of clang don't  
warn about the out of range enum value, so perhaps this was a bug that has  
now been fixed.  To keep older clang versions happy, let's just cast the  
enum value to int to stop the compiler complaining.  
  
The main reason for the Asserts mentioned above to exist are to inform  
future developers which are adding new MemoryContexts if they run out of  
bit space in MemoryChunk to store the MemoryContextMethodID.  As pointed  
out by Tom Lane, it seems wise to also add a comment to the header for  
that enum to document the restriction on these enum values.  
  
Additionally, also fix an incorrect usage of UINT64CONST() which was  
introduced in c6e0fe1f2.  
  
Author: Robert Haas, David Rowley  
Discussion: https://postgr.es/m/CA+TgmoYGG2C7Vbw1cjkQRRBL3zOk8SmhrQnsJgzscX=N9AwPrw@mail.gmail.com  

M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h

Revert "Add missing padding from MemoryChunk struct"

commit   : 5495796ad12aae971137d184ff25add8f6b03968    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 31 Aug 2022 03:06:31 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 31 Aug 2022 03:06:31 +1200    

Click here for diff

This reverts commit df0f4feef.  It turns out the problem which was causing  
the 32-bit ARM and PPC animals to fail was due to a MAXALIGN problem in  
slab.c.  This was fixed by d5ee4db0e.  The padding that was added in  
df0f4feef would only do anything on machines where uint64 was not aligned  
to 8 bytes.  The 32-bit machines which were failing are not in that  
category, so revert this commit.  
  
Discussion: https://postgr.es/m/3209100.1661787561@sss.pgh.pa.us  

M src/include/utils/memutils_memorychunk.h

Update the comment in rmgrlist.h to match it to the code.

commit   : c98b6acdb252546e9bea0b9a37d95ca63d2ff0fa    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 30 Aug 2022 09:16:41 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 30 Aug 2022 09:16:41 +0530    

Click here for diff

Author: Hayato Kuroda  
Reviwed-by: Amit Kapila  
Discussion: https://postgr.es/m/TYAPR01MB58665F20F412EDF27B0759CFF5769@TYAPR01MB5866.jpnprd01.prod.outlook.com  

M src/include/access/rmgrlist.h

Drop replication origin slots before tablesync worker exits.

commit   : f6c5edb8abcac04eb3eac6da356e59d399b2bcef    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 30 Aug 2022 08:51:41 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 30 Aug 2022 08:51:41 +0530    

Click here for diff

Currently, the replication origin tracking of the tablesync worker is  
dropped by the apply worker. So, there will be a small lag between the  
tablesync worker exit and its origin tracking got removed. In the  
meantime, new tablesync workers can be launched and will try to set up  
a new origin tracking. This can lead the system to reach max configured  
limit (max_replication_slots) even if the user has configured the max  
limit considering the number of tablesync workers required in the system.  
  
We decided not to back-patch as this can occur in very narrow  
circumstances and users have to option to increase the configured limit by  
increasing max_replication_slots.  
  
Reported-by: Hubert Depesz Lubaczewski  
Author: Ajin Cherian  
Reviwed-by: Masahiko Sawada, Peter Smith, Hou Zhijie, Amit Kapila  
Discussion: https://postgr.es/m/20220714115155.GA5439@depesz.com  

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

Further code review of port/simd.h

commit   : 865424627db638acdbe4b5d0384d0b9cd34838a5    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 30 Aug 2022 09:44:44 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 30 Aug 2022 09:44:44 +0700    

Click here for diff

Add missing declaration per existing style, and fix a couple typos.  
  
Nathan Bossart and Julien Rouhaud  
  
Discussion: https://www.postgresql.org/message-id/20220829171712.GA509233%40nathanxps13  
Discussion: https://www.postgresql.org/message-id/20220830022636.qrcbcecmhztbxrwa%40jrouhaud  

M src/include/port/simd.h

Adjust comments that called MultiXactIds "XMIDs".

commit   : 9887dd38f9660721e4ef63333ab81a60b1b3da92    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 29 Aug 2022 19:42:30 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Mon, 29 Aug 2022 19:42:30 -0700    

Click here for diff

Oversights in commits 0b018fab and f3c15cbe.  

M src/backend/access/heap/heapam.c
M src/backend/commands/vacuum.c
M src/test/isolation/specs/vacuum-no-cleanup-lock.spec

Use MAXALIGN() in calculations using sizeof(SlabBlock)

commit   : d5ee4db0eaf65fb99e20907d5b3355e8bf38aeaf    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Tue, 30 Aug 2022 14:36:04 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Tue, 30 Aug 2022 14:36:04 +1200    

Click here for diff

c6e0fe1f2 added a new pointer field to SlabBlock to make it 4 bytes larger  
on 32-bit machines.  Prior to that commit, the size of that struct was a  
multiple of 8, which meant that MAXALIGN(sizeof(SlabBlock)) was the same  
as sizeof(SlabBlock), however, after c6e0fe1f2, due to the addition of the  
new pointer field to store a pointer to the owning context, that was no  
longer true on builds with sizeof(void *) == 4.  
  
This problem was highlighted by an Assert failure which was checking that  
the pointer given to pfree() was MAXALIGNED.  Various 32-bit ARM buildfarm  
animals were failing.  These have MAXIMUM_ALIGNOF of 8.  The only 32-bit  
testing I'd managed to do on c6e0fe1f2 had been on x86, which has a  
MAXIMUM_ALIGNOF of 4, therefore did not exhibit this issue.  
  
Here we define Slab_BLOCKHDRSZ and copy what is being done in aset.c and  
generation.c for doing calculations based on the size of the context's  
block type.  This means that SlabAlloc() will now always return a  
MAXALIGNed pointer.  
  
This also fixes an incorrect sentinel_ok() check in SlabCheck() which was  
incorrectly checking the wrong sentinel byte.  This must have previously  
not caused any issues due to the fullChunkSize never being large enough to  
store the sentinel byte.  
  
Diagnosed-by: Tomas Vondra, Tom Lane  
Author: Tomas Vondra, David Rowley  
Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com  

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

commit   : b1ec7f47e396be7dd71d19328153c2e8dce80222    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Aug 2022 09:52:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 30 Aug 2022 09:52:58 +0900    

Click here for diff

All the code and comments cleaned up here is irrelevant since 495ed0e.  
Note that this removes an assumption that CreateRestrictedToken() may  
not exist, something that could have happened when running under Windows  
NT as the code stated.  Rather than assuming that it may not exist, this  
causes pg_ctl to fail hard if the function cannot be loaded.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20220826112637.GD2342@telsasoft.com  

M src/backend/port/win32/socket.c
M src/bin/pg_ctl/pg_ctl.c
M src/interfaces/libpq/win32.c
M src/port/dirmod.c

Clean up inconsistent use of fflush().

commit   : 7fed801135bae14d63b11ee4a10f6083767046d8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Aug 2022 13:55:38 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 29 Aug 2022 13:55:38 -0400    

Click here for diff

More than twenty years ago (79fcde48b), we hacked the postmaster  
to avoid a core-dump on systems that didn't support fflush(NULL).  
We've mostly, though not completely, hewed to that rule ever since.  
But such systems are surely gone in the wild, so in the spirit of  
cleaning out no-longer-needed portability hacks let's get rid of  
multiple per-file fflush() calls in favor of using fflush(NULL).  
  
Also, we were fairly inconsistent about whether to fflush() before  
popen() and system() calls.  While we've received no bug reports  
about that, it seems likely that at least some of these call sites  
are at risk of odd behavior, such as error messages appearing in  
an unexpected order.  Rather than expend a lot of brain cells  
figuring out which places are at hazard, let's just establish a  
uniform coding rule that we should fflush(NULL) before these calls.  
A no-op fflush() is surely of trivial cost compared to launching  
a sub-process via a shell; while if it's not a no-op then we likely  
need it.  
  
Discussion: https://postgr.es/m/2923412.1661722825@sss.pgh.pa.us  

M src/backend/access/transam/xlogarchive.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/shell_archive.c
M src/backend/storage/file/fd.c
M src/backend/utils/error/elog.c
M src/bin/initdb/initdb.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/copy.c
M src/bin/psql/prompt.c
M src/bin/psql/psqlscanslash.l
M src/common/exec.c
M src/fe_utils/archive.c
M src/fe_utils/print.c
M src/interfaces/libpq/fe-print.c
M src/test/regress/pg_regress.c

Remove stray "the".

commit   : 20796536c10fe7869e7af2c69615f14a80555c5d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 12:35:46 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 12:35:46 -0400    

Click here for diff

Per off-list report.  

M doc/src/sgml/user-manag.sgml

Prevent WAL corruption after a standby promotion.

commit   : 6672d7913929b82ec723a54381773d9cdc20fe9d    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 10:47:12 -0400    

Click here for diff

When a PostgreSQL instance performing archive recovery but not using  
standby mode is promoted, and the last WAL segment that it attempted  
to read ended in a partial record, the previous code would create  
invalid WAL on the new timeline. The WAL from the previously timeline  
would be copied to the new timeline up until the end of the last valid  
record, but instead of beginning to write WAL at immediately  
afterwards, the promoted server would write an overwrite contrecord at  
the beginning of the next segment. The end of the previous segment  
would be left as all-zeroes, resulting in failures if anything tried  
to read WAL from that file.  
  
The root of the issue is that ReadRecord() decides whether to set  
abortedRecPtr and missingContrecPtr based on the value of StandbyMode,  
but ReadRecord() switches to a new timeline based on the value of  
ArchiveRecoveryRequested. We shouldn't try to write an overwrite  
contrecord if we're switching to a new timeline, so change the test in  
ReadRecod() to check ArchiveRecoveryRequested instead.  
  
Code fix by Dilip Kumar. Comments by me incorporating suggested  
language from Álvaro Herrera. Further review from Kyotaro Horiguchi  
and Sami Imseih.  
  
Discussion: http://postgr.es/m/CAFiTN-t7umki=PK8dT1tcPV=mOUe2vNhHML6b3T7W7qqvvajjg@mail.gmail.com  
Discussion: http://postgr.es/m/FB0DEA0B-E14E-43A0-811F-C1AE93D00FF3%40amazon.com  

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

docs: Fix up some out-of-date references to INHERIT/NOINHERIT.

commit   : 620ac285483fd78a54206a8b523a877ba8fd1e9b    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 10:10:09 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 29 Aug 2022 10:10:09 -0400    

Click here for diff

Commit e3ce2de09d814f8770b2e3b3c152b7671bcdb83f should have updated  
these sections of the documentation, but failed to do so.  
  
Patch by me, reviewed by Nathan Bossart.  
  
Discussion: http://postgr.es/m/CA+TgmoaKMnde2W_=u7CqeCKi=FKnfbNQPwOR=c_3c8qD7b2nhQ@mail.gmail.com  

M doc/src/sgml/ref/set_role.sgml
M doc/src/sgml/user-manag.sgml

Add missing padding from MemoryChunk struct

commit   : df0f4feef8de933be61ce3e73142c82c37b17fa4    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 29 Aug 2022 23:20:25 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 29 Aug 2022 23:20:25 +1200    

Click here for diff

Buildfarm animals skate, grison and mamba are Assert failing on the  
pointer being given to repalloc not being MAXALIGNED.  c6e0fe1f2a made  
changes in that area.  
  
All of these animals are 32-bit with a MAXIMUM_ALIGNOF of 8 and a  
SIZEOF_VOID_P of 4.  I suspect that the pointer is not properly aligned due  
to the lack of padding in the MemoryChunk struct.  
  
Here we add the same type of padding that was previously used in  
AllocChunkData and GenerationChunk that c6e0fe1f2a neglected to add.  
  
Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com  

M src/include/utils/memutils_memorychunk.h

Fix broken cast on MSVC

commit   : c6a43c25a8ba1a825588f7af25a7173f2e66ce8d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 17:25:59 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 17:25:59 +0700    

Click here for diff

Per buildfarm animal drongo, casting a vector type to the same type  
causes a compile error. We still need the cast on ARM64, so invent a  
wrapper function that does the casting only where necessary.  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsEouaTwbmpqV%2BEW2%3DwFbhw2vHRe26NQTRcd0%3DNaOFDy7A%40mail.gmail.com  

M src/include/port/pg_lfind.h
M src/include/port/simd.h

Use ARM Advanced SIMD (NEON) intrinsics where available

commit   : 82739d4a80f2eeb2f96b56477bb04e463ea24800    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 14:32:54 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 14:32:54 +0700    

Click here for diff

NEON support is required on the Aarch64 architecture for standard  
implementations. Hardware designers for specialized markets can choose  
not to support it, but that's true of floating point as well, which  
we assume is supported. As with x86, some SIMD support is available  
on 32-bit platforms, but those are not interesting from a performance  
standpoint and would require an inconvenient runtime check.  
  
Nathan Bossart  
  
Reviewed by John Naylor, Andres Freund, Thomas Munro, and Tom Lane  
Discussion: https://www.postgresql.org/message-id/flat/CAFBsxsEyR9JkfbPcDXBRYEfdfC__OkwVGdwEAgY4Rv0cvw35EA%40mail.gmail.com#aba7a64b11503494ffd8dd27067626a9  

M src/include/port/simd.h

Abstract some more architecture-specific details away from SIMD functionality

commit   : f8f19f70868c6351b80f02a47fa65d56b728a5a2    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 13:40:53 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Mon, 29 Aug 2022 13:40:53 +0700    

Click here for diff

Add a typedef to represent vectors containing four 32-bit integers,  
and add functions operating on them. Also separate out saturating  
subtraction into its own function. The motivation for this is to  
prepare for a future commit to add ARM NEON support.  
  
Nathan Bossart  
  
Reviewed by John Naylor and Tom Lane  
Discussion: https://www.postgresql.org/message-id/flat/CAFBsxsEyR9JkfbPcDXBRYEfdfC__OkwVGdwEAgY4Rv0cvw35EA%40mail.gmail.com#aba7a64b11503494ffd8dd27067626a9  

M src/include/port/pg_lfind.h
M src/include/port/simd.h

Improve performance of and reduce overheads of memory management

commit   : c6e0fe1f2a08505544c410f613839664eea9eb21    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Mon, 29 Aug 2022 17:15:00 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Mon, 29 Aug 2022 17:15:00 +1200    

Click here for diff

Whenever we palloc a chunk of memory, traditionally, we prefix the  
returned pointer with a pointer to the memory context to which the chunk  
belongs.  This is required so that we're able to easily determine the  
owning context when performing operations such as pfree() and repalloc().  
  
For the AllocSet context, prior to this commit we additionally prefixed  
the pointer to the owning context with the size of the chunk.  This made  
the header 16 bytes in size.  This 16-byte overhead was required for all  
AllocSet allocations regardless of the allocation size.  
  
For the generation context, the problem was worse; in addition to the  
pointer to the owning context and chunk size, we also stored a pointer to  
the owning block so that we could track the number of freed chunks on a  
block.  
  
The slab allocator had a 16-byte chunk header.  
  
The changes being made here reduce the chunk header size down to just 8  
bytes for all 3 of our memory context types.  For small to medium sized  
allocations, this significantly increases the number of chunks that we can  
fit on a given block which results in much more efficient use of memory.  
  
Additionally, this commit completely changes the rule that pointers to  
palloc'd memory must be directly prefixed by a pointer to the owning  
memory context and instead, we now insist that they're directly prefixed  
by an 8-byte value where the least significant 3-bits are set to a value  
to indicate which type of memory context the pointer belongs to.  Using  
those 3 bits as an index (known as MemoryContextMethodID) to a new array  
which stores the methods for each memory context type, we're now able to  
pass the pointer given to functions such as pfree() and repalloc() to the  
function specific to that context implementation to allow them to devise  
their own methods of finding the memory context which owns the given  
allocated chunk of memory.  
  
The reason we're able to reduce the chunk header down to just 8 bytes is  
because of the way we make use of the remaining 61 bits of the required  
8-byte chunk header.  Here we also implement a general-purpose MemoryChunk  
struct which makes use of those 61 remaining bits to allow the storage of  
a 30-bit value which the MemoryContext is free to use as it pleases, and  
also the number of bytes which must be subtracted from the chunk to get a  
reference to the block that the chunk is stored on (also 30 bits).  The 1  
additional remaining bit is to denote if the chunk is an "external" chunk  
or not.  External here means that the chunk header does not store the  
30-bit value or the block offset.  The MemoryContext can use these  
external chunks at any time, but must use them if any of the two 30-bit  
fields are not large enough for the value(s) that need to be stored in  
them.  When the chunk is marked as external, it is up to the MemoryContext  
to devise its own means to determine the block offset.  
  
Using 3-bits for the MemoryContextMethodID does mean we're limiting  
ourselves to only having a maximum of 8 different memory context types.  
We could reduce the bit space for the 30-bit value a little to make way  
for more than 3 bits, but it seems like it might be better to do that only  
if we ever need more than 8 context types.  This would only be a problem  
if some future memory context type which does not use MemoryChunk really  
couldn't give up any of the 61 remaining bits in the chunk header.  
  
With this MemoryChunk, each of our 3 memory context types can quickly  
obtain a reference to the block any given chunk is located on.  AllocSet  
is able to find the context to which the chunk is owned, by first  
obtaining a reference to the block by subtracting the block offset as is  
stored in the 'hdrmask' field and then referencing the block's 'aset'  
field.  The Generation context uses the same method, but GenerationBlock  
did not have a field pointing back to the owning context, so one is added  
by this commit.  
  
In aset.c and generation.c, all allocations larger than allocChunkLimit  
are stored on dedicated blocks.  When there's just a single chunk on a  
block like this, it's easy to find the block from the chunk, we just  
subtract the size of the block header from the chunk pointer.  The size of  
these chunks is also known as we store the endptr on the block, so we can  
just subtract the pointer to the allocated memory from that.  Because we  
can easily find the owning block and the size of the chunk for these  
dedicated blocks, we just always use external chunks for allocation sizes  
larger than allocChunkLimit.  For generation.c, this sidesteps the problem  
of non-external MemoryChunks being unable to represent chunk sizes >= 1GB.  
This is less of a problem for aset.c as we store the free list index in  
the MemoryChunk's spare 30-bit field (the value of which will never be  
close to using all 30-bits).  We can easily reverse engineer the chunk size  
from this when needed.  Storing this saves AllocSetFree() from having to  
make a call to AllocSetFreeIndex() to determine which free list to put the  
newly freed chunk on.  
  
For the slab allocator, this commit adds a new restriction that slab  
chunks cannot be >= 1GB in size.  If there happened to be any users of  
slab.c which used chunk sizes this large, they really should be using  
AllocSet instead.  
  
Here we also add a restriction that normal non-dedicated blocks cannot be  
1GB or larger.  It's now not possible to pass a 'maxBlockSize' >= 1GB  
during the creation of an AllocSet or Generation context.  Allocations can  
still be larger than 1GB, it's just these will always be on dedicated  
blocks (which do not have the 1GB restriction).  
  
Author: Andres Freund, David Rowley  
Discussion: https://postgr.es/m/CAApHDvpjauCRXcgcaL6+e3eqecEHoeRm9D-kcbuvBitgPnW=vw@mail.gmail.com  

M src/backend/utils/mmgr/README
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/nodes/memnodes.h
M src/include/utils/memutils.h
A src/include/utils/memutils_internal.h
A src/include/utils/memutils_memorychunk.h
M src/tools/pgindent/typedefs.list

Fix the incorrect assertion introduced in commit 7f13ac8123.

commit   : d2169c998553a6945fd51b8a1e5e9e1384283fdd    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 29 Aug 2022 08:10:10 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 29 Aug 2022 08:10:10 +0530    

Click here for diff

It has been incorrectly assumed in commit 7f13ac8123 that we can either  
purge all or none in the catalog modifying xids list retrieved from a  
serialized snapshot. It is quite possible that some of the xids in that  
array are old enough to be pruned but not others.  
  
As per buildfarm  
  
Author: Amit Kapila and Masahiko Sawada  
Reviwed-by: Masahiko Sawada  
Discussion: https://postgr.es/m/CAA4eK1LBtv6ayE+TvCcPmC-xse=DVg=SmbyQD1nv_AaqcpUJEg@mail.gmail.com  

M contrib/test_decoding/expected/catalog_change_snapshot.out
M contrib/test_decoding/specs/catalog_change_snapshot.spec
M src/backend/replication/logical/snapbuild.c

Doc: fix example of recursive query.

commit   : 8c7fc86ca979f558bb7028763a71aa1ac7ca19b8    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 28 Aug 2022 10:44:52 -0400    

Click here for diff

Compute total number of sub-parts correctly, per jason@banfelder.net  
  
Simon Riggs  
  
Discussion: https://postgr.es/m/166161184718.1235920.6304070286124217754@wrigleys.postgresql.org  

M doc/src/sgml/queries.sgml

Add more detail why repalloc and pfree do not accept NULL pointers

commit   : 805a397db40bd49789946e8fe42e564d564fc27b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Aug 2022 09:55:04 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sun, 28 Aug 2022 09:55:04 +0200    

Click here for diff

Per discussion, we choose not to change this.  This just gives a  
little bit more information.  
  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M src/backend/utils/mmgr/README

Enable RandomizedBaseAddress (ASLR) on Windows with MSVC builds

commit   : 36389a060ca6b44d6ccc67653da77562a1ac5bb4    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Aug 2022 16:04:58 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sun, 28 Aug 2022 16:04:58 +0900    

Click here for diff

This has as effect to add /DYNAMICBASE to the .dll and .exe files  
generated by the builds, undoing 7f3e17b.  Note that ASLR was already  
enabled in MinGW as we have never added --disable-dynamicbase there.  
  
This change will ease a bit the integration of arm64 with MSVC, as ASLR  
support is mandatory in this case.  So, thanks to this commit, we have  
no need to make ASLR conditional depending on the architecture used for  
the build.  
  
Andres Freund has done a lot of testing with this option while working  
on meson, without seeing /DYNAMICBASE as being a problem in the Windows  
builds of the CI.  Personally, not supporting anything older than  
Windows 10 on HEAD makes me feel safer about this change, as we have  
seen ASLR with being a problem in process invocation particularly with  
Windows 8 and server 2012 back in 2014, even if Windows 10 was not  
really a thing back then.  45e004f is also something that can help in  
making the process invocation more stable.  We are very early in the  
development of Postgres 16, giving a lot of room to detect stability  
issues if any.  
  
Discussion: https://postgr.es/m/20220826012907.gjw3jdqdgsts5y65@awork3.anarazel.de  

M src/tools/msvc/MSBuildProject.pm

Avoid casting away const in sepgsql's quote_object_name.

commit   : 94077df1c2def788f888a27ed0035236f806466d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Aug 2022 12:52:39 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Aug 2022 12:52:39 -0400    

Click here for diff

quote_identifier's API is designed on the assumption that it's  
not worth worrying about a short-term memory leak when we have  
to produce a quoted version of the given identifier.  Whoever wrote  
quote_object_name took it on themselves to override that judgment,  
but the only way to do so is to cast away const someplace.  We can  
avoid that and substantially shorten the function by going along  
with quote_identifier's opinion.  AFAICS quote_object_name is not  
used in any way where this would be unsustainable.  
  
Per discussion of commit 45987aae2, which exposed that we had  
a casting-away-const situation here.  
  
Discussion: https://postgr.es/m/20220827112304.GL2342@telsasoft.com  

M contrib/sepgsql/label.c

Doc: add comment about bug fixed in back branches as of 3f7323cbb.

commit   : d1ce745db2d7db193c0be461db3cd34edd776dac    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Aug 2022 12:16:21 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sat, 27 Aug 2022 12:16:21 -0400    

Click here for diff

While the bug I just fixed in the back branches doesn't exist in  
HEAD, the requirement that MULTIEXPR SubPlans not share output  
parameters still does.  Add a comment to memorialize that, because  
perhaps it could be an issue again someday.  
  
Discussion: https://postgr.es/m/17596-c5357f61427a81dc@postgresql.org  

M src/backend/executor/nodeSubplan.c

Fix typo in comment for writetuple() function

commit   : 924954c670355f2a0ca1dd4173574a28fc0eedec    
  
author   : Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 27 Aug 2022 14:46:15 +0300    
  
committer: Alexander Korotkov <akorotkov@postgresql.org>    
date     : Sat, 27 Aug 2022 14:46:15 +0300    

Click here for diff

Reported-by: David Rowley  
Discussion: https://postgr.es/m/CAApHDvrZ9Ky2LcWwcKsbdYChA850JE5qS%3DkGJiTNWS8mbBXZHw%40mail.gmail.com  

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

Be more careful to avoid including system headers after perl.h

commit   : 4eec2e03c34f9a357d86317b1cd05d80a2ab559d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 27 Aug 2022 11:17:36 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 27 Aug 2022 11:17:36 +0700    

Click here for diff

Commit 121d2d3d70 included simd.h into pg_wchar.h. This caused a problem  
on Windows, since Perl has "#define free" (referring to globals), which  
breaks the Windows' header. To fix, move the static inline function  
definitions from plperl_helpers.h, into plperl.h, where we already  
document the necessary inclusion order. Since those functions were the  
only reason for the existence of plperl_helpers.h, remove it.  
  
First reported by Justin Pryzby  
  
Diagnosis and review by Andres Freund, patch by myself per suggestion  
from Tom Lane  
  
Discussion: https://www.postgresql.org/message-id/20220826115546.GE2342%40telsasoft.com  

M contrib/hstore_plperl/hstore_plperl.c
M contrib/jsonb_plperl/jsonb_plperl.c
M src/pl/plperl/GNUmakefile
M src/pl/plperl/SPI.xs
M src/pl/plperl/Util.xs
M src/pl/plperl/plperl.c
M src/pl/plperl/plperl.h
D src/pl/plperl/plperl_helpers.h

Use correct connection for cancellation in frontend's parallel slots

commit   : 52144b6fcd626bb7dbe9fe282329c0174620a34b    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Aug 2022 15:21:31 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Sat, 27 Aug 2022 15:21:31 +0900    

Click here for diff

While waiting for slots to become available in wait_on_slots() in  
parallel_slot.c, the cancellation always relied on the first connection  
in the set to do the job.  This could cause problems when this slot's  
socket is gone as PQgetCancel() would return NULL in this case.  Rather  
than always using the first connection, this changes the logic to use  
the first valid connection for the cancellation.  
  
Author: Ranier Vilela  
Reviewed-by: Justin Pryzby  
Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com  
Backpatch-through: 14  

M src/fe_utils/parallel_slot.c

Remove unneeded null pointer checks before PQfreemem()

commit   : e890ce7a4feb9d72cd502d52c5a4c4d853801974    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 19:16:28 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 19:16:28 +0200    

Click here for diff

PQfreemem() just calls free(), and the latter already checks for null  
pointers.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M contrib/vacuumlo/vacuumlo.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/bin/pg_basebackup/receivelog.c

Remove unnecessary casts in free() and pfree()

commit   : 45987aae260a441886a010323bf3e143ce8e82d6    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 15:55:57 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 15:55:57 +0200    

Click here for diff

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com  

M contrib/sepgsql/label.c
M src/backend/utils/fmgr/dfmgr.c

Use SSE2 in is_valid_ascii() where available.

commit   : 121d2d3d70ecdb2113b340c5f3b99a61341291af    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Fri, 26 Aug 2022 15:01:24 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Fri, 26 Aug 2022 15:01:24 +0700    

Click here for diff

Per flame graph from Jelte Fennema, COPY FROM ... USING BINARY shows  
input validation taking at least 5% of the profile, so it's worth trying  
to be more efficient here. With this change, validation of pure ASCII is  
nearly 40% faster on contemporary Intel hardware. To make this change  
legible and easier to adopt to additional architectures, use helper  
functions to abstract the platform details away.  
  
Reviewed by Nathan Bossart  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsG%3Dk8t%3DC457FXnoBXb%3D8iA4OaZkbFogFMachWif7mNnww%40mail.gmail.com  

M src/common/wchar.c
M src/include/mb/pg_wchar.h
M src/include/port/simd.h

Remove obsolete comment

commit   : ab9717847a2b0c32b93121f873f4dff331e26eb0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 26 Aug 2022 10:33:55 +0200    

Click here for diff

The comment in basebackup.c updated by 33bd4698c11 was actually  
obsolete to begin with, since the symbols it was referring to haven't  
existed in that header file for quite some time.  The header file is  
still needed for other reasons, though, so keep the #include, just  
drop the comment.  

M src/backend/backup/basebackup.c

Fix typo in comment.

commit   : a8b02587a3c20997f8991878eb02ef475a343e1f    
  
author   : Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 26 Aug 2022 16:55:00 +0900    
  
committer: Etsuro Fujita <efujita@postgresql.org>    
date     : Fri, 26 Aug 2022 16:55:00 +0900    

Click here for diff

M src/backend/commands/copyfromparse.c

Add optimized functions for linear search within byte arrays

commit   : e813e0e16852c080259cd0813e1a82ecb2625aea    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Sat, 20 Aug 2022 21:14:01 -0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Sat, 20 Aug 2022 21:14:01 -0700    

Click here for diff

In similar vein to b6ef167564, add pg_lfind8() and pg_lfind8_le()  
to search for bytes equal or less-than-or-equal to a given byte,  
respectively. To abstract away platform details, add helper functions  
and typedefs to simd.h.  
  
John Naylor and Nathan Bossart, per suggestion from Andres Freund  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsGzaaGLF%3DNuq61iRXTyspbO9rOjhSqFN%3DV6ozzmta5mXg%40mail.gmail.com  

M src/include/port/pg_lfind.h
M src/include/port/simd.h
M src/test/modules/test_lfind/expected/test_lfind.out
M src/test/modules/test_lfind/sql/test_lfind.sql
M src/test/modules/test_lfind/test_lfind–1.0.sql
M src/test/modules/test_lfind/test_lfind.c

Remove configure probe for sockaddr_in6 and require AF_INET6.

commit   : bcc8b14ef630b2ad9aae7813981fb248fbff9ed8    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 26 Aug 2022 10:13:22 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Fri, 26 Aug 2022 10:13:22 +1200    

Click here for diff

SUSv3 <netinet/in.h> defines struct sockaddr_in6, and all targeted Unix  
systems have it.  Windows has it in <ws2ipdef.h>.  Remove the configure  
probe, the macro and a small amount of dead code.  
  
Also remove a mention of IPv6-less builds from the documentation, since  
there aren't any.  
  
This is similar to commits f5580882 and 077bf2f2 for Unix sockets.  Even  
though AF_INET6 is an "optional" component of SUSv3, there are no known  
modern operating system without it, and it seems even less likely to be  
omitted from future systems than AF_UNIX.  
  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M doc/src/sgml/client-auth.sgml
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/pgstatfuncs.c
M src/bin/initdb/initdb.c
M src/include/pg_config.h.in
M src/include/utils/inet.h
M src/interfaces/libpq/fe-connect.c
M src/port/inet_net_ntop.c
M src/tools/ifaddrs/test_ifaddrs.c
M src/tools/msvc/Solution.pm

libpq code should use libpq_gettext(), not _()

commit   : 28ec316787674dd74d00b296724a009b6edc2fb0    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 20:46:58 +0200    

Click here for diff

Fix some wrong use and install a safeguard against future mistakes.  

M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/libpq-int.h

Fix doc oversight for custom WAL resource managers.

commit   : 66af5eea31e06fac288274cc056357cebbbbefe3    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 25 Aug 2022 10:26:31 -0700    

Click here for diff

Reported-by: Bharath Rupireddy  
Backpatch-through: 15  
Discussion: https://postgr.es/m/CALj2ACU+at7RqnWEzS59QsFg3ZOF4C4GSp7pt+PWiLEp0zrEKg@mail.gmail.com  

M doc/src/sgml/tableam.sgml

Small refactor to get rid of -Wshadow=compatible-local warning

commit   : d389487525bc1d543f27543ed2ff824d3a30f508    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 26 Aug 2022 02:46:56 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 26 Aug 2022 02:46:56 +1200    

Click here for diff

Further reduce -Wshadow=compatible-local warnings by 1 by refactoring the  
code in gistRelocateBuildBuffersOnSplit() to make use of  
foreach_current_index() instead of manually incrementing a variable on  
each loop.  
  
Author: David Rowley  
Discussion: https://postgr.es/m/CAApHDvpGZX-X=Bn4moyXgfFa0CdSUwoa04d3isit3=1qo8F8Bw@mail.gmail.com  

M src/backend/access/gist/gistbuildbuffers.c

More -Wshadow=compatible-local warning fixes

commit   : 3e0fff2e6888e39b0ad5cdfdb78bc1c2bb2b22c9    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Fri, 26 Aug 2022 02:35:40 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Fri, 26 Aug 2022 02:35:40 +1200    

Click here for diff

In a similar effort to f01592f91, here we're targetting fixing the  
warnings where we've deemed the shadowing variable to serve a close enough  
purpose to the shadowed variable just to reuse the shadowed version and  
not declare the shadowing variable at all.  
  
By my count, this takes the warning count from 106 down to 71.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220825020839.GT2342@telsasoft.com  

M src/backend/access/hash/hash_xlog.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/functioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/vacuum.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/lib/integerset.c
M src/backend/libpq/auth.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/postmaster/autovacuum.c
M src/backend/rewrite/rowsecurity.c
M src/backend/statistics/dependencies.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pgbench/pgbench.c

Allow grant-level control of role inheritance behavior.

commit   : e3ce2de09d814f8770b2e3b3c152b7671bcdb83f    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 25 Aug 2022 10:06:02 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 25 Aug 2022 10:06:02 -0400    

Click here for diff

The GRANT statement can now specify WITH INHERIT TRUE or WITH  
INHERIT FALSE to control whether the member inherits the granted  
role's permissions. For symmetry, you can now likewise write  
WITH ADMIN TRUE or WITH ADMIN FALSE to turn ADMIN OPTION on or off.  
  
If a GRANT does not specify WITH INHERIT, the behavior based on  
whether the member role is marked INHERIT or NOINHERIT. This means  
that if all roles are marked INHERIT or NOINHERIT before any role  
grants are performed, the behavior is identical to what we had before;  
otherwise, it's different, because ALTER ROLE [NO]INHERIT now only  
changes the default behavior of future grants, and has no effect on  
existing ones.  
  
Patch by me. Reviewed and testing by Nathan Bossart and Tushar Ahuja,  
with design-level comments from various others.  
  
Discussion: http://postgr.es/m/CA+Tgmoa5Sf4PiWrfxA=sGzDKg0Ojo3dADw=wAHOhR9dggV=RmQ@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_role.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/backend/utils/adt/acl.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_auth_members.h
M src/include/commands/user.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql

Move NON_EXEC_STATIC from c.h to postgres.h

commit   : 2059c5e3b06545e7d0650dba9c665332374c3c21    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 15:07:03 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 15:07:03 +0200    

Click here for diff

It is not needed at the scope of c.h, only in backend code.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/a6a6b48e-ca0a-b58d-18de-98e40d94b842%40enterprisedb.com  

M src/include/c.h
M src/include/postgres.h

Update another comment still referring to pg_start/stop_backup()

commit   : 421ccaa6272a2935a3d2e578ff6feeeeab7d8848    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 15:04:38 +0200    

Click here for diff

M src/test/recovery/t/020_archive_status.pl

doc: Fix typo in GRANT docs

commit   : d16c99aa71047e3cd94dad85f9fa82a7d6f94eed    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 Aug 2022 10:47:02 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 Aug 2022 10:47:02 +0200    

Click here for diff

Commit ce6b672e445 accidentally introduced a trivial typo in the  
documentation for GRANT.  

M doc/src/sgml/ref/grant.sgml

Fix typo in MVCC test comment

commit   : 0c67e9e566db32df3f420268e81e32f278a2f090    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 Aug 2022 10:31:20 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Thu, 25 Aug 2022 10:31:20 +0200    

Click here for diff

The optimization is named kill_prior_tuple but was accidentally  
spelled kill_prio_tuple in the test.  
  
Author: Mingli Zhang <avamingli@gmail.com>  
Discussion: https://postgr.es/m/82d3e66a-d8ae-4bfa-943e-29c5add0743f@Spark  

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

Remove unused symbol __aarch64

commit   : 4112e39f70eed8d699ea5be7f5945a8970023d0d    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 25 Aug 2022 13:37:40 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 25 Aug 2022 13:37:40 +0700    

Click here for diff

This was added as a possible variant of __aarch64__ back when 64-bit  
ARM was vaporware. It hasn't shown up in the wild since then, so remove.  
  
Nathan Bossart  
  
Discussion: https://www.postgresql.org/message-id/CAFBsxsEN5nW3uRh%3Djrs-QexDrC1btu0ZfriD3FFfb%3D3J6tAngg%40mail.gmail.com  

M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/storage/s_lock.h

pg_dump: Fix new ICU tests

commit   : b4ddf3ee30bfb5b7da60411cabcf0589bdbd3f42    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 25 Aug 2022 06:35:16 +0200    

Click here for diff

ICU doesn't support some server encodings, so we need to exclude them  
if a non-supported encoding was set up.  

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

aix: Fix SHLIB_EXPORTS reference in VPATH builds

commit   : 4444317f370cbbd6a9bb62d70dd8f1f062952ef4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:38:28 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:38:28 -0700    

Click here for diff

The dependencies here aren't quite right independent of vpath builds or not,  
but this at least makes vpath builds succeed. And it's pretty rare to change  
the exports.txt file anyway... The referenced thread has a patch that will  
clean that up further.  
  
Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M src/Makefile.shlib

Remove SUBSYS.o rule in common.mk, hasn't been used in a long time

commit   : 05bf551040ba161ddfbf7da308d61d2b7b425bf3    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:38:14 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:38:14 -0700    

Click here for diff

Apparently I missed that this SUBSYS.o rule isn't needed anymore in  
a4ebbd27527, likely because there still is a reference to it due to AIX - but  
that's self contained in src/backend/Makefile  
  
Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M src/backend/common.mk

Remove rule to generate postgres.o, not needed for 20+ years

commit   : 68fc18d14c7e1150823cf4a5728089459723c9da    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    

Click here for diff

Discussion: https://postgr.es/m/20220820174213.d574qde4ptwdzoqz@awork3.anarazel.de  

M src/backend/Makefile

solaris: Use versioning scripts instead of -Bsymbolic

commit   : 3fb0687d328b8eef6ab0ff80300e5746f4a777cb    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Wed, 24 Aug 2022 20:37:54 -0700    

Click here for diff

-Bsymbolic causes a lot of "ld: warning: symbol referencing errors"  
warnings. It's quite easy to add the symbol versioning script, we just need a  
slightly different parameter name.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/20220823083436.whtntk3bn3qpnvmb@awork3.anarazel.de  
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com  

M src/Makefile.shlib

Include RelFileLocator fields individually in BufferTag.

commit   : 82ac34db2036ec5b3cb32c9180f40549aa790dc2    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Wed, 24 Aug 2022 15:50:48 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Wed, 24 Aug 2022 15:50:48 -0400    

Click here for diff

This is preparatory work for a project to increase the number of bits  
in a RelFileNumber from 32 to 56.  
  
Along the way, introduce static inline accessor functions for a couple  
of BufferTag fields.  
  
Dilip Kumar, reviewed by me. The overall patch series has also had  
review at various times from Andres Freund, Ashutosh Sharma, Hannu  
Krosing, Vignesh C, Álvaro Herrera, and Tom Lane.  
  
Discussion: http://postgr.es/m/CAFiTN-trubju5YbWAq-BSpZ90-Z6xCVBQE8BVqXqANOZAF1Znw@mail.gmail.com  

M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h

pg_dump: Dump colliculocale

commit   : 396d348b046c6b7e5dc83158c4c1df1377a1d2ef    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 20:13:52 +0200    

Click here for diff

This was forgotten when the new column was introduced.  
  
Author: Marina Polyakova <m.polyakova@postgrespro.ru>  
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>  
Discussion: https://www.postgresql.org/message-id/7ad26354e75259f59c4a6c6997b8ee32%40postgrespro.ru  

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

Defend against stack overrun in a few more places.

commit   : f25bed3801e1e500850a9f3b29a003c644d4bd6d    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 24 Aug 2022 13:01:40 -0400    

Click here for diff

SplitToVariants() in the ispell code, lseg_inside_poly() in geo_ops.c,  
and regex_selectivity_sub() in selectivity estimation could recurse  
until stack overflow; fix by adding check_stack_depth() calls.  
So could next() in the regex compiler, but that case is better fixed by  
converting its tail recursion to a loop.  (We probably get better code  
that way too, since next() can now be inlined into its sole caller.)  
  
There remains a reachable stack overrun in the Turkish stemmer, but  
we'll need some advice from the Snowball people about how to fix that.  
  
Per report from Egor Chindyaskin and Alexander Lakhin.  These mistakes  
are old, so back-patch to all supported branches.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/1661334672.728714027@f473.i.mail.ru  

M src/backend/regex/regc_lex.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/like_support.c

Doc: remove duplicate "a" from func.sgml

commit   : a73d6c87f2eb19681fe52d6d8bb7db38a7a7da2a    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 23:45:57 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 23:45:57 +1200    

Click here for diff

Author: Shinya Kato  
Discussion: https://postgr.es/m/76c01275776749a167f49379ebec57f1@oss.nttdata.com  
Backpatch-through: 15, where that change was introduced  

M doc/src/sgml/func.sgml

Fix ICU locale option handling in CREATE DATABASE

commit   : 8b808f189fb1f62a6830e5c023f4ae49a1f4c9a8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 13:27:34 +0200    

Click here for diff

The code took the LOCALE option as the default/fallback for  
ICU_LOCALE, but this was neither documented nor intended, so remove  
it.  (It was probably left in from an earlier patch version.)  
  
Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c

Remove initialization of MyClientConnectionInfo at backend startup

commit   : 701ac2cb1fa25ca0b8572e87073d9008ed406b55    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Aug 2022 19:19:00 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Aug 2022 19:19:00 +0900    

Click here for diff

This stuff should be already initialized at process startup, so adding  
this extra step is confusing for no gain.  
  
Per gripe from Tom Lane and Jacob Champion.  
  
Discussion: https://postgr.es/m/bbf2b922-4ff7-5c30-e3ef-2a8bdcdd1116@timescale.com  

M src/backend/postmaster/postmaster.c

Further -Wshadow=compatible-local warning fixes

commit   : f959bf9a5b9cecd2f6e6bdd24a34a7b269b00827    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 22:04:28 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 22:04:28 +1200    

Click here for diff

These should have been included in 421892a19 as these shadowed variable  
warnings can also be fixed by adjusting the scope of the shadowed variable  
to put the declaration for it in an inner scope.  
  
This is part of the same effort as f01592f91.  
  
By my count, this takes the warning count from 114 down to 106.  
  
Author: David Rowley and Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com  

M src/backend/access/spgist/spgdoinsert.c
M src/backend/commands/trigger.c
M src/backend/executor/nodeHash.c
M src/backend/optimizer/plan/planner.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/ruleutils.c

Change shared library installation naming on macOS

commit   : 161355ee6d2c64c0c4853a0646795028d666f052    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 08:23:49 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Wed, 24 Aug 2022 08:23:49 +0200    

Click here for diff

It is not customary to install a shared library with a minor version  
number (libpq.5.16.dylib) on macOS.  We just need the file with the  
major version number (libpq.5.dylib) and the one without version  
number (libpq.dylib).  This also matches the installation layout used  
by Meson.  
  
Discussion: https://www.postgresql.org/message-id/e0c44fb2-8b66-a4b9-b274-7ed3a1a0ab74@enterprisedb.com  

M src/Makefile.shlib

Allow parallel workers to retrieve some data from Port

commit   : d951052a9e02bfacad8bd6f0f53a4dcd3b7e6d1f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Aug 2022 12:57:13 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 24 Aug 2022 12:57:13 +0900    

Click here for diff

This commit moves authn_id into a new global structure called  
ClientConnectionInfo (mapping to a MyClientConnectionInfo for each  
backend) which is intended to hold all the client information that  
should be shared between the backend and any of its parallel workers,  
access for extensions and triggers being the primary use case.  There is  
no need to push all the data of Port to the workers, and authn_id is  
quite a generic concept so using a separate structure provides the best  
balance (the name of the structure has been suggested by Robert Haas).  
  
While on it, and per discussion as this would be useful for a potential  
SYSTEM_USER that can be accessed through parallel workers, a second  
field is added for the authentication method, copied directly from  
Port.  
  
ClientConnectionInfo is serialized and restored using a new parallel  
key and a structure tracks the length of the authn_id, making the  
addition of more fields straight-forward.  
  
Author: Jacob Champion  
Reviewed-by: Bertrand Drouvot, Stephen Frost, Robert Haas, Tom Lane,  
Michael Paquier, Julien Rouhaud  
Discussion: https://postgr.es/m/793d990837ae5c06a558d58d62de9378ab525d83.camel@vmware.com  

M src/backend/access/transam/parallel.c
M src/backend/libpq/auth.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/init/miscinit.c
M src/include/libpq/libpq-be.h
M src/include/miscadmin.h
M src/tools/pgindent/typedefs.list

Further reduce warnings with -Wshadow=compatible-local

commit   : 421892a192b8f95ab96c5edb61d424f80a4221d0    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 12:27:12 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Wed, 24 Aug 2022 12:27:12 +1200    

Click here for diff

In a similar effort to f01592f91, here we're targetting fixing the  
warnings that -Wshadow=compatible-local produces that we can fix by moving  
a variable to an inner scope to stop that variable from being shadowed by  
another variable declared somewhere later in the function.  
  
All of the warnings being fixed here are changing the scope of variables  
which are being used as an iterator for a "for" loop.  In each instance,  
the fix happens to be changing the for loop to use the C99 type  
initialization.  Much of this code likely pre-dates our use of C99.  
  
Reducing the scope of the outer scoped variable seems like the safest way  
to fix these.  Renaming seems more likely to risk patches using the wrong  
variable.  Reducing the scope is more likely to result in a compilation  
failure after applying some future patch rather than introducing bugs with  
it.  
  
By my count, this takes the warning count from 129 down to 114.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com  

M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gist/gist.c
M src/backend/commands/copyfrom.c
M src/backend/commands/indexcmds.c
M src/backend/executor/nodeAgg.c
M src/backend/optimizer/path/costsize.c
M src/backend/statistics/mcv.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_dump/pg_dump.c
M src/interfaces/ecpg/pgtypeslib/numeric.c

Message style adjustment

commit   : 869e56a39976a42a393adc2d69df3abce7eff18f    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 21:50:12 +0200    

Click here for diff

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

Remove further unwanted linker flags from perl_embed_ldflags

commit   : b4e936859dc441102eb0b6fb7a104f3948c90490    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 16:00:38 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 16:00:38 +0200    

Click here for diff

Remove the contents of $Config{ldflags} from ExtUtils::Embed's ldopts,  
like we already do with $Config{ccdlflags}.  Those flags are the  
choices of those who built the Perl installation, which are not  
necessarily appropriate for building PostgreSQL.  What we really want  
from ldopts are the options identifying the location and name of the  
libperl library, but unfortunately it doesn't appear possible to get  
that separately from the other stuff.  
  
The motivation for this was to strip -mmacosx-version-min options.  We  
already did something similar for the -arch option.  Both of those are  
now covered by this more general approach.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com  

M config/perl.m4
M configure

Remove our artificial PG_SOMAXCONN limit on listen queue length.

commit   : 0f47457f1129fa21131465aba5663a14b2a09386    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 10:14:45 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 10:14:45 -0400    

Click here for diff

I added this in commit 153f40067, out of paranoia about kernels  
possibly rejecting very large listen backlog requests.  However,  
POSIX has said for decades that the kernel must silently reduce  
any value it considers too large, and there's no evidence that  
any current system doesn't obey that.  Let's just drop this limit  
and save some complication.  
  
While we're here, compute the request as twice MaxConnections not  
twice MaxBackends; the latter no longer means what it did in 2001.  
  
Per discussion of a report from Kevin McKibbin.  
  
Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com  

M src/backend/libpq/pqcomm.c
M src/include/pg_config_manual.h

Doc: document possible need to raise kernel's somaxconn limit.

commit   : ba94dfd4c4f63cf8663f16e427bcc6fac35a4428    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 09:55:37 -0400    

Click here for diff

On fast machines, it's possible for applications such as pgbench  
to issue connection requests so quickly that the postmaster's  
listen queue overflows in the kernel, resulting in unexpected  
failures (with not-very-helpful error messages).  Most modern OSes  
allow the queue size to be increased, so document how to do that.  
  
Per report from Kevin McKibbin.  
  
Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com  

M doc/src/sgml/runtime.sgml

Doc: prefer sysctl to /proc/sys in docs and comments.

commit   : 4ee6740167b6a311660a1e8752447a496dd0d235    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Tue, 23 Aug 2022 09:41:37 -0400    

Click here for diff

sysctl is more portable than Linux's /proc/sys file tree, and  
often easier to use too.  That's why most of our docs refer to  
sysctl when talking about how to adjust kernel parameters.  
Bring the few stragglers into line.  
  
Discussion: https://postgr.es/m/361175.1661187463@sss.pgh.pa.us  

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

Remove offsetof definition

commit   : bd67b7e01031b688f2f19f657ece4aa2322dbcc8    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 15:39:36 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Tue, 23 Aug 2022 15:39:36 +0200    

Click here for diff

This was only needed to deal with some ancient and no longer supported  
systems.  
  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://www.postgresql.org/message-id/flat/9a5223a2-3e25-d4fb-f092-01ec17428584%40enterprisedb.com  

M src/include/c.h

Don't bother to set sockaddr_un.sun_len.

commit   : c9818798147a4eec00bba61a05fa9bc88398ec3b    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 23 Aug 2022 23:52:17 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 23 Aug 2022 23:52:17 +1200    

Click here for diff

It's not necessary to fill in sun_len when calling bind() or connect(),  
on all known systems that have it.  
  
Discussion: https://postgr.es/m/2781112.1644819528%40sss.pgh.pa.us  

M src/common/ip.c

Add CHECK_FOR_INTERRUPTS while decoding changes.

commit   : f972ec5c285c3bc50d81f8044e08cd636017ab68    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Tue, 23 Aug 2022 10:20:02 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Tue, 23 Aug 2022 10:20:02 +0530    

Click here for diff

While decoding changes in a loop, if we skip all the changes there is no  
CFI making the loop uninterruptible.  
  
Reported-by: Whale Song and Andrey Borodin  
Bug: 17580  
Author: Masahiko Sawada  
Reviwed-by: Amit Kapila  
Backpatch-through: 10  
Discussion: https://postgr.es/m/17580-849c1d5b6d7eb422@postgresql.org  
Discussion: https://postgr.es/m/B319ECD6-9A28-4CDF-A8F4-3591E0BF2369@yandex-team.ru  

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

Don't define FRONTEND for libpq

commit   : 1d77afefbd1dd13a0ebec9d6675dd305e86c0538    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

Not needed anymore after 7143b3e8213.  
  
Discussion: https://postgr.es/m/20220820194550.725755r6fj2ro3rx@awork3.anarazel.de  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Don't define FRONTEND for ecpg libraries

commit   : 9352d5cf128ad9888918bba00b87ba347438fd26    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

Not needed anymore after 7143b3e8213.  
  
Discussion: https://postgr.es/m/20220820194550.725755r6fj2ro3rx@awork3.anarazel.de  

M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/tools/msvc/Mkvcbuild.pm

Don't define FRONTEND for initdb

commit   : 06e3559bade1da89feb1a53d517c991fb4f15272    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:39:30 -0700    

Click here for diff

No headers requiring FRONTED to be defined are included as of af1a949109d.  
  
Since this is the last user of (contrib|frontend)_defines in Mkvcbuild.pm,  
remove them.  
  
Discussion: https://postgr.es/m/20220820194550.725755r6fj2ro3rx@awork3.anarazel.de  

M src/bin/initdb/Makefile
M src/tools/msvc/Mkvcbuild.pm

Remove redundant call to pgstat_report_wal()

commit   : 1bdd54e662d58ed49448255a004b668b56bae100    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:25:42 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:25:42 -0700    

Click here for diff

pgstat_report_stat() will be called before shutdown so an explicit call to  
pgstat_report_wal() just before shutdown is redundant.  
  
This likely was not redundant before 5891c7a8ed8, but now it clearly is.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/CAAKRu_aaq33UnG4TXq3S-OSXGWj1QGf0sU%2BECH4tNwGFNERkZA%40mail.gmail.com  

M src/backend/postmaster/walwriter.c

Add BackendType for standalone backends

commit   : 0c679464a837079acc75ff1d45eaa83f79e05690    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:22:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:22:50 -0700    

Click here for diff

All backends should have a BackendType to enable statistics reporting  
per BackendType.  
  
Add a new BackendType for standalone backends, B_STANDALONE_BACKEND (and  
alphabetize the BackendTypes). Both the bootstrap backend and single  
user mode backends will have BackendType B_STANDALONE_BACKEND.  
  
Author: Melanie Plageman <melanieplageman@gmail.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Discussion: https://www.postgresql.org/message-id/CAAKRu_aaq33UnG4TXq3S-OSXGWj1QGf0sU%2BECH4tNwGFNERkZA%40mail.gmail.com  

M src/backend/utils/init/miscinit.c
M src/include/miscadmin.h

pgstat: Acquire lock when reading variable-numbered stats

commit   : cd063344fb801a90a40923a5b8aefe4eb8d80762    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Mon, 22 Aug 2022 20:16:50 -0700    

Click here for diff

Somewhere during the development of the patch acquiring a lock during read  
access to variable-numbered stats got lost. The missing lock acquisition won't  
cause corruption, but can lead to reading torn values when accessing  
stats. Add the missing lock acquisitions.  
  
Reported-by: Greg Stark <stark@mit.edu>  
Reviewed-by: "Drouvot, Bertrand" <bdrouvot@amazon.com>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>  
Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@mail.gmail.com  
Backpatch: 15-  

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

Switch format specifier for replication origins to %d

commit   : ba8321349bc02423aa4d49ebb5d579ec313cf930    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 23 Aug 2022 09:55:05 +0700    

Click here for diff

Using %u with uint16 causes warnings with -Wformat-signedness. There are many  
other warnings, but for now change only these since c920fe4818 already changed  
the message string for most of them.  
  
Per report from Peter Eisentraut  
Discussion: https://www.postgresql.org/message-id/31e63649-0355-7088-831e-b07d5f908a8c%40enterprisedb.com  

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

Remove empty statement

commit   : 1b9050da66aba821fec18376bee30d17e91e7027    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Tue, 23 Aug 2022 09:24:32 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Tue, 23 Aug 2022 09:24:32 +0700    

Click here for diff

Peter Smith  
  
Discussion: https://www.postgresql.org/message-id/CAHut%2BPtRGVuj8Q_GpHHxZyk7fGwdYDG8_s4GSfKoc_4Yd9vR-w%40mail.gmail.com  

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

Make role grant system more consistent with other privileges.

commit   : ce6b672e4455820a0348214be0da1a024c3f619f    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Mon, 22 Aug 2022 11:35:17 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Mon, 22 Aug 2022 11:35:17 -0400    

Click here for diff

Previously, membership of role A in role B could be recorded in the  
catalog tables only once. This meant that a new grant of role A to  
role B would overwrite the previous grant. For other object types, a  
new grant of permission on an object - in this case role A - exists  
along side the existing grant provided that the grantor is different.  
Either grant can be revoked independently of the other, and  
permissions remain so long as at least one grant remains. Make role  
grants work similarly.  
  
Previously, when granting membership in a role, the superuser could  
specify any role whatsoever as the grantor, but for other object types,  
the grantor of record must be either the owner of the object, or a  
role that currently has privileges to perform a similar GRANT.  
Implement the same scheme for role grants, treating the bootstrap  
superuser as the role owner since roles do not have owners. This means  
that attempting to revoke a grant, or admin option on a grant, can now  
fail if there are dependent privileges, and that CASCADE can be used  
to revoke these. It also means that you can't grant ADMIN OPTION on  
a role back to a user who granted it directly or indirectly to you,  
similar to how you can't give WITH GRANT OPTION on a privilege back  
to a role which granted it directly or indirectly to you.  
  
Previously, only the superuser could specify GRANTED BY with a user  
other than the current user. Relax that rule to allow the grantor  
to be any role whose privileges the current user posseses. This  
doesn't improve compatibility with what we do for other object types,  
where support for GRANTED BY is entirely vestigial, but it makes this  
feature more usable and seems to make sense to change at the same time  
we're changing related behaviors.  
  
Along the way, fix "ALTER GROUP group_name ADD USER user_name" to  
require the same privileges as "GRANT group_name TO user_name".  
Previously, CREATEROLE privileges were sufficient for either, but  
only the former form was permissible with ADMIN OPTION on the role.  
Now, either CREATEROLE or ADMIN OPTION on the role suffices for  
either spelling.  
  
Patch by me, reviewed by Stephen Frost.  
  
Discussion: http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com  

M doc/src/sgml/ref/alter_group.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/revoke.sgml
M src/backend/commands/user.c
M src/backend/parser/gram.y
M src/backend/utils/adt/acl.c
M src/backend/utils/cache/syscache.c
M src/bin/pg_dump/pg_dumpall.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_auth_members.h
M src/include/utils/acl.h
M src/test/regress/expected/create_role.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/create_role.sql
M src/test/regress/sql/privileges.sql

Fix assertion failure in CREATE DATABASE

commit   : 36f729e2bc3539e777cda698dc441b8ccec42142    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 Aug 2022 15:31:50 +0200    

Click here for diff

An assertion would fail when creating a database with libc locale  
provider from a template database with icu locale provider.  
  
Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru>  
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/backend/commands/dbcommands.c
M src/bin/scripts/t/020_createdb.pl

doc: Minor wordsmithing to COPY docs

commit   : e2fe0aedd00eae89e6d00bca5c598d1ac31b266a    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 22 Aug 2022 15:08:45 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Mon, 22 Aug 2022 15:08:45 +0200    

Click here for diff

Perform some minor wordsmithing on two sentences in the COPY documentation  
to make them clearer.  
  
While there, also ensure to wrap a few occurrences of CSV in <literal>  
which were missing this.  
  
Reported-by: Eric Mutta <eric.mutta@gmail.com>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/166104548566.654.11680826843612576896@wrigleys.postgresql.org  

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

pg_upgrade: Fix thinko in database info acquisition routine

commit   : f0b013b0fc0a53de0ffe610b403125affb9c6094    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 22 Aug 2022 13:26:52 +0200    

Click here for diff

When checking whether the major version supports per-database locale  
providers, it was always looking at the version of the old cluster  
instead of the cluster that was passed in.  This would lead to  
failures to detect locale provider mismatches.  
  
Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru>  
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>  
Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e  

M src/bin/pg_upgrade/info.c

Remove configure probes for sockaddr_storage members.

commit   : 64ef572c068fde7cbba7f82cd50f51c0131ffe3b    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 22 Aug 2022 16:47:17 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Mon, 22 Aug 2022 16:47:17 +1200    

Click here for diff

Remove four probes for members of sockaddr_storage.  Keep only the probe  
for sockaddr's sa_len, which is enough for our two remaining places that  
know about _len fields:  
  
1.  ifaddr.c needs to know if sockaddr has sa_len to understand the  
result of ioctl(SIOCGIFCONF).  Only AIX is still using the relevant code  
today, but it seems like a good idea to keep it compilable on Linux.  
  
2.  ip.c was testing for presence of ss_len to decide whether to fill in  
sun_len in our getaddrinfo_unix() function.  It's just as good to test  
for sa_len.  If you have one, you have them all.  
  
(The code in #2 isn't actually needed at all on several OSes I checked  
since modern versions ignore sa_len on input to system calls.  Proving  
that's the case for all relevant OSes is left for another day, but  
wouldn't get rid of that last probe anyway if we still want it for #1.)  
  
Discussion: https://postgr.es/m/CA%2BhUKGJJjF2AqdU_Aug5n2MAc1gr%3DGykNjVBZq%2Bd6Jrcp3Dyvg%40mail.gmail.com  

M config/c-library.m4
M configure
M configure.ac
M src/common/ip.c
M src/include/libpq/pqcomm.h
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Use logical operator && instead of & in vacuumparallel.c.

commit   : 838f798f172d509f022841b82277ec84d108a379    
  
author   : Amit Kapila <akapila@postgresql.org>    
date     : Mon, 22 Aug 2022 08:53:58 +0530    
  
committer: Amit Kapila <akapila@postgresql.org>    
date     : Mon, 22 Aug 2022 08:53:58 +0530    

Click here for diff

As such the current usage of & won't produce incorrect results but it  
would be better to use && to short-circuit the evaluation of second  
condition when the same is not required.  
  
Author: Ranier Vilela  
Reviewed-by: Tom Lane, Bharath Rupireddy  
Backpatch-through: 15, where it was introduced  
Discussion: https://postgr.es/m/CAEudQApL8QcoYwQuutkWKY_h7gBY8F0Xs34YKfc7-G0i83K_pw@mail.gmail.com  

M src/backend/commands/vacuumparallel.c

Fix comment in walsender_private.h

commit   : 49e525a08fcb42c05dc27bd0bc36aa491becc55f    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 22 Aug 2022 10:02:53 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 22 Aug 2022 10:02:53 +0900    

Click here for diff

All the members of the stucture are protected by the spinlock WalSnd,  
but a comment referred to "replyTime" and "latch" as not being in the  
set of what gets protected, contrary to what walsender.c does.  
  
Author: Bharath Rupireddy  
Discussion: https://postgr.es/m/CALj2ACWE_7srye4_GZ=N=-rD=qr2WHL9GZrMnhWJOJ5RdnNS2A@mail.gmail.com  

M src/include/replication/walsender_private.h

Remove dummyret definition

commit   : 585d0cd944d952f08f7649d02f1d6b6644e93611    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 20 Aug 2022 20:48:47 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 20 Aug 2022 20:48:47 +0200    

Click here for diff

This hasn't been used in a while (last use removed by 50d22de932, and  
before that 84b6d5f359), and since we are now preferring inline  
functions over complex macros, it's unlikely to be needed again.  
  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Discussion: https://www.postgresql.org/message-id/flat/7110ab37-8ddd-437f-905c-6aa6205c6185%40enterprisedb.com  

M src/include/c.h

regress: allow to specify directory containing expected files, for ecpg

commit   : c855872074b5bf44ecea033674d22fac831cfc31    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Sat, 20 Aug 2022 10:59:01 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Sat, 20 Aug 2022 10:59:01 -0700    

Click here for diff

The ecpg tests have their input directory in the build directory, as the tests  
need to be built. Until now that required copying the expected/ directory to  
the build directory in VPATH builds. To avoid needing to implement the same  
for the meson build, add support for specifying the location of the expected  
directory.  
  
Now that that's not needed anymore, remove the copying of ecpg's expected  
directory to the build directory in VPATH builds.  
  
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>  
Author: Andres Freund <andres@anarazel.de>  
Reviewed-by: Andres Freund <andres@anarazel.de>  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: https://postgr.es/m/20220718202327.pspcqz5mwbi2yb7w@awork3.anarazel.de  

M src/interfaces/ecpg/test/Makefile
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h

Remove remaining mentions of UNSAFE_STAT_OK

commit   : 1509abe2c5da6002620718d18031f5b5234c15cd    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 20 Aug 2022 13:53:21 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Sat, 20 Aug 2022 13:53:21 +0200    

Click here for diff

The last use was removed by bed90759fcbcd72d4d06969eebab81e47326f9a2.  
  
Discussion: https://www.postgresql.org/message-id/flat/01229f9a-b358-d71e-31ae-4c0855d73cbc%40enterprisedb.com  

M src/interfaces/libpq/Makefile
M src/tools/msvc/Mkvcbuild.pm

Reduce warnings with -Wshadow=compatible-local builds

commit   : 92fce4e1eda9b24d73f583fbe9b58f4e03f097a4    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 20 Aug 2022 15:16:51 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 20 Aug 2022 15:16:51 +1200    

Click here for diff

In a similar effort to f01592f91, here we further reduce the warnings we  
get about local variables being shadowed when building with  
-Wshadow=compatible-local.  This small change reduces the overall number  
of warnings by 36.  
  
Discussion: https://postgr.es/m/CAApHDvqBBqF=wmV5azrO7h3VwpwQo+JFBQ+g=E6wVUhKcqR8gA@mail.gmail.com  

M src/test/regress/regress.c

Remove shadowed local variables that are new in v15

commit   : f01592f9157707c4de1f00a0e0dc5a7e8fa8f1d5    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Sat, 20 Aug 2022 11:40:44 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Sat, 20 Aug 2022 11:40:44 +1200    

Click here for diff

Compiling with -Wshadow=compatible-local yields quite a few warnings about  
local variables being shadowed by compatible local variables in an inner  
scope.  Of course, this is perfectly valid in C, but we have had bugs in  
the past as a result of developers failing to notice this.  af7d270dd is a  
recent example.  
  
Here we do a cleanup of warnings we receive from -Wshadow=compatible-local  
for code which is new to PostgreSQL 15.  We've yet to have the discussion  
about if we actually ever want to run that as a standard compilation flag.  
We'll need to at least get the number of warnings down to something easier  
to manage before we can realistically consider if we want this or not.  
This commit is the first step towards reducing the warnings.  
  
The changes being made here are all fairly trivial.  Because of that, and  
the fact that v15 is still in beta, this is being back-patched into 15.  
It seems more risky not to do this as the risk of future bugs is increased  
by the additional conflicts that this commit could cause for any future  
bug fixes touching the same areas as this commit.  
  
Author: Justin Pryzby  
Discussion: https://postgr.es/m/20220817145434.GC26426%40telsasoft.com  
Backpatch-through: 15  

M src/backend/backup/basebackup_target.c
M src/backend/parser/parse_jsontable.c
M src/backend/replication/logical/tablesync.c
M src/backend/utils/adt/jsonpath_exec.c
M src/bin/pg_dump/pg_dump.c

Avoid reltuples distortion in very small tables.

commit   : 3097bde7dd1d9e7b1127b24935e70ca4609e22b2    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 19 Aug 2022 09:26:08 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Fri, 19 Aug 2022 09:26:08 -0700    

Click here for diff

Consistently avoid trusting a sample of only one page at the point that  
VACUUM determines a new reltuples for the target table (though only when  
the table is larger than a single page).  This is follow-up work to  
commit 74388a1a, which added a heuristic to prevent reltuples from  
becoming distorted by successive VACUUM operations that each scan only a  
single heap page (which was itself more or less a bugfix for an issue in  
commit 44fa8488, which simplified VACUUM's handling of scanned pages).  
  
The original bugfix commit did not account for certain remaining cases  
that where not affected by its "2% of total relpages" heuristic.  This  
happened with relations that are small enough that just one of its pages  
exceeded the 2% threshold, yet still big enough for VACUUM to deem  
skipping most of its pages via the visibility map worthwhile.  reltuples  
could still become distorted over time with such a table, at least in  
scenarios where the VACUUM command is run repeatedly and without the  
table itself ever changing.  
  
Author: Peter Geoghegan <pg@bowt.ie>  
Discussion: https://postgr.es/m/CAH2-Wzk7d4m3oEbEWkWQKd+gz-eD_peBvdXVk1a_KBygXadFeg@mail.gmail.com  
Backpatch: 15-, where the rules for scanned pages changed.  

M src/backend/commands/vacuum.c

Move a definition inside a header file

commit   : 7d12693473eca4008c5c53bb36a5f083068a941b    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 Aug 2022 11:20:09 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Fri, 19 Aug 2022 11:20:09 +0200    

Click here for diff

Over time, this has ended up in a slightly inappropriate place  
relative to the comments around it.  

M src/include/utils/date.h

doc: Improve some markups and some wording around archiving modules

commit   : 31e121d4f7bb3aad7a26021cbc7cfb43a077c7e3    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Aug 2022 10:00:12 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Fri, 19 Aug 2022 10:00:12 +0900    

Click here for diff

This commit adds or fixes markups used in a couple of places in the docs  
(for <command>, <systemitem> and <literal>).  While on it, this  
clarifies some of the documentation added recently for archiving modules  
with archive_command, that would still be used as default choice if no  
external module is defined (though an archive module could as well use  
an archive_command).  
  
Author: Maxim Yablokov  
Discussion: https://postgr.es/m/b47ec4e8-6f6a-2aba-038e-d5db150b245e@postgrespro.ru  
Backpatch-through: 15  

M doc/src/sgml/adminpack.sgml
M doc/src/sgml/archive-modules.sgml
M doc/src/sgml/backup.sgml
M doc/src/sgml/basebackup-to-shell.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M doc/src/sgml/ref/psql-ref.sgml

Initialize index stats during parallel VACUUM.

commit   : 662ba729a67e5c6e43efbc5263e1d2c3a72a8741    
  
author   : Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 18 Aug 2022 17:34:14 -0700    
  
committer: Peter Geoghegan <pg@bowt.ie>    
date     : Thu, 18 Aug 2022 17:34:14 -0700    

Click here for diff

Initialize shared memory allocated for index stats to avoid a hard  
crash.  This was possible when parallel VACUUM became confused about the  
current phase of index processing.  
  
Oversight in commit 8e1fae1938, which refactored parallel VACUUM.  
  
Author: Masahiko Sawada <sawada.mshk@gmail.com>  
Reported-By: Justin Pryzby <pryzby@telsasoft.com>  
Discussion: https://postgr.es/m/20220818133406.GL26426@telsasoft.com  
Backpatch: 15-, the first version with the refactoring commit.  

M src/backend/commands/vacuumparallel.c

Use correct LSN for error reporting in pg_walinspect

commit   : d9fbb8862959912c5266364059c0abeda0c93bbf    
  
author   : Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 Aug 2022 14:23:30 -0700    
  
committer: Jeff Davis <jdavis@postgresql.org>    
date     : Thu, 18 Aug 2022 14:23:30 -0700    

Click here for diff

Usage of ReadNextXLogRecord()'s first_record parameter for error  
reporting isn't always correct. For instance, in GetWALRecordsInfo()  
and GetWalStats(), we're reading multiple records, and first_record  
is always passed as the LSN of the first record which is then used  
for error reporting for later WAL record read failures. This isn't  
correct.  
  
The correct parameter to use for error reports in case of WAL  
reading failures is xlogreader->EndRecPtr. This change fixes it.  
  
While on it, removed an unnecessary Assert in pg_walinspect code.  
  
Reported-by: Robert Haas  
Author: Bharath Rupireddy  
Reviewed-by: Robert Haas  
Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZAOGzPUifrcZRjFZ2vbtcw3mp-mN6UgEoEcQg6bY3OVg%40mail.gmail.com  
Backpatch-through: 15  

M contrib/pg_walinspect/pg_walinspect.c

Bump catversion for 6566133c5f52771198aca07ed18f84519fac1be7

commit   : 9288c2e6f8e6bb523f309dd413af1344962ebc6e    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 15:10:06 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 15:10:06 -0400    

Click here for diff

Omission noted by Tom Lane.  

M src/include/catalog/catversion.h

Don't add HAVE_LDAP_H HAVE_WINLDAP_H to pg_config.h

commit   : 4ab53b647abffb911bea35662ca4b22d788c25d4    
  
author   : Andres Freund <andres@anarazel.de>    
date     : Thu, 18 Aug 2022 10:41:42 -0700    
  
committer: Andres Freund <andres@anarazel.de>    
date     : Thu, 18 Aug 2022 10:41:42 -0700    

Click here for diff

They're not referenced, so we don't need them in in pg_config.h.  
  
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>  
Discussion: http://postgr.es/m/e0c44fb2-8b66-a4b9-b274-7ed3a1a0ab74@enterprisedb.com  

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

Ensure that pg_auth_members.grantor is always valid.

commit   : 6566133c5f52771198aca07ed18f84519fac1be7    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 13:13:02 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 13:13:02 -0400    

Click here for diff

Previously, "GRANT foo TO bar" or "GRANT foo TO bar GRANTED BY baz"  
would record the OID of the grantor in pg_auth_members.grantor, but  
that role could later be dropped without modifying or removing the  
pg_auth_members record. That's not great, because we typically try  
to avoid dangling references in catalog data.  
  
Now, a role grant depends on the grantor, and the grantor can't be  
dropped without removing the grant or changing the grantor.  "DROP  
OWNED BY" will remove the grant, just as it does for other kinds of  
privileges. "REASSIGN OWNED BY" will not, again just like what we do  
in other cases involving privileges.  
  
pg_auth_members now has an OID column, because that is needed in order  
for dependencies to work. It also now has an index on the grantor  
column, because otherwise dropping a role would require a sequential  
scan of the entire table to see whether the role's OID is in use as  
a grantor. That probably wouldn't be too large a problem in practice,  
but it seems better to have an index just in case.  
  
A follow-on patch is planned with the goal of more thoroughly  
rationalizing the behavior of role grants. This patch is just trying  
to do enough to make sure that the data we store in the catalogs is at  
some basic level valid.  
  
Patch by me, reviewed by Stephen Frost  
  
Discussion: http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com  

M doc/src/sgml/catalogs.sgml
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/system_views.sql
M src/backend/commands/alter.c
M src/backend/commands/event_trigger.c
M src/backend/commands/tablecmds.c
M src/backend/commands/user.c
M src/include/catalog/dependency.h
M src/include/catalog/pg_auth_members.h
M src/test/regress/expected/create_role.out
M src/test/regress/expected/privileges.out
M src/test/regress/sql/create_role.sql
M src/test/regress/sql/privileges.sql

Improve performance of adjust_appendrel_attrs_multilevel.

commit   : 2f17b57017e5f1993dbe0f389e01f1302a541196    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 12:36:06 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 12:36:06 -0400    

Click here for diff

The present implementations of adjust_appendrel_attrs_multilevel and  
its sibling adjust_child_relids_multilevel are very messy, because  
they work by reconstructing the relids of the child's immediate  
parent and then seeing if that's bms_equal to the relids of the  
target parent.  Aside from being quite inefficient, this will not  
work with planned future changes to make joinrels' relid sets  
contain outer-join relids in addition to baserels.  
  
The whole thing can be solved at a stroke by adding explicit parent  
and top_parent links to child RelOptInfos, and making these functions  
work with RelOptInfo pointers instead of relids.  Doing that is  
simpler for most callers, too.  
  
In my original version of this patch, I got rid of  
RelOptInfo.top_parent_relids on the grounds that it was now redundant.  
However, that adds a lot of code churn in places that otherwise would  
not need changing, and arguably the extra indirection needed to fetch  
top_parent->relids in those places costs something.  So this version  
leaves that field in place.  
  
Discussion: https://postgr.es/m/553080.1657481916@sss.pgh.pa.us  

M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/backend/partitioning/partprune.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/appendinfo.h

Adjust assertion in XLogDecodeNextRecord.

commit   : ec97db399f1eccda6652d44b99d5363728832eb7    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 12:15:55 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 12:15:55 -0400    

Click here for diff

As written, if you use XLogBeginRead() to position an xlogreader at  
the beginning of a WAL page and then try to read WAL, this assertion  
will fail. However, the header comment for XLogBeginRead() claims  
that positioning an xlogreader at the beginning of a page is valid,  
and the code here is perfectly able to cope with it. It's only the  
assertion that causes trouble. So relax it.  
  
This is formally a bug in all supported branches, but as it doesn't  
seem to have any consequences for current uses of the xlogreader  
facility, no back-patch, at least for now.  
  
Dilip Kumar and Robert Haas  
  
Discussion: http://postgr.es/m/CA+TgmoaJSs2_7WHW2GzFYe9+zfPtxBKvT3GW47+x=ptUE=cULw@mail.gmail.com  

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

Fix subtly-incorrect matching of parent and child partitioned indexes.

commit   : e6dbb48487faf47c1436d26064736a906f885a03    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 12:11:47 -0400    

Click here for diff

When creating a partitioned index, DefineIndex tries to identify  
any existing indexes on the partitions that match the partitioned  
index, so that it can absorb those as child indexes instead of  
building new ones.  Part of the matching is to compare IndexInfo  
structs --- but that wasn't done quite right.  We're comparing  
the IndexInfo built within DefineIndex itself to one made from  
existing catalog contents by BuildIndexInfo.  Notably, while  
BuildIndexInfo will run index expressions and predicates through  
expression preprocessing, that has not happened to DefineIndex's  
struct.  The result is failure to match and subsequent creation  
of duplicate indexes.  
  
The easiest and most bulletproof fix is to build a new IndexInfo  
using BuildIndexInfo, thereby guaranteeing that the processing done  
is identical.  
  
While here, let's also extract the opfamily and collation data  
from the new partitioned index, removing ad-hoc logic that  
duplicated knowledge about how those are constructed.  
  
Per report from Christophe Pettus.  Back-patch to v11 where  
we invented partitioned indexes.  
  
Richard Guo and Tom Lane  
  
Discussion: https://postgr.es/m/8864BFAA-81FD-4BF9-8E06-7DEB8D4164ED@thebuild.com  

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

When using the WAL-logged CREATE DATABASE strategy, bulk extend.

commit   : 3e63e8462f31657c8ae1c541c92daf43ede8f038    
  
author   : Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    
  
committer: Robert Haas <rhaas@postgresql.org>    
date     : Thu, 18 Aug 2022 11:09:39 -0400    

Click here for diff

This should improve performance, and was suggested by Andres Freund.  
Back-patch to v15 to keep the code consistent across branches.  
  
Dilip Kumar  
  
Discussion: http://postgr.es/m/C3458199-FEDD-4356-865A-08DFAA5D4065@anarazel.de  
Discussion: http://postgr.es/m/CAFiTN-sJ0vVpJrZ=R5M+g7Tr8=NN4wKOtrqOcDEsfFfnZgivVA@mail.gmail.com  

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

Remove unused configure variable.

commit   : 27f1774aac1f8ffe642b55e78dbe0b64ed082cc6    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 11:22:13 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Thu, 18 Aug 2022 11:22:13 -0400    

Click here for diff

configure extracts TCL_SHLIB_LD_LIBS from tclConfig.sh, and puts the  
value into Makefile.global, but then we never use it anywhere.  It  
looks like I removed the only usage in cd75f94da, but didn't notice  
that it was the only usage.  Might as well mop this up while we're  
trying to get rid of unnecessary configure steps.  
  
Discussion: https://postgr.es/m/2442359.1660835043@sss.pgh.pa.us  

M configure
M configure.ac
M src/Makefile.global.in

Simplify and clarify an error message

commit   : 08909e3aee6182a988da5bf5c1b543910ee096c7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Thu, 18 Aug 2022 11:33:53 +0200    

Click here for diff

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

mstcpip.h is not missing on MinGW.

commit   : f340f97a13b1455349ee27550623179c018fa036    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:21:24 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:21:24 +1200    

Click here for diff

Remove a small difference between MinGW and MSVC builds which isn't  
needed for modern MinGW, noticed in passing.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

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

Remove configure probe for netinet/tcp.h.

commit   : 2492fe49dcb534844d9eece97504b4caca1d81ae    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:17:13 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:17:13 +1200    

Click here for diff

<netinet/tcp.h> is in SUSv3 and all targeted Unix systems have it.  
For Windows, we can provide a stub include file, to avoid some #ifdef  
noise.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/pqcomm.c
M src/common/ip.c
M src/include/libpq/libpq-be.h
M src/include/pg_config.h.in
A src/include/port/win32/netinet/tcp.h
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/tools/msvc/Solution.pm

Fix macro problem with gai_strerror on Windows.

commit   : cce28f62680ca77f18762d58bc31f6b67c6ef692    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:16:00 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:16:00 +1200    

Click here for diff

Commit 5579388d was confused about why gai_strerror() didn't work, and  
used gai_strerrorA().  It turns out that we had explicitly undefined  
Windows' own macro for that somewhere else.  Get rid of all that, and  
use the system headers' definition of gai_sterror() directly as  
intended.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M src/include/port/win32/netdb.h
M src/include/port/win32/sys/socket.h

Remove configure probe for sys/sockio.h.

commit   : 2cea02fb85b9b00c3b95d8cd0e39cf91cd2ce289    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:12:20 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:12:20 +1200    

Click here for diff

On BSD-family systems, header <sys/sockio.h> defines socket ioctl  
numbers like SIOCGIFCONF.  Only AIX is using those now, but it defines  
them in <net/if.h> anyway.  
  
Supposing some PostgreSQL hacker wants to test that AIX-only code path  
on a more common development system by pretending not to have  
getifaddrs().  It's enough to include <sys/ioctl.h>, at least on macOS,  
FreeBSD and Linux, and we're already doing that.  

M configure
M configure.ac
M src/backend/libpq/ifaddr.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove configure probe for net/if.h.

commit   : 2f8d918359ccb34533690735eb46b851002ac698    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:11:58 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:11:58 +1200    

Click here for diff

<net/if.h> is in SUSv3 and all targeted Unixes have it.  It's used in a  
region that is already ifdef'd out for Windows.  We're not using it for  
any standard definitions, but it's where AIX defines conventional socket  
ioctl numbers.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M configure
M configure.ac
M src/backend/libpq/ifaddr.c
M src/include/pg_config.h.in
M src/tools/msvc/Solution.pm

Remove dead ifaddr.c fallback code.

commit   : a717cddcac518162cc17bae3c68a492db9ab2e75    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:08:02 +1200    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Thu, 18 Aug 2022 16:08:02 +1200    

Click here for diff

We carried a special implementation of pg_foreach_ifaddr() using  
Solaris's ioctl(SIOCGLIFCONF), but Solaris 11 and illumos adopted  
getifaddrs() more than a decade ago, and we prefer to use that.  Solaris  
10 is EOL'd.  Remove the dead code.  
  
Adjust comment about which OSes have getifaddrs(), which also  
incorrectly listed AIX.  AIX is in fact the only Unix in the build farm  
that *doesn't* have it today, so the implementation based on  
ioctl(SIOCGIFCONF) (note, no 'L') is still live.  All the others have  
had it for at least one but mostly two decades.  
  
The last-stop fallback at the bottom of the file is dead code in  
practice, but it's hard to justify removing it because the better  
options are all non-standard.  
  
Discussion: https://postgr.es/m/CA+hUKGKErNfhmvb_H0UprEmp4LPzGN06yR2_0tYikjzB-2ECMw@mail.gmail.com  

M src/backend/libpq/ifaddr.c

Update comment in gramparse.h

commit   : 3f5dbcb5fe0bd68df7e5de5e95e10b3b892c43b2    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 18 Aug 2022 09:45:05 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 18 Aug 2022 09:45:05 +0700    

Click here for diff

src/common/keywords.c hasn't included this header since afb0d0712.  

M src/include/parser/gramparse.h

Refer to replication origin roident as "ID" in user facing messages and docs

commit   : c920fe48181d81ce218faa746f8af92c41d03b2e    
  
author   : John Naylor <john.naylor@postgresql.org>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    
  
committer: John Naylor <john.naylor@postgresql.org>    
date     : Thu, 18 Aug 2022 08:57:13 +0700    

Click here for diff

The table column that stores this is of type oid, but is actually limited  
to uint16 and has a different path for creating new values. Some of  
the documentation already referred to it as an ID, so let's standardize  
on that.  
  
While at it, most format strings already use %u, so for consintency  
change the remaining stragglers using %d.  
  
Per suggestions from Tom Lane and Justin Pryzby  
Discussion: https://www.postgresql.org/message-id/3437166.1659620465%40sss.pgh.pa.us  
Backpatch to v15  

M doc/src/sgml/replication-origins.sgml
M src/backend/replication/logical/origin.c

Fix hypothetical problem passing the wrong GROUP BY pathkeys

commit   : af7d270dd3c7523dad023f5761f630daa7fb2730    
  
author   : David Rowley <drowley@postgresql.org>    
date     : Thu, 18 Aug 2022 11:32:55 +1200    
  
committer: David Rowley <drowley@postgresql.org>    
date     : Thu, 18 Aug 2022 11:32:55 +1200    

Click here for diff

1349d2790 changed things to make the planner request that the  
query_pathkeys contain pathkeys for any ORDER BY / DISTINCT aggregates.  
Some code added prior to that commit in db0d67db2 made it so the order  
that the pathkeys appear in the group_pathkeys could be changed so that  
the GROUP BY could be executed in a more optimal order which minimized  
sort comparisons.  1349d2790 had to make sure that the pathkeys for any  
ORDER BY / DISTINCT aggregates remained at the end of the groupby_pathkeys  
and wasn't reordered, so some code was added to  
add_paths_to_grouping_rel() to first strip off any pathkeys belonging to  
ORDER BY / DISTINCT aggregates before passing to the function to optimize  
the order of the group_pathkeys.  
  
It seems I dropped the ball in 1349d2790 and mistakenly used the untouched  
PlannerInfo.group_pathkeys to pass to get_useful_group_keys_orderings()  
instead of the version that had the aggregate pathkeys removed.  It was  
only the code path that was handling creating paths for  
partially_grouped_rel which made this mistake.  In practice, we'll never  
have any extra pathkeys to strip off when processing  
partially_grouped_rel as that's only used when considering partial  
paths, which we never do when there are ORDER BY / DISTINCT aggregates.  
So this is just a hypothetical bug, not a live bug.  We already have the  
correct pathkeys determined, so it's of no extra cost to pass the  
correct variable.  
  
Reported-by: Justin Pryzby  
Discussion: https://postgr.es/m/20220817015755.GB26426@telsasoft.com  

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

doc: Add a note on PO editors

commit   : a340359a4f9bed54e0af67dd90050c13e0976fb6    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 23:41:56 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 23:41:56 +0200    

Click here for diff

While PO files can be edited in any text editor, specialized tools for  
translation editing can be quite helpful with automating tasks etc. Add  
a small note about PO editors to encourage new translators to research  
which tool works best for them.  
  
Reviewed-by: Bruce Momjian <bruce@momjian.us>  
Discussion: https://postgr.es/m/163490116698.684.10398197970578456928@wrigleys.postgresql.org  

M doc/src/sgml/nls.sgml

Refactor addition of PlaceHolderVars to joinrel targetlists.

commit   : afa0ec30bfd18611ec5bc4dfa394dc8838aece21    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 16:12:23 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 16:12:23 -0400    

Click here for diff

Make build_joinrel_tlist() responsible for adding PHVs that were  
already computed in one or the other input relation, and therefore  
change add_placeholders_to_joinrel() to only add PHVs that will be  
newly computed in this joinrel's output.  This makes the handling  
of PHVs in build_joinrel_tlist() more like its handling of plain  
Vars, which seems like a good thing on intelligibility grounds  
and will simplify planned future changes.  There is a purely  
cosmetic side-effect that the order of entries in the joinrel's  
tlist may change; but since it becomes more like the order of  
entries in the input tlists, that's not bad.  
  
The reason it wasn't done like this originally was the potential  
cost of looking up PlaceHolderInfo entries to consult ph_needed.  
Now that that's O(1) it shouldn't hurt.  
  
Discussion: https://postgr.es/m/1405792.1660677844@sss.pgh.pa.us  

M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/relnode.c
M src/test/regress/expected/join.out

Use an explicit state flag to control PlaceHolderInfo creation.

commit   : b3ff6c742f6c7f750e9f74476576839cb039e1ab    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 15:52:53 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 15:52:53 -0400    

Click here for diff

Up to now, callers of find_placeholder_info() were required to pass  
a flag indicating if it's OK to make a new PlaceHolderInfo.  That'd  
be fine if the callers had free choice, but they do not.  Once we  
begin deconstruct_jointree() it's no longer OK to make more PHIs;  
while callers before that always want to create a PHI if it's not  
there already.  So there's no freedom of action, only the opportunity  
to cause bugs by creating PHIs too late.  Let's get rid of that in  
favor of adding a state flag PlannerInfo.placeholdersFrozen, which  
we can set at the point where it's no longer OK to make more PHIs.  
  
This patch also simplifies a couple of call sites that were using  
complicated logic to avoid calling find_placeholder_info() as much  
as possible.  Now that that lookup is O(1) thanks to the previous  
commit, the extra bitmap manipulations are probably a net negative.  
  
Discussion: https://postgr.es/m/1405792.1660677844@sss.pgh.pa.us  

M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/placeholder.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/planmain.h

Make PlaceHolderInfo lookup O(1).

commit   : 6569ca43973b754e8213072c8ddcae9e7baf2aaa    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 15:35:51 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 15:35:51 -0400    

Click here for diff

Up to now we've just searched the placeholder_list when we want to  
find the PlaceHolderInfo with a given ID.  While there's no evidence  
of that being a problem in the field, an upcoming patch will add  
find_placeholder_info() calls in build_joinrel_tlist(), which seems  
likely to make it more of an issue: a joinrel emitting lots of  
PlaceHolderVars would incur O(N^2) cost, and we might be building  
a lot of joinrels in complex queries.  Hence, add an array that  
can be indexed directly by phid to make the lookups constant-time.  
  
Discussion: https://postgr.es/m/1405792.1660677844@sss.pgh.pa.us  

M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/var.c
M src/include/nodes/pathnodes.h

Avoid using list_length() to test for empty list.

commit   : efd0c16becbf45e3b0215e124fde75fee8fcbce4    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 11:12:35 -0400    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Wed, 17 Aug 2022 11:12:35 -0400    

Click here for diff

The standard way to check for list emptiness is to compare the  
List pointer to NIL; our list code goes out of its way to ensure  
that that is the only representation of an empty list.  (An  
acceptable alternative is a plain boolean test for non-null  
pointer, but explicit mention of NIL is usually preferable.)  
  
Various places didn't get that memo and expressed the condition  
with list_length(), which might not be so bad except that there  
were such a variety of ways to check it exactly: equal to zero,  
less than or equal to zero, less than one, yadda yadda.  In the  
name of code readability, let's standardize all those spellings  
as "list == NIL" or "list != NIL".  (There's probably some  
microscopic efficiency gain too, though few of these look to be  
at all performance-critical.)  
  
A very small number of cases were left as-is because they seemed  
more consistent with other adjacent list_length tests that way.  
  
Peter Smith, with bikeshedding from a number of us  
  
Discussion: https://postgr.es/m/CAHut+PtQYe+ENX5KrONMfugf0q6NHg4hR5dAhqEXEc2eefFeig@mail.gmail.com  

M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_depend.c
M src/backend/commands/event_trigger.c
M src/backend/commands/functioncmds.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/typecmds.c
M src/backend/executor/execPartition.c
M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/partitioning/partprune.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/statistics/mcv.c
M src/backend/storage/lmgr/lmgr.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/tsquery.c
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c

doc: Consistently spell case-insensitive

commit   : 4a319fce7671ffbe2a730f79529b7a2ef3794d41    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 10:05:03 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 10:05:03 +0200    

Click here for diff

While almost all occurrences of "case-insensitive{ly}" were spelled with  
a dash, a few were using "case insensitive{ly}" with a space instead. Fix  
by changing these to use a dash to be consistent.  
  
Discussion: https://postgr.es/m/7657EDEE-5EE2-4AAB-BA95-47B4F71653E1@yesql.se  

M doc/src/sgml/func.sgml
M doc/src/sgml/query.sgml
M doc/src/sgml/syntax.sgml

doc: Document pg_trgm being case-insensitive by default

commit   : 3e7d94fca0e5ad8835b0f2b1a584c83ea11ce439    
  
author   : Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 09:56:02 +0200    
  
committer: Daniel Gustafsson <dgustafsson@postgresql.org>    
date     : Wed, 17 Aug 2022 09:56:02 +0200    

Click here for diff

pg_trgm is by default operating case-insensitively but the docs didn't  
mention that at all.  
  
Author: Erik Rijkers <er@xs4all.nl>  
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>  
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>  
Reported-by: marcmaiwald@googlemail.com  
Discussion: https://postgr.es/m/166064504415.652.12724576876807446945@wrigleys.postgresql.org  

M doc/src/sgml/pgtrgm.sgml

Use SetInstallXLogFileSegmentActive() in more places in xlog.c

commit   : d265cd202961c240a2875826ca47822b54f74db5    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Aug 2022 15:28:45 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Aug 2022 15:28:45 +0900    

Click here for diff

This reduces the code paths where XLogCtl->InstallXLogFileSegmentActive  
is directly touched, and this wrapper function does the same thing as  
the original code replaced by the function call.  
  
Author: Bharath Rupireddy  
Reviewed-by: Nathan Bossart  
Discussion: https://postgr.es/m/CALj2ACVhkf-bC5CX-=6iBUfkO5GqmBntQH+m=HpY0iQ=-g1pRg@mail.gmail.com  

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

Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW

commit   : 93f2349c36a7555a81d5e26edf9a0213fb3d323a    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Aug 2022 14:55:20 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Wed, 17 Aug 2022 14:55:20 +0900    

Click here for diff

This event can happen when using SET ACCESS METHOD, as the data files of  
the materialized need a full refresh